Skip to content

Commit

Permalink
sink(ticdc): quick fail on create table error without primary key whe…
Browse files Browse the repository at this point in the history
…n downstream sql_require_primary_key is set (#11144)

close #11143
  • Loading branch information
lidezhu committed May 21, 2024
1 parent de06be9 commit 4d89c24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/errorutil/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (

gmysql "github.com/go-sql-driver/mysql"
"github.com/pingcap/errors"
"github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/infoschema"
"github.com/pingcap/tidb/pkg/parser/mysql"
"github.com/pingcap/tidb/pkg/util/dbterror"
Expand Down Expand Up @@ -139,7 +140,8 @@ func IsRetryableDDLError(err error) bool {
mysql.ErrKeyColumnDoesNotExits,
mysql.ErrWrongColumnName,
mysql.ErrPartitionMgmtOnNonpartitioned,
mysql.ErrNonuniqTable:
mysql.ErrNonuniqTable,
errno.ErrTableWithoutPrimaryKey:
return false
}
return true
Expand Down
2 changes: 2 additions & 0 deletions pkg/errorutil/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"testing"

"github.com/go-sql-driver/mysql"
"github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/infoschema"
tmysql "github.com/pingcap/tidb/pkg/parser/mysql"
"github.com/pingcap/tiflow/dm/pkg/terror"
Expand Down Expand Up @@ -109,6 +110,7 @@ func TestIsRetryableDDLError(t *testing.T) {
{newMysqlErr(tmysql.ErrPartitionMgmtOnNonpartitioned, "xx"), false},
{newMysqlErr(tmysql.ErrNonuniqTable, "xx"), false},
{newMysqlErr(tmysql.ErrBadDB, "xx"), false},
{newMysqlErr(errno.ErrTableWithoutPrimaryKey, "Unable to create or change a table without a primary key"), false},
{mysql.ErrInvalidConn, true},
}

Expand Down

0 comments on commit 4d89c24

Please sign in to comment.