Skip to content

Commit

Permalink
Use continue lable instead of break
Browse files Browse the repository at this point in the history
Signed-off-by: JmPotato <[email protected]>
  • Loading branch information
JmPotato committed Aug 14, 2024
1 parent 04753da commit a50458b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkg/tso/keyspace_group_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1302,6 +1302,7 @@ func (kgm *KeyspaceGroupManager) mergingChecker(ctx context.Context, mergeTarget
mergeMap[id] = struct{}{}
}

mergeLoop:
for {
select {
case <-ctx.Done():
Expand Down Expand Up @@ -1362,9 +1363,9 @@ func (kgm *KeyspaceGroupManager) mergingChecker(ctx context.Context, mergeTarget
zap.Any("merge-list", mergeList))
// All the keyspace group primaries in the merge list are gone,
// calculate the newly merged TSO to make sure it is greater than the original ones.
var ts, mergedTS time.Time
var mergedTS time.Time
for _, id := range mergeList {
ts, err = kgm.tsoSvcStorage.LoadTimestamp(endpoint.KeyspaceGroupGlobalTSPath(id))
ts, err := kgm.tsoSvcStorage.LoadTimestamp(endpoint.KeyspaceGroupGlobalTSPath(id))
if err != nil {
log.Error("failed to load the keyspace group TSO",
zap.String("member", kgm.tsoServiceID.ServiceAddr),
Expand All @@ -1373,15 +1374,13 @@ func (kgm *KeyspaceGroupManager) mergingChecker(ctx context.Context, mergeTarget
zap.Uint32("merge-id", id),
zap.Time("ts", ts),
zap.Error(err))
break
// Retry from the beginning of the loop.
continue mergeLoop
}
if ts.After(mergedTS) {
mergedTS = ts
}
}
if err != nil {
continue
}
// Update the newly merged TSO if the merged TSO is not zero.
if mergedTS != typeutil.ZeroTime {
log.Info("start to set the newly merged TSO",
Expand Down

0 comments on commit a50458b

Please sign in to comment.