Skip to content

Commit

Permalink
ddl: simplify job args fill (#56372)
Browse files Browse the repository at this point in the history
ref #53930
  • Loading branch information
D3Hunter authored Sep 27, 2024
1 parent afdd5c2 commit e80059b
Show file tree
Hide file tree
Showing 4 changed files with 214 additions and 413 deletions.
13 changes: 11 additions & 2 deletions pkg/meta/model/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,12 +483,21 @@ func (job *Job) GetWarnings() (map[errors.ErrorID]*terror.Error, map[errors.Erro
// FillArgs fills args for new job.
func (job *Job) FillArgs(args JobArgs) {
intest.Assert(job.Version == JobVersion1 || job.Version == JobVersion2, "job version is invalid")
args.fillJob(job)
if job.Version == JobVersion1 {
args.fillJobV1(job)
return
}
job.Args = []any{args}
}

// FillFinishedArgs fills args for finished job.
func (job *Job) FillFinishedArgs(args FinishedJobArgs) {
args.fillFinishedJob(job)
intest.Assert(job.Version == JobVersion1 || job.Version == JobVersion2, "job version is invalid")
if job.Version == JobVersion1 {
args.fillFinishedJobV1(job)
return
}
job.Args = []any{args}
}

func marshalArgs(jobVer JobVersion, args []any) (json.RawMessage, error) {
Expand Down
Loading

0 comments on commit e80059b

Please sign in to comment.