Skip to content

Commit

Permalink
*: show start time of multi-schema change sub-jobs (#44173)
Browse files Browse the repository at this point in the history
ref #14766
  • Loading branch information
tangenta authored May 29, 2023
1 parent cb8d6f2 commit 732b483
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
6 changes: 6 additions & 0 deletions ddl/multi_schema_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1057,10 +1057,16 @@ func TestMultiSchemaChangeAdminShowDDLJobs(t *testing.T) {
assert.Equal(t, rows[1][3], "add index /* subjob */ /* txn-merge */")
assert.Equal(t, rows[1][4], "delete only")
assert.Equal(t, rows[1][len(rows[1])-1], "running")
assert.True(t, len(rows[1][8].(string)) > 0)
assert.True(t, len(rows[1][9].(string)) > 0)
assert.True(t, len(rows[1][10].(string)) > 0)

assert.Equal(t, rows[2][3], "add index /* subjob */")
assert.Equal(t, rows[2][4], "none")
assert.Equal(t, rows[2][len(rows[2])-1], "queueing")
assert.True(t, len(rows[2][8].(string)) > 0)
assert.True(t, len(rows[2][9].(string)) > 0)
assert.True(t, len(rows[2][10].(string)) > 0)
}
}

Expand Down
15 changes: 12 additions & 3 deletions executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -628,9 +628,18 @@ func (e *DDLJobRetriever) appendJobToChunk(req *chunk.Chunk, job *model.Job, che
req.AppendInt64(5, job.SchemaID)
req.AppendInt64(6, job.TableID)
req.AppendInt64(7, subJob.RowCount)
req.AppendNull(8)
req.AppendNull(9)
req.AppendNull(10)
req.AppendTime(8, createTime)
if subJob.RealStartTS > 0 {
realStartTS := ts2Time(subJob.RealStartTS, e.TZLoc)
req.AppendTime(9, realStartTS)
} else {
req.AppendNull(9)
}
if finishTS > 0 {
req.AppendTime(10, finishTime)
} else {
req.AppendNull(10)
}
req.AppendString(11, subJob.State.String())
}
}
Expand Down
4 changes: 3 additions & 1 deletion parser/model/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ type SubJob struct {
RawArgs json.RawMessage `json:"raw_args"`
SchemaState SchemaState `json:"schema_state"`
SnapshotVer uint64 `json:"snapshot_ver"`
RealStartTS uint64 `json:"real_start_ts"`
Revertible bool `json:"revertible"`
State JobState `json:"state"`
RowCount int64 `json:"row_count"`
Expand Down Expand Up @@ -334,7 +335,7 @@ func (sub *SubJob) ToProxyJob(parentJob *Job) Job {
RawArgs: sub.RawArgs,
SchemaState: sub.SchemaState,
SnapshotVer: sub.SnapshotVer,
RealStartTS: parentJob.RealStartTS,
RealStartTS: sub.RealStartTS,
StartTS: parentJob.StartTS,
DependencyID: parentJob.DependencyID,
Query: parentJob.Query,
Expand All @@ -355,6 +356,7 @@ func (sub *SubJob) FromProxyJob(proxyJob *Job, ver int64) {
sub.Revertible = proxyJob.MultiSchemaInfo.Revertible
sub.SchemaState = proxyJob.SchemaState
sub.SnapshotVer = proxyJob.SnapshotVer
sub.RealStartTS = proxyJob.RealStartTS
sub.Args = proxyJob.Args
sub.State = proxyJob.State
sub.Warning = proxyJob.Warning
Expand Down

0 comments on commit 732b483

Please sign in to comment.