[fix][test] Fix flaky test testShadowWrites #22745
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #22345
Motivation
Root cause analysis
Actually, the ledger will roll over here because it will fill up the current ledger:
pulsar/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ShadowManagedLedgerImplTest.java
Line 77 in 6372b9c
Therefore, the source ML will update the managed ledger info. And the shadowML will get the updated MLInfo and update the LCE. So the assertion here is incorrect because the LCE will be updated:
pulsar/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ShadowManagedLedgerImplTest.java
Lines 79 to 81 in 6372b9c
The process of updating MLInfo from sourceML to shadowML is asynchronous. This causes the test to be unreliable.
Regarding the change for this:
pulsar/managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ShadowManagedLedgerImplTest.java
Lines 151 to 154 in 6372b9c
We have removed one entry addition operation in the test. Therefore, the final count for the ledger size will be one less.
Modifications
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: