LUCENE-7887: don't clear BufferedUpdatesStream on abort

This commit is contained in:
Mike McCandless 2017-06-29 05:52:19 -04:00
parent cabb1fa366
commit c9c0121d93
3 changed files with 4 additions and 7 deletions

View File

@ -175,11 +175,14 @@ class BufferedUpdatesStream implements Accountable {
// TODO: would be a bit more memory efficient to track this per-segment, so when each segment writes it writes all packets finished for
// it, rather than only recording here, across all segments. But, more complex code, and more CPU, and maybe not so much impact in
// practice?
assert packet.applied.getCount() == 1: "packet=" + packet;
packet.applied.countDown();
updates.remove(packet);
numTerms.addAndGet(-packet.numTermDeletes);
assert numTerms.get() >= 0: "numTerms=" + numTerms + " packet=" + packet;
bytesUsed.addAndGet(-packet.bytesUsed);
finishedSegment(packet.delGen());

View File

@ -299,7 +299,6 @@ class FrozenBufferedUpdates {
if (infoStream.isEnabled("BD")) {
infoStream.message("BD", "packet matches no segments");
}
break;
}
@ -422,10 +421,7 @@ class FrozenBufferedUpdates {
throw new IllegalArgumentException("gen is not yet set; call BufferedUpdatesStream.push first");
}
if (applied.getCount() == 0) {
// already done
return totalDelCount;
}
assert applied.getCount() != 0;
if (privateSegment != null) {
assert segStates.length == 1;

View File

@ -2364,8 +2364,6 @@ public class IndexWriter implements Closeable, TwoPhaseCommit, Accountable {
// set it to false before calling rollbackInternal
mergeScheduler.close();
bufferedUpdatesStream.clear();
docWriter.close(); // mark it as closed first to prevent subsequent indexing actions/flushes
docWriter.abort(this); // don't sync on IW here
synchronized(this) {