neuyilan commented on a change in pull request #2635:
URL: https://github.com/apache/iotdb/pull/2635#discussion_r571755902



##########
File path: 
cluster/src/main/java/org/apache/iotdb/cluster/metadata/CMManager.java
##########
@@ -393,6 +414,10 @@ public synchronized MeasurementMNode get(PartialPath key) {
         return null;
       }
     }
+
+    public synchronized boolean containsKey(PartialPath key) {
+      return cache.containsKey(key);
+    }

Review comment:
       Since all methods in RemoteMetaCache are synchronized, it is safe to 
modify the cache. However, in CMManager, functions in RemoteMetaCache may be 
called many times in a function, which may be due to the serialization of cache 
operations in CMManager, so the lock is added?
   
   Therefore, I think in CMManager, whether the cache operation is locked or 
not is OK. Locking can ensure that all cache operations in CMManager are 
serial.  However, since RemoteMetaCache itself is thread-safe, maybe it's also 
OK not to lock it.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to