HDDS-15172. Add validation tests and logging cleanup for Ozone Iceberg RewriteTablePath action.#10187
HDDS-15172. Add validation tests and logging cleanup for Ozone Iceberg RewriteTablePath action.#10187slfan1989 wants to merge 2 commits intoapache:masterfrom
Conversation
…g RewriteTablePath action.
sreejasahithi
left a comment
There was a problem hiding this comment.
Thanks @slfan1989 for adding the additional tests
| @Test | ||
| void executeRejectsMissingLocationPrefix() { | ||
| NullPointerException exception = assertThrows(NullPointerException.class, | ||
| () -> new RewriteTablePathOzoneAction(table) | ||
| .stagingLocation(stagingDir.toString() + "/") | ||
| .execute()); | ||
|
|
||
| assertEquals("Source prefix is null", exception.getMessage()); | ||
| } |
There was a problem hiding this comment.
This does not need to be checked because when we add the CLI HDDS-14946 the source and target prefix would be required fields so they can not be missing.
And once the CLI is added , the source and target prefix will be set before calling the action.
rewriteLocationPrefix is always called by the CLI before execute(), then sourcePrefix will never be null in practice, and the test adds no real value to it.
There was a problem hiding this comment.
Updating my earlier comment: while the CLI will enforce that source and target prefixes are set, I think it would be fine to keep this null check and the test as a defensive safeguard. It protects against misuse outside the CLI path and makes the contract of execute() clearer.
There was a problem hiding this comment.
@sreejasahithi That makes sense. I kept this as a defensive check for possible non-CLI callers, and to make the execute() contract a bit clearer.
| String stagingPath = RewriteTablePathUtil.stagingPath(versionFilePath, sourcePrefix, stagingDir); | ||
|
|
||
| System.out.println("Processing version file " + versionFilePath); | ||
| LOG.info("Processing version file {}", versionFilePath); |
There was a problem hiding this comment.
LOG.info will cause noise in the command output with the additional information as follows
2026-05-05 12:00:01,000 [main] INFO RewriteTablePathOzoneAction: Processing version file v4.metadata.json
2026-05-05 12:00:01,050 [main] INFO RewriteTablePathOzoneAction: Processing version file v3.metadata.json
There was a problem hiding this comment.
Thanks for pointing this out. I will change this to DEBUG so it does not add noise to the default command output, while still keeping the information available when debug logging is enabled.
…g RewriteTablePath action.
What changes were proposed in this pull request?
This PR improves validation coverage for the Ozone Iceberg
RewriteTablePathaction and replaces direct console output with SLF4J logging.The Ozone Iceberg
RewriteTablePathOzoneActionalready validates several user-provided inputs, such as source/target prefixes and metadata version names. However, some validation paths were not covered by unit tests. In particular, executing the action without configuring the source and target prefixes previously resulted in a raw JVMNullPointerExceptionmessage instead of the existing validation helper's clearer error message.This PR proposes the following changes:
RewriteTablePathOzoneActioninputs:execute().System.out.printlncall inRewriteTablePathOzoneActionwith SLF4J logging.These changes make the Iceberg rewrite path action easier to validate and keep logging consistent with the rest of the Ozone codebase.
What is the link to the Apache JIRA
HDDS-15172. Add validation tests and logging cleanup for Ozone Iceberg RewriteTablePath action.
How was this patch tested?