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



##########
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:
       No worries for ZK implementation, I'll be making the change to use the 
persistent recursive watch for master branch. 




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