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 SimpleNestedIT.testExplain flaky test #11681

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

neetikasinghal
Copy link
Contributor

@neetikasinghal neetikasinghal commented Dec 27, 2023

Description

The explain itself is coming from Lucene: https://github.com/apache/lucene/blob/a6f70ad2bb0b682eb65feb522358ee6d16cad766/lucene/join/src/java/org/apache/lucene/search/join/ToParentBlockJoinQuery.java#L432-L440

Here's some info on the docIds in lucene:

  • A DocId in lucene is not actually unique to the Index but is unique to a Segment. Lucene does this mainly to optimize writing and compression. Since it is only unique to a Segment, how can a Doc be uniquely identified at the Index level? The solution is simple. The segments are ordered. To take a simple example, an Index has two segments and each segment has 100 docs respectively. The DocId's in the Segment are 0-100 but when they are converted to the Index level, the range of the DocId's in the second Segment is converted to 100-200.

  • DocId's are unique within a Segment, numbered progressively from zero. But this does not mean that the DocId's are continuous. When a Doc is deleted, there is a gap.

  • The DocId corresponding to a document can change, usually when Segments are merged.

The test fails on the validation of range of the docIds in the assertion, the range changes as with indexRandomForConcurrentSearch function there are several bogus documents ingested and deleted which could trigger background merges and cause the range of the docIds matched with the search query to change.

One of the solutions is to call refresh after indexing the actual document which would create a new segment for the actual document and prevent it to be merged with the bogus documents, this is done as part of this PR.

Related Issues

Resolves #11413

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Failing checks are inspected and point to the corresponding known issue(s) (See: Troubleshooting Failing Builds)
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)
  • Public documentation issue/PR created

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.

Copy link
Contributor

github-actions bot commented Jan 2, 2024

✅ Gradle check result for 69378f1: SUCCESS

Copy link
Contributor

github-actions bot commented Jan 5, 2024

❌ Gradle check result for 9045235: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

github-actions bot commented Jan 8, 2024

❌ Gradle check result for 7c3df12: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@neetikasinghal
Copy link
Contributor Author

@reta updated the PR based on the discussion: #11413

Copy link
Contributor

github-actions bot commented Jan 9, 2024

❌ Gradle check result for 7fb9849:

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

@reta
Copy link
Collaborator

reta commented Jan 10, 2024

@reta updated the PR based on the discussion: #11413

Thanks @neetikasinghal , LGTM from my side (but @sohami has a good point)

Copy link
Contributor

❌ Gradle check result for 4172f1f: FAILURE

Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green. Is the failure a flaky test unrelated to your change?

Copy link
Contributor

✅ Gradle check result for 5cb6b98: SUCCESS

@neetikasinghal neetikasinghal added the backport 2.x Backport to 2.x branch label Jan 11, 2024
Copy link
Collaborator

@sohami sohami left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sohami sohami merged commit bbe790b into opensearch-project:main Jan 11, 2024
33 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jan 11, 2024
Signed-off-by: Neetika Singhal <[email protected]>
(cherry picked from commit bbe790b)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kotwanikunal pushed a commit that referenced this pull request Jan 11, 2024
(cherry picked from commit bbe790b)

Signed-off-by: Neetika Singhal <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
rayshrey pushed a commit to rayshrey/OpenSearch that referenced this pull request Mar 18, 2024
shiv0408 pushed a commit to Gaurav614/OpenSearch that referenced this pull request Apr 25, 2024
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.

[BUG] org.opensearch.search.nested.SimpleNestedIT.testExplain is flaky
5 participants