Skip to content

Commit

Permalink
This is an automated cherry-pick of tikv#8824
Browse files Browse the repository at this point in the history
close tikv#8823

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
  • Loading branch information
rleungx authored and ti-chi-bot committed Nov 20, 2024
1 parent 2da9d84 commit 6517e52
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions server/region_syncer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ import (
const (
keepaliveTime = 10 * time.Second
keepaliveTimeout = 3 * time.Second
<<<<<<< HEAD:server/region_syncer/client.go

Check failure on line 39 in server/region_syncer/client.go

View workflow job for this annotation

GitHub Actions / statics

syntax error: unexpected <<, expecting name
=======
msgSize = 8 * units.MiB
retryInterval = time.Second
>>>>>>> 41ec8dced (syncer: exit watch leader immediately (#8824)):pkg/syncer/client.go

Check failure on line 43 in server/region_syncer/client.go

View workflow job for this annotation

GitHub Actions / statics

exponent has no digits

Check failure on line 43 in server/region_syncer/client.go

View workflow job for this annotation

GitHub Actions / statics

invalid character U+0023 '#'

Check failure on line 43 in server/region_syncer/client.go

View workflow job for this annotation

GitHub Actions / statics

syntax error: unexpected ) after top level declaration
)

// StopSyncWithLeader stop to sync the region with leader.
Expand Down Expand Up @@ -160,7 +165,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 @@ -172,7 +182,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 Expand Up @@ -213,7 +228,17 @@ func (s *RegionSyncer) StartSyncWithLeader(addr string) {
log.Debug("region is stale", zap.Stringer("origin", origin.GetMeta()), errs.ZapError(err))
continue
}
<<<<<<< HEAD:server/region_syncer/client.go

Check failure on line 231 in server/region_syncer/client.go

View workflow job for this annotation

GitHub Actions / statics

syntax error: unexpected <<, expecting }
_, saveKV, _, _ := regionGuide(region, origin)

Check failure on line 232 in server/region_syncer/client.go

View workflow job for this annotation

GitHub Actions / statics

expression in go must be function call

Check failure on line 232 in server/region_syncer/client.go

View workflow job for this annotation

GitHub Actions / statics

syntax error: unexpected comma at end of statement
=======

Check failure on line 233 in server/region_syncer/client.go

View workflow job for this annotation

GitHub Actions / statics

syntax error: unexpected ==, expecting }
cctx := &core.MetaProcessContext{
Context: ctx,
TaskRunner: ratelimit.NewSyncRunner(),
Tracer: core.NewNoopHeartbeatProcessTracer(),
// no limit for followers.
}
saveKV, _, _, _ := regionGuide(cctx, region, origin)
>>>>>>> 41ec8dced (syncer: exit watch leader immediately (#8824)):pkg/syncer/client.go

Check failure on line 241 in server/region_syncer/client.go

View workflow job for this annotation

GitHub Actions / statics

syntax error: unexpected >>, expecting }
overlaps := bc.PutRegion(region)

if saveKV {
Expand Down

0 comments on commit 6517e52

Please sign in to comment.