Skip to content

[fix][test]fix flaky test MLPendingAckStoreTest.testMainProcess - #18310

Merged
liangyepianzhou merged 2 commits into
apache:masterfrom
poorbarcode:fix/concurrent_cursor_close
Nov 3, 2022
Merged

liangyepianzhou merged 2 commits into
apache:masterfrom
poorbarcode:fix/concurrent_cursor_close

Conversation

@poorbarcode

Copy link
Copy Markdown
Contributor

Fixes #18230

Motivation

ManagedCursorImpl has a known problem: when the cursor.close and the cursor.switchLedger are concurrent executing, a bad version exception is thrown. see:

if (e instanceof MetaStoreException.BadVersionException) {
log.warn("[{}] Failed to update cursor metadata for {} due to version conflict {}",
ledger.name, name, e.getMessage());
// it means previous owner of the ml might have updated the version incorrectly. So, check
// the ownership and refresh the version again.
if (ledger.mlOwnershipChecker != null && ledger.mlOwnershipChecker.get()) {
ledger.getStore().asyncGetCursorInfo(ledger.getName(), name,
new MetaStoreCallback<ManagedCursorInfo>() {
@Override
public void operationComplete(ManagedCursorInfo info, Stat stat) {
updateCursorLedgerStat(info, stat);
}
@Override
public void operationFailed(MetaStoreException e) {
if (log.isDebugEnabled()) {
log.debug(
"[{}] Failed to refresh cursor metadata-version for {} due "
+ "to {}", ledger.name, name, e.getMessage());
}
}
});
}
}
callback.operationFailed(e);

In this test, it hit this problem:

  • MlPendingAckStore.clearUselessLogData will trigger cursor.switchLedger if it is the first execute mard delete.
  • MlPendingAckStore.close will trigger cursor.close

Modifications

if MlPendingAckStore.close fail, just retry, it will be ok

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository:

@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Nov 2, 2022
@codecov-commenter

codecov-commenter commented Nov 3, 2022 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.97%. Comparing base (2e878e8) to head (8a00af2).
⚠️ Report is 3384 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #18310      +/-   ##
============================================
- Coverage     40.04%   39.97%   -0.08%     
+ Complexity     8625     8615      -10     
============================================
  Files           687      687              
  Lines         67436    67440       +4     
  Branches       7221     7221              
============================================
- Hits          27007    26959      -48     
- Misses        37411    37457      +46     
- Partials       3018     3024       +6     
Flag Coverage Δ
unittests 39.97% <ø> (-0.08%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 39 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@liangyepianzhou
liangyepianzhou merged commit 2bed5ff into apache:master Nov 3, 2022
@poorbarcode
poorbarcode deleted the fix/concurrent_cursor_close branch November 4, 2022 07:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky-test: MLPendingAckStoreTest.testMainProcess

5 participants