Skip to content

Commit

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

release-24.2: workload/schemachange: turn on exec logging for all statements
  • Loading branch information
rafiss authored Jan 6, 2025
2 parents 3c2c729 + 26fb787 commit f8beb12
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/workload/cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,8 @@ func runRun(gen workload.Generator, urls []string, dbName string) error {
}
continue
}
// Log the error so we get the stack trace.
log.Errorf(ctx, "%v", err)
// Log the error with %+v so we get the stack trace.
log.Errorf(ctx, "workload run error: %+v", err)
return err

case <-ticker.C:
Expand Down
4 changes: 4 additions & 0 deletions pkg/workload/schemachange/operation_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -3001,6 +3001,10 @@ func (es *ErrorState) Unwrap() error {
return es.cause
}

func (es *ErrorState) Cause() error {
return es.cause
}

func (es *ErrorState) Error() string {
return es.cause.Error()
}
Expand Down
12 changes: 10 additions & 2 deletions pkg/workload/schemachange/schemachange.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,16 @@ func (s *schemaChange) Ops(
// setClusterSettings configures any settings required for the workload ahead
// of starting workers.
func (s *schemaChange) setClusterSettings(ctx context.Context, pool *workload.MultiConnPool) error {
_, err := pool.Get().Exec(ctx, `SET CLUSTER SETTING sql.defaults.super_regions.enabled = 'on'`)
return errors.WithStack(err)
for _, stmt := range []string{
`SET CLUSTER SETTING sql.defaults.super_regions.enabled = 'on'`,
`SET CLUSTER SETTING sql.log.all_statements.enabled = 'on'`,
} {
_, err := pool.Get().Exec(ctx, stmt)
if err != nil {
return errors.WithStack(err)
}
}
return nil
}

// initSeqName returns the smallest available sequence number to be
Expand Down

0 comments on commit f8beb12

Please sign in to comment.