This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch branch-2.8
in repository https://gitbox.apache.org/repos/asf/pulsar.git


The following commit(s) were added to refs/heads/branch-2.8 by this push:
     new 52764ce  revert the wrong modification in 
org.apache.pulsar.broker.namespace.OwnershipCache#checkOwnership (#12650)
52764ce is described below

commit 52764ce22976b5b83d50f8cd10f4fa3e808d6853
Author: Jason918 <jason....@qq.com>
AuthorDate: Sun Nov 7 07:47:45 2021 +0800

    revert the wrong modification in 
org.apache.pulsar.broker.namespace.OwnershipCache#checkOwnership (#12650)
    
    Co-authored-by: Jiang Haiting <jianghait...@didichuxing.com>
---
 .../java/org/apache/pulsar/broker/namespace/OwnershipCache.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/OwnershipCache.java
 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/OwnershipCache.java
index c27575c..6cf7359 100644
--- 
a/pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/OwnershipCache.java
+++ 
b/pulsar-broker/src/main/java/org/apache/pulsar/broker/namespace/OwnershipCache.java
@@ -210,7 +210,13 @@ public class OwnershipCache {
             return CompletableFuture.completedFuture(true);
         }
         String bundlePath = ServiceUnitUtils.path(bundle);
-        return resolveOwnership(bundlePath).thenApply(Optional::isPresent);
+        return 
resolveOwnership(bundlePath).thenApply(optionalOwnedDataWithStat -> {
+            if (!optionalOwnedDataWithStat.isPresent()) {
+                return false;
+            }
+            Stat stat = optionalOwnedDataWithStat.get().getValue();
+            return stat.getEphemeralOwner() == 
localZkCache.getZooKeeper().getSessionId();
+        });
     }
 
     /**

Reply via email to