gaoran10 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r660418334



##########
File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
##########
@@ -3361,7 +3359,7 @@ private boolean currentLedgerIsFull() {
                 || currentLedgerSize >= (config.getMaxSizePerLedgerMb() * 
MegaByte));
 
         long timeSinceLedgerCreationMs = clock.millis() - 
lastLedgerCreatedTimestamp;
-        boolean maxLedgerTimeReached = timeSinceLedgerCreationMs >= 
maximumRolloverTimeMs;
+        boolean maxLedgerTimeReached = timeSinceLedgerCreationMs >= 
config.getMaximumRolloverTimeMs();

Review comment:
       The `maxLedgerTimeReached` is used to check the ledger should roll over 
or not, I think it should be the configuration value. And we could use the 
floating time to control the scheduled task to avoid many rollover operations 
happen at the same time.

##########
File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
##########
@@ -3361,7 +3359,7 @@ private boolean currentLedgerIsFull() {
                 || currentLedgerSize >= (config.getMaxSizePerLedgerMb() * 
MegaByte));
 
         long timeSinceLedgerCreationMs = clock.millis() - 
lastLedgerCreatedTimestamp;
-        boolean maxLedgerTimeReached = timeSinceLedgerCreationMs >= 
maximumRolloverTimeMs;
+        boolean maxLedgerTimeReached = timeSinceLedgerCreationMs >= 
config.getMaximumRolloverTimeMs();

Review comment:
       The `maxLedgerTimeReached` is used to check the ledger should roll over 
or not, I think it should be the configuration value. And we could use the 
floating time to control the scheduled task to avoid many rollover operations 
happen at the same time.

##########
File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
##########
@@ -3929,4 +3918,13 @@ public void clearBacklogFailed(ManagedLedgerException 
exception, Object ctx) {
             return CompletableFuture.completedFuture(ensembles);
         });
     }
+
+    private void updateLastLedgerCreatedTime() {

Review comment:
       Maybe we could use the name 
`updateLedgerCreatedTimeAndScheduleRolloverTask`?

##########
File path: 
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
##########
@@ -401,8 +401,6 @@ public void operationFailed(MetaStoreException e) {
         });
 
         scheduleTimeoutTask();
-
-        scheduleRollOverLedgerTask();

Review comment:
       If there is no traffic the old task `scheduleRollOverLedgerTask` will 
also do nothing, because there is an entry num check before the rollover task.




-- 
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]


Reply via email to