Skip to content
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

Merged
merged 3 commits into from
Nov 21, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
optimize
  • Loading branch information
liangyepianzhou committed Nov 14, 2022
commit 7a46cdd804f47baa6572b6f8cb2282a3c925a88c
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,18 @@ public void testRecoverSequenceId(boolean isUseManagedLedgerProperties) throws E
transactionMetadataStore.init(new TransactionRecoverTrackerImpl()).get();

Awaitility.await().until(transactionMetadataStore::checkIfReady);
//Mock a rateLimiter to avoid the internalMarkDelete call onCursorMarkDeletePositionUpdated
Field cursorField = MLTransactionLogImpl.class.getDeclaredField("cursor");
cursorField.setAccessible(true);
ManagedCursor cursor = (ManagedCursor) cursorField.get(mlTransactionLog);
Field rateLimiterFiled = ManagedCursorImpl.class.getDeclaredField("markDeleteLimiter");
rateLimiterFiled.setAccessible(true);

RateLimiter rateLimiter = mock(RateLimiter.class);
doReturn(false).when(rateLimiter).tryAcquire();
rateLimiterFiled.set(cursor, rateLimiter);

if (isUseManagedLedgerProperties) {
//Mock a rateLimiter to avoid the internalMarkDelete call onCursorMarkDeletePositionUpdated
Field cursorField = MLTransactionLogImpl.class.getDeclaredField("cursor");
cursorField.setAccessible(true);
ManagedCursor cursor = (ManagedCursor) cursorField.get(mlTransactionLog);
Field rateLimiterFiled = ManagedCursorImpl.class.getDeclaredField("markDeleteLimiter");
rateLimiterFiled.setAccessible(true);

RateLimiter rateLimiter = mock(RateLimiter.class);
doReturn(false).when(rateLimiter).tryAcquire();
rateLimiterFiled.set(cursor, rateLimiter);
}
TxnID txnID = transactionMetadataStore.newTransaction(20000).get();
transactionMetadataStore.updateTxnStatus(txnID, TxnStatus.COMMITTING, TxnStatus.OPEN, false).get();
if (isUseManagedLedgerProperties) {
Expand Down