Skip to content

Commit

Permalink
fix the condition
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed May 11, 2022
1 parent 306d47b commit 6f63f63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions server/cluster/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,8 @@ func (c *RaftCluster) processReportBuckets(buckets *metapb.Buckets) error {
return nil
}

// IsPreapred return if the prepare checker is ready.
func (c *RaftCluster) IsPreapred() bool {
// IsPrepared return if the prepare checker is ready.
func (c *RaftCluster) IsPrepared() bool {
return c.coordinator.prepareChecker.isPrepared()
}

Expand Down Expand Up @@ -817,7 +817,7 @@ func (c *RaftCluster) processRegionHeartbeat(region *core.RegionInfo) error {
regionEventCounter.WithLabelValues("update_cache").Inc()
}

if !c.IsPreapred() || isNew {
if !c.IsPrepared() && isNew {
c.coordinator.prepareChecker.collect(region)
}

Expand Down
4 changes: 2 additions & 2 deletions tests/server/region_syncer/region_syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func (s *regionSyncerTestSuite) TestPrepareChecker(c *C) {

// ensure flush to region storage
time.Sleep(3 * time.Second)
c.Assert(leaderServer.GetRaftCluster().IsPreapred(), IsTrue)
c.Assert(leaderServer.GetRaftCluster().IsPrepared(), IsTrue)

// join new PD
pd2, err := cluster.Join(s.ctx)
Expand All @@ -252,7 +252,7 @@ func (s *regionSyncerTestSuite) TestPrepareChecker(c *C) {
c.Assert(err, IsNil)
}
time.Sleep(time.Second)
c.Assert(rc.IsPreapred(), IsTrue)
c.Assert(rc.IsPrepared(), IsTrue)
}

func initRegions(regionLen int) []*core.RegionInfo {
Expand Down

0 comments on commit 6f63f63

Please sign in to comment.