Skip to content

Commit

Permalink
sql: attempt to deflake distsql physical planner tests
Browse files Browse the repository at this point in the history
Make sure the range cache is populated before verifying things about it.

Release note: None
  • Loading branch information
jordanlewis authored and tbg committed Oct 11, 2018
1 parent 6680582 commit be62f2d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/sql/distsql_physical_planner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 */)
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit be62f2d

Please sign in to comment.