diff --git a/ddl/ddl_tiflash_api.go b/ddl/ddl_tiflash_api.go index 1ade909b93ee9..c601093ca5963 100644 --- a/ddl/ddl_tiflash_api.go +++ b/ddl/ddl_tiflash_api.go @@ -37,6 +37,7 @@ import ( "github.com/pingcap/tidb/store/helper" "github.com/pingcap/tidb/table" "github.com/pingcap/tidb/util" + "github.com/pingcap/tidb/util/intest" "github.com/pingcap/tidb/util/logutil" atomicutil "go.uber.org/atomic" "go.uber.org/zap" @@ -398,6 +399,13 @@ func pollAvailableTableProgress(schemas infoschema.InfoSchema, ctx sessionctx.Co zap.Int64("tableID", availableTableID.ID), zap.Bool("IsPartition", availableTableID.IsPartition), ) + if intest.InTest { + // In the test, the server cannot start up because the port is occupied. + // Although the port is random. so we need to quickly return when to + // fail to get tiflash sync. + // https://github.com/pingcap/tidb/issues/39949 + panic(err) + } continue } err = infosync.UpdateTiFlashProgressCache(availableTableID.ID, progress) diff --git a/ddl/tiflashtest/BUILD.bazel b/ddl/tiflashtest/BUILD.bazel index 2a803cf03c5af..4e24ea074d7f4 100644 --- a/ddl/tiflashtest/BUILD.bazel +++ b/ddl/tiflashtest/BUILD.bazel @@ -2,11 +2,13 @@ load("@io_bazel_rules_go//go:def.bzl", "go_test") go_test( name = "tiflashtest_test", + timeout = "short", srcs = [ "ddl_tiflash_test.go", "main_test.go", ], flaky = True, + shard_count = 30, deps = [ "//config", "//ddl",