@@ -342,6 +342,7 @@ func (ib *indexBackfiller) ingestIndexEntries(
342
342
343
343
var vectorInputEntry rowenc.IndexEntry
344
344
for indexBatch := range indexEntryCh {
345
+ addedToVectorIndex := false
345
346
for _ , indexEntry := range indexBatch .indexEntries {
346
347
// Pace the admission control before processing each index entry.
347
348
if err := pacer .Pace (ctx ); err != nil {
@@ -359,6 +360,7 @@ func (ib *indexBackfiller) ingestIndexEntries(
359
360
if err != nil {
360
361
return ib .wrapDupError (ctx , err )
361
362
} else if isVectorIndex {
363
+ addedToVectorIndex = true
362
364
continue
363
365
}
364
366
}
@@ -374,6 +376,12 @@ func (ib *indexBackfiller) ingestIndexEntries(
374
376
mu .Lock ()
375
377
mu .addedSpans = append (mu .addedSpans , indexBatch .completedSpan )
376
378
mu .Unlock ()
379
+ // Vector indexes don't add to the bulk adder and take a long time to add
380
+ // entries, so flush progress manually after every indexBatch is processed
381
+ // that contained vector index entries.
382
+ if addedToVectorIndex {
383
+ flushAddedSpans (kvpb.BulkOpSummary {})
384
+ }
377
385
378
386
// After the index KVs have been copied to the underlying BulkAdder, we can
379
387
// free the memory which was accounted when building the index entries of the
@@ -404,14 +412,6 @@ func (ib *indexBackfiller) ingestIndexEntries(
404
412
if err := g .Wait (); err != nil {
405
413
return err
406
414
}
407
-
408
- // If there are only vector indexes, we push the completed spans manually so that
409
- // progress reporting works.
410
- // TODO(mw5h): this is a hack to get progress reporting to work for vector only
411
- // backfills. We should remove this once we have a more permanent solution.
412
- if ib .VectorOnly {
413
- flushAddedSpans (kvpb.BulkOpSummary {})
414
- }
415
415
if err := adder .Flush (ctx ); err != nil {
416
416
return ib .wrapDupError (ctx , err )
417
417
}
0 commit comments