You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/11/19 16:30:38 UTC

[GitHub] [pulsar] merlimat commented on a change in pull request #12896: [Issue 12894] Only refresh metadata if path is already in cache after write.

merlimat commented on a change in pull request #12896:
URL: https://github.com/apache/pulsar/pull/12896#discussion_r753344157



##########
File path: pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataCacheTest.java
##########
@@ -331,6 +331,7 @@ public void insertionOutsideCacheWithGenericType(String provider, Supplier<Strin
         });
 
         String key1 = newKey();
+        objCache.get(key1).join();

Review comment:
       This is forcing the key to be in the cache, but the test was expressly trying to check the condition in which it was not.

##########
File path: pulsar-metadata/src/main/java/org/apache/pulsar/metadata/api/MetadataCache.java
##########
@@ -155,4 +155,12 @@
      * @param path the path of the object in the metadata store
      */
     void refresh(String path);
+
+
+    /**
+     * Check if the value of this path is already in cache.
+     * @param path the path of the object in the metadata store
+     * @return true if the path exists.
+     */
+    boolean existsInCache(String path);

Review comment:
       I wouldn't add a new method in the API that we only are going to be using internally.
   
   Two solutions: 
    1. There is already `MetadataCache.getIfCached()`
    2. `MetadaCache.refresh()` implementation should take care of it internally.




-- 
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: commits-unsubscribe@pulsar.apache.org

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