From 849fc909dad3203471630c5fbd8442cee3e5c786 Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Thu, 19 Dec 2024 15:20:57 +0000 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 147c95f63c45..0f9ae04cefb1 100644 --- a/pkg/workload/cli/run.go +++ b/pkg/workload/cli/run.go @@ -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: From a446c252e60e5337c80360aa88b4d8b60ff5e11c Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Thu, 19 Dec 2024 15:21:21 +0000 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 629d6d7993d6..71a6a46110a2 100644 --- a/pkg/workload/schemachange/operation_generator.go +++ b/pkg/workload/schemachange/operation_generator.go @@ -2998,6 +2998,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 26fb787a5d24c200c21fe61566403b2ce318d976 Mon Sep 17 00:00:00 2001 From: Rafi Shamim Date: Thu, 19 Dec 2024 15:24:39 +0000 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 d7f95e5308cd..a4ce3e4a5455 100644 --- a/pkg/workload/schemachange/schemachange.go +++ b/pkg/workload/schemachange/schemachange.go @@ -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