HDDS-15715. Add helpful CLI flags to finalization CLIs#10678
HDDS-15715. Add helpful CLI flags to finalization CLIs#10678dombizita wants to merge 11 commits into
Conversation
errose28
left a comment
There was a problem hiding this comment.
Thanks for adding this @dombizita.
|
Thanks for the updates. Can you check on the CI failures? This should re-run against the base branch as well since we just merged from master. |
errose28
left a comment
There was a problem hiding this comment.
Thanks for the updates. Left some more comments.
Also here is an AI generated test we can add to cover the case of RPC failure during the wait loop. This assumes the desired behavior in this case is to exit the loop though, which I'm not sure is the case. It might be better to adjust the wait loop to print to stderr when this happens and retry automatically on the next interval, and update this test accordingly.
diff --git a/hadoop-ozone/cli-admin/src/test/java/org/apache/hadoop/ozone/admin/upgrade/TestFinalizeSubCommand.java b/hadoop-ozone/cli-admin/src/test/java/org/apache/hadoop/ozone/admin/upgrade/TestFinalizeSubCommand.java
index e6e3a5ed48..70bf533b11 100644
--- a/hadoop-ozone/cli-admin/src/test/java/org/apache/hadoop/ozone/admin/upgrade/TestFinalizeSubCommand.java
+++ b/hadoop-ozone/cli-admin/src/test/java/org/apache/hadoop/ozone/admin/upgrade/TestFinalizeSubCommand.java
@@ -169,6 +169,18 @@ public void testWaitFlagPollsUntilFinalized() throws Exception {
verify(omClient, times(3)).queryUpgradeStatus();
}
+ @Test
+ public void testWaitFlagRpcFailurePrintsMessageAndReturnsNonZero() throws Exception {
+ when(omClient.queryUpgradeStatus()).thenThrow(new IOException("RPC timeout"));
+
+ new CommandLine(cmd).parseArgs("--wait");
+ assertEquals(1, cmd.call());
+
+ String errOutput = errContent.toString(DEFAULT_ENCODING);
+ assertTrue(errOutput.contains("Failed to query upgrade status"));
+ assertTrue(errOutput.contains("RPC timeout"));
+ }
+
@Test
public void testWaitFlagInterruptIsHandledCleanly() throws Exception {
// Make the poll interval long enough that the interrupt lands during the sleep (after the first poll).
Conflicts: hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/OMUpgradeTestUtils.java
Thanks for the review, addressed the review comments in latest commit. I added the retry and print to stderr if there is a failed status query and adjusted the test case for this way. |
errose28
left a comment
There was a problem hiding this comment.
Functionality LGTM, just some comments on the protos.
|
Thanks for the review comments @errose28, I like the renaming and ordering of the protos, addressed everything in the latest commit. |
errose28
left a comment
There was a problem hiding this comment.
LGTM, but the latest CI failure is concerning. I'm not sure if it's related to this patch, but is at least related to branch. I'm investigating now.
|
Test failure is not related to this change. I documented it in https://issues.apache.org/jira/browse/HDDS-15966 and am running the fix 100 times on my fork. |
What changes were proposed in this pull request?
Added new CLI flags to the upgrade finalization CLI:
finalize --wait: the client will periodically poll the cluster for status from OM until the whole cluster is finalized. The finalize command is idempotent so waiting can be resumed at any timestatus --json: json version of the status output for scriptingstatus --verbose: includes internal information like OM and SCM apparent versions, the min and max DN apparent versions in the clusterUsed Claude Opus 4.8 for planning and coding, reviewed by me.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15715
How was this patch tested?
Added unit tests, green run on my fork: https://github.com/dombizita/ozone/actions/runs/28660447709