From acb216a71dc6dcd4cba55bc1cf61d4ac99eadace Mon Sep 17 00:00:00 2001 From: Matt White Date: Fri, 10 Oct 2025 17:54:03 +0000 Subject: [PATCH] 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 --- pkg/sql/mvcc_backfiller.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/sql/mvcc_backfiller.go b/pkg/sql/mvcc_backfiller.go index 2688152edbb4..6ae3889fcc72 100644 --- a/pkg/sql/mvcc_backfiller.go +++ b/pkg/sql/mvcc_backfiller.go @@ -58,7 +58,7 @@ func (im *IndexBackfillerMergePlanner) MergeIndexes( g.Add(sourceIndexSpan) g.Sub(progress.CompletedSpans[i]...) spansToDo[i] = g.Slice() - if len(spansToDo) > 0 { + if len(spansToDo[i]) > 0 { hasToDo = true } }