From 017e86cd0329af2ebae92cba5fabd7e2de013cfa Mon Sep 17 00:00:00 2001 From: lihaowei Date: Fri, 16 Apr 2021 10:34:35 +0800 Subject: [PATCH 1/4] change "none" 2 "queueing" Signed-off-by: lihaowei --- model/model.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/model.go b/model/model.go index 5c4049737..c748a4e90 100644 --- a/model/model.go +++ b/model/model.go @@ -69,7 +69,7 @@ func (s SchemaState) String() string { case StateGlobalTxnOnly: return "global txn only" default: - return "none" + return "queueing" } } From e22135f64ff155f5b5f539c076e257cb500b0c91 Mon Sep 17 00:00:00 2001 From: lihaowei Date: Fri, 16 Apr 2021 13:32:45 +0800 Subject: [PATCH 2/4] 4 review Signed-off-by: lihaowei --- model/ddl.go | 7 +++++-- model/model.go | 10 +++++----- model/model_test.go | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/model/ddl.go b/model/ddl.go index 5b596c12a..809fc4a95 100644 --- a/model/ddl.go +++ b/model/ddl.go @@ -215,8 +215,11 @@ type Job struct { SchemaState SchemaState `json:"schema_state"` // SnapshotVer means snapshot version for this job. SnapshotVer uint64 `json:"snapshot_ver"` - // StartTS uses timestamp allocated by TSO. + // CreateTS uses timestamp allocated by TSO. // Now it's the TS when we put the job to TiKV queue. + CreateTS uint64 `json:"create_ts"` + // StartTS uses timestamp allocated by TSO. + // Now it's the TS when the Job actually started StartTS uint64 `json:"start_ts"` // DependencyID is the job's ID that the current job depends on. DependencyID int64 `json:"dependency_id"` @@ -335,7 +338,7 @@ func (job *Job) DecodeArgs(args ...interface{}) error { func (job *Job) String() string { rowCount := job.GetRowCount() return fmt.Sprintf("ID:%d, Type:%s, State:%s, SchemaState:%s, SchemaID:%d, TableID:%d, RowCount:%d, ArgLen:%d, start time: %v, Err:%v, ErrCount:%d, SnapshotVersion:%v", - job.ID, job.Type, job.State, job.SchemaState, job.SchemaID, job.TableID, rowCount, len(job.Args), TSConvert2Time(job.StartTS), job.Error, job.ErrorCount, job.SnapshotVer) + job.ID, job.Type, job.State, job.SchemaState, job.SchemaID, job.TableID, rowCount, len(job.Args), TSConvert2Time(job.CreateTS), job.Error, job.ErrorCount, job.SnapshotVer) } func (job *Job) hasDependentSchema(other *Job) (bool, error) { diff --git a/model/model.go b/model/model.go index c748a4e90..0a48e41af 100644 --- a/model/model.go +++ b/model/model.go @@ -42,7 +42,7 @@ const ( StateDeleteReorganization // StatePublic means this schema element is ok for all write and read operations. StatePublic - // StateReplica means we're waiting tiflash replica to be finished. + // StateReplicaOnly means we're waiting tiflash replica to be finished. StateReplicaOnly // StateGlobalTxnOnly means we can only use global txn for operator on this schema element StateGlobalTxnOnly @@ -134,7 +134,7 @@ func (c *ColumnInfo) IsGenerated() bool { return len(c.GeneratedExprString) != 0 } -// SetOriginalDefaultValue sets the origin default value. +// SetOriginDefaultValue sets the origin default value. // For mysql.TypeBit type, the default value storage format must be a string. // Other value such as int must convert to string format first. // The mysql.TypeBit type supports the null default value. @@ -153,7 +153,7 @@ func (c *ColumnInfo) SetOriginDefaultValue(value interface{}) error { return nil } -// GetOriginalDefaultValue gets the origin default value. +// GetOriginDefaultValue gets the origin default value. func (c *ColumnInfo) GetOriginDefaultValue() interface{} { if c.Tp == mysql.TypeBit && c.OriginDefaultValueBit != nil { // If the column type is BIT, both `OriginDefaultValue` and `DefaultValue` of ColumnInfo are corrupted, @@ -220,7 +220,7 @@ func FindColumnInfo(cols []*ColumnInfo, name string) *ColumnInfo { // for use of execution phase. const ExtraHandleID = -1 -// ExtraPartitionID is the column ID of column which store the partitionID decoded in global index values. +// ExtraPidColID is the column ID of column which store the partitionID decoded in global index values. const ExtraPidColID = -2 const ( @@ -621,7 +621,7 @@ func (t *TableInfo) IsBaseTable() bool { return t.Sequence == nil && t.View == nil } -// ViewAlgorithm is VIEW's SQL AlGORITHM characteristic. +// ViewAlgorithm is VIEW's SQL ALGORITHM characteristic. // See https://dev.mysql.com/doc/refman/5.7/en/view-algorithms.html type ViewAlgorithm int diff --git a/model/model_test.go b/model/model_test.go index 870d5f49a..716ad75ee 100644 --- a/model/model_test.go +++ b/model/model_test.go @@ -151,7 +151,7 @@ func (*testModelSuite) TestJobStartTime(c *C) { BinlogInfo: &HistoryInfo{}, } t := time.Unix(0, 0) - c.Assert(t, Equals, TSConvert2Time(job.StartTS)) + c.Assert(t, Equals, TSConvert2Time(job.CreateTS)) c.Assert(job.String(), Equals, fmt.Sprintf("ID:123, Type:none, State:none, SchemaState:none, SchemaID:0, TableID:0, RowCount:0, ArgLen:0, start time: %s, Err:, ErrCount:0, SnapshotVersion:0", t)) } From 12b9f78ac3314394f1f1f10814f6bbb43234ac6d Mon Sep 17 00:00:00 2001 From: lihaowei Date: Tue, 20 Apr 2021 09:39:30 +0800 Subject: [PATCH 3/4] restore origin word --- model/ddl.go | 10 +++++----- model/model_test.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/model/ddl.go b/model/ddl.go index 809fc4a95..916ff810d 100644 --- a/model/ddl.go +++ b/model/ddl.go @@ -215,11 +215,11 @@ type Job struct { SchemaState SchemaState `json:"schema_state"` // SnapshotVer means snapshot version for this job. SnapshotVer uint64 `json:"snapshot_ver"` - // CreateTS uses timestamp allocated by TSO. - // Now it's the TS when we put the job to TiKV queue. - CreateTS uint64 `json:"create_ts"` + // RealStartTS uses timestamp allocated by TSO. + // Now it's the TS when we actually start the job. + RealStartTS uint64 `json:"real_start_ts"` // StartTS uses timestamp allocated by TSO. - // Now it's the TS when the Job actually started + // Now it's the TS when we put the job to TiKV queue. StartTS uint64 `json:"start_ts"` // DependencyID is the job's ID that the current job depends on. DependencyID int64 `json:"dependency_id"` @@ -338,7 +338,7 @@ func (job *Job) DecodeArgs(args ...interface{}) error { func (job *Job) String() string { rowCount := job.GetRowCount() return fmt.Sprintf("ID:%d, Type:%s, State:%s, SchemaState:%s, SchemaID:%d, TableID:%d, RowCount:%d, ArgLen:%d, start time: %v, Err:%v, ErrCount:%d, SnapshotVersion:%v", - job.ID, job.Type, job.State, job.SchemaState, job.SchemaID, job.TableID, rowCount, len(job.Args), TSConvert2Time(job.CreateTS), job.Error, job.ErrorCount, job.SnapshotVer) + job.ID, job.Type, job.State, job.SchemaState, job.SchemaID, job.TableID, rowCount, len(job.Args), TSConvert2Time(job.StartTS), job.Error, job.ErrorCount, job.SnapshotVer) } func (job *Job) hasDependentSchema(other *Job) (bool, error) { diff --git a/model/model_test.go b/model/model_test.go index 716ad75ee..870d5f49a 100644 --- a/model/model_test.go +++ b/model/model_test.go @@ -151,7 +151,7 @@ func (*testModelSuite) TestJobStartTime(c *C) { BinlogInfo: &HistoryInfo{}, } t := time.Unix(0, 0) - c.Assert(t, Equals, TSConvert2Time(job.CreateTS)) + c.Assert(t, Equals, TSConvert2Time(job.StartTS)) c.Assert(job.String(), Equals, fmt.Sprintf("ID:123, Type:none, State:none, SchemaState:none, SchemaID:0, TableID:0, RowCount:0, ArgLen:0, start time: %s, Err:, ErrCount:0, SnapshotVersion:0", t)) } From 0628899a504912571ac5b67d7d89e42d2235f4e8 Mon Sep 17 00:00:00 2001 From: Howie Date: Sun, 25 Apr 2021 11:37:27 +0800 Subject: [PATCH 4/4] *: change none 2 queueing --- model/model_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model/model_test.go b/model/model_test.go index 870d5f49a..4d00983aa 100644 --- a/model/model_test.go +++ b/model/model_test.go @@ -152,7 +152,7 @@ func (*testModelSuite) TestJobStartTime(c *C) { } t := time.Unix(0, 0) c.Assert(t, Equals, TSConvert2Time(job.StartTS)) - c.Assert(job.String(), Equals, fmt.Sprintf("ID:123, Type:none, State:none, SchemaState:none, SchemaID:0, TableID:0, RowCount:0, ArgLen:0, start time: %s, Err:, ErrCount:0, SnapshotVersion:0", t)) + c.Assert(job.String(), Equals, fmt.Sprintf("ID:123, Type:none, State:none, SchemaState:queueing, SchemaID:0, TableID:0, RowCount:0, ArgLen:0, start time: %s, Err:, ErrCount:0, SnapshotVersion:0", t)) } func (*testModelSuite) TestJobCodec(c *C) {