0lai0 opened a new pull request, #11099:
URL: https://github.com/apache/ozone/pull/11099
## What changes were proposed in this pull request?
`KeyInputStream.getBlockLocationInfo` runs on every per-block pipeline
refresh / read retry. It flatten-copies the version map with
`createLocationList()`, then does `stream().filter().collect(toList())` just to
pick `get(0)`, two throwaway `ArrayList`s per call, no short-circuit.
`OmKeyLocationInfoGroup.createLocationList()` is documented a s`"expensive
... Use getLocationLists() instead"`.
Fix: iterate `getLocationLists()` (the raw uncopied `Collection<List<...>>`)
with a nested for-loop, return on first match. Zero allocations,
short-circuits, same semantics.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-16216
## How was this patch tested?
https://github.com/0lai0/ozone/actions/runs/32735325487
- `mvn -pl :ozone-client install -DskipTests` — pass
- `mvn -pl :ozone-client test -Dtest=TestKeyInputStreamEC` — pass
- `mvn -pl :ozone-client checkstyle:check` — pass
Local JMH (target at last position → worst-case scan, gains are purely
from removed allocations):
| N / G | before ns | after ns | before B/op | after B/op |
|---:|---:|---:|---:|---:|
| 1 / 1 | 91 | 4 | 816 | ≈0 |
| 1 / 4 | 131 | 11 | 1,080 | ≈0 |
| 16 / 1 | 144 | 9 | 1,000 | ≈0 |
| 16 / 4 | 288 | 33 | 1,944 | ≈0 |
| 128 / 1 | 395 | 40 | 2,808 | ≈0 |
| 128 / 4 | 1,365 | 158 | 7,760 | ≈0 |
Generated-by: Claude Code (claude-opus-4-7)
--
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]