Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions pkg/sql/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ import (

func TestTrace(t *testing.T) {
defer leaktest.AfterTest(t)()
defer log.Scope(t).Close(t)

skip.UnderRace(t, "does too much work under race, see: "+
"https://github.com/cockroachdb/cockroach/pull/56343#issuecomment-733577377")

defer log.Scope(t).Close(t)

// These are always appended, even without the test specifying it.
alwaysOptionalSpans := []string{
"drain",
Expand All @@ -61,33 +61,30 @@ func TestTrace(t *testing.T) {
"/cockroach.sql.distsqlrun.DistSQL/FlowStream",
"noop",
}
nonVectorizedExpSpans := []string{
// These are optional if we use a test tenant.
tenantOptionalSpans := []string{
"/cockroach.roachpb.Internal/RangeLookup",
"executeWriteBatch",
}
commonExpSpans := []string{
"session recording",
"sql txn",
"sql query",
"optimizer",
"flow",
"table reader",
"consuming rows",
"txn coordinator send",
"dist sender send",
"/cockroach.roachpb.Internal/Batch",
"commit sql txn",
}
vectorizedExpSpans := []string{
"session recording",
"sql txn",
"sql query",
"optimizer",
"flow",
nonVectorizedExpSpans := append(append([]string(nil), commonExpSpans...), []string{
"table reader",
}...)
vectorizedExpSpans := append(append([]string(nil), commonExpSpans...), []string{
"batch flow coordinator",
"colbatchscan",
"consuming rows",
"txn coordinator send",
"dist sender send",
"/cockroach.roachpb.Internal/Batch",
"commit sql txn",
}
}...)

getRows := func(t *testing.T, sqlDB *gosql.DB, distsql, vectorize string, useShowTraceFor bool) (*gosql.Rows, string, error) {
if _, err := sqlDB.Exec(fmt.Sprintf("SET distsql = %s", distsql)); err != nil {
Expand Down Expand Up @@ -211,6 +208,9 @@ func TestTrace(t *testing.T) {
if test.distSQL == "on" {
optionalSpans = append(optionalSpans, distsqlOptionalSpans...)
}
if cluster.StartedDefaultTestTenant() {
optionalSpans = append(optionalSpans, tenantOptionalSpans...)
}
expSpans := nonVectorizedExpSpans
if test.vectorize == "on" {
expSpans = vectorizedExpSpans
Expand Down
Loading