sumitagrawl commented on code in PR #8961:
URL: https://github.com/apache/ozone/pull/8961#discussion_r2315150057


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -1074,7 +1074,9 @@ public ListKeysResult listKeys(String volumeName, String 
bucketName,
           CacheValue<OmKeyInfo> cacheValue =
               keyTable.getCacheValue(new CacheKey<>(kv.getKey()));
           if (cacheValue == null || cacheValue.getCacheValue() != null) {
-            cacheKeyMap.put(kv.getKey(), kv.getValue());
+            // We use putIfAbsent since cache entry should be more up-to-date 
and should not be overwritten
+            //  by the outdated DB entry
+            cacheKeyMap.putIfAbsent(kv.getKey(), kv.getValue());
             currentCount++;

Review Comment:
   Agree, currentCount is to build overall list size to maxKeys, here logic is 
only to return data from cache or from db (if deleted), both cases should be 
counted.
   
   Overwrite case is missed in this logic giving preference to DB value, but 
actually should be from cache.



-- 
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]

Reply via email to