horizonzy commented on code in PR #15914:
URL: https://github.com/apache/pulsar/pull/15914#discussion_r894299875
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -1196,35 +1196,48 @@ private CompletableFuture<Void> delete(boolean
failIfHasSubscriptions,
unfenceTopicToResume();
deleteFuture.completeExceptionally(e);
} else {
- ledger.asyncDelete(new
AsyncCallbacks.DeleteLedgerCallback() {
- @Override
- public void
deleteLedgerComplete(Object ctx) {
-
brokerService.removeTopicFromCache(topic);
-
-
dispatchRateLimiter.ifPresent(DispatchRateLimiter::close);
-
-
subscribeRateLimiter.ifPresent(SubscribeRateLimiter::close);
-
- unregisterTopicPolicyListener();
-
- log.info("[{}] Topic deleted",
topic);
- deleteFuture.complete(null);
- }
+ // Truncate to ensure the offloaded data
is not orphaned.
+ // Also ensures the BK ledgers are deleted
and not just scheduled for deletion
+ CompletableFuture<Void> truncateFuture =
ledger.asyncTruncate();
+ truncateFuture.whenComplete((ignore, exc)
-> {
Review Comment:
How about that move this logic to ledger.asyncDelete(). It can cover more
situation.
--
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]