[fix][test] fix flaky test testRecoverSequenceId#18437
Merged
Technoboy- merged 3 commits intoapache:masterfrom Nov 21, 2022
liangyepianzhou:xiangying/fix/flaky-test/testRecoverSequenceId
Merged
[fix][test] fix flaky test testRecoverSequenceId#18437Technoboy- merged 3 commits intoapache:masterfrom liangyepianzhou:xiangying/fix/flaky-test/testRecoverSequenceId
Technoboy- merged 3 commits intoapache:masterfrom
liangyepianzhou:xiangying/fix/flaky-test/testRecoverSequenceId
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.
|
Technoboy-
approved these changes
Nov 18, 2022
poorbarcode
approved these changes
Nov 18, 2022
Contributor
There was a problem hiding this comment.
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
lifepuzzlefun
pushed a commit
to lifepuzzlefun/pulsar
that referenced
this pull request
Dec 9, 2022
lifepuzzlefun
pushed a commit
to lifepuzzlefun/pulsar
that referenced
this pull request
Jan 10, 2023
tisonkun
pushed a commit
to tisonkun/pulsar
that referenced
this pull request
Jul 12, 2023
…ting module to flink-connector-test-utils module This closes apache#18437.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: #18396
Motivation
The logic we expected:
maxEntriesPerLedger= 3MlTransactionLog, such as [3:0] [3:1] [3:2]rollCurrentLedgerIfFullto close the old ledger and create a new ledgermaybeUpdateCursorBeforeTrimmingConsumedLedgerin thecreateCompleteof 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
internalAsyncMarkDeleteand 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
docdoc-requireddoc-not-neededdoc-completeMatching PR in forked repository
PR in forked repository: liangyepianzhou#10