From ffd32385b33aa040b0352bd5d910a497e3b51370 Mon Sep 17 00:00:00 2001 From: bb7133 Date: Wed, 30 Oct 2019 18:42:57 +0800 Subject: [PATCH 1/7] domain: refine error code for package domain --- ddl/db_change_test.go | 3 +-- ddl/db_test.go | 2 +- domain/domain.go | 13 ++++--------- go.mod | 2 ++ go.sum | 2 ++ 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/ddl/db_change_test.go b/ddl/db_change_test.go index dee4723eb8b5c..2e51b1d7bd830 100644 --- a/ddl/db_change_test.go +++ b/ddl/db_change_test.go @@ -1087,8 +1087,7 @@ func (s *testStateChangeSuite) TestParallelTruncateTableAndAddColumn(c *C) { f := func(c *C, err1, err2 error) { c.Assert(err1, IsNil) c.Assert(err2, NotNil) - c.Assert(err2.Error(), Equals, "[domain:2]Information schema is changed. [try again later]") - + c.Assert(err2.Error(), Equals, "[domain:8028]Information schema is changed during the execution of the statement(for example, table definition may be updated by other DDL ran in parallel). If you see this error often, try increasing `tidb_max_delta_schema_count`. [try again later]") } s.testControlParallelExecSQL(c, sql1, sql2, f) } diff --git a/ddl/db_test.go b/ddl/db_test.go index a665a2ed82246..0265c06e626fd 100644 --- a/ddl/db_test.go +++ b/ddl/db_test.go @@ -3476,7 +3476,7 @@ func (s *testDBSuite2) TestLockTables(c *C) { tk2.MustExec("lock tables t1 write") _, err = tk.Exec("commit") c.Assert(err, NotNil) - c.Assert(err.Error(), Equals, "previous statement: insert into t1 set a=1: [domain:2]Information schema is changed. [try again later]") + c.Assert(err.Error(), Equals, "previous statement: insert into t1 set a=1: [domain:8028]Information schema is changed during the execution of the statement(for example, table definition may be updated by other DDL ran in parallel). If you see this error often, try increasing `tidb_max_delta_schema_count`. [try again later]") // Test lock table by other session in transaction and commit with retry. tk.MustExec("unlock tables") diff --git a/domain/domain.go b/domain/domain.go index 2a7b634e1a0c4..4cb53e38efeaf 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -27,6 +27,7 @@ import ( "github.com/pingcap/failpoint" "github.com/pingcap/parser/ast" "github.com/pingcap/parser/model" + "github.com/pingcap/parser/mysql" "github.com/pingcap/parser/terror" "github.com/pingcap/tidb/bindinfo" "github.com/pingcap/tidb/config" @@ -1112,18 +1113,12 @@ func recoverInDomain(funcName string, quit bool) { } } -// Domain error codes. -const ( - codeInfoSchemaExpired terror.ErrCode = 1 - codeInfoSchemaChanged terror.ErrCode = 2 -) - var ( // ErrInfoSchemaExpired returns the error that information schema is out of date. - ErrInfoSchemaExpired = terror.ClassDomain.New(codeInfoSchemaExpired, "Information schema is out of date.") + ErrInfoSchemaExpired = terror.ClassDomain.New(mysql.ErrInfoSchemaExpired, mysql.MySQLErrName[mysql.ErrInfoSchemaExpired]) // ErrInfoSchemaChanged returns the error that information schema is changed. - ErrInfoSchemaChanged = terror.ClassDomain.New(codeInfoSchemaChanged, - "Information schema is changed. "+kv.TxnRetryableMark) + ErrInfoSchemaChanged = terror.ClassDomain.New(mysql.ErrInfoSchemaChanged, + mysql.MySQLErrName[mysql.ErrInfoSchemaChanged] + ". " +kv.TxnRetryableMark) ) func init() { diff --git a/go.mod b/go.mod index 3ab46c5d3d94e..e8b365ff36a38 100644 --- a/go.mod +++ b/go.mod @@ -77,3 +77,5 @@ require ( replace github.com/google/pprof => github.com/lonng/pprof v0.0.0-20191012154247-04dfd648ce8d go 1.13 + +replace github.com/pingcap/parser => github.com/bb7133/parser v0.0.0-20191030103444-d9198ce3783a diff --git a/go.sum b/go.sum index 230e91d433a03..6e687457f959b 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,8 @@ github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f h1:5ZfJxyXo8KyX8 github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/bb7133/parser v0.0.0-20191030103444-d9198ce3783a h1:YjAuzHZxNY9XWGMTJ0zQKKRHF4KpEkhbIP2AFX6kM7Y= +github.com/bb7133/parser v0.0.0-20191030103444-d9198ce3783a/go.mod h1:Vavbz+Ti/y+IQGXwsgGMHASfCyvH4A6zVQspCFBuRXM= 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/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= From 871f0568e81adbf74b4a0cded3ced6ed27a0f387 Mon Sep 17 00:00:00 2001 From: bb7133 Date: Wed, 30 Oct 2019 22:17:23 +0800 Subject: [PATCH 2/7] fix style --- domain/domain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/domain/domain.go b/domain/domain.go index 4cb53e38efeaf..a32c701fb8a7b 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -1118,7 +1118,7 @@ var ( ErrInfoSchemaExpired = terror.ClassDomain.New(mysql.ErrInfoSchemaExpired, mysql.MySQLErrName[mysql.ErrInfoSchemaExpired]) // ErrInfoSchemaChanged returns the error that information schema is changed. ErrInfoSchemaChanged = terror.ClassDomain.New(mysql.ErrInfoSchemaChanged, - mysql.MySQLErrName[mysql.ErrInfoSchemaChanged] + ". " +kv.TxnRetryableMark) + mysql.MySQLErrName[mysql.ErrInfoSchemaChanged]+". "+kv.TxnRetryableMark) ) func init() { From d8851538507bbcc7208faf544210f78e0725c3c2 Mon Sep 17 00:00:00 2001 From: bb7133 Date: Thu, 31 Oct 2019 10:27:01 +0800 Subject: [PATCH 3/7] update go.mod/go.sum --- go.mod | 6 ++---- go.sum | 16 ++++++++-------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index e8b365ff36a38..2287edcd4261d 100644 --- a/go.mod +++ b/go.mod @@ -38,7 +38,7 @@ require ( github.com/pingcap/goleveldb v0.0.0-20171020122428-b9ff6c35079e github.com/pingcap/kvproto v0.0.0-20191104103048-40f562012fb1 github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9 - github.com/pingcap/parser v0.0.0-20191031081038-bfb0c3adf567 + github.com/pingcap/parser v0.0.0-20191031022456-8839bb565f94 github.com/pingcap/pd v1.1.0-beta.0.20190923032047-5c648dc365e0 github.com/pingcap/tidb-tools v3.0.6-0.20191106033616-90632dda3863+incompatible github.com/pingcap/tipb v0.0.0-20191105120856-bd4b782c8393 @@ -48,7 +48,7 @@ require ( github.com/shirou/gopsutil v2.18.10+incompatible github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371 // indirect github.com/shurcooL/vfsgen v0.0.0-20181020040650-a97a25d856ca // indirect - github.com/sirupsen/logrus v1.2.0 + github.com/sirupsen/logrus v1.4.2 github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 github.com/struCoder/pidusage v0.1.2 github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 @@ -77,5 +77,3 @@ require ( replace github.com/google/pprof => github.com/lonng/pprof v0.0.0-20191012154247-04dfd648ce8d go 1.13 - -replace github.com/pingcap/parser => github.com/bb7133/parser v0.0.0-20191030103444-d9198ce3783a diff --git a/go.sum b/go.sum index 6e687457f959b..9ae88b3e7ccdc 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,6 @@ github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f h1:5ZfJxyXo8KyX8 github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/bb7133/parser v0.0.0-20191030103444-d9198ce3783a h1:YjAuzHZxNY9XWGMTJ0zQKKRHF4KpEkhbIP2AFX6kM7Y= -github.com/bb7133/parser v0.0.0-20191030103444-d9198ce3783a/go.mod h1:Vavbz+Ti/y+IQGXwsgGMHASfCyvH4A6zVQspCFBuRXM= 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/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= @@ -193,8 +191,8 @@ github.com/pingcap/kvproto v0.0.0-20191104103048-40f562012fb1/go.mod h1:WWLmULLO github.com/pingcap/log v0.0.0-20190715063458-479153f07ebd/go.mod h1:WpHUKhNZ18v116SvGrmjkA9CBhYmuUTKL+p8JC9ANEw= github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9 h1:AJD9pZYm72vMgPcQDww9rkZ1DnWfl0pXV3BOWlkYIjA= github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= -github.com/pingcap/parser v0.0.0-20191031081038-bfb0c3adf567 h1:Ge5Vt+44xJkb2DZwrdyoD+qMclm1Sq5bWyCc6mW7GpI= -github.com/pingcap/parser v0.0.0-20191031081038-bfb0c3adf567/go.mod h1:1FNvfp9+J0wvc4kl8eGNh7Rqrxveg15jJoWo/a0uHwA= +github.com/pingcap/parser v0.0.0-20191031022456-8839bb565f94 h1:ecYu0tOk0OtcuMp9PBkqEGZok+dEFOHAg6OQAXLKtII= +github.com/pingcap/parser v0.0.0-20191031022456-8839bb565f94/go.mod h1:1FNvfp9+J0wvc4kl8eGNh7Rqrxveg15jJoWo/a0uHwA= github.com/pingcap/pd v1.1.0-beta.0.20190923032047-5c648dc365e0 h1:GIEq+wZfrl2bcJxpuSrEH4H7/nlf5YdmpS+dU9lNIt8= github.com/pingcap/pd v1.1.0-beta.0.20190923032047-5c648dc365e0/go.mod h1:G/6rJpnYwM0LKMec2rI82/5Kg6GaZMvlfB+e6/tvYmI= github.com/pingcap/tidb-tools v3.0.6-0.20191106033616-90632dda3863+incompatible h1:H1jg0aDWz2SLRh3hNBo2HFtnuHtudIUvBumU7syRkic= @@ -236,8 +234,8 @@ github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJ github.com/shurcooL/vfsgen v0.0.0-20181020040650-a97a25d856ca h1:3fECS8atRjByijiI8yYiuwLwQ2ZxXobW7ua/8GRB3pI= github.com/shurcooL/vfsgen v0.0.0-20181020040650-a97a25d856ca/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= 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= @@ -294,7 +292,6 @@ go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180608092829-8ac0e0d97ce4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf h1:fnPsqIDRbCSgumaMCRpoIoF2s4qxv0xSSS0BVZUE/ss= @@ -322,13 +319,16 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +<<<<<<< HEAD golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +======= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +>>>>>>> update go.mod/go.sum golang.org/x/sys v0.0.0-20190909082730-f460065e899a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From e288828064e3df6455393dcb9f0f0d25aaf769ee Mon Sep 17 00:00:00 2001 From: bb7133 Date: Mon, 4 Nov 2019 19:58:44 +0800 Subject: [PATCH 4/7] fix CI --- ddl/failtest/fail_db_test.go | 2 +- domain/domain.go | 6 +++++- go.mod | 2 +- go.sum | 10 ++++------ 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ddl/failtest/fail_db_test.go b/ddl/failtest/fail_db_test.go index fbf4ee15f784a..487be5434f812 100644 --- a/ddl/failtest/fail_db_test.go +++ b/ddl/failtest/fail_db_test.go @@ -263,7 +263,7 @@ func (s *testFailDBSuite) TestFailSchemaSyncer(c *C) { c.Assert(s.dom.SchemaValidator.IsStarted(), IsFalse) _, err := tk.Exec("insert into t values(1)") c.Assert(err, NotNil) - c.Assert(err.Error(), Equals, "[domain:1]Information schema is out of date.") + c.Assert(err.Error(), Equals, "[domain:8027]Information schema is out of date: schema failed to update in 1 lease, please make sure TiDB can connect to TiKV") c.Assert(failpoint.Disable("github.com/pingcap/tidb/domain/ErrorMockReloadFailed"), IsNil) // wait the schemaValidator is started. for i := 0; i < 50; i++ { diff --git a/domain/domain.go b/domain/domain.go index a32c701fb8a7b..4f46f4562b483 100644 --- a/domain/domain.go +++ b/domain/domain.go @@ -1123,5 +1123,9 @@ var ( func init() { // Map error codes to mysql error codes. - terror.ErrClassToMySQLCodes[terror.ClassDomain] = make(map[terror.ErrCode]uint16) + domainMySQLErrCodes := map[terror.ErrCode]uint16{ + mysql.ErrInfoSchemaExpired: mysql.ErrInfoSchemaExpired, + mysql.ErrInfoSchemaChanged: mysql.ErrInfoSchemaChanged, + } + terror.ErrClassToMySQLCodes[terror.ClassDomain] = domainMySQLErrCodes } diff --git a/go.mod b/go.mod index 2287edcd4261d..108aa7265ba26 100644 --- a/go.mod +++ b/go.mod @@ -48,7 +48,7 @@ require ( github.com/shirou/gopsutil v2.18.10+incompatible github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371 // indirect github.com/shurcooL/vfsgen v0.0.0-20181020040650-a97a25d856ca // indirect - github.com/sirupsen/logrus v1.4.2 + github.com/sirupsen/logrus v1.2.0 github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 github.com/struCoder/pidusage v0.1.2 github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 diff --git a/go.sum b/go.sum index 9ae88b3e7ccdc..60875e6a3413f 100644 --- a/go.sum +++ b/go.sum @@ -234,8 +234,8 @@ github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJ github.com/shurcooL/vfsgen v0.0.0-20181020040650-a97a25d856ca h1:3fECS8atRjByijiI8yYiuwLwQ2ZxXobW7ua/8GRB3pI= github.com/shurcooL/vfsgen v0.0.0-20181020040650-a97a25d856ca/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/sirupsen/logrus v1.0.5/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= -github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo= +github.com/sirupsen/logrus v1.2.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= @@ -292,6 +292,7 @@ go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180608092829-8ac0e0d97ce4/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191029031824-8986dd9e96cf h1:fnPsqIDRbCSgumaMCRpoIoF2s4qxv0xSSS0BVZUE/ss= @@ -319,16 +320,13 @@ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -<<<<<<< HEAD golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -======= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= ->>>>>>> update go.mod/go.sum golang.org/x/sys v0.0.0-20190909082730-f460065e899a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191010194322-b09406accb47 h1:/XfQ9z7ib8eEJX2hdgFTZJ/ntt0swNk5oYBziWeTCvY= golang.org/x/sys v0.0.0-20191010194322-b09406accb47/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From ce9f7b4d9313617626d02d931a51693873026866 Mon Sep 17 00:00:00 2001 From: bb7133 Date: Thu, 7 Nov 2019 20:15:02 +0800 Subject: [PATCH 5/7] update errorcode test --- domain/domain_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/domain/domain_test.go b/domain/domain_test.go index 294a4b389160c..3a88d2c2d289a 100644 --- a/domain/domain_test.go +++ b/domain/domain_test.go @@ -422,6 +422,6 @@ func (*testSuite) TestSessionPool(c *C) { } func (*testSuite) TestErrorCode(c *C) { - c.Assert(int(ErrInfoSchemaExpired.ToSQLError().Code), Equals, mysql.ErrUnknown) - c.Assert(int(ErrInfoSchemaChanged.ToSQLError().Code), Equals, mysql.ErrUnknown) + c.Assert(int(ErrInfoSchemaExpired.ToSQLError().Code), Equals, mysql.ErrInfoSchemaExpired) + c.Assert(int(ErrInfoSchemaChanged.ToSQLError().Code), Equals, mysql.ErrInfoSchemaChanged) } From 964efa3e7e5c04847f3b0296784daecf4aa4b024 Mon Sep 17 00:00:00 2001 From: bb7133 Date: Fri, 8 Nov 2019 00:47:52 +0800 Subject: [PATCH 6/7] update go.mod/go.sum --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 108aa7265ba26..a7061f90cd798 100644 --- a/go.mod +++ b/go.mod @@ -38,7 +38,7 @@ require ( github.com/pingcap/goleveldb v0.0.0-20171020122428-b9ff6c35079e github.com/pingcap/kvproto v0.0.0-20191104103048-40f562012fb1 github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9 - github.com/pingcap/parser v0.0.0-20191031022456-8839bb565f94 + github.com/pingcap/parser v0.0.0-20191107084102-68af6554dec7 github.com/pingcap/pd v1.1.0-beta.0.20190923032047-5c648dc365e0 github.com/pingcap/tidb-tools v3.0.6-0.20191106033616-90632dda3863+incompatible github.com/pingcap/tipb v0.0.0-20191105120856-bd4b782c8393 diff --git a/go.sum b/go.sum index 60875e6a3413f..5a920719b1c2a 100644 --- a/go.sum +++ b/go.sum @@ -191,8 +191,8 @@ github.com/pingcap/kvproto v0.0.0-20191104103048-40f562012fb1/go.mod h1:WWLmULLO github.com/pingcap/log v0.0.0-20190715063458-479153f07ebd/go.mod h1:WpHUKhNZ18v116SvGrmjkA9CBhYmuUTKL+p8JC9ANEw= github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9 h1:AJD9pZYm72vMgPcQDww9rkZ1DnWfl0pXV3BOWlkYIjA= github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= -github.com/pingcap/parser v0.0.0-20191031022456-8839bb565f94 h1:ecYu0tOk0OtcuMp9PBkqEGZok+dEFOHAg6OQAXLKtII= -github.com/pingcap/parser v0.0.0-20191031022456-8839bb565f94/go.mod h1:1FNvfp9+J0wvc4kl8eGNh7Rqrxveg15jJoWo/a0uHwA= +github.com/pingcap/parser v0.0.0-20191107084102-68af6554dec7 h1:vjPDsANQmfb+RHVfQvqzb/xpzkQhFdICUEjtA8XvAYw= +github.com/pingcap/parser v0.0.0-20191107084102-68af6554dec7/go.mod h1:1FNvfp9+J0wvc4kl8eGNh7Rqrxveg15jJoWo/a0uHwA= github.com/pingcap/pd v1.1.0-beta.0.20190923032047-5c648dc365e0 h1:GIEq+wZfrl2bcJxpuSrEH4H7/nlf5YdmpS+dU9lNIt8= github.com/pingcap/pd v1.1.0-beta.0.20190923032047-5c648dc365e0/go.mod h1:G/6rJpnYwM0LKMec2rI82/5Kg6GaZMvlfB+e6/tvYmI= github.com/pingcap/tidb-tools v3.0.6-0.20191106033616-90632dda3863+incompatible h1:H1jg0aDWz2SLRh3hNBo2HFtnuHtudIUvBumU7syRkic= From 6432c472a8995e5de2b18daab8f7a15e786afa7d Mon Sep 17 00:00:00 2001 From: bb7133 Date: Fri, 8 Nov 2019 12:24:57 +0800 Subject: [PATCH 7/7] address comment --- server/server_test.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/server/server_test.go b/server/server_test.go index 66bc0892f561d..0156986fe5ee7 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -790,21 +790,21 @@ func runTestErrorCode(c *C) { checkErrorCode(c, err, tmysql.ErrNoSuchTable) _, err = txn2.Exec("create database test;") // Make tests stable. Some times the error may be the ErrInfoSchemaChanged. - checkErrorCode(c, err, tmysql.ErrDBCreateExists, tmysql.ErrUnknown) + checkErrorCode(c, err, tmysql.ErrDBCreateExists, tmysql.ErrInfoSchemaChanged) _, err = txn2.Exec("create database aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;") - checkErrorCode(c, err, tmysql.ErrTooLongIdent, tmysql.ErrUnknown) + checkErrorCode(c, err, tmysql.ErrTooLongIdent, tmysql.ErrInfoSchemaChanged) _, err = txn2.Exec("create table test (c int);") - checkErrorCode(c, err, tmysql.ErrTableExists, tmysql.ErrUnknown) + checkErrorCode(c, err, tmysql.ErrTableExists, tmysql.ErrInfoSchemaChanged) _, err = txn2.Exec("drop table unknown_table;") - checkErrorCode(c, err, tmysql.ErrBadTable, tmysql.ErrUnknown) + checkErrorCode(c, err, tmysql.ErrBadTable, tmysql.ErrInfoSchemaChanged) _, err = txn2.Exec("drop database unknown_db;") - checkErrorCode(c, err, tmysql.ErrDBDropExists, tmysql.ErrUnknown) + checkErrorCode(c, err, tmysql.ErrDBDropExists, tmysql.ErrInfoSchemaChanged) _, err = txn2.Exec("create table aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (a int);") - checkErrorCode(c, err, tmysql.ErrTooLongIdent, tmysql.ErrUnknown) + checkErrorCode(c, err, tmysql.ErrTooLongIdent, tmysql.ErrInfoSchemaChanged) _, err = txn2.Exec("create table long_column_table (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);") - checkErrorCode(c, err, tmysql.ErrTooLongIdent, tmysql.ErrUnknown) + checkErrorCode(c, err, tmysql.ErrTooLongIdent, tmysql.ErrInfoSchemaChanged) _, err = txn2.Exec("alter table test add aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int;") - checkErrorCode(c, err, tmysql.ErrTooLongIdent, tmysql.ErrUnknown) + checkErrorCode(c, err, tmysql.ErrTooLongIdent, tmysql.ErrInfoSchemaChanged) // Optimizer errors _, err = txn2.Exec("select *, * from test;")