Skip to content

Commit

Permalink
fix the conflict
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <rleungx@gmail.com>
  • Loading branch information
rleungx committed May 27, 2022
1 parent 449f2e4 commit 5becbd0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1037,10 +1037,10 @@ func (c *RaftCluster) RemoveStore(storeID uint64, physicallyDestroyed bool) erro
return err
}

// buryStore marks a store as tombstone in cluster.
// BuryStore marks a store as tombstone in cluster.
// The store should be empty before calling this func
// State transition: Offline -> Tombstone.
func (c *RaftCluster) buryStore(storeID uint64) error {
func (c *RaftCluster) BuryStore(storeID uint64) error {
c.Lock()
defer c.Unlock()

Expand Down Expand Up @@ -1184,7 +1184,7 @@ func (c *RaftCluster) checkStores() {
// If the store is empty, it can be buried.
regionCount := c.core.GetStoreRegionCount(offlineStore.GetId())
if regionCount == 0 {
if err := c.buryStore(offlineStore.GetId()); err != nil {
if err := c.BuryStore(offlineStore.GetId()); err != nil {
log.Error("bury store failed",
zap.Stringer("store", offlineStore),
errs.ZapError(err))
Expand Down
6 changes: 3 additions & 3 deletions server/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ func (s *testClusterInfoSuite) TestSetOfflineStore(c *C) {
for storeID := uint64(0); storeID <= 4; storeID++ {
store := cluster.GetStore(storeID)
if store == nil || store.IsUp() {
c.Assert(cluster.buryStore(storeID), NotNil)
c.Assert(cluster.BuryStore(storeID), NotNil)
} else {
c.Assert(cluster.buryStore(storeID), IsNil)
c.Assert(cluster.BuryStore(storeID), IsNil)
}
}
}
Expand All @@ -270,7 +270,7 @@ func (s *testClusterInfoSuite) TestReuseAddress(c *C) {
c.Assert(cluster.RemoveStore(3, true), IsNil)
// store 4: tombstone
c.Assert(cluster.RemoveStore(4, true), IsNil)
c.Assert(cluster.buryStore(4), IsNil)
c.Assert(cluster.BuryStore(4), IsNil)

for id := uint64(1); id <= 4; id++ {
storeInfo := cluster.GetStore(id)
Expand Down
6 changes: 3 additions & 3 deletions tests/server/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1116,7 +1116,7 @@ func (s *clusterTestSuite) TestTransferLeaderBack(c *C) {
tc.WaitLeader()
leaderServer := tc.GetServer(tc.GetLeader())
svr := leaderServer.GetServer()
rc := cluster.NewRaftCluster(s.ctx, svr.ClusterID(), syncer.NewRegionSyncer(svr), svr.GetClient(), svr.GetHTTPClient())
rc := cluster.NewRaftCluster(s.ctx, svr.GetClusterRootPath(), svr.ClusterID(), syncer.NewRegionSyncer(svr), svr.GetClient(), svr.GetHTTPClient())
rc.InitCluster(svr.GetAllocator(), svr.GetPersistOptions(), svr.GetStorage(), svr.GetBasicCluster())
storage := rc.GetStorage()
meta := &metapb.Cluster{Id: 123}
Expand Down Expand Up @@ -1147,7 +1147,7 @@ func (s *clusterTestSuite) TestTransferLeaderBack(c *C) {
c.Assert(err, IsNil)
c.Assert(rc1, NotNil)
// tombstone a store, and remove its record
c.Assert(rc1.BuryStore(1, false), IsNil)
c.Assert(rc1.BuryStore(1), IsNil)
c.Assert(rc1.RemoveTombStoneRecords(), IsNil)

// transfer PD leader back to the previous PD
Expand All @@ -1159,6 +1159,6 @@ func (s *clusterTestSuite) TestTransferLeaderBack(c *C) {
c.Assert(rc, NotNil)

// check store count
c.Assert(rc.GetMetaCluster(), DeepEquals, meta)
c.Assert(rc.GetConfig(), DeepEquals, meta)
c.Assert(rc.GetStoreCount(), Equals, 3)
}

0 comments on commit 5becbd0

Please sign in to comment.