Skip to content

Commit 7261ea9

Browse files
committed
fix(broker): improve service unit ownership lookup when channel is disabled
1 parent 9dcc3b9 commit 7261ea9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateChannelImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,8 +460,13 @@ private CompletableFuture<Optional<String>> getActiveOwnerAsync(
460460
String serviceUnit,
461461
ServiceUnitState state,
462462
Optional<String> owner) {
463-
// If the channel is disabled or closed, this broker cannot be an active owner.
463+
// If the channel is disabled or closed, this broker cannot be the active owner.
464+
// If the table already has an owner, and it is not local, return it as is for upper-level redirection;
465+
// otherwise, return empty.
464466
if (channelState == Disabled || channelState == Closed) {
467+
if (owner.isPresent() && !isTargetBroker(owner.get())) {
468+
return CompletableFuture.completedFuture(owner);
469+
}
465470
return CompletableFuture.completedFuture(Optional.empty());
466471
}
467472
// If this broker's registry does not exist(possibly suffering from connecting to the metadata store),

0 commit comments

Comments
 (0)