Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ddl: relax the check in ownerCheckAllVersions #46752

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions ddl/syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,13 +337,15 @@
if variable.EnableMDL.Load() {
for _, kv := range resp.Kvs {
key := string(kv.Key)
tidbIDInResp := key[strings.LastIndex(key, "/")+1:]

Check warning on line 340 in ddl/syncer/syncer.go

View check run for this annotation

Codecov / codecov/patch

ddl/syncer/syncer.go#L340

Added line #L340 was not covered by tests
ver, err := strconv.Atoi(string(kv.Value))
if err != nil {
logutil.BgLogger().Info("syncer check all versions, convert value to int failed, continue checking.", zap.String("category", "ddl"), 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] != "" {

Check warning on line 348 in ddl/syncer/syncer.go

View check run for this annotation

Codecov / codecov/patch

ddl/syncer/syncer.go#L348

Added line #L348 was not covered by tests
if notMatchVerCnt%intervalCnt == 0 {
logutil.BgLogger().Info("syncer check all versions, someone is not synced, continue checking", zap.String("category", "ddl"),
zap.String("ddl", string(kv.Key)), zap.Int("currentVer", ver), zap.Int64("latestVer", latestVer))
Expand All @@ -352,7 +354,7 @@
notMatchVerCnt++
break
}
delete(updatedMap, key[strings.LastIndex(key, "/")+1:])
delete(updatedMap, tidbIDInResp)

Check warning on line 357 in ddl/syncer/syncer.go

View check run for this annotation

Codecov / codecov/patch

ddl/syncer/syncer.go#L357

Added line #L357 was not covered by tests
}
if len(updatedMap) > 0 {
succ = false
Expand Down