Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
  • Loading branch information
wjhuang2016 authored and ti-chi-bot committed Sep 8, 2023
1 parent f096450 commit a81ccbc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ddl/syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,15 @@ func (s *schemaVersionSyncer) OwnerCheckAllVersions(ctx context.Context, jobID i
if variable.EnableMDL.Load() {
for _, kv := range resp.Kvs {
key := string(kv.Key)
tidbIDInResp := key[strings.LastIndex(key, "/")+1:]
ver, err := strconv.Atoi(string(kv.Value))
if err != nil {
logutil.BgLogger().Info("[ddl] syncer check all versions, convert value to int failed, continue checking.", zap.String("ddl", string(kv.Key)), zap.String("value", string(kv.Value)), zap.Error(err))
succ = false
break
}
if int64(ver) < latestVer {
// We need to check if the tidb ID is in the updatedMap, in case that deleting etcd is failed, and tidb server is down.
if int64(ver) < latestVer && updatedMap[tidbIDInResp] != "" {
if notMatchVerCnt%intervalCnt == 0 {
logutil.BgLogger().Info("[ddl] syncer check all versions, someone is not synced, continue checking",
zap.String("ddl", string(kv.Key)), zap.Int("currentVer", ver), zap.Int64("latestVer", latestVer))
Expand All @@ -325,7 +327,7 @@ func (s *schemaVersionSyncer) OwnerCheckAllVersions(ctx context.Context, jobID i
notMatchVerCnt++
break
}
delete(updatedMap, key[strings.LastIndex(key, "/")+1:])
delete(updatedMap, tidbIDInResp)
}
if len(updatedMap) > 0 {
succ = false
Expand Down

0 comments on commit a81ccbc

Please sign in to comment.