mirror of https://github.com/apache/lucene.git
LUCENE-7868: fix race condition when reader pooling is disabled
This commit is contained in:
parent
f0cc3769b5
commit
7c704d5258
|
@ -3758,7 +3758,6 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
|
|||
// and re-resolve against the newly merged segment:
|
||||
|
||||
Map<String,List<DocValuesFieldUpdates>> mergingDVUpdates = rld.getMergingDVUpdates();
|
||||
|
||||
for (Map.Entry<String,List<DocValuesFieldUpdates>> ent : mergingDVUpdates.entrySet()) {
|
||||
|
||||
String field = ent.getKey();
|
||||
|
@ -4356,6 +4355,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
|
|||
// Hold onto the "live" reader; we will use this to
|
||||
// commit merged deletes
|
||||
final ReadersAndUpdates rld = readerPool.get(info, true);
|
||||
rld.setIsMerging();
|
||||
|
||||
SegmentReader reader = rld.getReaderForMerge(context);
|
||||
int delCount = reader.numDeletedDocs();
|
||||
|
|
|
@ -811,9 +811,10 @@ class ReadersAndUpdates {
|
|||
synchronized public void setIsMerging() {
|
||||
// This ensures any newly resolved doc value updates while we are merging are
|
||||
// saved for re-applying after this segment is done merging:
|
||||
isMerging = true;
|
||||
|
||||
assert mergingDVUpdates.isEmpty();
|
||||
if (isMerging == false) {
|
||||
isMerging = true;
|
||||
assert mergingDVUpdates.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
/** Returns a reader for merge, with the latest doc values updates and deletions. */
|
||||
|
|
Loading…
Reference in New Issue