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: avoid schema version without diff #58549

Closed
wants to merge 1 commit into from
Closed
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
14 changes: 1 addition & 13 deletions pkg/ddl/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,19 +397,7 @@ func (sv *schemaVersionManager) setSchemaVersion(jobCtx *jobContext, job *model.
if err != nil {
return schemaVersion, errors.Trace(err)
}
// TODO we can merge this txn into job transaction to avoid schema version
// without differ.
start := time.Now()
err = kv.RunInNewTxn(kv.WithInternalSourceType(context.Background(), kv.InternalTxnDDL), sv.store, true, func(_ context.Context, txn kv.Transaction) error {
var err error
m := meta.NewMutator(txn)
schemaVersion, err = m.GenSchemaVersion()
return err
})
defer func() {
metrics.DDLIncrSchemaVerOpHist.Observe(time.Since(start).Seconds())
}()
return schemaVersion, err
return jobCtx.metaMut.GenSchemaVersion()
}

// lockSchemaVersion gets the lock to prevent the schema version from being updated.
Expand Down