Skip to content

HDDS-17446. Avoid copying the datanode container set twice - #11746

Merged
adoroszlai merged 1 commit into
apache:masterfrom
andyhuangdev:HDDS-17446
Oct 25, 2026
Merged

adoroszlai merged 1 commit into
apache:masterfrom
andyhuangdev:HDDS-17446

Conversation

@andyhuangdev

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

NodeStateMap.updateNode calls oldEntry.copyContainers(), which creates a new set, and the DatanodeEntry constructor copies that set again with addAll.

This change passes the old DatanodeEntry directly to the constructor so the containers are copied once. It avoids an intermediate set allocation while preserving an independent container set for the new entry.

Follow-up to the review comment on #11687.

What is the link to the Apache JIRA

HDDS-17446

How was this patch tested?

Passed TestSCMNodeManager#testRegisterKeepsContainersOnNodeUpdate, which verifies that containers are preserved when a datanode re-registers with a new version, ports, or IP address.

@andyhuangdev

Copy link
Copy Markdown
Contributor Author

cc @peterxcli

@github-actions github-actions Bot added the scm label Oct 25, 2026

@peterxcli peterxcli left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM +1

@adoroszlai
adoroszlai merged commit b9ba58d into apache:master Oct 25, 2026
56 checks passed
@adoroszlai

Copy link
Copy Markdown
Contributor

Thanks @andyhuangdev for the patch, @peterxcli for the review.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants