ivandika3 opened a new pull request, #8961:
URL: https://github.com/apache/ozone/pull/8961

   ## What changes were proposed in this pull request?
   
   In the listKeys implementation, the following code is used to not list the 
keys if the cache entry marks it as deleted.
   
   ```java
   // Entry should not be marked for delete, consider only those
   // entries.
   CacheValue<OmKeyInfo> cacheValue =
       keyTable.getCacheValue(new CacheKey<>(kv.getKey()));
   if (cacheValue == null || cacheValue.getCacheValue() != null) {
     cacheKeyMap.put(kv.getKey(), kv.getValue());
     currentCount++;
   } 
   ```
   
   However, it overwrites the cache key map (i.e. Map#put) regardless whether 
cacheKeyMap contains the entry or not. This might not be correct in key 
overwrite case where both cache and DB contains non-null entry, but cache entry 
should be more up-to-date and should be returned instead. We can use 
putIfAbsent instead.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-13595
   
   ## How was this patch tested?
   
   Unit test.
   
   Clean CI: https://github.com/ivandika3/ozone/actions/runs/17101046170


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