Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1273,34 +1273,29 @@ public CompletableFuture<Void> unsubscribe(String subscriptionName) {
.getTransactionPendingAckStoreSuffix(topic,
Codec.encode(subscriptionName)));
if (brokerService.pulsar().getConfiguration().isTransactionCoordinatorEnabled()) {
CompletableFuture<ManagedLedgerConfig> managedLedgerConfig = getBrokerService().getManagedLedgerConfig(tn);
managedLedgerConfig.thenAccept(config -> {
ManagedLedgerFactory managedLedgerFactory =
getBrokerService().getManagedLedgerFactoryForTopic(tn, config.getStorageClassName());
ManagedLedgerConfig managedLedgerConfig = ledger.getConfig();
ManagedLedgerFactory managedLedgerFactory = getBrokerService()
.getManagedLedgerFactoryForTopic(tn, managedLedgerConfig.getStorageClassName());
managedLedgerFactory.asyncDelete(tn.getPersistenceNamingEncoding(),
managedLedgerConfig,
new AsyncCallbacks.DeleteLedgerCallback() {
@Override
public void deleteLedgerComplete(Object ctx) {
CompletableFuture.completedFuture(managedLedgerConfig),
new AsyncCallbacks.DeleteLedgerCallback() {
@Override
public void deleteLedgerComplete(Object ctx) {
asyncDeleteCursorWithClearDelayedMessage(subscriptionName, unsubscribeFuture);
}

@Override
public void deleteLedgerFailed(ManagedLedgerException exception, Object ctx) {
if (exception instanceof MetadataNotFoundException) {
asyncDeleteCursorWithClearDelayedMessage(subscriptionName, unsubscribeFuture);
return;
}

@Override
public void deleteLedgerFailed(ManagedLedgerException exception, Object ctx) {
if (exception instanceof MetadataNotFoundException) {
asyncDeleteCursorWithClearDelayedMessage(subscriptionName, unsubscribeFuture);
return;
}

unsubscribeFuture.completeExceptionally(exception);
log.error("[{}][{}] Error deleting subscription pending ack store",
topic, subscriptionName, exception);
}
}, null);
}).exceptionally(ex -> {
unsubscribeFuture.completeExceptionally(ex);
return null;
});
unsubscribeFuture.completeExceptionally(exception);
log.error("[{}][{}] Error deleting subscription pending ack store",
topic, subscriptionName, exception);
}
}, null);
} else {
asyncDeleteCursorWithClearDelayedMessage(subscriptionName, unsubscribeFuture);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ public void testRemoveCluster() throws Exception {
admin1.namespaces().createNamespace(ns1);
admin1.namespaces().setNamespaceReplicationClusters(ns1, new HashSet<>(Arrays.asList(cluster1, cluster2)));
admin1.topics().createNonPartitionedTopic(topic);
admin1.topics().createSubscription(topic, "s1", MessageId.earliest);

// Wait for loading topic up.
Producer<String> p = client1.newProducer(Schema.STRING).topic(topic).create();
Expand Down
Loading