diff --git a/pkg/sql/distsql_physical_planner_test.go b/pkg/sql/distsql_physical_planner_test.go index c41c4ade4a99..eb5255fa8e7d 100644 --- a/pkg/sql/distsql_physical_planner_test.go +++ b/pkg/sql/distsql_physical_planner_test.go @@ -337,6 +337,12 @@ func TestDistSQLRangeCachesIntegrationTest(t *testing.T) { t.Fatal(err) } + // Ensure that the range cache is populated (see #31235). + _, err = db0.Exec(`SHOW EXPERIMENTAL_RANGES FROM TABLE "right"`) + if err != nil { + t.Fatal(err) + } + // Run everything in a transaction, so we're bound on a connection on which we // force DistSQL. txn, err := db3.BeginTx(context.TODO(), nil /* opts */) @@ -419,6 +425,8 @@ func TestDistSQLDeadHosts(t *testing.T) { )) } + r.Exec(t, "SHOW EXPERIMENTAL_RANGES FROM TABLE t") + r.Exec(t, fmt.Sprintf("INSERT INTO t SELECT i, i*i FROM generate_series(1, %d) AS g(i)", n)) r.Exec(t, "SET DISTSQL = ON") @@ -507,6 +515,9 @@ func TestDistSQLDrainingHosts(t *testing.T) { ), ) + // Ensure that the range cache is populated (see #31235). + r.Exec(t, "SHOW EXPERIMENTAL_RANGES FROM TABLE nums") + const query = "SELECT count(*) FROM NUMS" expectPlan := func(expectedPlan [][]string) { planQuery := fmt.Sprintf(`SELECT url FROM [EXPLAIN (DISTSQL) %s]`, query)