Skip to content

Commit

Permalink
Merge branch 'release-7.1' of github.com:tikv/pd into cherry-pick-887…
Browse files Browse the repository at this point in the history
…7-to-release-7.1
  • Loading branch information
lhy1024 committed Dec 18, 2024
2 parents 14e8ce7 + bc028fc commit 8ada003
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions server/region_syncer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (
const (
keepaliveTime = 10 * time.Second
keepaliveTimeout = 3 * time.Second
retryInterval = time.Second
)

// StopSyncWithLeader stop to sync the region with leader.
Expand Down Expand Up @@ -163,7 +164,12 @@ func (s *RegionSyncer) StartSyncWithLeader(addr string) {
}
}
log.Error("server failed to establish sync stream with leader", zap.String("server", s.server.Name()), zap.String("leader", s.server.GetLeader().GetName()), errs.ZapError(err))
time.Sleep(time.Second)
select {
case <-ctx.Done():
log.Info("stop synchronizing with leader due to context canceled")
return
case <-time.After(retryInterval):
}
continue
}

Expand All @@ -175,7 +181,12 @@ func (s *RegionSyncer) StartSyncWithLeader(addr string) {
if err = stream.CloseSend(); err != nil {
log.Error("failed to terminate client stream", errs.ZapError(errs.ErrGRPCCloseSend, err))
}
time.Sleep(time.Second)
select {
case <-ctx.Done():
log.Info("stop synchronizing with leader due to context canceled")
return
case <-time.After(retryInterval):
}
break
}
if s.history.GetNextIndex() != resp.GetStartIndex() {
Expand Down

0 comments on commit 8ada003

Please sign in to comment.