Skip to content

Fix flaky DataFormatAwareReplicaGetByIdIT when zero docs are indexed#22365

Open
LantaoJin wants to merge 1 commit into
opensearch-project:mainfrom
LantaoJin:fix/dfae-replica-getbyid-it-flaky
Open

Fix flaky DataFormatAwareReplicaGetByIdIT when zero docs are indexed#22365
LantaoJin wants to merge 1 commit into
opensearch-project:mainfrom
LantaoJin:fix/dfae-replica-getbyid-it-flaky

Conversation

@LantaoJin

@LantaoJin LantaoJin commented Jul 1, 2026

Copy link
Copy Markdown
Member

Description

testGetByIdFromReplica picked its document count with randomInt(20), which is inclusive of 0. On the (~1-in-21) runs where it rolled 0, the test indexed no documents and then failed in assertCatalogSnapshotsConverged(...).
With 0 docs, the index only ever produces a segments_N commit file. assertCatalogSnapshotsConverged calls assertLuceneIndexDirContents, which — because this suite runs with a Lucene secondary format (hasLuceneSecondary() returns true) — asserts the shard's index/ directory contains segment data files beyond segments_N (.si, .cfs, etc.). An empty index never writes those, so the assertion tripped:

parquet+lucene: index/ must have segment data files beyond segments_N, got [segments_N, write.lock]

The failure was purely a function of the random seed, making it an intermittent (flaky) failure rather than a real regression in the replica get-by-id path.

Related Issues

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • Functionality includes testing.
  • API changes companion pull request created, if applicable.
  • Public documentation issue/PR created, if applicable.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Lantao Jin <ltjin@amazon.com>
@LantaoJin LantaoJin requested a review from a team as a code owner July 1, 2026 02:36
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🧪 PR contains tests
🔒 No security concerns identified
✅ No TODO sections
🔀 No multiple PR themes
⚡ No major issues detected

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

❕ Gradle check result for f24dd04: UNSTABLE

Please review all flaky tests that succeeded after retry and create an issue if one does not already exist to track the flaky failure.

@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.38%. Comparing base (1e31adf) to head (f24dd04).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #22365      +/-   ##
============================================
+ Coverage     73.34%   73.38%   +0.04%     
- Complexity    76017    76062      +45     
============================================
  Files          6076     6076              
  Lines        345507   345508       +1     
  Branches      49732    49732              
============================================
+ Hits         253409   253568     +159     
+ Misses        71869    71744     -125     
+ Partials      20229    20196      -33     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants