devmadhuu commented on code in PR #5252:
URL: https://github.com/apache/ozone/pull/5252#discussion_r1319446566
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneListStatusHelper.java:
##########
@@ -215,7 +215,9 @@ public Collection<OzoneFileStatus> listStatusFSO(OmKeyArgs
args,
HeapEntry entry = heapIterator.next();
OzoneFileStatus status = entry.getStatus(prefixKey,
scmBlockSize, volumeName, bucketName, replication);
- map.putIfAbsent(entry.key, status);
+ if (!map.containsKey(entry.key)) {
Review Comment:
> AFAIK, `putIfAbsent` does the key check before put it to map.
@hemantk-12 Thanks for reviewing the PR, This map will contain deleted keys
as well and any deleted key entry will be represented in map with null value
and since we do not want to override null value as it represents key as
deleted, hence the reason of choosing `containsKey` check rather using
`putIfAbsent` directly because `putIfAbsent` Java implementation is not as per
our expectation in case of null values for a key. You may want to refer:
https://docs.oracle.com/javase/8/docs/api/java/util/Map.html#putIfAbsent-K-V-
--
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]