This is an automated email from the ASF dual-hosted git repository.
lhotari pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 12c96f6c4f9 [fix][broker] Ignore metadata changes when broker is not
in the Started state (#24352)
12c96f6c4f9 is described below
commit 12c96f6c4f974e1307d9b5a2ce49ab83fa95bcde
Author: Zixuan Liu <[email protected]>
AuthorDate: Wed May 28 16:07:24 2025 +0800
[fix][broker] Ignore metadata changes when broker is not in the Started
state (#24352)
Signed-off-by: Zixuan Liu <[email protected]>
---
.../org/apache/pulsar/broker/service/BrokerService.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
index 18929d7914d..ab0bef93847 100644
---
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
+++
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/BrokerService.java
@@ -2532,9 +2532,19 @@ public class BrokerService implements Closeable {
private void handleMetadataChanges(Notification n) {
- if (!pulsar.isRunning()) {
+ if (pulsar.getState() != PulsarService.State.Started) {
+ String brokerId;
+ try {
+ brokerId = pulsar.getBrokerId();
+ } catch (Exception ex) {
+ if (log.isDebugEnabled()) {
+ log.debug("Failed to get brokerId", ex);
+ }
+ // If broker is not running, we cannot get brokerId.
+ brokerId = "unknown";
+ }
// Ignore metadata changes when broker is not running
- log.info("Ignoring metadata change since broker is not running
(id={}, state={}) {}", pulsar.getBrokerId(),
+ log.info("Ignoring metadata change since broker is not running
(id={}, state={}) {}", brokerId,
pulsar.getState(), n);
return;
}