提交 78e794a9 编写于 作者: R Rajan Dhabalia 提交者: Matteo Merli

[pulsar-broker]Fix: race condition while deleting global topic (#4173)

上级 364ed5e9
......@@ -795,7 +795,6 @@ public class PersistentTopic implements Topic, AddEntryCallback {
closeClientFuture.thenAccept(delete -> {
if (USAGE_COUNT_UPDATER.get(this) == 0) {
isFenced = true;
List<CompletableFuture<Void>> futures = Lists.newArrayList();
if (failIfHasSubscriptions) {
......@@ -824,9 +823,14 @@ public class PersistentTopic implements Topic, AddEntryCallback {
@Override
public void deleteLedgerFailed(ManagedLedgerException exception, Object ctx) {
isFenced = false;
log.error("[{}] Error deleting topic", topic, exception);
deleteFuture.completeExceptionally(new PersistenceException(exception));
if (exception.getCause() instanceof KeeperException.NoNodeException) {
log.info("[{}] Topic is already deleted {}", topic, exception.getMessage());
deleteLedgerComplete(ctx);
} else {
isFenced = false;
log.error("[{}] Error deleting topic", topic, exception);
deleteFuture.completeExceptionally(new PersistenceException(exception));
}
}
}, null);
}
......@@ -984,7 +988,7 @@ public class PersistentTopic implements Topic, AddEntryCallback {
// doesn't serve global topic without local repl-cluster configured.
if (TopicName.get(topic).isGlobal() && !configuredClusters.contains(localCluster)) {
log.info("Deleting topic [{}] because local cluster is not part of global namespace repl list {}",
configuredClusters);
topic, configuredClusters);
return deleteForcefully();
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册