diff --git a/pkg/ddl/syncer/syncer.go b/pkg/ddl/syncer/syncer.go index 5b1212ab12ebdc..df6044716eb2b2 100644 --- a/pkg/ddl/syncer/syncer.go +++ b/pkg/ddl/syncer/syncer.go @@ -434,6 +434,7 @@ func (s *schemaVersionSyncer) OwnerCheckAllVersions(ctx context.Context, jobID i case <-notifyCh: return nil case <-ctx.Done(): + item.clearMatchFn() return errors.Trace(ctx.Err()) case <-time.After(time.Second): item.clearMatchFn() diff --git a/pkg/ddl/syncer/syncer_nokit_test.go b/pkg/ddl/syncer/syncer_nokit_test.go index e9f931b77ed50e..15d0cbf0eac447 100644 --- a/pkg/ddl/syncer/syncer_nokit_test.go +++ b/pkg/ddl/syncer/syncer_nokit_test.go @@ -188,6 +188,4 @@ func TestSyncJobSchemaVerLoop(t *testing.T) { cancel() wg.Wait() - - require.Zero(t, jobNodeVersionCnt()) }