-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Use a threadsafe map in SearchAsyncActionTests #33700
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
DaveCTurner
merged 2 commits into
elastic:master
from
DaveCTurner:2018-09-14-concurrent-map-in-SearchAsyncActionTests
Sep 25, 2018
Merged
Use a threadsafe map in SearchAsyncActionTests #33700
DaveCTurner
merged 2 commits into
elastic:master
from
DaveCTurner:2018-09-14-concurrent-map-in-SearchAsyncActionTests
Sep 25, 2018
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
Today `SearchAsyncActionTests#testFanOutAndCollect` uses a simple `HashMap` for the `nodeToContextMap` variable, which is then accessed from multiple threads without, apparently, explicit synchronisation. This provides an explanation for the test failure identified in elastic#29242 in which `.toString()` returns `"[]"` just before `.isEmpty` returns `false`, without any concurrent modifications. This change converts `nodeToContextMap` to a `newConcurrentMap()` so that this cannot occur. It also fixes a race condition in the detection of double-calling the subsequent search phase. Closes elastic#29242.
Collaborator
|
Pinging @elastic/es-search-aggs |
colings86
approved these changes
Sep 25, 2018
Contributor
colings86
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.
@DaveCTurner thanks for this. LGTM
DaveCTurner
added a commit
that referenced
this pull request
Sep 25, 2018
Today `SearchAsyncActionTests#testFanOutAndCollect` uses a simple `HashMap` for the `nodeToContextMap` variable, which is then accessed from multiple threads without, apparently, explicit synchronisation. This provides an explanation for the test failure identified in #29242 in which `.toString()` returns `"[]"` just before `.isEmpty` returns `false`, without any concurrent modifications. This change converts `nodeToContextMap` to a `newConcurrentMap()` so that this cannot occur. It also fixes a race condition in the detection of double-calling the subsequent search phase. Closes #29242.
danielmitterdorfer
added a commit
that referenced
this pull request
Oct 16, 2018
Today `SearchAsyncActionTests#testFanOutAndCollect` uses a simple `HashMap` for the `nodeToContextMap` variable, which is then accessed from multiple threads without, apparently, explicit synchronisation. This provides an explanation for the test failure identified in #29242 in which `.toString()` returns `"[]"` just before `.isEmpty` returns `false`, without any concurrent modifications. This change converts `nodeToContextMap` to a `newConcurrentMap()` so that this cannot occur. It also fixes a race condition in the detection of double-calling the subsequent search phase. This is a backport of #33700 to 5.6. Relates #33700 Relates #29242 Relates #34506
kcm
pushed a commit
that referenced
this pull request
Oct 30, 2018
Today `SearchAsyncActionTests#testFanOutAndCollect` uses a simple `HashMap` for the `nodeToContextMap` variable, which is then accessed from multiple threads without, apparently, explicit synchronisation. This provides an explanation for the test failure identified in #29242 in which `.toString()` returns `"[]"` just before `.isEmpty` returns `false`, without any concurrent modifications. This change converts `nodeToContextMap` to a `newConcurrentMap()` so that this cannot occur. It also fixes a race condition in the detection of double-calling the subsequent search phase. Closes #29242.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
:Search/Search
Search-related issues that do not fall into other categories
>test
Issues or PRs that are addressing/adding tests
v6.5.0
v7.0.0-beta1
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.
Today
SearchAsyncActionTests#testFanOutAndCollectuses a simpleHashMapforthe
nodeToContextMapvariable, which is then accessed from multiple threadswithout, apparently, explicit synchronisation. This provides an explanation for
the test failure identified in #29242 in which
.toString()returns"[]"just before
.isEmptyreturnsfalse, without any concurrent modifications.This change converts
nodeToContextMapto anewConcurrentMap()so that thiscannot occur. It also fixes a race condition in the detection of double-calling
the subsequent search phase.
Closes #29242.