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



##########
File path: 
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/cache/impl/MetadataCacheImpl.java
##########
@@ -209,8 +211,17 @@ public MetadataCacheImpl(MetadataStore store, 
MetadataSerde<T> serde) {
         store.put(path, content, Optional.of(-1L))
                 .thenAccept(stat -> {
                     // Make sure we have the value cached before the operation 
is completed
-                    objCache.put(path, FutureUtils.value(Optional.of(new 
CacheGetResult<>(value, stat))));
-                    future.complete(null);
+                    // In addition to caching the value, we need to add a 
watch on the path,
+                    // so when/if it changes on any other node, we are 
notified and we can
+                    // update the cache
+                    objCache.get(path).whenComplete( (stat2, ex) -> {

Review comment:
       For this one, we can do the following: 
    * Commit it with this approach
    * Cherry Pick for 2.8 branch
    * For 2.9 branch, go with persistent-recursive watched in ZK and we can 
eliminate this get() operation again.




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