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

*: make TestStores stable #8522

Merged
merged 3 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1667,9 +1667,12 @@ func (c *RaftCluster) checkStores() {
if c.IsPrepared() {
c.updateProgress(id, store.GetAddress(), removingAction, float64(regionSize), float64(regionSize), false /* dec */)
}
regionCount := c.GetStoreRegionCount(id)
// If the store is empty, it can be buried.
if regionCount == 0 {
needBury := c.GetStoreRegionCount(id) == 0
failpoint.Inject("doNotBuryStore", func(_ failpoint.Value) {
needBury = false
})
if needBury {
if err := c.BuryStore(id, false); err != nil {
log.Error("bury store failed",
zap.Stringer("store", offlineStore),
Expand Down
10 changes: 5 additions & 5 deletions tests/integrations/mcs/scheduling/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,13 +629,13 @@ func (suite *apiTestSuite) checkStores(cluster *tests.TestCluster) {
Version: "2.0.0",
},
}
// prevent the offline store from changing to tombstone
tests.MustPutRegion(re, cluster, 3, 6, []byte("a"), []byte("b"))
okJiang marked this conversation as resolved.
Show resolved Hide resolved

re.NoError(failpoint.Enable("github.com/tikv/pd/server/cluster/doNotBuryStore", `return(true)`))
defer func() {
re.NoError(failpoint.Disable("github.com/tikv/pd/server/cluster/doNotBuryStore"))
}()
for _, store := range stores {
tests.MustPutStore(re, cluster, store)
if store.GetId() == 6 {
cluster.GetLeaderServer().GetRaftCluster().GetBasicCluster().UpdateStoreStatus(6)
}
}
// Test /stores
apiServerAddr := cluster.GetLeaderServer().GetAddr()
Expand Down