Skip to content

HDDS-15715. Add helpful CLI flags to finalization CLIs#10678

Open
dombizita wants to merge 11 commits into
apache:HDDS-14496-zdufrom
dombizita:HDDS-15715
Open

HDDS-15715. Add helpful CLI flags to finalization CLIs#10678
dombizita wants to merge 11 commits into
apache:HDDS-14496-zdufrom
dombizita:HDDS-15715

Conversation

@dombizita

@dombizita dombizita commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

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 time
  • status --json: json version of the status output for scripting
  • status --verbose: includes internal information like OM and SCM apparent versions, the min and max DN apparent versions in the cluster

Used 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

@github-actions github-actions Bot added the zdu Pull requests for Zero Downtime Upgrade (ZDU) https://issues.apache.org/jira/browse/HDDS-14496 label Jul 6, 2026
@errose28
errose28 self-requested a review July 7, 2026 18:42

@errose28 errose28 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this @dombizita.

Comment thread hadoop-hdds/interface-client/src/main/proto/hdds.proto Outdated
@errose28

Copy link
Copy Markdown
Contributor

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 errose28 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@dombizita

Copy link
Copy Markdown
Contributor Author

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.

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 errose28 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functionality LGTM, just some comments on the protos.

Comment thread hadoop-hdds/interface-client/src/main/proto/hdds.proto
Comment thread hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto Outdated
Comment thread hadoop-hdds/interface-client/src/main/proto/hdds.proto Outdated
@dombizita

Copy link
Copy Markdown
Contributor Author

Thanks for the review comments @errose28, I like the renaming and ordering of the protos, addressed everything in the latest commit.

@errose28 errose28 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@errose28

Copy link
Copy Markdown
Contributor

Test failure is not related to this change. I documented it in https://issues.apache.org/jira/browse/HDDS-15966 and amrunning the fix 100 times on my fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

zdu Pull requests for Zero Downtime Upgrade (ZDU) https://issues.apache.org/jira/browse/HDDS-14496

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants