New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Branch-2.7] Fix ledger roll over scheduler task #11226
[Branch-2.7] Fix ledger roll over scheduler task #11226
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall the change looks good to me.
but I am afraid that we are adding a new flaky test
can you please check my comment ?
// the ledger rollover scheduled time is between 1000 and 1050 ms, | ||
// wait 1100 ms, the ledger should be rolled over. | ||
Awaitility.await() | ||
.atMost(1100, TimeUnit.MILLISECONDS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure that on CI we can rely on making the difference in the order of 100ms
it is possible that the machine is very slow and then we will see the test failing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'll increase the time order of magnitude, we could set the maximum rollover time to 10 seconds and wait 11 seconds? Maybe 1 second is more stable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's try
@lhotari what do you think ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I think it's better not to test accurate timings. The test code is cleaner when .atMost
is omitted. The default value is 10 seconds and that should be suitable for most cases where the operation is expected to complete in less than 10 seconds.
982fb46
to
71c86d3
Compare
…edLedgerImpl` 2. scheduled the ledger rollover task after update ledger last created time
…eachMaximumRolloverTime`
71c86d3
to
9b02015
Compare
The PR #11116 couldn't be cherry-picked to
branch-2.7
, because there are too many conflicts.In PR #8946 the ledger rollover task had been moved from
BrokerService
toManagedLedgerImpl
, and this PR is based on it.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