Skip to content

Commit

Permalink
Merge #31285
Browse files Browse the repository at this point in the history
31285: backport-2.1: sql: attempt to deflake distsql physical planner tests r=jordanlewis a=tschottdorf

Backport 1/1 commits from #31239.

Flaky as hell on release-2.1. Someone please ~~bors~~merge this for me with the LGTM.

/cc @cockroachdb/release

---

Make sure the range cache is populated before verifying things about it.

This seems like a hack, but otherwise I think these will just keep flaking.

Closes #25808.
Closes #31235.

Release note: None


Co-authored-by: Jordan Lewis <[email protected]>
  • Loading branch information
craig[bot] and jordanlewis committed Oct 11, 2018
2 parents 6680582 + be62f2d commit 00413b0
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 00413b0

Please sign in to comment.