heesung-sn commented on code in PR #23515:
URL: https://github.com/apache/pulsar/pull/23515#discussion_r1826907259
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/OwnershipCache.java:
##########
@@ -170,7 +170,17 @@ public CompletableFuture<Optional<NamespaceEphemeralData>>
getOwnerAsync(Namespa
// If we're not the owner, we need to check if anybody else is
String path = ServiceUnitUtils.path(suName);
- return lockManager.readLock(path);
+ return lockManager.readLock(path).thenCompose(owner -> {
+ //If the current broker is the owner, we must try to acquire
ownership to avoid cache loss.
Review Comment:
This PR looks ok to fix the possible cache and metadata inconsistency state.
I think we can also try to skip `expiredFuture.complete(null);` if the lock
is recreated on the same broker.
However, I think we better make this ownership release protocol clearer not
to cause such inconsistency states.
In ExtensibleLoadBalancer, we release the topic resources earlier in the
first state(Releasing state) and blocks(ignores by conflict resolver) further
re-assignment until the current transfer protocol finishes. So, I think we
should see less such racing conditions in ExtensibleLoadBalancer.
--
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]