diff --git a/pkg/workload/BUILD.bazel b/pkg/workload/BUILD.bazel index 9f498cbf37b0..2061f1ff4c5e 100644 --- a/pkg/workload/BUILD.bazel +++ b/pkg/workload/BUILD.bazel @@ -31,7 +31,6 @@ go_library( "@com_github_jackc_pgx_v5//:pgx", "@com_github_jackc_pgx_v5//pgconn", "@com_github_jackc_pgx_v5//pgxpool", - "@com_github_jackc_pgx_v5//tracelog", "@com_github_lib_pq//:pq", "@com_github_spf13_pflag//:pflag", "@org_golang_x_sync//errgroup", diff --git a/pkg/workload/pgx_helpers.go b/pkg/workload/pgx_helpers.go index 0d883dbaf0d7..16d04725e7ee 100644 --- a/pkg/workload/pgx_helpers.go +++ b/pkg/workload/pgx_helpers.go @@ -21,7 +21,6 @@ import ( "github.com/cockroachdb/errors" "github.com/jackc/pgx/v5" "github.com/jackc/pgx/v5/pgxpool" - "github.com/jackc/pgx/v5/tracelog" "golang.org/x/sync/errgroup" ) @@ -87,9 +86,6 @@ type MultiConnPoolCfg struct { // max number of connections per pool. A value less than 0 skips the // connection warmup phase. WarmupConns int - - // LogLevel specifies the log level (default: warn) - LogLevel tracelog.LogLevel } // NewMultiConnPoolCfgFromFlags constructs a new MultiConnPoolCfg object based @@ -126,35 +122,6 @@ var stringToMethod = map[string]pgx.QueryExecMode{ "simple": pgx.QueryExecModeSimpleProtocol, } -// pgxLogger implements the pgx.Logger interface. -type pgxLogger struct{} - -var _ tracelog.Logger = pgxLogger{} - -// Log implements the pgx.Logger interface. -func (p pgxLogger) Log( - ctx context.Context, level tracelog.LogLevel, msg string, data map[string]interface{}, -) { - if ctx.Err() != nil { - // Don't log anything from pgx if the context was canceled by the workload - // runner. It would result in spam at the end of every workload. - return - } - if strings.Contains(msg, "restart transaction") { - // Our workloads have a lot of contention, so "restart transaction" messages - // are expected and noisy. - return - } - // data may contain error with "restart transaction" -- skip those as well. - if data != nil { - ev := data["err"] - if err, ok := ev.(error); ok && strings.Contains(err.Error(), "restart transaction") { - return - } - } - log.VInfof(ctx, log.Level(level), "pgx logger [%s]: %s logParams=%v", level.String(), msg, data) -} - // NewMultiConnPool creates a new MultiConnPool. // // Each URL gets one or more pools, and each pool has at most MaxConnsPerPool @@ -168,10 +135,6 @@ func NewMultiConnPool( m := &MultiConnPool{} m.mu.preparedStatements = map[string]string{} - logLevel := tracelog.LogLevelWarn - if cfg.LogLevel != 0 { - logLevel = cfg.LogLevel - } maxConnLifetime := 300 * time.Second if cfg.MaxConnLifetime > 0 { maxConnLifetime = cfg.MaxConnLifetime @@ -241,10 +204,6 @@ func NewMultiConnPool( connCfg := poolCfg.ConnConfig connCfg.DefaultQueryExecMode = queryMode - connCfg.Tracer = &tracelog.TraceLog{ - Logger: &pgxLogger{}, - LogLevel: logLevel, - } p, err := pgxpool.NewWithConfig(ctx, poolCfg) if err != nil { return nil, err