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 authored and ti-chi-bot committed Aug 14, 2024
1 parent 15f80af commit 689a480
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

Check warning on line 1378 in pkg/tso/keyspace_group_manager.go

View check run for this annotation

Codecov / codecov/patch

pkg/tso/keyspace_group_manager.go#L1378

Added line #L1378 was not covered by tests
}
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 689a480

Please sign in to comment.