-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[TEST] wait for all active shards when indexing data #121442
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
Merged
elasticsearchmachine
merged 3 commits into
elastic:main
from
andreidan:fix-test-mtermvectors
Feb 3, 2025
Merged
[TEST] wait for all active shards when indexing data #121442
elasticsearchmachine
merged 3 commits into
elastic:main
from
andreidan:fix-test-mtermvectors
Feb 3, 2025
Conversation
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
This attempts to fix a flay test where the term_freq returned by the multiple terms vectors API was `null`. I was not able to reproduce this test but this proposes a fix based on the following running theory: - an Elasticsearch cluster comprised of at least 2 nodes - we create a couple of indices with 1 primary and 1 replica - we index a document that was acknowledged only by the primary (because `wait_for_active_shards` defaults to `1`) - the test executes the multiple terms vectors API and it hits the node hosting the replica shard, which hasn't yet received the document we ingested in the primary shard. This race condition between the document replication and the test running the terms vectors API on the replica shard could yield a `null` value for the the term's `term_freq` (as the replica shard contains 0 documents). This PR proposes we change the `wait_for_active_shards` value to `all` so each write is acknowledged by all replicas before the client receives the response.
Collaborator
|
Pinging @elastic/es-search-foundations (Team:Search Foundations) |
piergm
approved these changes
Jan 31, 2025
Member
piergm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theory make sense to me! More so if it's not always failing but a flaky test 😄 Nice one Andrei! Let's hope the theory is correct 🤞
Contributor
Author
|
@elasticmachine update branch |
Contributor
Author
|
@elasticmachine update branch |
This was referenced Feb 10, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
auto-backport
Automatically create backport pull requests when merged
auto-merge-without-approval
Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!)
low-risk
An open issue or test failure that is a low risk to future releases
:Search Foundations/Search
Catch all for Search Foundations
Team:Search Foundations
Meta label for the Search Foundations team in Elasticsearch
>test-failure
Triaged test failures from CI
v8.19.0
v9.0.0
v9.1.0
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.
This attempts to fix a flay test where the term_freq returned by the multiple terms vectors API was
null.I was not able to reproduce this test but this proposes a fix based on the following running theory:
wait_for_active_shardsdefaults to1)This race condition between the document replication and the test running the terms vectors API on the replica shard could yield a
nullvalue for the the term'sterm_freq(as the replica shard contains 0 documents).This PR proposes we change the
wait_for_active_shardsvalue toallso each write is acknowledged by all replicas before the client receives the response.Fixes #113325