File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
server/src/main/java/org/elasticsearch/index/engine Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -194,14 +194,18 @@ private Translog.Operation[] loadDocuments(List<SearchRecord> documentRecords) t
194194 maxDoc = leafReaderContext .reader ().maxDoc ();
195195 } while (docRecord .docID () >= docBase + maxDoc );
196196
197+ // TODO: instead of building an array, let's just check whether doc ids are (semi) dense
197198 IntArrayList nextDocIds = new IntArrayList ();
198199 for (int j = i ; j < documentRecords .size (); j ++) {
199- int docID = documentRecords .get (j ).docID ();
200- if (docBase + maxDoc >= docID ) {
201- break ;
200+ var record = documentRecords .get (j );
201+ if (record .isTombstone ()) {
202+ continue ;
203+ }
204+ int docID = record .docID ();
205+ if (docID >= docBase && docID < docBase + maxDoc ) {
206+ int segmentDocID = docID - docBase ;
207+ nextDocIds .add (segmentDocID );
202208 }
203- int segmentDocID = docID - docBase ;
204- nextDocIds .add (segmentDocID );
205209 }
206210
207211 int [] nextDocIdArray = nextDocIds .toArray ();
You can’t perform that action at this time.
0 commit comments