Huang Kuan Hao created HDDS-16214:
-------------------------------------
Summary: Avoid the per-group list copy in KeyManagerImpl read paths
Key: HDDS-16214
URL: https://issues.apache.org/jira/browse/HDDS-16214
Project: Apache Ozone
Issue Type: Sub-task
Reporter: Huang Kuan Hao
Assignee: Huang Kuan Hao
Three KeyManagerImpl read-path methods flatten-copy each version group only to
iterate/stream it once:
// addBlockToken4Read
for (OmKeyLocationInfoGroup key : value.getKeyLocationVersions()) {
key.getLocationList().forEach(k -> {
k.setToken(secretManager.generateToken(remoteUser, k.getBlockID(),
EnumSet.of(READ), k.getLength()));
});
}
// sortDatanodes
for (OmKeyLocationInfo k : key.getLocationList()) {
Pipeline pipeline = k.getPipeline();
...
}
// extractContainerIDs
return keyInfo.getKeyLocationVersions().stream()
.flatMap(v -> v.getLocationList().stream())
.map(BlockLocationInfo::getContainerID);
Fix: iterate getLocationLists() (nested loop / flatMap). setToken mutates the
shared element references, so token assignment is unaffected. Behavior
unchanged.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]