LUCENE-8233: Never reset initiazlized DV gen

We drop changes after we finish a merge, this has also reset
the DV generation the PendingSoftDeletes were initialized on causing
assertions to trip if releaseing the reader was writing DV to disk.
This change removes resetting the dv generation to make assertions
hold which requried to keep the pending change count on PendingSoftDeletes.
This commit is contained in:
Simon Willnauer 2018-04-13 09:30:32 +02:00
parent f41e7c4da7
commit d5b6857603
3 changed files with 7 additions and 7 deletions

View File

@ -166,7 +166,7 @@ class PendingDeletes {
/**
* Resets the pending docs
*/
void reset() {
void dropChanges() {
pendingDeleteCount = 0;
}
@ -223,7 +223,7 @@ class PendingDeletes {
// (successfully written) del docs:
info.advanceDelGen();
info.setDelCount(info.getDelCount() + pendingDeleteCount);
reset();
dropChanges();
return true;
}

View File

@ -88,10 +88,10 @@ final class PendingSoftDeletes extends PendingDeletes {
}
@Override
void reset() {
dvGeneration = -2;
super.reset();
hardDeletes.reset();
void dropChanges() {
// don't reset anything here - this is called after a merge (successful or not) to prevent
// rewriting the deleted docs to disk. we only pass it on and reset the number of pending deletes
hardDeletes.dropChanges();
}
/**

View File

@ -287,7 +287,7 @@ final class ReadersAndUpdates {
// is running, by now we have carried forward those
// deletes onto the newly merged segment, so we can
// discard them on the sub-readers:
pendingDeletes.reset();
pendingDeletes.dropChanges();
dropMergingUpdates();
}