Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
Signed-off-by: Cabinfever_B <[email protected]>
  • Loading branch information
CabinfeverB committed Nov 29, 2023
1 parent 73064fc commit 896abe1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
6 changes: 2 additions & 4 deletions pkg/syncer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ var regionGuide = core.GenerateRegionGuideFunc(false)

// IsRunning returns whether the region syncer client is running.
func (s *RegionSyncer) IsRunning() bool {
return s.streamingRunning.Load() && s.historyLoaded.Load()
return s.streamingRunning.Load()
}

// StartSyncWithLeader starts to sync with leader.
Expand All @@ -97,7 +97,6 @@ func (s *RegionSyncer) StartSyncWithLeader(addr string) {
defer logutil.LogPanic()
defer s.wg.Done()
defer s.streamingRunning.Store(false)
defer s.historyLoaded.Store(false)
// used to load region from kv storage to cache storage.
bc := s.server.GetBasicCluster()
regionStorage := s.server.GetStorage()
Expand Down Expand Up @@ -154,7 +153,6 @@ func (s *RegionSyncer) StartSyncWithLeader(addr string) {
time.Sleep(time.Second)
continue
}
s.streamingRunning.Store(true)
log.Info("server starts to synchronize with leader", zap.String("server", s.server.Name()), zap.String("leader", s.server.GetLeader().GetName()), zap.Uint64("request-index", s.history.GetNextIndex()))
for {
resp, err := stream.Recv()
Expand Down Expand Up @@ -226,7 +224,7 @@ func (s *RegionSyncer) StartSyncWithLeader(addr string) {
}
}
// mark the client as running status when it finished the first history region sync.
s.historyLoaded.Store(true)
s.streamingRunning.Store(true)
}
}
}()
Expand Down
1 change: 0 additions & 1 deletion pkg/syncer/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ type RegionSyncer struct {
tlsConfig *grpcutil.TLSConfig
// status when as client
streamingRunning atomic.Bool
historyLoaded atomic.Bool
}

// NewRegionSyncer returns a region syncer.
Expand Down

0 comments on commit 896abe1

Please sign in to comment.