Fix doc stats test when deleting all docs
This commit fixes an issue with IndexShardTests#testDocStats when the number of deleted docs is equal to the number of docs. In this case, Luence will remove the underlying segment tripping an assertion on the number of deleted docs.
This commit is contained in:
parent
6deb5283db
commit
d5c18bf5c9
|
@ -1401,7 +1401,8 @@ public class IndexShardTests extends IndexShardTestCase {
|
|||
IntStream.range(0, Math.toIntExact(numDocs)).boxed().collect(Collectors.toList()));
|
||||
for (final Integer i : ids) {
|
||||
final String id = Integer.toString(i);
|
||||
final ParsedDocument doc = testParsedDocument(id, id, "test", null, new ParseContext.Document(), new BytesArray("{}"), null);
|
||||
final ParsedDocument doc =
|
||||
testParsedDocument(id, id, "test", null, new ParseContext.Document(), new BytesArray("{}"), null);
|
||||
final Engine.Index index =
|
||||
new Engine.Index(
|
||||
new Term("_uid", id),
|
||||
|
@ -1428,7 +1429,8 @@ public class IndexShardTests extends IndexShardTestCase {
|
|||
{
|
||||
final DocsStats docStats = indexShard.docStats();
|
||||
assertThat(docStats.getCount(), equalTo(numDocs));
|
||||
assertThat(docStats.getDeleted(), equalTo(numDocsToDelete));
|
||||
// Lucene will delete a segment if all docs are deleted from it; this means that we lose the deletes when deleting all docs
|
||||
assertThat(docStats.getDeleted(), equalTo(numDocsToDelete == numDocs ? 0 : numDocsToDelete));
|
||||
}
|
||||
|
||||
// merge them away
|
||||
|
|
Loading…
Reference in New Issue