Github user dweiss commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/502#discussion_r235062399
--- Diff: lucene/core/src/java/org/apache/lucene/index/IndexWriter.java ---
@@ -4350,6 +4351,33 @@ private synchronized void
closeMergeReaders(MergePolicy.OneMerge merge, boolean
}
}
+ private int countSoftDeletes(CodecReader reader, Bits wrappedLiveDocs,
Bits hardLiveDocs, Counter softDeleteCounter) throws IOException {
+ int hardDeleteCount = 0;
+ int softDeletesCount = 0;
+ DocIdSetIterator softDeletedDocs =
DocValuesFieldExistsQuery.getDocValuesDocIdSetIterator(config.getSoftDeletesField(),
reader);
+ if (softDeletedDocs != null) {
+ int docId;
+ while ((docId = softDeletedDocs.nextDoc()) !=
DocIdSetIterator.NO_MORE_DOCS) {
+ if (wrappedLiveDocs == null || wrappedLiveDocs.get(docId)) {
+ if (hardLiveDocs == null || hardLiveDocs.get(docId)) {
+ softDeletesCount++;
+ } else {
+ hardDeleteCount++;
+ }
+ }
+ }
+ }
+ softDeleteCounter.addAndGet(softDeletesCount);
+ return hardDeleteCount;
+ }
+
+ private boolean assertSoftDeletesCount(CodecReader reader, int
expectedCount) throws IOException {
+ Counter count = Counter.newCounter(false);
+ countSoftDeletes(reader, reader.getLiveDocs(), null, count);
+ assert count.get() == expectedCount : "soft-deletes cound missmatch
expected: " + expectedCount + " but actual: " + count.get() ;
--- End diff --
missmatch -> mismatch
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]