You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/08/30 09:58:31 UTC

[GitHub] [ozone] mukul1987 commented on a change in pull request #2594: HDDS-5660. Separate container caches for Open and Closed containers.

mukul1987 commented on a change in pull request #2594:
URL: https://github.com/apache/ozone/pull/2594#discussion_r698355347



##########
File path: hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/ContainerCache.java
##########
@@ -227,9 +246,68 @@ private boolean cleanupDb(ReferenceCountedDB db) {
   public void addDB(String containerDBPath, ReferenceCountedDB db) {
     lock.lock();
     try {
-      this.putIfAbsent(containerDBPath, db);
+      openContainerCache.putIfAbsent(containerDBPath, db);
+      metrics.incNumOpenContainerInserts();
+    } finally {
+      lock.unlock();
+    }
+  }
+
+  public void markContainerClosed(String containerPath) {
+    lock.lock();
+    try {
+      ReferenceCountedDB db = openContainerCache.remove(containerPath);
+      Preconditions.checkNotNull(db, "Container not found in open cache:" +
+          containerPath);
+      closeContainerCache.putIfAbsent(containerPath, db);
+      metrics.incNumOpenContainerRemoves();
     } finally {
       lock.unlock();
     }
   }
+
+  public boolean isContainerOpen(State state) {

Review comment:
       ok will do that,




-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org