You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "poorbarcode (via GitHub)" <gi...@apache.org> on 2023/08/24 06:03:45 UTC
[GitHub] [pulsar] poorbarcode commented on a diff in pull request #21035: [fix] [bk] Correctct the bookie info after ZK client is reconnected
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org