Skip to content

HDDS-16279. Cache replica index map in Pipeline - #11114

Open
rich7420 wants to merge 1 commit into
apache:masterfrom
rich7420:HDDS-16279
Open

HDDS-16279. Cache replica index map in Pipeline#11114
rich7420 wants to merge 1 commit into
apache:masterfrom
rich7420:HDDS-16279

Conversation

@rich7420

@rich7420 rich7420 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Pipeline.getReplicaIndexes() re-derived the {node -> replicaIndex} map (stream + toMap + boxing) on every call, on the per-block-read command-build path. It is now memoized in a lazy volatile field and returned as an unmodifiable view. reportDatanode() is the only method that can change the node set, so it drops the cached view. Same contents (all callers only read the map), so behavior is unchanged.

What is the link to the Apache JIRA

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

How was this patch tested?

https://github.com/rich7420/ozone/actions/runs/32860599887

JMH (out of tree, isolating getReplicaIndexes()), JDK 21:

nodes ns/op (old -> new) B/op (old -> new)
3 (RATIS) 54.2 -> 0.47 416 -> ~0
5 (EC) 66.0 -> 0.46 480 -> ~0

getReplicaIndexes() re-derived the {node -> replicaIndex} map (stream + toMap
+ boxing) on every call, on the per-block-read command-build path. Memoize it
in a lazy volatile field, returned as an unmodifiable view. reportDatanode()
can change the node set, so it drops the cached view. Behavior unchanged.
Copilot AI lite review requested due to automatic review settings August 25, 2026 14:50

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@rich7420
rich7420 marked this pull request as draft August 25, 2026 15:36
@rich7420
rich7420 marked this pull request as ready for review August 26, 2026 08:01
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