poorbarcode commented on code in PR #21035:
URL: https://github.com/apache/pulsar/pull/21035#discussion_r1303841158


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarRegistrationClient.java:
##########
@@ -88,13 +91,29 @@ public PulsarRegistrationClient(MetadataStore store,
                 .newSingleThreadScheduledExecutor(new 
DefaultThreadFactory("pulsar-registration-client"));
 
         store.registerListener(this::updatedBookies);
+        this.store.registerSessionListener(this::refreshBookies);
     }
 
     @Override
     public void close() {
         executor.shutdownNow();
     }
 
+    private void refreshBookies(SessionEvent sessionEvent) {
+        lastMetadataSessionEvent = sessionEvent;
+        if (!SessionEvent.Reconnected.equals(sessionEvent)){

Review Comment:
   I added this event, and I noticed that as long as the event 
`SessionReestablished` occurs, the event `Reconnected` must occur, this causes 
the cache will be cleaned twice, but this should have no other bad effects. 
See: 
   - 
https://github.com/apache/pulsar/blob/master/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKSessionWatcher.java#L172-L175
   - 
https://github.com/apache/pulsar/blob/master/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/EtcdSessionWatcher.java#L152-L154
   



-- 
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: [email protected]

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

Reply via email to