horizonzy commented on code in PR #18672:
URL: https://github.com/apache/pulsar/pull/18672#discussion_r1050372776
##########
pulsar-broker-common/src/main/java/org/apache/pulsar/bookie/rackawareness/BookieRackAffinityMapping.java:
##########
@@ -133,6 +137,28 @@ public synchronized void setConf(Configuration conf) {
}
}
+ private void watchAvailableBookies() {
+ BookieAddressResolver bookieAddressResolver =
getBookieAddressResolver();
+ if (bookieAddressResolver instanceof DefaultBookieAddressResolver) {
+ try {
+ Field field =
DefaultBookieAddressResolver.class.getDeclaredField("registrationClient");
+ field.setAccessible(true);
+ RegistrationClient registrationClient = (RegistrationClient)
field.get(bookieAddressResolver);
+ registrationClient.watchWritableBookies(versioned -> {
+ try {
+ racksWithHost =
bookieMappingCache.get(BOOKIE_INFO_ROOT_PATH).get()
Review Comment:
PulsarRegistrationClient holds another watcher.
org.apache.bookkeeper.client.BookieWatcherImpl#initialBlockingBookieRead
```
writable =
this.registrationClient.watchWritableBookies((bookies) -> {
this.processWritableBookiesChanged((Set)bookies.getValue());
});
```
We need to make the watcher callback ordered. First to update the rack info,
then to handle `processWritableBookiesChanged`. Or the newBookieNode didn't
aware of the newest rack info.
So I change the `writableBookiesWatchers ` type from `Map` to `Set`.
--
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]