BewareMyPower commented on code in PR #23349:
URL: https://github.com/apache/pulsar/pull/23349#discussion_r1777123803
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/ExtensibleLoadManagerImpl.java:
##########
@@ -982,17 +1017,28 @@ protected void monitor() {
}
public void disableBroker() throws Exception {
+ // TopicDoesNotExistException might be thrown and it's not
recoverable. Enable this flag to exit playFollower()
+ // or playLeader() quickly.
+ if (!state.compareAndSet(State.RUNNING, State.DISABLED)) {
+ failForUnexpectedState("disableBroker");
+ }
+ stopLoadDataReportTasks();
serviceUnitStateChannel.cleanOwnerships();
- leaderElectionService.close();
brokerRegistry.unregister();
+ leaderElectionService.close();
+ final var availableBrokers = brokerRegistry.getAvailableBrokersAsync()
+ .get(conf.getMetadataStoreOperationTimeoutSeconds(),
TimeUnit.SECONDS);
+ if (availableBrokers.isEmpty()) {
+ close();
+ }
// Close the internal topics (if owned any) after giving up the
possible leader role,
// so that the subsequent lookups could hit the next leader.
closeInternalTopics();
}
private void closeInternalTopics() {
List<CompletableFuture<Void>> futures = new ArrayList<>();
- for (String name : INTERNAL_TOPICS) {
+ for (String name : Set.of(BROKER_LOAD_DATA_STORE_TOPIC,
TOP_BUNDLES_LOAD_DATA_STORE_TOPIC)) {
Review Comment:
It's not required. I reverted this change first.
--
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]