You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/06/22 00:58:44 UTC

[GitHub] [pulsar] dlg99 commented on a diff in pull request #15914: [Fix][Tiered Storage] Eagerly Delete Offloaded Segments On Topic Deletion

dlg99 commented on code in PR #15914:
URL: https://github.com/apache/pulsar/pull/15914#discussion_r903186123


##########
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:
   @horizonzy moved it into ManagedLedgerImpl



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org