mattisonchao commented on code in PR #19138:
URL: https://github.com/apache/pulsar/pull/19138#discussion_r1068860037


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/delayed/bucket/ImmutableBucket.java:
##########
@@ -132,12 +131,26 @@ private void recoverDelayedIndexBitMapAndNumber(int 
startSnapshotIndex,
         this.setNumberBucketDelayedMessages(numberMessages.getValue());
     }
 
+    
CompletableFuture<List<DelayedMessageIndexBucketSnapshotFormat.SnapshotSegment>>
 getRemainSnapshotSegment() {
+        return 
bucketSnapshotStorage.getBucketSnapshotSegment(getAndUpdateBucketId(), 
currentSegmentEntryId,
+                lastSegmentEntryId);
+    }
+
+    CompletableFuture<Void> asyncDeleteBucketSnapshot() {
+        return removeBucketCursorProperty(bucketKey()).thenCompose(__ ->
+                
bucketSnapshotStorage.deleteBucketSnapshot(getAndUpdateBucketId()));
+    }
+
     void clear(boolean delete) {
         delayedIndexBitMap.clear();
         getSnapshotCreateFuture().ifPresent(snapshotGenerateFuture -> {
             if (delete) {
                 snapshotGenerateFuture.cancel(true);
-                // TODO delete bucket snapshot
+                try {
+                    
asyncDeleteBucketSnapshot().get(AsyncOperationTimeoutSeconds, TimeUnit.SECONDS);
+                } catch (Exception e) {

Review Comment:
   Do you consider refactoring this code? Please catch the special exception if 
no.



-- 
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-unsubscr...@pulsar.apache.org

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

Reply via email to