Skip to content

Commit

Permalink
Merge pull request #102045 from cockroachdb/blathers/backport-release…
Browse files Browse the repository at this point in the history
…-23.1-102038

release-23.1: roachtest: some more logging for costfuzz and unoptimized query oracle
  • Loading branch information
yuzefovich authored Apr 22, 2023
2 parents 61d670a + 086aac6 commit 01f129a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pkg/cmd/roachtest/tests/query_comparison_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/roachprod/install"
"github.com/cockroachdb/cockroach/pkg/testutils/sqlutils"
"github.com/cockroachdb/cockroach/pkg/util/randutil"
"github.com/cockroachdb/cockroach/pkg/util/timeutil"
"github.com/cockroachdb/errors"
)

Expand Down Expand Up @@ -304,6 +305,17 @@ type queryComparisonHelper struct {
// plan, and the output of running the query so they can be logged in case of
// failure.
func (h *queryComparisonHelper) runQuery(stmt string) ([][]string, error) {
// Log this statement with a timestamp but commented out. This will help in
// cases when the stmt will get stuck and the whole test will time out (in
// such a scenario, since the stmt didn't execute successfully, it won't get
// logged by the caller).
h.logStmt(fmt.Sprintf("-- %s: %s", timeutil.Now(),
// Remove all newline symbols to log this stmt as a single line. This
// way this auxiliary logging takes up less space (if the stmt executes
// successfully, it'll still get logged with the nice formatting).
strings.ReplaceAll(stmt, "\n", "")),
)

runQueryImpl := func(stmt string) ([][]string, error) {
rows, err := h.conn.Query(stmt)
if err != nil {
Expand Down

0 comments on commit 01f129a

Please sign in to comment.