mirror of https://github.com/apache/lucene.git
LUCENE-8232: Write and Checkpoint DV updates seperately if we drop a reader
This commit is contained in:
parent
acb3c37942
commit
ca02e637ff
|
@ -604,10 +604,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
|
||||||
if (!poolReaders && rld.refCount() == 1 && readerMap.containsKey(rld.info)) {
|
if (!poolReaders && rld.refCount() == 1 && readerMap.containsKey(rld.info)) {
|
||||||
// This is the last ref to this RLD, and we're not
|
// This is the last ref to this RLD, and we're not
|
||||||
// pooling, so remove it:
|
// pooling, so remove it:
|
||||||
boolean changed = rld.writeLiveDocs(directory);
|
if (rld.writeLiveDocs(directory)) {
|
||||||
changed |= rld.writeFieldUpdates(directory, globalFieldNumberMap, bufferedUpdatesStream.getCompletedDelGen(), infoStream);
|
|
||||||
|
|
||||||
if (changed) {
|
|
||||||
// Make sure we only write del docs for a live segment:
|
// Make sure we only write del docs for a live segment:
|
||||||
assert assertInfoLive == false || assertInfoIsLive(rld.info);
|
assert assertInfoLive == false || assertInfoIsLive(rld.info);
|
||||||
// Must checkpoint because we just
|
// Must checkpoint because we just
|
||||||
|
@ -619,6 +616,9 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
|
||||||
// did was move the state to disk:
|
// did was move the state to disk:
|
||||||
checkpointNoSIS();
|
checkpointNoSIS();
|
||||||
}
|
}
|
||||||
|
if (rld.writeFieldUpdates(directory, globalFieldNumberMap, bufferedUpdatesStream.getCompletedDelGen(), infoStream)) {
|
||||||
|
checkpointNoSIS();
|
||||||
|
}
|
||||||
if (rld.getNumDVUpdates() == 0) {
|
if (rld.getNumDVUpdates() == 0) {
|
||||||
rld.dropReaders();
|
rld.dropReaders();
|
||||||
readerMap.remove(rld.info);
|
readerMap.remove(rld.info);
|
||||||
|
|
Loading…
Reference in New Issue