Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide GetMinTS API to solve the compatibility issue brought by multi-timeline tso #6421

Merged
merged 10 commits into from
May 12, 2023
Prev Previous commit
Next Next commit
Fix flaky TestGetMinTS() test
Signed-off-by: Bin Shi <binshi.bing@gmail.com>
  • Loading branch information
binshi-bing committed May 12, 2023
commit 69596c24fdbdb7a284ca8e4777e3d9f28ae93275
16 changes: 9 additions & 7 deletions tests/integrations/mcs/tso/keyspace_group_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,22 @@ func (suite *tsoKeyspaceGroupManagerTestSuite) TestKeyspacesServedByDefaultKeysp
// a keyspace group before, will be served by the default keyspace group.
re := suite.Require()
testutil.Eventually(re, func() bool {
for _, server := range suite.tsoCluster.GetServers() {
allServed := true
for _, keyspaceID := range []uint32{0, 1, 2} {
for _, keyspaceID := range []uint32{0, 1, 2} {
served := false
for _, server := range suite.tsoCluster.GetServers() {
if server.IsKeyspaceServing(keyspaceID, mcsutils.DefaultKeyspaceGroupID) {
tam, err := server.GetTSOAllocatorManager(mcsutils.DefaultKeyspaceGroupID)
re.NoError(err)
re.NotNil(tam)
} else {
allServed = false
served = true
break
}
}
return allServed
if !served {
return false
}
}
return false
return true
}, testutil.WithWaitFor(5*time.Second), testutil.WithTickInterval(50*time.Millisecond))

// Any keyspace that was assigned to a keyspace group before, except default keyspace,
Expand Down
18 changes: 18 additions & 0 deletions tests/integrations/tso/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,24 @@ func (suite *tsoClientTestSuite) SetupSuite() {
suite.keyspaceIDs = append(suite.keyspaceIDs, keyspaceGroup.keyspaceIDs...)
}

// Make sure all keyspace groups are available.
testutil.Eventually(re, func() bool {
for _, keyspaceID := range suite.keyspaceIDs {
served := false
for _, server := range suite.tsoCluster.GetServers() {
if server.IsKeyspaceServing(keyspaceID, mcsutils.DefaultKeyspaceGroupID) {
served = true
break
}
}
if !served {
return false
}
}
return true
}, testutil.WithWaitFor(5*time.Second), testutil.WithTickInterval(50*time.Millisecond))

// Create clients and make sure they all have discovered the tso service.
suite.clients = mcs.WaitForMultiKeyspacesTSOAvailable(
suite.ctx, re, suite.keyspaceIDs, strings.Split(suite.backendEndpoints, ","))
re.Equal(len(suite.keyspaceIDs), len(suite.clients))
Expand Down