GitHub user salsolatragus opened a pull request:
https://github.com/apache/lucene-solr/pull/446
SOLR-12736: Improve parallel iteration of two lists of same length.
The class `BooleanWeight` takes a `BooleanQuery` (a list of
`BooleanClause`s) as input and maintains a list of weights corresponding to the
clauses. The clauses and the weights are iterated in parallel in various places
throughout the class. At these code locations, it is not obvious that these two
lists always have the same length, i.e., that the parallel iteration is safe.
Moreover, the parallel iteration is not well supported by the Java language,
which is why this operation is implemented differently throughout the code.
This patch joins the two lists to enable parallel iteration without
managing two separate lists. This makes the codeâs intent more obvious and
prevents bugs due to the lists getting out of sync by a future change.
This problem was identified by our automated detector
[MUDetect](https://github.com/stg-tud/MUDetect/). We would very much appreciate
your feedback on our patch. Thank you very much!
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/MUBench/lucene-solr master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/lucene-solr/pull/446.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #446
----
commit 5522eebbcd8365d070fd08b09cdacac74643adb5
Author: Sven Amann <amann@...>
Date: 2018-09-05T11:24:23Z
Improve parallel iteration of two lists of same length.
The class `BooleanWeight` takes a `BooleanQuery` (a list of
`BooleanClause`s) as input and maintains a list of weights corresponding to the
clauses. The clauses and the weights are iterated in parallel in various places
throughout the class. At these code locations, it is not obvious that these two
lists always have the same length, i.e., that the parallel iteration is safe.
Moreover, the parallel iteration is not well supported by the Java language,
which is why this operation is implemented differently throughout the code.
This patch joins the two lists to enable parallel iteration without
managing two separate lists. This makes the codeâs intent more obvious and
prevents bugs due to the lists getting out of sync by a future change.
----
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]