Ivan Andika created HDDS-13595:
----------------------------------

             Summary: ListKeys should not overwrite entry if cache exists
                 Key: HDDS-13595
                 URL: https://issues.apache.org/jira/browse/HDDS-13595
             Project: Apache Ozone
          Issue Type: Bug
            Reporter: Ivan Andika
            Assignee: Ivan Andika


In the listKeys, the following code is used to not list the keys if the cache 
entry marks it as deleted.

 
{code: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++;
} {code}
 

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.



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