-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
ConcurrentModificationException in ShardFieldUsageTracker #78899
Comments
This is not something that we support by default. Are you saying that you do that in a custom plugin ? I am afraid that there's more than just the
The problem is more general I think. We expect a single thread per search at the moment so changing this would require more architectural changes. Can you describe the use case that you're trying to solve with the concurrent search ? |
This is done in a plugin that executes joins over indices. The goal is to execute a search concurrently against segments of a shard: a series of searches is executed on several indices, thus we seek to reduce the time spent on a search as much as possible. A segment being read-only, it is better to do it this way than to operate on the segments sequentially.
I am sure you are aware of this, but doesn't this go against the
Off the top of your head, can you point to some of the readers that would be problematic ? |
Well it should work in practice and it's supported in Lucene. However we don't use this feature in Elasticsearch so it's not tested and some of our custom collectors could break like aggregations for instance. It's something that can change, we already discussed supporting this feature, so it seems reasonable to try to avoid breaking the concurrency when possible. |
It's something we will need to benchmark: While the initial implementation was using synchronization, it was only the simpler non-synchronized version later on that was benchmarked. |
Pinging @elastic/es-search (Team:Search) |
Can I help running this benchmark ? |
We discussed this internally, and will check the effects of #79088 using our nightly regression benchmarks. |
While Lucene readers are currently only sequentially accessed, we expect future usages (and custom plugins) to access this concurrently. Closes #78899
While Lucene readers are currently only sequentially accessed, we expect future usages (and custom plugins) to access this concurrently. Closes elastic#78899
While testing the version 7.15, I got a
ConcurrentModificationException
coming from theFieldUsageTrackingDirectoryReader
:From what I can tell, the
ShardFieldUsageTracker
uses an hashmap that is modified concurrently: I create aScorer
in several threads, one per segment. The creation of the scorer fails with theConcurrentModificationException
.elasticsearch/server/src/main/java/org/elasticsearch/index/search/stats/ShardFieldUsageTracker.java
Line 160 in 79d65f6
Is it possible to make that
usages
variable aConcurrentHashMap
? Should I try to create a PR with a reproducing unit test ?The text was updated successfully, but these errors were encountered: