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 2021/06/26 17:23:57 UTC
[GitHub] [pulsar] gaoran10 opened a new pull request #11116: [Ledger] Fix ledger rollover scheduled task
gaoran10 opened a new pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116
### Motivation
Currently, the ledger rollover scheduled task will execute before reach the ledger maximum rollover time, this will cause the ledger doesn't roll over in time.
### Modifications
Only make the ledger rollover scheduled task after the ledger created successfully.
If the scheduled task was executed when there is no entry in the current ledger, the scheduled task will not be re-executed, and if there is new entry is added the ledger will rollover.
### Verifying this change
Add a unit test to verify the ledger could be rolled over in time.
### Does this pull request potentially affect one of the following parts:
*If `yes` was chosen, please highlight the changes*
- Dependencies (does it add or upgrade a dependency): (no)
- The public API: (no)
- The schema: (no)
- The default values of configurations: (no)
- The wire protocol: (no)
- The rest endpoints: (no)
- The admin cli options: (no)
- Anything that affects deployment: (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-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] gaoran10 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
gaoran10 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r660420196
##########
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`?
--
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
[GitHub] [pulsar] gaoran10 commented on pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
gaoran10 commented on pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#issuecomment-870443036
> @gaoran10 does this affect docs?
Sorry late response, this is not affect doc.
--
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
[GitHub] [pulsar] 315157973 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
315157973 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r659853112
##########
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:
We have now deleted the scheduled task. If there is no traffic, will it never be cleaned up?
--
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
[GitHub] [pulsar] gaoran10 commented on pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
gaoran10 commented on pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#issuecomment-870443036
> @gaoran10 does this affect docs?
Sorry late response, this is not affect doc.
--
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
[GitHub] [pulsar] gaoran10 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
gaoran10 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r659458163
##########
File path: managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
##########
@@ -2922,6 +2922,23 @@ public void testManagedLedgerRollOverIfFull() throws Exception {
Assert.assertEquals(ledger.getTotalSize(), 0);
}
+ @Test
+ public void testLedgerReachMaximumRolloverTime() throws Exception {
+ ManagedLedgerConfig config = new ManagedLedgerConfig();
+ config.setRetentionTime(1, TimeUnit.SECONDS);
+ config.setMaxEntriesPerLedger(2);
+ config.setMinimumRolloverTime(1, TimeUnit.MILLISECONDS);
+ config.setMaximumRolloverTime(1, TimeUnit.SECONDS);
+
+ ManagedLedger ml = factory.open("ledger-reach-maximum-rollover-time", config);
+ Position position1 = ml.addEntry("test".getBytes());
+
+ Thread.sleep(1000);
Review comment:
This test is used for mocking a sense that the ledger reaches the maximum rollover time threshold.
--
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
[GitHub] [pulsar] gaoran10 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
gaoran10 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r660423705
##########
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] gaoran10 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
gaoran10 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r659458015
##########
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:
It seems that the fixed-rate scheduled task doesn't roll over the ledger in time when the ledger reaches the maximum rollover threshold.
--
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
[GitHub] [pulsar] 315157973 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
315157973 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r659862322
##########
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:
But what it actually does is : updateLastLedgerCreatedTime And rollCurrentLedgerIfFull
--
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
[GitHub] [pulsar] gaoran10 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
gaoran10 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r659455861
##########
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:
Maybe the random maximum rollover time should be used to control the scheduled task? And use the original configuration to check the ledger whether reach the max rollover time threshold.
--
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
[GitHub] [pulsar] Anonymitaet commented on pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#issuecomment-869334517
@gaoran10 does this affect docs?
--
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
[GitHub] [pulsar] eolivelli commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
eolivelli commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r659645977
##########
File path: managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
##########
@@ -2922,6 +2922,23 @@ public void testManagedLedgerRollOverIfFull() throws Exception {
Assert.assertEquals(ledger.getTotalSize(), 0);
}
+ @Test
+ public void testLedgerReachMaximumRolloverTime() throws Exception {
+ ManagedLedgerConfig config = new ManagedLedgerConfig();
+ config.setRetentionTime(1, TimeUnit.SECONDS);
+ config.setMaxEntriesPerLedger(2);
+ config.setMinimumRolloverTime(1, TimeUnit.MILLISECONDS);
+ config.setMaximumRolloverTime(1, TimeUnit.SECONDS);
+
+ ManagedLedger ml = factory.open("ledger-reach-maximum-rollover-time", config);
+ Position position1 = ml.addEntry("test".getBytes());
+
+ Thread.sleep(1000);
Review comment:
what happens on a slow machine ?
will the test fail ?
what are you testing here ? is there a better way to test what you want ?
--
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
[GitHub] [pulsar] 315157973 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
315157973 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r659250218
##########
File path: managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
##########
@@ -2922,6 +2922,23 @@ public void testManagedLedgerRollOverIfFull() throws Exception {
Assert.assertEquals(ledger.getTotalSize(), 0);
}
+ @Test
+ public void testLedgerReachMaximumRolloverTime() throws Exception {
+ ManagedLedgerConfig config = new ManagedLedgerConfig();
+ config.setRetentionTime(1, TimeUnit.SECONDS);
+ config.setMaxEntriesPerLedger(2);
+ config.setMinimumRolloverTime(1, TimeUnit.MILLISECONDS);
+ config.setMaximumRolloverTime(1, TimeUnit.SECONDS);
+
+ ManagedLedger ml = factory.open("ledger-reach-maximum-rollover-time", config);
+ Position position1 = ml.addEntry("test".getBytes());
+
+ Thread.sleep(1000);
Review comment:
Why not use Awaitility
--
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
[GitHub] [pulsar] Anonymitaet commented on pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#issuecomment-870422315
Hi @gaoran10 any feedback?
--
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
[GitHub] [pulsar] 315157973 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
315157973 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r659852724
##########
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:
We have now deleted the scheduled task. If there is no traffic, will it never be cleaned up?
##########
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:
We have now deleted the scheduled task. If there is no traffic, will it never be cleaned up?
##########
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:
https://github.com/apache/pulsar/blob/da66d0e2212c99a5a7e346c38778af0f1276e7d1/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L309
https://github.com/apache/pulsar/blob/da66d0e2212c99a5a7e346c38778af0f1276e7d1/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L3471-L3473
Your current time is fixed, the previous time is floating.
Anyway, I think we need to avoid deleting at the same time. "control the scheduled task" is work for me
##########
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:
But what it actually does is : updateLastLedgerCreatedTime And rollCurrentLedgerIfFull
--
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
[GitHub] [pulsar] gaoran10 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
gaoran10 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r661190219
##########
File path: managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
##########
@@ -2922,6 +2922,23 @@ public void testManagedLedgerRollOverIfFull() throws Exception {
Assert.assertEquals(ledger.getTotalSize(), 0);
}
+ @Test
+ public void testLedgerReachMaximumRolloverTime() throws Exception {
+ ManagedLedgerConfig config = new ManagedLedgerConfig();
+ config.setRetentionTime(1, TimeUnit.SECONDS);
+ config.setMaxEntriesPerLedger(2);
+ config.setMinimumRolloverTime(1, TimeUnit.MILLISECONDS);
+ config.setMaximumRolloverTime(1, TimeUnit.SECONDS);
+
+ ManagedLedger ml = factory.open("ledger-reach-maximum-rollover-time", config);
+ Position position1 = ml.addEntry("test".getBytes());
+
+ Thread.sleep(1000);
Review comment:
I changed the test. PTAL @315157973 @eolivelli
##########
File path: managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerTest.java
##########
@@ -2922,6 +2922,23 @@ public void testManagedLedgerRollOverIfFull() throws Exception {
Assert.assertEquals(ledger.getTotalSize(), 0);
}
+ @Test
+ public void testLedgerReachMaximumRolloverTime() throws Exception {
+ ManagedLedgerConfig config = new ManagedLedgerConfig();
+ config.setRetentionTime(1, TimeUnit.SECONDS);
+ config.setMaxEntriesPerLedger(2);
+ config.setMinimumRolloverTime(1, TimeUnit.MILLISECONDS);
+ config.setMaximumRolloverTime(1, TimeUnit.SECONDS);
+
+ ManagedLedger ml = factory.open("ledger-reach-maximum-rollover-time", config);
+ Position position1 = ml.addEntry("test".getBytes());
+
+ Thread.sleep(1000);
Review comment:
I changed the test. @315157973 @eolivelli PTAL
--
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
[GitHub] [pulsar] Anonymitaet commented on pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
Anonymitaet commented on pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#issuecomment-870422315
Hi @gaoran10 any feedback?
--
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
[GitHub] [pulsar] 315157973 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
315157973 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r659859148
##########
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:
https://github.com/apache/pulsar/blob/da66d0e2212c99a5a7e346c38778af0f1276e7d1/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L309
https://github.com/apache/pulsar/blob/da66d0e2212c99a5a7e346c38778af0f1276e7d1/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L3471-L3473
Your current time is fixed, the previous time is floating.
Anyway, I think we need to avoid deleting at the same time. "control the scheduled task" is work for me
--
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
[GitHub] [pulsar] gaoran10 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
gaoran10 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r659454565
##########
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:
This method is used to update `lastLedgerCreatedTimestamp`, updating this field indicates that the ledger has been created succesully, and at this time, we could add a scheduled task to check the ledger reaches maximum rollover time or not.
--
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
[GitHub] [pulsar] 315157973 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
315157973 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r659249273
##########
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:
I look at the previous logic, there will be a random value here to ensure that all Ledgers are not rollover together at the same time
##########
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:
Just a question:
It will be executed regularly, why is it “the scheduled task will not be re-executed” ?
##########
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:
The method name is different from what it actually does
--
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
[GitHub] [pulsar] gaoran10 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
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.
--
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
[GitHub] [pulsar] gaoran10 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
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: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [pulsar] gaoran10 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
gaoran10 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r660418610
##########
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.
--
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
[GitHub] [pulsar] 315157973 commented on a change in pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
315157973 commented on a change in pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116#discussion_r659852724
##########
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:
We have now deleted the scheduled task. If there is no traffic, will it never be cleaned up?
--
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
[GitHub] [pulsar] sijie merged pull request #11116: [Ledger] Fix ledger rollover scheduled task
Posted by GitBox <gi...@apache.org>.
sijie merged pull request #11116:
URL: https://github.com/apache/pulsar/pull/11116
--
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