Skip to content

Commit

Permalink
remove unstable test
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Sep 29, 2024
1 parent e3f29e6 commit 63c78f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 66 deletions.
2 changes: 1 addition & 1 deletion server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
10 changes: 10 additions & 0 deletions server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ const (
maxCheckRegionSplitInterval = 100 * time.Millisecond

defaultEnableSchedulingFallback = true
defaultEnableTSOFallback = true
)

// Special keys for Labels
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
65 changes: 0 additions & 65 deletions tests/integrations/mcs/tso/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}

0 comments on commit 63c78f8

Please sign in to comment.