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: abstract decode job args v1 #56420

Merged
merged 11 commits into from
Oct 8, 2024
2 changes: 0 additions & 2 deletions pkg/ddl/foreign_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ func testCreateForeignKey(t *testing.T, d ddl.ExecutorForTest, ctx sessionctx.Co
ctx.SetValue(sessionctx.QueryString, "skip")

args := &model.AddForeignKeyArgs{FkInfo: fkInfo}
job.FillArgs(args)
err = d.DoDDLJobWrapper(ctx, ddl.NewJobWrapperWithArgs(job, args, true))
require.NoError(t, err)
return job
Expand All @@ -89,7 +88,6 @@ func testDropForeignKey(t *testing.T, ctx sessionctx.Context, d ddl.ExecutorForT
}
ctx.SetValue(sessionctx.QueryString, "skip")
args := &model.DropForeignKeyArgs{FkName: pmodel.NewCIStr(foreignKeyName)}
job.FillArgs(args)
err := d.DoDDLJobWrapper(ctx, ddl.NewJobWrapperWithArgs(job, args, true))
require.NoError(t, err)
v := getSchemaVer(t, ctx)
Expand Down
9 changes: 6 additions & 3 deletions pkg/ddl/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,12 @@ func testRenameTables(t *testing.T, ctx sessionctx.Context, d ddl.ExecutorForTes
},
}

args := model.GetRenameTablesArgsFromV1(
oldSchemaIDs, oldSchemaNames, oldTableNames,
newSchemaIDs, newTableNames, oldTableIDs)
args := &model.RenameTablesArgs{
RenameTableInfos: model.GetRenameTablesArgsFromV1(
oldSchemaIDs, oldSchemaNames, oldTableNames,
newSchemaIDs, newTableNames, oldTableIDs,
),
}

ctx.SetValue(sessionctx.QueryString, "skip")
require.NoError(t, d.DoDDLJobWrapper(ctx, ddl.NewJobWrapperWithArgs(job, args, true)))
Expand Down
4 changes: 2 additions & 2 deletions pkg/meta/model/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ func (job *Job) GetWarnings() (map[errors.ErrorID]*terror.Error, map[errors.Erro
func (job *Job) FillArgs(args JobArgs) {
intest.Assert(job.Version == JobVersion1 || job.Version == JobVersion2, "job version is invalid")
if job.Version == JobVersion1 {
args.fillJobV1(job)
job.Args = args.getArgsV1(job)
return
}
job.Args = []any{args}
Expand All @@ -496,7 +496,7 @@ func (job *Job) FillArgs(args JobArgs) {
func (job *Job) FillFinishedArgs(args FinishedJobArgs) {
intest.Assert(job.Version == JobVersion1 || job.Version == JobVersion2, "job version is invalid")
if job.Version == JobVersion1 {
args.fillFinishedJobV1(job)
job.Args = args.getFinishedArgsV1(job)
return
}
job.Args = []any{args}
Expand Down
Loading