rich7420 opened a new pull request, #11114:
URL: https://github.com/apache/ozone/pull/11114
## 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?
New `TestPipeline#getReplicaIndexesIsMemoizedAndInvalidatedOnReport` covers
the derived contents, the unmodifiable view, memoization, and cache
invalidation after `reportDatanode`. Existing `TestPipeline` (9/9) and
checkstyle, pmd, findbugs are green on the fork CI.
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 |
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]