diff --git a/pkg/sql/opt/bench/BUILD.bazel b/pkg/sql/opt/bench/BUILD.bazel index 6dee01889fc6..a0f6c458277e 100644 --- a/pkg/sql/opt/bench/BUILD.bazel +++ b/pkg/sql/opt/bench/BUILD.bazel @@ -32,6 +32,7 @@ go_test( "//pkg/testutils/serverutils", "//pkg/testutils/skip", "//pkg/testutils/sqlutils", + "//pkg/util/log", "//pkg/util/randutil", "//pkg/util/timeutil", ], diff --git a/pkg/sql/opt/bench/bench_test.go b/pkg/sql/opt/bench/bench_test.go index d35ffd909b67..f1c66bf12a76 100644 --- a/pkg/sql/opt/bench/bench_test.go +++ b/pkg/sql/opt/bench/bench_test.go @@ -38,6 +38,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/testutils/serverutils" "github.com/cockroachdb/cockroach/pkg/testutils/skip" "github.com/cockroachdb/cockroach/pkg/testutils/sqlutils" + "github.com/cockroachdb/cockroach/pkg/util/log" "github.com/cockroachdb/cockroach/pkg/util/randutil" "github.com/cockroachdb/cockroach/pkg/util/timeutil" ) @@ -278,7 +279,7 @@ var profileQuery = flag.String("profile-query", "kv-read", "name of query to run func TestCPUProfile(t *testing.T) { skip.IgnoreLint(t, "Remove this when profiling. Use profile flags above to configure. Sample command line: \n"+ - "GOMAXPROCS=1 go test -run TestCPUProfile --logtostderr NONE && go tool pprof bench.test cpu.out", + "GOMAXPROCS=1 go test -run TestCPUProfile && go tool pprof cpu.out", ) h := newHarness() @@ -319,6 +320,7 @@ func BenchmarkPhases(b *testing.B) { // BenchmarkEndToEnd measures the time to execute a query end-to-end. func BenchmarkEndToEnd(b *testing.B) { + defer log.Scope(b).Close(b) h := newHarness() defer h.close() diff --git a/pkg/sql/opt/bench/fk_test.go b/pkg/sql/opt/bench/fk_test.go index 134e436561a8..8188c8baff25 100644 --- a/pkg/sql/opt/bench/fk_test.go +++ b/pkg/sql/opt/bench/fk_test.go @@ -19,6 +19,7 @@ import ( "github.com/cockroachdb/cockroach/pkg/base" "github.com/cockroachdb/cockroach/pkg/testutils/serverutils" "github.com/cockroachdb/cockroach/pkg/testutils/sqlutils" + "github.com/cockroachdb/cockroach/pkg/util/log" ) func runFKBench( @@ -53,16 +54,15 @@ func runFKBench( } func BenchmarkFKInsert(b *testing.B) { + defer log.Scope(b).Close(b) const parentRows = 1000 setup := func(b *testing.B, r *sqlutils.SQLRunner, setupFKs bool) { - r.Exec(b, "CREATE TABLE child (k int primary key, p int)") - r.Exec(b, "CREATE TABLE parent (p int primary key, data int)") - + r.Exec(b, "CREATE TABLE parent (p INT PRIMARY KEY, data INT)") if setupFKs { - r.Exec(b, "ALTER TABLE child ADD CONSTRAINT fk FOREIGN KEY (p) REFERENCES parent(p)") + r.Exec(b, "CREATE TABLE child (k INT PRIMARY KEY, p INT REFERENCES parent(p))") } else { // Create the index on p manually so it's a more fair comparison. - r.Exec(b, "CREATE INDEX idx ON child(p)") + r.Exec(b, "CREATE TABLE child (k INT PRIMARY KEY, p INT, INDEX (p))") } r.Exec(b, fmt.Sprintf( diff --git a/pkg/util/log/test_log_scope.go b/pkg/util/log/test_log_scope.go index 2066922b3d17..4791e14bdc92 100644 --- a/pkg/util/log/test_log_scope.go +++ b/pkg/util/log/test_log_scope.go @@ -256,7 +256,6 @@ func (l *TestLogScope) Close(t tShim) { "bug in TestLogScope - previous config:\n%s\nafter restore:\n%s", l.previous.appliedConfig, restoredConfig) } - // t.Logf("restored configuration:\n%s", restoredConfig) } // calledDuringPanic returns true if panic() is one of its callers.