From 63c78f8550e3008fb2d49337b3794ffbfc5b5a52 Mon Sep 17 00:00:00 2001 From: Ryan Leung Date: Sun, 29 Sep 2024 18:02:06 +0800 Subject: [PATCH] remove unstable test Signed-off-by: Ryan Leung --- server/cluster/cluster.go | 2 +- server/config/config.go | 10 ++++ tests/integrations/mcs/tso/server_test.go | 65 ----------------------- 3 files changed, 11 insertions(+), 66 deletions(-) diff --git a/server/cluster/cluster.go b/server/cluster/cluster.go index c1a8d2216082..3b33c46b09eb 100644 --- a/server/cluster/cluster.go +++ b/server/cluster/cluster.go @@ -417,7 +417,7 @@ func (c *RaftCluster) checkTSOService() { log.Info("TSO server starts to provide timestamp") } c.SetServiceIndependent(constant.TSOServiceName) - } else { + } else if c.opt.GetMicroServiceConfig().IsTSOFallbackEnabled() { // TSO server is not available, we need to initialize the PD's allocator group and // let PD provide the timestamp through UnsetServiceIndependent. if !allocator.IsInitialize() { diff --git a/server/config/config.go b/server/config/config.go index d8bd086225cb..c8988939d095 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -253,6 +253,7 @@ const ( maxCheckRegionSplitInterval = 100 * time.Millisecond defaultEnableSchedulingFallback = true + defaultEnableTSOFallback = true ) // Special keys for Labels @@ -855,12 +856,16 @@ func (c *DRAutoSyncReplicationConfig) adjust(meta *configutil.ConfigMetaData) { // MicroServiceConfig is the configuration for micro service. type MicroServiceConfig struct { EnableSchedulingFallback bool `toml:"enable-scheduling-fallback" json:"enable-scheduling-fallback,string"` + EnableTSOFallback bool `toml:"enable-tso-fallback" json:"enable-tso-fallback,string"` } func (c *MicroServiceConfig) adjust(meta *configutil.ConfigMetaData) { if !meta.IsDefined("enable-scheduling-fallback") { c.EnableSchedulingFallback = defaultEnableSchedulingFallback } + if !meta.IsDefined("enable-tso-fallback") { + c.EnableTSOFallback = defaultEnableTSOFallback + } } // Clone returns a copy of micro service config. @@ -874,6 +879,11 @@ func (c *MicroServiceConfig) IsSchedulingFallbackEnabled() bool { return c.EnableSchedulingFallback } +// IsTSOFallbackEnabled returns whether to enable tso service fallback to api service. +func (c *MicroServiceConfig) IsTSOFallbackEnabled() bool { + return c.EnableTSOFallback +} + // KeyspaceConfig is the configuration for keyspace management. type KeyspaceConfig struct { // PreAlloc contains the keyspace to be allocated during keyspace manager initialization. diff --git a/tests/integrations/mcs/tso/server_test.go b/tests/integrations/mcs/tso/server_test.go index 22df2ddfc6a4..56c71c95850c 100644 --- a/tests/integrations/mcs/tso/server_test.go +++ b/tests/integrations/mcs/tso/server_test.go @@ -641,68 +641,3 @@ func TestTSOServiceSwitch(t *testing.T) { <-ch re.NoError(failpoint.Disable("github.com/tikv/pd/client/fastUpdateServiceMode")) } - -func TestTSOServiceWithOldClient(t *testing.T) { - re := require.New(t) - re.NoError(failpoint.Enable("github.com/tikv/pd/client/fastUpdateServiceMode", `return(true)`)) - re.NoError(failpoint.Enable("github.com/tikv/pd/client/usePDServiceMode", `return(true)`)) - var wg sync.WaitGroup - defer wg.Wait() - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - cluster, err := tests.NewTestAPICluster(ctx, 1) - re.NoError(err) - defer cluster.Destroy() - - err = cluster.RunInitialServers() - re.NoError(err) - - leaderName := cluster.WaitLeader() - re.NotEmpty(leaderName) - pdLeader := cluster.GetServer(leaderName) - backendEndpoints := pdLeader.GetAddr() - re.NoError(pdLeader.BootstrapCluster()) - pdClient, err := pd.NewClientWithContext(ctx, []string{backendEndpoints}, pd.SecurityOption{}) - re.NoError(err) - defer pdClient.Close() - ch := make(chan struct{}) - ch1 := make(chan struct{}) - wg.Add(1) - go func(ctx context.Context, wg *sync.WaitGroup, ch, ch1 chan struct{}) { - defer wg.Done() - var lastPhysical, lastLogical int64 - for { - select { - case <-ctx.Done(): - return - default: - } - physical, logical, err := pdClient.GetTS(context.Background()) - if err == nil { - re.GreaterOrEqual(physical, lastPhysical) - if physical == lastPhysical { - re.Greater(logical, lastLogical) - } - lastPhysical = physical - lastLogical = logical - select { - case <-ch1: - ch <- struct{}{} - default: - } - } else { - t.Log(err) - } - } - }(ctx, &wg, ch, ch1) - ch1 <- struct{}{} - <-ch - tsoCluster, err := tests.NewTestTSOCluster(ctx, 1, backendEndpoints) - re.NoError(err) - tsoCluster.WaitForDefaultPrimaryServing(re) - ch1 <- struct{}{} - <-ch - tsoCluster.Destroy() - re.NoError(failpoint.Disable("github.com/tikv/pd/client/usePDServiceMode")) - re.NoError(failpoint.Disable("github.com/tikv/pd/client/fastUpdateServiceMode")) -}