Skip to content

Commit cd09eda

Browse files
committed
sql: fix early exit from merge index planner
The MergeIndexes() method of the IndexBackfillerMergePlanner has a check to see if there are any spans to merge before proceeding with building the plan for the merge. Previously the check for this was checking whether there were any elements in spansToDo, which is allocated to have one entry per source index ID, causing the length check to be vacuously true. The logic probably meant to to check the length of the spans list for each individual source index ID, which this patch puts into place. Epic: none Release note: None
1 parent 481e179 commit cd09eda

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/sql/mvcc_backfiller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func (im *IndexBackfillerMergePlanner) MergeIndexes(
5858
g.Add(sourceIndexSpan)
5959
g.Sub(progress.CompletedSpans[i]...)
6060
spansToDo[i] = g.Slice()
61-
if len(spansToDo) > 0 {
61+
if len(spansToDo[i]) > 0 {
6262
hasToDo = true
6363
}
6464
}

0 commit comments

Comments
 (0)