File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ go_test(
2727 "//pkg/sql/catalog" ,
2828 "//pkg/sql/catalog/desctestutils" ,
2929 "//pkg/sql/parser" ,
30+ "//pkg/sql/pgwire/pgcode" ,
3031 "//pkg/sql/randgen" ,
3132 "//pkg/sql/sem/tree" ,
3233 "//pkg/sql/sqltestutils" ,
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ import (
3131 "github.com/cockroachdb/cockroach/pkg/sql/catalog"
3232 "github.com/cockroachdb/cockroach/pkg/sql/catalog/desctestutils"
3333 "github.com/cockroachdb/cockroach/pkg/sql/parser"
34+ "github.com/cockroachdb/cockroach/pkg/sql/pgwire/pgcode"
3435 "github.com/cockroachdb/cockroach/pkg/sql/randgen"
3536 "github.com/cockroachdb/cockroach/pkg/sql/sem/tree"
3637 "github.com/cockroachdb/cockroach/pkg/sql/types"
@@ -736,9 +737,13 @@ func TestLargeCopy(t *testing.T) {
736737 if err == nil {
737738 return true
738739 }
739- if atomicCopy && strings .Contains (err .Error (), "restart transaction" ) {
740- // We can only retry txn errors with non-atomic COPY.
741- return true
740+ if atomicCopy {
741+ // Ignore retriable errors in atomic COPY mode, since we only have
742+ // automatic retries when atomic=false.
743+ var pgErr = new (pgconn.PgError )
744+ if errors .As (err , & pgErr ) && pgcode .MakeCode (pgErr .Code ) == pgcode .SerializationFailure {
745+ return true
746+ }
742747 }
743748 if ! doAlterPK {
744749 return false
You can’t perform that action at this time.
0 commit comments