diff --git a/lucene/src/java/org/apache/lucene/index/SegmentReader.java b/lucene/src/java/org/apache/lucene/index/SegmentReader.java index 95e4999e736..3b71ab64c34 100644 --- a/lucene/src/java/org/apache/lucene/index/SegmentReader.java +++ b/lucene/src/java/org/apache/lucene/index/SegmentReader.java @@ -750,6 +750,8 @@ public class SegmentReader extends IndexReader implements Cloneable { if (deletedDocsDirty) { // re-write deleted si.advanceDelGen(); + assert deletedDocs.length() == si.docCount; + // We can write directly to the actual name (vs to a // .tmp & renaming it) because the file is not live // until segments file is written: