Skip to content

HDDS-15716. Replace layout version protos with new version-named protos in the DN–SCM protocol#10817

Open
dombizita wants to merge 2 commits into
apache:HDDS-14496-zdufrom
dombizita:HDDS-15716
Open

HDDS-15716. Replace layout version protos with new version-named protos in the DN–SCM protocol#10817
dombizita wants to merge 2 commits into
apache:HDDS-14496-zdufrom
dombizita:HDDS-15716

Conversation

@dombizita

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

The current proto uses the old terminology in the names. We will have one non-rolling upgrade before ZDU is released where we can deprecate this proto and switch to a new one without any extra compatibility handling.

In this patch I switched LayoutVersionProto to DatanodeVersionProto and FinalizeNewLayoutVersionCommandProto to FinalizeNewDatanodeVersionCommandProto.

What is the link to the Apache JIRA

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

How was this patch tested?

Green CI on my fork: https://github.com/dombizita/ozone/actions/runs/29577100863

Used Claude Opus 4.8 for the refactoring, review and adjustments by me.

@dombizita
dombizita requested a review from errose28 July 20, 2026 08:12
@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 20, 2026

@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. Most comments are minor, but there's some improvements we can do to existing behavior as well.

Comment on lines +91 to +92
* Replaces LayoutVersionProto, using the versioning terminology of
* ComponentVersionManager: apparentVersion and softwareVersion.

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.

Suggested change
* Replaces LayoutVersionProto, using the versioning terminology of
* ComponentVersionManager: apparentVersion and softwareVersion.
* Used by Datanodes to report their versions to SCM.

Comment on lines +80 to +83
*
* Deprecated, please use DatanodeVersionProto instead. The field names
* metadataLayoutVersion and softwareLayoutVersion have been replaced by
* apparentVersion and softwareVersion respectively.

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.

Let's make the deprecation message the first thing in the comment.

* Replaces FinalizeNewLayoutVersionCommandProto.
*/
message FinalizeNewDatanodeVersionCommandProto {
required bool finalizeNewDatanodeVersion = 1 [default = false];

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.

This field is not needed, even in the old version. Sending the command is enough to instruct the DN to finalize without needing a separate flag to make it active.

message FinalizeNewDatanodeVersionCommandProto {
required bool finalizeNewDatanodeVersion = 1 [default = false];
optional DatanodeVersionProto datanodeVersion = 2;
required int64 cmdId = 3;

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.

Other commands have this required but for new fields we should be using optional for everything, so IMO this should be optional too.

/**
* This command asks the DataNode to finalize a new layout version.
*
* Deprecated, please use FinalizeNewDatanodeVersionCommandProto instead, which

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.

Again let's make the deprecation message the first thing in the comment.

Comment on lines +529 to +530
* This command asks the DataNode to finalize a new datanode version.
* Replaces FinalizeNewLayoutVersionCommandProto.

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.

IMO better to have the deprecated command point forward to the new one than the new one point back to the deprecated one.

Suggested change
* This command asks the DataNode to finalize a new datanode version.
* Replaces FinalizeNewLayoutVersionCommandProto.
* This command asks the Datanode to finalize a new datanode version.

((FinalizeVersionCommand) command).getProto();
try {
if (finalizeCommand.getFinalizeNewLayoutVersion()) {
if (finalizeCommand.getFinalizeNewDatanodeVersion()) {

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.

We should probably add a check that DN and SCM software versions match here, the open question is what to do about it. I'm currently thinking we should crash the node, since there's already safeguards checking versions when the DN registers and before SCM finalizes itself. With those in place it shouldn't even be possible to hit this code block so I think we can be defensive.

*/
message FinalizeNewDatanodeVersionCommandProto {
required bool finalizeNewDatanodeVersion = 1 [default = false];
optional DatanodeVersionProto datanodeVersion = 2;

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.

I know the old command had this, but it's not intuitive what is supposed to go here. Is it for SCM to send the expected datanode software and apparent version it wants this node to be on? In that case the values will always be the same. I'm wondering if we should just replace this with an expected software version field so the DN can double check before going through with finalization.

*/
public static class LayoutReportFromDatanode
extends ReportFromDatanode<LayoutVersionProto> {
public static class VersionReportFromDatanode

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.

Looks like this is unused. I'm not sure what its original purpose was but we can remove it.

LayoutVersionProto versionInfo = null;
if (!heartbeat.hasDataNodeLayoutVersion()) {
DatanodeVersionProto versionInfo = null;
if (!heartbeat.hasDatanodeVersion()) {

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.

I don't know why this block was put here in the original framework. There's a similar one in StorageContainerDatanodeProtocolServerSideTranslatorPB#register. It only makes sense if you can ZDU between a version that doesn't support reporting versions and one that does, which has never been possible. This will still be true going forward since we have to use a non-rolling upgrade to get to this ZDU version first.

For registering, we can make SCMNodeManager#shouldFenceDatanode null safe so we get a node not permitted error when a node tries to register with no version info.

On heartbeats we can choose to call processVersionReport only when a version is attached. Technically it is the "last known version" so it doesn't need to be in every heartbeat, even though it is expected based on all existing datanode implementations.

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.

Both type changes in this file can have their corresponding variable renamed too.

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