提交 82efd3c2 编写于 作者: martianzhang's avatar martianzhang

add vendor

上级 7c5d8b1e
......@@ -9,6 +9,9 @@ import (
// Trace just calls AddStack.
func Trace(err error) error {
if err == nil {
return nil
}
return AddStack(err)
}
......@@ -52,6 +55,48 @@ func Annotatef(err error, format string, args ...interface{}) error {
}
}
var emptyStack stack
// NewNoStackError creates error without error stack
// later duplicate trace will no longer generate Stack too.
func NewNoStackError(msg string) error {
return &fundamental{
msg: msg,
stack: &emptyStack,
}
}
// SuspendStack suspends stack generate for error.
func SuspendStack(err error) error {
if err == nil {
return err
}
cleared := clearStack(err)
if cleared {
return err
}
return &withStack{
err,
&emptyStack,
}
}
func clearStack(err error) (cleared bool) {
switch typedErr := err.(type) {
case *withMessage:
return clearStack(typedErr.Cause())
case *fundamental:
typedErr.stack = &emptyStack
return true
case *withStack:
typedErr.stack = &emptyStack
clearStack(typedErr.Cause())
return true
default:
return false
}
}
// ErrorStack will format a stack trace if it is available, otherwise it will be Error()
// If the error is nil, the empty string is returned
// Note that this just calls fmt.Sprintf("%+v", err)
......
# Parser
[![Go Report Card](https://goreportcard.com/badge/github.com/pingcap/parser)](https://goreportcard.com/report/github.com/pingcap/parser) [![CircleCI Status](https://circleci.com/gh/pingcap/parser.svg?style=shield)](https://circleci.com/gh/pingcap/parser) [![GoDoc](https://godoc.org/github.com/pingcap/parser?status.svg)](https://godoc.org/github.com/pingcap/parser)
[![codecov](https://codecov.io/gh/pingcap/parser/branch/master/graph/badge.svg)](https://codecov.io/gh/pingcap/parser)
TiDB SQL Parser
......
......@@ -98,11 +98,11 @@ func (n *CreateDatabaseStmt) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord("IF NOT EXISTS ")
}
ctx.WriteName(n.Name)
for _, option := range n.Options {
for i, option := range n.Options {
ctx.WritePlain(" ")
err := option.Restore(ctx)
if err != nil {
return errors.Trace(err)
return errors.Annotatef(err, "An error occurred while splicing CreateDatabaseStmt DatabaseOption: [%v]", i)
}
}
return nil
......@@ -118,6 +118,43 @@ func (n *CreateDatabaseStmt) Accept(v Visitor) (Node, bool) {
return v.Leave(n)
}
// AlterDatabaseStmt is a statement to change the structure of a database.
// See https://dev.mysql.com/doc/refman/5.7/en/alter-database.html
type AlterDatabaseStmt struct {
ddlNode
Name string
AlterDefaultDatabase bool
Options []*DatabaseOption
}
// Restore implements Node interface.
func (n *AlterDatabaseStmt) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord("ALTER DATABASE")
if !n.AlterDefaultDatabase {
ctx.WritePlain(" ")
ctx.WriteName(n.Name)
}
for i, option := range n.Options {
ctx.WritePlain(" ")
err := option.Restore(ctx)
if err != nil {
return errors.Annotatef(err, "An error occurred while splicing AlterDatabaseStmt DatabaseOption: [%v]", i)
}
}
return nil
}
// Accept implements Node Accept interface.
func (n *AlterDatabaseStmt) Accept(v Visitor) (Node, bool) {
newNode, skipChildren := v.Enter(n)
if skipChildren {
return v.Leave(newNode)
}
n = newNode.(*AlterDatabaseStmt)
return v.Leave(n)
}
// DropDatabaseStmt is a statement to drop a database and all tables in the database.
// See https://dev.mysql.com/doc/refman/5.7/en/drop-database.html
type DropDatabaseStmt struct {
......@@ -354,6 +391,14 @@ const (
ColumnOptionCollate
)
var (
invalidOptionForGeneratedColumn = map[ColumnOptionType]struct{}{
ColumnOptionAutoIncrement: {},
ColumnOptionOnUpdate: {},
ColumnOptionDefaultValue: {},
}
)
// ColumnOption is used for parsing column constraint info from SQL.
type ColumnOption struct {
node
......@@ -672,6 +717,23 @@ func (n *ColumnDef) Accept(v Visitor) (Node, bool) {
return v.Leave(n)
}
// Validate checks if a column definition is legal.
// For example, generated column definitions that contain such
// column options as `ON UPDATE`, `AUTO_INCREMENT`, `DEFAULT`
// are illegal.
func (n *ColumnDef) Validate() bool {
generatedCol := false
illegalOpt4gc := false
for _, opt := range n.Options {
if opt.Tp == ColumnOptionGenerated {
generatedCol = true
}
_, found := invalidOptionForGeneratedColumn[opt.Tp]
illegalOpt4gc = illegalOpt4gc || found
}
return !(generatedCol && illegalOpt4gc)
}
// CreateTableStmt is a statement to create a table.
// See https://dev.mysql.com/doc/refman/5.7/en/create-table.html
type CreateTableStmt struct {
......@@ -684,7 +746,7 @@ type CreateTableStmt struct {
Constraints []*Constraint
Options []*TableOption
Partition *PartitionOptions
OnDuplicate OnDuplicateCreateTableSelectType
OnDuplicate OnDuplicateKeyHandlingType
Select ResultSetNode
}
......@@ -744,11 +806,11 @@ func (n *CreateTableStmt) Restore(ctx *RestoreCtx) error {
if n.Select != nil {
switch n.OnDuplicate {
case OnDuplicateCreateTableSelectError:
case OnDuplicateKeyHandlingError:
ctx.WriteKeyWord(" AS ")
case OnDuplicateCreateTableSelectIgnore:
case OnDuplicateKeyHandlingIgnore:
ctx.WriteKeyWord(" IGNORE AS ")
case OnDuplicateCreateTableSelectReplace:
case OnDuplicateKeyHandlingReplace:
ctx.WriteKeyWord(" REPLACE AS ")
}
......@@ -1180,6 +1242,7 @@ const (
TableOptionRowFormat
TableOptionStatsPersistent
TableOptionShardRowID
TableOptionPreSplitRegion
TableOptionPackKeys
)
......@@ -1201,15 +1264,16 @@ const (
TokuDBRowFormatUncompressed
)
// OnDuplicateCreateTableSelectType is the option that handle unique key values in 'CREATE TABLE ... SELECT'.
// OnDuplicateKeyHandlingType is the option that handle unique key values in 'CREATE TABLE ... SELECT' or `LOAD DATA`.
// See https://dev.mysql.com/doc/refman/5.7/en/create-table-select.html
type OnDuplicateCreateTableSelectType int
// See https://dev.mysql.com/doc/refman/5.7/en/load-data.html
type OnDuplicateKeyHandlingType int
// OnDuplicateCreateTableSelect types
// OnDuplicateKeyHandling types
const (
OnDuplicateCreateTableSelectError OnDuplicateCreateTableSelectType = iota
OnDuplicateCreateTableSelectIgnore
OnDuplicateCreateTableSelectReplace
OnDuplicateKeyHandlingError OnDuplicateKeyHandlingType = iota
OnDuplicateKeyHandlingIgnore
OnDuplicateKeyHandlingReplace
)
// TableOption is used for parsing table option from SQL.
......@@ -1324,8 +1388,10 @@ func (n *TableOption) Restore(ctx *RestoreCtx) error {
ctx.WritePlain(" /* TableOptionStatsPersistent is not supported */ ")
case TableOptionShardRowID:
ctx.WriteKeyWord("SHARD_ROW_ID_BITS ")
ctx.WritePlain("= ")
ctx.WritePlainf("%d", n.UintValue)
ctx.WritePlainf("= %d", n.UintValue)
case TableOptionPreSplitRegion:
ctx.WriteKeyWord("PRE_SPLIT_REGIONS ")
ctx.WritePlainf("= %d", n.UintValue)
case TableOptionPackKeys:
// TODO: not support
ctx.WriteKeyWord("PACK_KEYS ")
......
......@@ -31,6 +31,7 @@ var (
_ DMLNode = &SelectStmt{}
_ DMLNode = &ShowStmt{}
_ DMLNode = &LoadDataStmt{}
_ DMLNode = &SplitIndexRegionStmt{}
_ Node = &Assignment{}
_ Node = &ByItem{}
......@@ -1113,18 +1114,27 @@ func (n *Assignment) Accept(v Visitor) (Node, bool) {
return v.Leave(n)
}
type ColumnNameOrUserVar struct {
ColumnName *ColumnName
UserVar *VariableExpr
}
// LoadDataStmt is a statement to load data from a specified file, then insert this rows into an existing table.
// See https://dev.mysql.com/doc/refman/5.7/en/load-data.html
type LoadDataStmt struct {
dmlNode
IsLocal bool
Path string
Table *TableName
Columns []*ColumnName
FieldsInfo *FieldsClause
LinesInfo *LinesClause
IgnoreLines uint64
IsLocal bool
Path string
OnDuplicate OnDuplicateKeyHandlingType
Table *TableName
Columns []*ColumnName
FieldsInfo *FieldsClause
LinesInfo *LinesClause
IgnoreLines uint64
ColumnAssignments []*Assignment
ColumnsAndUserVars []*ColumnNameOrUserVar
}
// Restore implements Node interface.
......@@ -1135,6 +1145,11 @@ func (n *LoadDataStmt) Restore(ctx *RestoreCtx) error {
}
ctx.WriteKeyWord("INFILE ")
ctx.WriteString(n.Path)
if n.OnDuplicate == OnDuplicateKeyHandlingReplace {
ctx.WriteKeyWord(" REPLACE")
} else if n.OnDuplicate == OnDuplicateKeyHandlingIgnore {
ctx.WriteKeyWord(" IGNORE")
}
ctx.WriteKeyWord(" INTO TABLE ")
if err := n.Table.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore LoadDataStmt.Table")
......@@ -1146,18 +1161,39 @@ func (n *LoadDataStmt) Restore(ctx *RestoreCtx) error {
ctx.WritePlainf("%d", n.IgnoreLines)
ctx.WriteKeyWord(" LINES")
}
if len(n.Columns) != 0 {
if len(n.ColumnsAndUserVars) != 0 {
ctx.WritePlain(" (")
for i, column := range n.Columns {
for i, c := range n.ColumnsAndUserVars {
if i != 0 {
ctx.WritePlain(",")
}
if err := column.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore LoadDataStmt.Columns")
if c.ColumnName != nil {
if err := c.ColumnName.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore LoadDataStmt.ColumnsAndUserVars")
}
}
if c.UserVar != nil {
if err := c.UserVar.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore LoadDataStmt.ColumnsAndUserVars")
}
}
}
ctx.WritePlain(")")
}
if n.ColumnAssignments != nil {
ctx.WriteKeyWord(" SET")
for i, assign := range n.ColumnAssignments {
if i != 0 {
ctx.WritePlain(",")
}
ctx.WritePlain(" ")
if err := assign.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore LoadDataStmt.ColumnAssignments")
}
}
}
return nil
}
......@@ -1182,9 +1218,28 @@ func (n *LoadDataStmt) Accept(v Visitor) (Node, bool) {
}
n.Columns[i] = node.(*ColumnName)
}
for i, assignment := range n.ColumnAssignments {
node, ok := assignment.Accept(v)
if !ok {
return n, false
}
n.ColumnAssignments[i] = node.(*Assignment)
}
return v.Leave(n)
}
const (
Terminated = iota
Enclosed
Escaped
)
type FieldItem struct {
Type int
Value string
}
// FieldsClause represents fields references clause in load data statement.
type FieldsClause struct {
Terminated string
......@@ -1750,6 +1805,7 @@ const (
ShowStatsBuckets
ShowStatsHealthy
ShowPlugins
ShowProfile
ShowProfiles
ShowMasterStatus
ShowPrivileges
......@@ -1757,6 +1813,21 @@ const (
ShowBindings
ShowPumpStatus
ShowDrainerStatus
ShowOpenTables
ShowAnalyzeStatus
)
const (
ProfileTypeInvalid = iota
ProfileTypeCPU
ProfileTypeMemory
ProfileTypeBlockIo
ProfileTypeContextSwitch
ProfileTypePageFaults
ProfileTypeIpc
ProfileTypeSwaps
ProfileTypeSource
ProfileTypeAll
)
// ShowStmt is a statement to provide information about databases, tables, columns and so on.
......@@ -1771,13 +1842,18 @@ type ShowStmt struct {
Column *ColumnName // Used for `desc table column`.
Flag int // Some flag parsed from sql, such as FULL.
Full bool
User *auth.UserIdentity // Used for show grants/create user.
IfNotExists bool // Used for `show create database if not exists`
User *auth.UserIdentity // Used for show grants/create user.
Roles []*auth.RoleIdentity // Used for show grants .. using
IfNotExists bool // Used for `show create database if not exists`
// GlobalScope is used by `show variables` and `show bindings`
GlobalScope bool
Pattern *PatternLikeExpr
Where ExprNode
ShowProfileTypes []int // Used for `SHOW PROFILE` syntax
ShowProfileArgs *int64 // Used for `SHOW PROFILE` syntax
ShowProfileLimit *Limit // Used for `SHOW PROFILE` syntax
}
// Restore implements Node interface.
......@@ -1847,6 +1923,17 @@ func (n *ShowStmt) Restore(ctx *RestoreCtx) error {
return errors.Annotate(err, "An error occurred while restore ShowStmt.User")
}
}
if n.Roles != nil {
ctx.WriteKeyWord(" USING ")
for i, r := range n.Roles {
if err := r.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore ShowStmt.User")
}
if i != len(n.Roles)-1 {
ctx.WritePlain(", ")
}
}
}
case ShowMasterStatus:
ctx.WriteKeyWord("MASTER STATUS")
case ShowProcessList:
......@@ -1874,6 +1961,47 @@ func (n *ShowStmt) Restore(ctx *RestoreCtx) error {
}
case ShowProfiles:
ctx.WriteKeyWord("PROFILES")
case ShowProfile:
ctx.WriteKeyWord("PROFILE")
if len(n.ShowProfileTypes) > 0 {
for i, tp := range n.ShowProfileTypes {
if i != 0 {
ctx.WritePlain(",")
}
ctx.WritePlain(" ")
switch tp {
case ProfileTypeCPU:
ctx.WriteKeyWord("CPU")
case ProfileTypeMemory:
ctx.WriteKeyWord("MEMORY")
case ProfileTypeBlockIo:
ctx.WriteKeyWord("BLOCK IO")
case ProfileTypeContextSwitch:
ctx.WriteKeyWord("CONTEXT SWITCHES")
case ProfileTypeIpc:
ctx.WriteKeyWord("IPC")
case ProfileTypePageFaults:
ctx.WriteKeyWord("PAGE FAULTS")
case ProfileTypeSource:
ctx.WriteKeyWord("SOURCE")
case ProfileTypeSwaps:
ctx.WriteKeyWord("SWAPS")
case ProfileTypeAll:
ctx.WriteKeyWord("ALL")
}
}
}
if n.ShowProfileArgs != nil {
ctx.WriteKeyWord(" FOR QUERY ")
ctx.WritePlainf("%d", *n.ShowProfileArgs)
}
if n.ShowProfileLimit != nil {
ctx.WritePlain(" ")
if err := n.ShowProfileLimit.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore ShowStmt.WritePlain")
}
}
case ShowPrivileges:
ctx.WriteKeyWord("PRIVILEGES")
// ShowTargetFilterable
......@@ -1889,6 +2017,9 @@ func (n *ShowStmt) Restore(ctx *RestoreCtx) error {
restoreOptFull()
ctx.WriteKeyWord("TABLES")
restoreShowDatabaseNameOpt()
case ShowOpenTables:
ctx.WriteKeyWord("OPEN TABLES")
restoreShowDatabaseNameOpt()
case ShowTableStatus:
ctx.WriteKeyWord("TABLE STATUS")
restoreShowDatabaseNameOpt()
......@@ -1943,6 +2074,8 @@ func (n *ShowStmt) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord("PUMP STATUS")
case ShowDrainerStatus:
ctx.WriteKeyWord("DRAINER STATUS")
case ShowAnalyzeStatus:
ctx.WriteKeyWord("ANALYZE STATUS")
default:
return errors.New("Unknown ShowStmt type")
}
......@@ -2011,7 +2144,7 @@ type WindowSpec struct {
Frame *FrameClause
// OnlyAlias will set to true of the first following case.
// To make compatiable with MySQL, we need to distinguish `select func over w` from `select func over (w)`.
// To make compatible with MySQL, we need to distinguish `select func over w` from `select func over (w)`.
OnlyAlias bool
}
......@@ -2270,3 +2403,61 @@ func (n *FrameBound) Accept(v Visitor) (Node, bool) {
}
return v.Leave(n)
}
type SplitIndexRegionStmt struct {
dmlNode
Table *TableName
IndexName string
ValueLists [][]ExprNode
}
func (n *SplitIndexRegionStmt) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord("SPLIT TABLE ")
if err := n.Table.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred while restore SplitIndexRegionStmt.Table")
}
ctx.WriteKeyWord(" INDEX ")
ctx.WriteName(n.IndexName)
ctx.WriteKeyWord(" BY ")
for i, row := range n.ValueLists {
if i != 0 {
ctx.WritePlain(",")
}
ctx.WritePlain("(")
for j, v := range row {
if j != 0 {
ctx.WritePlain(",")
}
if err := v.Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore SplitIndexRegionStmt.ValueLists[%d][%d]", i, j)
}
}
ctx.WritePlain(")")
}
return nil
}
func (n *SplitIndexRegionStmt) Accept(v Visitor) (Node, bool) {
newNode, skipChildren := v.Enter(n)
if skipChildren {
return v.Leave(newNode)
}
n = newNode.(*SplitIndexRegionStmt)
node, ok := n.Table.Accept(v)
if !ok {
return n, false
}
n.Table = node.(*TableName)
for i, list := range n.ValueLists {
for j, val := range list {
node, ok := val.Accept(v)
if !ok {
return n, false
}
n.ValueLists[i][j] = node.(ExprNode)
}
}
return v.Leave(n)
}
......@@ -158,9 +158,15 @@ func (n *BinaryOperationExpr) Restore(ctx *RestoreCtx) error {
if err := n.L.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred when restore BinaryOperationExpr.L")
}
if ctx.Flags.HasSpacesAroundBinaryOperationFlag() {
ctx.WritePlain(" ")
}
if err := n.Op.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred when restore BinaryOperationExpr.Op")
}
if ctx.Flags.HasSpacesAroundBinaryOperationFlag() {
ctx.WritePlain(" ")
}
if err := n.R.Restore(ctx); err != nil {
return errors.Annotate(err, "An error occurred when restore BinaryOperationExpr.R")
}
......@@ -283,13 +289,14 @@ func (n *CaseExpr) Restore(ctx *RestoreCtx) error {
// Format the ExprNode into a Writer.
func (n *CaseExpr) Format(w io.Writer) {
fmt.Fprint(w, "CASE ")
fmt.Fprint(w, "CASE")
// Because the presence of `case when` syntax, `Value` could be nil and we need check this.
if n.Value != nil {
n.Value.Format(w)
fmt.Fprint(w, " ")
n.Value.Format(w)
}
for _, clause := range n.WhenClauses {
fmt.Fprint(w, " ")
fmt.Fprint(w, "WHEN ")
clause.Expr.Format(w)
fmt.Fprint(w, " THEN ")
......
......@@ -512,7 +512,7 @@ func (n *FuncCastExpr) Restore(ctx *RestoreCtx) error {
return errors.Annotatef(err, "An error occurred while restore FuncCastExpr.Expr")
}
ctx.WriteKeyWord(" AS ")
n.Tp.FormatAsCastType(ctx.In)
n.Tp.RestoreAsCastType(ctx)
ctx.WritePlain(")")
case CastConvertFunction:
ctx.WriteKeyWord("CONVERT")
......@@ -521,7 +521,7 @@ func (n *FuncCastExpr) Restore(ctx *RestoreCtx) error {
return errors.Annotatef(err, "An error occurred while restore FuncCastExpr.Expr")
}
ctx.WritePlain(", ")
n.Tp.FormatAsCastType(ctx.In)
n.Tp.RestoreAsCastType(ctx)
ctx.WritePlain(")")
case CastBinaryOperator:
ctx.WriteKeyWord("BINARY ")
......
......@@ -42,6 +42,7 @@ var (
_ StmtNode = &RollbackStmt{}
_ StmtNode = &SetPwdStmt{}
_ StmtNode = &SetRoleStmt{}
_ StmtNode = &SetDefaultRoleStmt{}
_ StmtNode = &SetStmt{}
_ StmtNode = &UseStmt{}
_ StmtNode = &FlushStmt{}
......@@ -67,6 +68,12 @@ const (
DrainerType = "DRAINER"
)
// Transaction mode constants.
const (
Optimistic = "OPTIMISTIC"
Pessimistic = "PESSIMISTIC"
)
var (
// ExplainFormats stores the valid formats for explain statement, used by validator.
ExplainFormats = []string{
......@@ -364,11 +371,17 @@ func (n *ExecuteStmt) Accept(v Visitor) (Node, bool) {
// See https://dev.mysql.com/doc/refman/5.7/en/commit.html
type BeginStmt struct {
stmtNode
Mode string
}
// Restore implements Node interface.
func (n *BeginStmt) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord("START TRANSACTION")
if n.Mode == "" {
ctx.WriteKeyWord("START TRANSACTION")
} else {
ctx.WriteKeyWord("BEGIN ")
ctx.WriteKeyWord(n.Mode)
}
return nil
}
......@@ -847,6 +860,57 @@ func (n *SetRoleStmt) Accept(v Visitor) (Node, bool) {
return v.Leave(n)
}
type SetDefaultRoleStmt struct {
stmtNode
SetRoleOpt SetRoleStmtType
RoleList []*auth.RoleIdentity
UserList []*auth.UserIdentity
}
func (n *SetDefaultRoleStmt) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord("SET DEFAULT ROLE")
switch n.SetRoleOpt {
case SetRoleNone:
ctx.WriteKeyWord(" NONE")
case SetRoleAll:
ctx.WriteKeyWord(" ALL")
default:
}
for i, role := range n.RoleList {
ctx.WritePlain(" ")
err := role.Restore(ctx)
if err != nil {
return errors.Annotate(err, "An error occurred while restore SetDefaultRoleStmt.RoleList")
}
if i != len(n.RoleList)-1 {
ctx.WritePlain(",")
}
}
ctx.WritePlain(" TO")
for i, user := range n.UserList {
ctx.WritePlain(" ")
err := user.Restore(ctx)
if err != nil {
return errors.Annotate(err, "An error occurred while restore SetDefaultRoleStmt.UserList")
}
if i != len(n.UserList)-1 {
ctx.WritePlain(",")
}
}
return nil
}
// Accept implements Node Accept interface.
func (n *SetDefaultRoleStmt) Accept(v Visitor) (Node, bool) {
newNode, skipChildren := v.Enter(n)
if skipChildren {
return v.Leave(newNode)
}
n = newNode.(*SetDefaultRoleStmt)
return v.Leave(n)
}
// UserSpec is used for parsing create user statement.
type UserSpec struct {
User *auth.UserIdentity
......@@ -901,14 +965,119 @@ func (n *UserSpec) EncodedPassword() (string, bool) {
return opt.HashString, true
}
const (
TslNone = iota
Ssl
X509
Cipher
Issuer
Subject
)
type TslOption struct {
Type int
Value string
}
func (t *TslOption) Restore(ctx *RestoreCtx) error {
switch t.Type {
case TslNone:
ctx.WriteKeyWord("NONE")
case Ssl:
ctx.WriteKeyWord("SSL")
case X509:
ctx.WriteKeyWord("X509")
case Cipher:
ctx.WriteKeyWord("CIPHER ")
ctx.WriteString(t.Value)
case Issuer:
ctx.WriteKeyWord("ISSUER ")
ctx.WriteString(t.Value)
case Subject:
ctx.WriteKeyWord("CIPHER")
ctx.WriteString(t.Value)
default:
return errors.Errorf("Unsupported TslOption.Type %d", t.Type)
}
return nil
}
const (
MaxQueriesPerHour = iota + 1
MaxUpdatesPerHour
MaxConnectionsPerHour
MaxUserConnections
)
type ResourceOption struct {
Type int
Count int64
}
func (r *ResourceOption) Restore(ctx *RestoreCtx) error {
switch r.Type {
case MaxQueriesPerHour:
ctx.WriteKeyWord("MAX_QUERIES_PER_HOUR ")
case MaxUpdatesPerHour:
ctx.WriteKeyWord("MAX_UPDATES_PER_HOUR ")
case MaxConnectionsPerHour:
ctx.WriteKeyWord("MAX_CONNECTIONS_PER_HOUR ")
case MaxUserConnections:
ctx.WriteKeyWord("MAX_USER_CONNECTIONS ")
default:
return errors.Errorf("Unsupported ResourceOption.Type %d", r.Type)
}
ctx.WritePlainf("%d", r.Count)
return nil
}
const (
PasswordExpire = iota + 1
PasswordExpireDefault
PasswordExpireNever
PasswordExpireInterval
Lock
Unlock
)
type PasswordOrLockOption struct {
Type int
Count int64
}
func (p *PasswordOrLockOption) Restore(ctx *RestoreCtx) error {
switch p.Type {
case PasswordExpire:
ctx.WriteKeyWord("PASSWORD EXPIRE")
case PasswordExpireDefault:
ctx.WriteKeyWord("PASSWORD EXPIRE DEFAULT")
case PasswordExpireNever:
ctx.WriteKeyWord("PASSWORD EXPIRE NEVER")
case PasswordExpireInterval:
ctx.WriteKeyWord("PASSWORD EXPIRE NEVER")
ctx.WritePlainf(" %d", p.Count)
ctx.WriteKeyWord(" DAY")
case Lock:
ctx.WriteKeyWord("ACCOUNT LOCK")
case Unlock:
ctx.WriteKeyWord("ACCOUNT UNLOCK")
default:
return errors.Errorf("Unsupported PasswordOrLockOption.Type %d", p.Type)
}
return nil
}
// CreateUserStmt creates user account.
// See https://dev.mysql.com/doc/refman/5.7/en/create-user.html
type CreateUserStmt struct {
stmtNode
IsCreateRole bool
IfNotExists bool
Specs []*UserSpec
IsCreateRole bool
IfNotExists bool
Specs []*UserSpec
TslOptions []*TslOption
ResourceOptions []*ResourceOption
PasswordOrLockOptions []*PasswordOrLockOption
}
// Restore implements Node interface.
......@@ -929,6 +1098,40 @@ func (n *CreateUserStmt) Restore(ctx *RestoreCtx) error {
return errors.Annotatef(err, "An error occurred while restore CreateUserStmt.Specs[%d]", i)
}
}
tslOptionLen := len(n.TslOptions)
if tslOptionLen != 0 {
ctx.WriteKeyWord(" REQUIRE ")
}
// Restore `tslOptions` reversely to keep order the same with original sql
for i := tslOptionLen; i > 0; i-- {
if i != tslOptionLen {
ctx.WriteKeyWord(" AND ")
}
if err := n.TslOptions[i-1].Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore CreateUserStmt.TslOptions[%d]", i)
}
}
if len(n.ResourceOptions) != 0 {
ctx.WriteKeyWord(" WITH")
}
for i, v := range n.ResourceOptions {
ctx.WritePlain(" ")
if err := v.Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore CreateUserStmt.ResourceOptions[%d]", i)
}
}
for i, v := range n.PasswordOrLockOptions {
ctx.WritePlain(" ")
if err := v.Restore(ctx); err != nil {
return errors.Annotatef(err, "An error occurred while restore CreateUserStmt.PasswordOrLockOptions[%d]", i)
}
}
return nil
}
......
......@@ -35,12 +35,17 @@ type AnalyzeTableStmt struct {
MaxNumBuckets uint64
// IndexFlag is true when we only analyze indices for a table.
IndexFlag bool
IndexFlag bool
Incremental bool
}
// Restore implements Node interface.
func (n *AnalyzeTableStmt) Restore(ctx *RestoreCtx) error {
ctx.WriteKeyWord("ANALYZE TABLE ")
if n.Incremental {
ctx.WriteKeyWord("ANALYZE INCREMENTAL TABLE ")
} else {
ctx.WriteKeyWord("ANALYZE TABLE ")
}
for i, table := range n.TableNames {
if i != 0 {
ctx.WritePlain(",")
......
......@@ -18,6 +18,17 @@ import (
"github.com/pingcap/errors"
"github.com/pingcap/parser/mysql"
"github.com/pingcap/parser/terror"
)
const (
codeCollationCharsetMismatch = terror.ErrCode(mysql.ErrCollationCharsetMismatch)
codeUnknownCollation = terror.ErrCode(mysql.ErrUnknownCollation)
)
var (
ErrUnknownCollation = terror.ClassDDL.New(codeUnknownCollation, mysql.MySQLErrName[mysql.ErrUnknownCollation])
ErrCollationCharsetMismatch = terror.ClassDDL.New(codeCollationCharsetMismatch, mysql.MySQLErrName[mysql.ErrCollationCharsetMismatch])
)
// Charset is a charset.
......@@ -40,8 +51,10 @@ type Collation struct {
}
var charsets = make(map[string]*Charset)
var collationsMap = make(map[int]*Collation)
var collationsIDMap = make(map[int]*Collation)
var collationsNameMap = make(map[string]*Collation)
var descs = make([]*Desc, 0, len(charsetInfos))
var supportedCollations = make([]*Collation, 0, len(supportedCollationNames))
// All the supported charsets should be in the following table.
var charsetInfos = []*Charset{
......@@ -52,6 +65,15 @@ var charsetInfos = []*Charset{
{CharsetBin, CollationBin, make(map[string]*Collation), "binary", 1},
}
// All the names supported collations should be in the following table.
var supportedCollationNames = map[string]struct{}{
CollationUTF8: {},
CollationUTF8MB4: {},
CollationASCII: {},
CollationLatin1: {},
CollationBin: {},
}
// Desc is a charset description.
type Desc struct {
Name string
......@@ -60,11 +82,16 @@ type Desc struct {
Maxlen int
}
// GetAllCharsets gets all charset descriptions in the local charsets.
func GetAllCharsets() []*Desc {
// GetSupportedCharsets gets descriptions for all charsets supported so far.
func GetSupportedCharsets() []*Desc {
return descs
}
// GetSupportedCollations gets information for all collations supported so far.
func GetSupportedCollations() []*Collation {
return supportedCollations
}
// ValidCharsetAndCollation checks the charset and the collation validity
// and returns a boolean.
func ValidCharsetAndCollation(cs string, co string) bool {
......@@ -119,17 +146,20 @@ func GetCharsetInfo(cs string) (string, string, error) {
// GetCharsetDesc gets charset descriptions in the local charsets.
func GetCharsetDesc(cs string) (*Desc, error) {
c, ok := charsets[strings.ToLower(cs)]
if !ok {
switch strings.ToLower(cs) {
case CharsetUTF8:
return descs[0], nil
case CharsetUTF8MB4:
return descs[1], nil
case CharsetASCII:
return descs[2], nil
case CharsetLatin1:
return descs[3], nil
case CharsetBin:
return descs[4], nil
default:
return nil, errors.Errorf("Unknown charset %s", cs)
}
desc := &Desc{
Name: c.Name,
DefaultCollation: c.DefaultCollation,
Desc: c.Desc,
Maxlen: c.Maxlen,
}
return desc, nil
}
// GetCharsetInfoByID returns charset and collation for id as cs_number.
......@@ -137,7 +167,7 @@ func GetCharsetInfoByID(coID int) (string, string, error) {
if coID == mysql.DefaultCollationID {
return mysql.DefaultCharset, mysql.DefaultCollationName, nil
}
if collation, ok := collationsMap[coID]; ok {
if collation, ok := collationsIDMap[coID]; ok {
return collation.CharsetName, collation.Name, nil
}
return "", "", errors.Errorf("Unknown charset id %d", coID)
......@@ -148,6 +178,14 @@ func GetCollations() []*Collation {
return collations
}
func GetCollationByName(name string) (*Collation, error) {
collation, ok := collationsNameMap[strings.ToLower(name)]
if !ok {
return nil, ErrUnknownCollation.GenWithStackByArgs(name)
}
return collation, nil
}
const (
// CharsetBin is used for marking binary charset.
CharsetBin = "binary"
......@@ -179,10 +217,10 @@ var collations = []*Collation{
{5, "latin1", "latin1_german1_ci", false},
{6, "hp8", "hp8_english_ci", true},
{7, "koi8r", "koi8r_general_ci", true},
{8, "latin1", "latin1_swedish_ci", true},
{8, "latin1", "latin1_swedish_ci", false},
{9, "latin2", "latin2_general_ci", true},
{10, "swe7", "swe7_swedish_ci", true},
{11, "ascii", "ascii_general_ci", true},
{11, "ascii", "ascii_general_ci", false},
{12, "ujis", "ujis_japanese_ci", true},
{13, "sjis", "sjis_japanese_ci", true},
{14, "cp1251", "cp1251_bulgarian_ci", false},
......@@ -203,7 +241,7 @@ var collations = []*Collation{
{30, "latin5", "latin5_turkish_ci", true},
{31, "latin1", "latin1_german2_ci", false},
{32, "armscii8", "armscii8_general_ci", true},
{33, "utf8", "utf8_general_ci", true},
{33, "utf8", "utf8_general_ci", false},
{34, "cp1250", "cp1250_czech_cs", false},
{35, "ucs2", "ucs2_general_ci", true},
{36, "cp866", "cp866_general_ci", true},
......@@ -215,9 +253,9 @@ var collations = []*Collation{
{42, "latin7", "latin7_general_cs", false},
{43, "macce", "macce_bin", false},
{44, "cp1250", "cp1250_croatian_ci", false},
{45, "utf8mb4", "utf8mb4_general_ci", true},
{46, "utf8mb4", "utf8mb4_bin", false},
{47, "latin1", "latin1_bin", false},
{45, "utf8mb4", "utf8mb4_general_ci", false},
{46, "utf8mb4", "utf8mb4_bin", true},
{47, "latin1", "latin1_bin", true},
{48, "latin1", "latin1_general_ci", false},
{49, "latin1", "latin1_general_cs", false},
{50, "cp1251", "cp1251_bin", false},
......@@ -235,7 +273,7 @@ var collations = []*Collation{
{62, "utf16le", "utf16le_bin", false},
{63, "binary", "binary", true},
{64, "armscii8", "armscii8_bin", false},
{65, "ascii", "ascii_bin", false},
{65, "ascii", "ascii_bin", true},
{66, "cp1250", "cp1250_bin", false},
{67, "cp1256", "cp1256_bin", false},
{68, "cp866", "cp866_bin", false},
......@@ -252,7 +290,7 @@ var collations = []*Collation{
{80, "cp850", "cp850_bin", false},
{81, "cp852", "cp852_bin", false},
{82, "swe7", "swe7_bin", false},
{83, "utf8", "utf8_bin", false},
{83, "utf8", "utf8_bin", true},
{84, "big5", "big5_bin", false},
{85, "euckr", "euckr_bin", false},
{86, "gb2312", "gb2312_bin", false},
......@@ -391,6 +429,7 @@ var collations = []*Collation{
{245, "utf8mb4", "utf8mb4_croatian_ci", false},
{246, "utf8mb4", "utf8mb4_unicode_520_ci", false},
{247, "utf8mb4", "utf8mb4_vietnamese_ci", false},
{255, "utf8mb4", "utf8mb4_0900_ai_ci", false},
}
// init method always puts to the end of file.
......@@ -407,11 +446,18 @@ func init() {
}
for _, c := range collations {
collationsMap[c.ID] = c
charset, ok := charsets[c.CharsetName]
if !ok {
continue
collationsIDMap[c.ID] = c
if _, ok := supportedCollationNames[c.Name]; ok {
supportedCollations = append(supportedCollations, c)
}
if charset, ok := charsets[c.CharsetName]; ok {
charset.Collations[c.Name] = c
}
charset.Collations[c.Name] = c
}
for id, name := range mysql.Collations {
collationsNameMap[name] = collationsIDMap[int(id)]
}
}
......@@ -19,6 +19,9 @@ jobs:
- run:
name: "Build & Test"
command: make test
- run:
name: "Upload coverage"
command: bash <(curl -s https://codecov.io/bash)
build-integration:
docker:
- image: golang:1.11
......
......@@ -111,6 +111,9 @@ func (d *sqlDigester) normalize(sql string) {
d.lexer.reset(sql)
for {
tok, pos, lit := d.lexer.scan()
if tok == invalid {
break
}
if tok == unicode.ReplacementChar && d.lexer.r.eof() {
break
}
......
......@@ -216,6 +216,8 @@ const (
RestoreNameLowercase
RestoreNameDoubleQuotes
RestoreNameBackQuotes
RestoreSpacesAroundBinaryOperation
)
const (
......@@ -271,6 +273,11 @@ func (rf RestoreFlags) HasNameBackQuotesFlag() bool {
return rf.has(RestoreNameBackQuotes)
}
// HasSpacesAroundBinaryOperationFlag returns a boolean indicating whether `rf` has `RestoreSpacesAroundBinaryOperation` flag.
func (rf RestoreFlags) HasSpacesAroundBinaryOperationFlag() bool {
return rf.has(RestoreSpacesAroundBinaryOperation)
}
// RestoreCtx is `Restore` context to hold flags and writer.
type RestoreCtx struct {
Flags RestoreFlags
......
......@@ -8,7 +8,7 @@ require (
github.com/cznic/strutil v0.0.0-20171016134553-529a34b1c186
github.com/cznic/y v0.0.0-20170802143616-045f81c6662a
github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8
github.com/pingcap/errors v0.11.1
github.com/pingcap/errors v0.11.4
github.com/pingcap/tidb v0.0.0-20190321025159-e8299209340c
github.com/pingcap/tipb v0.0.0-20190107072121-abbec73437b7
github.com/sirupsen/logrus v1.3.0
......
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f h1:5ZfJxyXo8KyX8DgGXC5B7ILL8y51fci/qYz2B4j8iLY=
github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/blacktear23/go-proxyprotocol v0.0.0-20180807104634-af7a81e8dd0d/go.mod h1:VKt7CNAQxpFpSDz3sXyj9hY/GbVsQCr0sB3w59nE7lU=
github.com/boltdb/bolt v1.3.1 h1:JQmyP4ZBrce+ZQu0dY660FMfatumYDLun9hBCUVIkF4=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w=
github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
github.com/coreos/bbolt v1.3.0 h1:HIgH5xUWXT914HCI671AxuTTqjj64UOFr7pHn48LUTI=
github.com/coreos/bbolt v1.3.0/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142 h1:3jFq2xL4ZajGK4aZY8jz+DAF0FHjI51BXjjSwCzS1Dk=
github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cznic/golex v0.0.0-20181122101858-9c343928389c h1:G8zTsaqyVfIHpgMFcGgdbhHSFhlNc77rAKkhVbQ9kQg=
github.com/cznic/golex v0.0.0-20181122101858-9c343928389c/go.mod h1:+bmmJDNmKlhWNG+gwWCkaBoTy39Fs+bzRxVBzoTQbIc=
......@@ -25,49 +35,80 @@ github.com/cznic/strutil v0.0.0-20171016134553-529a34b1c186/go.mod h1:AHHPPPXTw0
github.com/cznic/y v0.0.0-20170802143616-045f81c6662a h1:N2rDAvHuM46OGscJkGX4Dw4BBqZgg6mGNGLYs5utVVo=
github.com/cznic/y v0.0.0-20170802143616-045f81c6662a/go.mod h1:1rk5VM7oSnA4vjp+hrLQ3HWHa+Y4yPCa3/CsJrcNnvs=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 h1:clC1lXBpe2kTj2VHdaIu9ajZQe4kcEY9j0NsnDDBZ3o=
github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM=
github.com/etcd-io/gofail v0.0.0-20180808172546-51ce9a71510a h1:QNEenQIsGDEEfFNSnN+h6hE1OwnHqTg7Dl9gEk1Cko4=
github.com/etcd-io/gofail v0.0.0-20180808172546-51ce9a71510a/go.mod h1:49H/RkXP8pKaZy4h0d+NW16rSLhyVBt4o6VLJbmOqDE=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E=
github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8=
github.com/go-sql-driver/mysql v0.0.0-20170715192408-3955978caca4/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/gogo/protobuf v0.0.0-20180717141946-636bf0302bc9/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI=
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff h1:kOkM9whyQYodu09SJ6W3NCsHG7crFaJILQ22Gozp3lg=
github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v0.0.0-20180814211427-aa810b61a9c7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8=
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
github.com/gorilla/mux v1.6.2 h1:Pgr17XVTNXAk3q/r4CpKzC5xBM/qW1uVLV+IhRZpIIk=
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 h1:Iju5GlWwrvL6UBg4zJJt3btmonfrMlCDdsejg4CZE7c=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho=
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
github.com/grpc-ecosystem/grpc-gateway v1.5.1 h1:3scN4iuXkNOyP98jF55Lv8a9j1o/IwvnDIZ0LHJK1nk=
github.com/grpc-ecosystem/grpc-gateway v1.5.1/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5 h1:2U0HzY8BJ8hVwDKIzp7y4voR9CX/nvcfymLmg2UiOio=
github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGiHgQ4OO8tzTaLawm8vnODuwDk=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe h1:W/GaMY0y69G4cFlmsC6B9sbuo2fP8OFP1ABjt4kPz+w=
github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/montanaflynn/stats v0.0.0-20180911141734-db72e6cae808 h1:pmpDGKLw4n82EtrNiLqB+xSz/JQwFOaZuMALYUHwX5s=
github.com/montanaflynn/stats v0.0.0-20180911141734-db72e6cae808/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
github.com/myesui/uuid v1.0.0 h1:xCBmH4l5KuvLYc5L7AS7SZg9/jKdIFubM7OVoLqaQUI=
github.com/myesui/uuid v1.0.0/go.mod h1:2CDfNgU0LR8mIdO8vdWd8i9gWWxLlcoIGGpSNgafq84=
github.com/ngaut/pools v0.0.0-20180318154953-b7bc8c42aac7 h1:7KAv7KMGTTqSmYZtNdcNTgsos+vFzULLwyElndwn+5c=
github.com/ngaut/pools v0.0.0-20180318154953-b7bc8c42aac7/go.mod h1:iWMfgwqYW+e8n5lC/jjNEhwcjbRDpl5NT7n2h+4UNcI=
github.com/ngaut/sync2 v0.0.0-20141008032647-7a24ed77b2ef h1:K0Fn+DoFqNqktdZtdV3bPQ/0cuYh2H4rkg0tytX/07k=
github.com/ngaut/sync2 v0.0.0-20141008032647-7a24ed77b2ef/go.mod h1:7WjlapSfwQyo6LNmIvEWzsW1hbBQfpUO4JWnuQRmva8=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/opentracing/basictracer-go v1.0.0 h1:YyUAhaEfjoWXclZVJ9sGoNct7j4TVk7lZWlQw5UXuoo=
github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg=
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/philhofer/fwd v1.0.0 h1:UbZqGr5Y38ApvM/V/jEljVxwocdweyH+vmYvRPBnbqQ=
github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU=
......@@ -77,13 +118,18 @@ github.com/pingcap/errors v0.11.0 h1:DCJQB8jrHbQ1VVlMFIrbj2ApScNNotVmkSNplu2yUt4
github.com/pingcap/errors v0.11.0/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pingcap/errors v0.11.1 h1:BXFZ6MdDd2U1uJUa2sRAWTmm+nieEzuyYM0R4aUTcC8=
github.com/pingcap/errors v0.11.1/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4=
github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8=
github.com/pingcap/gofail v0.0.0-20181217135706-6a951c1e42c3 h1:04yuCf5NMvLU8rB2m4Qs3rynH7EYpMno3lHkewIOdMo=
github.com/pingcap/gofail v0.0.0-20181217135706-6a951c1e42c3/go.mod h1:DazNTg0PTldtpsQiT9I5tVJwV1onHMKBBgXzmJUlMns=
github.com/pingcap/goleveldb v0.0.0-20171020122428-b9ff6c35079e h1:P73/4dPCL96rGrobssy1nVy2VaVpNCuLpCbr+FEaTA8=
github.com/pingcap/goleveldb v0.0.0-20171020122428-b9ff6c35079e/go.mod h1:O17XtbryoCJhkKGbT62+L2OlrniwqiGLSqrmdHCMzZw=
github.com/pingcap/kvproto v0.0.0-20190215154024-7f2fc73ef562 h1:32oF1/8lVnBR2JVcCAnKPQATTOX0+ckRDFpjQk4Ngno=
github.com/pingcap/kvproto v0.0.0-20190215154024-7f2fc73ef562/go.mod h1:QMdbTAXCHzzygQzqcG9uVUgU2fKeSN1GmfMiykdSzzY=
github.com/pingcap/log v0.0.0-20190307075452-bd41d9273596 h1:t2OQTpPJnrPDGlvA+3FwJptMTt6MEPdzK1Wt99oaefQ=
github.com/pingcap/log v0.0.0-20190307075452-bd41d9273596/go.mod h1:WpHUKhNZ18v116SvGrmjkA9CBhYmuUTKL+p8JC9ANEw=
github.com/pingcap/parser v0.0.0-20190312024907-3f6280b08c8b/go.mod h1:1FNvfp9+J0wvc4kl8eGNh7Rqrxveg15jJoWo/a0uHwA=
github.com/pingcap/pd v2.1.0-rc.4+incompatible h1:/buwGk04aHO5odk/+O8ZOXGs4qkUjYTJ2UpCJXna8NE=
github.com/pingcap/pd v2.1.0-rc.4+incompatible/go.mod h1:nD3+EoYes4+aNNODO99ES59V83MZSI+dFbhyr667a0E=
github.com/pingcap/tidb v0.0.0-20190321025159-e8299209340c h1:n3i2K6zUzXZDe6imOtdOhWltuqCLFtmLropKwS6ljeI=
github.com/pingcap/tidb v0.0.0-20190321025159-e8299209340c/go.mod h1:FcgD4o1kq3YNk08MWtMRwNZXQJpM28bFdb/go9KpmEA=
......@@ -93,12 +139,17 @@ github.com/pingcap/tipb v0.0.0-20190107072121-abbec73437b7 h1:wnjdQRhybddDesBVBK
github.com/pingcap/tipb v0.0.0-20190107072121-abbec73437b7/go.mod h1:RtkHW8WbcNxj8lsbzjaILci01CtYnYbIkQhjyZWrWVI=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pquerna/ffjson v0.0.0-20181028064349-e517b90714f7 h1:gGBSHPOU7g8YjTbhwn+lvFm2VDEhhA+PwDIlstkgSxE=
github.com/pquerna/ffjson v0.0.0-20181028064349-e517b90714f7/go.mod h1:YARuvh7BUWHNhzDq2OM5tzR2RiCcN2D7sapiKyCel/M=
github.com/prometheus/client_golang v0.9.0 h1:tXuTFVHC03mW0D+Ua1Q2d1EAVqLTuggX50V0VLICCzY=
github.com/prometheus/client_golang v0.9.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39 h1:Cto4X6SVMWRPBkJ/3YHn1iDGDGc/Z+sW+AEMKHMVvN4=
github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d h1:GoAlyOgbOEIFdaDqxJVlbOQ1DtGmZWs/Qau0hIlk+WQ=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446 h1:/NRJ5vAYoqz+7sG51ubIDHXeWO8DlTSrToPu6q11ziA=
github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M=
......@@ -109,7 +160,9 @@ github.com/shurcooL/vfsgen v0.0.0-20181020040650-a97a25d856ca/go.mod h1:TrYk7fJV
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.3.0 h1:hI/7Q+DtNZ2kINb6qt/lS+IyXnHQe9e90POfeewL/ME=
github.com/sirupsen/logrus v1.3.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
......@@ -120,17 +173,27 @@ github.com/struCoder/pidusage v0.1.2/go.mod h1:pWBlW3YuSwRl6h7R5KbvA4N8oOqe9LjaK
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2/go.mod h1:2PfKggNGDuadAa0LElHrByyrz4JPZ9fFx6Gs7nx7ZZU=
github.com/tinylib/msgp v1.1.0 h1:9fQd+ICuRIu/ue4vxJZu6/LzxN0HwMds2nq/0cFvxHU=
github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 h1:lYIiVDtZnyTWlNwiAxLj0bbpTcx1BWCFhXjfsvmPdNc=
github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/twinj/uuid v1.0.0 h1:fzz7COZnDrXGTAOHGuUGYd6sG+JMq+AoE7+Jlu0przk=
github.com/twinj/uuid v1.0.0/go.mod h1:mMgcE1RHFUFqe5AfiwlINXisXfDGro23fWdPUfOMjRY=
github.com/uber-go/atomic v1.3.2 h1:Azu9lPBWRNKzYXSIwRfgRuDuS0YKsK4NFhiQv98gkxo=
github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g=
github.com/uber/jaeger-client-go v2.15.0+incompatible h1:NP3qsSqNxh8VYr956ur1N/1C1PjvOJnJykCzcD5QHbk=
github.com/uber/jaeger-client-go v2.15.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk=
github.com/uber/jaeger-lib v1.5.0 h1:OHbgr8l656Ub3Fw5k9SWnBfIEwvoHQ+W2y+Aa9D1Uyo=
github.com/uber/jaeger-lib v1.5.0/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U=
github.com/ugorji/go v0.0.0-20171019201919-bdcc60b419d1 h1:UvhxfNjNqlZ/x3cDyqxMhoiUpemd3zXkVQApN6bM/lg=
github.com/ugorji/go v0.0.0-20171019201919-bdcc60b419d1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
github.com/unrolled/render v0.0.0-20180914162206-b9786414de4d h1:ggUgChAeyge4NZ4QUw6lhHsVymzwSDJOZcE0s2X8S20=
github.com/unrolled/render v0.0.0-20180914162206-b9786414de4d/go.mod h1:tu82oB5W2ykJRVioYsB+IQKcft7ryBr7w12qMBUPyXg=
github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18 h1:MPPkRncZLN9Kh4MEFmbnK4h3BD7AUmskWv2+EeZJCCs=
github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/zap v1.9.1 h1:XCJQEf3W6eZaVwhRBof6ImoYGJSITeKWsyeh3HFu/5o=
go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793 h1:u+LnwYTOOW7Ukr/fppxEb1Nwz0AtPflrblfvUudpo+I=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
......@@ -154,6 +217,7 @@ golang.org/x/sys v0.0.0-20190109145017-48ac38b7c8cb/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuArfcOvC4AoJmILihzhDg=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190130214255-bb1329dc71a0 h1:iRpjPej1fPzmfoBhMFkp3HdqzF+ytPmAwiQhJGV0zGw=
......@@ -167,14 +231,20 @@ google.golang.org/grpc v0.0.0-20180607172857-7a6a684ca69e/go.mod h1:yo6s7OP7yaDg
google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio=
google.golang.org/grpc v1.17.0 h1:TRJYBgMclJvGYn2rIMjj+h9KtMt5r1Ij7ODVRIZkwhk=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8=
gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k=
gopkg.in/stretchr/testify.v1 v1.2.2 h1:yhQC6Uy5CqibAIlk1wlusa/MJ3iAN49/BsR/dCCKz3M=
gopkg.in/stretchr/testify.v1 v1.2.2/go.mod h1:QI5V/q6UbPmuhtm10CaFZxED9NreB8PnFYN9JcR6TxU=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
sourcegraph.com/sourcegraph/appdash v0.0.0-20180531100431-4c381bd170b4 h1:VO9oZbbkvTwqLimlQt15QNdOOBArT2dw/bvzsMZBiqQ=
sourcegraph.com/sourcegraph/appdash v0.0.0-20180531100431-4c381bd170b4/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67/go.mod h1:L5q+DGLGOQFpo1snNEkLOJT2d1YTW66rWNzatr3He1k=
......@@ -161,6 +161,7 @@ var tokenMap = map[string]int{
"BIT_OR": bitOr,
"BIT_XOR": bitXor,
"BLOB": blobType,
"BLOCK": block,
"BOOL": boolType,
"BOOLEAN": booleanType,
"BOTH": both,
......@@ -196,9 +197,11 @@ var tokenMap = map[string]int{
"CONNECTION": connection,
"CONSISTENT": consistent,
"CONSTRAINT": constraint,
"CONTEXT": context,
"CONVERT": convert,
"COPY": copyKwd,
"COUNT": count,
"CPU": cpu,
"CREATE": create,
"CROSS": cross,
"CURRENT": current,
......@@ -261,6 +264,7 @@ var tokenMap = map[string]int{
"EXPLAIN": explain,
"EXTRACT": extract,
"FALSE": falseKwd,
"FAULTS": faultsSym,
"FIELDS": fields,
"FIRST": first,
"FIXED": fixed,
......@@ -293,6 +297,7 @@ var tokenMap = map[string]int{
"IF": ifKwd,
"IGNORE": ignore,
"IN": in,
"INCREMENTAL": incremental,
"INDEX": index,
"INDEXES": indexes,
"INFILE": infile,
......@@ -306,6 +311,8 @@ var tokenMap = map[string]int{
"INT3": int3Type,
"INT4": int4Type,
"INT8": int8Type,
"IO": io,
"IPC": ipc,
"INTEGER": integerType,
"INTERVAL": interval,
"INTERNAL": internal,
......@@ -352,6 +359,7 @@ var tokenMap = map[string]int{
"MEDIUMBLOB": mediumblobType,
"MEDIUMINT": mediumIntType,
"MEDIUMTEXT": mediumtextType,
"MEMORY": memory,
"MERGE": merge,
"MICROSECOND": microsecond,
"MIN": min,
......@@ -382,15 +390,18 @@ var tokenMap = map[string]int{
"OFFSET": offset,
"ON": on,
"ONLY": only,
"OPTIMISTIC": optimistic,
"OPTION": option,
"OPTIONALLY": optionally,
"OR": or,
"ORDER": order,
"OUTER": outer,
"PACK_KEYS": packKeys,
"PAGE": pageSym,
"PARTITION": partition,
"PARTITIONS": partitions,
"PASSWORD": password,
"PESSIMISTIC": pessimistic,
"PLUGINS": plugins,
"POSITION": position,
"PRECEDING": preceding,
......@@ -401,6 +412,7 @@ var tokenMap = map[string]int{
"PROCEDURE": procedure,
"PROCESS": process,
"PROCESSLIST": processlist,
"PROFILE": profile,
"PROFILES": profiles,
"PUMP": pump,
"QUARTER": quarter,
......@@ -408,6 +420,7 @@ var tokenMap = map[string]int{
"QUERIES": queries,
"QUICK": quick,
"SHARD_ROW_ID_BITS": shardRowIDBits,
"PRE_SPLIT_REGIONS": preSplitRegions,
"RANGE": rangeKwd,
"RECOVER": recover,
"READ": read,
......@@ -454,10 +467,12 @@ var tokenMap = map[string]int{
"SMALLINT": smallIntType,
"SNAPSHOT": snapshot,
"SOME": some,
"SPLIT": split,
"SQL": sql,
"SQL_CACHE": sqlCache,
"SQL_CALC_FOUND_ROWS": sqlCalcFoundRows,
"SQL_NO_CACHE": sqlNoCache,
"SOURCE": source,
"SSL": ssl,
"START": start,
"STARTING": starting,
......@@ -468,6 +483,9 @@ var tokenMap = map[string]int{
"STATS_META": statsMeta,
"STATS_PERSISTENT": statsPersistent,
"STATUS": status,
"SWAPS": swaps,
"SWITCHES": switchesSym,
"OPEN": open,
"STD": stddevPop,
"STDDEV": stddevPop,
"STDDEV_POP": stddevPop,
......@@ -513,6 +531,7 @@ var tokenMap = map[string]int{
"TOKUDB_ZLIB": tokudbZlib,
"TOP": top,
"TRACE": trace,
"TRADITIONAL": traditional,
"TRAILING": trailing,
"TRANSACTION": transaction,
"TRIGGER": trigger,
......
......@@ -29,63 +29,65 @@ type ActionType byte
// List DDL actions.
const (
ActionNone ActionType = 0
ActionCreateSchema ActionType = 1
ActionDropSchema ActionType = 2
ActionCreateTable ActionType = 3
ActionDropTable ActionType = 4
ActionAddColumn ActionType = 5
ActionDropColumn ActionType = 6
ActionAddIndex ActionType = 7
ActionDropIndex ActionType = 8
ActionAddForeignKey ActionType = 9
ActionDropForeignKey ActionType = 10
ActionTruncateTable ActionType = 11
ActionModifyColumn ActionType = 12
ActionRebaseAutoID ActionType = 13
ActionRenameTable ActionType = 14
ActionSetDefaultValue ActionType = 15
ActionShardRowID ActionType = 16
ActionModifyTableComment ActionType = 17
ActionRenameIndex ActionType = 18
ActionAddTablePartition ActionType = 19
ActionDropTablePartition ActionType = 20
ActionCreateView ActionType = 21
ActionModifyTableCharsetAndCollate ActionType = 22
ActionTruncateTablePartition ActionType = 23
ActionDropView ActionType = 24
ActionRecoverTable ActionType = 25
ActionNone ActionType = 0
ActionCreateSchema ActionType = 1
ActionDropSchema ActionType = 2
ActionCreateTable ActionType = 3
ActionDropTable ActionType = 4
ActionAddColumn ActionType = 5
ActionDropColumn ActionType = 6
ActionAddIndex ActionType = 7
ActionDropIndex ActionType = 8
ActionAddForeignKey ActionType = 9
ActionDropForeignKey ActionType = 10
ActionTruncateTable ActionType = 11
ActionModifyColumn ActionType = 12
ActionRebaseAutoID ActionType = 13
ActionRenameTable ActionType = 14
ActionSetDefaultValue ActionType = 15
ActionShardRowID ActionType = 16
ActionModifyTableComment ActionType = 17
ActionRenameIndex ActionType = 18
ActionAddTablePartition ActionType = 19
ActionDropTablePartition ActionType = 20
ActionCreateView ActionType = 21
ActionModifyTableCharsetAndCollate ActionType = 22
ActionTruncateTablePartition ActionType = 23
ActionDropView ActionType = 24
ActionRecoverTable ActionType = 25
ActionModifySchemaCharsetAndCollate ActionType = 26
)
// AddIndexStr is a string related to the operation of "add index".
const AddIndexStr = "add index"
var actionMap = map[ActionType]string{
ActionCreateSchema: "create schema",
ActionDropSchema: "drop schema",
ActionCreateTable: "create table",
ActionDropTable: "drop table",
ActionAddColumn: "add column",
ActionDropColumn: "drop column",
ActionAddIndex: AddIndexStr,
ActionDropIndex: "drop index",
ActionAddForeignKey: "add foreign key",
ActionDropForeignKey: "drop foreign key",
ActionTruncateTable: "truncate table",
ActionModifyColumn: "modify column",
ActionRebaseAutoID: "rebase auto_increment ID",
ActionRenameTable: "rename table",
ActionSetDefaultValue: "set default value",
ActionShardRowID: "shard row ID",
ActionModifyTableComment: "modify table comment",
ActionRenameIndex: "rename index",
ActionAddTablePartition: "add partition",
ActionDropTablePartition: "drop partition",
ActionCreateView: "create view",
ActionModifyTableCharsetAndCollate: "modify table charset and collate",
ActionTruncateTablePartition: "truncate partition",
ActionDropView: "drop view",
ActionRecoverTable: "recover table",
ActionCreateSchema: "create schema",
ActionDropSchema: "drop schema",
ActionCreateTable: "create table",
ActionDropTable: "drop table",
ActionAddColumn: "add column",
ActionDropColumn: "drop column",
ActionAddIndex: AddIndexStr,
ActionDropIndex: "drop index",
ActionAddForeignKey: "add foreign key",
ActionDropForeignKey: "drop foreign key",
ActionTruncateTable: "truncate table",
ActionModifyColumn: "modify column",
ActionRebaseAutoID: "rebase auto_increment ID",
ActionRenameTable: "rename table",
ActionSetDefaultValue: "set default value",
ActionShardRowID: "shard row ID",
ActionModifyTableComment: "modify table comment",
ActionRenameIndex: "rename index",
ActionAddTablePartition: "add partition",
ActionDropTablePartition: "drop partition",
ActionCreateView: "create view",
ActionModifyTableCharsetAndCollate: "modify table charset and collate",
ActionTruncateTablePartition: "truncate partition",
ActionDropView: "drop view",
ActionRecoverTable: "recover table",
ActionModifySchemaCharsetAndCollate: "modify schema charset and collate",
}
// String return current ddl action in string
......
......@@ -175,9 +175,15 @@ const (
// After version V2.1.2 (PR#8738) , TiDB add UTF8 check, then the user upgrade from v2.0.8 insert some UTF8MB4 characters will got error.
// This is not compatibility for user. Then we try to fix this in PR #9820, and increase the version number.
TableInfoVersion2 = uint16(2)
// TableInfoVersion3 means the table info version is 3.
// This version aims to deal with upper-cased charset name in TableInfo stored by versions prior to TiDB v2.1.9:
// TiDB always suppose all charsets / collations as lower-cased and try to convert them if they're not.
// However, the convert is missed in some scenarios before v2.1.9, so for all those tables prior to TableInfoVersion3, their
// charsets / collations will be converted to lower-case while loading from the storage.
TableInfoVersion3 = uint16(3)
// CurrLatestTableInfoVersion means the latest table info in the current TiDB.
CurrLatestTableInfoVersion = TableInfoVersion2
CurrLatestTableInfoVersion = TableInfoVersion3
)
// ExtraHandleName is the name of ExtraHandle Column.
......@@ -214,6 +220,10 @@ type TableInfo struct {
ShardRowIDBits uint64
// MaxShardRowIDBits uses to record the max ShardRowIDBits be used so far.
MaxShardRowIDBits uint64 `json:"max_shard_row_id_bits"`
// PreSplitRegions specify the pre-split region when create table.
// The pre-split region num is 2^(PreSplitRegions-1).
// And the PreSplitRegions should less than or equal to ShardRowIDBits.
PreSplitRegions uint64 `json:"pre_split_regions"`
Partition *PartitionInfo `json:"partition"`
......@@ -716,8 +726,8 @@ func ColumnToProto(c *ColumnInfo) *tipb.ColumnInfo {
// TODO: update it when more collate is supported.
func collationToProto(c string) int32 {
v := mysql.CollationNames[c]
if v == mysql.BinaryCollationID {
return int32(mysql.BinaryCollationID)
if v == mysql.BinaryDefaultCollationID {
return int32(mysql.BinaryDefaultCollationID)
}
// We only support binary and utf8_bin collation.
// Setting other collations to utf8_bin for old data compatibility.
......
......@@ -20,15 +20,15 @@ func CharsetNameToID(charset string) uint8 {
// Use quick path for TiDB to avoid access CharsetIDs map
// "SHOW CHARACTER SET;" to see all the supported character sets.
if charset == "utf8mb4" {
return UTF8MB4CollationID
return UTF8MB4DefaultCollationID
} else if charset == "binary" {
return BinaryCollationID
return BinaryDefaultCollationID
} else if charset == "utf8" {
return UTF8CollationID
return UTF8DefaultCollationID
} else if charset == "ascii" {
return ASCIICollationID
return ASCIIDefaultCollationID
} else if charset == "latin1" {
return Latin1CollationID
return Latin1DefaultCollationID
} else {
return CharsetIDs[charset]
}
......@@ -41,10 +41,10 @@ var CharsetIDs = map[string]uint8{
"cp850": 4,
"hp8": 6,
"koi8r": 7,
"latin1": Latin1CollationID,
"latin1": Latin1DefaultCollationID,
"latin2": 9,
"swe7": 10,
"ascii": ASCIICollationID,
"ascii": ASCIIDefaultCollationID,
"ujis": 12,
"sjis": 13,
"hebrew": 16,
......@@ -57,7 +57,7 @@ var CharsetIDs = map[string]uint8{
"gbk": 28,
"latin5": 30,
"armscii8": 32,
"utf8": UTF8CollationID,
"utf8": UTF8DefaultCollationID,
"ucs2": 35,
"cp866": 36,
"keybcs2": 37,
......@@ -65,14 +65,14 @@ var CharsetIDs = map[string]uint8{
"macroman": 39,
"cp852": 40,
"latin7": 41,
"utf8mb4": UTF8MB4CollationID,
"utf8mb4": UTF8MB4DefaultCollationID,
"cp1251": 51,
"utf16": 54,
"utf16le": 56,
"cp1256": 57,
"cp1257": 59,
"utf32": 60,
"binary": BinaryCollationID,
"binary": BinaryDefaultCollationID,
"geostd8": 92,
"cp932": 95,
"eucjpms": 97,
......@@ -85,10 +85,10 @@ var Charsets = map[string]string{
"cp850": "cp850_general_ci",
"hp8": "hp8_english_ci",
"koi8r": "koi8r_general_ci",
"latin1": "latin1_swedish_ci",
"latin1": "latin1_bin",
"latin2": "latin2_general_ci",
"swe7": "swe7_swedish_ci",
"ascii": "ascii_general_ci",
"ascii": "ascii_bin",
"ujis": "ujis_japanese_ci",
"sjis": "sjis_japanese_ci",
"hebrew": "hebrew_general_ci",
......@@ -101,7 +101,7 @@ var Charsets = map[string]string{
"gbk": "gbk_chinese_ci",
"latin5": "latin5_turkish_ci",
"armscii8": "armscii8_general_ci",
"utf8": "utf8_general_ci",
"utf8": "utf8_bin",
"ucs2": "ucs2_general_ci",
"cp866": "cp866_general_ci",
"keybcs2": "keybcs2_general_ci",
......@@ -109,7 +109,7 @@ var Charsets = map[string]string{
"macroman": "macroman_general_ci",
"cp852": "cp852_general_ci",
"latin7": "latin7_general_ci",
"utf8mb4": "utf8mb4_general_ci",
"utf8mb4": "utf8mb4_bin",
"cp1251": "cp1251_general_ci",
"utf16": "utf16_general_ci",
"utf16le": "utf16le_general_ci",
......@@ -122,7 +122,7 @@ var Charsets = map[string]string{
"eucjpms": "eucjpms_japanese_ci",
}
// Collations maps MySQL default collation ID to its name.
// Collations maps MySQL collation ID to its name.
var Collations = map[uint8]string{
1: "big5_chinese_ci",
2: "latin2_czech_cs",
......@@ -343,9 +343,10 @@ var Collations = map[uint8]string{
245: "utf8mb4_croatian_ci",
246: "utf8mb4_unicode_520_ci",
247: "utf8mb4_vietnamese_ci",
255: "utf8mb4_0900_ai_ci",
}
// CollationNames maps MySQL default collation name to its ID
// CollationNames maps MySQL collation name to its ID
var CollationNames = map[string]uint8{
"big5_chinese_ci": 1,
"latin2_czech_cs": 2,
......@@ -566,6 +567,7 @@ var CollationNames = map[string]uint8{
"utf8mb4_croatian_ci": 245,
"utf8mb4_unicode_520_ci": 246,
"utf8mb4_vietnamese_ci": 247,
"utf8mb4_0900_ai_ci": 255,
}
// MySQL collation information.
......@@ -574,15 +576,15 @@ const (
UTF8MB4Charset = "utf8mb4"
DefaultCharset = UTF8MB4Charset
// DefaultCollationID is utf8mb4_bin(46)
DefaultCollationID = 46
Latin1CollationID = 8
ASCIICollationID = 11
UTF8CollationID = 33
UTF8MB4CollationID = 45
BinaryCollationID = 63
UTF8DefaultCollation = "utf8_bin"
UTF8MB4DefaultCollation = "utf8mb4_bin"
DefaultCollationName = UTF8MB4DefaultCollation
DefaultCollationID = 46
Latin1DefaultCollationID = 47
ASCIIDefaultCollationID = 65
UTF8DefaultCollationID = 83
UTF8MB4DefaultCollationID = 46
BinaryDefaultCollationID = 63
UTF8DefaultCollation = "utf8_bin"
UTF8MB4DefaultCollation = "utf8mb4_bin"
DefaultCollationName = UTF8MB4DefaultCollation
// MaxBytesOfCharacter, is the max bytes length of a character,
// refer to RFC3629, in UTF-8, characters from the U+0000..U+10FFFF range
......
......@@ -882,6 +882,7 @@ const (
ErrMustChangePasswordLogin = 1862
ErrRowInWrongPartition = 1863
ErrErrorLast = 1863
ErrInvalidJSONData = 3069
ErrGeneratedColumnFunctionIsNotAllowed = 3102
ErrBadGeneratedColumn = 3105
ErrUnsupportedOnGeneratedColumn = 3106
......@@ -890,10 +891,11 @@ const (
ErrGeneratedColumnRefAutoInc = 3109
ErrInvalidJSONText = 3140
ErrInvalidJSONPath = 3143
ErrInvalidJSONData = 3146
ErrInvalidTypeForJSON = 3146
ErrInvalidJSONPathWildcard = 3149
ErrInvalidJSONContainsPathType = 3150
ErrJSONUsedAsKey = 3152
ErrBadUser = 3162
ErrRoleNotGranted = 3530
ErrWindowNoSuchWindow = 3579
ErrWindowCircularityInWindowGraph = 3580
......@@ -921,6 +923,8 @@ const (
ErrMemExceedThreshold = 8001
ErrForUpdateCantRetry = 8002
ErrAdminCheckTable = 8003
ErrTxnTooLarge = 8004
ErrWriteConflictInTiDB = 8005
ErrInvalidPluginID = 8101
ErrInvalidPluginManifest = 8102
ErrInvalidPluginName = 8103
......@@ -938,6 +942,5 @@ const (
ErrResolveLockTimeout = 9004
ErrRegionUnavailable = 9005
ErrGCTooEarly = 9006
ErrTxnTooLarge = 9500
ErrWriteConflict = 9007
)
......@@ -885,9 +885,10 @@ var MySQLErrName = map[uint16]string{
ErrDependentByGeneratedColumn: "Column '%s' has a generated column dependency.",
ErrGeneratedColumnFunctionIsNotAllowed: "Expression of generated column '%s' contains a disallowed function.",
ErrGeneratedColumnRefAutoInc: "Generated column '%s' cannot refer to auto-increment column.",
ErrInvalidJSONData: "Invalid JSON data provided to function %s: %s",
ErrInvalidJSONText: "Invalid JSON text: %-.192s",
ErrInvalidJSONPath: "Invalid JSON path expression %s.",
ErrInvalidJSONData: "Invalid data type for JSON data",
ErrInvalidTypeForJSON: "Invalid data type for JSON data in argument %d to function %s; a JSON string or JSON type is required.",
ErrInvalidJSONPathWildcard: "In this situation, path expressions may not contain the * and ** tokens.",
ErrInvalidJSONContainsPathType: "The second argument can only be either 'one' or 'all'.",
ErrJSONUsedAsKey: "JSON column '%-.192s' cannot be used in key specification.",
......@@ -915,10 +916,11 @@ var MySQLErrName = map[uint16]string{
ErrRoleNotGranted: "%s is is not granted to %s",
// TiDB errors.
ErrMemExceedThreshold: "%s holds %dB memory, exceeds threshold %dB.%s",
ErrForUpdateCantRetry: "[%d] can not retry select for update statement",
ErrAdminCheckTable: "TiDB admin check table failed.",
ErrMemExceedThreshold: "%s holds %dB memory, exceeds threshold %dB.%s",
ErrForUpdateCantRetry: "[%d] can not retry select for update statement",
ErrAdminCheckTable: "TiDB admin check table failed.",
ErrTxnTooLarge: "Transaction is too large",
ErrWriteConflictInTiDB: "Write conflict, txnStartTS %d is stale",
ErrInvalidPluginID: "Wrong plugin id: %s, valid plugin id is [name]-[version], both name and version should not contain '-'",
ErrInvalidPluginManifest: "Cannot read plugin %s's manifest",
ErrInvalidPluginName: "Plugin load with %s but got wrong name %s",
......@@ -936,6 +938,5 @@ var MySQLErrName = map[uint16]string{
ErrResolveLockTimeout: "Resolve lock timeout",
ErrRegionUnavailable: "Region is unavailable",
ErrGCTooEarly: "GC life time is shorter than transaction duration, transaction starts at %v, GC safe point is %v",
ErrTxnTooLarge: "Transaction is too large",
ErrWriteConflict: "Write conflict, txnStartTS=%d, conflictStartTS=%d, conflictCommitTS=%d, key=%s",
}
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -203,6 +203,7 @@ import (
primary "PRIMARY"
procedure "PROCEDURE"
shardRowIDBits "SHARD_ROW_ID_BITS"
preSplitRegions "PRE_SPLIT_REGIONS"
rangeKwd "RANGE"
rank "RANK"
read "READ"
......@@ -281,6 +282,7 @@ import (
begin "BEGIN"
binlog "BINLOG"
bitType "BIT"
block "BLOCK"
booleanType "BOOLEAN"
boolType "BOOL"
btree "BTREE"
......@@ -302,6 +304,8 @@ import (
compression "COMPRESSION"
connection "CONNECTION"
consistent "CONSISTENT"
context "CONTEXT"
cpu "CPU"
current "CURRENT"
day "DAY"
data "DATA"
......@@ -325,6 +329,7 @@ import (
exclusive "EXCLUSIVE"
execute "EXECUTE"
expire "EXPIRE"
faultsSym "FAULTS"
fields "FIELDS"
first "FIRST"
fixed "FIXED"
......@@ -339,8 +344,11 @@ import (
identified "IDENTIFIED"
isolation "ISOLATION"
issuer "ISSUER"
incremental "INCREMENTAL"
indexes "INDEXES"
invoker "INVOKER"
io "IO"
ipc "IPC"
jsonType "JSON"
keyBlockSize "KEY_BLOCK_SIZE"
local "LOCAL"
......@@ -358,6 +366,7 @@ import (
maxQueriesPerHour "MAX_QUERIES_PER_HOUR"
maxUpdatesPerHour "MAX_UPDATES_PER_HOUR"
maxUserConnections "MAX_USER_CONNECTIONS"
memory "MEMORY"
merge "MERGE"
minRows "MIN_ROWS"
names "NAMES"
......@@ -368,6 +377,7 @@ import (
nulls "NULLS"
offset "OFFSET"
only "ONLY"
pageSym "PAGE"
password "PASSWORD"
partitions "PARTITIONS"
pipesAsOr
......@@ -377,6 +387,7 @@ import (
privileges "PRIVILEGES"
process "PROCESS"
processlist "PROCESSLIST"
profile "PROFILE"
profiles "PROFILES"
quarter "QUARTER"
query "QUERY"
......@@ -410,6 +421,10 @@ import (
start "START"
statsPersistent "STATS_PERSISTENT"
status "STATUS"
swaps "SWAPS"
switchesSym "SWITCHES"
open "OPEN"
source "SOURCE"
subject "SUBJECT"
subpartition "SUBPARTITION"
subpartitions "SUBPARTITIONS"
......@@ -425,6 +440,7 @@ import (
timeType "TIME"
timestampType "TIMESTAMP"
trace "TRACE"
traditional "TRADITIONAL"
transaction "TRANSACTION"
triggers "TRIGGERS"
truncate "TRUNCATE"
......@@ -501,6 +517,8 @@ import (
job "JOB"
nodeID "NODE_ID"
nodeState "NODE_STATE"
optimistic "OPTIMISTIC"
pessimistic "PESSIMISTIC"
pump "PUMP"
stats "STATS"
statsMeta "STATS_META"
......@@ -511,6 +529,7 @@ import (
tidbHJ "TIDB_HJ"
tidbSMJ "TIDB_SMJ"
tidbINLJ "TIDB_INLJ"
split "SPLIT"
builtinAddDate
builtinBitAnd
......@@ -590,15 +609,13 @@ import (
%type <statement>
AdminStmt "Check table statement or show ddl statement"
AlterDatabaseStmt "Alter database statement"
AlterTableStmt "Alter table statement"
AlterUserStmt "Alter user statement"
AnalyzeTableStmt "Analyze table statement"
BeginTransactionStmt "BEGIN TRANSACTION statement"
BinlogStmt "Binlog base64 statement"
CommitStmt "COMMIT statement"
ConnectionOption "single connection options"
ConnectionOptionList "connection options for CREATE USER statement"
ConnectionOptions "optional connection options for CREATE USER statement"
CreateTableStmt "CREATE TABLE statement"
CreateViewStmt "CREATE VIEW stetement"
CreateUserStmt "CREATE User statement"
......@@ -637,6 +654,7 @@ import (
RevokeStmt "Revoke statement"
RevokeRoleStmt "Revoke role statement"
RollbackStmt "ROLLBACK statement"
SplitIndexRegionStmt "Split index region statement"
SetStmt "Set variable statement"
ChangeStmt "Change statement"
SetRoleStmt "Set active role statement"
......@@ -644,7 +662,7 @@ import (
ShowStmt "Show engines/databases/tables/user/columns/warnings/status statement"
Statement "statement"
TraceStmt "TRACE statement"
TraceableStmt "traceable statment"
TraceableStmt "traceable statement"
TruncateTableStmt "TRUNCATE TABLE statement"
UnlockTablesStmt "Unlock tables statement"
UpdateStmt "UPDATE statement"
......@@ -667,13 +685,17 @@ import (
CastType "Cast function target type"
CharsetName "Character set name"
ClearPasswordExpireOptions "Clear password expire options"
CollationName "Collation name"
ColumnDef "table column definition"
ColumnDefList "table column definition list"
ColumnName "column name"
ColumnNameOrUserVariable "column name or user variable"
ColumnNameList "column name list"
ColumnNameOrUserVariableList "column name or user variable list"
ColumnList "column list"
ColumnNameListOpt "column name list opt"
ColumnNameListOptWithBrackets "column name list opt with brackets"
ColumnNameOrUserVarListOpt "column name or user vairiabe list opt"
ColumnNameOrUserVarListOptWithBrackets "column name or user variable list opt with brackets"
ColumnSetValue "insert statement set value by column name"
ColumnSetValueList "insert statement set value by column name list"
CompareOp "Compare opcode"
......@@ -681,6 +703,9 @@ import (
ColumnOptionList "column definition option list"
VirtualOrStored "indicate generated column is stored or not"
ColumnOptionListOpt "optional column definition option list"
ConnectionOption "single connection options"
ConnectionOptionList "connection options for CREATE USER statement"
ConnectionOptions "optional connection options for CREATE USER statement"
Constraint "table constraint"
ConstraintElem "table constraint element"
ConstraintKeywordOpt "Constraint Keyword or empty"
......@@ -695,11 +720,10 @@ import (
DefaultFalseDistinctOpt "Distinct option which defaults to false"
DefaultTrueDistinctOpt "Distinct option which defaults to true"
BuggyDefaultFalseDistinctOpt "Distinct option which accepts DISTINCT ALL and defaults to false"
Enclosed "Enclosed by"
RequireClause "Encrypted connections options"
EqOpt "= or empty"
EscapedTableRef "escaped table reference"
Escaped "Escaped by"
ExplainFormatType "explain format type"
ExpressionList "expression list"
MaxValueOrExpressionList "maxvalue or expression list"
ExpressionListOpt "expression list opt"
......@@ -707,13 +731,14 @@ import (
FuncDatetimePrecList "Function datetime precision list"
Field "field expression"
Fields "Fields clause"
FieldsTerminated "Fields terminated by"
FieldAsName "Field alias name"
FieldAsNameOpt "Field alias name opt"
FieldList "field expression list"
FlushOption "Flush option"
PluginNameList "Plugin Name List"
TableRefsClause "Table references clause"
FieldItem "Field item for load data clause"
FieldItemList "Field items for load data clause"
FuncDatetimePrec "Function datetime precision"
GlobalScope "The scope of variable"
GroupByClause "GROUP BY clause"
......@@ -747,6 +772,9 @@ import (
LimitOption "Limit option could be integer or parameter marker."
Lines "Lines clause"
LinesTerminated "Lines terminated by"
LoadDataSetSpecOpt "Optional load data specification"
LoadDataSetList "Load data specifications"
LoadDataSetItem "Single load data specification"
LocalOpt "Local opt"
LockClause "Alter table lock clause"
MaxNumBuckets "Max number of buckets"
......@@ -754,7 +782,7 @@ import (
NoWriteToBinLogAliasOpt "NO_WRITE_TO_BINLOG alias LOCAL or empty"
ObjectType "Grant statement object type"
OnDuplicateKeyUpdate "ON DUPLICATE KEY UPDATE value list"
DuplicateOpt "[IGNORE|REPLACE] in CREATE TABLE ... SELECT statement"
DuplicateOpt "[IGNORE|REPLACE] in CREATE TABLE ... SELECT statement or LOAD DATA statement"
OptFull "Full or empty"
Order "ORDER BY clause optional collation specification"
OrderBy "ORDER BY clause"
......@@ -817,6 +845,10 @@ import (
ShowDatabaseNameOpt "Show tables/columns statement database name option"
ShowTableAliasOpt "Show table alias option"
ShowLikeOrWhereOpt "Show like or where clause option"
ShowProfileArgsOpt "Show profile args option"
ShowProfileTypesOpt "Show profile types option"
ShowProfileType "Show profile type"
ShowProfileTypes "Show profile types"
Starting "Starting by"
StatementList "statement list"
StatsPersistentVal "stats_persistent value"
......@@ -854,6 +886,7 @@ import (
UserSpec "Username and auth option"
UserSpecList "Username and auth option list"
UserVariableList "User defined variable name list"
UsingRoles "UsingRoles is role option for SHOW GRANT"
Values "values"
ValuesList "values list"
ValuesOpt "values optional"
......@@ -995,6 +1028,8 @@ import (
%precedence insertValues
%precedence lowerThanCreateTableSelect
%precedence createTableSelect
%precedence lowerThanCharsetKwd
%precedence charsetKwd
%precedence lowerThanKey
%precedence key
......@@ -1437,6 +1472,24 @@ RecoverTableStmt:
}
}
/*******************************************************************
*
* Split index region statement
*
* Example:
* SPLIT TABLE table_name INDEX index_name BY (val1...),(val2...)...
*
*******************************************************************/
SplitIndexRegionStmt:
"SPLIT" "TABLE" TableName "INDEX" IndexName "BY" ValuesList
{
$$ = &ast.SplitIndexRegionStmt{
Table: $3.(*ast.TableName),
IndexName: $5.(string),
ValueLists: $7.([][]ast.ExprNode),
}
}
/*******************************************************************************************/
AnalyzeTableStmt:
......@@ -1448,6 +1501,10 @@ AnalyzeTableStmt:
{
$$ = &ast.AnalyzeTableStmt{TableNames: []*ast.TableName{$3.(*ast.TableName)}, IndexNames: $5.([]model.CIStr), IndexFlag: true, MaxNumBuckets: $6.(uint64)}
}
| "ANALYZE" "INCREMENTAL" "TABLE" TableName "INDEX" IndexNameList MaxNumBuckets
{
$$ = &ast.AnalyzeTableStmt{TableNames: []*ast.TableName{$4.(*ast.TableName)}, IndexNames: $6.([]model.CIStr), IndexFlag: true, Incremental: true, MaxNumBuckets: $7.(uint64)}
}
| "ANALYZE" "TABLE" TableName "PARTITION" PartitionNameList MaxNumBuckets
{
$$ = &ast.AnalyzeTableStmt{TableNames: []*ast.TableName{$3.(*ast.TableName)}, PartitionNames: $5.([]model.CIStr), MaxNumBuckets: $6.(uint64),}
......@@ -1462,6 +1519,17 @@ AnalyzeTableStmt:
MaxNumBuckets: $8.(uint64),
}
}
| "ANALYZE" "INCREMENTAL" "TABLE" TableName "PARTITION" PartitionNameList "INDEX" IndexNameList MaxNumBuckets
{
$$ = &ast.AnalyzeTableStmt{
TableNames: []*ast.TableName{$4.(*ast.TableName)},
PartitionNames: $6.([]model.CIStr),
IndexNames: $8.([]model.CIStr),
IndexFlag: true,
Incremental: true,
MaxNumBuckets: $9.(uint64),
}
}
MaxNumBuckets:
{
......@@ -1501,6 +1569,18 @@ BeginTransactionStmt:
{
$$ = &ast.BeginStmt{}
}
| "BEGIN" "PESSIMISTIC"
{
$$ = &ast.BeginStmt{
Mode: ast.Pessimistic,
}
}
| "BEGIN" "OPTIMISTIC"
{
$$ = &ast.BeginStmt{
Mode: ast.Optimistic,
}
}
| "START" "TRANSACTION"
{
$$ = &ast.BeginStmt{}
......@@ -1529,7 +1609,12 @@ ColumnDefList:
ColumnDef:
ColumnName Type ColumnOptionListOpt
{
$$ = &ast.ColumnDef{Name: $1.(*ast.ColumnName), Tp: $2.(*types.FieldType), Options: $3.([]*ast.ColumnOption)}
colDef := &ast.ColumnDef{Name: $1.(*ast.ColumnName), Tp: $2.(*types.FieldType), Options: $3.([]*ast.ColumnOption)}
if !colDef.Validate() {
yylex.AppendError(yylex.Errorf("Invalid column definition"))
return 1
}
$$ = colDef
}
ColumnName:
......@@ -1566,14 +1651,44 @@ ColumnNameListOpt:
$$ = $1.([]*ast.ColumnName)
}
ColumnNameListOptWithBrackets:
ColumnNameOrUserVarListOpt:
/* EMPTY */
{
$$ = []*ast.ColumnName{}
$$ = []*ast.ColumnNameOrUserVar{}
}
| ColumnNameOrUserVariableList
{
$$ = $1.([]*ast.ColumnNameOrUserVar)
}
ColumnNameOrUserVariableList:
ColumnNameOrUserVariable
{
$$ = []*ast.ColumnNameOrUserVar{$1.(*ast.ColumnNameOrUserVar)}
}
| ColumnNameOrUserVariableList ',' ColumnNameOrUserVariable
{
$$ = append($1.([]*ast.ColumnNameOrUserVar), $3.(*ast.ColumnNameOrUserVar))
}
ColumnNameOrUserVariable:
ColumnName
{
$$ = &ast.ColumnNameOrUserVar{ColumnName: $1.(*ast.ColumnName)}
}
| UserVariable
{
$$ = &ast.ColumnNameOrUserVar{UserVar: $1.(*ast.VariableExpr)}
}
ColumnNameOrUserVarListOptWithBrackets:
/* EMPTY */
{
$$ = []*ast.ColumnNameOrUserVar{}
}
| '(' ColumnNameListOpt ')'
| '(' ColumnNameOrUserVarListOpt ')'
{
$$ = $2.([]*ast.ColumnName)
$$ = $2.([]*ast.ColumnNameOrUserVar)
}
CommitStmt:
......@@ -1620,8 +1735,7 @@ ColumnOption:
}
| "ON" "UPDATE" NowSymOptionFraction
{
nowFunc := &ast.FuncCallExpr{FnName: model.NewCIStr("CURRENT_TIMESTAMP")}
$$ = &ast.ColumnOption{Tp: ast.ColumnOptionOnUpdate, Expr: nowFunc}
$$ = &ast.ColumnOption{Tp: ast.ColumnOptionOnUpdate, Expr: $3}
}
| "COMMENT" stringLit
{
......@@ -1653,7 +1767,7 @@ ColumnOption:
Refer: $1.(*ast.ReferenceDef),
}
}
| "COLLATE" StringName
| "COLLATE" CollationName
{
$$ = &ast.ColumnOption{Tp: ast.ColumnOptionCollate, StrValue: $2.(string)}
}
......@@ -1935,6 +2049,35 @@ IndexColNameList:
/**************************************AlterDatabaseStmt***************************************
* See https://dev.mysql.com/doc/refman/5.7/en/alter-database.html
* 'ALTER DATABASE ... UPGRADE DATA DIRECTORY NAME' is not supported yet.
*
* ALTER {DATABASE | SCHEMA} [db_name]
* alter_specification ...
*
* alter_specification:
* [DEFAULT] CHARACTER SET [=] charset_name
* | [DEFAULT] COLLATE [=] collation_name
*******************************************************************************************/
AlterDatabaseStmt:
"ALTER" DatabaseSym DBName DatabaseOptionList
{
$$ = &ast.AlterDatabaseStmt{
Name: $3.(string),
AlterDefaultDatabase: false,
Options: $4.([]*ast.DatabaseOption),
}
}
| "ALTER" DatabaseSym DatabaseOptionList
{
$$ = &ast.AlterDatabaseStmt{
Name: "",
AlterDefaultDatabase: true,
Options: $3.([]*ast.DatabaseOption),
}
}
/*******************************************************************
*
* Create Database Statement
......@@ -1966,7 +2109,7 @@ DatabaseOption:
{
$$ = &ast.DatabaseOption{Tp: ast.DatabaseOptionCharset, Value: $4.(string)}
}
| DefaultKwdOpt "COLLATE" EqOpt StringName
| DefaultKwdOpt "COLLATE" EqOpt CollationName
{
$$ = &ast.DatabaseOption{Tp: ast.DatabaseOptionCollate, Value: $4.(string)}
}
......@@ -2013,7 +2156,7 @@ CreateTableStmt:
if $7 != nil {
stmt.Partition = $7.(*ast.PartitionOptions)
}
stmt.OnDuplicate = $8.(ast.OnDuplicateCreateTableSelectType)
stmt.OnDuplicate = $8.(ast.OnDuplicateKeyHandlingType)
stmt.Select = $10.(*ast.CreateTableStmt).Select
$$ = stmt
}
......@@ -2027,6 +2170,7 @@ CreateTableStmt:
}
DefaultKwdOpt:
%prec lowerThanCharsetKwd
{}
| "DEFAULT"
......@@ -2204,15 +2348,15 @@ PartDefValuesOpt:
DuplicateOpt:
{
$$ = ast.OnDuplicateCreateTableSelectError
$$ = ast.OnDuplicateKeyHandlingError
}
| "IGNORE"
{
$$ = ast.OnDuplicateCreateTableSelectIgnore
$$ = ast.OnDuplicateKeyHandlingIgnore
}
| "REPLACE"
{
$$ = ast.OnDuplicateCreateTableSelectReplace
$$ = ast.OnDuplicateKeyHandlingReplace
}
AsOpt:
......@@ -2624,6 +2768,20 @@ ExplainStmt:
Format: $4,
}
}
| ExplainSym "FORMAT" "=" ExplainFormatType "FOR" "CONNECTION" NUM
{
$$ = &ast.ExplainForStmt{
Format: $4.(string),
ConnectionID: getUint64FromNUM($7),
}
}
| ExplainSym "FORMAT" "=" ExplainFormatType ExplainableStmt
{
$$ = &ast.ExplainStmt{
Stmt: $5,
Format: $4.(string),
}
}
| ExplainSym "ANALYZE" ExplainableStmt
{
$$ = &ast.ExplainStmt {
......@@ -2633,6 +2791,16 @@ ExplainStmt:
}
}
ExplainFormatType:
"TRADITIONAL"
{
$$ = "row"
}
| "JSON"
{
$$ = "json"
}
LengthNum:
NUM
{
......@@ -2903,7 +3071,7 @@ PredicateExpr:
{
escape := $4.(string)
if len(escape) > 1 {
yylex.AppendError(yylex.Errorf("Incorrect arguments %s to ESCAPE", escape))
yylex.AppendError(ErrWrongArguments.GenWithStackByArgs("ESCAPE"))
return 1
} else if len(escape) == 0 {
escape = "\\"
......@@ -3136,26 +3304,28 @@ Identifier:
identifier | UnReservedKeyword | NotKeywordToken | TiDBKeyword
UnReservedKeyword:
"ACTION" | "ASCII" | "AUTO_INCREMENT" | "AFTER" | "ALWAYS" | "AVG" | "BEGIN" | "BIT" | "BOOL" | "BOOLEAN" | "BTREE" | "BYTE" | "CLEANUP" | "CHARSET"
"ACTION" | "ASCII" | "AUTO_INCREMENT" | "AFTER" | "ALWAYS" | "AVG" | "BEGIN" | "BIT" | "BOOL" | "BOOLEAN" | "BTREE" | "BYTE" | "CLEANUP" | "CHARSET" %prec charsetKwd
| "COLUMNS" | "COMMIT" | "COMPACT" | "COMPRESSED" | "CONSISTENT" | "CURRENT" | "DATA" | "DATE" %prec lowerThanStringLitToken| "DATETIME" | "DAY" | "DEALLOCATE" | "DO" | "DUPLICATE"
| "DYNAMIC"| "END" | "ENGINE" | "ENGINES" | "ENUM" | "ERRORS" | "ESCAPE" | "EXECUTE" | "FIELDS" | "FIRST" | "FIXED" | "FLUSH" | "FOLLOWING" | "FORMAT" | "FULL" |"GLOBAL"
| "HASH" | "HOUR" | "LESS" | "LOCAL" | "LAST" | "NAMES" | "OFFSET" | "PASSWORD" %prec lowerThanEq | "PREPARE" | "QUICK" | "REDUNDANT"
| "ROLE" |"ROLLBACK" | "SESSION" | "SIGNED" | "SNAPSHOT" | "START" | "STATUS" | "SUBPARTITIONS" | "SUBPARTITION" | "TABLES" | "TABLESPACE" | "TEXT" | "THAN" | "TIME" %prec lowerThanStringLitToken
| "ROLE" |"ROLLBACK" | "SESSION" | "SIGNED" | "SNAPSHOT" | "START" | "STATUS" | "OPEN"| "SUBPARTITIONS" | "SUBPARTITION" | "TABLES" | "TABLESPACE" | "TEXT" | "THAN" | "TIME" %prec lowerThanStringLitToken
| "TIMESTAMP" %prec lowerThanStringLitToken | "TRACE" | "TRANSACTION" | "TRUNCATE" | "UNBOUNDED" | "UNKNOWN" | "VALUE" | "WARNINGS" | "YEAR" | "MODE" | "WEEK" | "ANY" | "SOME" | "USER" | "IDENTIFIED"
| "COLLATION" | "COMMENT" | "AVG_ROW_LENGTH" | "CONNECTION" | "CHECKSUM" | "COMPRESSION" | "KEY_BLOCK_SIZE" | "MASTER" | "MAX_ROWS"
| "MIN_ROWS" | "NATIONAL" | "ROW_FORMAT" | "QUARTER" | "GRANTS" | "TRIGGERS" | "DELAY_KEY_WRITE" | "ISOLATION" | "JSON"
| "REPEATABLE" | "RESPECT" | "COMMITTED" | "UNCOMMITTED" | "ONLY" | "SERIALIZABLE" | "LEVEL" | "VARIABLES" | "SQL_CACHE" | "INDEXES" | "PROCESSLIST"
| "SQL_NO_CACHE" | "DISABLE" | "ENABLE" | "REVERSE" | "PRIVILEGES" | "NO" | "BINLOG" | "FUNCTION" | "VIEW" | "BINDING" | "BINDINGS" | "MODIFY" | "EVENTS" | "PARTITIONS"
| "NONE" | "NULLS" | "SUPER" | "EXCLUSIVE" | "STATS_PERSISTENT" | "ROW_COUNT" | "COALESCE" | "MONTH" | "PROCESS" | "PROFILES"
| "NONE" | "NULLS" | "SUPER" | "EXCLUSIVE" | "STATS_PERSISTENT" | "ROW_COUNT" | "COALESCE" | "MONTH" | "PROCESS" | "PROFILE" | "PROFILES"
| "MICROSECOND" | "MINUTE" | "PLUGINS" | "PRECEDING" | "QUERY" | "QUERIES" | "SECOND" | "SEPARATOR" | "SHARE" | "SHARED" | "SLOW" | "MAX_CONNECTIONS_PER_HOUR" | "MAX_QUERIES_PER_HOUR" | "MAX_UPDATES_PER_HOUR"
| "MAX_USER_CONNECTIONS" | "REPLICATION" | "CLIENT" | "SLAVE" | "RELOAD" | "TEMPORARY" | "ROUTINE" | "EVENT" | "ALGORITHM" | "DEFINER" | "INVOKER" | "MERGE" | "TEMPTABLE" | "UNDEFINED" | "SECURITY" | "CASCADED" | "RECOVER" | "CIPHER" | "SUBJECT" | "ISSUER" | "X509" | "NEVER" | "EXPIRE" | "ACCOUNT"
| "MAX_USER_CONNECTIONS" | "REPLICATION" | "CLIENT" | "SLAVE" | "RELOAD" | "TEMPORARY" | "ROUTINE" | "EVENT" | "ALGORITHM" | "DEFINER" | "INVOKER" | "MERGE" | "TEMPTABLE" | "UNDEFINED" | "SECURITY" | "CASCADED"
| "RECOVER" | "CIPHER" | "SUBJECT" | "ISSUER" | "X509" | "NEVER" | "EXPIRE" | "ACCOUNT" | "INCREMENTAL" | "CPU" | "MEMORY" | "BLOCK" | "IO" | "CONTEXT" | "SWITCHES" | "PAGE" | "FAULTS" | "IPC" | "SWAPS" | "SOURCE" | "TRADITIONAL"
TiDBKeyword:
"ADMIN" | "BUCKETS" | "CANCEL" | "DDL" | "DRAINER" | "JOBS" | "JOB" | "NODE_ID" | "NODE_STATE" | "PUMP" | "STATS" | "STATS_META" | "STATS_HISTOGRAMS" | "STATS_BUCKETS" | "STATS_HEALTHY" | "TIDB" | "TIDB_HJ"
| "TIDB_SMJ" | "TIDB_INLJ"
| "TIDB_SMJ" | "TIDB_INLJ" | "SPLIT" | "OPTIMISTIC" | "PESSIMISTIC"
NotKeywordToken:
"ADDDATE" | "BIT_AND" | "BIT_OR" | "BIT_XOR" | "CAST" | "COPY" | "COUNT" | "CURTIME" | "DATE_ADD" | "DATE_SUB" | "EXTRACT" | "GET_FORMAT" | "GROUP_CONCAT"
......@@ -5680,6 +5850,12 @@ SetRoleStmt:
SetDefaultRoleStmt:
"SET" "DEFAULT" "ROLE" SetDefaultRoleOpt "TO" UsernameList
{
tmp := $4.(*ast.SetRoleStmt)
$$ = &ast.SetDefaultRoleStmt{
SetRoleOpt: tmp.SetRoleOpt,
RoleList: tmp.RoleList,
UserList: $6.([]*auth.UserIdentity),
}
}
SetDefaultRoleOpt:
......@@ -5857,20 +6033,31 @@ CharsetName:
StringName
{
// Validate input charset name to keep the same behavior as parser of MySQL.
_, _, err := charset.GetCharsetInfo($1.(string))
name, _, err := charset.GetCharsetInfo($1.(string))
if err != nil {
yylex.AppendError(ErrUnknownCharacterSet.GenWithStackByArgs($1))
return 1
}
// Use $1 instead of charset name returned from charset.GetCharsetInfo(),
// to keep upper-lower case of input for restore.
$$ = $1
// Use charset name returned from charset.GetCharsetInfo(),
// to keep lower case of input for generated column restore.
$$ = name
}
| binaryType
{
$$ = charset.CharsetBin
}
CollationName:
StringName
{
info, err := charset.GetCollationByName($1.(string))
if err != nil {
yylex.AppendError(err)
return 1
}
$$ = info.Name
}
VariableAssignmentList:
{
$$ = []*ast.VariableAssignment{}
......@@ -6196,12 +6383,21 @@ ShowStmt:
// See https://dev.mysql.com/doc/refman/5.7/en/show-grants.html
$$ = &ast.ShowStmt{Tp: ast.ShowGrants}
}
| "SHOW" "GRANTS" "FOR" Username
| "SHOW" "GRANTS" "FOR" Username UsingRoles
{
// See https://dev.mysql.com/doc/refman/5.7/en/show-grants.html
$$ = &ast.ShowStmt{
Tp: ast.ShowGrants,
User: $4.(*auth.UserIdentity),
if $5 != nil {
$$ = &ast.ShowStmt{
Tp: ast.ShowGrants,
User: $4.(*auth.UserIdentity),
Roles: $5.([]*auth.RoleIdentity),
}
} else {
$$ = &ast.ShowStmt{
Tp: ast.ShowGrants,
User: $4.(*auth.UserIdentity),
Roles: nil,
}
}
}
| "SHOW" "MASTER" "STATUS"
......@@ -6279,12 +6475,121 @@ ShowStmt:
Tp: ast.ShowProfiles,
}
}
| "SHOW" "PROFILE" ShowProfileTypesOpt ShowProfileArgsOpt SelectStmtLimit
{
v := &ast.ShowStmt{
Tp: ast.ShowProfile,
}
if $3 != nil {
v.ShowProfileTypes = $3.([]int)
}
if $4 != nil {
v.ShowProfileArgs = $4.(*int64)
}
if $5 != nil {
v.ShowProfileLimit = $5.(*ast.Limit)
}
$$ = v
}
| "SHOW" "PRIVILEGES"
{
$$ = &ast.ShowStmt{
Tp: ast.ShowPrivileges,
}
}
| "SHOW" "ANALYZE" "STATUS" ShowLikeOrWhereOpt
{
stmt := &ast.ShowStmt{
Tp: ast.ShowAnalyzeStatus,
}
if $4 != nil {
if x, ok := $4.(*ast.PatternLikeExpr); ok && x.Expr == nil {
stmt.Pattern = x
} else {
stmt.Where = $4.(ast.ExprNode)
}
}
$$ = stmt
}
ShowProfileTypesOpt:
{
$$ = nil
}
| ShowProfileTypes
{
$$ = $1
}
ShowProfileTypes:
ShowProfileType
{
$$ = []int{$1.(int)}
}
| ShowProfileTypes ',' ShowProfileType
{
l := $1.([]int)
l = append(l, $3.(int))
$$ = l
}
ShowProfileType:
"CPU"
{
$$ = ast.ProfileTypeCPU
}
| "MEMORY"
{
$$ = ast.ProfileTypeMemory
}
| "BLOCK" "IO"
{
$$ = ast.ProfileTypeBlockIo
}
| "CONTEXT" "SWITCHES"
{
$$ = ast.ProfileTypeContextSwitch
}
| "PAGE" "FAULTS"
{
$$ = ast.ProfileTypePageFaults
}
| "IPC"
{
$$ = ast.ProfileTypeIpc
}
| "SWAPS"
{
$$ = ast.ProfileTypeSwaps
}
| "SOURCE"
{
$$ = ast.ProfileTypeSource
}
| "ALL"
{
$$ = ast.ProfileTypeAll
}
ShowProfileArgsOpt:
{
$$ = nil
}
| "FOR" "QUERY" NUM
{
v := $3.(int64)
$$ = &v
}
UsingRoles:
{
$$ = nil
}
| "USING" RolenameList
{
$$ = $2.([]*auth.RoleIdentity)
}
ShowIndexKwd:
"INDEX"
......@@ -6315,6 +6620,13 @@ ShowTargetFilterable:
Full: $1.(bool),
}
}
| "OPEN" "TABLES" ShowDatabaseNameOpt
{
$$ = &ast.ShowStmt{
Tp: ast.ShowOpenTables,
DBName: $3.(string),
}
}
| "TABLE" "STATUS" ShowDatabaseNameOpt
{
$$ = &ast.ShowStmt{
......@@ -6574,6 +6886,7 @@ WithReadLockOpt:
Statement:
EmptyStmt
| AdminStmt
| AlterDatabaseStmt
| AlterTableStmt
| AlterUserStmt
| AnalyzeTableStmt
......@@ -6620,6 +6933,7 @@ Statement:
| SetStmt
| SetRoleStmt
| SetDefaultRoleStmt
| SplitIndexRegionStmt
| ShowStmt
| SubSelect
{
......@@ -6758,7 +7072,7 @@ TableOption:
{
$$ = &ast.TableOption{Tp: ast.TableOptionCharset, StrValue: $4.(string)}
}
| DefaultKwdOpt "COLLATE" EqOpt StringName
| DefaultKwdOpt "COLLATE" EqOpt CollationName
{
$$ = &ast.TableOption{Tp: ast.TableOptionCollate, StrValue: $4.(string)}
}
......@@ -6818,6 +7132,10 @@ TableOption:
{
$$ = &ast.TableOption{Tp: ast.TableOptionShardRowID, UintValue: $3.(uint64)}
}
| "PRE_SPLIT_REGIONS" EqOpt LengthNum
{
$$ = &ast.TableOption{Tp: ast.TableOptionPreSplitRegion, UintValue: $3.(uint64)}
}
| "PACK_KEYS" EqOpt StatsPersistentVal
{
// Parse it but will ignore it.
......@@ -7015,7 +7333,7 @@ NumericType:
if x.Flen == types.UnspecifiedLength || x.Flen == 0 {
x.Flen = 1
} else if x.Flen > 64 {
yylex.AppendError(yylex.Errorf("invalid field length %d for bit type, must in [1, 64]", x.Flen))
yylex.AppendError(ErrTooBigDisplayWidth.GenWithStackByArgs(x.Flen))
}
$$ = x
}
......@@ -7433,7 +7751,7 @@ OptCollate:
{
$$ = ""
}
| "COLLATE" StringName
| "COLLATE" CollationName
{
$$ = $2.(string)
}
......@@ -7546,6 +7864,9 @@ CreateUserStmt:
IsCreateRole: false,
IfNotExists: $3.(bool),
Specs: $4.([]*ast.UserSpec),
TslOptions: $5.([]*ast.TslOption),
ResourceOptions: $6.([]*ast.ResourceOption),
PasswordOrLockOptions: $7.([]*ast.PasswordOrLockOption),
}
}
......@@ -7605,127 +7926,182 @@ UserSpecList:
ConnectionOptions:
{
$$ = nil
l := []*ast.ResourceOption{}
$$ = l
}
| "WITH" ConnectionOptionList
{
$$ = nil
$$ = $2
}
ConnectionOptionList:
ConnectionOption
{
$$ = nil
$$ = []*ast.ResourceOption{$1.(*ast.ResourceOption)}
}
| ConnectionOptionList ConnectionOption
{
$$ = nil
l := $1.([]*ast.ResourceOption)
l = append(l, $2.(*ast.ResourceOption))
$$ = l
}
ConnectionOption:
"MAX_QUERIES_PER_HOUR" NUM
{
$$ = nil
$$ = &ast.ResourceOption {
Type: ast.MaxQueriesPerHour,
Count: $2.(int64),
}
}
| "MAX_UPDATES_PER_HOUR" NUM
{
$$ = nil
$$ = &ast.ResourceOption {
Type: ast.MaxUpdatesPerHour,
Count: $2.(int64),
}
}
| "MAX_CONNECTIONS_PER_HOUR" NUM
{
$$ = nil
$$ = &ast.ResourceOption {
Type: ast.MaxConnectionsPerHour,
Count: $2.(int64),
}
}
| "MAX_USER_CONNECTIONS" NUM
{
$$ = nil
$$ = &ast.ResourceOption {
Type: ast.MaxUserConnections,
Count: $2.(int64),
}
}
RequireClause:
{
$$ = nil
l := []*ast.TslOption{}
$$ = l
}
| "REQUIRE" "NONE"
{
$$ = nil
t := &ast.TslOption {
Type: ast.TslNone,
}
$$ = []*ast.TslOption{t}
}
| "REQUIRE" "SSL"
{
$$ = nil
t := &ast.TslOption {
Type: ast.Ssl,
}
$$ = []*ast.TslOption{t}
}
| "REQUIRE" "X509"
{
$$ = nil
t := &ast.TslOption {
Type: ast.X509,
}
$$ = []*ast.TslOption{t}
}
| "REQUIRE" RequireList
{
$$ = nil
$$ = $2
}
RequireList:
RequireListElement
{
$$ = nil
$$ = []*ast.TslOption{$1.(*ast.TslOption)}
}
| RequireListElement "AND" RequireList
{
$$ = nil
l := $3.([]*ast.TslOption)
l = append(l, $1.(*ast.TslOption))
$$ = l
}
RequireListElement:
"ISSUER" StringLiteral
"ISSUER" stringLit
{
$$ = nil
$$ = &ast.TslOption {
Type: ast.Issuer,
Value: $2,
}
}
| "SUBJECT" StringLiteral
| "SUBJECT" stringLit
{
$$ = nil
$$ = &ast.TslOption {
Type: ast.Subject,
Value: $2,
}
}
| "CIPHER" StringLiteral
| "CIPHER" stringLit
{
$$ = nil
$$ = &ast.TslOption {
Type: ast.Cipher,
Value: $2,
}
}
PasswordOrLockOptions:
{
$$ = nil
l := []*ast.PasswordOrLockOption{}
$$ = l
}
| PasswordOrLockOptionList
{
$$ = nil
$$ = $1
}
PasswordOrLockOptionList:
PasswordOrLockOption
{
$$ = nil
$$ = []*ast.PasswordOrLockOption{$1.(*ast.PasswordOrLockOption)}
}
| PasswordOrLockOptionList PasswordOrLockOption
{
$$ = nil
l := $1.([]*ast.PasswordOrLockOption)
l = append(l, $2.(*ast.PasswordOrLockOption))
$$ = l
}
PasswordOrLockOption:
"ACCOUNT" "UNLOCK"
{
$$ = nil
$$ = &ast.PasswordOrLockOption {
Type: ast.Unlock,
}
}
| "ACCOUNT" "LOCK"
{
$$ = nil
$$ = &ast.PasswordOrLockOption {
Type: ast.Lock,
}
}
| PasswordExpire
{
$$ = nil
$$ = &ast.PasswordOrLockOption {
Type: ast.PasswordExpire,
}
}
| PasswordExpire "INTERVAL" NUM "DAY"
{
$$ = nil
$$ = &ast.PasswordOrLockOption {
Type: ast.PasswordExpireInterval,
Count: $3.(int64),
}
}
| PasswordExpire "NEVER"
{
$$ = nil
$$ = &ast.PasswordOrLockOption {
Type: ast.PasswordExpireNever,
}
}
| PasswordExpire "DEFAULT"
{
$$ = &ast.PasswordOrLockOption {
Type: ast.PasswordExpireDefault,
}
}
PasswordExpire:
"PASSWORD" "EXPIRE" ClearPasswordExpireOptions
......@@ -8125,23 +8501,40 @@ RevokeRoleStmt:
* See https://dev.mysql.com/doc/refman/5.7/en/load-data.html
*******************************************************************************************/
LoadDataStmt:
"LOAD" "DATA" LocalOpt "INFILE" stringLit "INTO" "TABLE" TableName CharsetOpt Fields Lines IgnoreLines ColumnNameListOptWithBrackets
"LOAD" "DATA" LocalOpt "INFILE" stringLit DuplicateOpt "INTO" "TABLE" TableName CharsetOpt Fields Lines IgnoreLines ColumnNameOrUserVarListOptWithBrackets LoadDataSetSpecOpt
{
x := &ast.LoadDataStmt{
Path: $5,
Table: $8.(*ast.TableName),
Columns: $13.([]*ast.ColumnName),
IgnoreLines:$12.(uint64),
Path: $5,
OnDuplicate: $6.(ast.OnDuplicateKeyHandlingType),
Table: $9.(*ast.TableName),
ColumnsAndUserVars: $14.([]*ast.ColumnNameOrUserVar),
IgnoreLines: $13.(uint64),
}
if $3 != nil {
x.IsLocal = true
}
if $10 != nil {
x.FieldsInfo = $10.(*ast.FieldsClause)
// See https://dev.mysql.com/doc/refman/5.7/en/load-data.html#load-data-duplicate-key-handling
// If you do not specify IGNORE or REPLACE modifier , then we set default behavior to IGNORE when LOCAL modifier is specified
if x.OnDuplicate == ast.OnDuplicateKeyHandlingError {
x.OnDuplicate = ast.OnDuplicateKeyHandlingIgnore
}
}
if $11 != nil {
x.LinesInfo = $11.(*ast.LinesClause)
x.FieldsInfo = $11.(*ast.FieldsClause)
}
if $12 != nil {
x.LinesInfo = $12.(*ast.LinesClause)
}
if $15 != nil {
x.ColumnAssignments = $15.([]*ast.Assignment)
}
columns := []*ast.ColumnName{}
for _, v := range x.ColumnsAndUserVars {
if v.ColumnName != nil {
columns = append(columns, v.ColumnName)
}
}
x.Columns = columns
$$ = x
}
......@@ -8175,64 +8568,93 @@ Fields:
Escaped: escape[0],
}
}
| FieldsOrColumns FieldsTerminated Enclosed Escaped
| FieldsOrColumns FieldItemList
{
escape := $4.(string)
if escape != "\\" && len(escape) > 1 {
yylex.AppendError(yylex.Errorf("Incorrect arguments %s to ESCAPE", escape))
return 1
}
var enclosed byte
str := $3.(string)
if len(str) > 1 {
yylex.AppendError(yylex.Errorf("Incorrect arguments %s to ENCLOSED", escape))
return 1
}else if len(str) != 0 {
enclosed = str[0]
}
var escaped byte
if len(escape) > 0 {
escaped = escape[0]
}
$$ = &ast.FieldsClause{
Terminated: $2.(string),
Enclosed: enclosed,
Escaped: escaped,
fieldsClause := &ast.FieldsClause{
Terminated: "\t",
Escaped: []byte("\\")[0],
}
fieldItems := $2.([]*ast.FieldItem)
for _, item := range fieldItems {
switch item.Type {
case ast.Terminated:
fieldsClause.Terminated = item.Value
case ast.Enclosed:
var enclosed byte
if len(item.Value) > 0 {
enclosed = item.Value[0]
}
fieldsClause.Enclosed = enclosed
case ast.Escaped:
var escaped byte
if len(item.Value) > 0 {
escaped = item.Value[0]
}
fieldsClause.Escaped = escaped
}
}
$$ = fieldsClause
}
FieldsOrColumns:
"FIELDS" | "COLUMNS"
FieldsTerminated:
FieldItemList:
FieldItemList FieldItem
{
$$ = "\t"
fieldItems := $1.([]*ast.FieldItem)
$$ = append(fieldItems, $2.(*ast.FieldItem))
}
| "TERMINATED" "BY" stringLit
| FieldItem
{
$$ = $3
fieldItems := make([]*ast.FieldItem, 1, 1)
fieldItems[0] = $1.(*ast.FieldItem)
$$ = fieldItems
}
Enclosed:
FieldItem:
"TERMINATED" "BY" stringLit
{
$$ = ""
$$ = &ast.FieldItem{
Type: ast.Terminated,
Value: $3,
}
}
| "OPTIONALLY" "ENCLOSED" "BY" stringLit
{
$$ = $4
str := $4
if str != "\\" && len(str) > 1 {
yylex.AppendError(ErrWrongFieldTerminators.GenWithStackByArgs())
return 1
}
$$ = &ast.FieldItem{
Type: ast.Enclosed,
Value: str,
}
}
| "ENCLOSED" "BY" stringLit
{
$$ = $3
}
Escaped:
{
$$ = "\\"
str := $3
if str != "\\" && len(str) > 1 {
yylex.AppendError(ErrWrongFieldTerminators.GenWithStackByArgs())
return 1
}
$$ = &ast.FieldItem{
Type: ast.Enclosed,
Value: str,
}
}
| "ESCAPED" "BY" stringLit
{
$$ = $3
str := $3
if str != "\\" && len(str) > 1 {
yylex.AppendError(ErrWrongFieldTerminators.GenWithStackByArgs())
return 1
}
$$ = &ast.FieldItem{
Type: ast.Escaped,
Value: str,
}
}
Lines:
......@@ -8262,6 +8684,38 @@ LinesTerminated:
$$ = $3
}
LoadDataSetSpecOpt:
{
$$ = nil
}
| "SET" LoadDataSetList
{
$$ = $2
}
LoadDataSetList:
LoadDataSetList ',' LoadDataSetItem
{
l := $1.([]*ast.Assignment)
$$ = append(l, $3.(*ast.Assignment))
}
| LoadDataSetItem
{
$$ = []*ast.Assignment{$1.(*ast.Assignment)}
}
LoadDataSetItem:
SimpleIdent "=" ExprOrDefault
{
$$ = &ast.Assignment{
Column: $1.(*ast.ColumnNameExpr).Name,
Expr: $3,
}
}
/*********************************************************************
* Lock/Unlock Tables
......
......@@ -239,7 +239,15 @@ func (e *Error) FastGen(format string, args ...interface{}) error {
err := *e
err.message = format
err.args = args
return &err
return errors.SuspendStack(&err)
}
// FastGen generates a new *Error with the same class and code, and a new arguments.
// This will not call runtime.Caller to get file and line.
func (e *Error) FastGenByArgs(args ...interface{}) error {
err := *e
err.args = args
return errors.SuspendStack(&err)
}
// Equal checks if err is equal to e.
......
{
mv go.mod1 go.mod
mv go.sum1 go.sum
GO111MODULE=on go test ./...
GO111MODULE=on go test -race -covermode=atomic -coverprofile=coverage.txt ./...
} || {
mv go.mod go.mod1
mv go.sum go.sum1
......
......@@ -252,54 +252,63 @@ func (ft *FieldType) Restore(ctx *format.RestoreCtx) error {
return nil
}
// FormatAsCastType is used for write AST back to string.
func (ft *FieldType) FormatAsCastType(w io.Writer) {
// RestoreAsCastType is used for write AST back to string.
func (ft *FieldType) RestoreAsCastType(ctx *format.RestoreCtx) {
switch ft.Tp {
case mysql.TypeVarString:
if ft.Charset == charset.CharsetBin && ft.Collate == charset.CollationBin {
fmt.Fprint(w, "BINARY")
ctx.WriteKeyWord("BINARY")
} else {
fmt.Fprint(w, "CHAR")
ctx.WriteKeyWord("CHAR")
}
if ft.Flen != UnspecifiedLength {
fmt.Fprintf(w, "(%d)", ft.Flen)
ctx.WritePlainf("(%d)", ft.Flen)
}
if ft.Flag&mysql.BinaryFlag != 0 {
fmt.Fprint(w, " BINARY")
ctx.WriteKeyWord(" BINARY")
}
if ft.Charset != charset.CharsetBin && ft.Charset != mysql.DefaultCharset {
fmt.Fprintf(w, " CHARACTER SET %s", ft.Charset)
ctx.WriteKeyWord(" CHARSET ")
ctx.WriteKeyWord(ft.Charset)
}
case mysql.TypeDate:
fmt.Fprint(w, "DATE")
ctx.WriteKeyWord("DATE")
case mysql.TypeDatetime:
fmt.Fprint(w, "DATETIME")
ctx.WriteKeyWord("DATETIME")
if ft.Decimal > 0 {
fmt.Fprintf(w, "(%d)", ft.Decimal)
ctx.WritePlainf("(%d)", ft.Decimal)
}
case mysql.TypeNewDecimal:
fmt.Fprint(w, "DECIMAL")
ctx.WriteKeyWord("DECIMAL")
if ft.Flen > 0 && ft.Decimal > 0 {
fmt.Fprintf(w, "(%d, %d)", ft.Flen, ft.Decimal)
ctx.WritePlainf("(%d, %d)", ft.Flen, ft.Decimal)
} else if ft.Flen > 0 {
fmt.Fprintf(w, "(%d)", ft.Flen)
ctx.WritePlainf("(%d)", ft.Flen)
}
case mysql.TypeDuration:
fmt.Fprint(w, "TIME")
ctx.WriteKeyWord("TIME")
if ft.Decimal > 0 {
fmt.Fprintf(w, "(%d)", ft.Decimal)
ctx.WritePlainf("(%d)", ft.Decimal)
}
case mysql.TypeLonglong:
if ft.Flag&mysql.UnsignedFlag != 0 {
fmt.Fprint(w, "UNSIGNED")
ctx.WriteKeyWord("UNSIGNED")
} else {
fmt.Fprint(w, "SIGNED")
ctx.WriteKeyWord("SIGNED")
}
case mysql.TypeJSON:
fmt.Fprint(w, "JSON")
ctx.WriteKeyWord("JSON")
}
}
// FormatAsCastType is used for write AST back to string.
func (ft *FieldType) FormatAsCastType(w io.Writer) {
var sb strings.Builder
restoreCtx := format.NewRestoreCtx(format.DefaultRestoreFlags, &sb)
ft.RestoreAsCastType(restoreCtx)
fmt.Fprint(w, sb.String())
}
// VarStorageLen indicates this column is a variable length column.
const VarStorageLen = -1
......
......@@ -31,6 +31,9 @@ const (
codeErrSyntax = terror.ErrCode(mysql.ErrSyntax)
codeErrUnknownCharacterSet = terror.ErrCode(mysql.ErrUnknownCharacterSet)
codeErrInvalidYearColumnLength = terror.ErrCode(mysql.ErrInvalidYearColumnLength)
codeWrongArgument = terror.ErrCode(mysql.ErrWrongArguments)
codeWrongFieldTerminators = terror.ErrCode(mysql.ErrWrongFieldTerminators)
codeTooBigDisplayWidth = terror.ErrCode(mysql.ErrTooBigDisplaywidth)
)
var (
......@@ -42,6 +45,13 @@ var (
ErrUnknownCharacterSet = terror.ClassParser.New(codeErrUnknownCharacterSet, mysql.MySQLErrName[mysql.ErrUnknownCharacterSet])
// ErrInvalidYearColumnLength returns for illegal column length for year type.
ErrInvalidYearColumnLength = terror.ClassParser.New(codeErrInvalidYearColumnLength, mysql.MySQLErrName[mysql.ErrInvalidYearColumnLength])
// ErrWrongArguments returns for illegal argument.
ErrWrongArguments = terror.ClassParser.New(codeWrongArgument, mysql.MySQLErrName[mysql.ErrWrongArguments])
// ErrWrongFieldTerminators returns for illegal field terminators.
ErrWrongFieldTerminators = terror.ClassParser.New(codeWrongFieldTerminators, mysql.MySQLErrName[mysql.ErrWrongFieldTerminators])
// ErrTooBigDisplayWidth returns for data display width exceed limit .
ErrTooBigDisplayWidth = terror.ClassParser.New(codeTooBigDisplayWidth, mysql.MySQLErrName[mysql.ErrTooBigDisplaywidth])
// SpecFieldPattern special result field pattern
SpecFieldPattern = regexp.MustCompile(`(\/\*!(M?[0-9]{5,6})?|\*\/)`)
specCodePattern = regexp.MustCompile(`\/\*!(M?[0-9]{5,6})?([^*]|\*+[^*/])*\*+\/`)
......@@ -55,6 +65,9 @@ func init() {
codeErrParse: mysql.ErrParse,
codeErrUnknownCharacterSet: mysql.ErrUnknownCharacterSet,
codeErrInvalidYearColumnLength: mysql.ErrInvalidYearColumnLength,
codeWrongArgument: mysql.ErrWrongArguments,
codeWrongFieldTerminators: mysql.ErrWrongFieldTerminators,
codeTooBigDisplayWidth: mysql.ErrTooBigDisplaywidth,
}
terror.ErrClassToMySQLCodes[terror.ClassParser] = parserMySQLErrCodes
}
......
......@@ -15,6 +15,8 @@ package stmtctx
import (
"math"
"sort"
"strconv"
"sync"
"time"
......@@ -93,8 +95,10 @@ type StatementContext struct {
message string
warnings []SQLWarn
errorCount uint16
histogramsNotLoad bool
execDetails execdetails.ExecDetails
allExecDetails []*execdetails.ExecDetails
}
// PrevAffectedRows is the affected-rows value(DDL is 0, DML is the number of affected rows).
PrevAffectedRows int64
......@@ -265,31 +269,42 @@ func (sc *StatementContext) WarningCount() uint16 {
return wc
}
// NumWarnings gets warning count. It's different from `WarningCount` in that
// `WarningCount` return the warning count of the last executed command, so if
// the last command is a SHOW statement, `WarningCount` return 0. On the other
// hand, `NumWarnings` always return number of warnings(or errors if `errOnly`
// is set).
func (sc *StatementContext) NumWarnings(errOnly bool) uint16 {
var wc uint16
const zero = "0"
// NumErrorWarnings gets warning and error count.
func (sc *StatementContext) NumErrorWarnings() (ec, wc string) {
var (
ecNum uint16
wcNum int
)
sc.mu.Lock()
defer sc.mu.Unlock()
if errOnly {
for _, warn := range sc.mu.warnings {
if warn.Level == WarnLevelError {
wc++
}
}
ecNum = sc.mu.errorCount
wcNum = len(sc.mu.warnings)
sc.mu.Unlock()
if ecNum == 0 {
ec = zero
} else {
wc = uint16(len(sc.mu.warnings))
ec = strconv.Itoa(int(ecNum))
}
return wc
if wcNum == 0 {
wc = zero
} else {
wc = strconv.Itoa(wcNum)
}
return
}
// SetWarnings sets warnings.
func (sc *StatementContext) SetWarnings(warns []SQLWarn) {
sc.mu.Lock()
sc.mu.warnings = warns
for _, w := range warns {
if w.Level == WarnLevelError {
sc.mu.errorCount++
}
}
sc.mu.Unlock()
}
......@@ -316,6 +331,7 @@ func (sc *StatementContext) AppendError(warn error) {
sc.mu.Lock()
if len(sc.mu.warnings) < math.MaxUint16 {
sc.mu.warnings = append(sc.mu.warnings, SQLWarn{WarnLevelError, warn})
sc.mu.errorCount++
}
sc.mu.Unlock()
}
......@@ -375,7 +391,10 @@ func (sc *StatementContext) ResetForRetry() {
sc.mu.copied = 0
sc.mu.touched = 0
sc.mu.message = ""
sc.mu.errorCount = 0
sc.mu.warnings = nil
sc.mu.execDetails = execdetails.ExecDetails{}
sc.mu.allExecDetails = make([]*execdetails.ExecDetails, 0, 4)
sc.mu.Unlock()
sc.TableIDs = sc.TableIDs[:0]
sc.IndexIDs = sc.IndexIDs[:0]
......@@ -392,6 +411,7 @@ func (sc *StatementContext) MergeExecDetails(details *execdetails.ExecDetails, c
sc.mu.execDetails.RequestCount++
sc.mu.execDetails.TotalKeys += details.TotalKeys
sc.mu.execDetails.ProcessedKeys += details.ProcessedKeys
sc.mu.allExecDetails = append(sc.mu.allExecDetails, details)
}
sc.mu.execDetails.CommitDetail = commitDetails
sc.mu.Unlock()
......@@ -423,3 +443,46 @@ func (sc *StatementContext) ShouldIgnoreOverflowError() bool {
}
return false
}
// CopTasksDetails returns some useful information of cop-tasks during execution.
func (sc *StatementContext) CopTasksDetails() *CopTasksDetails {
sc.mu.Lock()
defer sc.mu.Unlock()
n := len(sc.mu.allExecDetails)
d := &CopTasksDetails{NumCopTasks: n}
if n == 0 {
return d
}
d.AvgProcessTime = sc.mu.execDetails.ProcessTime / time.Duration(n)
d.AvgWaitTime = sc.mu.execDetails.WaitTime / time.Duration(n)
sort.Slice(sc.mu.allExecDetails, func(i, j int) bool {
return sc.mu.allExecDetails[i].ProcessTime < sc.mu.allExecDetails[j].ProcessTime
})
d.P90ProcessTime = sc.mu.allExecDetails[n*9/10].ProcessTime
d.MaxProcessTime = sc.mu.allExecDetails[n-1].ProcessTime
d.MaxProcessAddress = sc.mu.allExecDetails[n-1].CalleeAddress
sort.Slice(sc.mu.allExecDetails, func(i, j int) bool {
return sc.mu.allExecDetails[i].WaitTime < sc.mu.allExecDetails[j].WaitTime
})
d.P90WaitTime = sc.mu.allExecDetails[n*9/10].WaitTime
d.MaxWaitTime = sc.mu.allExecDetails[n-1].WaitTime
d.MaxWaitAddress = sc.mu.allExecDetails[n-1].CalleeAddress
return d
}
//CopTasksDetails collects some useful information of cop-tasks during execution.
type CopTasksDetails struct {
NumCopTasks int
AvgProcessTime time.Duration
P90ProcessTime time.Duration
MaxProcessAddress string
MaxProcessTime time.Duration
AvgWaitTime time.Duration
P90WaitTime time.Duration
MaxWaitAddress string
MaxWaitTime time.Duration
}
......@@ -173,6 +173,99 @@ func ConvertFloatToUint(sc *stmtctx.StatementContext, fval float64, upperBound u
return uint64(val), nil
}
// convertScientificNotation converts a decimal string with scientific notation to a normal decimal string.
// 1E6 => 1000000, .12345E+5 => 12345
func convertScientificNotation(str string) (string, error) {
// https://golang.org/ref/spec#Floating-point_literals
eIdx := -1
point := -1
for i := 0; i < len(str); i++ {
if str[i] == '.' {
point = i
}
if str[i] == 'e' || str[i] == 'E' {
eIdx = i
if point == -1 {
point = i
}
break
}
}
if eIdx == -1 {
return str, nil
}
exp, err := strconv.ParseInt(str[eIdx+1:], 10, 64)
if err != nil {
return "", errors.WithStack(err)
}
f := str[:eIdx]
if exp == 0 {
return f, nil
} else if exp > 0 { // move point right
if point+int(exp) == len(f)-1 { // 123.456 >> 3 = 123456. = 123456
return f[:point] + f[point+1:], nil
} else if point+int(exp) < len(f)-1 { // 123.456 >> 2 = 12345.6
return f[:point] + f[point+1:point+1+int(exp)] + "." + f[point+1+int(exp):], nil
}
// 123.456 >> 5 = 12345600
return f[:point] + f[point+1:] + strings.Repeat("0", point+int(exp)-len(f)+1), nil
} else { // move point left
exp = -exp
if int(exp) < point { // 123.456 << 2 = 1.23456
return f[:point-int(exp)] + "." + f[point-int(exp):point] + f[point+1:], nil
}
// 123.456 << 5 = 0.00123456
return "0." + strings.Repeat("0", int(exp)-point) + f[:point] + f[point+1:], nil
}
}
func convertDecimalStrToUint(sc *stmtctx.StatementContext, str string, upperBound uint64, tp byte) (uint64, error) {
str, err := convertScientificNotation(str)
if err != nil {
return 0, err
}
var intStr, fracStr string
p := strings.Index(str, ".")
if p == -1 {
intStr = str
} else {
intStr = str[:p]
fracStr = str[p+1:]
}
intStr = strings.TrimLeft(intStr, "0")
if intStr == "" {
intStr = "0"
}
if sc.ShouldClipToZero() && intStr[0] == '-' {
return 0, overflow(str, tp)
}
var round uint64
if fracStr != "" && fracStr[0] >= '5' {
round++
}
upperBound -= round
upperStr := strconv.FormatUint(upperBound, 10)
if len(intStr) > len(upperStr) ||
(len(intStr) == len(upperStr) && intStr > upperStr) {
return upperBound, overflow(str, tp)
}
val, err := strconv.ParseUint(intStr, 10, 64)
if err != nil {
return val, err
}
return val + round, nil
}
// ConvertDecimalToUint converts a decimal to a uint by converting it to a string first to avoid float overflow (#10181).
func ConvertDecimalToUint(sc *stmtctx.StatementContext, d *MyDecimal, upperBound uint64, tp byte) (uint64, error) {
return convertDecimalStrToUint(sc, string(d.ToString()), upperBound, tp)
}
// StrToInt converts a string to an integer at the best-effort.
func StrToInt(sc *stmtctx.StatementContext, str string) (int64, error) {
str = strings.TrimSpace(str)
......
......@@ -911,11 +911,7 @@ func (d *Datum) convertToUint(sc *stmtctx.StatementContext, target *FieldType) (
val, err = ConvertIntToUint(sc, ival, upperBound, tp)
}
case KindMysqlDecimal:
fval, err1 := d.GetMysqlDecimal().ToFloat64()
val, err = ConvertFloatToUint(sc, fval, upperBound, tp)
if err == nil {
err = err1
}
val, err = ConvertDecimalToUint(sc, d.GetMysqlDecimal(), upperBound, tp)
case KindMysqlEnum:
val, err = ConvertFloatToUint(sc, d.GetMysqlEnum().ToNumber(), upperBound, tp)
case KindMysqlSet:
......@@ -1835,14 +1831,14 @@ func DatumsToStrNoErr(datums []Datum) string {
return str
}
// CopyDatum returns a new copy of the datum.
// CloneDatum returns a new copy of the datum.
// TODO: Abandon this function.
func CopyDatum(datum Datum) Datum {
func CloneDatum(datum Datum) Datum {
return *datum.Copy()
}
// CopyRow deep copies a Datum slice.
func CopyRow(dr []Datum) []Datum {
// CloneRow deep copies a Datum slice.
func CloneRow(dr []Datum) []Datum {
c := make([]Datum, len(dr))
for i, d := range dr {
c[i] = *d.Copy()
......
......@@ -14,6 +14,7 @@
package types
import (
"github.com/pingcap/errors"
"github.com/pingcap/parser/mysql"
"github.com/pingcap/parser/terror"
parser_types "github.com/pingcap/parser/types"
......@@ -59,28 +60,43 @@ var (
ErrWarnDataOutOfRange = terror.ClassTypes.New(codeDataOutOfRange, mysql.MySQLErrName[mysql.ErrWarnDataOutOfRange])
// ErrDuplicatedValueInType is returned when enum column has duplicated value.
ErrDuplicatedValueInType = terror.ClassTypes.New(codeDuplicatedValueInType, mysql.MySQLErrName[mysql.ErrDuplicatedValueInType])
// ErrDatetimeFunctionOverflow is returned when the calculation in datetime function cause overflow.
ErrDatetimeFunctionOverflow = terror.ClassTypes.New(codeDatetimeFunctionOverflow, mysql.MySQLErrName[mysql.ErrDatetimeFunctionOverflow])
// ErrInvalidTimeFormat is returned when the time format is not correct.
ErrInvalidTimeFormat = terror.ClassTypes.New(mysql.ErrTruncatedWrongValue, "invalid time format: '%v'")
// ErrInvalidWeekModeFormat is returned when the week mode is wrong.
ErrInvalidWeekModeFormat = terror.ClassTypes.New(mysql.ErrTruncatedWrongValue, "invalid week mode format: '%v'")
// ErrInvalidYearFormat is returned when the input is not a valid year format.
ErrInvalidYearFormat = errors.New("invalid year format")
// ErrInvalidYear is returned when the input value is not a valid year.
ErrInvalidYear = errors.New("invalid year")
// ErrIncorrectDatetimeValue is returned when the input is not valid date time value.
ErrIncorrectDatetimeValue = terror.ClassTypes.New(mysql.ErrTruncatedWrongValue, "Incorrect datetime value: '%s'")
// ErrTruncatedWrongValue is returned then
ErrTruncatedWrongValue = terror.ClassTypes.New(mysql.ErrTruncatedWrongValue, mysql.MySQLErrName[mysql.ErrTruncatedWrongValue])
)
const (
codeBadNumber terror.ErrCode = 1
codeDataTooLong = terror.ErrCode(mysql.ErrDataTooLong)
codeIllegalValueForType = terror.ErrCode(mysql.ErrIllegalValueForType)
codeTruncated = terror.ErrCode(mysql.WarnDataTruncated)
codeOverflow = terror.ErrCode(mysql.ErrDataOutOfRange)
codeDivByZero = terror.ErrCode(mysql.ErrDivisionByZero)
codeTooBigDisplayWidth = terror.ErrCode(mysql.ErrTooBigDisplaywidth)
codeTooBigFieldLength = terror.ErrCode(mysql.ErrTooBigFieldlength)
codeTooBigSet = terror.ErrCode(mysql.ErrTooBigSet)
codeTooBigScale = terror.ErrCode(mysql.ErrTooBigScale)
codeTooBigPrecision = terror.ErrCode(mysql.ErrTooBigPrecision)
codeWrongFieldSpec = terror.ErrCode(mysql.ErrWrongFieldSpec)
codeTruncatedWrongValue = terror.ErrCode(mysql.ErrTruncatedWrongValue)
codeUnknown = terror.ErrCode(mysql.ErrUnknown)
codeInvalidDefault = terror.ErrCode(mysql.ErrInvalidDefault)
codeMBiggerThanD = terror.ErrCode(mysql.ErrMBiggerThanD)
codeDataOutOfRange = terror.ErrCode(mysql.ErrWarnDataOutOfRange)
codeDuplicatedValueInType = terror.ErrCode(mysql.ErrDuplicatedValueInType)
codeDataTooLong = terror.ErrCode(mysql.ErrDataTooLong)
codeIllegalValueForType = terror.ErrCode(mysql.ErrIllegalValueForType)
codeTruncated = terror.ErrCode(mysql.WarnDataTruncated)
codeOverflow = terror.ErrCode(mysql.ErrDataOutOfRange)
codeDivByZero = terror.ErrCode(mysql.ErrDivisionByZero)
codeTooBigDisplayWidth = terror.ErrCode(mysql.ErrTooBigDisplaywidth)
codeTooBigFieldLength = terror.ErrCode(mysql.ErrTooBigFieldlength)
codeTooBigSet = terror.ErrCode(mysql.ErrTooBigSet)
codeTooBigScale = terror.ErrCode(mysql.ErrTooBigScale)
codeTooBigPrecision = terror.ErrCode(mysql.ErrTooBigPrecision)
codeWrongFieldSpec = terror.ErrCode(mysql.ErrWrongFieldSpec)
codeTruncatedWrongValue = terror.ErrCode(mysql.ErrTruncatedWrongValue)
codeUnknown = terror.ErrCode(mysql.ErrUnknown)
codeInvalidDefault = terror.ErrCode(mysql.ErrInvalidDefault)
codeMBiggerThanD = terror.ErrCode(mysql.ErrMBiggerThanD)
codeDataOutOfRange = terror.ErrCode(mysql.ErrWarnDataOutOfRange)
codeDuplicatedValueInType = terror.ErrCode(mysql.ErrDuplicatedValueInType)
codeDatetimeFunctionOverflow = terror.ErrCode(mysql.ErrDatetimeFunctionOverflow)
)
var (
......@@ -92,23 +108,24 @@ var (
func init() {
typesMySQLErrCodes := map[terror.ErrCode]uint16{
codeDataTooLong: mysql.ErrDataTooLong,
codeIllegalValueForType: mysql.ErrIllegalValueForType,
codeTruncated: mysql.WarnDataTruncated,
codeOverflow: mysql.ErrDataOutOfRange,
codeDivByZero: mysql.ErrDivisionByZero,
codeTooBigDisplayWidth: mysql.ErrTooBigDisplaywidth,
codeTooBigFieldLength: mysql.ErrTooBigFieldlength,
codeTooBigSet: mysql.ErrTooBigSet,
codeTooBigScale: mysql.ErrTooBigScale,
codeTooBigPrecision: mysql.ErrTooBigPrecision,
codeWrongFieldSpec: mysql.ErrWrongFieldSpec,
codeTruncatedWrongValue: mysql.ErrTruncatedWrongValue,
codeUnknown: mysql.ErrUnknown,
codeInvalidDefault: mysql.ErrInvalidDefault,
codeMBiggerThanD: mysql.ErrMBiggerThanD,
codeDataOutOfRange: mysql.ErrWarnDataOutOfRange,
codeDuplicatedValueInType: mysql.ErrDuplicatedValueInType,
codeDataTooLong: mysql.ErrDataTooLong,
codeIllegalValueForType: mysql.ErrIllegalValueForType,
codeTruncated: mysql.WarnDataTruncated,
codeOverflow: mysql.ErrDataOutOfRange,
codeDivByZero: mysql.ErrDivisionByZero,
codeTooBigDisplayWidth: mysql.ErrTooBigDisplaywidth,
codeTooBigFieldLength: mysql.ErrTooBigFieldlength,
codeTooBigSet: mysql.ErrTooBigSet,
codeTooBigScale: mysql.ErrTooBigScale,
codeTooBigPrecision: mysql.ErrTooBigPrecision,
codeWrongFieldSpec: mysql.ErrWrongFieldSpec,
codeTruncatedWrongValue: mysql.ErrTruncatedWrongValue,
codeUnknown: mysql.ErrUnknown,
codeInvalidDefault: mysql.ErrInvalidDefault,
codeMBiggerThanD: mysql.ErrMBiggerThanD,
codeDataOutOfRange: mysql.ErrWarnDataOutOfRange,
codeDuplicatedValueInType: mysql.ErrDuplicatedValueInType,
codeDatetimeFunctionOverflow: mysql.ErrDatetimeFunctionOverflow,
}
terror.ErrClassToMySQLCodes[terror.ClassTypes] = typesMySQLErrCodes
}
......@@ -149,6 +149,67 @@ func decodeEscapedUnicode(s []byte) (char [4]byte, size int, err error) {
return
}
// quoteString escapes interior quote and other characters for JSON_QUOTE
// https://dev.mysql.com/doc/refman/5.7/en/json-creation-functions.html#function_json-quote
// TODO: add JSON_QUOTE builtin
func quoteString(s string) string {
var escapeByteMap = map[byte]string{
'\\': "\\\\",
'"': "\\\"",
'\b': "\\b",
'\f': "\\f",
'\n': "\\n",
'\r': "\\r",
'\t': "\\t",
}
ret := new(bytes.Buffer)
ret.WriteByte('"')
start := 0
hasEscaped := false
for i := 0; i < len(s); {
if b := s[i]; b < utf8.RuneSelf {
escaped, ok := escapeByteMap[b]
if ok {
if start < i {
ret.WriteString(s[start:i])
}
hasEscaped = true
ret.WriteString(escaped)
i++
start = i
} else {
i++
}
} else {
c, size := utf8.DecodeRune([]byte(s[i:]))
if c == utf8.RuneError && size == 1 { // refer to codes of `binary.marshalStringTo`
if start < i {
ret.WriteString(s[start:i])
}
hasEscaped = true
ret.WriteString(`\ufffd`)
i += size
start = i
continue
}
i += size
}
}
if start < len(s) {
ret.WriteString(s[start:])
}
if hasEscaped {
ret.WriteByte('"')
return ret.String()
}
return ret.String()[1:]
}
// Extract receives several path expressions as arguments, matches them in bj, and returns:
// ret: target JSON matched any path expressions. maybe autowrapped as an array.
// found: true if any path expressions matched.
......@@ -778,3 +839,148 @@ func (bj BinaryJSON) GetElemDepth() int {
return 1
}
}
// extractCallbackFn: the type of CALLBACK function for extractToCallback
type extractCallbackFn func(fullpath PathExpression, bj BinaryJSON) (stop bool, err error)
// extractToCallback: callback alternative of extractTo
// would be more effective when walk through the whole JSON is unnecessary
// NOTICE: path [0] & [*] for JSON object other than array is INVALID, which is different from extractTo.
func (bj BinaryJSON) extractToCallback(pathExpr PathExpression, callbackFn extractCallbackFn, fullpath PathExpression) (stop bool, err error) {
if len(pathExpr.legs) == 0 {
return callbackFn(fullpath, bj)
}
currentLeg, subPathExpr := pathExpr.popOneLeg()
if currentLeg.typ == pathLegIndex && bj.TypeCode == TypeCodeArray {
elemCount := bj.GetElemCount()
if currentLeg.arrayIndex == arrayIndexAsterisk {
for i := 0; i < elemCount; i++ {
//buf = bj.arrayGetElem(i).extractTo(buf, subPathExpr)
path := fullpath.pushBackOneIndexLeg(i)
stop, err = bj.arrayGetElem(i).extractToCallback(subPathExpr, callbackFn, path)
if stop || err != nil {
return
}
}
} else if currentLeg.arrayIndex < elemCount {
//buf = bj.arrayGetElem(currentLeg.arrayIndex).extractTo(buf, subPathExpr)
path := fullpath.pushBackOneIndexLeg(currentLeg.arrayIndex)
stop, err = bj.arrayGetElem(currentLeg.arrayIndex).extractToCallback(subPathExpr, callbackFn, path)
if stop || err != nil {
return
}
}
} else if currentLeg.typ == pathLegKey && bj.TypeCode == TypeCodeObject {
elemCount := bj.GetElemCount()
if currentLeg.dotKey == "*" {
for i := 0; i < elemCount; i++ {
//buf = bj.objectGetVal(i).extractTo(buf, subPathExpr)
path := fullpath.pushBackOneKeyLeg(string(bj.objectGetKey(i)))
stop, err = bj.objectGetVal(i).extractToCallback(subPathExpr, callbackFn, path)
if stop || err != nil {
return
}
}
} else {
child, ok := bj.objectSearchKey(hack.Slice(currentLeg.dotKey))
if ok {
//buf = child.extractTo(buf, subPathExpr)
path := fullpath.pushBackOneKeyLeg(currentLeg.dotKey)
stop, err = child.extractToCallback(subPathExpr, callbackFn, path)
if stop || err != nil {
return
}
}
}
} else if currentLeg.typ == pathLegDoubleAsterisk {
//buf = bj.extractTo(buf, subPathExpr)
stop, err = bj.extractToCallback(subPathExpr, callbackFn, fullpath)
if stop || err != nil {
return
}
if bj.TypeCode == TypeCodeArray {
elemCount := bj.GetElemCount()
for i := 0; i < elemCount; i++ {
//buf = bj.arrayGetElem(i).extractTo(buf, pathExpr)
path := fullpath.pushBackOneIndexLeg(i)
stop, err = bj.arrayGetElem(i).extractToCallback(pathExpr, callbackFn, path)
if stop || err != nil {
return
}
}
} else if bj.TypeCode == TypeCodeObject {
elemCount := bj.GetElemCount()
for i := 0; i < elemCount; i++ {
//buf = bj.objectGetVal(i).extractTo(buf, pathExpr)
path := fullpath.pushBackOneKeyLeg(string(bj.objectGetKey(i)))
stop, err = bj.objectGetVal(i).extractToCallback(pathExpr, callbackFn, path)
if stop || err != nil {
return
}
}
}
}
return false, nil
}
// BinaryJSONWalkFunc is used as callback function for BinaryJSON.Walk
type BinaryJSONWalkFunc func(fullpath PathExpression, bj BinaryJSON) (stop bool, err error)
// Walk traverse BinaryJSON objects
func (bj BinaryJSON) Walk(walkFn BinaryJSONWalkFunc, pathExprList ...PathExpression) (err error) {
pathSet := make(map[string]bool)
var doWalk extractCallbackFn
doWalk = func(fullpath PathExpression, bj BinaryJSON) (stop bool, err error) {
pathStr := fullpath.String()
if _, ok := pathSet[pathStr]; ok {
return false, nil
}
stop, err = walkFn(fullpath, bj)
pathSet[pathStr] = true
if stop || err != nil {
return
}
if bj.TypeCode == TypeCodeArray {
elemCount := bj.GetElemCount()
for i := 0; i < elemCount; i++ {
path := fullpath.pushBackOneIndexLeg(i)
stop, err = doWalk(path, bj.arrayGetElem(i))
if stop || err != nil {
return
}
}
} else if bj.TypeCode == TypeCodeObject {
elemCount := bj.GetElemCount()
for i := 0; i < elemCount; i++ {
path := fullpath.pushBackOneKeyLeg(string(bj.objectGetKey(i)))
stop, err = doWalk(path, bj.objectGetVal(i))
if stop || err != nil {
return
}
}
}
return false, nil
}
fullpath := PathExpression{legs: make([]pathLeg, 0, 32), flags: pathExpressionFlag(0)}
if len(pathExprList) > 0 {
for _, pathExpr := range pathExprList {
var stop bool
stop, err = bj.extractToCallback(pathExpr, doWalk, fullpath)
if stop || err != nil {
return err
}
}
} else {
_, err = doWalk(fullpath, bj)
if err != nil {
return
}
}
return nil
}
......@@ -117,6 +117,30 @@ func (pe PathExpression) popOneLastLeg() (PathExpression, pathLeg) {
return PathExpression{legs: pe.legs[:lastLegIdx]}, lastLeg
}
// pushBackOneIndexLeg pushback one leg of INDEX type
func (pe PathExpression) pushBackOneIndexLeg(index int) PathExpression {
newPe := PathExpression{
legs: append(pe.legs, pathLeg{typ: pathLegIndex, arrayIndex: index}),
flags: pe.flags,
}
if index == -1 {
newPe.flags |= pathExpressionContainsAsterisk
}
return newPe
}
// pushBackOneKeyLeg pushback one leg of KEY type
func (pe PathExpression) pushBackOneKeyLeg(key string) PathExpression {
newPe := PathExpression{
legs: append(pe.legs, pathLeg{typ: pathLegKey, dotKey: key}),
flags: pe.flags,
}
if key == "*" {
newPe.flags |= pathExpressionContainsAsterisk
}
return newPe
}
// ContainsAnyAsterisk returns true if pe contains any asterisk.
func (pe PathExpression) ContainsAnyAsterisk() bool {
return pe.flags.containsAnyAsterisk()
......@@ -212,3 +236,27 @@ func isBlank(c rune) bool {
}
return false
}
func (pe PathExpression) String() string {
var s strings.Builder
s.WriteString("$")
for _, leg := range pe.legs {
switch leg.typ {
case pathLegIndex:
if leg.arrayIndex == -1 {
s.WriteString("[*]")
} else {
s.WriteString("[")
s.WriteString(strconv.Itoa(leg.arrayIndex))
s.WriteString("]")
}
case pathLegKey:
s.WriteString(".")
s.WriteString(quoteString(leg.dotKey))
case pathLegDoubleAsterisk:
s.WriteString("**")
}
}
return s.String()
}
......@@ -29,18 +29,7 @@ import (
"github.com/pingcap/parser/terror"
"github.com/pingcap/tidb/sessionctx/stmtctx"
"github.com/pingcap/tidb/util/logutil"
)
// Portable analogs of some common call errors.
var (
ErrInvalidTimeFormat = terror.ClassTypes.New(mysql.ErrTruncatedWrongValue, "invalid time format: '%v'")
ErrInvalidWeekModeFormat = terror.ClassTypes.New(mysql.ErrTruncatedWrongValue, "invalid week mode format: '%v'")
ErrInvalidYearFormat = errors.New("invalid year format")
ErrInvalidYear = errors.New("invalid year")
ErrZeroDate = errors.New("datetime zero in date")
ErrIncorrectDatetimeValue = terror.ClassTypes.New(mysql.ErrTruncatedWrongValue, "Incorrect datetime value: '%s'")
ErrDatetimeFunctionOverflow = terror.ClassTypes.New(mysql.ErrDatetimeFunctionOverflow, mysql.MySQLErrName[mysql.ErrDatetimeFunctionOverflow])
ErrTruncatedWrongValue = terror.ClassTypes.New(mysql.ErrTruncatedWrongValue, mysql.MySQLErrName[mysql.ErrTruncatedWrongValue])
tidbMath "github.com/pingcap/tidb/util/math"
)
// Time format without fractional seconds precision.
......@@ -196,6 +185,13 @@ var (
}
)
const (
// GoDurationDay is the gotime.Duration which equals to a Day.
GoDurationDay = gotime.Hour * 24
// GoDurationWeek is the gotime.Duration which equals to a Week.
GoDurationWeek = GoDurationDay * 7
)
// FromGoTime translates time.Time to mysql time internal representation.
func FromGoTime(t gotime.Time) MysqlTime {
year, month, day := t.Date()
......@@ -1198,9 +1194,9 @@ func ParseDuration(sc *stmtctx.StatementContext, str string, fsp int) (Duration,
// TruncateOverflowMySQLTime truncates d when it overflows, and return ErrTruncatedWrongVal.
func TruncateOverflowMySQLTime(d gotime.Duration) (gotime.Duration, error) {
if d > MaxTime {
return MaxTime, ErrTruncatedWrongVal.GenWithStackByArgs("time", d.String())
return MaxTime, ErrTruncatedWrongVal.GenWithStackByArgs("time", d)
} else if d < MinTime {
return MinTime, ErrTruncatedWrongVal.GenWithStackByArgs("time", d.String())
return MinTime, ErrTruncatedWrongVal.GenWithStackByArgs("time", d)
}
return d, nil
......@@ -1474,7 +1470,7 @@ func checkDateRange(t MysqlTime) error {
func checkMonthDay(year, month, day int, allowInvalidDate bool) error {
if month < 0 || month > 12 {
return errors.Trace(ErrInvalidTimeFormat.GenWithStackByArgs(month))
return errors.Trace(ErrIncorrectDatetimeValue.GenWithStackByArgs(month))
}
maxDay := 31
......@@ -1482,13 +1478,13 @@ func checkMonthDay(year, month, day int, allowInvalidDate bool) error {
if month > 0 {
maxDay = maxDaysInMonth[month-1]
}
if month == 2 && year%4 != 0 {
if month == 2 && !isLeapYear(uint16(year)) {
maxDay = 28
}
}
if day < 0 || day > maxDay {
return errors.Trace(ErrInvalidTimeFormat.GenWithStackByArgs(day))
return errors.Trace(ErrIncorrectDatetimeValue.GenWithStackByArgs(day))
}
return nil
}
......@@ -1545,6 +1541,7 @@ func checkDatetimeType(t MysqlTime, allowZeroInDate, allowInvalidDate bool) erro
// ExtractDatetimeNum extracts time value number from datetime unit and format.
func ExtractDatetimeNum(t *Time, unit string) (int64, error) {
// TODO: Consider time_zone variable.
switch strings.ToUpper(unit) {
case "DAY":
return int64(t.Time.Day()), nil
......@@ -1552,12 +1549,7 @@ func ExtractDatetimeNum(t *Time, unit string) (int64, error) {
week := t.Time.Week(0)
return int64(week), nil
case "MONTH":
// TODO: Consider time_zone variable.
t1, err := t.Time.GoTime(gotime.Local)
if err != nil {
return 0, errors.Trace(err)
}
return int64(t1.Month()), nil
return int64(t.Time.Month()), nil
case "QUARTER":
m := int64(t.Time.Month())
// 1 - 3 -> 1
......@@ -1619,41 +1611,110 @@ func ExtractDurationNum(d *Duration, unit string) (int64, error) {
}
}
func extractSingleTimeValue(unit string, format string) (int64, int64, int64, float64, error) {
fv, err := strconv.ParseFloat(format, 64)
// parseSingleTimeValue parse the format according the given unit. If we set strictCheck true, we'll check whether
// the converted value not exceed the range of MySQL's TIME type.
// The first four returned values are year, month, day and nanosecond.
func parseSingleTimeValue(unit string, format string, strictCheck bool) (int64, int64, int64, int64, error) {
// Format is a preformatted number, it format should be A[.[B]].
decimalPointPos := strings.IndexRune(format, '.')
if decimalPointPos == -1 {
decimalPointPos = len(format)
}
sign := int64(1)
if len(format) > 0 && format[0] == '-' {
sign = int64(-1)
}
iv, err := strconv.ParseInt(format[0:decimalPointPos], 10, 64)
if err != nil {
return 0, 0, 0, 0, ErrIncorrectDatetimeValue.GenWithStackByArgs(format)
}
iv := int64(math.Round(fv))
riv := iv // Rounded integer value
dv := int64(0)
lf := len(format) - 1
// Has fraction part
if decimalPointPos < lf {
if lf-decimalPointPos >= 6 {
// MySQL rounds down to 1e-6.
if dv, err = strconv.ParseInt(format[decimalPointPos+1:decimalPointPos+7], 10, 64); err != nil {
return 0, 0, 0, 0, ErrIncorrectDatetimeValue.GenWithStackByArgs(format)
}
} else {
if dv, err = strconv.ParseInt(format[decimalPointPos+1:]+"000000"[:6-(lf-decimalPointPos)], 10, 64); err != nil {
return 0, 0, 0, 0, ErrIncorrectDatetimeValue.GenWithStackByArgs(format)
}
}
if dv >= 500000 { // Round up, and we should keep 6 digits for microsecond, so dv should in [000000, 999999].
riv += sign
}
if unit != "SECOND" {
err = ErrTruncatedWrongValue.GenWithStackByArgs(format)
}
}
switch strings.ToUpper(unit) {
case "MICROSECOND":
return 0, 0, 0, fv * float64(gotime.Microsecond), nil
if strictCheck && tidbMath.Abs(riv) > TimeMaxValueSeconds*1000 {
return 0, 0, 0, 0, ErrDatetimeFunctionOverflow.GenWithStackByArgs("time")
}
dayCount := riv / int64(GoDurationDay/gotime.Microsecond)
riv %= int64(GoDurationDay / gotime.Microsecond)
return 0, 0, dayCount, riv * int64(gotime.Microsecond), err
case "SECOND":
return 0, 0, 0, fv * float64(gotime.Second), nil
if strictCheck && tidbMath.Abs(iv) > TimeMaxValueSeconds {
return 0, 0, 0, 0, ErrDatetimeFunctionOverflow.GenWithStackByArgs("time")
}
dayCount := iv / int64(GoDurationDay/gotime.Second)
iv %= int64(GoDurationDay / gotime.Second)
return 0, 0, dayCount, iv*int64(gotime.Second) + dv*int64(gotime.Microsecond), err
case "MINUTE":
return 0, 0, 0, float64(iv * int64(gotime.Minute)), nil
if strictCheck && tidbMath.Abs(riv) > TimeMaxHour*60+TimeMaxMinute {
return 0, 0, 0, 0, ErrDatetimeFunctionOverflow.GenWithStackByArgs("time")
}
dayCount := riv / int64(GoDurationDay/gotime.Minute)
riv %= int64(GoDurationDay / gotime.Minute)
return 0, 0, dayCount, riv * int64(gotime.Minute), err
case "HOUR":
return 0, 0, 0, float64(iv * int64(gotime.Hour)), nil
if strictCheck && tidbMath.Abs(riv) > TimeMaxHour {
return 0, 0, 0, 0, ErrDatetimeFunctionOverflow.GenWithStackByArgs("time")
}
dayCount := riv / 24
riv %= 24
return 0, 0, dayCount, riv * int64(gotime.Hour), err
case "DAY":
return 0, 0, iv, 0, nil
if strictCheck && tidbMath.Abs(riv) > TimeMaxHour/24 {
return 0, 0, 0, 0, ErrDatetimeFunctionOverflow.GenWithStackByArgs("time")
}
return 0, 0, riv, 0, err
case "WEEK":
return 0, 0, 7 * iv, 0, nil
if strictCheck && 7*tidbMath.Abs(riv) > TimeMaxHour/24 {
return 0, 0, 0, 0, ErrDatetimeFunctionOverflow.GenWithStackByArgs("time")
}
return 0, 0, 7 * riv, 0, err
case "MONTH":
return 0, iv, 0, 0, nil
if strictCheck && tidbMath.Abs(riv) > 1 {
return 0, 0, 0, 0, ErrDatetimeFunctionOverflow.GenWithStackByArgs("time")
}
return 0, riv, 0, 0, err
case "QUARTER":
return 0, 3 * iv, 0, 0, nil
if strictCheck {
return 0, 0, 0, 0, ErrDatetimeFunctionOverflow.GenWithStackByArgs("time")
}
return 0, 3 * riv, 0, 0, err
case "YEAR":
return iv, 0, 0, 0, nil
if strictCheck {
return 0, 0, 0, 0, ErrDatetimeFunctionOverflow.GenWithStackByArgs("time")
}
return riv, 0, 0, 0, err
}
return 0, 0, 0, 0, errors.Errorf("invalid singel timeunit - %s", unit)
}
// extractTimeValue extracts years, months, days, microseconds from a string
// parseTimeValue gets years, months, days, nanoseconds from a string
// nanosecond will not exceed length of single day
// MySQL permits any punctuation delimiter in the expr format.
// See https://dev.mysql.com/doc/refman/8.0/en/expressions.html#temporal-intervals
func extractTimeValue(format string, index, cnt int) (int64, int64, int64, float64, error) {
func parseTimeValue(format string, index, cnt int) (int64, int64, int64, int64, error) {
neg := false
originalFmt := format
format = strings.TrimSpace(format)
......@@ -1691,57 +1752,160 @@ func extractTimeValue(format string, index, cnt int) (int64, int64, int64, float
return 0, 0, 0, 0, ErrIncorrectDatetimeValue.GenWithStackByArgs(originalFmt)
}
hours, err := strconv.ParseFloat(fields[HourIndex], 64)
hours, err := strconv.ParseInt(fields[HourIndex], 10, 64)
if err != nil {
return 0, 0, 0, 0, ErrIncorrectDatetimeValue.GenWithStackByArgs(originalFmt)
}
minutes, err := strconv.ParseFloat(fields[MinuteIndex], 64)
minutes, err := strconv.ParseInt(fields[MinuteIndex], 10, 64)
if err != nil {
return 0, 0, 0, 0, ErrIncorrectDatetimeValue.GenWithStackByArgs(originalFmt)
}
seconds, err := strconv.ParseFloat(fields[SecondIndex], 64)
seconds, err := strconv.ParseInt(fields[SecondIndex], 10, 64)
if err != nil {
return 0, 0, 0, 0, ErrIncorrectDatetimeValue.GenWithStackByArgs(originalFmt)
}
microseconds, err := strconv.ParseFloat(alignFrac(fields[MicrosecondIndex], MaxFsp), 64)
microseconds, err := strconv.ParseInt(alignFrac(fields[MicrosecondIndex], MaxFsp), 10, 64)
if err != nil {
return 0, 0, 0, 0, ErrIncorrectDatetimeValue.GenWithStackByArgs(originalFmt)
}
durations := hours*float64(gotime.Hour) + minutes*float64(gotime.Minute) +
seconds*float64(gotime.Second) + microseconds*float64(gotime.Microsecond)
seconds = hours*3600 + minutes*60 + seconds
days += seconds / (3600 * 24)
seconds %= 3600 * 24
return years, months, days, seconds*int64(gotime.Second) + microseconds*int64(gotime.Microsecond), nil
}
return years, months, days, durations, nil
func parseAndValidateDurationValue(format string, index, cnt int) (int64, error) {
year, month, day, nano, err := parseTimeValue(format, index, cnt)
if err != nil {
return 0, err
}
if year != 0 || month != 0 || tidbMath.Abs(day) > TimeMaxHour/24 {
return 0, ErrDatetimeFunctionOverflow.GenWithStackByArgs("time")
}
dur := day*int64(GoDurationDay) + nano
if tidbMath.Abs(dur) > int64(MaxTime) {
return 0, ErrDatetimeFunctionOverflow.GenWithStackByArgs("time")
}
return dur, nil
}
// ExtractTimeValue extracts time value from time unit and format.
func ExtractTimeValue(unit string, format string) (int64, int64, int64, float64, error) {
// ParseDurationValue parses time value from time unit and format.
// Returns y years m months d days + n nanoseconds
// Nanoseconds will no longer than one day.
func ParseDurationValue(unit string, format string) (y int64, m int64, d int64, n int64, _ error) {
switch strings.ToUpper(unit) {
case "MICROSECOND", "SECOND", "MINUTE", "HOUR", "DAY", "WEEK", "MONTH", "QUARTER", "YEAR":
return extractSingleTimeValue(unit, format)
return parseSingleTimeValue(unit, format, false)
case "SECOND_MICROSECOND":
return parseTimeValue(format, MicrosecondIndex, SecondMicrosecondMaxCnt)
case "MINUTE_MICROSECOND":
return parseTimeValue(format, MicrosecondIndex, MinuteMicrosecondMaxCnt)
case "MINUTE_SECOND":
return parseTimeValue(format, SecondIndex, MinuteSecondMaxCnt)
case "HOUR_MICROSECOND":
return parseTimeValue(format, MicrosecondIndex, HourMicrosecondMaxCnt)
case "HOUR_SECOND":
return parseTimeValue(format, SecondIndex, HourSecondMaxCnt)
case "HOUR_MINUTE":
return parseTimeValue(format, MinuteIndex, HourMinuteMaxCnt)
case "DAY_MICROSECOND":
return parseTimeValue(format, MicrosecondIndex, DayMicrosecondMaxCnt)
case "DAY_SECOND":
return parseTimeValue(format, SecondIndex, DaySecondMaxCnt)
case "DAY_MINUTE":
return parseTimeValue(format, MinuteIndex, DayMinuteMaxCnt)
case "DAY_HOUR":
return parseTimeValue(format, HourIndex, DayHourMaxCnt)
case "YEAR_MONTH":
return parseTimeValue(format, MonthIndex, YearMonthMaxCnt)
default:
return 0, 0, 0, 0, errors.Errorf("invalid single timeunit - %s", unit)
}
}
// ExtractDurationValue extract the value from format to Duration.
func ExtractDurationValue(unit string, format string) (Duration, error) {
unit = strings.ToUpper(unit)
switch unit {
case "MICROSECOND", "SECOND", "MINUTE", "HOUR", "DAY", "WEEK", "MONTH", "QUARTER", "YEAR":
_, month, day, nano, err := parseSingleTimeValue(unit, format, true)
if err != nil {
return ZeroDuration, err
}
dur := Duration{Duration: gotime.Duration((month*30+day)*int64(GoDurationDay) + nano)}
if unit == "MICROSECOND" {
dur.Fsp = MaxFsp
}
return dur, err
case "SECOND_MICROSECOND":
return extractTimeValue(format, MicrosecondIndex, SecondMicrosecondMaxCnt)
d, err := parseAndValidateDurationValue(format, MicrosecondIndex, SecondMicrosecondMaxCnt)
if err != nil {
return ZeroDuration, err
}
return Duration{Duration: gotime.Duration(d), Fsp: MaxFsp}, nil
case "MINUTE_MICROSECOND":
return extractTimeValue(format, MicrosecondIndex, MinuteMicrosecondMaxCnt)
d, err := parseAndValidateDurationValue(format, MicrosecondIndex, MinuteMicrosecondMaxCnt)
if err != nil {
return ZeroDuration, err
}
return Duration{Duration: gotime.Duration(d), Fsp: MaxFsp}, nil
case "MINUTE_SECOND":
return extractTimeValue(format, SecondIndex, MinuteSecondMaxCnt)
d, err := parseAndValidateDurationValue(format, SecondIndex, MinuteSecondMaxCnt)
if err != nil {
return ZeroDuration, err
}
return Duration{Duration: gotime.Duration(d), Fsp: MaxFsp}, nil
case "HOUR_MICROSECOND":
return extractTimeValue(format, MicrosecondIndex, HourMicrosecondMaxCnt)
d, err := parseAndValidateDurationValue(format, MicrosecondIndex, HourMicrosecondMaxCnt)
if err != nil {
return ZeroDuration, err
}
return Duration{Duration: gotime.Duration(d), Fsp: MaxFsp}, nil
case "HOUR_SECOND":
return extractTimeValue(format, SecondIndex, HourSecondMaxCnt)
d, err := parseAndValidateDurationValue(format, SecondIndex, HourSecondMaxCnt)
if err != nil {
return ZeroDuration, err
}
return Duration{Duration: gotime.Duration(d), Fsp: MaxFsp}, nil
case "HOUR_MINUTE":
return extractTimeValue(format, MinuteIndex, HourMinuteMaxCnt)
d, err := parseAndValidateDurationValue(format, MinuteIndex, HourMinuteMaxCnt)
if err != nil {
return ZeroDuration, err
}
return Duration{Duration: gotime.Duration(d), Fsp: 0}, nil
case "DAY_MICROSECOND":
return extractTimeValue(format, MicrosecondIndex, DayMicrosecondMaxCnt)
d, err := parseAndValidateDurationValue(format, MicrosecondIndex, DayMicrosecondMaxCnt)
if err != nil {
return ZeroDuration, err
}
return Duration{Duration: gotime.Duration(d), Fsp: MaxFsp}, nil
case "DAY_SECOND":
return extractTimeValue(format, SecondIndex, DaySecondMaxCnt)
d, err := parseAndValidateDurationValue(format, SecondIndex, DaySecondMaxCnt)
if err != nil {
return ZeroDuration, err
}
return Duration{Duration: gotime.Duration(d), Fsp: MaxFsp}, nil
case "DAY_MINUTE":
return extractTimeValue(format, MinuteIndex, DayMinuteMaxCnt)
d, err := parseAndValidateDurationValue(format, MinuteIndex, DayMinuteMaxCnt)
if err != nil {
return ZeroDuration, err
}
return Duration{Duration: gotime.Duration(d), Fsp: 0}, nil
case "DAY_HOUR":
return extractTimeValue(format, HourIndex, DayHourMaxCnt)
d, err := parseAndValidateDurationValue(format, HourIndex, DayHourMaxCnt)
if err != nil {
return ZeroDuration, err
}
return Duration{Duration: gotime.Duration(d), Fsp: 0}, nil
case "YEAR_MONTH":
return extractTimeValue(format, MonthIndex, YearMonthMaxCnt)
_, err := parseAndValidateDurationValue(format, MonthIndex, YearMonthMaxCnt)
if err != nil {
return ZeroDuration, err
}
// MONTH must exceed the limit of mysql's duration. So just return overflow error.
return ZeroDuration, ErrDatetimeFunctionOverflow.GenWithStackByArgs("time")
default:
return 0, 0, 0, 0, errors.Errorf("invalid singel timeunit - %s", unit)
return ZeroDuration, errors.Errorf("invalid single timeunit - %s", unit)
}
}
......
......@@ -22,6 +22,7 @@ import (
"runtime"
"sort"
"strings"
"time"
"github.com/pingcap/errors"
zaplog "github.com/pingcap/log"
......@@ -208,7 +209,9 @@ func (f *textFormatter) Format(entry *log.Entry) ([]byte, error) {
const (
// SlowLogTimeFormat is the time format for slow log.
SlowLogTimeFormat = "2006-01-02-15:04:05.999999999 -0700"
SlowLogTimeFormat = time.RFC3339Nano
// OldSlowLogTimeFormat is the first version of the the time format for slow log, This is use for compatibility.
OldSlowLogTimeFormat = "2006-01-02-15:04:05.999999999 -0700"
)
type slowLogFormatter struct{}
......
......@@ -15,8 +15,8 @@ package math
import "math"
// http://cavaliercoder.com/blog/optimized-abs-for-int64-in-go.html
func abs(n int64) int64 {
// Abs implement the abs function according to http://cavaliercoder.com/blog/optimized-abs-for-int64-in-go.html
func Abs(n int64) int64 {
y := n >> 63
return (n ^ y) - y
}
......@@ -46,5 +46,5 @@ func StrLenOfInt64Fast(x int64) int {
if x < 0 {
size = 1 // add "-" sign on the length count
}
return size + StrLenOfUint64Fast(uint64(abs(x)))
return size + StrLenOfUint64Fast(uint64(Abs(x)))
}
......@@ -43,9 +43,10 @@ type Tracker struct {
children []*Tracker // The children memory trackers
}
label string // Label of this "Tracker".
bytesConsumed int64 // Consumed bytes.
bytesLimit int64 // Negative value means no limit.
label fmt.Stringer // Label of this "Tracker".
bytesConsumed int64 // Consumed bytes.
bytesLimit int64 // Negative value means no limit.
maxConsumed int64 // max number of bytes consumed during execution.
actionOnExceed ActionOnExceed
parent *Tracker // The parent memory tracker.
}
......@@ -53,7 +54,7 @@ type Tracker struct {
// NewTracker creates a memory tracker.
// 1. "label" is the label used in the usage string.
// 2. "bytesLimit < 0" means no limit.
func NewTracker(label string, bytesLimit int64) *Tracker {
func NewTracker(label fmt.Stringer, bytesLimit int64) *Tracker {
return &Tracker{
label: label,
bytesLimit: bytesLimit,
......@@ -67,7 +68,7 @@ func (t *Tracker) SetActionOnExceed(a ActionOnExceed) {
}
// SetLabel sets the label of a Tracker.
func (t *Tracker) SetLabel(label string) {
func (t *Tracker) SetLabel(label fmt.Stringer) {
t.label = label
}
......@@ -142,6 +143,19 @@ func (t *Tracker) Consume(bytes int64) {
if atomic.AddInt64(&tracker.bytesConsumed, bytes) >= tracker.bytesLimit && tracker.bytesLimit > 0 {
rootExceed = tracker
}
if tracker.parent == nil {
// since we only need a total memory usage during execution,
// we only record max consumed bytes in root(statement-level) for performance.
for {
maxNow := atomic.LoadInt64(&tracker.maxConsumed)
consumed := atomic.LoadInt64(&tracker.bytesConsumed)
if consumed > maxNow && !atomic.CompareAndSwapInt64(&tracker.maxConsumed, maxNow, consumed) {
continue
}
break
}
}
}
if rootExceed != nil {
rootExceed.actionOnExceed.Action(rootExceed)
......@@ -153,6 +167,11 @@ func (t *Tracker) BytesConsumed() int64 {
return atomic.LoadInt64(&t.bytesConsumed)
}
// MaxConsumed returns max number of bytes consumed during execution.
func (t *Tracker) MaxConsumed() int64 {
return atomic.LoadInt64(&t.maxConsumed)
}
// String returns the string representation of this Tracker tree.
func (t *Tracker) String() string {
buffer := bytes.NewBufferString("\n")
......
......@@ -105,10 +105,10 @@
"revisionTime": "2018-09-19T09:01:24Z"
},
{
"checksumSHA1": "QPt6+cvPrmKkLeujdqEKgRH84Mw=",
"checksumSHA1": "wFLw18XvRl2NnXP3wReuyB4KXk4=",
"path": "github.com/pingcap/errors",
"revision": "1176802fff62540cc87d289bd40c52a2d6b2ea16",
"revisionTime": "2018-10-24T15:10:47Z"
"revision": "fc6e4ce558343e6eab2450e7653502fee61d9ad6",
"revisionTime": "2019-05-15T08:44:45Z"
},
{
"checksumSHA1": "eIqELR/hEESdiBCcpk5kmdu2e3U=",
......@@ -117,118 +117,118 @@
"revisionTime": "2019-03-07T07:54:52Z"
},
{
"checksumSHA1": "Spi5+PnYjhKAZ1u62Ym5OGzBkbo=",
"checksumSHA1": "IB9wW2GmSlnLVDRkaUXcF3CJ15g=",
"path": "github.com/pingcap/parser",
"revision": "cdceeb2c5476084c21987c42bc9405cdcbc290ef",
"revisionTime": "2019-04-08T06:41:40Z"
"revision": "89ae120307cc42a1cccc4daba2c589966db77055",
"revisionTime": "2019-05-23T11:32:41Z"
},
{
"checksumSHA1": "2E4g3rvXdR/N0IA7vTngW+I2dlI=",
"checksumSHA1": "qeft79GIpt7bP++Qlg1UNSdXL3E=",
"path": "github.com/pingcap/parser/ast",
"revision": "cdceeb2c5476084c21987c42bc9405cdcbc290ef",
"revisionTime": "2019-04-08T06:41:40Z"
"revision": "89ae120307cc42a1cccc4daba2c589966db77055",
"revisionTime": "2019-05-23T11:32:41Z"
},
{
"checksumSHA1": "xiv40YqnvHcbIhaEzJqjh5K7ehM=",
"path": "github.com/pingcap/parser/auth",
"revision": "cdceeb2c5476084c21987c42bc9405cdcbc290ef",
"revisionTime": "2019-04-08T06:41:40Z"
"revision": "89ae120307cc42a1cccc4daba2c589966db77055",
"revisionTime": "2019-05-23T11:32:41Z"
},
{
"checksumSHA1": "TNatzumortkzsN5ShBPORCLX0ww=",
"checksumSHA1": "EvDXpplklIXmKqLclzWzaN/uHKQ=",
"path": "github.com/pingcap/parser/charset",
"revision": "cdceeb2c5476084c21987c42bc9405cdcbc290ef",
"revisionTime": "2019-04-08T06:41:40Z"
"revision": "89ae120307cc42a1cccc4daba2c589966db77055",
"revisionTime": "2019-05-23T11:32:41Z"
},
{
"checksumSHA1": "ohLJW2u9NJEzYIJL/AjOqcuKfMY=",
"checksumSHA1": "Aao6Mul/qqogOwPwM2arBKZkYZs=",
"path": "github.com/pingcap/parser/format",
"revision": "cdceeb2c5476084c21987c42bc9405cdcbc290ef",
"revisionTime": "2019-04-08T06:41:40Z"
"revision": "89ae120307cc42a1cccc4daba2c589966db77055",
"revisionTime": "2019-05-23T11:32:41Z"
},
{
"checksumSHA1": "owbn76pdlOudJtIi4vPJ+3SlKuk=",
"checksumSHA1": "YN9BYMOMxEXjrUCPPYQREN90BC0=",
"path": "github.com/pingcap/parser/model",
"revision": "cdceeb2c5476084c21987c42bc9405cdcbc290ef",
"revisionTime": "2019-04-08T06:41:40Z"
"revision": "89ae120307cc42a1cccc4daba2c589966db77055",
"revisionTime": "2019-05-23T11:32:41Z"
},
{
"checksumSHA1": "10eiqFEB//6VqEAaViZGoQP2zoQ=",
"checksumSHA1": "/qaOJqnSLO0dZbyQDnq75wUPiLo=",
"path": "github.com/pingcap/parser/mysql",
"revision": "cdceeb2c5476084c21987c42bc9405cdcbc290ef",
"revisionTime": "2019-04-08T06:41:40Z"
"revision": "89ae120307cc42a1cccc4daba2c589966db77055",
"revisionTime": "2019-05-23T11:32:41Z"
},
{
"checksumSHA1": "olapD16WCMBU9vrA5PtlERGFfXw=",
"path": "github.com/pingcap/parser/opcode",
"revision": "cdceeb2c5476084c21987c42bc9405cdcbc290ef",
"revisionTime": "2019-04-08T06:41:40Z"
"revision": "89ae120307cc42a1cccc4daba2c589966db77055",
"revisionTime": "2019-05-23T11:32:41Z"
},
{
"checksumSHA1": "TF2rMYy9ewgZpFsJb+jaGXXqZqc=",
"checksumSHA1": "kNunWp0HfikkRiZlOzfD1bvHruM=",
"path": "github.com/pingcap/parser/terror",
"revision": "cdceeb2c5476084c21987c42bc9405cdcbc290ef",
"revisionTime": "2019-04-08T06:41:40Z"
"revision": "89ae120307cc42a1cccc4daba2c589966db77055",
"revisionTime": "2019-05-23T11:32:41Z"
},
{
"checksumSHA1": "99wS/t3dZNvqLZ+DK/V9D4or3R8=",
"checksumSHA1": "abJKAbu4Cro4oJZ2IeI+n+0R87A=",
"path": "github.com/pingcap/parser/types",
"revision": "cdceeb2c5476084c21987c42bc9405cdcbc290ef",
"revisionTime": "2019-04-08T06:41:40Z"
"revision": "89ae120307cc42a1cccc4daba2c589966db77055",
"revisionTime": "2019-05-23T11:32:41Z"
},
{
"checksumSHA1": "hOYJW5hSqstxumyNG8+tItUtmhU=",
"checksumSHA1": "t0O+34iPgOlRt020Cn36smUWhwQ=",
"path": "github.com/pingcap/tidb/sessionctx/stmtctx",
"revision": "f6a36e0b3634759b0e8f8afef63c70c06707279c",
"revisionTime": "2019-04-09T02:17:41Z"
"revision": "cc74145ffa9e48edcae0fb394618ada43b2776c0",
"revisionTime": "2019-05-24T06:40:04Z"
},
{
"checksumSHA1": "p2EXSv26CqDA/O8oA1jkig+42tU=",
"checksumSHA1": "1INT6BSMg5WA9x4ftRegJBhDJQg=",
"path": "github.com/pingcap/tidb/types",
"revision": "f6a36e0b3634759b0e8f8afef63c70c06707279c",
"revisionTime": "2019-04-09T02:17:41Z"
"revision": "cc74145ffa9e48edcae0fb394618ada43b2776c0",
"revisionTime": "2019-05-24T06:40:04Z"
},
{
"checksumSHA1": "fPdBwAtPVKOr7YAyOMnRxyHixoM=",
"checksumSHA1": "PwXMuapqcWj1+hMEcRIJhLJ3NsY=",
"path": "github.com/pingcap/tidb/types/json",
"revision": "f6a36e0b3634759b0e8f8afef63c70c06707279c",
"revisionTime": "2019-04-09T02:17:41Z"
"revision": "cc74145ffa9e48edcae0fb394618ada43b2776c0",
"revisionTime": "2019-05-24T06:40:04Z"
},
{
"checksumSHA1": "45zWX5Q6D6aTEWtc4p/lbD9WD4o=",
"path": "github.com/pingcap/tidb/types/parser_driver",
"revision": "f6a36e0b3634759b0e8f8afef63c70c06707279c",
"revisionTime": "2019-04-09T02:17:41Z"
"revision": "cc74145ffa9e48edcae0fb394618ada43b2776c0",
"revisionTime": "2019-05-24T06:40:04Z"
},
{
"checksumSHA1": "za/7NvrgGTXpUf/A4/MCtgeNp+Y=",
"path": "github.com/pingcap/tidb/util/execdetails",
"revision": "f6a36e0b3634759b0e8f8afef63c70c06707279c",
"revisionTime": "2019-04-09T02:17:41Z"
"revision": "cc74145ffa9e48edcae0fb394618ada43b2776c0",
"revisionTime": "2019-05-24T06:40:04Z"
},
{
"checksumSHA1": "RdbHgQWMHjRtKjqPcTX81k1V3sw=",
"path": "github.com/pingcap/tidb/util/hack",
"revision": "f6a36e0b3634759b0e8f8afef63c70c06707279c",
"revisionTime": "2019-04-09T02:17:41Z"
"revision": "cc74145ffa9e48edcae0fb394618ada43b2776c0",
"revisionTime": "2019-05-24T06:40:04Z"
},
{
"checksumSHA1": "wlgkvTvOR4cyv/X16Kt07HzAWeo=",
"checksumSHA1": "JYbZwZe2uuqKVVV40ZU4G9zGEBE=",
"path": "github.com/pingcap/tidb/util/logutil",
"revision": "f6a36e0b3634759b0e8f8afef63c70c06707279c",
"revisionTime": "2019-04-09T02:17:41Z"
"revision": "cc74145ffa9e48edcae0fb394618ada43b2776c0",
"revisionTime": "2019-05-24T06:40:04Z"
},
{
"checksumSHA1": "UoBGdswa5v8jGAVQxP3RRrMsq9w=",
"checksumSHA1": "OveQu0ABBJmMEwmmthqSRQC2Ef0=",
"path": "github.com/pingcap/tidb/util/math",
"revision": "f6a36e0b3634759b0e8f8afef63c70c06707279c",
"revisionTime": "2019-04-09T02:17:41Z"
"revision": "cc74145ffa9e48edcae0fb394618ada43b2776c0",
"revisionTime": "2019-05-24T06:40:04Z"
},
{
"checksumSHA1": "0teuFRow8w3BahNYK6IrAtgZsUs=",
"checksumSHA1": "9q+/RZZoN4cq/FbCUCD0uVAyqeU=",
"path": "github.com/pingcap/tidb/util/memory",
"revision": "f6a36e0b3634759b0e8f8afef63c70c06707279c",
"revisionTime": "2019-04-09T02:17:41Z"
"revision": "cc74145ffa9e48edcae0fb394618ada43b2776c0",
"revisionTime": "2019-05-24T06:40:04Z"
},
{
"checksumSHA1": "QPIBwDNUFF5Whrnd41S3mkKa4gQ=",
......@@ -485,62 +485,62 @@
{
"checksumSHA1": "aKn1oKcY74N8TRLm3Ayt7Q4bbI4=",
"path": "vitess.io/vitess/go/bytes2",
"revision": "1dc74aace0998ae1424845f9a4590c60ad622e45",
"revisionTime": "2019-04-07T19:11:39Z"
"revision": "eb2d057927b37c5a6f144ab5baa762881cffae8d",
"revisionTime": "2019-05-23T12:28:24Z"
},
{
"checksumSHA1": "bhE6CGQgZTIgLPp9lnvlKW/47xc=",
"path": "vitess.io/vitess/go/hack",
"revision": "1dc74aace0998ae1424845f9a4590c60ad622e45",
"revisionTime": "2019-04-07T19:11:39Z"
"revision": "eb2d057927b37c5a6f144ab5baa762881cffae8d",
"revisionTime": "2019-05-23T12:28:24Z"
},
{
"checksumSHA1": "w4BH8HL/CgT6aBWojJeZHOj5DZg=",
"checksumSHA1": "RERqgxOX48XzRIoe5fQzvWSJV0Y=",
"path": "vitess.io/vitess/go/sqltypes",
"revision": "1dc74aace0998ae1424845f9a4590c60ad622e45",
"revisionTime": "2019-04-07T19:11:39Z"
"revision": "eb2d057927b37c5a6f144ab5baa762881cffae8d",
"revisionTime": "2019-05-23T12:28:24Z"
},
{
"checksumSHA1": "vAIRxI6MHsq3x1hLQwIyw5AvqtI=",
"path": "vitess.io/vitess/go/vt/log",
"revision": "1dc74aace0998ae1424845f9a4590c60ad622e45",
"revisionTime": "2019-04-07T19:11:39Z"
"revision": "eb2d057927b37c5a6f144ab5baa762881cffae8d",
"revisionTime": "2019-05-23T12:28:24Z"
},
{
"checksumSHA1": "87Zndvk3Y+M+QxMx3uFa0iSbvWY=",
"path": "vitess.io/vitess/go/vt/proto/query",
"revision": "1dc74aace0998ae1424845f9a4590c60ad622e45",
"revisionTime": "2019-04-07T19:11:39Z"
"revision": "eb2d057927b37c5a6f144ab5baa762881cffae8d",
"revisionTime": "2019-05-23T12:28:24Z"
},
{
"checksumSHA1": "xpcb9NfXMEeHhEPStbJntIfa5GQ=",
"path": "vitess.io/vitess/go/vt/proto/topodata",
"revision": "1dc74aace0998ae1424845f9a4590c60ad622e45",
"revisionTime": "2019-04-07T19:11:39Z"
"revision": "eb2d057927b37c5a6f144ab5baa762881cffae8d",
"revisionTime": "2019-05-23T12:28:24Z"
},
{
"checksumSHA1": "7rQUJ9mz64dMJpFhIGNkMvG2Zqs=",
"checksumSHA1": "l9fmSuOJyoq+EKM4QxfoSw8hLPY=",
"path": "vitess.io/vitess/go/vt/proto/vtgate",
"revision": "1dc74aace0998ae1424845f9a4590c60ad622e45",
"revisionTime": "2019-04-07T19:11:39Z"
"revision": "eb2d057927b37c5a6f144ab5baa762881cffae8d",
"revisionTime": "2019-05-23T12:28:24Z"
},
{
"checksumSHA1": "qz32abYdmm9NfKTc++K0l1EvXXM=",
"path": "vitess.io/vitess/go/vt/proto/vtrpc",
"revision": "1dc74aace0998ae1424845f9a4590c60ad622e45",
"revisionTime": "2019-04-07T19:11:39Z"
"revision": "eb2d057927b37c5a6f144ab5baa762881cffae8d",
"revisionTime": "2019-05-23T12:28:24Z"
},
{
"checksumSHA1": "WIWzi5IyyoFxkJDG+Oj/DnwpEXg=",
"checksumSHA1": "/V79kL29yMBxAofQBL/XqxJv/GE=",
"path": "vitess.io/vitess/go/vt/sqlparser",
"revision": "1dc74aace0998ae1424845f9a4590c60ad622e45",
"revisionTime": "2019-04-07T19:11:39Z"
"revision": "eb2d057927b37c5a6f144ab5baa762881cffae8d",
"revisionTime": "2019-05-23T12:28:24Z"
},
{
"checksumSHA1": "U6rh56fSka/7xLGnl1OnWgBItn8=",
"checksumSHA1": "qhGH2j3onpaSh+fbs1fKPoTxUcw=",
"path": "vitess.io/vitess/go/vt/vterrors",
"revision": "1dc74aace0998ae1424845f9a4590c60ad622e45",
"revisionTime": "2019-04-07T19:11:39Z"
"revision": "eb2d057927b37c5a6f144ab5baa762881cffae8d",
"revisionTime": "2019-05-23T12:28:24Z"
}
],
"rootPath": "github.com/XiaoMi/soar"
......
......@@ -57,6 +57,11 @@ func BuildBindVariables(in map[string]interface{}) (map[string]*querypb.BindVari
return out, nil
}
// Int8BindVariable converts an int8 to a bind var.
func Int8BindVariable(v int8) *querypb.BindVariable {
return ValueBindVariable(NewInt8(v))
}
// Int32BindVariable converts an int32 to a bind var.
func Int32BindVariable(v int32) *querypb.BindVariable {
return ValueBindVariable(NewInt32(v))
......@@ -99,6 +104,11 @@ func BuildBindVariable(v interface{}) (*querypb.BindVariable, error) {
return StringBindVariable(v), nil
case []byte:
return BytesBindVariable(v), nil
case bool:
if v {
return Int8BindVariable(1), nil
}
return Int8BindVariable(0), nil
case int:
return &querypb.BindVariable{
Type: querypb.Type_INT64,
......
......@@ -100,6 +100,11 @@ func NewInt64(v int64) Value {
return MakeTrusted(Int64, strconv.AppendInt(nil, v, 10))
}
// NewInt8 builds an Int8 Value.
func NewInt8(v int8) Value {
return MakeTrusted(Int8, strconv.AppendInt(nil, int64(v), 10))
}
// NewInt32 builds an Int64 Value.
func NewInt32(v int32) Value {
return MakeTrusted(Int32, strconv.AppendInt(nil, int64(v), 10))
......
......@@ -53,7 +53,42 @@ func (x TransactionMode) String() string {
return proto.EnumName(TransactionMode_name, int32(x))
}
func (TransactionMode) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{0}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{0}
}
// CommitOrder is used to designate which of the ShardSessions
// get used for transactions.
type CommitOrder int32
const (
// NORMAL is the default commit order.
CommitOrder_NORMAL CommitOrder = 0
// PRE is used to designate pre_sessions.
CommitOrder_PRE CommitOrder = 1
// POST is used to designate post_sessions.
CommitOrder_POST CommitOrder = 2
// AUTOCOMMIT is used to run the statement as autocommitted transaction.
CommitOrder_AUTOCOMMIT CommitOrder = 3
)
var CommitOrder_name = map[int32]string{
0: "NORMAL",
1: "PRE",
2: "POST",
3: "AUTOCOMMIT",
}
var CommitOrder_value = map[string]int32{
"NORMAL": 0,
"PRE": 1,
"POST": 2,
"AUTOCOMMIT": 3,
}
func (x CommitOrder) String() string {
return proto.EnumName(CommitOrder_name, int32(x))
}
func (CommitOrder) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_vtgate_178abacf9cf673c8, []int{1}
}
// Session objects are exchanged like cookies through various
......@@ -88,17 +123,21 @@ type Session struct {
// transaction_mode specifies the current transaction mode.
TransactionMode TransactionMode `protobuf:"varint,7,opt,name=transaction_mode,json=transactionMode,proto3,enum=vtgate.TransactionMode" json:"transaction_mode,omitempty"`
// warnings contains non-fatal warnings from the previous query
Warnings []*query.QueryWarning `protobuf:"bytes,8,rep,name=warnings,proto3" json:"warnings,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
Warnings []*query.QueryWarning `protobuf:"bytes,8,rep,name=warnings,proto3" json:"warnings,omitempty"`
// pre_sessions contains sessions that have to be committed first.
PreSessions []*Session_ShardSession `protobuf:"bytes,9,rep,name=pre_sessions,json=preSessions,proto3" json:"pre_sessions,omitempty"`
// post_sessions contains sessions that have to be committed last.
PostSessions []*Session_ShardSession `protobuf:"bytes,10,rep,name=post_sessions,json=postSessions,proto3" json:"post_sessions,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *Session) Reset() { *m = Session{} }
func (m *Session) String() string { return proto.CompactTextString(m) }
func (*Session) ProtoMessage() {}
func (*Session) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{0}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{0}
}
func (m *Session) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Session.Unmarshal(m, b)
......@@ -174,6 +213,20 @@ func (m *Session) GetWarnings() []*query.QueryWarning {
return nil
}
func (m *Session) GetPreSessions() []*Session_ShardSession {
if m != nil {
return m.PreSessions
}
return nil
}
func (m *Session) GetPostSessions() []*Session_ShardSession {
if m != nil {
return m.PostSessions
}
return nil
}
type Session_ShardSession struct {
Target *query.Target `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
TransactionId int64 `protobuf:"varint,2,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"`
......@@ -186,7 +239,7 @@ func (m *Session_ShardSession) Reset() { *m = Session_ShardSession{} }
func (m *Session_ShardSession) String() string { return proto.CompactTextString(m) }
func (*Session_ShardSession) ProtoMessage() {}
func (*Session_ShardSession) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{0, 0}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{0, 0}
}
func (m *Session_ShardSession) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Session_ShardSession.Unmarshal(m, b)
......@@ -244,7 +297,7 @@ func (m *ExecuteRequest) Reset() { *m = ExecuteRequest{} }
func (m *ExecuteRequest) String() string { return proto.CompactTextString(m) }
func (*ExecuteRequest) ProtoMessage() {}
func (*ExecuteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{1}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{1}
}
func (m *ExecuteRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteRequest.Unmarshal(m, b)
......@@ -332,7 +385,7 @@ func (m *ExecuteResponse) Reset() { *m = ExecuteResponse{} }
func (m *ExecuteResponse) String() string { return proto.CompactTextString(m) }
func (*ExecuteResponse) ProtoMessage() {}
func (*ExecuteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{2}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{2}
}
func (m *ExecuteResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteResponse.Unmarshal(m, b)
......@@ -402,7 +455,7 @@ func (m *ExecuteShardsRequest) Reset() { *m = ExecuteShardsRequest{} }
func (m *ExecuteShardsRequest) String() string { return proto.CompactTextString(m) }
func (*ExecuteShardsRequest) ProtoMessage() {}
func (*ExecuteShardsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{3}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{3}
}
func (m *ExecuteShardsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteShardsRequest.Unmarshal(m, b)
......@@ -497,7 +550,7 @@ func (m *ExecuteShardsResponse) Reset() { *m = ExecuteShardsResponse{} }
func (m *ExecuteShardsResponse) String() string { return proto.CompactTextString(m) }
func (*ExecuteShardsResponse) ProtoMessage() {}
func (*ExecuteShardsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{4}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{4}
}
func (m *ExecuteShardsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteShardsResponse.Unmarshal(m, b)
......@@ -568,7 +621,7 @@ func (m *ExecuteKeyspaceIdsRequest) Reset() { *m = ExecuteKeyspaceIdsReq
func (m *ExecuteKeyspaceIdsRequest) String() string { return proto.CompactTextString(m) }
func (*ExecuteKeyspaceIdsRequest) ProtoMessage() {}
func (*ExecuteKeyspaceIdsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{5}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{5}
}
func (m *ExecuteKeyspaceIdsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteKeyspaceIdsRequest.Unmarshal(m, b)
......@@ -663,7 +716,7 @@ func (m *ExecuteKeyspaceIdsResponse) Reset() { *m = ExecuteKeyspaceIdsRe
func (m *ExecuteKeyspaceIdsResponse) String() string { return proto.CompactTextString(m) }
func (*ExecuteKeyspaceIdsResponse) ProtoMessage() {}
func (*ExecuteKeyspaceIdsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{6}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{6}
}
func (m *ExecuteKeyspaceIdsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteKeyspaceIdsResponse.Unmarshal(m, b)
......@@ -734,7 +787,7 @@ func (m *ExecuteKeyRangesRequest) Reset() { *m = ExecuteKeyRangesRequest
func (m *ExecuteKeyRangesRequest) String() string { return proto.CompactTextString(m) }
func (*ExecuteKeyRangesRequest) ProtoMessage() {}
func (*ExecuteKeyRangesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{7}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{7}
}
func (m *ExecuteKeyRangesRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteKeyRangesRequest.Unmarshal(m, b)
......@@ -829,7 +882,7 @@ func (m *ExecuteKeyRangesResponse) Reset() { *m = ExecuteKeyRangesRespon
func (m *ExecuteKeyRangesResponse) String() string { return proto.CompactTextString(m) }
func (*ExecuteKeyRangesResponse) ProtoMessage() {}
func (*ExecuteKeyRangesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{8}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{8}
}
func (m *ExecuteKeyRangesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteKeyRangesResponse.Unmarshal(m, b)
......@@ -902,7 +955,7 @@ func (m *ExecuteEntityIdsRequest) Reset() { *m = ExecuteEntityIdsRequest
func (m *ExecuteEntityIdsRequest) String() string { return proto.CompactTextString(m) }
func (*ExecuteEntityIdsRequest) ProtoMessage() {}
func (*ExecuteEntityIdsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{9}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{9}
}
func (m *ExecuteEntityIdsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteEntityIdsRequest.Unmarshal(m, b)
......@@ -1001,7 +1054,7 @@ func (m *ExecuteEntityIdsRequest_EntityId) Reset() { *m = ExecuteEntityI
func (m *ExecuteEntityIdsRequest_EntityId) String() string { return proto.CompactTextString(m) }
func (*ExecuteEntityIdsRequest_EntityId) ProtoMessage() {}
func (*ExecuteEntityIdsRequest_EntityId) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{9, 0}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{9, 0}
}
func (m *ExecuteEntityIdsRequest_EntityId) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteEntityIdsRequest_EntityId.Unmarshal(m, b)
......@@ -1061,7 +1114,7 @@ func (m *ExecuteEntityIdsResponse) Reset() { *m = ExecuteEntityIdsRespon
func (m *ExecuteEntityIdsResponse) String() string { return proto.CompactTextString(m) }
func (*ExecuteEntityIdsResponse) ProtoMessage() {}
func (*ExecuteEntityIdsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{10}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{10}
}
func (m *ExecuteEntityIdsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteEntityIdsResponse.Unmarshal(m, b)
......@@ -1126,7 +1179,7 @@ func (m *ExecuteBatchRequest) Reset() { *m = ExecuteBatchRequest{} }
func (m *ExecuteBatchRequest) String() string { return proto.CompactTextString(m) }
func (*ExecuteBatchRequest) ProtoMessage() {}
func (*ExecuteBatchRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{11}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{11}
}
func (m *ExecuteBatchRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteBatchRequest.Unmarshal(m, b)
......@@ -1214,7 +1267,7 @@ func (m *ExecuteBatchResponse) Reset() { *m = ExecuteBatchResponse{} }
func (m *ExecuteBatchResponse) String() string { return proto.CompactTextString(m) }
func (*ExecuteBatchResponse) ProtoMessage() {}
func (*ExecuteBatchResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{12}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{12}
}
func (m *ExecuteBatchResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteBatchResponse.Unmarshal(m, b)
......@@ -1274,7 +1327,7 @@ func (m *BoundShardQuery) Reset() { *m = BoundShardQuery{} }
func (m *BoundShardQuery) String() string { return proto.CompactTextString(m) }
func (*BoundShardQuery) ProtoMessage() {}
func (*BoundShardQuery) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{13}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{13}
}
func (m *BoundShardQuery) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BoundShardQuery.Unmarshal(m, b)
......@@ -1342,7 +1395,7 @@ func (m *ExecuteBatchShardsRequest) Reset() { *m = ExecuteBatchShardsReq
func (m *ExecuteBatchShardsRequest) String() string { return proto.CompactTextString(m) }
func (*ExecuteBatchShardsRequest) ProtoMessage() {}
func (*ExecuteBatchShardsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{14}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{14}
}
func (m *ExecuteBatchShardsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteBatchShardsRequest.Unmarshal(m, b)
......@@ -1423,7 +1476,7 @@ func (m *ExecuteBatchShardsResponse) Reset() { *m = ExecuteBatchShardsRe
func (m *ExecuteBatchShardsResponse) String() string { return proto.CompactTextString(m) }
func (*ExecuteBatchShardsResponse) ProtoMessage() {}
func (*ExecuteBatchShardsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{15}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{15}
}
func (m *ExecuteBatchShardsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteBatchShardsResponse.Unmarshal(m, b)
......@@ -1484,7 +1537,7 @@ func (m *BoundKeyspaceIdQuery) Reset() { *m = BoundKeyspaceIdQuery{} }
func (m *BoundKeyspaceIdQuery) String() string { return proto.CompactTextString(m) }
func (*BoundKeyspaceIdQuery) ProtoMessage() {}
func (*BoundKeyspaceIdQuery) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{16}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{16}
}
func (m *BoundKeyspaceIdQuery) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BoundKeyspaceIdQuery.Unmarshal(m, b)
......@@ -1551,7 +1604,7 @@ func (m *ExecuteBatchKeyspaceIdsRequest) Reset() { *m = ExecuteBatchKeys
func (m *ExecuteBatchKeyspaceIdsRequest) String() string { return proto.CompactTextString(m) }
func (*ExecuteBatchKeyspaceIdsRequest) ProtoMessage() {}
func (*ExecuteBatchKeyspaceIdsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{17}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{17}
}
func (m *ExecuteBatchKeyspaceIdsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteBatchKeyspaceIdsRequest.Unmarshal(m, b)
......@@ -1632,7 +1685,7 @@ func (m *ExecuteBatchKeyspaceIdsResponse) Reset() { *m = ExecuteBatchKey
func (m *ExecuteBatchKeyspaceIdsResponse) String() string { return proto.CompactTextString(m) }
func (*ExecuteBatchKeyspaceIdsResponse) ProtoMessage() {}
func (*ExecuteBatchKeyspaceIdsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{18}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{18}
}
func (m *ExecuteBatchKeyspaceIdsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ExecuteBatchKeyspaceIdsResponse.Unmarshal(m, b)
......@@ -1696,7 +1749,7 @@ func (m *StreamExecuteRequest) Reset() { *m = StreamExecuteRequest{} }
func (m *StreamExecuteRequest) String() string { return proto.CompactTextString(m) }
func (*StreamExecuteRequest) ProtoMessage() {}
func (*StreamExecuteRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{19}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{19}
}
func (m *StreamExecuteRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StreamExecuteRequest.Unmarshal(m, b)
......@@ -1775,7 +1828,7 @@ func (m *StreamExecuteResponse) Reset() { *m = StreamExecuteResponse{} }
func (m *StreamExecuteResponse) String() string { return proto.CompactTextString(m) }
func (*StreamExecuteResponse) ProtoMessage() {}
func (*StreamExecuteResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{20}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{20}
}
func (m *StreamExecuteResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StreamExecuteResponse.Unmarshal(m, b)
......@@ -1826,7 +1879,7 @@ func (m *StreamExecuteShardsRequest) Reset() { *m = StreamExecuteShardsR
func (m *StreamExecuteShardsRequest) String() string { return proto.CompactTextString(m) }
func (*StreamExecuteShardsRequest) ProtoMessage() {}
func (*StreamExecuteShardsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{21}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{21}
}
func (m *StreamExecuteShardsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StreamExecuteShardsRequest.Unmarshal(m, b)
......@@ -1903,7 +1956,7 @@ func (m *StreamExecuteShardsResponse) Reset() { *m = StreamExecuteShards
func (m *StreamExecuteShardsResponse) String() string { return proto.CompactTextString(m) }
func (*StreamExecuteShardsResponse) ProtoMessage() {}
func (*StreamExecuteShardsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{22}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{22}
}
func (m *StreamExecuteShardsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StreamExecuteShardsResponse.Unmarshal(m, b)
......@@ -1955,7 +2008,7 @@ func (m *StreamExecuteKeyspaceIdsRequest) Reset() { *m = StreamExecuteKe
func (m *StreamExecuteKeyspaceIdsRequest) String() string { return proto.CompactTextString(m) }
func (*StreamExecuteKeyspaceIdsRequest) ProtoMessage() {}
func (*StreamExecuteKeyspaceIdsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{23}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{23}
}
func (m *StreamExecuteKeyspaceIdsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StreamExecuteKeyspaceIdsRequest.Unmarshal(m, b)
......@@ -2032,7 +2085,7 @@ func (m *StreamExecuteKeyspaceIdsResponse) Reset() { *m = StreamExecuteK
func (m *StreamExecuteKeyspaceIdsResponse) String() string { return proto.CompactTextString(m) }
func (*StreamExecuteKeyspaceIdsResponse) ProtoMessage() {}
func (*StreamExecuteKeyspaceIdsResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{24}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{24}
}
func (m *StreamExecuteKeyspaceIdsResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StreamExecuteKeyspaceIdsResponse.Unmarshal(m, b)
......@@ -2084,7 +2137,7 @@ func (m *StreamExecuteKeyRangesRequest) Reset() { *m = StreamExecuteKeyR
func (m *StreamExecuteKeyRangesRequest) String() string { return proto.CompactTextString(m) }
func (*StreamExecuteKeyRangesRequest) ProtoMessage() {}
func (*StreamExecuteKeyRangesRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{25}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{25}
}
func (m *StreamExecuteKeyRangesRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StreamExecuteKeyRangesRequest.Unmarshal(m, b)
......@@ -2161,7 +2214,7 @@ func (m *StreamExecuteKeyRangesResponse) Reset() { *m = StreamExecuteKey
func (m *StreamExecuteKeyRangesResponse) String() string { return proto.CompactTextString(m) }
func (*StreamExecuteKeyRangesResponse) ProtoMessage() {}
func (*StreamExecuteKeyRangesResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{26}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{26}
}
func (m *StreamExecuteKeyRangesResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_StreamExecuteKeyRangesResponse.Unmarshal(m, b)
......@@ -2207,7 +2260,7 @@ func (m *BeginRequest) Reset() { *m = BeginRequest{} }
func (m *BeginRequest) String() string { return proto.CompactTextString(m) }
func (*BeginRequest) ProtoMessage() {}
func (*BeginRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{27}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{27}
}
func (m *BeginRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BeginRequest.Unmarshal(m, b)
......@@ -2254,7 +2307,7 @@ func (m *BeginResponse) Reset() { *m = BeginResponse{} }
func (m *BeginResponse) String() string { return proto.CompactTextString(m) }
func (*BeginResponse) ProtoMessage() {}
func (*BeginResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{28}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{28}
}
func (m *BeginResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_BeginResponse.Unmarshal(m, b)
......@@ -2302,7 +2355,7 @@ func (m *CommitRequest) Reset() { *m = CommitRequest{} }
func (m *CommitRequest) String() string { return proto.CompactTextString(m) }
func (*CommitRequest) ProtoMessage() {}
func (*CommitRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{29}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{29}
}
func (m *CommitRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CommitRequest.Unmarshal(m, b)
......@@ -2354,7 +2407,7 @@ func (m *CommitResponse) Reset() { *m = CommitResponse{} }
func (m *CommitResponse) String() string { return proto.CompactTextString(m) }
func (*CommitResponse) ProtoMessage() {}
func (*CommitResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{30}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{30}
}
func (m *CommitResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_CommitResponse.Unmarshal(m, b)
......@@ -2390,7 +2443,7 @@ func (m *RollbackRequest) Reset() { *m = RollbackRequest{} }
func (m *RollbackRequest) String() string { return proto.CompactTextString(m) }
func (*RollbackRequest) ProtoMessage() {}
func (*RollbackRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{31}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{31}
}
func (m *RollbackRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RollbackRequest.Unmarshal(m, b)
......@@ -2435,7 +2488,7 @@ func (m *RollbackResponse) Reset() { *m = RollbackResponse{} }
func (m *RollbackResponse) String() string { return proto.CompactTextString(m) }
func (*RollbackResponse) ProtoMessage() {}
func (*RollbackResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{32}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{32}
}
func (m *RollbackResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_RollbackResponse.Unmarshal(m, b)
......@@ -2471,7 +2524,7 @@ func (m *ResolveTransactionRequest) Reset() { *m = ResolveTransactionReq
func (m *ResolveTransactionRequest) String() string { return proto.CompactTextString(m) }
func (*ResolveTransactionRequest) ProtoMessage() {}
func (*ResolveTransactionRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{33}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{33}
}
func (m *ResolveTransactionRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ResolveTransactionRequest.Unmarshal(m, b)
......@@ -2527,7 +2580,7 @@ func (m *MessageStreamRequest) Reset() { *m = MessageStreamRequest{} }
func (m *MessageStreamRequest) String() string { return proto.CompactTextString(m) }
func (*MessageStreamRequest) ProtoMessage() {}
func (*MessageStreamRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{34}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{34}
}
func (m *MessageStreamRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MessageStreamRequest.Unmarshal(m, b)
......@@ -2602,7 +2655,7 @@ func (m *MessageAckRequest) Reset() { *m = MessageAckRequest{} }
func (m *MessageAckRequest) String() string { return proto.CompactTextString(m) }
func (*MessageAckRequest) ProtoMessage() {}
func (*MessageAckRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{35}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{35}
}
func (m *MessageAckRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MessageAckRequest.Unmarshal(m, b)
......@@ -2666,7 +2719,7 @@ func (m *IdKeyspaceId) Reset() { *m = IdKeyspaceId{} }
func (m *IdKeyspaceId) String() string { return proto.CompactTextString(m) }
func (*IdKeyspaceId) ProtoMessage() {}
func (*IdKeyspaceId) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{36}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{36}
}
func (m *IdKeyspaceId) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_IdKeyspaceId.Unmarshal(m, b)
......@@ -2719,7 +2772,7 @@ func (m *MessageAckKeyspaceIdsRequest) Reset() { *m = MessageAckKeyspace
func (m *MessageAckKeyspaceIdsRequest) String() string { return proto.CompactTextString(m) }
func (*MessageAckKeyspaceIdsRequest) ProtoMessage() {}
func (*MessageAckKeyspaceIdsRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{37}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{37}
}
func (m *MessageAckKeyspaceIdsRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_MessageAckKeyspaceIdsRequest.Unmarshal(m, b)
......@@ -2778,7 +2831,7 @@ func (m *ResolveTransactionResponse) Reset() { *m = ResolveTransactionRe
func (m *ResolveTransactionResponse) String() string { return proto.CompactTextString(m) }
func (*ResolveTransactionResponse) ProtoMessage() {}
func (*ResolveTransactionResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{38}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{38}
}
func (m *ResolveTransactionResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ResolveTransactionResponse.Unmarshal(m, b)
......@@ -2896,7 +2949,7 @@ func (m *SplitQueryRequest) Reset() { *m = SplitQueryRequest{} }
func (m *SplitQueryRequest) String() string { return proto.CompactTextString(m) }
func (*SplitQueryRequest) ProtoMessage() {}
func (*SplitQueryRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{39}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{39}
}
func (m *SplitQueryRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SplitQueryRequest.Unmarshal(m, b)
......@@ -2985,7 +3038,7 @@ func (m *SplitQueryResponse) Reset() { *m = SplitQueryResponse{} }
func (m *SplitQueryResponse) String() string { return proto.CompactTextString(m) }
func (*SplitQueryResponse) ProtoMessage() {}
func (*SplitQueryResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{40}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{40}
}
func (m *SplitQueryResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SplitQueryResponse.Unmarshal(m, b)
......@@ -3026,7 +3079,7 @@ func (m *SplitQueryResponse_KeyRangePart) Reset() { *m = SplitQueryRespo
func (m *SplitQueryResponse_KeyRangePart) String() string { return proto.CompactTextString(m) }
func (*SplitQueryResponse_KeyRangePart) ProtoMessage() {}
func (*SplitQueryResponse_KeyRangePart) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{40, 0}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{40, 0}
}
func (m *SplitQueryResponse_KeyRangePart) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SplitQueryResponse_KeyRangePart.Unmarshal(m, b)
......@@ -3074,7 +3127,7 @@ func (m *SplitQueryResponse_ShardPart) Reset() { *m = SplitQueryResponse
func (m *SplitQueryResponse_ShardPart) String() string { return proto.CompactTextString(m) }
func (*SplitQueryResponse_ShardPart) ProtoMessage() {}
func (*SplitQueryResponse_ShardPart) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{40, 1}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{40, 1}
}
func (m *SplitQueryResponse_ShardPart) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SplitQueryResponse_ShardPart.Unmarshal(m, b)
......@@ -3127,7 +3180,7 @@ func (m *SplitQueryResponse_Part) Reset() { *m = SplitQueryResponse_Part
func (m *SplitQueryResponse_Part) String() string { return proto.CompactTextString(m) }
func (*SplitQueryResponse_Part) ProtoMessage() {}
func (*SplitQueryResponse_Part) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{40, 2}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{40, 2}
}
func (m *SplitQueryResponse_Part) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_SplitQueryResponse_Part.Unmarshal(m, b)
......@@ -3188,7 +3241,7 @@ func (m *GetSrvKeyspaceRequest) Reset() { *m = GetSrvKeyspaceRequest{} }
func (m *GetSrvKeyspaceRequest) String() string { return proto.CompactTextString(m) }
func (*GetSrvKeyspaceRequest) ProtoMessage() {}
func (*GetSrvKeyspaceRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{41}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{41}
}
func (m *GetSrvKeyspaceRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSrvKeyspaceRequest.Unmarshal(m, b)
......@@ -3228,7 +3281,7 @@ func (m *GetSrvKeyspaceResponse) Reset() { *m = GetSrvKeyspaceResponse{}
func (m *GetSrvKeyspaceResponse) String() string { return proto.CompactTextString(m) }
func (*GetSrvKeyspaceResponse) ProtoMessage() {}
func (*GetSrvKeyspaceResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{42}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{42}
}
func (m *GetSrvKeyspaceResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_GetSrvKeyspaceResponse.Unmarshal(m, b)
......@@ -3286,7 +3339,7 @@ func (m *UpdateStreamRequest) Reset() { *m = UpdateStreamRequest{} }
func (m *UpdateStreamRequest) String() string { return proto.CompactTextString(m) }
func (*UpdateStreamRequest) ProtoMessage() {}
func (*UpdateStreamRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{43}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{43}
}
func (m *UpdateStreamRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateStreamRequest.Unmarshal(m, b)
......@@ -3374,7 +3427,7 @@ func (m *UpdateStreamResponse) Reset() { *m = UpdateStreamResponse{} }
func (m *UpdateStreamResponse) String() string { return proto.CompactTextString(m) }
func (*UpdateStreamResponse) ProtoMessage() {}
func (*UpdateStreamResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_vtgate_1d4a858d9b127f46, []int{44}
return fileDescriptor_vtgate_178abacf9cf673c8, []int{44}
}
func (m *UpdateStreamResponse) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_UpdateStreamResponse.Unmarshal(m, b)
......@@ -3460,128 +3513,134 @@ func init() {
proto.RegisterType((*UpdateStreamRequest)(nil), "vtgate.UpdateStreamRequest")
proto.RegisterType((*UpdateStreamResponse)(nil), "vtgate.UpdateStreamResponse")
proto.RegisterEnum("vtgate.TransactionMode", TransactionMode_name, TransactionMode_value)
}
func init() { proto.RegisterFile("vtgate.proto", fileDescriptor_vtgate_1d4a858d9b127f46) }
var fileDescriptor_vtgate_1d4a858d9b127f46 = []byte{
// 1883 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x5a, 0x4f, 0x8f, 0x23, 0x47,
0x15, 0xa7, 0xbb, 0xfd, 0xf7, 0xf9, 0xef, 0xd6, 0x78, 0x77, 0x1d, 0x67, 0xd8, 0x99, 0x74, 0x18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, 0xf0, 0x0f, 0xdd, 0xc8, 0x23, 0x00, 0x00,
proto.RegisterEnum("vtgate.CommitOrder", CommitOrder_name, CommitOrder_value)
}
func init() { proto.RegisterFile("vtgate.proto", fileDescriptor_vtgate_178abacf9cf673c8) }
var fileDescriptor_vtgate_178abacf9cf673c8 = []byte{
// 1962 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x5a, 0xcd, 0x8f, 0x23, 0x47,
0x15, 0x4f, 0x77, 0xfb, 0xf3, 0xb5, 0xbf, 0xb6, 0xd6, 0xbb, 0xeb, 0x38, 0xc3, 0xce, 0xa4, 0xc3,
0x28, 0xce, 0x66, 0xe5, 0x21, 0x0e, 0x04, 0x84, 0x22, 0x85, 0x19, 0xef, 0x10, 0x59, 0xd9, 0xf9,
0xa0, 0xec, 0xcd, 0x02, 0x22, 0x6a, 0xf5, 0xd8, 0x25, 0x6f, 0x33, 0x76, 0xb7, 0xd3, 0x55, 0xf6,
0x32, 0x1c, 0x50, 0xfe, 0x83, 0x88, 0x03, 0x12, 0x8a, 0x90, 0x10, 0x12, 0x12, 0x27, 0xae, 0x48,
0xc0, 0x85, 0x1b, 0x47, 0xc4, 0x89, 0x23, 0x12, 0xff, 0x00, 0x12, 0x7f, 0x01, 0xea, 0xaa, 0xea,
0x0f, 0xf7, 0x7c, 0x79, 0x3c, 0x3b, 0x2b, 0xef, 0xc5, 0xea, 0x7a, 0x55, 0xf5, 0xea, 0xbd, 0xdf,
0xfb, 0xd5, 0xab, 0xd7, 0xd5, 0x86, 0xc2, 0x8c, 0x0d, 0x2d, 0x46, 0x9a, 0x13, 0xcf, 0x65, 0x2e,
0xca, 0x88, 0x56, 0x5d, 0xff, 0x7c, 0x4a, 0xbc, 0x13, 0x21, 0xac, 0x97, 0x98, 0x3b, 0x71, 0x07,
0x16, 0xb3, 0x64, 0x5b, 0x9f, 0x31, 0x6f, 0xd2, 0x17, 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0x02, 0xf1, 0x83, 0x47, 0x50, 0x4e, 0xfc, 0xb5, 0x04, 0x95, 0x41, 0x7f, 0xb2,
0xdf, 0x3d, 0xdc, 0x6d, 0x77, 0xbe, 0xdf, 0xd9, 0x7d, 0x54, 0x79, 0x0d, 0x01, 0x64, 0xba, 0x9d,
0xfd, 0x8f, 0x1f, 0xef, 0x56, 0x14, 0x94, 0x87, 0xf4, 0xde, 0x93, 0xc7, 0xbd, 0x4e, 0x45, 0xf5,
0x1f, 0x7b, 0x4f, 0x0f, 0x0e, 0xdb, 0x15, 0xed, 0xc1, 0x87, 0xa0, 0x8b, 0x5a, 0xe8, 0xc0, 0x1b,
0x10, 0xcf, 0x9f, 0xb0, 0x7f, 0x80, 0xf7, 0xb6, 0x1f, 0x57, 0x5e, 0x43, 0x59, 0xd0, 0x0e, 0xb1,
0x3f, 0x33, 0x07, 0xa9, 0xc3, 0x83, 0x6e, 0xaf, 0xa2, 0xa2, 0x12, 0xc0, 0xf6, 0x93, 0xde, 0x41,
0xfb, 0x60, 0x6f, 0xaf, 0xd3, 0xab, 0x68, 0x3b, 0x1f, 0x40, 0xd9, 0x76, 0x9b, 0x33, 0x9b, 0x11,
0x4a, 0xc5, 0x9f, 0x83, 0x7e, 0xfc, 0x96, 0x6c, 0xd9, 0xee, 0x96, 0x78, 0xda, 0x1a, 0xba, 0x5b,
0x33, 0xb6, 0xc5, 0x7b, 0xb7, 0xc4, 0xa6, 0x38, 0xca, 0xf0, 0xd6, 0xfb, 0xff, 0x0f, 0x00, 0x00,
0xff, 0xff, 0x43, 0xd4, 0xfe, 0x66, 0x8a, 0x24, 0x00, 0x00,
}
......@@ -532,7 +532,7 @@ func (node *Stream) walkSubtree(visit Visit) error {
// the row and re-inserts with new values. For that reason we keep it as an Insert struct.
// Replaces are currently disallowed in sharded schemas because
// of the implications the deletion part may have on vindexes.
// If you add fields here, consider adding them to calls to validateSubquerySamePlan.
// If you add fields here, consider adding them to calls to validateUnshardedRoute.
type Insert struct {
Action string
Comments Comments
......@@ -584,7 +584,7 @@ func (Values) iInsertRows() {}
func (*ParenSelect) iInsertRows() {}
// Update represents an UPDATE statement.
// If you add fields here, consider adding them to calls to validateSubquerySamePlan.
// If you add fields here, consider adding them to calls to validateUnshardedRoute.
type Update struct {
Comments Comments
Ignore string
......@@ -618,7 +618,7 @@ func (node *Update) walkSubtree(visit Visit) error {
}
// Delete represents a DELETE statement.
// If you add fields here, consider adding them to calls to validateSubquerySamePlan.
// If you add fields here, consider adding them to calls to validateUnshardedRoute.
type Delete struct {
Comments Comments
Targets TableNames
......
......@@ -88,6 +88,9 @@ func (nz *normalizer) WalkSelect(node SQLNode) (bool, error) {
// Common node types that never contain SQLVals or ListArgs but create a lot of object
// allocations.
return false, nil
case OrderBy, GroupBy:
// do not make a bind var for order by column_position
return false, nil
}
return true, nil
}
......
......@@ -53,23 +53,31 @@ func (pq *ParsedQuery) GenerateQuery(bindVariables map[string]*querypb.BindVaria
}
var buf strings.Builder
buf.Grow(len(pq.Query))
if err := pq.Append(&buf, bindVariables, extras); err != nil {
return "", err
}
return buf.String(), nil
}
// Append appends the generated query to the provided buffer.
func (pq *ParsedQuery) Append(buf *strings.Builder, bindVariables map[string]*querypb.BindVariable, extras map[string]Encodable) error {
current := 0
for _, loc := range pq.bindLocations {
buf.WriteString(pq.Query[current:loc.offset])
name := pq.Query[loc.offset : loc.offset+loc.length]
if encodable, ok := extras[name[1:]]; ok {
encodable.EncodeSQL(&buf)
encodable.EncodeSQL(buf)
} else {
supplied, _, err := FetchBindVar(name, bindVariables)
if err != nil {
return "", err
return err
}
EncodeValue(&buf, supplied)
EncodeValue(buf, supplied)
}
current = loc.offset + loc.length
}
buf.WriteString(pq.Query[current:])
return buf.String(), nil
return nil
}
// MarshalJSON is a custom JSON marshaler for ParsedQuery.
......
因为 它太大了无法显示 source diff 。你可以改为 查看blob
......@@ -181,7 +181,7 @@ func skipToEnd(yylex interface{}) {
%token <bytes> NULLX AUTO_INCREMENT APPROXNUM SIGNED UNSIGNED ZEROFILL
// Supported SHOW tokens
%token <bytes> COLLATION DATABASES TABLES VITESS_KEYSPACES VITESS_SHARDS VITESS_TABLETS VSCHEMA VSCHEMA_TABLES VITESS_TARGET FULL PROCESSLIST COLUMNS FIELDS ENGINES PLUGINS
%token <bytes> COLLATION DATABASES SCHEMAS TABLES VITESS_KEYSPACES VITESS_SHARDS VITESS_TABLETS VSCHEMA VSCHEMA_TABLES VITESS_TARGET FULL PROCESSLIST COLUMNS FIELDS ENGINES PLUGINS
// SET tokens
%token <bytes> NAMES CHARSET GLOBAL SESSION ISOLATION LEVEL READ WRITE ONLY REPEATABLE COMMITTED UNCOMMITTED SERIALIZABLE
......@@ -1485,6 +1485,10 @@ show_statement:
{
$$ = &Show{Type: string($2)}
}
| SHOW SCHEMAS ddl_skip_to_end
{
$$ = &Show{Type: string($2)}
}
| SHOW ENGINES
{
$$ = &Show{Type: string($2)}
......@@ -2450,50 +2454,18 @@ function_call_keyword:
{
$$ = &ConvertUsingExpr{Expr: $3, Type: $5}
}
| SUBSTR openb column_name ',' value_expression closeb
{
$$ = &SubstrExpr{Name: $3, From: $5, To: nil}
}
| SUBSTR openb column_name ',' value_expression ',' value_expression closeb
{
$$ = &SubstrExpr{Name: $3, From: $5, To: $7}
}
| SUBSTR openb column_name FROM value_expression FOR value_expression closeb
{
$$ = &SubstrExpr{Name: $3, From: $5, To: $7}
}
| SUBSTRING openb column_name ',' value_expression closeb
{
$$ = &SubstrExpr{Name: $3, From: $5, To: nil}
}
| SUBSTRING openb column_name ',' value_expression ',' value_expression closeb
{
$$ = &SubstrExpr{Name: $3, From: $5, To: $7}
}
| SUBSTRING openb column_name FROM value_expression FOR value_expression closeb
{
$$ = &SubstrExpr{Name: $3, From: $5, To: $7}
}
| SUBSTR openb STRING ',' value_expression closeb
{
$$ = &SubstrExpr{StrVal: NewStrVal($3), From: $5, To: nil}
}
| SUBSTR openb STRING ',' value_expression ',' value_expression closeb
{
$$ = &SubstrExpr{StrVal: NewStrVal($3), From: $5, To: $7}
}
| SUBSTR openb STRING FROM value_expression FOR value_expression closeb
{
$$ = &SubstrExpr{StrVal: NewStrVal($3), From: $5, To: $7}
}
| SUBSTRING openb STRING ',' value_expression closeb
{
$$ = &SubstrExpr{StrVal: NewStrVal($3), From: $5, To: nil}
}
| SUBSTRING openb STRING ',' value_expression ',' value_expression closeb
{
$$ = &SubstrExpr{StrVal: NewStrVal($3), From: $5, To: $7}
}
| SUBSTRING openb STRING FROM value_expression FOR value_expression closeb
{
$$ = &SubstrExpr{StrVal: NewStrVal($3), From: $5, To: $7}
......@@ -2626,6 +2598,14 @@ function_call_conflict:
{
$$ = &FuncExpr{Name: NewColIdent("replace"), Exprs: $3}
}
| SUBSTR openb select_expression_list closeb
{
$$ = &FuncExpr{Name: NewColIdent("substr"), Exprs: $3}
}
| SUBSTRING openb select_expression_list closeb
{
$$ = &FuncExpr{Name: NewColIdent("substr"), Exprs: $3}
}
match_option:
/*empty*/
......@@ -3364,6 +3344,7 @@ non_reserved_keyword:
| REPEATABLE
| RESTRICT
| ROLLBACK
| SCHEMAS
| SESSION
| SERIALIZABLE
| SHARE
......
......@@ -318,7 +318,7 @@ var keywords = map[string]int{
"rlike": REGEXP,
"rollback": ROLLBACK,
"schema": SCHEMA,
"schemas": UNUSED,
"schemas": SCHEMAS,
"second_microsecond": UNUSED,
"select": SELECT,
"sensitive": UNUSED,
......
......@@ -70,6 +70,7 @@
package vterrors
import (
"flag"
"fmt"
"io"
......@@ -77,6 +78,14 @@ import (
vtrpcpb "vitess.io/vitess/go/vt/proto/vtrpc"
)
// LogErrStacks controls whether or not printing errors includes the
// embedded stack trace in the output.
var LogErrStacks bool
func init() {
flag.BoolVar(&LogErrStacks, "LogErrStacks", false, "log stack traces in errors")
}
// New returns an error with the supplied message.
// New also records the stack trace at the point it was called.
func New(code vtrpcpb.Code, message string) error {
......@@ -122,7 +131,9 @@ func (f *fundamental) Format(s fmt.State, verb rune) {
case 'v':
panicIfError(io.WriteString(s, "Code: "+f.code.String()+"\n"))
panicIfError(io.WriteString(s, f.msg+"\n"))
f.stack.Format(s, verb)
if LogErrStacks {
f.stack.Format(s, verb)
}
return
case 's':
panicIfError(io.WriteString(s, f.msg))
......@@ -198,7 +209,9 @@ func (w *wrapping) Format(s fmt.State, verb rune) {
if rune('v') == verb {
panicIfError(fmt.Fprintf(s, "%v\n", w.Cause()))
panicIfError(io.WriteString(s, w.msg))
w.stack.Format(s, verb)
if LogErrStacks {
w.stack.Format(s, verb)
}
return
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册