-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[fix][test] fix flaky test testRecoverSequenceId #18437
[fix][test] fix flaky test testRecoverSequenceId #18437
Conversation
Codecov Report
@@ Coverage Diff @@
## master #18437 +/- ##
============================================
+ Coverage 40.04% 45.00% +4.95%
- Complexity 8625 10610 +1985
============================================
Files 687 757 +70
Lines 67436 72781 +5345
Branches 7221 7817 +596
============================================
+ Hits 27007 32756 +5749
+ Misses 37411 36346 -1065
- Partials 3018 3679 +661
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
LGTM
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.
Suggestion add doc for this test case
/**
* Determine MLTransactionSequenceIdGenerator can recover the latest transaction id after restart.
* @isUseManagedLedgerProperties If true means that the last transaction id will be recovered by `ManagedLedger.prop`.
* @isUseManagedLedgerProperties If false means that the last transaction id will be recovered by the last transaction log in ledger
*/
@Test(dataProvider = "isUseManagedLedgerProperties")
public void testRecoverSequenceId(boolean isUseManagedLedgerProperties) throws Exception {
}
.../src/test/java/org/apache/pulsar/transaction/coordinator/MLTransactionMetadataStoreTest.java
Outdated
Show resolved
Hide resolved
…ting module to flink-connector-test-utils module This closes apache#18437.
Fixes: #18396
Motivation
The logic we expected:
maxEntriesPerLedger
= 3MlTransactionLog
, such as [3:0] [3:1] [3:2]rollCurrentLedgerIfFull
to close the old ledger and create a new ledgermaybeUpdateCursorBeforeTrimmingConsumedLedger
in thecreateComplete
of ManagedLedger. The cursor position of the transaction log will be update to the earliest position in the new ledger, such as [5: -1]pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
Lines 2356 to 2388 in a624e85
internalTrimLedgers
.pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
Lines 2570 to 2629 in 6373180
But there is a scheduled task to do flushCursors.
pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryImpl.java
Lines 203 to 204 in 6373180
Which will call
internalAsyncMarkDelete
and then update the cursor position to [3:2].pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
Lines 1939 to 1947 in 6373180
pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
Line 2066 in 6373180
And then the expired ledger (ledger id = 3) can not be deleted in
internalTrimLedgers
.pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
Lines 2570 to 2593 in 6373180
Modifications
There is a
markDeleteLimiter.tryAcquire()
called beforeinternalAsyncMarkDelete
, we can mock it to make it aways return false.pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedCursorImpl.java
Lines 1939 to 1947 in 6373180
Verifying this change
(Please pick either of the following options)
This change is a trivial rework / code cleanup without any test coverage.
(or)
This change is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(example:)
Does this pull request potentially affect one of the following parts:
If the box was checked, please highlight the changes
Documentation
doc
doc-required
doc-not-needed
doc-complete
Matching PR in forked repository
PR in forked repository: liangyepianzhou#10