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


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/cache/FullTableCache.java:
##########
@@ -111,18 +116,31 @@ public void loadInitial(CacheKey<KEY> key, 
CacheValue<VALUE> value) {
   @Override
   public void put(CacheKey<KEY> cacheKey, CacheValue<VALUE> value) {
     try {
-      lock.writeLock().lock();
+      lock.readLock().lock();
       cache.put(cacheKey, value);
-      epochEntries.computeIfAbsent(value.getEpoch(),
-          v -> new CopyOnWriteArraySet<>()).add(cacheKey);
+      // add in case of null value for cleanup purpose only when key is deleted
+      if (value.getCacheValue() == null) {
+        epochEntries.computeIfAbsent(value.getEpoch(),
+            v -> new CopyOnWriteArraySet<>()).add(cacheKey);
+      }
     } finally {
-      lock.writeLock().unlock();
+      lock.readLock().unlock();
     }
   }
 
   @Override
   public void cleanup(List<Long> epochs) {
-    executorService.execute(() -> evictCache(epochs));
+    epochCleanupQueue.clear();

Review Comment:
   We are giving preference to latest epoch, and since latest epoch is 
received, which means previous epoch is already notified. Using this, 
intermediate epoch is not required and in eviction logic, only latest is used 
to handle all previous epch and action for cleanup.
   Check for sequential epoch is not required and logic is modified.



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