Huang Kuan Hao created HDDS-16213:
-------------------------------------

             Summary: Avoid the per-group list copy in 
KeyManagerImpl.getPendingDeletionKeys
                 Key: HDDS-16213
                 URL: https://issues.apache.org/jira/browse/HDDS-16213
             Project: Apache Ozone
          Issue Type: Sub-task
            Reporter: Huang Kuan Hao
            Assignee: Huang Kuan Hao


In KeyManagerImpl.getPendingDeletionKeys (the KeyDeletingService 
reclaimable-key scan), each key's DeletedBlock list is built via a flatten-copy 
that is immediately re-streamed and discarded, once per key in the scan:

List<DeletedBlock> deletedBlocks = info.getKeyLocationVersions().stream()
    .flatMap(versionLocations -> versionLocations.getLocationList().stream()
        .map(b -> new DeletedBlock(
            new BlockID(b.getContainerID(), b.getLocalID()),
            b.getLength(),
            QuotaUtil.getReplicatedSize(b.getLength(), 
info.getReplicationConfig()),
            QuotaUtil.getSizePerReplica(b.getLength(), 
info.getReplicationConfig())
        ))).collect(Collectors.toList());
Fix: use getLocationLists() (no copy): .flatMap(v -> 
v.getLocationLists().stream().flatMap(List::stream)). Behavior unchanged. 
Complementary to HDDS-16195, which reuses the computed replicated sizes on the 
same loop but leaves this copy in place.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to