Skip to content

HDDS-14940. Create skeleton for ozone admin upgrade status command#10011

Open
sodonnel wants to merge 2 commits intoapache:HDDS-14496-zdufrom
sodonnel:HDDS-14940
Open

HDDS-14940. Create skeleton for ozone admin upgrade status command#10011
sodonnel wants to merge 2 commits intoapache:HDDS-14496-zdufrom
sodonnel:HDDS-14940

Conversation

@sodonnel
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Create the skeleton for a new upgrade command ozone admin upgrade status, which will eventually replace the existing commands. This initial version will connect to SCM and pull a placeholder response. The logic to actually query the SCM status will be added in followup PRs.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-14940

How was this patch tested?

Tested manually in docker to prove the command is wired up correctly. Tests can be added when we have real functionality in the command to test.

@github-actions github-actions bot added the zdu Pull requests for Zero Downtime Upgrade (ZDU) https://issues.apache.org/jira/browse/HDDS-14496 label Mar 31, 2026
Copy link
Copy Markdown
Contributor

@adoroszlai adoroszlai left a comment

Choose a reason for hiding this comment

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

Thanks @sodonnel for the patch.

Comment on lines +430 to +433
required bool scmFinalized = 1;
required int32 numDatanodesFinalized = 2;
required int32 numDatanodesTotal = 3;
required bool shouldFinalize = 4;
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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is a new object - shouldn't all its fields be required as we have no backward compatibility issue here - nothing else can be using this object?

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.

It's about backward compatibility of a future version of the software. From the docs I linked:

required must not be used for new fields. Semantics for required fields should be implemented at the application layer instead

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK - this probably should be communicated more widely, as it seems that the established pattern is now not to be followed, and I suspect many people don't know this. The current definition file is also full of required fields.

Comment on lines +45 to +49
System.out.println("Update status:");
System.out.println(" SCM Finalized: " + status.getScmFinalized());
System.out.println(" Datanodes finalized: " + status.getNumDatanodesFinalized());
System.out.println(" Total Datanodes: " + status.getNumDatanodesTotal());
System.out.println(" Should Finalize: " + status.getShouldFinalize());
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.

nit: please use out() (inherited from AbstractSubcommand) instead of System.out.

*/
@CommandLine.Command(
name = "status",
description = "Upgrade status of the cluster",
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.

nit:

Suggested change
description = "Upgrade status of the cluster",
description = "Show status of cluster upgrade",

*/
@CommandLine.Command(
name = "upgrade",
description = "Upgrade specific operations",
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.

nit:

Suggested change
description = "Upgrade specific operations",
description = "Operations related to cluster upgrade",

Comment on lines +1163 to +1170
return HddsProtos.UpgradeStatus.newBuilder()
.setScmFinalized(true)
.setNumDatanodesFinalized(10)
.setNumDatanodesTotal(10)
.setShouldFinalize(true)
.build();
} catch (IOException ex) {
AUDIT.logReadFailure(buildAuditMessageForFailure(SCMAction.QUERY_UPGRADE_STATUS, auditMap, ex));
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.

AUDIT.logReadSuccess is missing. Should be something like:

HddsProtos.UpgradeStatus response = ...
AUDIT.logReadSuccess(...)
return response

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