diff --git a/lucene/core/src/java/org/apache/lucene/index/PendingDeletes.java b/lucene/core/src/java/org/apache/lucene/index/PendingDeletes.java index fca42b416d5..52d06e8fd29 100644 --- a/lucene/core/src/java/org/apache/lucene/index/PendingDeletes.java +++ b/lucene/core/src/java/org/apache/lucene/index/PendingDeletes.java @@ -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; } diff --git a/lucene/core/src/java/org/apache/lucene/index/PendingSoftDeletes.java b/lucene/core/src/java/org/apache/lucene/index/PendingSoftDeletes.java index 0d7852b0eeb..4c3db482ab5 100644 --- a/lucene/core/src/java/org/apache/lucene/index/PendingSoftDeletes.java +++ b/lucene/core/src/java/org/apache/lucene/index/PendingSoftDeletes.java @@ -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(); } /** diff --git a/lucene/core/src/java/org/apache/lucene/index/ReadersAndUpdates.java b/lucene/core/src/java/org/apache/lucene/index/ReadersAndUpdates.java index 6dc88643181..b236bea68a0 100644 --- a/lucene/core/src/java/org/apache/lucene/index/ReadersAndUpdates.java +++ b/lucene/core/src/java/org/apache/lucene/index/ReadersAndUpdates.java @@ -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(); }