From 9a2e42771bba5fb72d9c7e0df8f96f7943199f14 Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Thu, 19 Dec 2024 10:20:57 -0500 Subject: [PATCH 1/3] workload: log full stack trace of error on failure Release note: None --- pkg/workload/cli/run.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/workload/cli/run.go b/pkg/workload/cli/run.go index 309684df5172..97279d6069f0 100644 --- a/pkg/workload/cli/run.go +++ b/pkg/workload/cli/run.go @@ -595,8 +595,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: From 5cc6d736c05ca98434fc7d5b0609ed743ee78974 Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Thu, 19 Dec 2024 10:21:21 -0500 Subject: [PATCH 2/3] workload/schemachange: make ErrorState implement Cause() This will make the error formatting work more conventionally. Release note: None --- pkg/workload/schemachange/operation_generator.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/workload/schemachange/operation_generator.go b/pkg/workload/schemachange/operation_generator.go index abed5bcad23f..6bd6293d322e 100644 --- a/pkg/workload/schemachange/operation_generator.go +++ b/pkg/workload/schemachange/operation_generator.go @@ -3144,6 +3144,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() } From a8ccc452b7c082246f82a99bd4c2cecbc159d3b2 Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Thu, 19 Dec 2024 10:24:39 -0500 Subject: [PATCH 3/3] workload/schemachange: turn on exec logging This will help us see exactly which statements were executed by the workload, including helper queries. Release note: None --- pkg/workload/schemachange/schemachange.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pkg/workload/schemachange/schemachange.go b/pkg/workload/schemachange/schemachange.go index fb9c5ace269c..e29621a76a23 100644 --- a/pkg/workload/schemachange/schemachange.go +++ b/pkg/workload/schemachange/schemachange.go @@ -339,8 +339,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