From f054b68522f1e2cd09e6cc9807c52a64e9b931b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matou=C5=A1=20Dzivjak?= Date: Wed, 18 Nov 2026 12:34:51 +0100 Subject: [PATCH 1/2] chore: bump crdb version to latest --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2c4a75..9547c17 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,7 +71,7 @@ jobs: contents: read services: cockroach: - image: cockroachdb/cockroach:v25.1.4 + image: cockroachdb/cockroach:v26.4.0 env: COCKROACH_ARGS: >- start-single-node --insecure From 72146d8801049ba9642cfedc5709ec1614d7b314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Gr=C3=A4ger?= Date: Wed, 18 Nov 2026 12:47:21 +0100 Subject: [PATCH 2/2] chore: use official way to inject retry errors --- pool_integration_test.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/pool_integration_test.go b/pool_integration_test.go index ec470ab..788acc0 100644 --- a/pool_integration_test.go +++ b/pool_integration_test.go @@ -6,6 +6,7 @@ import ( "context" "crypto/rand" "os" + "strconv" "strings" "testing" "time" @@ -17,7 +18,7 @@ import ( "github.com/stretchr/testify/require" ) -func newIntegrationPool(t *testing.T, maxConns int32, opts ...Option) *Pool { +func newIntegrationPool(t testing.TB, maxConns int32, opts ...Option) *Pool { t.Helper() url := os.Getenv("CRDB_TEST_DATABASE_URL") @@ -74,17 +75,21 @@ func TestIntegrationPool_InTx(t *testing.T) { var attempts int err := pool.InTx(ctx, pgx.TxOptions{}, func(db Runner) error { attempts++ + + // Set session variable to enable/disable failures + shouldFail := attempts == 1 || tc.alwaysRetry + require.NoError(t, db.ExecFunc( + ctx, + func(_ context.Context, _ pgconn.CommandTag, err error) error { return err }, + "SET inject_retry_errors_enabled = "+strconv.FormatBool(shouldFail), + )) + if err := db.ExecFunc(ctx, func(_ context.Context, _ pgconn.CommandTag, err error) error { return err }, "INSERT INTO "+table+" VALUES (1)"); err != nil { return err } - if attempts == 1 || tc.alwaysRetry { - // Returning a real serialization failure also aborts the server-side transaction. - return db.ExecFunc(ctx, func(_ context.Context, _ pgconn.CommandTag, err error) error { - return err - }, "SELECT crdb_internal.force_retry('1s'::INTERVAL)") - } + return nil }) if tc.wantRows == 1 {