BewareMyPower commented on code in PR #21745:
URL: https://github.com/apache/pulsar/pull/21745#discussion_r1437581938
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -1230,6 +1232,29 @@ private void
asyncDeleteCursorWithClearDelayedMessage(String subscriptionName,
dispatcher.clearDelayedMessages().whenComplete((__, ex) -> {
if (ex != null) {
unsubscribeFuture.completeExceptionally(ex);
+ } else {
+
asyncDeleteCursorWithCleanCompactionLedger(persistentSubscription,
unsubscribeFuture);
+ }
+ });
+ }
+
+ private void
asyncDeleteCursorWithCleanCompactionLedger(PersistentSubscription subscription,
+
CompletableFuture<Void> unsubscribeFuture) {
Review Comment:
```suggestion
private void
asyncDeleteCursorWithCleanCompactionLedger(PersistentSubscription subscription,
CompletableFuture<Void> unsubscribeFuture) {
```
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -1396,6 +1423,7 @@ private CompletableFuture<Void> delete(boolean
failIfHasSubscriptions,
unfenceTopicToResume();
deleteFuture.completeExceptionally(ex);
} else {
+ log.info("[{}] Topic deleted...",
topic);
Review Comment:
I believe these logs are only added for debugging. It's better to delete
them.
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -3420,17 +3448,29 @@ public void readEntryFailed(ManagedLedgerException
exception, Object ctx) {
public synchronized void triggerCompaction()
throws PulsarServerException, AlreadyRunningException {
if (currentCompaction.isDone()) {
+ if (!lock.readLock().tryLock()) {
Review Comment:
Why did you acquire the read lock here?
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentTopic.java:
##########
@@ -3420,17 +3448,29 @@ public void readEntryFailed(ManagedLedgerException
exception, Object ctx) {
public synchronized void triggerCompaction()
throws PulsarServerException, AlreadyRunningException {
if (currentCompaction.isDone()) {
+ if (!lock.readLock().tryLock()) {
+ log.info("[{}] Topic is closing or deleting, skip triggering
compaction -lock", topic);
+ return;
+ }
+ try {
+ if (isClosingOrDeleting) {
+ log.info("[{}] Topic is closing or deleting, skip
triggering compaction -flag", topic);
Review Comment:
Should them be warning logs? BTW, the `-lock` and `-flag` words in the logs
are not readable.
--
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]