Skip to content

Commit 697cd49

Browse files
committed
Remove sort by primary term when reading soft-deletes (#43845)
With Lucene rollback (#33473), we should never have more than one primary term for each sequence number. Therefore we don't have to sort by the primary term when reading soft-deletes.
1 parent 1ea5397 commit 697cd49

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

server/src/main/java/org/elasticsearch/index/engine/LuceneChangesSnapshot.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,8 @@ private void fillParallelArray(ScoreDoc[] scoreDocs, ParallelArray parallelArray
211211

212212
private TopDocs searchOperations(ScoreDoc after) throws IOException {
213213
final Query rangeQuery = LongPoint.newRangeQuery(SeqNoFieldMapper.NAME, Math.max(fromSeqNo, lastSeenSeqNo), toSeqNo);
214-
final Sort sortedBySeqNoThenByTerm = new Sort(
215-
new SortField(SeqNoFieldMapper.NAME, SortField.Type.LONG),
216-
new SortField(SeqNoFieldMapper.PRIMARY_TERM_NAME, SortField.Type.LONG, true)
217-
);
218-
return indexSearcher.searchAfter(after, rangeQuery, searchBatchSize, sortedBySeqNoThenByTerm);
214+
final Sort sortedBySeqNo = new Sort(new SortField(SeqNoFieldMapper.NAME, SortField.Type.LONG));
215+
return indexSearcher.searchAfter(after, rangeQuery, searchBatchSize, sortedBySeqNo);
219216
}
220217

221218
private Translog.Operation readDocAsOp(int docIndex) throws IOException {

0 commit comments

Comments
 (0)