From 36e8e3492e90489ae2a3048aa1ca4e0bb11b71ae Mon Sep 17 00:00:00 2001 From: ystaticy Date: Fri, 17 Jan 2025 12:46:25 +0800 Subject: [PATCH] ddl: filter zero job IDs when puting `DDLAllSchemaVersionsByJob` key (#58991) ref pingcap/tidb#58992 --- pkg/ddl/schemaver/syncer.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/ddl/schemaver/syncer.go b/pkg/ddl/schemaver/syncer.go index d82a6bbab015c..0ce5258a1030b 100644 --- a/pkg/ddl/schemaver/syncer.go +++ b/pkg/ddl/schemaver/syncer.go @@ -280,6 +280,10 @@ func (s *etcdSyncer) UpdateSelfVersion(ctx context.Context, jobID int64, version var err error var path string if variable.EnableMDL.Load() { + // If jobID is 0, it doesn't need to put into etcd `DDLAllSchemaVersionsByJob` key. + if jobID == 0 { + return nil + } path = fmt.Sprintf("%s/%d/%s", util.DDLAllSchemaVersionsByJob, jobID, s.ddlID) err = util.PutKVToEtcdMono(ctx, s.etcdCli, keyOpDefaultRetryCnt, path, ver) } else {