Skip to content

Commit

Permalink
Merge pull request #131440 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-24.2-131369

release-24.2: roachtest: set timeout in MR costfuzz, unoptimized-query-oracle
  • Loading branch information
michae2 authored Sep 26, 2024
2 parents 1f4be74 + 7495bb4 commit f4a8916
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions pkg/cmd/roachtest/tests/query_comparison_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,34 @@ func runOneRoundQueryComparison(
fmt.Fprint(failureLog, "\n")
}

connSetup := func(conn *gosql.DB) {
setStmtTimeout := fmt.Sprintf("SET statement_timeout='%s';", statementTimeout.String())
t.Status("setting statement_timeout")
t.L().Printf("statement timeout:\n%s", setStmtTimeout)
if _, err := conn.Exec(setStmtTimeout); err != nil {
t.Fatal(err)
}
logStmt(setStmtTimeout)

setUnconstrainedStmt := "SET unconstrained_non_covering_index_scan_enabled = true;"
t.Status("setting unconstrained_non_covering_index_scan_enabled")
t.L().Printf("\n%s", setUnconstrainedStmt)
if _, err := conn.Exec(setUnconstrainedStmt); err != nil {
logStmt(setUnconstrainedStmt)
t.Fatal(err)
}
logStmt(setUnconstrainedStmt)
}

node := 1
conn := c.Conn(ctx, t.L(), node)

rnd, seed := randutil.NewTestRand()
t.L().Printf("seed: %d", seed)
t.L().Printf("setupName: %s", qct.setupName)

connSetup(conn)

if qct.setupName == "workload-replay" {

logTest := func(logStr string, logType string) {
Expand Down Expand Up @@ -308,23 +329,6 @@ func runOneRoundQueryComparison(
}
}

setStmtTimeout := fmt.Sprintf("SET statement_timeout='%s';", statementTimeout.String())
t.Status("setting statement_timeout")
t.L().Printf("statement timeout:\n%s", setStmtTimeout)
if _, err := conn.Exec(setStmtTimeout); err != nil {
t.Fatal(err)
}
logStmt(setStmtTimeout)

setUnconstrainedStmt := "SET unconstrained_non_covering_index_scan_enabled = true;"
t.Status("setting unconstrained_non_covering_index_scan_enabled")
t.L().Printf("\n%s", setUnconstrainedStmt)
if _, err := conn.Exec(setUnconstrainedStmt); err != nil {
logStmt(setUnconstrainedStmt)
t.Fatal(err)
}
logStmt(setUnconstrainedStmt)

conn2 := conn
if qct.isMultiRegion {
t.Status("setting up multi-region database")
Expand All @@ -334,6 +338,7 @@ func runOneRoundQueryComparison(
node2 := rnd.Intn(qct.nodeCount-1) + 2
t.Status(fmt.Sprintf("running some queries from node %d with conn1 and some queries from node %d with conn2", node, node2))
conn2 = c.Conn(ctx, t.L(), node2)
connSetup(conn2)
}

// Initialize a smither that generates only INSERT and UPDATE statements with
Expand Down

0 comments on commit f4a8916

Please sign in to comment.