Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Oct 8, 2024
1 parent 72fc9ed commit e27ab1f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,9 @@ func (k *serviceModeKeeper) close() {
defer k.Unlock()
switch k.serviceMode {
case pdpb.ServiceMode_API_SVC_MODE:
k.tsoSvcDiscovery.Close()
if k.tsoSvcDiscovery != nil {
k.tsoSvcDiscovery.Close()
}
fallthrough
case pdpb.ServiceMode_PD_SVC_MODE:
if k.tsoClient != nil {
Expand Down
2 changes: 2 additions & 0 deletions tests/integrations/mcs/tso/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ func TestForwardTSOWhenPrimaryChanged(t *testing.T) {

func TestResignTSOPrimaryForward(t *testing.T) {
re := require.New(t)
re.NoError(failpoint.Enable("github.com/tikv/pd/client/fastUpdateServiceMode", `return(true)`))
suite := NewAPIServerForward(re)
defer suite.ShutDown()
// TODO: test random kill primary with 3 nodes
Expand All @@ -345,6 +346,7 @@ func TestResignTSOPrimaryForward(t *testing.T) {
re.NoError(err)
suite.checkAvailableTSO(re, true)
}
re.NoError(failpoint.Disable("github.com/tikv/pd/client/fastUpdateServiceMode"))
}

func TestResignAPIPrimaryForward(t *testing.T) {
Expand Down

0 comments on commit e27ab1f

Please sign in to comment.