Skip to content

Commit

Permalink
[parser] model: add SQL mode and warnings field for ddl job (pingcap#…
Browse files Browse the repository at this point in the history
  • Loading branch information
AilinKid authored and ti-chi-bot committed Oct 9, 2021
1 parent 0a026a0 commit 0c0b9d0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions parser/model/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"time"

"github.com/pingcap/errors"
"github.com/pingcap/parser/mysql"
"github.com/pingcap/parser/terror"
)

Expand Down Expand Up @@ -175,6 +176,10 @@ type DDLReorgMeta struct {
// EndHandle is the last handle of the adding indices table.
// We should only backfill indices in the range [startHandle, EndHandle].
EndHandle int64 `json:"end_handle"`

SQLMode mysql.SQLMode `json:"sql_mode"`
Warnings map[errors.ErrorID]*terror.Error `json:"warnings"`
WarningsCount map[errors.ErrorID]int64 `json:"warnings_count"`
}

// NewDDLReorgMeta new a DDLReorgMeta.
Expand Down Expand Up @@ -262,6 +267,17 @@ func (job *Job) GetRowCount() int64 {
return job.RowCount
}

// SetWarnings sets the warnings of rows handled.
func (job *Job) SetWarnings(warnings map[errors.ErrorID]*terror.Error, warningsCount map[errors.ErrorID]int64) {
job.ReorgMeta.Warnings = warnings
job.ReorgMeta.WarningsCount = warningsCount
}

// GetWarnings gets the warnings of the rows handled.
func (job *Job) GetWarnings() (map[errors.ErrorID]*terror.Error, map[errors.ErrorID]int64) {
return job.ReorgMeta.Warnings, job.ReorgMeta.WarningsCount
}

// Encode encodes job with json format.
// updateRawArgs is used to determine whether to update the raw args.
func (job *Job) Encode(updateRawArgs bool) ([]byte, error) {
Expand Down

0 comments on commit 0c0b9d0

Please sign in to comment.