From 6a66ed6bb82d0de5201cde161b1ea02e609c6841 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Mon, 13 Feb 2023 13:10:08 +0800 Subject: [PATCH] ddl: return panic when to get tiflash sync progress failed in test (#41292) close pingcap/tidb#39949 --- ddl/ddl_tiflash_api.go | 8 ++++++++ ddl/tiflashtest/BUILD.bazel | 2 ++ 2 files changed, 10 insertions(+) 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",