Skip to content

HDDS-16386. NodeDecommissionManager should read maintenance replica config from ReplicationManagerConfiguration - #11271

Open
navinko wants to merge 6 commits into
apache:masterfrom
navinko:HDDS-16386
Open

navinko wants to merge 6 commits into
apache:masterfrom
navinko:HDDS-16386

Conversation

@navinko

@navinko navinko commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

NodeDecommissionManager was reading the two maintenance settings as keys with hardcoded default values:

setMaintenanceConfigs(config.getInt("hdds.scm.replication.maintenance.replica.minimum", 2),
 config.getInt("hdds.scm.replication.maintenance.remaining.redundancy", 1));

Those keys and defaults (2 and 1) are already defined in ReplicationManager.ReplicationManagerConfiguration, so they were duplicated in two places. Since the constructor already receives the ReplicationManager instance, this PR reads them from rm.getConfig(), making ReplicationManagerConfiguration the single source of truth.

What is the link to the Apache JIRA

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

How was this patch tested?

#Added new unit test -
TestNodeDecommissionManager#testMaintenanceConfigsReadFromReplicationManagerConfiguration — verifies the values comes from ReplicationManagerConfiguration.
#Updated existing unit test -
TestDeletedBlockLog to have getConfig stub, otherwise passing it as null causing NPE which results test failure.

Successful CI - https://github.com/navinko/ozone/actions/runs/35424869985

@chihsuan chihsuan 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 cleanup! @navinko LGTM +1

Just curious, since both keys are reconfigurable and only ReplicationManager picks up a reconfig today, could checkIfMaintenancePossible read rmConf directly instead of copying the values? Happy to see that as a follow-up too. Left a small nit inline.

Comment on lines +284 to +285
// Read the maintenance replica config from ReplicationManagerConfiguration,
// which is the single source of truth for these values.

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: Could we drop this comment? The code already says where the values come from.

Suggested change
// Read the maintenance replica config from ReplicationManagerConfiguration,
// which is the single source of truth for these values.

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.

Thank you! Removed the comment.

@navinko

navinko commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the cleanup! @navinko LGTM +1

Just curious, since both keys are reconfigurable and only ReplicationManager picks up a reconfig today, could checkIfMaintenancePossible read rmConf directly instead of copying the values? Happy to see that as a follow-up too. Left a small nit inline.

Thanks @chihsuan for the review.
Yes, it's doable . I'll do the rmConf read as the follow-up.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants