diff --git a/build.sh b/build.sh index 6efa2d4..9f47898 100755 --- a/build.sh +++ b/build.sh @@ -18,7 +18,7 @@ function build { GOOS=$3 GOARCH=$4 - if ! go version | egrep -q 'go(1\.1[56])' ; then + if ! go version | egrep -q 'go1\.(1[5-9]|[2-9][0-9]{1})' ; then echo "go version must be 1.15 or above" exit 1 fi @@ -40,8 +40,9 @@ function build { builddir=$(setuptree) cp $buildpath/$target $builddir/gh-ost/usr/bin cd $buildpath - fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m 'shlomi-noach ' --description "GitHub's Online Schema Migrations for MySQL " --url "https://github.com/github/gh-ost" --vendor "GitHub" --license "Apache 2.0" -C $builddir/gh-ost --prefix=/ -t rpm --rpm-rpmbuild-define "_build_id_links none" . - fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m 'shlomi-noach ' --description "GitHub's Online Schema Migrations for MySQL " --url "https://github.com/github/gh-ost" --vendor "GitHub" --license "Apache 2.0" -C $builddir/gh-ost --prefix=/ -t deb --deb-no-default-config-files . + fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m 'GitHub' --description "GitHub's Online Schema Migrations for MySQL " --url "https://github.com/github/gh-ost" --vendor "GitHub" --license "Apache 2.0" -C $builddir/gh-ost --prefix=/ -t rpm --rpm-rpmbuild-define "_build_id_links none" . + fpm -v "${RELEASE_VERSION}" --epoch 1 -f -s dir -n gh-ost -m 'GitHub' --description "GitHub's Online Schema Migrations for MySQL " --url "https://github.com/github/gh-ost" --vendor "GitHub" --license "Apache 2.0" -C $builddir/gh-ost --prefix=/ -t deb --deb-no-default-config-files . + cd - fi } @@ -62,10 +63,13 @@ main() { mkdir -p ${buildpath} rm -rf ${buildpath:?}/* build GNU/Linux linux linux amd64 - # build macOS osx darwin amd64 + build macOS osx darwin amd64 echo "Binaries found in:" find $buildpath/gh-ost* -type f -maxdepth 1 + + echo "Checksums:" + (cd $buildpath && shasum -a256 gh-ost* 2>/dev/null) } main "$@" diff --git a/doc/command-line-flags.md b/doc/command-line-flags.md index 62d3d11..417255a 100644 --- a/doc/command-line-flags.md +++ b/doc/command-line-flags.md @@ -22,7 +22,7 @@ If, for some reason, you do not wish `gh-ost` to connect to a replica, you may c ### approve-renamed-columns -When your migration issues a column rename (`change column old_name new_name ...`) `gh-ost` analyzes the statement to try and associate the old column name with new column name. Otherwise the new structure may also look like some column was dropped and another was added. +When your migration issues a column rename (`change column old_name new_name ...`) `gh-ost` analyzes the statement to try and associate the old column name with new column name. Otherwise, the new structure may also look like some column was dropped and another was added. `gh-ost` will print out what it thinks the _rename_ implied, but will not issue the migration unless you provide with `--approve-renamed-columns`. @@ -32,7 +32,7 @@ If you think `gh-ost` is mistaken and that there's actually no _rename_ involved `gh-ost` infers the identity of the master server by crawling up the replication topology. You may explicitly tell `gh-ost` the identity of the master host via `--assume-master-host=the.master.com`. This is useful in: -- _master-master_ topologies (together with [`--allow-master-master`](#allow-master-master)), where `gh-ost` can arbitrarily pick one of the co-masters and you prefer that it picks a specific one +- _master-master_ topologies (together with [`--allow-master-master`](#allow-master-master)), where `gh-ost` can arbitrarily pick one of the co-masters, and you prefer that it picks a specific one - _tungsten replicator_ topologies (together with [`--tungsten`](#tungsten)), where `gh-ost` is unable to crawl and detect the master ### assume-rbr @@ -61,7 +61,13 @@ Comma delimited status-name=threshold, same format as [`--max-load`](#max-load). `--critical-load` defines a threshold that, when met, `gh-ost` panics and bails out. The default behavior is to bail out immediately when meeting this threshold. -This may sometimes lead to migrations bailing out on a very short spike, that, while in itself is impacting production and is worth investigating, isn't reason enough to kill a 10 hour migration. +This may sometimes lead to migrations bailing out on a very short spike, that, while in itself is impacting production and is worth investigating, isn't reason enough to kill a 10-hour migration. + +### critical-load-hibernate-seconds + +When `--critical-load-hibernate-seconds` is non-zero (e.g. `--critical-load-hibernate-seconds=300`), `critical-load` does not panic and bail out; instead, `gh-ost` goes into hibernation for the specified duration. It will not read/write anything from/to any server during this time. Execution then continues upon waking from hibernation. + +If `critical-load` is met again, `gh-ost` will repeat this cycle, and never panic and bail out. ### critical-load-interval-millis @@ -98,7 +104,7 @@ Noteworthy is that setting `--dml-batch-size` to higher value _does not_ mean `g ### exact-rowcount -A `gh-ost` execution need to copy whatever rows you have in your existing table onto the ghost table. This can, and often be, a large number. Exactly what that number is? +A `gh-ost` execution need to copy whatever rows you have in your existing table onto the ghost table. This can and often will be, a large number. Exactly what that number is? `gh-ost` initially estimates the number of rows in your table by issuing an `explain select * from your_table`. This will use statistics on your table and return with a rough estimate. How rough? It might go as low as half or as high as double the actual number of rows in your table. This is the same method as used in [`pt-online-schema-change`](https://www.percona.com/doc/percona-toolkit/2.2/pt-online-schema-change.html). `gh-ost` also supports the `--exact-rowcount` flag. When this flag is given, two things happen: @@ -135,6 +141,10 @@ Add this flag when executing on a 1st generation Google Cloud Platform (GCP). Default 100. See [`subsecond-lag`](subsecond-lag.md) for details. +### hooks-status-interval + +Defaults to 60 seconds. Configures how often the `gh-ost-on-status` hook is called, see [`hooks`](hooks.md) for full details on how to use hooks. + ### initially-drop-ghost-table `gh-ost` maintains two tables while migrating: the _ghost_ table (which is synced from your original table and finally replaces it) and a changelog table, which is used internally for bookkeeping. By default, it panics and aborts if it sees those tables upon startup. Provide `--initially-drop-ghost-table` and `--initially-drop-old-table` to let `gh-ost` know it's OK to drop them beforehand. @@ -230,7 +240,7 @@ Provide a command delimited list of replicas; `gh-ost` will throttle when any of ### throttle-http -Provide a HTTP endpoint; `gh-ost` will issue `HEAD` requests on given URL and throttle whenever response status code is not `200`. The URL can be queried and updated dynamically via [interactive commands](interactive-commands.md). Empty URL disables the HTTP check. +Provide an HTTP endpoint; `gh-ost` will issue `HEAD` requests on given URL and throttle whenever response status code is not `200`. The URL can be queried and updated dynamically via [interactive commands](interactive-commands.md). Empty URL disables the HTTP check. ### timestamp-old-table diff --git a/doc/hooks.md b/doc/hooks.md index 91e1311..c1fe594 100644 --- a/doc/hooks.md +++ b/doc/hooks.md @@ -68,6 +68,7 @@ The following variables are available on all hooks: - `GH_OST_INSPECTED_LAG` - lag in seconds (floating point) of inspected server - `GH_OST_HEARTBEAT_LAG` - lag in seconds (floating point) of heartbeat - `GH_OST_PROGRESS` - progress pct ([0..100], floating point) of migration +- `GH_OST_ETA_SECONDS` - estimated duration until migration finishes in seconds - `GH_OST_MIGRATED_HOST` - `GH_OST_INSPECTED_HOST` - `GH_OST_EXECUTING_HOST` diff --git a/doc/triggerless-design.md b/doc/triggerless-design.md index 510a301..10a4203 100644 --- a/doc/triggerless-design.md +++ b/doc/triggerless-design.md @@ -112,7 +112,7 @@ It is also interesting to observe that `gh-ost` is the only application writing When `gh-ost` pauses (throttles), it issues no writes on the ghost table. Because there are no triggers, write workload is decoupled from the `gh-ost` write workload. And because we're using an asynchronous approach, the algorithm already handles a time difference between a master write time and the ghost apply time. A difference of a few microseconds is no different from a difference of minutes or hours. -When `gh-ost` [throttles](throttle.md), either by replication lag, `max-load` setting or and explicit [interactive user command](interactive-commands.md), the master is back to normal. It sees no more writes on the ghost table. +When `gh-ost` [throttles](throttle.md), either by replication lag, `max-load` setting or an explicit [interactive user command](interactive-commands.md), the master is back to normal. It sees no more writes on the ghost table. An exception is the ongoing heartbeat writes onto the changelog table, which we consider to be negligible. #### Testability diff --git a/go.mod b/go.mod index 7ae7172..4fe45a4 100644 --- a/go.mod +++ b/go.mod @@ -4,15 +4,14 @@ go 1.16 require ( github.com/go-ini/ini v1.62.0 - github.com/go-sql-driver/mysql v1.5.0 + github.com/go-mysql-org/go-mysql v1.3.0 + github.com/go-sql-driver/mysql v1.6.0 github.com/openark/golib v0.0.0-20210531070646-355f37940af8 - github.com/pkg/errors v0.9.1 // indirect github.com/satori/go.uuid v1.2.0 - github.com/siddontang/go-mysql v1.1.0 github.com/smartystreets/goconvey v1.6.4 // indirect golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 golang.org/x/net v0.0.0-20210224082022-3d97a244fca7 - golang.org/x/text v0.3.5 + golang.org/x/text v0.3.6 gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/ini.v1 v1.62.0 // indirect ) diff --git a/go.sum b/go.sum index e169413..cf570fa 100644 --- a/go.sum +++ b/go.sum @@ -1,32 +1,54 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/cznic/golex v0.0.0-20181122101858-9c343928389c/go.mod h1:+bmmJDNmKlhWNG+gwWCkaBoTy39Fs+bzRxVBzoTQbIc= +github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= +github.com/cznic/parser v0.0.0-20160622100904-31edd927e5b1/go.mod h1:2B43mz36vGZNZEwkWi8ayRSSUXLfjL8OkbzwW4NcPMM= +github.com/cznic/sortutil v0.0.0-20181122101858-f5f958428db8/go.mod h1:q2w6Bg5jeox1B+QkJ6Wp/+Vn0G/bo3f1uY7Fn3vivIQ= +github.com/cznic/strutil v0.0.0-20171016134553-529a34b1c186/go.mod h1:AHHPPPXTw0h6pVabbcbyGRK1DckRn7r/STdZEeIDzZc= +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/go-ini/ini v1.62.0 h1:7VJT/ZXjzqSrvtraFp4ONq80hTcRQth1c9ZnQ3uNQvU= github.com/go-ini/ini v1.62.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= +github.com/go-mysql-org/go-mysql v1.3.0 h1:lpNqkwdPzIrYSZGdqt8HIgAXZaK6VxBNfr8f7Z4FgGg= +github.com/go-mysql-org/go-mysql v1.3.0/go.mod h1:3lFZKf7l95Qo70+3XB2WpiSf9wu2s3na3geLMaIIrqQ= +github.com/go-sql-driver/mysql v1.3.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= +github.com/jmoiron/sqlx v1.3.3/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= +github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/openark/golib v0.0.0-20210531070646-355f37940af8 h1:9ciIHNuyFqRWi9NpMNw9sVLB6z1ItpP5ZhTY9Q1xVu4= github.com/openark/golib v0.0.0-20210531070646-355f37940af8/go.mod h1:1jj8x1eDVZxgc/Z4VyamX4qTbAdHPUQA6NeVtCd8Sl8= github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8 h1:USx2/E1bX46VG32FIw034Au6seQ2fY9NEILmNh/UlQg= github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8/go.mod h1:B1+S9LNcuMyLH/4HMTViQOJevkGiik3wW2AN9zb2fNQ= -github.com/pingcap/errors v0.11.0 h1:DCJQB8jrHbQ1VVlMFIrbj2ApScNNotVmkSNplu2yUt4= github.com/pingcap/errors v0.11.0/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= -github.com/pingcap/parser v0.0.0-20190506092653-e336082eb825/go.mod h1:1FNvfp9+J0wvc4kl8eGNh7Rqrxveg15jJoWo/a0uHwA= -github.com/pingcap/tipb v0.0.0-20190428032612-535e1abaa330/go.mod h1:RtkHW8WbcNxj8lsbzjaILci01CtYnYbIkQhjyZWrWVI= +github.com/pingcap/errors v0.11.5-0.20201029093017-5a7df2af2ac7/go.mod h1:G7x87le1poQzLB/TqvTJI2ILrSgobnq4Ut7luOwvfvI= +github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3 h1:LllgC9eGfqzkfubMgjKIDyZYaa609nNWAyNZtpy2B3M= +github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3/go.mod h1:G7x87le1poQzLB/TqvTJI2ILrSgobnq4Ut7luOwvfvI= +github.com/pingcap/log v0.0.0-20200511115504-543df19646ad/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= +github.com/pingcap/log v0.0.0-20210317133921-96f4fcab92a4/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= +github.com/pingcap/parser v0.0.0-20210415081931-48e7f467fd74/go.mod h1:xZC8I7bug4GJ5KtHhgAikjTfU4kBv1Sbo3Pf1MZ6lVw= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.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/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 h1:pntxY8Ary0t43dCZ5dqY4YTJCObLY1kIXl0uzMv+7DE= @@ -35,38 +57,76 @@ github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726 h1:xT+JlYxNGqyT+XcU8 github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= github.com/siddontang/go-log v0.0.0-20180807004314-8d05993dda07 h1:oI+RNwuC9jF2g2lP0u0cVEEZrc/AYBCuFdvwrLWM/6Q= github.com/siddontang/go-log v0.0.0-20180807004314-8d05993dda07/go.mod h1:yFdBgwXP24JziuRl2NMUahT7nGLNOKi1SIiFxMttVD4= -github.com/siddontang/go-mysql v1.1.0 h1:NfkS1skrPwUd3hsUqhc6jrv24dKTNMANxKRmDsf1fMc= -github.com/siddontang/go-mysql v1.1.0/go.mod h1:+W4RCzesQDI11HvIkaDjS8yM36SpAnGNQ7jmTLn5BnU= -github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= +go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 h1:/ZScEX8SfEmUGRHs0gxpqteO5nfNW6axyZbBdw9A12g= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210224082022-3d97a244fca7 h1:OgUuv8lsRpBibGNbSizVwKWlysjaNzmC9gYMhPVfqFM= golang.org/x/net v0.0.0-20210224082022-3d97a244fca7/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20201125231158-b5590deeca9b/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/ini.v1 v1.62.0 h1:duBzk771uxoUuOlyRLkHsygud9+5lrlGjdFBb4mSKDU= gopkg.in/ini.v1 v1.62.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= +gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= +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.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/go/base/context.go b/go/base/context.go index f8054d6..4378e6b 100644 --- a/go/base/context.go +++ b/go/base/context.go @@ -140,6 +140,7 @@ type MigrationContext struct { HooksHintMessage string HooksHintOwner string HooksHintToken string + HooksStatusIntervalSec int64 DropServeSocket bool ServeSocketFile string @@ -551,8 +552,8 @@ func (this *MigrationContext) SetMaxLagMillisecondsThrottleThreshold(maxLagMilli } func (this *MigrationContext) SetChunkSize(chunkSize int64) { - if chunkSize < 100 { - chunkSize = 100 + if chunkSize < 10 { + chunkSize = 10 } if chunkSize > 100000 { chunkSize = 100000 diff --git a/go/binlog/gomysql_reader.go b/go/binlog/gomysql_reader.go index bc80cb5..454b27a 100644 --- a/go/binlog/gomysql_reader.go +++ b/go/binlog/gomysql_reader.go @@ -1,5 +1,5 @@ /* - Copyright 2016 GitHub Inc. + Copyright 2021 GitHub Inc. See https://github.com/github/gh-ost/blob/master/LICENSE */ @@ -13,8 +13,8 @@ import ( "github.com/github/gh-ost/go/mysql" "github.com/github/gh-ost/go/sql" - gomysql "github.com/siddontang/go-mysql/mysql" - "github.com/siddontang/go-mysql/replication" + gomysql "github.com/go-mysql-org/go-mysql/mysql" + "github.com/go-mysql-org/go-mysql/replication" "golang.org/x/net/context" ) diff --git a/go/cmd/gh-ost/main.go b/go/cmd/gh-ost/main.go index 7b5af54..93d8fb9 100644 --- a/go/cmd/gh-ost/main.go +++ b/go/cmd/gh-ost/main.go @@ -8,6 +8,7 @@ package main import ( "flag" "fmt" + "net/url" "os" "os/signal" "syscall" @@ -98,7 +99,7 @@ func main() { flag.BoolVar(&migrationContext.AssumeRBR, "assume-rbr", false, "set to 'true' when you know for certain your server uses 'ROW' binlog_format. gh-ost is unable to tell, event after reading binlog_format, whether the replication process does indeed use 'ROW', and restarts replication to be certain RBR setting is applied. Such operation requires SUPER privileges which you might not have. Setting this flag avoids restarting replication and you can proceed to use gh-ost without SUPER privileges") flag.BoolVar(&migrationContext.CutOverExponentialBackoff, "cut-over-exponential-backoff", false, "Wait exponentially longer intervals between failed cut-over attempts. Wait intervals obey a maximum configurable with 'exponential-backoff-max-interval').") exponentialBackoffMaxInterval := flag.Int64("exponential-backoff-max-interval", 64, "Maximum number of seconds to wait between attempts when performing various operations with exponential backoff.") - chunkSize := flag.Int64("chunk-size", 1000, "amount of rows to handle in each iteration (allowed range: 100-100,000)") + chunkSize := flag.Int64("chunk-size", 1000, "amount of rows to handle in each iteration (allowed range: 10-100,000)") dmlBatchSize := flag.Int64("dml-batch-size", 10, "batch size for DML events to apply in a single transaction (range 1-100)") defaultRetries := flag.Int64("default-retries", 60, "Default number of retries for various operations before panicking") cutOverLockTimeoutSeconds := flag.Int64("cut-over-lock-timeout-seconds", 3, "Max number of seconds to hold locks on tables while attempting to cut-over (retry attempted when lock exceeds timeout)") @@ -124,13 +125,14 @@ func main() { flag.StringVar(&migrationContext.HooksHintMessage, "hooks-hint", "", "arbitrary message to be injected to hooks via GH_OST_HOOKS_HINT, for your convenience") flag.StringVar(&migrationContext.HooksHintOwner, "hooks-hint-owner", "", "arbitrary name of owner to be injected to hooks via GH_OST_HOOKS_HINT_OWNER, for your convenience") flag.StringVar(&migrationContext.HooksHintToken, "hooks-hint-token", "", "arbitrary token to be injected to hooks via GH_OST_HOOKS_HINT_TOKEN, for your convenience") + flag.Int64Var(&migrationContext.HooksStatusIntervalSec, "hooks-status-interval", 60, "how many seconds to wait between calling onStatus hook") flag.UintVar(&migrationContext.ReplicaServerId, "replica-server-id", 99999, "server id used by gh-ost process. Default: 99999") maxLoad := flag.String("max-load", "", "Comma delimited status-name=threshold. e.g: 'Threads_running=100,Threads_connected=500'. When status exceeds threshold, app throttles writes") criticalLoad := flag.String("critical-load", "", "Comma delimited status-name=threshold, same format as --max-load. When status exceeds threshold, app panics and quits") flag.Int64Var(&migrationContext.CriticalLoadIntervalMilliseconds, "critical-load-interval-millis", 0, "When 0, migration immediately bails out upon meeting critical-load. When non-zero, a second check is done after given interval, and migration only bails out if 2nd check still meets critical load") - flag.Int64Var(&migrationContext.CriticalLoadHibernateSeconds, "critical-load-hibernate-seconds", 0, "When nonzero, critical-load does not panic and bail out; instead, gh-ost goes into hibernate for the specified duration. It will not read/write anything to from/to any server") + flag.Int64Var(&migrationContext.CriticalLoadHibernateSeconds, "critical-load-hibernate-seconds", 0, "When non-zero, critical-load does not panic and bail out; instead, gh-ost goes into hibernation for the specified duration. It will not read/write anything from/to any server") quiet := flag.Bool("quiet", false, "quiet") verbose := flag.Bool("verbose", false, "verbose") debug := flag.Bool("debug", false, "debug mode (very verbose)") @@ -188,6 +190,11 @@ func main() { log.Fatalf("--database must be provided and database name must not be empty, or --alter must specify database name") } } + + if err := flag.Set("database", url.QueryEscape(migrationContext.DatabaseName)); err != nil { + migrationContext.Log.Fatale(err) + } + if migrationContext.OriginalTableName == "" { if parser.HasExplicitTable() { migrationContext.OriginalTableName = parser.GetExplicitTable() diff --git a/go/logic/migrator.go b/go/logic/migrator.go index c12c21f..ceb6e67 100644 --- a/go/logic/migrator.go +++ b/go/logic/migrator.go @@ -1016,7 +1016,7 @@ func (this *Migrator) printStatus(rule PrintStatusRule, writers ...io.Writer) { w := io.MultiWriter(writers...) fmt.Fprintln(w, status) - if elapsedSeconds%60 == 0 { + if elapsedSeconds%this.migrationContext.HooksStatusIntervalSec == 0 { this.hooksExecutor.onStatus(status) } } diff --git a/vendor/github.com/siddontang/go-mysql/LICENSE b/vendor/github.com/go-mysql-org/go-mysql/LICENSE similarity index 100% rename from vendor/github.com/siddontang/go-mysql/LICENSE rename to vendor/github.com/go-mysql-org/go-mysql/LICENSE diff --git a/vendor/github.com/siddontang/go-mysql/client/auth.go b/vendor/github.com/go-mysql-org/go-mysql/client/auth.go similarity index 96% rename from vendor/github.com/siddontang/go-mysql/client/auth.go rename to vendor/github.com/go-mysql-org/go-mysql/client/auth.go index 566d52d..01217f8 100644 --- a/vendor/github.com/siddontang/go-mysql/client/auth.go +++ b/vendor/github.com/go-mysql-org/go-mysql/client/auth.go @@ -6,9 +6,9 @@ import ( "encoding/binary" "fmt" + . "github.com/go-mysql-org/go-mysql/mysql" + "github.com/go-mysql-org/go-mysql/packet" "github.com/pingcap/errors" - . "github.com/siddontang/go-mysql/mysql" - "github.com/siddontang/go-mysql/packet" ) const defaultAuthPluginName = AUTH_NATIVE_PASSWORD @@ -46,7 +46,7 @@ func (c *Conn) readInitialHandshake() error { pos := 1 + bytes.IndexByte(data[1:], 0x00) + 1 // connection id length is 4 - c.connectionID = uint32(binary.LittleEndian.Uint32(data[pos : pos+4])) + c.connectionID = binary.LittleEndian.Uint32(data[pos : pos+4]) pos += 4 c.salt = []byte{} @@ -106,7 +106,7 @@ func (c *Conn) readInitialHandshake() error { // generate auth response data according to auth plugin // // NOTE: the returned boolean value indicates whether to add a \NUL to the end of data. -// it is quite tricky because MySQl server expects different formats of responses in different auth situations. +// it is quite tricky because MySQL server expects different formats of responses in different auth situations. // here the \NUL needs to be added when sending back the empty password or cleartext password in 'sha256_password' // authentication. func (c *Conn) genAuthResponse(authData []byte) ([]byte, bool, error) { @@ -199,7 +199,7 @@ func (c *Conn) writeAuthHandshake() error { // Charset [1 byte] // use default collation id 33 here, is utf-8 - data[12] = byte(DEFAULT_COLLATION_ID) + data[12] = DEFAULT_COLLATION_ID // SSL Connection Request Packet // http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::SSLRequest diff --git a/vendor/github.com/siddontang/go-mysql/client/conn.go b/vendor/github.com/go-mysql-org/go-mysql/client/conn.go similarity index 82% rename from vendor/github.com/siddontang/go-mysql/client/conn.go rename to vendor/github.com/go-mysql-org/go-mysql/client/conn.go index e26680f..1b37444 100644 --- a/vendor/github.com/siddontang/go-mysql/client/conn.go +++ b/vendor/github.com/go-mysql-org/go-mysql/client/conn.go @@ -7,9 +7,9 @@ import ( "strings" "time" + . "github.com/go-mysql-org/go-mysql/mysql" + "github.com/go-mysql-org/go-mysql/packet" "github.com/pingcap/errors" - . "github.com/siddontang/go-mysql/mysql" - "github.com/siddontang/go-mysql/packet" ) type Conn struct { @@ -33,6 +33,9 @@ type Conn struct { connectionID uint32 } +// This function will be called for every row in resultset from ExecuteSelectStreaming. +type SelectPerRowCallback func(row []FieldValue) error + func getNetProto(addr string) string { proto := "tcp" if strings.Contains(addr, "/") { @@ -165,6 +168,28 @@ func (c *Conn) Execute(command string, args ...interface{}) (*Result, error) { } } +// ExecuteSelectStreaming will call perRowCallback for every row in resultset +// WITHOUT saving any row data to Result.{Values/RawPkg/RowDatas} fields. +// +// ExecuteSelectStreaming should be used only for SELECT queries with a large response resultset for memory preserving. +// +// Example: +// +// var result mysql.Result +// conn.ExecuteSelectStreaming(`SELECT ... LIMIT 100500`, &result, func(row []mysql.FieldValue) error { +// // Use the row as you want. +// // You must not save FieldValue.AsString() value after this callback is done. Copy it if you need. +// return nil +// }) +// +func (c *Conn) ExecuteSelectStreaming(command string, result *Result, perRowCallback SelectPerRowCallback) error { + if err := c.writeCommandStr(COM_QUERY, command); err != nil { + return errors.Trace(err) + } + + return c.readResultStreaming(false, result, perRowCallback) +} + func (c *Conn) Begin() error { _, err := c.exec("BEGIN") return errors.Trace(err) diff --git a/vendor/github.com/go-mysql-org/go-mysql/client/pool.go b/vendor/github.com/go-mysql-org/go-mysql/client/pool.go new file mode 100644 index 0000000..c8c1f45 --- /dev/null +++ b/vendor/github.com/go-mysql-org/go-mysql/client/pool.go @@ -0,0 +1,476 @@ +package client + +import ( + "context" + "math" + "math/rand" + "sync" + "time" + + "github.com/pingcap/errors" +) + +/* +Pool for efficient reuse of connections. + +Usage: + pool := client.NewPool(log.Debugf, 100, 400, 5, `127.0.0.1:3306`, `username`, `userpwd`, `dbname`) + ... + conn, _ := pool.GetConn(ctx) + defer pool.PutConn(conn) + conn.Execute/conn.Begin/etc... +*/ + +type ( + Timestamp int64 + + LogFunc func(format string, args ...interface{}) + + Pool struct { + logFunc LogFunc + minAlive int + maxAlive int + maxIdle int + idleCloseTimeout Timestamp + idlePingTimeout Timestamp + connect func() (*Conn, error) + + synchro struct { + sync.Mutex + idleConnections []Connection + stats ConnectionStats + } + + readyConnection chan Connection + } + + ConnectionStats struct { + // Uses internally + TotalCount int + + // Only for stats + IdleCount int + CreatedCount int64 + } + + Connection struct { + conn *Conn + lastUseAt Timestamp + } +) + +var ( + // MaxIdleTimeoutWithoutPing - If the connection has been idle for more than this time, + // then ping will be performed before use to check if it alive + MaxIdleTimeoutWithoutPing = 10 * time.Second + + // DefaultIdleTimeout - If the connection has been idle for more than this time, + // we can close it (but we should remember about Pool.minAlive) + DefaultIdleTimeout = 30 * time.Second + + // MaxNewConnectionAtOnce - If we need to create new connections, + // then we will create no more than this number of connections at a time. + // This restriction will be ignored on pool initialization. + MaxNewConnectionAtOnce = 5 +) + +// NewPool initializes new connection pool and uses params: addr, user, password, dbName and options. +// minAlive specifies the minimum number of open connections that the pool will try to maintain. +// maxAlive specifies the maximum number of open connections +// (for internal reasons, may be greater by 1 inside newConnectionProducer). +// maxIdle specifies the maximum number of idle connections (see DefaultIdleTimeout). +func NewPool( + logFunc LogFunc, + minAlive int, + maxAlive int, + maxIdle int, + addr string, + user string, + password string, + dbName string, + options ...func(conn *Conn), +) *Pool { + if minAlive > maxAlive { + minAlive = maxAlive + } + if maxIdle > maxAlive { + maxIdle = maxAlive + } + if maxIdle <= minAlive { + maxIdle = minAlive + } + + pool := &Pool{ + logFunc: logFunc, + minAlive: minAlive, + maxAlive: maxAlive, + maxIdle: maxIdle, + + idleCloseTimeout: Timestamp(math.Ceil(DefaultIdleTimeout.Seconds())), + idlePingTimeout: Timestamp(math.Ceil(MaxIdleTimeoutWithoutPing.Seconds())), + + connect: func() (*Conn, error) { + return Connect(addr, user, password, dbName, options...) + }, + + readyConnection: make(chan Connection), + } + + pool.synchro.idleConnections = make([]Connection, 0, pool.maxIdle) + + go pool.newConnectionProducer() + + if pool.minAlive > 0 { + pool.logFunc(`Pool: Setup %d new connections (minimal pool size)...`, pool.minAlive) + pool.startNewConnections(pool.minAlive) + } + + go pool.closeOldIdleConnections() + + return pool +} + +func (pool *Pool) GetStats(stats *ConnectionStats) { + pool.synchro.Lock() + + *stats = pool.synchro.stats + + stats.IdleCount = len(pool.synchro.idleConnections) + + pool.synchro.Unlock() +} + +// GetConn returns connection from the pool or create new +func (pool *Pool) GetConn(ctx context.Context) (*Conn, error) { + for { + connection, err := pool.getConnection(ctx) + if err != nil { + return nil, err + } + + // For long time idle connections, we do a ping check + if delta := pool.nowTs() - connection.lastUseAt; delta > pool.idlePingTimeout { + if err := pool.ping(connection.conn); err != nil { + pool.closeConn(connection.conn) + continue + } + } + + return connection.conn, nil + } +} + +// PutConn returns working connection back to pool +func (pool *Pool) PutConn(conn *Conn) { + pool.putConnection(Connection{ + conn: conn, + lastUseAt: pool.nowTs(), + }) +} + +// DropConn closes the connection without any checks +func (pool *Pool) DropConn(conn *Conn) { + pool.closeConn(conn) +} + +func (pool *Pool) putConnection(connection Connection) { + pool.synchro.Lock() + defer pool.synchro.Unlock() + + // If someone is already waiting for a connection, then we return it to him + select { + case pool.readyConnection <- connection: + return + default: + } + + // Nobody needs this connection + + pool.putConnectionUnsafe(connection) +} + +func (pool *Pool) nowTs() Timestamp { + return Timestamp(time.Now().Unix()) +} + +func (pool *Pool) getConnection(ctx context.Context) (Connection, error) { + pool.synchro.Lock() + + connection := pool.getIdleConnectionUnsafe() + if connection.conn != nil { + pool.synchro.Unlock() + return connection, nil + } + pool.synchro.Unlock() + + // No idle connections are available + + select { + case connection := <-pool.readyConnection: + return connection, nil + + case <-ctx.Done(): + return Connection{}, ctx.Err() + } +} + +func (pool *Pool) putConnectionUnsafe(connection Connection) { + if len(pool.synchro.idleConnections) == cap(pool.synchro.idleConnections) { + pool.synchro.stats.TotalCount-- + _ = connection.conn.Close() // Could it be more effective to close older connections? + } else { + pool.synchro.idleConnections = append(pool.synchro.idleConnections, connection) + } +} + +func (pool *Pool) newConnectionProducer() { + var connection Connection + var err error + + for { + connection.conn = nil + + pool.synchro.Lock() + + connection = pool.getIdleConnectionUnsafe() + if connection.conn == nil { + if pool.synchro.stats.TotalCount >= pool.maxAlive { + // Can't create more connections + pool.synchro.Unlock() + time.Sleep(10 * time.Millisecond) + continue + } + pool.synchro.stats.TotalCount++ // "Reserving" new connection + } + + pool.synchro.Unlock() + + if connection.conn == nil { + connection, err = pool.createNewConnection() + if err != nil { + pool.synchro.Lock() + pool.synchro.stats.TotalCount-- // Bad luck, should try again + pool.synchro.Unlock() + + time.Sleep(time.Duration(10+rand.Intn(90)) * time.Millisecond) + continue + } + } + + pool.readyConnection <- connection + } +} + +func (pool *Pool) createNewConnection() (Connection, error) { + var connection Connection + var err error + + connection.conn, err = pool.connect() + if err != nil { + return Connection{}, errors.Errorf(`Could not connect to mysql: %s`, err) + } + connection.lastUseAt = pool.nowTs() + + pool.synchro.Lock() + pool.synchro.stats.CreatedCount++ + pool.synchro.Unlock() + + return connection, nil +} + +func (pool *Pool) getIdleConnectionUnsafe() Connection { + cnt := len(pool.synchro.idleConnections) + if cnt == 0 { + return Connection{} + } + + last := cnt - 1 + connection := pool.synchro.idleConnections[last] + pool.synchro.idleConnections[last].conn = nil + pool.synchro.idleConnections = pool.synchro.idleConnections[:last] + + return connection +} + +func (pool *Pool) closeOldIdleConnections() { + var toPing []Connection + + ticker := time.NewTicker(5 * time.Second) + + for range ticker.C { + toPing = pool.getOldIdleConnections(toPing[:0]) + if len(toPing) == 0 { + continue + } + pool.recheckConnections(toPing) + + if !pool.spawnConnectionsIfNeeded() { + pool.closeIdleConnectionsIfCan() + } + } +} + +func (pool *Pool) getOldIdleConnections(dst []Connection) []Connection { + dst = dst[:0] + + pool.synchro.Lock() + + synchro := &pool.synchro + + idleCnt := len(synchro.idleConnections) + checkBefore := pool.nowTs() - pool.idlePingTimeout + + for i := idleCnt - 1; i >= 0; i-- { + if synchro.idleConnections[i].lastUseAt > checkBefore { + continue + } + + dst = append(dst, synchro.idleConnections[i]) + + last := idleCnt - 1 + if i < last { + // Removing an item from the middle of a slice + synchro.idleConnections[i], synchro.idleConnections[last] = synchro.idleConnections[last], synchro.idleConnections[i] + } + + synchro.idleConnections[last].conn = nil + synchro.idleConnections = synchro.idleConnections[:last] + idleCnt-- + } + + pool.synchro.Unlock() + + return dst +} + +func (pool *Pool) recheckConnections(connections []Connection) { + const workerCnt = 2 // Heuristic :) + + queue := make(chan Connection, len(connections)) + for _, connection := range connections { + queue <- connection + } + close(queue) + + var wg sync.WaitGroup + wg.Add(workerCnt) + for worker := 0; worker < workerCnt; worker++ { + go func() { + defer wg.Done() + for connection := range queue { + if err := pool.ping(connection.conn); err != nil { + pool.closeConn(connection.conn) + } else { + pool.putConnection(connection) + } + } + }() + } + + wg.Wait() +} + +// spawnConnectionsIfNeeded creates new connections if there are not enough of them and returns true in this case +func (pool *Pool) spawnConnectionsIfNeeded() bool { + pool.synchro.Lock() + totalCount := pool.synchro.stats.TotalCount + idleCount := len(pool.synchro.idleConnections) + needSpanNew := pool.minAlive - totalCount + pool.synchro.Unlock() + + if needSpanNew <= 0 { + return false + } + + // Не хватает соединений, нужно создать еще + + if needSpanNew > MaxNewConnectionAtOnce { + needSpanNew = MaxNewConnectionAtOnce + } + + pool.logFunc(`Pool: Setup %d new connections (total: %d idle: %d)...`, needSpanNew, totalCount, idleCount) + pool.startNewConnections(needSpanNew) + + return true +} + +func (pool *Pool) closeIdleConnectionsIfCan() { + pool.synchro.Lock() + + canCloseCnt := pool.synchro.stats.TotalCount - pool.minAlive + canCloseCnt-- // -1 to account for an open but unused connection (pool.readyConnection <- connection in newConnectionProducer) + + idleCnt := len(pool.synchro.idleConnections) + + inFly := pool.synchro.stats.TotalCount - idleCnt + + // We can close no more than 10% connections at a time, but at least 1, if possible + idleCanCloseCnt := idleCnt / 10 + if idleCanCloseCnt == 0 { + idleCanCloseCnt = 1 + } + if canCloseCnt > idleCanCloseCnt { + canCloseCnt = idleCanCloseCnt + } + if canCloseCnt <= 0 { + pool.synchro.Unlock() + return + } + + closeFromIdx := idleCnt - canCloseCnt + if closeFromIdx < 0 { + // If there are enough requests in the "flight" now, then we can close all unnecessary + closeFromIdx = 0 + } + + toClose := append([]Connection{}, pool.synchro.idleConnections[closeFromIdx:]...) + + for i := closeFromIdx; i < idleCnt; i++ { + pool.synchro.idleConnections[i].conn = nil + } + pool.synchro.idleConnections = pool.synchro.idleConnections[:closeFromIdx] + + pool.synchro.Unlock() + + pool.logFunc(`Pool: Close %d idle connections (in fly %d)`, len(toClose), inFly) + for _, connection := range toClose { + pool.closeConn(connection.conn) + } +} + +func (pool *Pool) closeConn(conn *Conn) { + pool.synchro.Lock() + pool.synchro.stats.TotalCount-- + pool.synchro.Unlock() + + _ = conn.Close() // Closing is not an instant action, so do it outside the lock +} + +func (pool *Pool) startNewConnections(count int) { + connections := make([]Connection, 0, count) + for i := 0; i < count; i++ { + if conn, err := pool.createNewConnection(); err == nil { + pool.synchro.Lock() + pool.synchro.stats.TotalCount++ + pool.synchro.Unlock() + connections = append(connections, conn) + } + } + + pool.synchro.Lock() + for _, connection := range connections { + pool.putConnectionUnsafe(connection) + } + pool.synchro.Unlock() +} + +func (pool *Pool) ping(conn *Conn) error { + deadline := time.Now().Add(100 * time.Millisecond) + _ = conn.SetWriteDeadline(deadline) + _ = conn.SetReadDeadline(deadline) + err := conn.Ping() + if err != nil { + pool.logFunc(`Pool: ping query fail: %s`, err.Error()) + } + return err +} diff --git a/vendor/github.com/siddontang/go-mysql/client/req.go b/vendor/github.com/go-mysql-org/go-mysql/client/req.go similarity index 96% rename from vendor/github.com/siddontang/go-mysql/client/req.go rename to vendor/github.com/go-mysql-org/go-mysql/client/req.go index 87ad506..df3cee2 100644 --- a/vendor/github.com/siddontang/go-mysql/client/req.go +++ b/vendor/github.com/go-mysql-org/go-mysql/client/req.go @@ -1,7 +1,7 @@ package client import ( - "github.com/siddontang/go-mysql/utils" + "github.com/go-mysql-org/go-mysql/utils" ) func (c *Conn) writeCommand(command byte) error { diff --git a/vendor/github.com/siddontang/go-mysql/client/resp.go b/vendor/github.com/go-mysql-org/go-mysql/client/resp.go similarity index 73% rename from vendor/github.com/siddontang/go-mysql/client/resp.go rename to vendor/github.com/go-mysql-org/go-mysql/client/resp.go index 712f069..cc94414 100644 --- a/vendor/github.com/siddontang/go-mysql/client/resp.go +++ b/vendor/github.com/go-mysql-org/go-mysql/client/resp.go @@ -7,9 +7,9 @@ import ( "encoding/binary" "encoding/pem" + . "github.com/go-mysql-org/go-mysql/mysql" + "github.com/go-mysql-org/go-mysql/utils" "github.com/pingcap/errors" - . "github.com/siddontang/go-mysql/mysql" - "github.com/siddontang/go-mysql/utils" "github.com/siddontang/go/hack" ) @@ -39,7 +39,7 @@ func (c *Conn) handleOKPacket(data []byte) (*Result, error) { var n int var pos = 1 - r := new(Result) + r := &Result{Resultset: &Resultset{}} r.AffectedRows, _, n = LengthEncodedInt(data[pos:]) pos += n @@ -101,6 +101,10 @@ func (c *Conn) handleAuthResult() error { } c.authPluginName = switchToPlugin auth, addNull, err := c.genAuthResponse(data) + if err != nil { + return err + } + if err = c.WriteAuthSwitchPacket(auth, addNull); err != nil { return err } @@ -138,7 +142,7 @@ func (c *Conn) handleAuthResult() error { } } } else { - errors.Errorf("invalid packet") + return errors.Errorf("invalid packet %x", data[0]) } } else if c.authPluginName == AUTH_SHA256_PASSWORD { if len(data) == 0 { @@ -169,7 +173,6 @@ func (c *Conn) readAuthResult() ([]byte, string, error) { // see: https://insidemysql.com/preparing-your-community-connector-for-mysql-8-part-2-sha256/ // packet indicator switch data[0] { - case OK_HEADER: _, err := c.handleOKPacket(data) return nil, "", err @@ -230,6 +233,42 @@ func (c *Conn) readResult(binary bool) (*Result, error) { return c.readResultset(firstPkgBuf, binary) } +func (c *Conn) readResultStreaming(binary bool, result *Result, perRowCb SelectPerRowCallback) error { + firstPkgBuf, err := c.ReadPacketReuseMem(utils.ByteSliceGet(16)[:0]) + defer utils.ByteSlicePut(firstPkgBuf) + + if err != nil { + return errors.Trace(err) + } + + if firstPkgBuf[0] == OK_HEADER { + // https://dev.mysql.com/doc/internals/en/com-query-response.html + // 14.6.4.1 COM_QUERY Response + // If the number of columns in the resultset is 0, this is a OK_Packet. + + okResult, err := c.handleOKPacket(firstPkgBuf) + if err != nil { + return errors.Trace(err) + } + + result.Status = okResult.Status + result.AffectedRows = okResult.AffectedRows + result.InsertId = okResult.InsertId + if result.Resultset == nil { + result.Resultset = NewResultset(0) + } else { + result.Reset(0) + } + return nil + } else if firstPkgBuf[0] == ERR_HEADER { + return c.handleErrorPacket(append([]byte{}, firstPkgBuf...)) + } else if firstPkgBuf[0] == LocalInFile_HEADER { + return ErrMalformPacket + } + + return c.readResultsetStreaming(firstPkgBuf, binary, result, perRowCb) +} + func (c *Conn) readResultset(data []byte, binary bool) (*Result, error) { // column count count, _, n := LengthEncodedInt(data) @@ -253,6 +292,31 @@ func (c *Conn) readResultset(data []byte, binary bool) (*Result, error) { return result, nil } +func (c *Conn) readResultsetStreaming(data []byte, binary bool, result *Result, perRowCb SelectPerRowCallback) error { + columnCount, _, n := LengthEncodedInt(data) + + if n-len(data) != 0 { + return ErrMalformPacket + } + + if result.Resultset == nil { + result.Resultset = NewResultset(int(columnCount)) + } else { + // Reuse memory if can + result.Reset(int(columnCount)) + } + + if err := c.readResultColumns(result); err != nil { + return errors.Trace(err) + } + + if err := c.readResultRowsStreaming(result, binary, perRowCb); err != nil { + return errors.Trace(err) + } + + return nil +} + func (c *Conn) readResultColumns(result *Result) (err error) { var i int = 0 var data []byte @@ -341,3 +405,47 @@ func (c *Conn) readResultRows(result *Result, isBinary bool) (err error) { return nil } + +func (c *Conn) readResultRowsStreaming(result *Result, isBinary bool, perRowCb SelectPerRowCallback) (err error) { + var ( + data []byte + row []FieldValue + ) + + for { + data, err = c.ReadPacketReuseMem(data[:0]) + if err != nil { + return + } + + // EOF Packet + if c.isEOFPacket(data) { + if c.capability&CLIENT_PROTOCOL_41 > 0 { + // result.Warnings = binary.LittleEndian.Uint16(data[1:]) + // todo add strict_mode, warning will be treat as error + result.Status = binary.LittleEndian.Uint16(data[3:]) + c.status = result.Status + } + + break + } + + if data[0] == ERR_HEADER { + return c.handleErrorPacket(data) + } + + // Parse this row + row, err = RowData(data).Parse(result.Fields, isBinary, row) + if err != nil { + return errors.Trace(err) + } + + // Send the row to "userland" code + err = perRowCb(row) + if err != nil { + return errors.Trace(err) + } + } + + return nil +} diff --git a/vendor/github.com/siddontang/go-mysql/client/stmt.go b/vendor/github.com/go-mysql-org/go-mysql/client/stmt.go similarity index 93% rename from vendor/github.com/siddontang/go-mysql/client/stmt.go rename to vendor/github.com/go-mysql-org/go-mysql/client/stmt.go index 7cafb4f..239da78 100644 --- a/vendor/github.com/siddontang/go-mysql/client/stmt.go +++ b/vendor/github.com/go-mysql-org/go-mysql/client/stmt.go @@ -5,14 +5,13 @@ import ( "fmt" "math" + . "github.com/go-mysql-org/go-mysql/mysql" "github.com/pingcap/errors" - . "github.com/siddontang/go-mysql/mysql" ) type Stmt struct { - conn *Conn - id uint32 - query string + conn *Conn + id uint32 params int columns int @@ -55,7 +54,7 @@ func (s *Stmt) write(args ...interface{}) error { //NULL-bitmap, length: (num-params+7) nullBitmap := make([]byte, (paramsNum+7)>>3) - var length int = int(1 + 4 + 1 + 4 + ((paramsNum + 7) >> 3) + 1 + (paramsNum << 1)) + length := 1 + 4 + 1 + 4 + ((paramsNum + 7) >> 3) + 1 + (paramsNum << 1) var newParamBoundFlag byte = 0 @@ -91,11 +90,11 @@ func (s *Stmt) write(args ...interface{}) error { case uint16: paramTypes[i<<1] = MYSQL_TYPE_SHORT paramTypes[(i<<1)+1] = 0x80 - paramValues[i] = Uint16ToBytes(uint16(v)) + paramValues[i] = Uint16ToBytes(v) case uint32: paramTypes[i<<1] = MYSQL_TYPE_LONG paramTypes[(i<<1)+1] = 0x80 - paramValues[i] = Uint32ToBytes(uint32(v)) + paramValues[i] = Uint32ToBytes(v) case uint: paramTypes[i<<1] = MYSQL_TYPE_LONGLONG paramTypes[(i<<1)+1] = 0x80 @@ -103,14 +102,13 @@ func (s *Stmt) write(args ...interface{}) error { case uint64: paramTypes[i<<1] = MYSQL_TYPE_LONGLONG paramTypes[(i<<1)+1] = 0x80 - paramValues[i] = Uint64ToBytes(uint64(v)) + paramValues[i] = Uint64ToBytes(v) case bool: paramTypes[i<<1] = MYSQL_TYPE_TINY if v { paramValues[i] = []byte{1} } else { paramValues[i] = []byte{0} - } case float32: paramTypes[i<<1] = MYSQL_TYPE_FLOAT diff --git a/vendor/github.com/siddontang/go-mysql/client/tls.go b/vendor/github.com/go-mysql-org/go-mysql/client/tls.go similarity index 100% rename from vendor/github.com/siddontang/go-mysql/client/tls.go rename to vendor/github.com/go-mysql-org/go-mysql/client/tls.go diff --git a/vendor/github.com/siddontang/go-mysql/mysql/const.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/const.go similarity index 100% rename from vendor/github.com/siddontang/go-mysql/mysql/const.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/const.go diff --git a/vendor/github.com/siddontang/go-mysql/mysql/errcode.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/errcode.go similarity index 77% rename from vendor/github.com/siddontang/go-mysql/mysql/errcode.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/errcode.go index 8acff1a..1be5c44 100644 --- a/vendor/github.com/siddontang/go-mysql/mysql/errcode.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/errcode.go @@ -1,870 +1,870 @@ package mysql const ( - ER_ERROR_FIRST uint16 = 1000 - ER_HASHCHK = 1000 - ER_NISAMCHK = 1001 - ER_NO = 1002 - ER_YES = 1003 - ER_CANT_CREATE_FILE = 1004 - ER_CANT_CREATE_TABLE = 1005 - ER_CANT_CREATE_DB = 1006 - ER_DB_CREATE_EXISTS = 1007 - ER_DB_DROP_EXISTS = 1008 - ER_DB_DROP_DELETE = 1009 - ER_DB_DROP_RMDIR = 1010 - ER_CANT_DELETE_FILE = 1011 - ER_CANT_FIND_SYSTEM_REC = 1012 - ER_CANT_GET_STAT = 1013 - ER_CANT_GET_WD = 1014 - ER_CANT_LOCK = 1015 - ER_CANT_OPEN_FILE = 1016 - ER_FILE_NOT_FOUND = 1017 - ER_CANT_READ_DIR = 1018 - ER_CANT_SET_WD = 1019 - ER_CHECKREAD = 1020 - ER_DISK_FULL = 1021 - ER_DUP_KEY = 1022 - ER_ERROR_ON_CLOSE = 1023 - ER_ERROR_ON_READ = 1024 - ER_ERROR_ON_RENAME = 1025 - ER_ERROR_ON_WRITE = 1026 - ER_FILE_USED = 1027 - ER_FILSORT_ABORT = 1028 - ER_FORM_NOT_FOUND = 1029 - ER_GET_ERRNO = 1030 - ER_ILLEGAL_HA = 1031 - ER_KEY_NOT_FOUND = 1032 - ER_NOT_FORM_FILE = 1033 - ER_NOT_KEYFILE = 1034 - ER_OLD_KEYFILE = 1035 - ER_OPEN_AS_READONLY = 1036 - ER_OUTOFMEMORY = 1037 - ER_OUT_OF_SORTMEMORY = 1038 - ER_UNEXPECTED_EOF = 1039 - ER_CON_COUNT_ERROR = 1040 - ER_OUT_OF_RESOURCES = 1041 - ER_BAD_HOST_ERROR = 1042 - ER_HANDSHAKE_ERROR = 1043 - ER_DBACCESS_DENIED_ERROR = 1044 - ER_ACCESS_DENIED_ERROR = 1045 - ER_NO_DB_ERROR = 1046 - ER_UNKNOWN_COM_ERROR = 1047 - ER_BAD_NULL_ERROR = 1048 - ER_BAD_DB_ERROR = 1049 - ER_TABLE_EXISTS_ERROR = 1050 - ER_BAD_TABLE_ERROR = 1051 - ER_NON_UNIQ_ERROR = 1052 - ER_SERVER_SHUTDOWN = 1053 - ER_BAD_FIELD_ERROR = 1054 - ER_WRONG_FIELD_WITH_GROUP = 1055 - ER_WRONG_GROUP_FIELD = 1056 - ER_WRONG_SUM_SELECT = 1057 - ER_WRONG_VALUE_COUNT = 1058 - ER_TOO_LONG_IDENT = 1059 - ER_DUP_FIELDNAME = 1060 - ER_DUP_KEYNAME = 1061 - ER_DUP_ENTRY = 1062 - ER_WRONG_FIELD_SPEC = 1063 - ER_PARSE_ERROR = 1064 - ER_EMPTY_QUERY = 1065 - ER_NONUNIQ_TABLE = 1066 - ER_INVALID_DEFAULT = 1067 - ER_MULTIPLE_PRI_KEY = 1068 - ER_TOO_MANY_KEYS = 1069 - ER_TOO_MANY_KEY_PARTS = 1070 - ER_TOO_LONG_KEY = 1071 - ER_KEY_COLUMN_DOES_NOT_EXITS = 1072 - ER_BLOB_USED_AS_KEY = 1073 - ER_TOO_BIG_FIELDLENGTH = 1074 - ER_WRONG_AUTO_KEY = 1075 - ER_READY = 1076 - ER_NORMAL_SHUTDOWN = 1077 - ER_GOT_SIGNAL = 1078 - ER_SHUTDOWN_COMPLETE = 1079 - ER_FORCING_CLOSE = 1080 - ER_IPSOCK_ERROR = 1081 - ER_NO_SUCH_INDEX = 1082 - ER_WRONG_FIELD_TERMINATORS = 1083 - ER_BLOBS_AND_NO_TERMINATED = 1084 - ER_TEXTFILE_NOT_READABLE = 1085 - ER_FILE_EXISTS_ERROR = 1086 - ER_LOAD_INFO = 1087 - ER_ALTER_INFO = 1088 - ER_WRONG_SUB_KEY = 1089 - ER_CANT_REMOVE_ALL_FIELDS = 1090 - ER_CANT_DROP_FIELD_OR_KEY = 1091 - ER_INSERT_INFO = 1092 - ER_UPDATE_TABLE_USED = 1093 - ER_NO_SUCH_THREAD = 1094 - ER_KILL_DENIED_ERROR = 1095 - ER_NO_TABLES_USED = 1096 - ER_TOO_BIG_SET = 1097 - ER_NO_UNIQUE_LOGFILE = 1098 - ER_TABLE_NOT_LOCKED_FOR_WRITE = 1099 - ER_TABLE_NOT_LOCKED = 1100 - ER_BLOB_CANT_HAVE_DEFAULT = 1101 - ER_WRONG_DB_NAME = 1102 - ER_WRONG_TABLE_NAME = 1103 - ER_TOO_BIG_SELECT = 1104 - ER_UNKNOWN_ERROR = 1105 - ER_UNKNOWN_PROCEDURE = 1106 - ER_WRONG_PARAMCOUNT_TO_PROCEDURE = 1107 - ER_WRONG_PARAMETERS_TO_PROCEDURE = 1108 - ER_UNKNOWN_TABLE = 1109 - ER_FIELD_SPECIFIED_TWICE = 1110 - ER_INVALID_GROUP_FUNC_USE = 1111 - ER_UNSUPPORTED_EXTENSION = 1112 - ER_TABLE_MUST_HAVE_COLUMNS = 1113 - ER_RECORD_FILE_FULL = 1114 - ER_UNKNOWN_CHARACTER_SET = 1115 - ER_TOO_MANY_TABLES = 1116 - ER_TOO_MANY_FIELDS = 1117 - ER_TOO_BIG_ROWSIZE = 1118 - ER_STACK_OVERRUN = 1119 - ER_WRONG_OUTER_JOIN = 1120 - ER_NULL_COLUMN_IN_INDEX = 1121 - ER_CANT_FIND_UDF = 1122 - ER_CANT_INITIALIZE_UDF = 1123 - ER_UDF_NO_PATHS = 1124 - ER_UDF_EXISTS = 1125 - ER_CANT_OPEN_LIBRARY = 1126 - ER_CANT_FIND_DL_ENTRY = 1127 - ER_FUNCTION_NOT_DEFINED = 1128 - ER_HOST_IS_BLOCKED = 1129 - ER_HOST_NOT_PRIVILEGED = 1130 - ER_PASSWORD_ANONYMOUS_USER = 1131 - ER_PASSWORD_NOT_ALLOWED = 1132 - ER_PASSWORD_NO_MATCH = 1133 - ER_UPDATE_INFO = 1134 - ER_CANT_CREATE_THREAD = 1135 - ER_WRONG_VALUE_COUNT_ON_ROW = 1136 - ER_CANT_REOPEN_TABLE = 1137 - ER_INVALID_USE_OF_NULL = 1138 - ER_REGEXP_ERROR = 1139 - ER_MIX_OF_GROUP_FUNC_AND_FIELDS = 1140 - ER_NONEXISTING_GRANT = 1141 - ER_TABLEACCESS_DENIED_ERROR = 1142 - ER_COLUMNACCESS_DENIED_ERROR = 1143 - ER_ILLEGAL_GRANT_FOR_TABLE = 1144 - ER_GRANT_WRONG_HOST_OR_USER = 1145 - ER_NO_SUCH_TABLE = 1146 - ER_NONEXISTING_TABLE_GRANT = 1147 - ER_NOT_ALLOWED_COMMAND = 1148 - ER_SYNTAX_ERROR = 1149 - ER_DELAYED_CANT_CHANGE_LOCK = 1150 - ER_TOO_MANY_DELAYED_THREADS = 1151 - ER_ABORTING_CONNECTION = 1152 - ER_NET_PACKET_TOO_LARGE = 1153 - ER_NET_READ_ERROR_FROM_PIPE = 1154 - ER_NET_FCNTL_ERROR = 1155 - ER_NET_PACKETS_OUT_OF_ORDER = 1156 - ER_NET_UNCOMPRESS_ERROR = 1157 - ER_NET_READ_ERROR = 1158 - ER_NET_READ_INTERRUPTED = 1159 - ER_NET_ERROR_ON_WRITE = 1160 - ER_NET_WRITE_INTERRUPTED = 1161 - ER_TOO_LONG_STRING = 1162 - ER_TABLE_CANT_HANDLE_BLOB = 1163 - ER_TABLE_CANT_HANDLE_AUTO_INCREMENT = 1164 - ER_DELAYED_INSERT_TABLE_LOCKED = 1165 - ER_WRONG_COLUMN_NAME = 1166 - ER_WRONG_KEY_COLUMN = 1167 - ER_WRONG_MRG_TABLE = 1168 - ER_DUP_UNIQUE = 1169 - ER_BLOB_KEY_WITHOUT_LENGTH = 1170 - ER_PRIMARY_CANT_HAVE_NULL = 1171 - ER_TOO_MANY_ROWS = 1172 - ER_REQUIRES_PRIMARY_KEY = 1173 - ER_NO_RAID_COMPILED = 1174 - ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE = 1175 - ER_KEY_DOES_NOT_EXITS = 1176 - ER_CHECK_NO_SUCH_TABLE = 1177 - ER_CHECK_NOT_IMPLEMENTED = 1178 - ER_CANT_DO_THIS_DURING_AN_TRANSACTION = 1179 - ER_ERROR_DURING_COMMIT = 1180 - ER_ERROR_DURING_ROLLBACK = 1181 - ER_ERROR_DURING_FLUSH_LOGS = 1182 - ER_ERROR_DURING_CHECKPOINT = 1183 - ER_NEW_ABORTING_CONNECTION = 1184 - ER_DUMP_NOT_IMPLEMENTED = 1185 - ER_FLUSH_MASTER_BINLOG_CLOSED = 1186 - ER_INDEX_REBUILD = 1187 - ER_MASTER = 1188 - ER_MASTER_NET_READ = 1189 - ER_MASTER_NET_WRITE = 1190 - ER_FT_MATCHING_KEY_NOT_FOUND = 1191 - ER_LOCK_OR_ACTIVE_TRANSACTION = 1192 - ER_UNKNOWN_SYSTEM_VARIABLE = 1193 - ER_CRASHED_ON_USAGE = 1194 - ER_CRASHED_ON_REPAIR = 1195 - ER_WARNING_NOT_COMPLETE_ROLLBACK = 1196 - ER_TRANS_CACHE_FULL = 1197 - ER_SLAVE_MUST_STOP = 1198 - ER_SLAVE_NOT_RUNNING = 1199 - ER_BAD_SLAVE = 1200 - ER_MASTER_INFO = 1201 - ER_SLAVE_THREAD = 1202 - ER_TOO_MANY_USER_CONNECTIONS = 1203 - ER_SET_CONSTANTS_ONLY = 1204 - ER_LOCK_WAIT_TIMEOUT = 1205 - ER_LOCK_TABLE_FULL = 1206 - ER_READ_ONLY_TRANSACTION = 1207 - ER_DROP_DB_WITH_READ_LOCK = 1208 - ER_CREATE_DB_WITH_READ_LOCK = 1209 - ER_WRONG_ARGUMENTS = 1210 - ER_NO_PERMISSION_TO_CREATE_USER = 1211 - ER_UNION_TABLES_IN_DIFFERENT_DIR = 1212 - ER_LOCK_DEADLOCK = 1213 - ER_TABLE_CANT_HANDLE_FT = 1214 - ER_CANNOT_ADD_FOREIGN = 1215 - ER_NO_REFERENCED_ROW = 1216 - ER_ROW_IS_REFERENCED = 1217 - ER_CONNECT_TO_MASTER = 1218 - ER_QUERY_ON_MASTER = 1219 - ER_ERROR_WHEN_EXECUTING_COMMAND = 1220 - ER_WRONG_USAGE = 1221 - ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT = 1222 - ER_CANT_UPDATE_WITH_READLOCK = 1223 - ER_MIXING_NOT_ALLOWED = 1224 - ER_DUP_ARGUMENT = 1225 - ER_USER_LIMIT_REACHED = 1226 - ER_SPECIFIC_ACCESS_DENIED_ERROR = 1227 - ER_LOCAL_VARIABLE = 1228 - ER_GLOBAL_VARIABLE = 1229 - ER_NO_DEFAULT = 1230 - ER_WRONG_VALUE_FOR_VAR = 1231 - ER_WRONG_TYPE_FOR_VAR = 1232 - ER_VAR_CANT_BE_READ = 1233 - ER_CANT_USE_OPTION_HERE = 1234 - ER_NOT_SUPPORTED_YET = 1235 - ER_MASTER_FATAL_ERROR_READING_BINLOG = 1236 - ER_SLAVE_IGNORED_TABLE = 1237 - ER_INCORRECT_GLOBAL_LOCAL_VAR = 1238 - ER_WRONG_FK_DEF = 1239 - ER_KEY_REF_DO_NOT_MATCH_TABLE_REF = 1240 - ER_OPERAND_COLUMNS = 1241 - ER_SUBQUERY_NO_1_ROW = 1242 - ER_UNKNOWN_STMT_HANDLER = 1243 - ER_CORRUPT_HELP_DB = 1244 - ER_CYCLIC_REFERENCE = 1245 - ER_AUTO_CONVERT = 1246 - ER_ILLEGAL_REFERENCE = 1247 - ER_DERIVED_MUST_HAVE_ALIAS = 1248 - ER_SELECT_REDUCED = 1249 - ER_TABLENAME_NOT_ALLOWED_HERE = 1250 - ER_NOT_SUPPORTED_AUTH_MODE = 1251 - ER_SPATIAL_CANT_HAVE_NULL = 1252 - ER_COLLATION_CHARSET_MISMATCH = 1253 - ER_SLAVE_WAS_RUNNING = 1254 - ER_SLAVE_WAS_NOT_RUNNING = 1255 - ER_TOO_BIG_FOR_UNCOMPRESS = 1256 - ER_ZLIB_Z_MEM_ERROR = 1257 - ER_ZLIB_Z_BUF_ERROR = 1258 - ER_ZLIB_Z_DATA_ERROR = 1259 - ER_CUT_VALUE_GROUP_CONCAT = 1260 - ER_WARN_TOO_FEW_RECORDS = 1261 - ER_WARN_TOO_MANY_RECORDS = 1262 - ER_WARN_NULL_TO_NOTNULL = 1263 - ER_WARN_DATA_OUT_OF_RANGE = 1264 - WARN_DATA_TRUNCATED = 1265 - ER_WARN_USING_OTHER_HANDLER = 1266 - ER_CANT_AGGREGATE_2COLLATIONS = 1267 - ER_DROP_USER = 1268 - ER_REVOKE_GRANTS = 1269 - ER_CANT_AGGREGATE_3COLLATIONS = 1270 - ER_CANT_AGGREGATE_NCOLLATIONS = 1271 - ER_VARIABLE_IS_NOT_STRUCT = 1272 - ER_UNKNOWN_COLLATION = 1273 - ER_SLAVE_IGNORED_SSL_PARAMS = 1274 - ER_SERVER_IS_IN_SECURE_AUTH_MODE = 1275 - ER_WARN_FIELD_RESOLVED = 1276 - ER_BAD_SLAVE_UNTIL_COND = 1277 - ER_MISSING_SKIP_SLAVE = 1278 - ER_UNTIL_COND_IGNORED = 1279 - ER_WRONG_NAME_FOR_INDEX = 1280 - ER_WRONG_NAME_FOR_CATALOG = 1281 - ER_WARN_QC_RESIZE = 1282 - ER_BAD_FT_COLUMN = 1283 - ER_UNKNOWN_KEY_CACHE = 1284 - ER_WARN_HOSTNAME_WONT_WORK = 1285 - ER_UNKNOWN_STORAGE_ENGINE = 1286 - ER_WARN_DEPRECATED_SYNTAX = 1287 - ER_NON_UPDATABLE_TABLE = 1288 - ER_FEATURE_DISABLED = 1289 - ER_OPTION_PREVENTS_STATEMENT = 1290 - ER_DUPLICATED_VALUE_IN_TYPE = 1291 - ER_TRUNCATED_WRONG_VALUE = 1292 - ER_TOO_MUCH_AUTO_TIMESTAMP_COLS = 1293 - ER_INVALID_ON_UPDATE = 1294 - ER_UNSUPPORTED_PS = 1295 - ER_GET_ERRMSG = 1296 - ER_GET_TEMPORARY_ERRMSG = 1297 - ER_UNKNOWN_TIME_ZONE = 1298 - ER_WARN_INVALID_TIMESTAMP = 1299 - ER_INVALID_CHARACTER_STRING = 1300 - ER_WARN_ALLOWED_PACKET_OVERFLOWED = 1301 - ER_CONFLICTING_DECLARATIONS = 1302 - ER_SP_NO_RECURSIVE_CREATE = 1303 - ER_SP_ALREADY_EXISTS = 1304 - ER_SP_DOES_NOT_EXIST = 1305 - ER_SP_DROP_FAILED = 1306 - ER_SP_STORE_FAILED = 1307 - ER_SP_LILABEL_MISMATCH = 1308 - ER_SP_LABEL_REDEFINE = 1309 - ER_SP_LABEL_MISMATCH = 1310 - ER_SP_UNINIT_VAR = 1311 - ER_SP_BADSELECT = 1312 - ER_SP_BADRETURN = 1313 - ER_SP_BADSTATEMENT = 1314 - ER_UPDATE_LOG_DEPRECATED_IGNORED = 1315 - ER_UPDATE_LOG_DEPRECATED_TRANSLATED = 1316 - ER_QUERY_INTERRUPTED = 1317 - ER_SP_WRONG_NO_OF_ARGS = 1318 - ER_SP_COND_MISMATCH = 1319 - ER_SP_NORETURN = 1320 - ER_SP_NORETURNEND = 1321 - ER_SP_BAD_CURSOR_QUERY = 1322 - ER_SP_BAD_CURSOR_SELECT = 1323 - ER_SP_CURSOR_MISMATCH = 1324 - ER_SP_CURSOR_ALREADY_OPEN = 1325 - ER_SP_CURSOR_NOT_OPEN = 1326 - ER_SP_UNDECLARED_VAR = 1327 - ER_SP_WRONG_NO_OF_FETCH_ARGS = 1328 - ER_SP_FETCH_NO_DATA = 1329 - ER_SP_DUP_PARAM = 1330 - ER_SP_DUP_VAR = 1331 - ER_SP_DUP_COND = 1332 - ER_SP_DUP_CURS = 1333 - ER_SP_CANT_ALTER = 1334 - ER_SP_SUBSELECT_NYI = 1335 - ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG = 1336 - ER_SP_VARCOND_AFTER_CURSHNDLR = 1337 - ER_SP_CURSOR_AFTER_HANDLER = 1338 - ER_SP_CASE_NOT_FOUND = 1339 - ER_FPARSER_TOO_BIG_FILE = 1340 - ER_FPARSER_BAD_HEADER = 1341 - ER_FPARSER_EOF_IN_COMMENT = 1342 - ER_FPARSER_ERROR_IN_PARAMETER = 1343 - ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER = 1344 - ER_VIEW_NO_EXPLAIN = 1345 - ER_FRM_UNKNOWN_TYPE = 1346 - ER_WRONG_OBJECT = 1347 - ER_NONUPDATEABLE_COLUMN = 1348 - ER_VIEW_SELECT_DERIVED = 1349 - ER_VIEW_SELECT_CLAUSE = 1350 - ER_VIEW_SELECT_VARIABLE = 1351 - ER_VIEW_SELECT_TMPTABLE = 1352 - ER_VIEW_WRONG_LIST = 1353 - ER_WARN_VIEW_MERGE = 1354 - ER_WARN_VIEW_WITHOUT_KEY = 1355 - ER_VIEW_INVALID = 1356 - ER_SP_NO_DROP_SP = 1357 - ER_SP_GOTO_IN_HNDLR = 1358 - ER_TRG_ALREADY_EXISTS = 1359 - ER_TRG_DOES_NOT_EXIST = 1360 - ER_TRG_ON_VIEW_OR_TEMP_TABLE = 1361 - ER_TRG_CANT_CHANGE_ROW = 1362 - ER_TRG_NO_SUCH_ROW_IN_TRG = 1363 - ER_NO_DEFAULT_FOR_FIELD = 1364 - ER_DIVISION_BY_ZERO = 1365 - ER_TRUNCATED_WRONG_VALUE_FOR_FIELD = 1366 - ER_ILLEGAL_VALUE_FOR_TYPE = 1367 - ER_VIEW_NONUPD_CHECK = 1368 - ER_VIEW_CHECK_FAILED = 1369 - ER_PROCACCESS_DENIED_ERROR = 1370 - ER_RELAY_LOG_FAIL = 1371 - ER_PASSWD_LENGTH = 1372 - ER_UNKNOWN_TARGET_BINLOG = 1373 - ER_IO_ERR_LOG_INDEX_READ = 1374 - ER_BINLOG_PURGE_PROHIBITED = 1375 - ER_FSEEK_FAIL = 1376 - ER_BINLOG_PURGE_FATAL_ERR = 1377 - ER_LOG_IN_USE = 1378 - ER_LOG_PURGE_UNKNOWN_ERR = 1379 - ER_RELAY_LOG_INIT = 1380 - ER_NO_BINARY_LOGGING = 1381 - ER_RESERVED_SYNTAX = 1382 - ER_WSAS_FAILED = 1383 - ER_DIFF_GROUPS_PROC = 1384 - ER_NO_GROUP_FOR_PROC = 1385 - ER_ORDER_WITH_PROC = 1386 - ER_LOGGING_PROHIBIT_CHANGING_OF = 1387 - ER_NO_FILE_MAPPING = 1388 - ER_WRONG_MAGIC = 1389 - ER_PS_MANY_PARAM = 1390 - ER_KEY_PART_0 = 1391 - ER_VIEW_CHECKSUM = 1392 - ER_VIEW_MULTIUPDATE = 1393 - ER_VIEW_NO_INSERT_FIELD_LIST = 1394 - ER_VIEW_DELETE_MERGE_VIEW = 1395 - ER_CANNOT_USER = 1396 - ER_XAER_NOTA = 1397 - ER_XAER_INVAL = 1398 - ER_XAER_RMFAIL = 1399 - ER_XAER_OUTSIDE = 1400 - ER_XAER_RMERR = 1401 - ER_XA_RBROLLBACK = 1402 - ER_NONEXISTING_PROC_GRANT = 1403 - ER_PROC_AUTO_GRANT_FAIL = 1404 - ER_PROC_AUTO_REVOKE_FAIL = 1405 - ER_DATA_TOO_LONG = 1406 - ER_SP_BAD_SQLSTATE = 1407 - ER_STARTUP = 1408 - ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR = 1409 - ER_CANT_CREATE_USER_WITH_GRANT = 1410 - ER_WRONG_VALUE_FOR_TYPE = 1411 - ER_TABLE_DEF_CHANGED = 1412 - ER_SP_DUP_HANDLER = 1413 - ER_SP_NOT_VAR_ARG = 1414 - ER_SP_NO_RETSET = 1415 - ER_CANT_CREATE_GEOMETRY_OBJECT = 1416 - ER_FAILED_ROUTINE_BREAK_BINLOG = 1417 - ER_BINLOG_UNSAFE_ROUTINE = 1418 - ER_BINLOG_CREATE_ROUTINE_NEED_SUPER = 1419 - ER_EXEC_STMT_WITH_OPEN_CURSOR = 1420 - ER_STMT_HAS_NO_OPEN_CURSOR = 1421 - ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG = 1422 - ER_NO_DEFAULT_FOR_VIEW_FIELD = 1423 - ER_SP_NO_RECURSION = 1424 - ER_TOO_BIG_SCALE = 1425 - ER_TOO_BIG_PRECISION = 1426 - ER_M_BIGGER_THAN_D = 1427 - ER_WRONG_LOCK_OF_SYSTEM_TABLE = 1428 - ER_CONNECT_TO_FOREIGN_DATA_SOURCE = 1429 - ER_QUERY_ON_FOREIGN_DATA_SOURCE = 1430 - ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST = 1431 - ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE = 1432 - ER_FOREIGN_DATA_STRING_INVALID = 1433 - ER_CANT_CREATE_FEDERATED_TABLE = 1434 - ER_TRG_IN_WRONG_SCHEMA = 1435 - ER_STACK_OVERRUN_NEED_MORE = 1436 - ER_TOO_LONG_BODY = 1437 - ER_WARN_CANT_DROP_DEFAULT_KEYCACHE = 1438 - ER_TOO_BIG_DISPLAYWIDTH = 1439 - ER_XAER_DUPID = 1440 - ER_DATETIME_FUNCTION_OVERFLOW = 1441 - ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG = 1442 - ER_VIEW_PREVENT_UPDATE = 1443 - ER_PS_NO_RECURSION = 1444 - ER_SP_CANT_SET_AUTOCOMMIT = 1445 - ER_MALFORMED_DEFINER = 1446 - ER_VIEW_FRM_NO_USER = 1447 - ER_VIEW_OTHER_USER = 1448 - ER_NO_SUCH_USER = 1449 - ER_FORBID_SCHEMA_CHANGE = 1450 - ER_ROW_IS_REFERENCED_2 = 1451 - ER_NO_REFERENCED_ROW_2 = 1452 - ER_SP_BAD_VAR_SHADOW = 1453 - ER_TRG_NO_DEFINER = 1454 - ER_OLD_FILE_FORMAT = 1455 - ER_SP_RECURSION_LIMIT = 1456 - ER_SP_PROC_TABLE_CORRUPT = 1457 - ER_SP_WRONG_NAME = 1458 - ER_TABLE_NEEDS_UPGRADE = 1459 - ER_SP_NO_AGGREGATE = 1460 - ER_MAX_PREPARED_STMT_COUNT_REACHED = 1461 - ER_VIEW_RECURSIVE = 1462 - ER_NON_GROUPING_FIELD_USED = 1463 - ER_TABLE_CANT_HANDLE_SPKEYS = 1464 - ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA = 1465 - ER_REMOVED_SPACES = 1466 - ER_AUTOINC_READ_FAILED = 1467 - ER_USERNAME = 1468 - ER_HOSTNAME = 1469 - ER_WRONG_STRING_LENGTH = 1470 - ER_NON_INSERTABLE_TABLE = 1471 - ER_ADMIN_WRONG_MRG_TABLE = 1472 - ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT = 1473 - ER_NAME_BECOMES_EMPTY = 1474 - ER_AMBIGUOUS_FIELD_TERM = 1475 - ER_FOREIGN_SERVER_EXISTS = 1476 - ER_FOREIGN_SERVER_DOESNT_EXIST = 1477 - ER_ILLEGAL_HA_CREATE_OPTION = 1478 - ER_PARTITION_REQUIRES_VALUES_ERROR = 1479 - ER_PARTITION_WRONG_VALUES_ERROR = 1480 - ER_PARTITION_MAXVALUE_ERROR = 1481 - ER_PARTITION_SUBPARTITION_ERROR = 1482 - ER_PARTITION_SUBPART_MIX_ERROR = 1483 - ER_PARTITION_WRONG_NO_PART_ERROR = 1484 - ER_PARTITION_WRONG_NO_SUBPART_ERROR = 1485 - ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR = 1486 - ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR = 1487 - ER_FIELD_NOT_FOUND_PART_ERROR = 1488 - ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR = 1489 - ER_INCONSISTENT_PARTITION_INFO_ERROR = 1490 - ER_PARTITION_FUNC_NOT_ALLOWED_ERROR = 1491 - ER_PARTITIONS_MUST_BE_DEFINED_ERROR = 1492 - ER_RANGE_NOT_INCREASING_ERROR = 1493 - ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR = 1494 - ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR = 1495 - ER_PARTITION_ENTRY_ERROR = 1496 - ER_MIX_HANDLER_ERROR = 1497 - ER_PARTITION_NOT_DEFINED_ERROR = 1498 - ER_TOO_MANY_PARTITIONS_ERROR = 1499 - ER_SUBPARTITION_ERROR = 1500 - ER_CANT_CREATE_HANDLER_FILE = 1501 - ER_BLOB_FIELD_IN_PART_FUNC_ERROR = 1502 - ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF = 1503 - ER_NO_PARTS_ERROR = 1504 - ER_PARTITION_MGMT_ON_NONPARTITIONED = 1505 - ER_FOREIGN_KEY_ON_PARTITIONED = 1506 - ER_DROP_PARTITION_NON_EXISTENT = 1507 - ER_DROP_LAST_PARTITION = 1508 - ER_COALESCE_ONLY_ON_HASH_PARTITION = 1509 - ER_REORG_HASH_ONLY_ON_SAME_NO = 1510 - ER_REORG_NO_PARAM_ERROR = 1511 - ER_ONLY_ON_RANGE_LIST_PARTITION = 1512 - ER_ADD_PARTITION_SUBPART_ERROR = 1513 - ER_ADD_PARTITION_NO_NEW_PARTITION = 1514 - ER_COALESCE_PARTITION_NO_PARTITION = 1515 - ER_REORG_PARTITION_NOT_EXIST = 1516 - ER_SAME_NAME_PARTITION = 1517 - ER_NO_BINLOG_ERROR = 1518 - ER_CONSECUTIVE_REORG_PARTITIONS = 1519 - ER_REORG_OUTSIDE_RANGE = 1520 - ER_PARTITION_FUNCTION_FAILURE = 1521 - ER_PART_STATE_ERROR = 1522 - ER_LIMITED_PART_RANGE = 1523 - ER_PLUGIN_IS_NOT_LOADED = 1524 - ER_WRONG_VALUE = 1525 - ER_NO_PARTITION_FOR_GIVEN_VALUE = 1526 - ER_FILEGROUP_OPTION_ONLY_ONCE = 1527 - ER_CREATE_FILEGROUP_FAILED = 1528 - ER_DROP_FILEGROUP_FAILED = 1529 - ER_TABLESPACE_AUTO_EXTEND_ERROR = 1530 - ER_WRONG_SIZE_NUMBER = 1531 - ER_SIZE_OVERFLOW_ERROR = 1532 - ER_ALTER_FILEGROUP_FAILED = 1533 - ER_BINLOG_ROW_LOGGING_FAILED = 1534 - ER_BINLOG_ROW_WRONG_TABLE_DEF = 1535 - ER_BINLOG_ROW_RBR_TO_SBR = 1536 - ER_EVENT_ALREADY_EXISTS = 1537 - ER_EVENT_STORE_FAILED = 1538 - ER_EVENT_DOES_NOT_EXIST = 1539 - ER_EVENT_CANT_ALTER = 1540 - ER_EVENT_DROP_FAILED = 1541 - ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG = 1542 - ER_EVENT_ENDS_BEFORE_STARTS = 1543 - ER_EVENT_EXEC_TIME_IN_THE_PAST = 1544 - ER_EVENT_OPEN_TABLE_FAILED = 1545 - ER_EVENT_NEITHER_M_EXPR_NOR_M_AT = 1546 - ER_OBSOLETE_COL_COUNT_DOESNT_MATCH_CORRUPTED = 1547 - ER_OBSOLETE_CANNOT_LOAD_FROM_TABLE = 1548 - ER_EVENT_CANNOT_DELETE = 1549 - ER_EVENT_COMPILE_ERROR = 1550 - ER_EVENT_SAME_NAME = 1551 - ER_EVENT_DATA_TOO_LONG = 1552 - ER_DROP_INDEX_FK = 1553 - ER_WARN_DEPRECATED_SYNTAX_WITH_VER = 1554 - ER_CANT_WRITE_LOCK_LOG_TABLE = 1555 - ER_CANT_LOCK_LOG_TABLE = 1556 - ER_FOREIGN_DUPLICATE_KEY_OLD_UNUSED = 1557 - ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE = 1558 - ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR = 1559 - ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT = 1560 - ER_NDB_CANT_SWITCH_BINLOG_FORMAT = 1561 - ER_PARTITION_NO_TEMPORARY = 1562 - ER_PARTITION_CONST_DOMAIN_ERROR = 1563 - ER_PARTITION_FUNCTION_IS_NOT_ALLOWED = 1564 - ER_DDL_LOG_ERROR = 1565 - ER_NULL_IN_VALUES_LESS_THAN = 1566 - ER_WRONG_PARTITION_NAME = 1567 - ER_CANT_CHANGE_TX_CHARACTERISTICS = 1568 - ER_DUP_ENTRY_AUTOINCREMENT_CASE = 1569 - ER_EVENT_MODIFY_QUEUE_ERROR = 1570 - ER_EVENT_SET_VAR_ERROR = 1571 - ER_PARTITION_MERGE_ERROR = 1572 - ER_CANT_ACTIVATE_LOG = 1573 - ER_RBR_NOT_AVAILABLE = 1574 - ER_BASE64_DECODE_ERROR = 1575 - ER_EVENT_RECURSION_FORBIDDEN = 1576 - ER_EVENTS_DB_ERROR = 1577 - ER_ONLY_INTEGERS_ALLOWED = 1578 - ER_UNSUPORTED_LOG_ENGINE = 1579 - ER_BAD_LOG_STATEMENT = 1580 - ER_CANT_RENAME_LOG_TABLE = 1581 - ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT = 1582 - ER_WRONG_PARAMETERS_TO_NATIVE_FCT = 1583 - ER_WRONG_PARAMETERS_TO_STORED_FCT = 1584 - ER_NATIVE_FCT_NAME_COLLISION = 1585 - ER_DUP_ENTRY_WITH_KEY_NAME = 1586 - ER_BINLOG_PURGE_EMFILE = 1587 - ER_EVENT_CANNOT_CREATE_IN_THE_PAST = 1588 - ER_EVENT_CANNOT_ALTER_IN_THE_PAST = 1589 - ER_SLAVE_INCIDENT = 1590 - ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT = 1591 - ER_BINLOG_UNSAFE_STATEMENT = 1592 - ER_SLAVE_FATAL_ERROR = 1593 - ER_SLAVE_RELAY_LOG_READ_FAILURE = 1594 - ER_SLAVE_RELAY_LOG_WRITE_FAILURE = 1595 - ER_SLAVE_CREATE_EVENT_FAILURE = 1596 - ER_SLAVE_MASTER_COM_FAILURE = 1597 - ER_BINLOG_LOGGING_IMPOSSIBLE = 1598 - ER_VIEW_NO_CREATION_CTX = 1599 - ER_VIEW_INVALID_CREATION_CTX = 1600 - ER_SR_INVALID_CREATION_CTX = 1601 - ER_TRG_CORRUPTED_FILE = 1602 - ER_TRG_NO_CREATION_CTX = 1603 - ER_TRG_INVALID_CREATION_CTX = 1604 - ER_EVENT_INVALID_CREATION_CTX = 1605 - ER_TRG_CANT_OPEN_TABLE = 1606 - ER_CANT_CREATE_SROUTINE = 1607 - ER_NEVER_USED = 1608 - ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT = 1609 - ER_SLAVE_CORRUPT_EVENT = 1610 - ER_LOAD_DATA_INVALID_COLUMN = 1611 - ER_LOG_PURGE_NO_FILE = 1612 - ER_XA_RBTIMEOUT = 1613 - ER_XA_RBDEADLOCK = 1614 - ER_NEED_REPREPARE = 1615 - ER_DELAYED_NOT_SUPPORTED = 1616 - WARN_NO_MASTER_INFO = 1617 - WARN_OPTION_IGNORED = 1618 - WARN_PLUGIN_DELETE_BUILTIN = 1619 - WARN_PLUGIN_BUSY = 1620 - ER_VARIABLE_IS_READONLY = 1621 - ER_WARN_ENGINE_TRANSACTION_ROLLBACK = 1622 - ER_SLAVE_HEARTBEAT_FAILURE = 1623 - ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE = 1624 - ER_NDB_REPLICATION_SCHEMA_ERROR = 1625 - ER_CONFLICT_FN_PARSE_ERROR = 1626 - ER_EXCEPTIONS_WRITE_ERROR = 1627 - ER_TOO_LONG_TABLE_COMMENT = 1628 - ER_TOO_LONG_FIELD_COMMENT = 1629 - ER_FUNC_INEXISTENT_NAME_COLLISION = 1630 - ER_DATABASE_NAME = 1631 - ER_TABLE_NAME = 1632 - ER_PARTITION_NAME = 1633 - ER_SUBPARTITION_NAME = 1634 - ER_TEMPORARY_NAME = 1635 - ER_RENAMED_NAME = 1636 - ER_TOO_MANY_CONCURRENT_TRXS = 1637 - WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED = 1638 - ER_DEBUG_SYNC_TIMEOUT = 1639 - ER_DEBUG_SYNC_HIT_LIMIT = 1640 - ER_DUP_SIGNAL_SET = 1641 - ER_SIGNAL_WARN = 1642 - ER_SIGNAL_NOT_FOUND = 1643 - ER_SIGNAL_EXCEPTION = 1644 - ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER = 1645 - ER_SIGNAL_BAD_CONDITION_TYPE = 1646 - WARN_COND_ITEM_TRUNCATED = 1647 - ER_COND_ITEM_TOO_LONG = 1648 - ER_UNKNOWN_LOCALE = 1649 - ER_SLAVE_IGNORE_SERVER_IDS = 1650 - ER_QUERY_CACHE_DISABLED = 1651 - ER_SAME_NAME_PARTITION_FIELD = 1652 - ER_PARTITION_COLUMN_LIST_ERROR = 1653 - ER_WRONG_TYPE_COLUMN_VALUE_ERROR = 1654 - ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR = 1655 - ER_MAXVALUE_IN_VALUES_IN = 1656 - ER_TOO_MANY_VALUES_ERROR = 1657 - ER_ROW_SINGLE_PARTITION_FIELD_ERROR = 1658 - ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD = 1659 - ER_PARTITION_FIELDS_TOO_LONG = 1660 - ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE = 1661 - ER_BINLOG_ROW_MODE_AND_STMT_ENGINE = 1662 - ER_BINLOG_UNSAFE_AND_STMT_ENGINE = 1663 - ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE = 1664 - ER_BINLOG_STMT_MODE_AND_ROW_ENGINE = 1665 - ER_BINLOG_ROW_INJECTION_AND_STMT_MODE = 1666 - ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE = 1667 - ER_BINLOG_UNSAFE_LIMIT = 1668 - ER_BINLOG_UNSAFE_INSERT_DELAYED = 1669 - ER_BINLOG_UNSAFE_SYSTEM_TABLE = 1670 - ER_BINLOG_UNSAFE_AUTOINC_COLUMNS = 1671 - ER_BINLOG_UNSAFE_UDF = 1672 - ER_BINLOG_UNSAFE_SYSTEM_VARIABLE = 1673 - ER_BINLOG_UNSAFE_SYSTEM_FUNCTION = 1674 - ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS = 1675 - ER_MESSAGE_AND_STATEMENT = 1676 - ER_SLAVE_CONVERSION_FAILED = 1677 - ER_SLAVE_CANT_CREATE_CONVERSION = 1678 - ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT = 1679 - ER_PATH_LENGTH = 1680 - ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT = 1681 - ER_WRONG_NATIVE_TABLE_STRUCTURE = 1682 - ER_WRONG_PERFSCHEMA_USAGE = 1683 - ER_WARN_I_S_SKIPPED_TABLE = 1684 - ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT = 1685 - ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT = 1686 - ER_SPATIAL_MUST_HAVE_GEOM_COL = 1687 - ER_TOO_LONG_INDEX_COMMENT = 1688 - ER_LOCK_ABORTED = 1689 - ER_DATA_OUT_OF_RANGE = 1690 - ER_WRONG_SPVAR_TYPE_IN_LIMIT = 1691 - ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE = 1692 - ER_BINLOG_UNSAFE_MIXED_STATEMENT = 1693 - ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN = 1694 - ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN = 1695 - ER_FAILED_READ_FROM_PAR_FILE = 1696 - ER_VALUES_IS_NOT_INT_TYPE_ERROR = 1697 - ER_ACCESS_DENIED_NO_PASSWORD_ERROR = 1698 - ER_SET_PASSWORD_AUTH_PLUGIN = 1699 - ER_GRANT_PLUGIN_USER_EXISTS = 1700 - ER_TRUNCATE_ILLEGAL_FK = 1701 - ER_PLUGIN_IS_PERMANENT = 1702 - ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN = 1703 - ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX = 1704 - ER_STMT_CACHE_FULL = 1705 - ER_MULTI_UPDATE_KEY_CONFLICT = 1706 - ER_TABLE_NEEDS_REBUILD = 1707 - WARN_OPTION_BELOW_LIMIT = 1708 - ER_INDEX_COLUMN_TOO_LONG = 1709 - ER_ERROR_IN_TRIGGER_BODY = 1710 - ER_ERROR_IN_UNKNOWN_TRIGGER_BODY = 1711 - ER_INDEX_CORRUPT = 1712 - ER_UNDO_RECORD_TOO_BIG = 1713 - ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT = 1714 - ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE = 1715 - ER_BINLOG_UNSAFE_REPLACE_SELECT = 1716 - ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT = 1717 - ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT = 1718 - ER_BINLOG_UNSAFE_UPDATE_IGNORE = 1719 - ER_PLUGIN_NO_UNINSTALL = 1720 - ER_PLUGIN_NO_INSTALL = 1721 - ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT = 1722 - ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC = 1723 - ER_BINLOG_UNSAFE_INSERT_TWO_KEYS = 1724 - ER_TABLE_IN_FK_CHECK = 1725 - ER_UNSUPPORTED_ENGINE = 1726 - ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST = 1727 - ER_CANNOT_LOAD_FROM_TABLE_V2 = 1728 - ER_MASTER_DELAY_VALUE_OUT_OF_RANGE = 1729 - ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT = 1730 - ER_PARTITION_EXCHANGE_DIFFERENT_OPTION = 1731 - ER_PARTITION_EXCHANGE_PART_TABLE = 1732 - ER_PARTITION_EXCHANGE_TEMP_TABLE = 1733 - ER_PARTITION_INSTEAD_OF_SUBPARTITION = 1734 - ER_UNKNOWN_PARTITION = 1735 - ER_TABLES_DIFFERENT_METADATA = 1736 - ER_ROW_DOES_NOT_MATCH_PARTITION = 1737 - ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX = 1738 - ER_WARN_INDEX_NOT_APPLICABLE = 1739 - ER_PARTITION_EXCHANGE_FOREIGN_KEY = 1740 - ER_NO_SUCH_KEY_VALUE = 1741 - ER_RPL_INFO_DATA_TOO_LONG = 1742 - ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE = 1743 - ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE = 1744 - ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX = 1745 - ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT = 1746 - ER_PARTITION_CLAUSE_ON_NONPARTITIONED = 1747 - ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET = 1748 - ER_NO_SUCH_PARTITION__UNUSED = 1749 - ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE = 1750 - ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE = 1751 - ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE = 1752 - ER_MTS_FEATURE_IS_NOT_SUPPORTED = 1753 - ER_MTS_UPDATED_DBS_GREATER_MAX = 1754 - ER_MTS_CANT_PARALLEL = 1755 - ER_MTS_INCONSISTENT_DATA = 1756 - ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING = 1757 - ER_DA_INVALID_CONDITION_NUMBER = 1758 - ER_INSECURE_PLAIN_TEXT = 1759 - ER_INSECURE_CHANGE_MASTER = 1760 - ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO = 1761 - ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO = 1762 - ER_SQLTHREAD_WITH_SECURE_SLAVE = 1763 - ER_TABLE_HAS_NO_FT = 1764 - ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER = 1765 - ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION = 1766 - ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST = 1767 - ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION_WHEN_GTID_NEXT_LIST_IS_NULL = 1768 - ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION = 1769 - ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL = 1770 - ER_SKIPPING_LOGGED_TRANSACTION = 1771 - ER_MALFORMED_GTID_SET_SPECIFICATION = 1772 - ER_MALFORMED_GTID_SET_ENCODING = 1773 - ER_MALFORMED_GTID_SPECIFICATION = 1774 - ER_GNO_EXHAUSTED = 1775 - ER_BAD_SLAVE_AUTO_POSITION = 1776 - ER_AUTO_POSITION_REQUIRES_GTID_MODE_ON = 1777 - ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET = 1778 - ER_GTID_MODE_2_OR_3_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON = 1779 - ER_GTID_MODE_REQUIRES_BINLOG = 1780 - ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF = 1781 - ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON = 1782 - ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF = 1783 - ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF = 1784 - ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE = 1785 - ER_GTID_UNSAFE_CREATE_SELECT = 1786 - ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION = 1787 - ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME = 1788 - ER_MASTER_HAS_PURGED_REQUIRED_GTIDS = 1789 - ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID = 1790 - ER_UNKNOWN_EXPLAIN_FORMAT = 1791 - ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION = 1792 - ER_TOO_LONG_TABLE_PARTITION_COMMENT = 1793 - ER_SLAVE_CONFIGURATION = 1794 - ER_INNODB_FT_LIMIT = 1795 - ER_INNODB_NO_FT_TEMP_TABLE = 1796 - ER_INNODB_FT_WRONG_DOCID_COLUMN = 1797 - ER_INNODB_FT_WRONG_DOCID_INDEX = 1798 - ER_INNODB_ONLINE_LOG_TOO_BIG = 1799 - ER_UNKNOWN_ALTER_ALGORITHM = 1800 - ER_UNKNOWN_ALTER_LOCK = 1801 - ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS = 1802 - ER_MTS_RECOVERY_FAILURE = 1803 - ER_MTS_RESET_WORKERS = 1804 - ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 = 1805 - ER_SLAVE_SILENT_RETRY_TRANSACTION = 1806 - ER_DISCARD_FK_CHECKS_RUNNING = 1807 - ER_TABLE_SCHEMA_MISMATCH = 1808 - ER_TABLE_IN_SYSTEM_TABLESPACE = 1809 - ER_IO_READ_ERROR = 1810 - ER_IO_WRITE_ERROR = 1811 - ER_TABLESPACE_MISSING = 1812 - ER_TABLESPACE_EXISTS = 1813 - ER_TABLESPACE_DISCARDED = 1814 - ER_INTERNAL_ERROR = 1815 - ER_INNODB_IMPORT_ERROR = 1816 - ER_INNODB_INDEX_CORRUPT = 1817 - ER_INVALID_YEAR_COLUMN_LENGTH = 1818 - ER_NOT_VALID_PASSWORD = 1819 - ER_MUST_CHANGE_PASSWORD = 1820 - ER_FK_NO_INDEX_CHILD = 1821 - ER_FK_NO_INDEX_PARENT = 1822 - ER_FK_FAIL_ADD_SYSTEM = 1823 - ER_FK_CANNOT_OPEN_PARENT = 1824 - ER_FK_INCORRECT_OPTION = 1825 - ER_FK_DUP_NAME = 1826 - ER_PASSWORD_FORMAT = 1827 - ER_FK_COLUMN_CANNOT_DROP = 1828 - ER_FK_COLUMN_CANNOT_DROP_CHILD = 1829 - ER_FK_COLUMN_NOT_NULL = 1830 - ER_DUP_INDEX = 1831 - ER_FK_COLUMN_CANNOT_CHANGE = 1832 - ER_FK_COLUMN_CANNOT_CHANGE_CHILD = 1833 - ER_FK_CANNOT_DELETE_PARENT = 1834 - ER_MALFORMED_PACKET = 1835 - ER_READ_ONLY_MODE = 1836 - ER_GTID_NEXT_TYPE_UNDEFINED_GROUP = 1837 - ER_VARIABLE_NOT_SETTABLE_IN_SP = 1838 - ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF = 1839 - ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY = 1840 - ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY = 1841 - ER_GTID_PURGED_WAS_CHANGED = 1842 - ER_GTID_EXECUTED_WAS_CHANGED = 1843 - ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES = 1844 - ER_ALTER_OPERATION_NOT_SUPPORTED = 1845 - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON = 1846 - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY = 1847 - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION = 1848 - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME = 1849 - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE = 1850 - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK = 1851 - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_IGNORE = 1852 - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK = 1853 - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC = 1854 - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS = 1855 - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS = 1856 - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS = 1857 - ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE = 1858 - ER_DUP_UNKNOWN_IN_INDEX = 1859 - ER_IDENT_CAUSES_TOO_LONG_PATH = 1860 - ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL = 1861 - ER_MUST_CHANGE_PASSWORD_LOGIN = 1862 - ER_ROW_IN_WRONG_PARTITION = 1863 - ER_ERROR_LAST = 1863 + ER_ERROR_FIRST = 1000 + ER_HASHCHK = 1000 + ER_NISAMCHK = 1001 + ER_NO = 1002 + ER_YES = 1003 + ER_CANT_CREATE_FILE = 1004 + ER_CANT_CREATE_TABLE = 1005 + ER_CANT_CREATE_DB = 1006 + ER_DB_CREATE_EXISTS = 1007 + ER_DB_DROP_EXISTS = 1008 + ER_DB_DROP_DELETE = 1009 + ER_DB_DROP_RMDIR = 1010 + ER_CANT_DELETE_FILE = 1011 + ER_CANT_FIND_SYSTEM_REC = 1012 + ER_CANT_GET_STAT = 1013 + ER_CANT_GET_WD = 1014 + ER_CANT_LOCK = 1015 + ER_CANT_OPEN_FILE = 1016 + ER_FILE_NOT_FOUND = 1017 + ER_CANT_READ_DIR = 1018 + ER_CANT_SET_WD = 1019 + ER_CHECKREAD = 1020 + ER_DISK_FULL = 1021 + ER_DUP_KEY = 1022 + ER_ERROR_ON_CLOSE = 1023 + ER_ERROR_ON_READ = 1024 + ER_ERROR_ON_RENAME = 1025 + ER_ERROR_ON_WRITE = 1026 + ER_FILE_USED = 1027 + ER_FILSORT_ABORT = 1028 + ER_FORM_NOT_FOUND = 1029 + ER_GET_ERRNO = 1030 + ER_ILLEGAL_HA = 1031 + ER_KEY_NOT_FOUND = 1032 + ER_NOT_FORM_FILE = 1033 + ER_NOT_KEYFILE = 1034 + ER_OLD_KEYFILE = 1035 + ER_OPEN_AS_READONLY = 1036 + ER_OUTOFMEMORY = 1037 + ER_OUT_OF_SORTMEMORY = 1038 + ER_UNEXPECTED_EOF = 1039 + ER_CON_COUNT_ERROR = 1040 + ER_OUT_OF_RESOURCES = 1041 + ER_BAD_HOST_ERROR = 1042 + ER_HANDSHAKE_ERROR = 1043 + ER_DBACCESS_DENIED_ERROR = 1044 + ER_ACCESS_DENIED_ERROR = 1045 + ER_NO_DB_ERROR = 1046 + ER_UNKNOWN_COM_ERROR = 1047 + ER_BAD_NULL_ERROR = 1048 + ER_BAD_DB_ERROR = 1049 + ER_TABLE_EXISTS_ERROR = 1050 + ER_BAD_TABLE_ERROR = 1051 + ER_NON_UNIQ_ERROR = 1052 + ER_SERVER_SHUTDOWN = 1053 + ER_BAD_FIELD_ERROR = 1054 + ER_WRONG_FIELD_WITH_GROUP = 1055 + ER_WRONG_GROUP_FIELD = 1056 + ER_WRONG_SUM_SELECT = 1057 + ER_WRONG_VALUE_COUNT = 1058 + ER_TOO_LONG_IDENT = 1059 + ER_DUP_FIELDNAME = 1060 + ER_DUP_KEYNAME = 1061 + ER_DUP_ENTRY = 1062 + ER_WRONG_FIELD_SPEC = 1063 + ER_PARSE_ERROR = 1064 + ER_EMPTY_QUERY = 1065 + ER_NONUNIQ_TABLE = 1066 + ER_INVALID_DEFAULT = 1067 + ER_MULTIPLE_PRI_KEY = 1068 + ER_TOO_MANY_KEYS = 1069 + ER_TOO_MANY_KEY_PARTS = 1070 + ER_TOO_LONG_KEY = 1071 + ER_KEY_COLUMN_DOES_NOT_EXITS = 1072 + ER_BLOB_USED_AS_KEY = 1073 + ER_TOO_BIG_FIELDLENGTH = 1074 + ER_WRONG_AUTO_KEY = 1075 + ER_READY = 1076 + ER_NORMAL_SHUTDOWN = 1077 + ER_GOT_SIGNAL = 1078 + ER_SHUTDOWN_COMPLETE = 1079 + ER_FORCING_CLOSE = 1080 + ER_IPSOCK_ERROR = 1081 + ER_NO_SUCH_INDEX = 1082 + ER_WRONG_FIELD_TERMINATORS = 1083 + ER_BLOBS_AND_NO_TERMINATED = 1084 + ER_TEXTFILE_NOT_READABLE = 1085 + ER_FILE_EXISTS_ERROR = 1086 + ER_LOAD_INFO = 1087 + ER_ALTER_INFO = 1088 + ER_WRONG_SUB_KEY = 1089 + ER_CANT_REMOVE_ALL_FIELDS = 1090 + ER_CANT_DROP_FIELD_OR_KEY = 1091 + ER_INSERT_INFO = 1092 + ER_UPDATE_TABLE_USED = 1093 + ER_NO_SUCH_THREAD = 1094 + ER_KILL_DENIED_ERROR = 1095 + ER_NO_TABLES_USED = 1096 + ER_TOO_BIG_SET = 1097 + ER_NO_UNIQUE_LOGFILE = 1098 + ER_TABLE_NOT_LOCKED_FOR_WRITE = 1099 + ER_TABLE_NOT_LOCKED = 1100 + ER_BLOB_CANT_HAVE_DEFAULT = 1101 + ER_WRONG_DB_NAME = 1102 + ER_WRONG_TABLE_NAME = 1103 + ER_TOO_BIG_SELECT = 1104 + ER_UNKNOWN_ERROR = 1105 + ER_UNKNOWN_PROCEDURE = 1106 + ER_WRONG_PARAMCOUNT_TO_PROCEDURE = 1107 + ER_WRONG_PARAMETERS_TO_PROCEDURE = 1108 + ER_UNKNOWN_TABLE = 1109 + ER_FIELD_SPECIFIED_TWICE = 1110 + ER_INVALID_GROUP_FUNC_USE = 1111 + ER_UNSUPPORTED_EXTENSION = 1112 + ER_TABLE_MUST_HAVE_COLUMNS = 1113 + ER_RECORD_FILE_FULL = 1114 + ER_UNKNOWN_CHARACTER_SET = 1115 + ER_TOO_MANY_TABLES = 1116 + ER_TOO_MANY_FIELDS = 1117 + ER_TOO_BIG_ROWSIZE = 1118 + ER_STACK_OVERRUN = 1119 + ER_WRONG_OUTER_JOIN = 1120 + ER_NULL_COLUMN_IN_INDEX = 1121 + ER_CANT_FIND_UDF = 1122 + ER_CANT_INITIALIZE_UDF = 1123 + ER_UDF_NO_PATHS = 1124 + ER_UDF_EXISTS = 1125 + ER_CANT_OPEN_LIBRARY = 1126 + ER_CANT_FIND_DL_ENTRY = 1127 + ER_FUNCTION_NOT_DEFINED = 1128 + ER_HOST_IS_BLOCKED = 1129 + ER_HOST_NOT_PRIVILEGED = 1130 + ER_PASSWORD_ANONYMOUS_USER = 1131 + ER_PASSWORD_NOT_ALLOWED = 1132 + ER_PASSWORD_NO_MATCH = 1133 + ER_UPDATE_INFO = 1134 + ER_CANT_CREATE_THREAD = 1135 + ER_WRONG_VALUE_COUNT_ON_ROW = 1136 + ER_CANT_REOPEN_TABLE = 1137 + ER_INVALID_USE_OF_NULL = 1138 + ER_REGEXP_ERROR = 1139 + ER_MIX_OF_GROUP_FUNC_AND_FIELDS = 1140 + ER_NONEXISTING_GRANT = 1141 + ER_TABLEACCESS_DENIED_ERROR = 1142 + ER_COLUMNACCESS_DENIED_ERROR = 1143 + ER_ILLEGAL_GRANT_FOR_TABLE = 1144 + ER_GRANT_WRONG_HOST_OR_USER = 1145 + ER_NO_SUCH_TABLE = 1146 + ER_NONEXISTING_TABLE_GRANT = 1147 + ER_NOT_ALLOWED_COMMAND = 1148 + ER_SYNTAX_ERROR = 1149 + ER_DELAYED_CANT_CHANGE_LOCK = 1150 + ER_TOO_MANY_DELAYED_THREADS = 1151 + ER_ABORTING_CONNECTION = 1152 + ER_NET_PACKET_TOO_LARGE = 1153 + ER_NET_READ_ERROR_FROM_PIPE = 1154 + ER_NET_FCNTL_ERROR = 1155 + ER_NET_PACKETS_OUT_OF_ORDER = 1156 + ER_NET_UNCOMPRESS_ERROR = 1157 + ER_NET_READ_ERROR = 1158 + ER_NET_READ_INTERRUPTED = 1159 + ER_NET_ERROR_ON_WRITE = 1160 + ER_NET_WRITE_INTERRUPTED = 1161 + ER_TOO_LONG_STRING = 1162 + ER_TABLE_CANT_HANDLE_BLOB = 1163 + ER_TABLE_CANT_HANDLE_AUTO_INCREMENT = 1164 + ER_DELAYED_INSERT_TABLE_LOCKED = 1165 + ER_WRONG_COLUMN_NAME = 1166 + ER_WRONG_KEY_COLUMN = 1167 + ER_WRONG_MRG_TABLE = 1168 + ER_DUP_UNIQUE = 1169 + ER_BLOB_KEY_WITHOUT_LENGTH = 1170 + ER_PRIMARY_CANT_HAVE_NULL = 1171 + ER_TOO_MANY_ROWS = 1172 + ER_REQUIRES_PRIMARY_KEY = 1173 + ER_NO_RAID_COMPILED = 1174 + ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE = 1175 + ER_KEY_DOES_NOT_EXITS = 1176 + ER_CHECK_NO_SUCH_TABLE = 1177 + ER_CHECK_NOT_IMPLEMENTED = 1178 + ER_CANT_DO_THIS_DURING_AN_TRANSACTION = 1179 + ER_ERROR_DURING_COMMIT = 1180 + ER_ERROR_DURING_ROLLBACK = 1181 + ER_ERROR_DURING_FLUSH_LOGS = 1182 + ER_ERROR_DURING_CHECKPOINT = 1183 + ER_NEW_ABORTING_CONNECTION = 1184 + ER_DUMP_NOT_IMPLEMENTED = 1185 + ER_FLUSH_MASTER_BINLOG_CLOSED = 1186 + ER_INDEX_REBUILD = 1187 + ER_MASTER = 1188 + ER_MASTER_NET_READ = 1189 + ER_MASTER_NET_WRITE = 1190 + ER_FT_MATCHING_KEY_NOT_FOUND = 1191 + ER_LOCK_OR_ACTIVE_TRANSACTION = 1192 + ER_UNKNOWN_SYSTEM_VARIABLE = 1193 + ER_CRASHED_ON_USAGE = 1194 + ER_CRASHED_ON_REPAIR = 1195 + ER_WARNING_NOT_COMPLETE_ROLLBACK = 1196 + ER_TRANS_CACHE_FULL = 1197 + ER_SLAVE_MUST_STOP = 1198 + ER_SLAVE_NOT_RUNNING = 1199 + ER_BAD_SLAVE = 1200 + ER_MASTER_INFO = 1201 + ER_SLAVE_THREAD = 1202 + ER_TOO_MANY_USER_CONNECTIONS = 1203 + ER_SET_CONSTANTS_ONLY = 1204 + ER_LOCK_WAIT_TIMEOUT = 1205 + ER_LOCK_TABLE_FULL = 1206 + ER_READ_ONLY_TRANSACTION = 1207 + ER_DROP_DB_WITH_READ_LOCK = 1208 + ER_CREATE_DB_WITH_READ_LOCK = 1209 + ER_WRONG_ARGUMENTS = 1210 + ER_NO_PERMISSION_TO_CREATE_USER = 1211 + ER_UNION_TABLES_IN_DIFFERENT_DIR = 1212 + ER_LOCK_DEADLOCK = 1213 + ER_TABLE_CANT_HANDLE_FT = 1214 + ER_CANNOT_ADD_FOREIGN = 1215 + ER_NO_REFERENCED_ROW = 1216 + ER_ROW_IS_REFERENCED = 1217 + ER_CONNECT_TO_MASTER = 1218 + ER_QUERY_ON_MASTER = 1219 + ER_ERROR_WHEN_EXECUTING_COMMAND = 1220 + ER_WRONG_USAGE = 1221 + ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT = 1222 + ER_CANT_UPDATE_WITH_READLOCK = 1223 + ER_MIXING_NOT_ALLOWED = 1224 + ER_DUP_ARGUMENT = 1225 + ER_USER_LIMIT_REACHED = 1226 + ER_SPECIFIC_ACCESS_DENIED_ERROR = 1227 + ER_LOCAL_VARIABLE = 1228 + ER_GLOBAL_VARIABLE = 1229 + ER_NO_DEFAULT = 1230 + ER_WRONG_VALUE_FOR_VAR = 1231 + ER_WRONG_TYPE_FOR_VAR = 1232 + ER_VAR_CANT_BE_READ = 1233 + ER_CANT_USE_OPTION_HERE = 1234 + ER_NOT_SUPPORTED_YET = 1235 + ER_MASTER_FATAL_ERROR_READING_BINLOG = 1236 + ER_SLAVE_IGNORED_TABLE = 1237 + ER_INCORRECT_GLOBAL_LOCAL_VAR = 1238 + ER_WRONG_FK_DEF = 1239 + ER_KEY_REF_DO_NOT_MATCH_TABLE_REF = 1240 + ER_OPERAND_COLUMNS = 1241 + ER_SUBQUERY_NO_1_ROW = 1242 + ER_UNKNOWN_STMT_HANDLER = 1243 + ER_CORRUPT_HELP_DB = 1244 + ER_CYCLIC_REFERENCE = 1245 + ER_AUTO_CONVERT = 1246 + ER_ILLEGAL_REFERENCE = 1247 + ER_DERIVED_MUST_HAVE_ALIAS = 1248 + ER_SELECT_REDUCED = 1249 + ER_TABLENAME_NOT_ALLOWED_HERE = 1250 + ER_NOT_SUPPORTED_AUTH_MODE = 1251 + ER_SPATIAL_CANT_HAVE_NULL = 1252 + ER_COLLATION_CHARSET_MISMATCH = 1253 + ER_SLAVE_WAS_RUNNING = 1254 + ER_SLAVE_WAS_NOT_RUNNING = 1255 + ER_TOO_BIG_FOR_UNCOMPRESS = 1256 + ER_ZLIB_Z_MEM_ERROR = 1257 + ER_ZLIB_Z_BUF_ERROR = 1258 + ER_ZLIB_Z_DATA_ERROR = 1259 + ER_CUT_VALUE_GROUP_CONCAT = 1260 + ER_WARN_TOO_FEW_RECORDS = 1261 + ER_WARN_TOO_MANY_RECORDS = 1262 + ER_WARN_NULL_TO_NOTNULL = 1263 + ER_WARN_DATA_OUT_OF_RANGE = 1264 + WARN_DATA_TRUNCATED = 1265 + ER_WARN_USING_OTHER_HANDLER = 1266 + ER_CANT_AGGREGATE_2COLLATIONS = 1267 + ER_DROP_USER = 1268 + ER_REVOKE_GRANTS = 1269 + ER_CANT_AGGREGATE_3COLLATIONS = 1270 + ER_CANT_AGGREGATE_NCOLLATIONS = 1271 + ER_VARIABLE_IS_NOT_STRUCT = 1272 + ER_UNKNOWN_COLLATION = 1273 + ER_SLAVE_IGNORED_SSL_PARAMS = 1274 + ER_SERVER_IS_IN_SECURE_AUTH_MODE = 1275 + ER_WARN_FIELD_RESOLVED = 1276 + ER_BAD_SLAVE_UNTIL_COND = 1277 + ER_MISSING_SKIP_SLAVE = 1278 + ER_UNTIL_COND_IGNORED = 1279 + ER_WRONG_NAME_FOR_INDEX = 1280 + ER_WRONG_NAME_FOR_CATALOG = 1281 + ER_WARN_QC_RESIZE = 1282 + ER_BAD_FT_COLUMN = 1283 + ER_UNKNOWN_KEY_CACHE = 1284 + ER_WARN_HOSTNAME_WONT_WORK = 1285 + ER_UNKNOWN_STORAGE_ENGINE = 1286 + ER_WARN_DEPRECATED_SYNTAX = 1287 + ER_NON_UPDATABLE_TABLE = 1288 + ER_FEATURE_DISABLED = 1289 + ER_OPTION_PREVENTS_STATEMENT = 1290 + ER_DUPLICATED_VALUE_IN_TYPE = 1291 + ER_TRUNCATED_WRONG_VALUE = 1292 + ER_TOO_MUCH_AUTO_TIMESTAMP_COLS = 1293 + ER_INVALID_ON_UPDATE = 1294 + ER_UNSUPPORTED_PS = 1295 + ER_GET_ERRMSG = 1296 + ER_GET_TEMPORARY_ERRMSG = 1297 + ER_UNKNOWN_TIME_ZONE = 1298 + ER_WARN_INVALID_TIMESTAMP = 1299 + ER_INVALID_CHARACTER_STRING = 1300 + ER_WARN_ALLOWED_PACKET_OVERFLOWED = 1301 + ER_CONFLICTING_DECLARATIONS = 1302 + ER_SP_NO_RECURSIVE_CREATE = 1303 + ER_SP_ALREADY_EXISTS = 1304 + ER_SP_DOES_NOT_EXIST = 1305 + ER_SP_DROP_FAILED = 1306 + ER_SP_STORE_FAILED = 1307 + ER_SP_LILABEL_MISMATCH = 1308 + ER_SP_LABEL_REDEFINE = 1309 + ER_SP_LABEL_MISMATCH = 1310 + ER_SP_UNINIT_VAR = 1311 + ER_SP_BADSELECT = 1312 + ER_SP_BADRETURN = 1313 + ER_SP_BADSTATEMENT = 1314 + ER_UPDATE_LOG_DEPRECATED_IGNORED = 1315 + ER_UPDATE_LOG_DEPRECATED_TRANSLATED = 1316 + ER_QUERY_INTERRUPTED = 1317 + ER_SP_WRONG_NO_OF_ARGS = 1318 + ER_SP_COND_MISMATCH = 1319 + ER_SP_NORETURN = 1320 + ER_SP_NORETURNEND = 1321 + ER_SP_BAD_CURSOR_QUERY = 1322 + ER_SP_BAD_CURSOR_SELECT = 1323 + ER_SP_CURSOR_MISMATCH = 1324 + ER_SP_CURSOR_ALREADY_OPEN = 1325 + ER_SP_CURSOR_NOT_OPEN = 1326 + ER_SP_UNDECLARED_VAR = 1327 + ER_SP_WRONG_NO_OF_FETCH_ARGS = 1328 + ER_SP_FETCH_NO_DATA = 1329 + ER_SP_DUP_PARAM = 1330 + ER_SP_DUP_VAR = 1331 + ER_SP_DUP_COND = 1332 + ER_SP_DUP_CURS = 1333 + ER_SP_CANT_ALTER = 1334 + ER_SP_SUBSELECT_NYI = 1335 + ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG = 1336 + ER_SP_VARCOND_AFTER_CURSHNDLR = 1337 + ER_SP_CURSOR_AFTER_HANDLER = 1338 + ER_SP_CASE_NOT_FOUND = 1339 + ER_FPARSER_TOO_BIG_FILE = 1340 + ER_FPARSER_BAD_HEADER = 1341 + ER_FPARSER_EOF_IN_COMMENT = 1342 + ER_FPARSER_ERROR_IN_PARAMETER = 1343 + ER_FPARSER_EOF_IN_UNKNOWN_PARAMETER = 1344 + ER_VIEW_NO_EXPLAIN = 1345 + ER_FRM_UNKNOWN_TYPE = 1346 + ER_WRONG_OBJECT = 1347 + ER_NONUPDATEABLE_COLUMN = 1348 + ER_VIEW_SELECT_DERIVED = 1349 + ER_VIEW_SELECT_CLAUSE = 1350 + ER_VIEW_SELECT_VARIABLE = 1351 + ER_VIEW_SELECT_TMPTABLE = 1352 + ER_VIEW_WRONG_LIST = 1353 + ER_WARN_VIEW_MERGE = 1354 + ER_WARN_VIEW_WITHOUT_KEY = 1355 + ER_VIEW_INVALID = 1356 + ER_SP_NO_DROP_SP = 1357 + ER_SP_GOTO_IN_HNDLR = 1358 + ER_TRG_ALREADY_EXISTS = 1359 + ER_TRG_DOES_NOT_EXIST = 1360 + ER_TRG_ON_VIEW_OR_TEMP_TABLE = 1361 + ER_TRG_CANT_CHANGE_ROW = 1362 + ER_TRG_NO_SUCH_ROW_IN_TRG = 1363 + ER_NO_DEFAULT_FOR_FIELD = 1364 + ER_DIVISION_BY_ZERO = 1365 + ER_TRUNCATED_WRONG_VALUE_FOR_FIELD = 1366 + ER_ILLEGAL_VALUE_FOR_TYPE = 1367 + ER_VIEW_NONUPD_CHECK = 1368 + ER_VIEW_CHECK_FAILED = 1369 + ER_PROCACCESS_DENIED_ERROR = 1370 + ER_RELAY_LOG_FAIL = 1371 + ER_PASSWD_LENGTH = 1372 + ER_UNKNOWN_TARGET_BINLOG = 1373 + ER_IO_ERR_LOG_INDEX_READ = 1374 + ER_BINLOG_PURGE_PROHIBITED = 1375 + ER_FSEEK_FAIL = 1376 + ER_BINLOG_PURGE_FATAL_ERR = 1377 + ER_LOG_IN_USE = 1378 + ER_LOG_PURGE_UNKNOWN_ERR = 1379 + ER_RELAY_LOG_INIT = 1380 + ER_NO_BINARY_LOGGING = 1381 + ER_RESERVED_SYNTAX = 1382 + ER_WSAS_FAILED = 1383 + ER_DIFF_GROUPS_PROC = 1384 + ER_NO_GROUP_FOR_PROC = 1385 + ER_ORDER_WITH_PROC = 1386 + ER_LOGGING_PROHIBIT_CHANGING_OF = 1387 + ER_NO_FILE_MAPPING = 1388 + ER_WRONG_MAGIC = 1389 + ER_PS_MANY_PARAM = 1390 + ER_KEY_PART_0 = 1391 + ER_VIEW_CHECKSUM = 1392 + ER_VIEW_MULTIUPDATE = 1393 + ER_VIEW_NO_INSERT_FIELD_LIST = 1394 + ER_VIEW_DELETE_MERGE_VIEW = 1395 + ER_CANNOT_USER = 1396 + ER_XAER_NOTA = 1397 + ER_XAER_INVAL = 1398 + ER_XAER_RMFAIL = 1399 + ER_XAER_OUTSIDE = 1400 + ER_XAER_RMERR = 1401 + ER_XA_RBROLLBACK = 1402 + ER_NONEXISTING_PROC_GRANT = 1403 + ER_PROC_AUTO_GRANT_FAIL = 1404 + ER_PROC_AUTO_REVOKE_FAIL = 1405 + ER_DATA_TOO_LONG = 1406 + ER_SP_BAD_SQLSTATE = 1407 + ER_STARTUP = 1408 + ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR = 1409 + ER_CANT_CREATE_USER_WITH_GRANT = 1410 + ER_WRONG_VALUE_FOR_TYPE = 1411 + ER_TABLE_DEF_CHANGED = 1412 + ER_SP_DUP_HANDLER = 1413 + ER_SP_NOT_VAR_ARG = 1414 + ER_SP_NO_RETSET = 1415 + ER_CANT_CREATE_GEOMETRY_OBJECT = 1416 + ER_FAILED_ROUTINE_BREAK_BINLOG = 1417 + ER_BINLOG_UNSAFE_ROUTINE = 1418 + ER_BINLOG_CREATE_ROUTINE_NEED_SUPER = 1419 + ER_EXEC_STMT_WITH_OPEN_CURSOR = 1420 + ER_STMT_HAS_NO_OPEN_CURSOR = 1421 + ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG = 1422 + ER_NO_DEFAULT_FOR_VIEW_FIELD = 1423 + ER_SP_NO_RECURSION = 1424 + ER_TOO_BIG_SCALE = 1425 + ER_TOO_BIG_PRECISION = 1426 + ER_M_BIGGER_THAN_D = 1427 + ER_WRONG_LOCK_OF_SYSTEM_TABLE = 1428 + ER_CONNECT_TO_FOREIGN_DATA_SOURCE = 1429 + ER_QUERY_ON_FOREIGN_DATA_SOURCE = 1430 + ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST = 1431 + ER_FOREIGN_DATA_STRING_INVALID_CANT_CREATE = 1432 + ER_FOREIGN_DATA_STRING_INVALID = 1433 + ER_CANT_CREATE_FEDERATED_TABLE = 1434 + ER_TRG_IN_WRONG_SCHEMA = 1435 + ER_STACK_OVERRUN_NEED_MORE = 1436 + ER_TOO_LONG_BODY = 1437 + ER_WARN_CANT_DROP_DEFAULT_KEYCACHE = 1438 + ER_TOO_BIG_DISPLAYWIDTH = 1439 + ER_XAER_DUPID = 1440 + ER_DATETIME_FUNCTION_OVERFLOW = 1441 + ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG = 1442 + ER_VIEW_PREVENT_UPDATE = 1443 + ER_PS_NO_RECURSION = 1444 + ER_SP_CANT_SET_AUTOCOMMIT = 1445 + ER_MALFORMED_DEFINER = 1446 + ER_VIEW_FRM_NO_USER = 1447 + ER_VIEW_OTHER_USER = 1448 + ER_NO_SUCH_USER = 1449 + ER_FORBID_SCHEMA_CHANGE = 1450 + ER_ROW_IS_REFERENCED_2 = 1451 + ER_NO_REFERENCED_ROW_2 = 1452 + ER_SP_BAD_VAR_SHADOW = 1453 + ER_TRG_NO_DEFINER = 1454 + ER_OLD_FILE_FORMAT = 1455 + ER_SP_RECURSION_LIMIT = 1456 + ER_SP_PROC_TABLE_CORRUPT = 1457 + ER_SP_WRONG_NAME = 1458 + ER_TABLE_NEEDS_UPGRADE = 1459 + ER_SP_NO_AGGREGATE = 1460 + ER_MAX_PREPARED_STMT_COUNT_REACHED = 1461 + ER_VIEW_RECURSIVE = 1462 + ER_NON_GROUPING_FIELD_USED = 1463 + ER_TABLE_CANT_HANDLE_SPKEYS = 1464 + ER_NO_TRIGGERS_ON_SYSTEM_SCHEMA = 1465 + ER_REMOVED_SPACES = 1466 + ER_AUTOINC_READ_FAILED = 1467 + ER_USERNAME = 1468 + ER_HOSTNAME = 1469 + ER_WRONG_STRING_LENGTH = 1470 + ER_NON_INSERTABLE_TABLE = 1471 + ER_ADMIN_WRONG_MRG_TABLE = 1472 + ER_TOO_HIGH_LEVEL_OF_NESTING_FOR_SELECT = 1473 + ER_NAME_BECOMES_EMPTY = 1474 + ER_AMBIGUOUS_FIELD_TERM = 1475 + ER_FOREIGN_SERVER_EXISTS = 1476 + ER_FOREIGN_SERVER_DOESNT_EXIST = 1477 + ER_ILLEGAL_HA_CREATE_OPTION = 1478 + ER_PARTITION_REQUIRES_VALUES_ERROR = 1479 + ER_PARTITION_WRONG_VALUES_ERROR = 1480 + ER_PARTITION_MAXVALUE_ERROR = 1481 + ER_PARTITION_SUBPARTITION_ERROR = 1482 + ER_PARTITION_SUBPART_MIX_ERROR = 1483 + ER_PARTITION_WRONG_NO_PART_ERROR = 1484 + ER_PARTITION_WRONG_NO_SUBPART_ERROR = 1485 + ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR = 1486 + ER_NO_CONST_EXPR_IN_RANGE_OR_LIST_ERROR = 1487 + ER_FIELD_NOT_FOUND_PART_ERROR = 1488 + ER_LIST_OF_FIELDS_ONLY_IN_HASH_ERROR = 1489 + ER_INCONSISTENT_PARTITION_INFO_ERROR = 1490 + ER_PARTITION_FUNC_NOT_ALLOWED_ERROR = 1491 + ER_PARTITIONS_MUST_BE_DEFINED_ERROR = 1492 + ER_RANGE_NOT_INCREASING_ERROR = 1493 + ER_INCONSISTENT_TYPE_OF_FUNCTIONS_ERROR = 1494 + ER_MULTIPLE_DEF_CONST_IN_LIST_PART_ERROR = 1495 + ER_PARTITION_ENTRY_ERROR = 1496 + ER_MIX_HANDLER_ERROR = 1497 + ER_PARTITION_NOT_DEFINED_ERROR = 1498 + ER_TOO_MANY_PARTITIONS_ERROR = 1499 + ER_SUBPARTITION_ERROR = 1500 + ER_CANT_CREATE_HANDLER_FILE = 1501 + ER_BLOB_FIELD_IN_PART_FUNC_ERROR = 1502 + ER_UNIQUE_KEY_NEED_ALL_FIELDS_IN_PF = 1503 + ER_NO_PARTS_ERROR = 1504 + ER_PARTITION_MGMT_ON_NONPARTITIONED = 1505 + ER_FOREIGN_KEY_ON_PARTITIONED = 1506 + ER_DROP_PARTITION_NON_EXISTENT = 1507 + ER_DROP_LAST_PARTITION = 1508 + ER_COALESCE_ONLY_ON_HASH_PARTITION = 1509 + ER_REORG_HASH_ONLY_ON_SAME_NO = 1510 + ER_REORG_NO_PARAM_ERROR = 1511 + ER_ONLY_ON_RANGE_LIST_PARTITION = 1512 + ER_ADD_PARTITION_SUBPART_ERROR = 1513 + ER_ADD_PARTITION_NO_NEW_PARTITION = 1514 + ER_COALESCE_PARTITION_NO_PARTITION = 1515 + ER_REORG_PARTITION_NOT_EXIST = 1516 + ER_SAME_NAME_PARTITION = 1517 + ER_NO_BINLOG_ERROR = 1518 + ER_CONSECUTIVE_REORG_PARTITIONS = 1519 + ER_REORG_OUTSIDE_RANGE = 1520 + ER_PARTITION_FUNCTION_FAILURE = 1521 + ER_PART_STATE_ERROR = 1522 + ER_LIMITED_PART_RANGE = 1523 + ER_PLUGIN_IS_NOT_LOADED = 1524 + ER_WRONG_VALUE = 1525 + ER_NO_PARTITION_FOR_GIVEN_VALUE = 1526 + ER_FILEGROUP_OPTION_ONLY_ONCE = 1527 + ER_CREATE_FILEGROUP_FAILED = 1528 + ER_DROP_FILEGROUP_FAILED = 1529 + ER_TABLESPACE_AUTO_EXTEND_ERROR = 1530 + ER_WRONG_SIZE_NUMBER = 1531 + ER_SIZE_OVERFLOW_ERROR = 1532 + ER_ALTER_FILEGROUP_FAILED = 1533 + ER_BINLOG_ROW_LOGGING_FAILED = 1534 + ER_BINLOG_ROW_WRONG_TABLE_DEF = 1535 + ER_BINLOG_ROW_RBR_TO_SBR = 1536 + ER_EVENT_ALREADY_EXISTS = 1537 + ER_EVENT_STORE_FAILED = 1538 + ER_EVENT_DOES_NOT_EXIST = 1539 + ER_EVENT_CANT_ALTER = 1540 + ER_EVENT_DROP_FAILED = 1541 + ER_EVENT_INTERVAL_NOT_POSITIVE_OR_TOO_BIG = 1542 + ER_EVENT_ENDS_BEFORE_STARTS = 1543 + ER_EVENT_EXEC_TIME_IN_THE_PAST = 1544 + ER_EVENT_OPEN_TABLE_FAILED = 1545 + ER_EVENT_NEITHER_M_EXPR_NOR_M_AT = 1546 + ER_OBSOLETE_COL_COUNT_DOESNT_MATCH_CORRUPTED = 1547 + ER_OBSOLETE_CANNOT_LOAD_FROM_TABLE = 1548 + ER_EVENT_CANNOT_DELETE = 1549 + ER_EVENT_COMPILE_ERROR = 1550 + ER_EVENT_SAME_NAME = 1551 + ER_EVENT_DATA_TOO_LONG = 1552 + ER_DROP_INDEX_FK = 1553 + ER_WARN_DEPRECATED_SYNTAX_WITH_VER = 1554 + ER_CANT_WRITE_LOCK_LOG_TABLE = 1555 + ER_CANT_LOCK_LOG_TABLE = 1556 + ER_FOREIGN_DUPLICATE_KEY_OLD_UNUSED = 1557 + ER_COL_COUNT_DOESNT_MATCH_PLEASE_UPDATE = 1558 + ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR = 1559 + ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_FORMAT = 1560 + ER_NDB_CANT_SWITCH_BINLOG_FORMAT = 1561 + ER_PARTITION_NO_TEMPORARY = 1562 + ER_PARTITION_CONST_DOMAIN_ERROR = 1563 + ER_PARTITION_FUNCTION_IS_NOT_ALLOWED = 1564 + ER_DDL_LOG_ERROR = 1565 + ER_NULL_IN_VALUES_LESS_THAN = 1566 + ER_WRONG_PARTITION_NAME = 1567 + ER_CANT_CHANGE_TX_CHARACTERISTICS = 1568 + ER_DUP_ENTRY_AUTOINCREMENT_CASE = 1569 + ER_EVENT_MODIFY_QUEUE_ERROR = 1570 + ER_EVENT_SET_VAR_ERROR = 1571 + ER_PARTITION_MERGE_ERROR = 1572 + ER_CANT_ACTIVATE_LOG = 1573 + ER_RBR_NOT_AVAILABLE = 1574 + ER_BASE64_DECODE_ERROR = 1575 + ER_EVENT_RECURSION_FORBIDDEN = 1576 + ER_EVENTS_DB_ERROR = 1577 + ER_ONLY_INTEGERS_ALLOWED = 1578 + ER_UNSUPORTED_LOG_ENGINE = 1579 + ER_BAD_LOG_STATEMENT = 1580 + ER_CANT_RENAME_LOG_TABLE = 1581 + ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT = 1582 + ER_WRONG_PARAMETERS_TO_NATIVE_FCT = 1583 + ER_WRONG_PARAMETERS_TO_STORED_FCT = 1584 + ER_NATIVE_FCT_NAME_COLLISION = 1585 + ER_DUP_ENTRY_WITH_KEY_NAME = 1586 + ER_BINLOG_PURGE_EMFILE = 1587 + ER_EVENT_CANNOT_CREATE_IN_THE_PAST = 1588 + ER_EVENT_CANNOT_ALTER_IN_THE_PAST = 1589 + ER_SLAVE_INCIDENT = 1590 + ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT = 1591 + ER_BINLOG_UNSAFE_STATEMENT = 1592 + ER_SLAVE_FATAL_ERROR = 1593 + ER_SLAVE_RELAY_LOG_READ_FAILURE = 1594 + ER_SLAVE_RELAY_LOG_WRITE_FAILURE = 1595 + ER_SLAVE_CREATE_EVENT_FAILURE = 1596 + ER_SLAVE_MASTER_COM_FAILURE = 1597 + ER_BINLOG_LOGGING_IMPOSSIBLE = 1598 + ER_VIEW_NO_CREATION_CTX = 1599 + ER_VIEW_INVALID_CREATION_CTX = 1600 + ER_SR_INVALID_CREATION_CTX = 1601 + ER_TRG_CORRUPTED_FILE = 1602 + ER_TRG_NO_CREATION_CTX = 1603 + ER_TRG_INVALID_CREATION_CTX = 1604 + ER_EVENT_INVALID_CREATION_CTX = 1605 + ER_TRG_CANT_OPEN_TABLE = 1606 + ER_CANT_CREATE_SROUTINE = 1607 + ER_NEVER_USED = 1608 + ER_NO_FORMAT_DESCRIPTION_EVENT_BEFORE_BINLOG_STATEMENT = 1609 + ER_SLAVE_CORRUPT_EVENT = 1610 + ER_LOAD_DATA_INVALID_COLUMN = 1611 + ER_LOG_PURGE_NO_FILE = 1612 + ER_XA_RBTIMEOUT = 1613 + ER_XA_RBDEADLOCK = 1614 + ER_NEED_REPREPARE = 1615 + ER_DELAYED_NOT_SUPPORTED = 1616 + WARN_NO_MASTER_INFO = 1617 + WARN_OPTION_IGNORED = 1618 + WARN_PLUGIN_DELETE_BUILTIN = 1619 + WARN_PLUGIN_BUSY = 1620 + ER_VARIABLE_IS_READONLY = 1621 + ER_WARN_ENGINE_TRANSACTION_ROLLBACK = 1622 + ER_SLAVE_HEARTBEAT_FAILURE = 1623 + ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE = 1624 + ER_NDB_REPLICATION_SCHEMA_ERROR = 1625 + ER_CONFLICT_FN_PARSE_ERROR = 1626 + ER_EXCEPTIONS_WRITE_ERROR = 1627 + ER_TOO_LONG_TABLE_COMMENT = 1628 + ER_TOO_LONG_FIELD_COMMENT = 1629 + ER_FUNC_INEXISTENT_NAME_COLLISION = 1630 + ER_DATABASE_NAME = 1631 + ER_TABLE_NAME = 1632 + ER_PARTITION_NAME = 1633 + ER_SUBPARTITION_NAME = 1634 + ER_TEMPORARY_NAME = 1635 + ER_RENAMED_NAME = 1636 + ER_TOO_MANY_CONCURRENT_TRXS = 1637 + WARN_NON_ASCII_SEPARATOR_NOT_IMPLEMENTED = 1638 + ER_DEBUG_SYNC_TIMEOUT = 1639 + ER_DEBUG_SYNC_HIT_LIMIT = 1640 + ER_DUP_SIGNAL_SET = 1641 + ER_SIGNAL_WARN = 1642 + ER_SIGNAL_NOT_FOUND = 1643 + ER_SIGNAL_EXCEPTION = 1644 + ER_RESIGNAL_WITHOUT_ACTIVE_HANDLER = 1645 + ER_SIGNAL_BAD_CONDITION_TYPE = 1646 + WARN_COND_ITEM_TRUNCATED = 1647 + ER_COND_ITEM_TOO_LONG = 1648 + ER_UNKNOWN_LOCALE = 1649 + ER_SLAVE_IGNORE_SERVER_IDS = 1650 + ER_QUERY_CACHE_DISABLED = 1651 + ER_SAME_NAME_PARTITION_FIELD = 1652 + ER_PARTITION_COLUMN_LIST_ERROR = 1653 + ER_WRONG_TYPE_COLUMN_VALUE_ERROR = 1654 + ER_TOO_MANY_PARTITION_FUNC_FIELDS_ERROR = 1655 + ER_MAXVALUE_IN_VALUES_IN = 1656 + ER_TOO_MANY_VALUES_ERROR = 1657 + ER_ROW_SINGLE_PARTITION_FIELD_ERROR = 1658 + ER_FIELD_TYPE_NOT_ALLOWED_AS_PARTITION_FIELD = 1659 + ER_PARTITION_FIELDS_TOO_LONG = 1660 + ER_BINLOG_ROW_ENGINE_AND_STMT_ENGINE = 1661 + ER_BINLOG_ROW_MODE_AND_STMT_ENGINE = 1662 + ER_BINLOG_UNSAFE_AND_STMT_ENGINE = 1663 + ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE = 1664 + ER_BINLOG_STMT_MODE_AND_ROW_ENGINE = 1665 + ER_BINLOG_ROW_INJECTION_AND_STMT_MODE = 1666 + ER_BINLOG_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE = 1667 + ER_BINLOG_UNSAFE_LIMIT = 1668 + ER_BINLOG_UNSAFE_INSERT_DELAYED = 1669 + ER_BINLOG_UNSAFE_SYSTEM_TABLE = 1670 + ER_BINLOG_UNSAFE_AUTOINC_COLUMNS = 1671 + ER_BINLOG_UNSAFE_UDF = 1672 + ER_BINLOG_UNSAFE_SYSTEM_VARIABLE = 1673 + ER_BINLOG_UNSAFE_SYSTEM_FUNCTION = 1674 + ER_BINLOG_UNSAFE_NONTRANS_AFTER_TRANS = 1675 + ER_MESSAGE_AND_STATEMENT = 1676 + ER_SLAVE_CONVERSION_FAILED = 1677 + ER_SLAVE_CANT_CREATE_CONVERSION = 1678 + ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_FORMAT = 1679 + ER_PATH_LENGTH = 1680 + ER_WARN_DEPRECATED_SYNTAX_NO_REPLACEMENT = 1681 + ER_WRONG_NATIVE_TABLE_STRUCTURE = 1682 + ER_WRONG_PERFSCHEMA_USAGE = 1683 + ER_WARN_I_S_SKIPPED_TABLE = 1684 + ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_BINLOG_DIRECT = 1685 + ER_STORED_FUNCTION_PREVENTS_SWITCH_BINLOG_DIRECT = 1686 + ER_SPATIAL_MUST_HAVE_GEOM_COL = 1687 + ER_TOO_LONG_INDEX_COMMENT = 1688 + ER_LOCK_ABORTED = 1689 + ER_DATA_OUT_OF_RANGE = 1690 + ER_WRONG_SPVAR_TYPE_IN_LIMIT = 1691 + ER_BINLOG_UNSAFE_MULTIPLE_ENGINES_AND_SELF_LOGGING_ENGINE = 1692 + ER_BINLOG_UNSAFE_MIXED_STATEMENT = 1693 + ER_INSIDE_TRANSACTION_PREVENTS_SWITCH_SQL_LOG_BIN = 1694 + ER_STORED_FUNCTION_PREVENTS_SWITCH_SQL_LOG_BIN = 1695 + ER_FAILED_READ_FROM_PAR_FILE = 1696 + ER_VALUES_IS_NOT_INT_TYPE_ERROR = 1697 + ER_ACCESS_DENIED_NO_PASSWORD_ERROR = 1698 + ER_SET_PASSWORD_AUTH_PLUGIN = 1699 + ER_GRANT_PLUGIN_USER_EXISTS = 1700 + ER_TRUNCATE_ILLEGAL_FK = 1701 + ER_PLUGIN_IS_PERMANENT = 1702 + ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MIN = 1703 + ER_SLAVE_HEARTBEAT_VALUE_OUT_OF_RANGE_MAX = 1704 + ER_STMT_CACHE_FULL = 1705 + ER_MULTI_UPDATE_KEY_CONFLICT = 1706 + ER_TABLE_NEEDS_REBUILD = 1707 + WARN_OPTION_BELOW_LIMIT = 1708 + ER_INDEX_COLUMN_TOO_LONG = 1709 + ER_ERROR_IN_TRIGGER_BODY = 1710 + ER_ERROR_IN_UNKNOWN_TRIGGER_BODY = 1711 + ER_INDEX_CORRUPT = 1712 + ER_UNDO_RECORD_TOO_BIG = 1713 + ER_BINLOG_UNSAFE_INSERT_IGNORE_SELECT = 1714 + ER_BINLOG_UNSAFE_INSERT_SELECT_UPDATE = 1715 + ER_BINLOG_UNSAFE_REPLACE_SELECT = 1716 + ER_BINLOG_UNSAFE_CREATE_IGNORE_SELECT = 1717 + ER_BINLOG_UNSAFE_CREATE_REPLACE_SELECT = 1718 + ER_BINLOG_UNSAFE_UPDATE_IGNORE = 1719 + ER_PLUGIN_NO_UNINSTALL = 1720 + ER_PLUGIN_NO_INSTALL = 1721 + ER_BINLOG_UNSAFE_WRITE_AUTOINC_SELECT = 1722 + ER_BINLOG_UNSAFE_CREATE_SELECT_AUTOINC = 1723 + ER_BINLOG_UNSAFE_INSERT_TWO_KEYS = 1724 + ER_TABLE_IN_FK_CHECK = 1725 + ER_UNSUPPORTED_ENGINE = 1726 + ER_BINLOG_UNSAFE_AUTOINC_NOT_FIRST = 1727 + ER_CANNOT_LOAD_FROM_TABLE_V2 = 1728 + ER_MASTER_DELAY_VALUE_OUT_OF_RANGE = 1729 + ER_ONLY_FD_AND_RBR_EVENTS_ALLOWED_IN_BINLOG_STATEMENT = 1730 + ER_PARTITION_EXCHANGE_DIFFERENT_OPTION = 1731 + ER_PARTITION_EXCHANGE_PART_TABLE = 1732 + ER_PARTITION_EXCHANGE_TEMP_TABLE = 1733 + ER_PARTITION_INSTEAD_OF_SUBPARTITION = 1734 + ER_UNKNOWN_PARTITION = 1735 + ER_TABLES_DIFFERENT_METADATA = 1736 + ER_ROW_DOES_NOT_MATCH_PARTITION = 1737 + ER_BINLOG_CACHE_SIZE_GREATER_THAN_MAX = 1738 + ER_WARN_INDEX_NOT_APPLICABLE = 1739 + ER_PARTITION_EXCHANGE_FOREIGN_KEY = 1740 + ER_NO_SUCH_KEY_VALUE = 1741 + ER_RPL_INFO_DATA_TOO_LONG = 1742 + ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE = 1743 + ER_BINLOG_READ_EVENT_CHECKSUM_FAILURE = 1744 + ER_BINLOG_STMT_CACHE_SIZE_GREATER_THAN_MAX = 1745 + ER_CANT_UPDATE_TABLE_IN_CREATE_TABLE_SELECT = 1746 + ER_PARTITION_CLAUSE_ON_NONPARTITIONED = 1747 + ER_ROW_DOES_NOT_MATCH_GIVEN_PARTITION_SET = 1748 + ER_NO_SUCH_PARTITION__UNUSED = 1749 + ER_CHANGE_RPL_INFO_REPOSITORY_FAILURE = 1750 + ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_CREATED_TEMP_TABLE = 1751 + ER_WARNING_NOT_COMPLETE_ROLLBACK_WITH_DROPPED_TEMP_TABLE = 1752 + ER_MTS_FEATURE_IS_NOT_SUPPORTED = 1753 + ER_MTS_UPDATED_DBS_GREATER_MAX = 1754 + ER_MTS_CANT_PARALLEL = 1755 + ER_MTS_INCONSISTENT_DATA = 1756 + ER_FULLTEXT_NOT_SUPPORTED_WITH_PARTITIONING = 1757 + ER_DA_INVALID_CONDITION_NUMBER = 1758 + ER_INSECURE_PLAIN_TEXT = 1759 + ER_INSECURE_CHANGE_MASTER = 1760 + ER_FOREIGN_DUPLICATE_KEY_WITH_CHILD_INFO = 1761 + ER_FOREIGN_DUPLICATE_KEY_WITHOUT_CHILD_INFO = 1762 + ER_SQLTHREAD_WITH_SECURE_SLAVE = 1763 + ER_TABLE_HAS_NO_FT = 1764 + ER_VARIABLE_NOT_SETTABLE_IN_SF_OR_TRIGGER = 1765 + ER_VARIABLE_NOT_SETTABLE_IN_TRANSACTION = 1766 + ER_GTID_NEXT_IS_NOT_IN_GTID_NEXT_LIST = 1767 + ER_CANT_CHANGE_GTID_NEXT_IN_TRANSACTION_WHEN_GTID_NEXT_LIST_IS_NULL = 1768 + ER_SET_STATEMENT_CANNOT_INVOKE_FUNCTION = 1769 + ER_GTID_NEXT_CANT_BE_AUTOMATIC_IF_GTID_NEXT_LIST_IS_NON_NULL = 1770 + ER_SKIPPING_LOGGED_TRANSACTION = 1771 + ER_MALFORMED_GTID_SET_SPECIFICATION = 1772 + ER_MALFORMED_GTID_SET_ENCODING = 1773 + ER_MALFORMED_GTID_SPECIFICATION = 1774 + ER_GNO_EXHAUSTED = 1775 + ER_BAD_SLAVE_AUTO_POSITION = 1776 + ER_AUTO_POSITION_REQUIRES_GTID_MODE_ON = 1777 + ER_CANT_DO_IMPLICIT_COMMIT_IN_TRX_WHEN_GTID_NEXT_IS_SET = 1778 + ER_GTID_MODE_2_OR_3_REQUIRES_ENFORCE_GTID_CONSISTENCY_ON = 1779 + ER_GTID_MODE_REQUIRES_BINLOG = 1780 + ER_CANT_SET_GTID_NEXT_TO_GTID_WHEN_GTID_MODE_IS_OFF = 1781 + ER_CANT_SET_GTID_NEXT_TO_ANONYMOUS_WHEN_GTID_MODE_IS_ON = 1782 + ER_CANT_SET_GTID_NEXT_LIST_TO_NON_NULL_WHEN_GTID_MODE_IS_OFF = 1783 + ER_FOUND_GTID_EVENT_WHEN_GTID_MODE_IS_OFF = 1784 + ER_GTID_UNSAFE_NON_TRANSACTIONAL_TABLE = 1785 + ER_GTID_UNSAFE_CREATE_SELECT = 1786 + ER_GTID_UNSAFE_CREATE_DROP_TEMPORARY_TABLE_IN_TRANSACTION = 1787 + ER_GTID_MODE_CAN_ONLY_CHANGE_ONE_STEP_AT_A_TIME = 1788 + ER_MASTER_HAS_PURGED_REQUIRED_GTIDS = 1789 + ER_CANT_SET_GTID_NEXT_WHEN_OWNING_GTID = 1790 + ER_UNKNOWN_EXPLAIN_FORMAT = 1791 + ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION = 1792 + ER_TOO_LONG_TABLE_PARTITION_COMMENT = 1793 + ER_SLAVE_CONFIGURATION = 1794 + ER_INNODB_FT_LIMIT = 1795 + ER_INNODB_NO_FT_TEMP_TABLE = 1796 + ER_INNODB_FT_WRONG_DOCID_COLUMN = 1797 + ER_INNODB_FT_WRONG_DOCID_INDEX = 1798 + ER_INNODB_ONLINE_LOG_TOO_BIG = 1799 + ER_UNKNOWN_ALTER_ALGORITHM = 1800 + ER_UNKNOWN_ALTER_LOCK = 1801 + ER_MTS_CHANGE_MASTER_CANT_RUN_WITH_GAPS = 1802 + ER_MTS_RECOVERY_FAILURE = 1803 + ER_MTS_RESET_WORKERS = 1804 + ER_COL_COUNT_DOESNT_MATCH_CORRUPTED_V2 = 1805 + ER_SLAVE_SILENT_RETRY_TRANSACTION = 1806 + ER_DISCARD_FK_CHECKS_RUNNING = 1807 + ER_TABLE_SCHEMA_MISMATCH = 1808 + ER_TABLE_IN_SYSTEM_TABLESPACE = 1809 + ER_IO_READ_ERROR = 1810 + ER_IO_WRITE_ERROR = 1811 + ER_TABLESPACE_MISSING = 1812 + ER_TABLESPACE_EXISTS = 1813 + ER_TABLESPACE_DISCARDED = 1814 + ER_INTERNAL_ERROR = 1815 + ER_INNODB_IMPORT_ERROR = 1816 + ER_INNODB_INDEX_CORRUPT = 1817 + ER_INVALID_YEAR_COLUMN_LENGTH = 1818 + ER_NOT_VALID_PASSWORD = 1819 + ER_MUST_CHANGE_PASSWORD = 1820 + ER_FK_NO_INDEX_CHILD = 1821 + ER_FK_NO_INDEX_PARENT = 1822 + ER_FK_FAIL_ADD_SYSTEM = 1823 + ER_FK_CANNOT_OPEN_PARENT = 1824 + ER_FK_INCORRECT_OPTION = 1825 + ER_FK_DUP_NAME = 1826 + ER_PASSWORD_FORMAT = 1827 + ER_FK_COLUMN_CANNOT_DROP = 1828 + ER_FK_COLUMN_CANNOT_DROP_CHILD = 1829 + ER_FK_COLUMN_NOT_NULL = 1830 + ER_DUP_INDEX = 1831 + ER_FK_COLUMN_CANNOT_CHANGE = 1832 + ER_FK_COLUMN_CANNOT_CHANGE_CHILD = 1833 + ER_FK_CANNOT_DELETE_PARENT = 1834 + ER_MALFORMED_PACKET = 1835 + ER_READ_ONLY_MODE = 1836 + ER_GTID_NEXT_TYPE_UNDEFINED_GROUP = 1837 + ER_VARIABLE_NOT_SETTABLE_IN_SP = 1838 + ER_CANT_SET_GTID_PURGED_WHEN_GTID_MODE_IS_OFF = 1839 + ER_CANT_SET_GTID_PURGED_WHEN_GTID_EXECUTED_IS_NOT_EMPTY = 1840 + ER_CANT_SET_GTID_PURGED_WHEN_OWNED_GTIDS_IS_NOT_EMPTY = 1841 + ER_GTID_PURGED_WAS_CHANGED = 1842 + ER_GTID_EXECUTED_WAS_CHANGED = 1843 + ER_BINLOG_STMT_MODE_AND_NO_REPL_TABLES = 1844 + ER_ALTER_OPERATION_NOT_SUPPORTED = 1845 + ER_ALTER_OPERATION_NOT_SUPPORTED_REASON = 1846 + ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COPY = 1847 + ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_PARTITION = 1848 + ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_RENAME = 1849 + ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE = 1850 + ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK = 1851 + ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_IGNORE = 1852 + ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK = 1853 + ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC = 1854 + ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS = 1855 + ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS = 1856 + ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS = 1857 + ER_SQL_SLAVE_SKIP_COUNTER_NOT_SETTABLE_IN_GTID_MODE = 1858 + ER_DUP_UNKNOWN_IN_INDEX = 1859 + ER_IDENT_CAUSES_TOO_LONG_PATH = 1860 + ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL = 1861 + ER_MUST_CHANGE_PASSWORD_LOGIN = 1862 + ER_ROW_IN_WRONG_PARTITION = 1863 + ER_ERROR_LAST = 1863 ) diff --git a/vendor/github.com/siddontang/go-mysql/mysql/errname.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/errname.go similarity index 99% rename from vendor/github.com/siddontang/go-mysql/mysql/errname.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/errname.go index 7f8575a..0ff7a13 100644 --- a/vendor/github.com/siddontang/go-mysql/mysql/errname.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/errname.go @@ -591,7 +591,7 @@ var MySQLErrName = map[uint16]string{ ER_BINLOG_PURGE_EMFILE: "Too many files opened, please execute the command again", ER_EVENT_CANNOT_CREATE_IN_THE_PAST: "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was dropped immediately after creation.", ER_EVENT_CANNOT_ALTER_IN_THE_PAST: "Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future.", - ER_SLAVE_INCIDENT: "The incident %s occured on the master. Message: %-.64s", + ER_SLAVE_INCIDENT: "The incident %s occurred on the master. Message: %-.64s", ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT: "Table has no partition for some existing values", ER_BINLOG_UNSAFE_STATEMENT: "Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. %s", ER_SLAVE_FATAL_ERROR: "Fatal error: %s", diff --git a/vendor/github.com/siddontang/go-mysql/mysql/error.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/error.go similarity index 100% rename from vendor/github.com/siddontang/go-mysql/mysql/error.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/error.go diff --git a/vendor/github.com/siddontang/go-mysql/mysql/field.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/field.go similarity index 98% rename from vendor/github.com/siddontang/go-mysql/mysql/field.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/field.go index 84b3606..e0f8e6f 100644 --- a/vendor/github.com/siddontang/go-mysql/mysql/field.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/field.go @@ -3,7 +3,7 @@ package mysql import ( "encoding/binary" - "github.com/siddontang/go-mysql/utils" + "github.com/go-mysql-org/go-mysql/utils" ) type FieldData []byte @@ -130,7 +130,7 @@ func (f *Field) Parse(p FieldData) (err error) { f.DefaultValue = p[pos:(pos + int(f.DefaultValueLength))] } - return + return nil } func (p FieldData) Parse() (f *Field, err error) { diff --git a/vendor/github.com/siddontang/go-mysql/mysql/gtid.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/gtid.go similarity index 100% rename from vendor/github.com/siddontang/go-mysql/mysql/gtid.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/gtid.go diff --git a/vendor/github.com/siddontang/go-mysql/mysql/mariadb_gtid.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/mariadb_gtid.go similarity index 93% rename from vendor/github.com/siddontang/go-mysql/mysql/mariadb_gtid.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/mariadb_gtid.go index 0a9136b..8bfffd0 100644 --- a/vendor/github.com/siddontang/go-mysql/mysql/mariadb_gtid.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/mariadb_gtid.go @@ -3,12 +3,12 @@ package mysql import ( "bytes" "fmt" + "sort" "strconv" "strings" "github.com/pingcap/errors" "github.com/siddontang/go-log/log" - "github.com/siddontang/go/hack" ) // MariadbGTID represent mariadb gtid, [domain ID]-[server-id]-[sequence] @@ -113,15 +113,9 @@ func ParseMariadbGTIDSet(str string) (GTIDSet, error) { if str == "" { return s, nil } - - sp := strings.Split(str, ",") - - //todo, handle redundant same uuid - for i := 0; i < len(sp); i++ { - err := s.Update(sp[i]) - if err != nil { - return nil, errors.Trace(err) - } + err := s.Update(str) + if err != nil { + return nil, err } return s, nil } @@ -147,17 +141,29 @@ func (s *MariadbGTIDSet) AddSet(gtid *MariadbGTID) error { // Update updates mariadb gtid set func (s *MariadbGTIDSet) Update(GTIDStr string) error { - gtid, err := ParseMariadbGTID(GTIDStr) - if err != nil { - return err + sp := strings.Split(GTIDStr, ",") + //todo, handle redundant same uuid + for i := 0; i < len(sp); i++ { + gtid, err := ParseMariadbGTID(sp[i]) + if err != nil { + return errors.Trace(err) + } + err = s.AddSet(gtid) + if err != nil { + return errors.Trace(err) + } } - - err = s.AddSet(gtid) - return errors.Trace(err) + return nil } func (s *MariadbGTIDSet) String() string { - return hack.String(s.Encode()) + sets := make([]string, 0, len(s.Sets)) + for _, set := range s.Sets { + sets = append(sets, set.String()) + } + sort.Strings(sets) + + return strings.Join(sets, ",") } // Encode encodes mariadb gtid set diff --git a/vendor/github.com/siddontang/go-mysql/mysql/mysql_gtid.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/mysql_gtid.go similarity index 90% rename from vendor/github.com/siddontang/go-mysql/mysql/mysql_gtid.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/mysql_gtid.go index 151581f..fbd5b7b 100644 --- a/vendor/github.com/siddontang/go-mysql/mysql/mysql_gtid.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/mysql_gtid.go @@ -32,8 +32,10 @@ func parseInterval(str string) (i Interval, err error) { i.Stop = i.Start + 1 case 2: i.Start, err = strconv.ParseInt(p[0], 10, 64) - i.Stop, err = strconv.ParseInt(p[1], 10, 64) - i.Stop = i.Stop + 1 + if err == nil { + i.Stop, err = strconv.ParseInt(p[1], 10, 64) + i.Stop++ + } default: err = errors.Errorf("invalid interval format, must n[-n]") } @@ -230,14 +232,14 @@ func (s *UUIDSet) String() string { } func (s *UUIDSet) encode(w io.Writer) { - w.Write(s.SID.Bytes()) + _, _ = w.Write(s.SID.Bytes()) n := int64(len(s.Intervals)) - binary.Write(w, binary.LittleEndian, n) + _ = binary.Write(w, binary.LittleEndian, n) for _, i := range s.Intervals { - binary.Write(w, binary.LittleEndian, i.Start) - binary.Write(w, binary.LittleEndian, i.Stop) + _ = binary.Write(w, binary.LittleEndian, i.Start) + _ = binary.Write(w, binary.LittleEndian, i.Stop) } } @@ -292,7 +294,7 @@ func (s *UUIDSet) Decode(data []byte) error { func (s *UUIDSet) Clone() *UUIDSet { clone := new(UUIDSet) - clone.SID, _ = uuid.FromString(s.SID.String()) + copy(clone.SID[:], s.SID[:]) clone.Intervals = s.Intervals.Normalize() return clone @@ -318,7 +320,6 @@ func ParseMysqlGTIDSet(str string) (GTIDSet, error) { } else { s.AddSet(set) } - } return s, nil } @@ -362,13 +363,13 @@ func (s *MysqlGTIDSet) AddSet(set *UUIDSet) { } func (s *MysqlGTIDSet) Update(GTIDStr string) error { - uuidSet, err := ParseUUIDSet(GTIDStr) + gtidSet, err := ParseMysqlGTIDSet(GTIDStr) if err != nil { return err } - - s.AddSet(uuidSet) - + for _, uuidSet := range gtidSet.(*MysqlGTIDSet).Sets { + s.AddSet(uuidSet) + } return nil } @@ -414,15 +415,28 @@ func (s *MysqlGTIDSet) Equal(o GTIDSet) bool { } return true - } func (s *MysqlGTIDSet) String() string { + // there is only one element in gtid set + if len(s.Sets) == 1 { + for _, set := range s.Sets { + return set.String() + } + } + + // sort multi set var buf bytes.Buffer - sep := "" + sets := make([]string, 0, len(s.Sets)) for _, set := range s.Sets { + sets = append(sets, set.String()) + } + sort.Strings(sets) + + sep := "" + for _, set := range sets { buf.WriteString(sep) - buf.WriteString(set.String()) + buf.WriteString(set) sep = "," } @@ -432,7 +446,7 @@ func (s *MysqlGTIDSet) String() string { func (s *MysqlGTIDSet) Encode() []byte { var buf bytes.Buffer - binary.Write(&buf, binary.LittleEndian, uint64(len(s.Sets))) + _ = binary.Write(&buf, binary.LittleEndian, uint64(len(s.Sets))) for i := range s.Sets { s.Sets[i].encode(&buf) diff --git a/vendor/github.com/siddontang/go-mysql/mysql/parse_binary.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/parse_binary.go similarity index 96% rename from vendor/github.com/siddontang/go-mysql/mysql/parse_binary.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/parse_binary.go index b9b8179..03b35ca 100644 --- a/vendor/github.com/siddontang/go-mysql/mysql/parse_binary.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/parse_binary.go @@ -20,7 +20,7 @@ func ParseBinaryUint16(data []byte) uint16 { } func ParseBinaryInt24(data []byte) int32 { - u32 := uint32(ParseBinaryUint24(data)) + u32 := ParseBinaryUint24(data) if u32&0x00800000 != 0 { u32 |= 0xFF000000 } diff --git a/vendor/github.com/go-mysql-org/go-mysql/mysql/position.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/position.go new file mode 100644 index 0000000..c592d63 --- /dev/null +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/position.go @@ -0,0 +1,80 @@ +package mysql + +import ( + "fmt" + "strconv" + "strings" +) + +// For binlog filename + position based replication +type Position struct { + Name string + Pos uint32 +} + +func (p Position) Compare(o Position) int { + // First compare binlog name + nameCmp := CompareBinlogFileName(p.Name, o.Name) + if nameCmp != 0 { + return nameCmp + } + // Same binlog file, compare position + if p.Pos > o.Pos { + return 1 + } else if p.Pos < o.Pos { + return -1 + } else { + return 0 + } +} + +func (p Position) String() string { + return fmt.Sprintf("(%s, %d)", p.Name, p.Pos) +} + +func CompareBinlogFileName(a, b string) int { + // sometimes it's convenient to construct a `Position` literal with no `Name` + if a == "" && b == "" { + return 0 + } else if a == "" { + return -1 + } else if b == "" { + return 1 + } + + splitBinlogName := func(n string) (string, int) { + // mysqld appends a numeric extension to the binary log base name to generate binary log file names + // ... + // If you supply an extension in the log name (for example, --log-bin=base_name.extension), + // the extension is silently removed and ignored. + // ref: https://dev.mysql.com/doc/refman/8.0/en/binary-log.html + i := strings.LastIndexByte(n, '.') + if i == -1 { + // try keeping backward compatibility + return n, 0 + } + + seq, err := strconv.Atoi(n[i+1:]) + if err != nil { + panic(fmt.Sprintf("binlog file %s doesn't contain numeric extension", err)) + } + return n[:i], seq + } + + aBase, aSeq := splitBinlogName(a) + bBase, bSeq := splitBinlogName(b) + + if aBase > bBase { + return 1 + } else if aBase < bBase { + return -1 + } + + if aSeq > bSeq { + return 1 + } else if aSeq < bSeq { + return -1 + } else { + return 0 + } +} diff --git a/vendor/github.com/siddontang/go-mysql/mysql/result.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/result.go similarity index 100% rename from vendor/github.com/siddontang/go-mysql/mysql/result.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/result.go diff --git a/vendor/github.com/siddontang/go-mysql/mysql/resultset.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/resultset.go similarity index 94% rename from vendor/github.com/siddontang/go-mysql/mysql/resultset.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/resultset.go index 2da6e3b..f244b7d 100644 --- a/vendor/github.com/siddontang/go-mysql/mysql/resultset.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/resultset.go @@ -27,9 +27,9 @@ var ( } ) -func NewResultset(resultsetCount int) *Resultset { +func NewResultset(fieldsCount int) *Resultset { r := resultsetPool.Get().(*Resultset) - r.reset(resultsetCount) + r.Reset(fieldsCount) return r } @@ -37,7 +37,7 @@ func (r *Resultset) returnToPool() { resultsetPool.Put(r) } -func (r *Resultset) reset(count int) { +func (r *Resultset) Reset(fieldsCount int) { r.RawPkg = r.RawPkg[:0] r.Fields = r.Fields[:0] @@ -52,14 +52,14 @@ func (r *Resultset) reset(count int) { r.FieldNames = make(map[string]int) } - if count == 0 { + if fieldsCount == 0 { return } - if cap(r.Fields) < count { - r.Fields = make([]*Field, count) + if cap(r.Fields) < fieldsCount { + r.Fields = make([]*Field, fieldsCount) } else { - r.Fields = r.Fields[:count] + r.Fields = r.Fields[:fieldsCount] } } @@ -142,7 +142,7 @@ func (r *Resultset) GetUint(row, column int) (uint64, error) { case uint32: return uint64(v), nil case uint64: - return uint64(v), nil + return v, nil case float32: return uint64(v), nil case float64: diff --git a/vendor/github.com/siddontang/go-mysql/mysql/resultset_helper.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/resultset_helper.go similarity index 93% rename from vendor/github.com/siddontang/go-mysql/mysql/resultset_helper.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/resultset_helper.go index 4e8bf6d..3c22c9c 100644 --- a/vendor/github.com/siddontang/go-mysql/mysql/resultset_helper.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/resultset_helper.go @@ -17,7 +17,7 @@ func formatTextValue(value interface{}) ([]byte, error) { case int32: return strconv.AppendInt(nil, int64(v), 10), nil case int64: - return strconv.AppendInt(nil, int64(v), 10), nil + return strconv.AppendInt(nil, v, 10), nil case int: return strconv.AppendInt(nil, int64(v), 10), nil case uint8: @@ -27,13 +27,13 @@ func formatTextValue(value interface{}) ([]byte, error) { case uint32: return strconv.AppendUint(nil, uint64(v), 10), nil case uint64: - return strconv.AppendUint(nil, uint64(v), 10), nil + return strconv.AppendUint(nil, v, 10), nil case uint: return strconv.AppendUint(nil, uint64(v), 10), nil case float32: return strconv.AppendFloat(nil, float64(v), 'f', -1, 64), nil case float64: - return strconv.AppendFloat(nil, float64(v), 'f', -1, 64), nil + return strconv.AppendFloat(nil, v, 'f', -1, 64), nil case []byte: return v, nil case string: @@ -64,7 +64,7 @@ func formatBinaryValue(value interface{}) ([]byte, error) { case uint32: return Uint64ToBytes(uint64(v)), nil case uint64: - return Uint64ToBytes(uint64(v)), nil + return Uint64ToBytes(v), nil case uint: return Uint64ToBytes(uint64(v)), nil case float32: @@ -146,7 +146,10 @@ func BuildSimpleTextResultset(names []string, values [][]interface{}) (*Resultse } if r.Fields[j] == nil { r.Fields[j] = &Field{Name: hack.Slice(names[j]), Type: typ} - formatField(r.Fields[j], value) + err = formatField(r.Fields[j], value) + if err != nil { + return nil, errors.Trace(err) + } } else if typ != r.Fields[j].Type { // we got another type in the same column. in general, we treat it as an error, except // the case, when old value was null, and the new one isn't null, so we can update @@ -154,7 +157,10 @@ func BuildSimpleTextResultset(names []string, values [][]interface{}) (*Resultse oldIsNull, newIsNull := r.Fields[j].Type == MYSQL_TYPE_NULL, typ == MYSQL_TYPE_NULL if oldIsNull && !newIsNull { // old is null, new isn't, update type info. r.Fields[j].Type = typ - formatField(r.Fields[j], value) + err = formatField(r.Fields[j], value) + if err != nil { + return nil, errors.Trace(err) + } } else if !oldIsNull && !newIsNull { // different non-null types, that's an error. return nil, errors.Errorf("row types aren't consistent") } diff --git a/vendor/github.com/siddontang/go-mysql/mysql/rowdata.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/rowdata.go similarity index 99% rename from vendor/github.com/siddontang/go-mysql/mysql/rowdata.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/rowdata.go index f5a493f..d3cfd0a 100644 --- a/vendor/github.com/siddontang/go-mysql/mysql/rowdata.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/rowdata.go @@ -3,8 +3,8 @@ package mysql import ( "strconv" + "github.com/go-mysql-org/go-mysql/utils" "github.com/pingcap/errors" - "github.com/siddontang/go-mysql/utils" ) type RowData []byte diff --git a/vendor/github.com/siddontang/go-mysql/mysql/state.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/state.go similarity index 100% rename from vendor/github.com/siddontang/go-mysql/mysql/state.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/state.go diff --git a/vendor/github.com/siddontang/go-mysql/mysql/util.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/util.go similarity index 99% rename from vendor/github.com/siddontang/go-mysql/mysql/util.go rename to vendor/github.com/go-mysql-org/go-mysql/mysql/util.go index b9e0501..054fe4f 100644 --- a/vendor/github.com/siddontang/go-mysql/mysql/util.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/util.go @@ -114,7 +114,7 @@ func RandomBuf(size int) ([]byte, error) { // avoid to generate '\0' for i, b := range buf { - if uint8(b) == 0 { + if b == 0 { buf[i] = '0' } } diff --git a/vendor/github.com/siddontang/go-mysql/packet/conn.go b/vendor/github.com/go-mysql-org/go-mysql/packet/conn.go similarity index 98% rename from vendor/github.com/siddontang/go-mysql/packet/conn.go rename to vendor/github.com/go-mysql-org/go-mysql/packet/conn.go index 13ed29e..c60f68e 100644 --- a/vendor/github.com/siddontang/go-mysql/packet/conn.go +++ b/vendor/github.com/go-mysql-org/go-mysql/packet/conn.go @@ -13,9 +13,9 @@ import ( "crypto/x509" "encoding/pem" + . "github.com/go-mysql-org/go-mysql/mysql" + "github.com/go-mysql-org/go-mysql/utils" "github.com/pingcap/errors" - . "github.com/siddontang/go-mysql/mysql" - "github.com/siddontang/go-mysql/utils" ) type BufPool struct { @@ -134,7 +134,7 @@ func (c *Conn) ReadPacketTo(w io.Writer) error { } length := int(uint32(c.header[0]) | uint32(c.header[1])<<8 | uint32(c.header[2])<<16) - sequence := uint8(c.header[3]) + sequence := c.header[3] if sequence != c.Sequence { return errors.Errorf("invalid sequence %d != %d", sequence, c.Sequence) diff --git a/vendor/github.com/siddontang/go-mysql/replication/backup.go b/vendor/github.com/go-mysql-org/go-mysql/replication/backup.go similarity index 93% rename from vendor/github.com/siddontang/go-mysql/replication/backup.go rename to vendor/github.com/go-mysql-org/go-mysql/replication/backup.go index 9bf72a4..c299ebc 100644 --- a/vendor/github.com/siddontang/go-mysql/replication/backup.go +++ b/vendor/github.com/go-mysql-org/go-mysql/replication/backup.go @@ -7,8 +7,8 @@ import ( "path" "time" + . "github.com/go-mysql-org/go-mysql/mysql" "github.com/pingcap/errors" - . "github.com/siddontang/go-mysql/mysql" ) // StartBackup: Like mysqlbinlog remote raw backup @@ -22,7 +22,9 @@ func (b *BinlogSyncer) StartBackup(backupDir string, p Position, timeout time.Du // Force use raw mode b.parser.SetRawMode(true) - os.MkdirAll(backupDir, 0755) + if err := os.MkdirAll(backupDir, 0755); err != nil { + return errors.Trace(err) + } s, err := b.StartSync(p) if err != nil { @@ -82,7 +84,6 @@ func (b *BinlogSyncer) StartBackup(backupDir string, p Position, timeout time.Du if _, err = f.Write(BinLogFileHeader); err != nil { return errors.Trace(err) } - } if n, err := f.Write(e.RawData); err != nil { diff --git a/vendor/github.com/siddontang/go-mysql/replication/binlogstreamer.go b/vendor/github.com/go-mysql-org/go-mysql/replication/binlogstreamer.go similarity index 99% rename from vendor/github.com/siddontang/go-mysql/replication/binlogstreamer.go rename to vendor/github.com/go-mysql-org/go-mysql/replication/binlogstreamer.go index 2347522..56b8622 100644 --- a/vendor/github.com/siddontang/go-mysql/replication/binlogstreamer.go +++ b/vendor/github.com/go-mysql-org/go-mysql/replication/binlogstreamer.go @@ -2,9 +2,10 @@ package replication import ( "context" + "time" + "github.com/pingcap/errors" "github.com/siddontang/go-log/log" - "time" ) var ( diff --git a/vendor/github.com/siddontang/go-mysql/replication/binlogsyncer.go b/vendor/github.com/go-mysql-org/go-mysql/replication/binlogsyncer.go similarity index 96% rename from vendor/github.com/siddontang/go-mysql/replication/binlogsyncer.go rename to vendor/github.com/go-mysql-org/go-mysql/replication/binlogsyncer.go index 2cec5de..a5dfcb5 100644 --- a/vendor/github.com/siddontang/go-mysql/replication/binlogsyncer.go +++ b/vendor/github.com/go-mysql-org/go-mysql/replication/binlogsyncer.go @@ -10,11 +10,11 @@ import ( "sync" "time" + "github.com/go-mysql-org/go-mysql/client" + . "github.com/go-mysql-org/go-mysql/mysql" "github.com/pingcap/errors" uuid "github.com/satori/go.uuid" "github.com/siddontang/go-log/log" - "github.com/siddontang/go-mysql/client" - . "github.com/siddontang/go-mysql/mysql" ) var ( @@ -104,6 +104,10 @@ type BinlogSyncerConfig struct { // https://mariadb.com/kb/en/library/com_binlog_dump/ // https://mariadb.com/kb/en/library/annotate_rows_event/ DumpCommandFlag uint16 + + //Option function is used to set outside of BinlogSyncerConfig, between mysql connection and COM_REGISTER_SLAVE + //For MariaDB: slave_gtid_ignore_duplicates、skip_replication、slave_until_gtid + Option func(*client.Conn) error } // BinlogSyncer syncs binlog event from server. @@ -179,7 +183,10 @@ func (b *BinlogSyncer) close() { b.cancel() if b.c != nil { - b.c.SetReadDeadline(time.Now().Add(100 * time.Millisecond)) + err := b.c.SetReadDeadline(time.Now().Add(100 * time.Millisecond)) + if err != nil { + log.Warnf(`could not set read deadline: %s`, err) + } } // kill last connection id @@ -223,18 +230,26 @@ func (b *BinlogSyncer) registerSlave() error { return errors.Trace(err) } + if b.cfg.Option != nil { + if err = b.cfg.Option(b.c); err != nil { + return errors.Trace(err) + } + } + if len(b.cfg.Charset) != 0 { - b.c.SetCharset(b.cfg.Charset) + if err = b.c.SetCharset(b.cfg.Charset); err != nil { + return errors.Trace(err) + } } //set read timeout if b.cfg.ReadTimeout > 0 { - b.c.SetReadDeadline(time.Now().Add(b.cfg.ReadTimeout)) + _ = b.c.SetReadDeadline(time.Now().Add(b.cfg.ReadTimeout)) } if b.cfg.RecvBufferSize > 0 { if tcp, ok := b.c.Conn.Conn.(*net.TCPConn); ok { - tcp.SetReadBuffer(b.cfg.RecvBufferSize) + _ = tcp.SetReadBuffer(b.cfg.RecvBufferSize) } } @@ -268,7 +283,6 @@ func (b *BinlogSyncer) registerSlave() error { // if _, err = b.c.Execute(`SET @master_binlog_checksum=@@global.binlog_checksum`); err != nil { // return errors.Trace(err) // } - } } @@ -697,7 +711,7 @@ func (b *BinlogSyncer) onStream(s *BinlogStreamer) { //set read timeout if b.cfg.ReadTimeout > 0 { - b.c.SetReadDeadline(time.Now().Add(b.cfg.ReadTimeout)) + _ = b.c.SetReadDeadline(time.Now().Add(b.cfg.ReadTimeout)) } // Reset retry count on successful packet receieve diff --git a/vendor/github.com/siddontang/go-mysql/replication/const.go b/vendor/github.com/go-mysql-org/go-mysql/replication/const.go similarity index 100% rename from vendor/github.com/siddontang/go-mysql/replication/const.go rename to vendor/github.com/go-mysql-org/go-mysql/replication/const.go diff --git a/vendor/github.com/siddontang/go-mysql/replication/doc.go b/vendor/github.com/go-mysql-org/go-mysql/replication/doc.go similarity index 100% rename from vendor/github.com/siddontang/go-mysql/replication/doc.go rename to vendor/github.com/go-mysql-org/go-mysql/replication/doc.go diff --git a/vendor/github.com/siddontang/go-mysql/replication/event.go b/vendor/github.com/go-mysql-org/go-mysql/replication/event.go similarity index 97% rename from vendor/github.com/siddontang/go-mysql/replication/event.go rename to vendor/github.com/go-mysql-org/go-mysql/replication/event.go index e5457c8..90b38d3 100644 --- a/vendor/github.com/siddontang/go-mysql/replication/event.go +++ b/vendor/github.com/go-mysql-org/go-mysql/replication/event.go @@ -11,8 +11,9 @@ import ( "unicode" "github.com/pingcap/errors" - "github.com/satori/go.uuid" - . "github.com/siddontang/go-mysql/mysql" + uuid "github.com/satori/go.uuid" + + . "github.com/go-mysql-org/go-mysql/mysql" ) const ( @@ -100,7 +101,7 @@ func (h *EventHeader) Decode(data []byte) error { } func (h *EventHeader) Dump(w io.Writer) { - fmt.Fprintf(w, "=== %s ===\n", EventType(h.EventType)) + fmt.Fprintf(w, "=== %s ===\n", h.EventType) fmt.Fprintf(w, "Date: %s\n", time.Unix(int64(h.Timestamp), 0).Format(TimeFormat)) fmt.Fprintf(w, "Log position: %d\n", h.LogPos) fmt.Fprintf(w, "Event size: %d\n", h.EventSize) @@ -309,7 +310,7 @@ func (e *QueryEvent) Decode(data []byte) error { e.ExecutionTime = binary.LittleEndian.Uint32(data[pos:]) pos += 4 - schemaLength := uint8(data[pos]) + schemaLength := data[pos] pos++ e.ErrorCode = binary.LittleEndian.Uint16(data[pos:]) @@ -368,7 +369,7 @@ type GTIDEvent struct { func (e *GTIDEvent) Decode(data []byte) error { pos := 0 - e.CommitFlag = uint8(data[pos]) + e.CommitFlag = data[pos] pos++ e.SID = data[pos : pos+SidLength] pos += SidLength @@ -376,7 +377,7 @@ func (e *GTIDEvent) Decode(data []byte) error { pos += 8 if len(data) >= 42 { - if uint8(data[pos]) == LogicalTimestampTypeCode { + if data[pos] == LogicalTimestampTypeCode { pos++ e.LastCommitted = int64(binary.LittleEndian.Uint64(data[pos:])) pos += PartLogicalTimestampLength @@ -394,11 +395,9 @@ func (e *GTIDEvent) Decode(data []byte) error { e.ImmediateCommitTimestamp &= ^(uint64(1) << 55) e.OriginalCommitTimestamp = FixedLengthInt(data[pos : pos+7]) pos += 7 - } else { // Otherwise OriginalCommitTimestamp == ImmediateCommitTimestamp e.OriginalCommitTimestamp = e.ImmediateCommitTimestamp - } // TRANSACTION_LENGTH_MIN_LENGTH = 1 @@ -422,13 +421,10 @@ func (e *GTIDEvent) Decode(data []byte) error { e.ImmediateServerVersion &= ^(uint32(1) << 31) e.OriginalServerVersion = binary.LittleEndian.Uint32(data[pos:]) pos += 4 - } else { // Otherwise OriginalServerVersion == ImmediateServerVersion e.OriginalServerVersion = e.ImmediateServerVersion - } - } } return nil @@ -510,7 +506,7 @@ func (e *ExecuteLoadQueryEvent) Decode(data []byte) error { e.ExecutionTime = binary.LittleEndian.Uint32(data[pos:]) pos += 4 - e.SchemaLength = uint8(data[pos]) + e.SchemaLength = data[pos] pos++ e.ErrorCode = binary.LittleEndian.Uint16(data[pos:]) @@ -528,7 +524,7 @@ func (e *ExecuteLoadQueryEvent) Decode(data []byte) error { e.EndPos = binary.LittleEndian.Uint32(data[pos:]) pos += 4 - e.DupHandlingFlags = uint8(data[pos]) + e.DupHandlingFlags = data[pos] return nil } @@ -601,7 +597,7 @@ func (e *MariadbGTIDEvent) Decode(data []byte) error { pos += 8 e.GTID.DomainID = binary.LittleEndian.Uint32(data[pos:]) pos += 4 - e.Flags = uint8(data[pos]) + e.Flags = data[pos] pos += 1 if (e.Flags & BINLOG_MARIADB_FL_GROUP_COMMIT_ID) > 0 { diff --git a/vendor/github.com/siddontang/go-mysql/replication/generic_event.go b/vendor/github.com/go-mysql-org/go-mysql/replication/generic_event.go similarity index 100% rename from vendor/github.com/siddontang/go-mysql/replication/generic_event.go rename to vendor/github.com/go-mysql-org/go-mysql/replication/generic_event.go diff --git a/vendor/github.com/siddontang/go-mysql/replication/json_binary.go b/vendor/github.com/go-mysql-org/go-mysql/replication/json_binary.go similarity index 99% rename from vendor/github.com/siddontang/go-mysql/replication/json_binary.go rename to vendor/github.com/go-mysql-org/go-mysql/replication/json_binary.go index a5b3b99..ab6c075 100644 --- a/vendor/github.com/siddontang/go-mysql/replication/json_binary.go +++ b/vendor/github.com/go-mysql-org/go-mysql/replication/json_binary.go @@ -5,8 +5,8 @@ import ( "fmt" "math" + . "github.com/go-mysql-org/go-mysql/mysql" "github.com/pingcap/errors" - . "github.com/siddontang/go-mysql/mysql" "github.com/siddontang/go/hack" ) @@ -149,7 +149,7 @@ func (d *jsonBinaryDecoder) decodeObjectOrArray(data []byte, isSmall bool, isObj count := d.decodeCount(data, isSmall) size := d.decodeCount(data[offsetSize:], isSmall) - if d.isDataShort(data, int(size)) { + if d.isDataShort(data, size) { // Before MySQL 5.7.22, json type generated column may have invalid value, // bug ref: https://bugs.mysql.com/bug.php?id=88791 // As generated column value is not used in replication, we can just ignore @@ -452,7 +452,6 @@ func (d *jsonBinaryDecoder) decodeDateTime(data []byte) interface{} { frac := v % (1 << 24) return fmt.Sprintf("%04d-%02d-%02d %02d:%02d:%02d.%06d", year, month, day, hour, minute, second, frac) - } func (d *jsonBinaryDecoder) decodeCount(data []byte, isSmall bool) int { diff --git a/vendor/github.com/siddontang/go-mysql/replication/parser.go b/vendor/github.com/go-mysql-org/go-mysql/replication/parser.go similarity index 98% rename from vendor/github.com/siddontang/go-mysql/replication/parser.go rename to vendor/github.com/go-mysql-org/go-mysql/replication/parser.go index a0cc46c..77eb7e9 100644 --- a/vendor/github.com/siddontang/go-mysql/replication/parser.go +++ b/vendor/github.com/go-mysql-org/go-mysql/replication/parser.go @@ -80,7 +80,7 @@ func (p *BinlogParser) ParseFile(name string, offset int64, onEvent OnEventFunc) offset = 4 } else if offset > 4 { // FORMAT_DESCRIPTION event should be read by default always (despite that fact passed offset may be higher than 4) - if _, err = f.Seek(4, os.SEEK_SET); err != nil { + if _, err = f.Seek(4, io.SeekStart); err != nil { return errors.Errorf("seek %s to %d error %v", name, offset, err) } @@ -89,7 +89,7 @@ func (p *BinlogParser) ParseFile(name string, offset int64, onEvent OnEventFunc) } } - if _, err = f.Seek(offset, os.SEEK_SET); err != nil { + if _, err = f.Seek(offset, io.SeekStart); err != nil { return errors.Errorf("seek %s to %d error %v", name, offset, err) } @@ -157,7 +157,6 @@ func (p *BinlogParser) parseSingleEvent(r io.Reader, onEvent OnEventFunc) (bool, } func (p *BinlogParser) ParseReader(r io.Reader, onEvent OnEventFunc) error { - for { if atomic.LoadUint32(&p.stopProcessing) == 1 { break diff --git a/vendor/github.com/siddontang/go-mysql/replication/row_event.go b/vendor/github.com/go-mysql-org/go-mysql/replication/row_event.go similarity index 97% rename from vendor/github.com/siddontang/go-mysql/replication/row_event.go rename to vendor/github.com/go-mysql-org/go-mysql/replication/row_event.go index f209e0a..d49e51a 100644 --- a/vendor/github.com/siddontang/go-mysql/replication/row_event.go +++ b/vendor/github.com/go-mysql-org/go-mysql/replication/row_event.go @@ -12,8 +12,9 @@ import ( "github.com/pingcap/errors" "github.com/shopspring/decimal" "github.com/siddontang/go-log/log" - . "github.com/siddontang/go-mysql/mysql" "github.com/siddontang/go/hack" + + . "github.com/go-mysql-org/go-mysql/mysql" ) var errMissingTableMapEvent = errors.New("invalid table id, no corresponding table map event") @@ -145,7 +146,7 @@ func (e *TableMapEvent) Decode(data []byte) error { } func bitmapByteSize(columnCount int) int { - return int(columnCount+7) / 8 + return (columnCount + 7) / 8 } // see mysql sql/log_event.h @@ -238,10 +239,8 @@ func (e *TableMapEvent) decodeMeta(data []byte) error { } func (e *TableMapEvent) decodeOptionalMeta(data []byte) (err error) { - pos := 0 for pos < len(data) { - // optional metadata fields are stored in Type, Length, Value(TLV) format // Type takes 1 byte. Length is a packed integer value. Values takes Length bytes t := data[pos] @@ -637,7 +636,6 @@ func (e *TableMapEvent) EnumSetCollationMap() map[int]uint64 { } func (e *TableMapEvent) collationMap(includeType func(int) bool, defaultCharset, columnCharset []uint64) map[int]uint64 { - if len(defaultCharset) != 0 { defaultCollation := defaultCharset[0] @@ -666,7 +664,6 @@ func (e *TableMapEvent) collationMap(includeType func(int) bool, defaultCharset, } if len(columnCharset) != 0 { - p := 0 ret := make(map[int]uint64) for i := 0; i < int(e.ColumnCount); i++ { @@ -739,7 +736,6 @@ func (e *TableMapEvent) GeometryTypeMap() map[int]uint64 { // Table_map_log_event::print_columns in mysql-8.0/sql/log_event.cc and mariadb-10.5/sql/log_event_client.cc func (e *TableMapEvent) realType(i int) byte { - typ := e.ColumnType[i] switch typ { @@ -757,7 +753,6 @@ func (e *TableMapEvent) realType(i int) byte { } func (e *TableMapEvent) IsNumericColumn(i int) bool { - switch e.realType(i) { case MYSQL_TYPE_TINY, MYSQL_TYPE_SHORT, @@ -772,14 +767,12 @@ func (e *TableMapEvent) IsNumericColumn(i int) bool { default: return false } - } // IsCharacterColumn returns true if the column type is considered as character type. // Note that JSON/GEOMETRY types are treated as character type in mariadb. // (JSON is an alias for LONGTEXT in mariadb: https://mariadb.com/kb/en/json-data-type/) func (e *TableMapEvent) IsCharacterColumn(i int) bool { - switch e.realType(i) { case MYSQL_TYPE_STRING, MYSQL_TYPE_VAR_STRING, @@ -796,7 +789,6 @@ func (e *TableMapEvent) IsCharacterColumn(i int) bool { default: return false } - } func (e *TableMapEvent) IsEnumColumn(i int) bool { @@ -846,7 +838,8 @@ type RowsEvent struct { ColumnBitmap2 []byte //rows: invalid: int64, float64, bool, []byte, string - Rows [][]interface{} + Rows [][]interface{} + SkippedColumns [][]int parseTime bool timestampStringLocation *time.Location @@ -854,7 +847,7 @@ type RowsEvent struct { ignoreJSONDecodeErr bool } -func (e *RowsEvent) Decode(data []byte) error { +func (e *RowsEvent) Decode(data []byte) (err2 error) { pos := 0 e.TableID = FixedLengthInt(data[0:e.tableIDSize]) pos += e.tableIDSize @@ -898,7 +891,9 @@ func (e *RowsEvent) Decode(data []byte) error { // ... repeat rows until event-end defer func() { if r := recover(); r != nil { - log.Fatalf("parse rows event panic %v, data %q, parsed rows %#v, table map %#v\n%s", r, data, e, e.Table, Pstack()) + errStr := fmt.Sprintf("parse rows event panic %v, data %q, parsed rows %#v, table map %#v", r, data, e, e.Table) + log.Errorf("%s\n%s", errStr, Pstack()) + err2 = errors.Trace(errors.New(errStr)) } }() @@ -907,6 +902,7 @@ func (e *RowsEvent) Decode(data []byte) error { if e.needBitmap2 { rowsLen += e.ColumnCount } + e.SkippedColumns = make([][]int, 0, rowsLen) e.Rows = make([][]interface{}, 0, rowsLen) for pos < len(data) { @@ -932,6 +928,7 @@ func isBitSet(bitmap []byte, i int) bool { func (e *RowsEvent) decodeRows(data []byte, table *TableMapEvent, bitmap []byte) (int, error) { row := make([]interface{}, e.ColumnCount) + skips := make([]int, 0) pos := 0 @@ -953,6 +950,7 @@ func (e *RowsEvent) decodeRows(data []byte, table *TableMapEvent, bitmap []byte) var err error for i := 0; i < int(e.ColumnCount); i++ { if !isBitSet(bitmap, i) { + skips = append(skips, i) continue } @@ -973,6 +971,7 @@ func (e *RowsEvent) decodeRows(data []byte, table *TableMapEvent, bitmap []byte) } e.Rows = append(e.Rows, row) + e.SkippedColumns = append(e.SkippedColumns, skips) return pos, nil } @@ -1002,7 +1001,7 @@ func (e *RowsEvent) decodeValue(data []byte, tp byte, meta uint16) (v interface{ if b0&0x30 != 0x30 { length = int(uint16(b1) | (uint16((b0&0x30)^0x30) << 4)) - tp = byte(b0 | 0x30) + tp = b0 | 0x30 } else { length = int(meta & 0xFF) tp = b0 @@ -1045,7 +1044,7 @@ func (e *RowsEvent) decodeValue(data []byte, tp byte, meta uint16) (v interface{ n = int(nbits+7) / 8 //use int64 for bit - v, err = decodeBit(data, int(nbits), int(n)) + v, err = decodeBit(data, int(nbits), n) case MYSQL_TYPE_TIMESTAMP: n = 4 t := binary.LittleEndian.Uint32(data) @@ -1092,11 +1091,7 @@ func (e *RowsEvent) decodeValue(data []byte, tp byte, meta uint16) (v interface{ if i32 == 0 { v = "00:00:00" } else { - sign := "" - if i32 < 0 { - sign = "-" - } - v = fmt.Sprintf("%s%02d:%02d:%02d", sign, i32/10000, (i32%10000)/100, i32%100) + v = fmt.Sprintf("%02d:%02d:%02d", i32/10000, (i32%10000)/100, i32%100) } case MYSQL_TYPE_TIME2: v, n, err = decodeTime2(data, meta) @@ -1158,14 +1153,15 @@ func (e *RowsEvent) decodeValue(data []byte, tp byte, meta uint16) (v interface{ default: err = fmt.Errorf("unsupport type %d in binlog and don't know how to handle", tp) } - return + + return v, n, err } func decodeString(data []byte, length int) (v string, n int) { if length < 256 { length = int(data[0]) - n = int(length) + 1 + n = length + 1 v = hack.String(data[1:n]) } else { length = int(binary.LittleEndian.Uint16(data[0:])) @@ -1192,9 +1188,9 @@ func decodeDecimalDecompressValue(compIndx int, data []byte, mask uint8) (size i func decodeDecimal(data []byte, precision int, decimals int, useDecimal bool) (interface{}, int, error) { //see python mysql replication and https://github.com/jeremycole/mysql_binlog - integral := (precision - decimals) - uncompIntegral := int(integral / digitsPerInteger) - uncompFractional := int(decimals / digitsPerInteger) + integral := precision - decimals + uncompIntegral := integral / digitsPerInteger + uncompFractional := decimals / digitsPerInteger compIntegral := integral - (uncompIntegral * digitsPerInteger) compFractional := decimals - (uncompFractional * digitsPerInteger) diff --git a/vendor/github.com/siddontang/go-mysql/replication/time.go b/vendor/github.com/go-mysql-org/go-mysql/replication/time.go similarity index 100% rename from vendor/github.com/siddontang/go-mysql/replication/time.go rename to vendor/github.com/go-mysql-org/go-mysql/replication/time.go diff --git a/vendor/github.com/siddontang/go-mysql/utils/byte_slice_pool.go b/vendor/github.com/go-mysql-org/go-mysql/utils/byte_slice_pool.go similarity index 91% rename from vendor/github.com/siddontang/go-mysql/utils/byte_slice_pool.go rename to vendor/github.com/go-mysql-org/go-mysql/utils/byte_slice_pool.go index be0f1a2..cd51544 100644 --- a/vendor/github.com/siddontang/go-mysql/utils/byte_slice_pool.go +++ b/vendor/github.com/go-mysql-org/go-mysql/utils/byte_slice_pool.go @@ -31,6 +31,6 @@ func ByteSlicePut(data []byte) { select { case byteSliceChan <- data: default: - byteSlicePool.Put(data) + byteSlicePool.Put(data) //nolint:staticcheck } } diff --git a/vendor/github.com/siddontang/go-mysql/utils/bytes_buffer_pool.go b/vendor/github.com/go-mysql-org/go-mysql/utils/bytes_buffer_pool.go similarity index 100% rename from vendor/github.com/siddontang/go-mysql/utils/bytes_buffer_pool.go rename to vendor/github.com/go-mysql-org/go-mysql/utils/bytes_buffer_pool.go diff --git a/vendor/github.com/siddontang/go-mysql/utils/zeroalloc.go b/vendor/github.com/go-mysql-org/go-mysql/utils/zeroalloc.go similarity index 100% rename from vendor/github.com/siddontang/go-mysql/utils/zeroalloc.go rename to vendor/github.com/go-mysql-org/go-mysql/utils/zeroalloc.go diff --git a/vendor/github.com/go-sql-driver/mysql/.travis.yml b/vendor/github.com/go-sql-driver/mysql/.travis.yml deleted file mode 100644 index 56fcf25..0000000 --- a/vendor/github.com/go-sql-driver/mysql/.travis.yml +++ /dev/null @@ -1,129 +0,0 @@ -sudo: false -language: go -go: - - 1.10.x - - 1.11.x - - 1.12.x - - 1.13.x - - master - -before_install: - - go get golang.org/x/tools/cmd/cover - - go get github.com/mattn/goveralls - -before_script: - - echo -e "[server]\ninnodb_log_file_size=256MB\ninnodb_buffer_pool_size=512MB\nmax_allowed_packet=16MB" | sudo tee -a /etc/mysql/my.cnf - - sudo service mysql restart - - .travis/wait_mysql.sh - - mysql -e 'create database gotest;' - -matrix: - include: - - env: DB=MYSQL8 - sudo: required - dist: trusty - go: 1.10.x - services: - - docker - before_install: - - go get golang.org/x/tools/cmd/cover - - go get github.com/mattn/goveralls - - docker pull mysql:8.0 - - docker run -d -p 127.0.0.1:3307:3306 --name mysqld -e MYSQL_DATABASE=gotest -e MYSQL_USER=gotest -e MYSQL_PASSWORD=secret -e MYSQL_ROOT_PASSWORD=verysecret - mysql:8.0 --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1 - - cp .travis/docker.cnf ~/.my.cnf - - .travis/wait_mysql.sh - before_script: - - export MYSQL_TEST_USER=gotest - - export MYSQL_TEST_PASS=secret - - export MYSQL_TEST_ADDR=127.0.0.1:3307 - - export MYSQL_TEST_CONCURRENT=1 - - - env: DB=MYSQL57 - sudo: required - dist: trusty - go: 1.10.x - services: - - docker - before_install: - - go get golang.org/x/tools/cmd/cover - - go get github.com/mattn/goveralls - - docker pull mysql:5.7 - - docker run -d -p 127.0.0.1:3307:3306 --name mysqld -e MYSQL_DATABASE=gotest -e MYSQL_USER=gotest -e MYSQL_PASSWORD=secret -e MYSQL_ROOT_PASSWORD=verysecret - mysql:5.7 --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1 - - cp .travis/docker.cnf ~/.my.cnf - - .travis/wait_mysql.sh - before_script: - - export MYSQL_TEST_USER=gotest - - export MYSQL_TEST_PASS=secret - - export MYSQL_TEST_ADDR=127.0.0.1:3307 - - export MYSQL_TEST_CONCURRENT=1 - - - env: DB=MARIA55 - sudo: required - dist: trusty - go: 1.10.x - services: - - docker - before_install: - - go get golang.org/x/tools/cmd/cover - - go get github.com/mattn/goveralls - - docker pull mariadb:5.5 - - docker run -d -p 127.0.0.1:3307:3306 --name mysqld -e MYSQL_DATABASE=gotest -e MYSQL_USER=gotest -e MYSQL_PASSWORD=secret -e MYSQL_ROOT_PASSWORD=verysecret - mariadb:5.5 --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1 - - cp .travis/docker.cnf ~/.my.cnf - - .travis/wait_mysql.sh - before_script: - - export MYSQL_TEST_USER=gotest - - export MYSQL_TEST_PASS=secret - - export MYSQL_TEST_ADDR=127.0.0.1:3307 - - export MYSQL_TEST_CONCURRENT=1 - - - env: DB=MARIA10_1 - sudo: required - dist: trusty - go: 1.10.x - services: - - docker - before_install: - - go get golang.org/x/tools/cmd/cover - - go get github.com/mattn/goveralls - - docker pull mariadb:10.1 - - docker run -d -p 127.0.0.1:3307:3306 --name mysqld -e MYSQL_DATABASE=gotest -e MYSQL_USER=gotest -e MYSQL_PASSWORD=secret -e MYSQL_ROOT_PASSWORD=verysecret - mariadb:10.1 --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1 - - cp .travis/docker.cnf ~/.my.cnf - - .travis/wait_mysql.sh - before_script: - - export MYSQL_TEST_USER=gotest - - export MYSQL_TEST_PASS=secret - - export MYSQL_TEST_ADDR=127.0.0.1:3307 - - export MYSQL_TEST_CONCURRENT=1 - - - os: osx - osx_image: xcode10.1 - addons: - homebrew: - packages: - - mysql - update: true - go: 1.12.x - before_install: - - go get golang.org/x/tools/cmd/cover - - go get github.com/mattn/goveralls - before_script: - - echo -e "[server]\ninnodb_log_file_size=256MB\ninnodb_buffer_pool_size=512MB\nmax_allowed_packet=16MB\nlocal_infile=1" >> /usr/local/etc/my.cnf - - mysql.server start - - mysql -uroot -e 'CREATE USER gotest IDENTIFIED BY "secret"' - - mysql -uroot -e 'GRANT ALL ON *.* TO gotest' - - mysql -uroot -e 'create database gotest;' - - export MYSQL_TEST_USER=gotest - - export MYSQL_TEST_PASS=secret - - export MYSQL_TEST_ADDR=127.0.0.1:3306 - - export MYSQL_TEST_CONCURRENT=1 - -script: - - go test -v -covermode=count -coverprofile=coverage.out - - go vet ./... - - .travis/gofmt.sh -after_script: - - $HOME/gopath/bin/goveralls -coverprofile=coverage.out -service=travis-ci diff --git a/vendor/github.com/go-sql-driver/mysql/AUTHORS b/vendor/github.com/go-sql-driver/mysql/AUTHORS index ad59898..50afa2c 100644 --- a/vendor/github.com/go-sql-driver/mysql/AUTHORS +++ b/vendor/github.com/go-sql-driver/mysql/AUTHORS @@ -13,11 +13,15 @@ Aaron Hopkins Achille Roussel +Alex Snast Alexey Palazhchenko Andrew Reid +Animesh Ray Arne Hormann +Ariel Mashraki Asta Xie Bulat Gaifullin +Caine Jette Carlos Nieto Chris Moos Craig Wilson @@ -52,6 +56,7 @@ Julien Schmidt Justin Li Justin Nuß Kamil Dziedzic +Kei Kamikawa Kevin Malachowski Kieron Woodhouse Lennart Rudolph @@ -74,20 +79,26 @@ Reed Allman Richard Wilkes Robert Russell Runrioter Wung +Sho Iizuka +Sho Ikeda Shuode Li Simon J Mudd Soroush Pour Stan Putrya Stanley Gunawan Steven Hartland +Tan Jinhua <312841925 at qq.com> Thomas Wodarek Tim Ruffles Tom Jenkinson Vladimir Kovpak +Vladyslav Zhelezniak Xiangyu Hu Xiaobing Jiang Xiuming Chen +Xuehong Chan Zhenye Xie +Zhixin Wen # Organizations @@ -103,3 +114,4 @@ Multiplay Ltd. Percona LLC Pivotal Inc. Stripe Inc. +Zendesk Inc. diff --git a/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md b/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md index 9cb97b3..72a738e 100644 --- a/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md +++ b/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md @@ -1,3 +1,29 @@ +## Version 1.6 (2021-04-01) + +Changes: + + - Migrate the CI service from travis-ci to GitHub Actions (#1176, #1183, #1190) + - `NullTime` is deprecated (#960, #1144) + - Reduce allocations when building SET command (#1111) + - Performance improvement for time formatting (#1118) + - Performance improvement for time parsing (#1098, #1113) + +New Features: + + - Implement `driver.Validator` interface (#1106, #1174) + - Support returning `uint64` from `Valuer` in `ConvertValue` (#1143) + - Add `json.RawMessage` for converter and prepared statement (#1059) + - Interpolate `json.RawMessage` as `string` (#1058) + - Implements `CheckNamedValue` (#1090) + +Bugfixes: + + - Stop rounding times (#1121, #1172) + - Put zero filler into the SSL handshake packet (#1066) + - Fix checking cancelled connections back into the connection pool (#1095) + - Fix remove last 0 byte for mysql_old_password when password is empty (#1133) + + ## Version 1.5 (2020-01-07) Changes: diff --git a/vendor/github.com/go-sql-driver/mysql/README.md b/vendor/github.com/go-sql-driver/mysql/README.md index d2627a4..0b13154 100644 --- a/vendor/github.com/go-sql-driver/mysql/README.md +++ b/vendor/github.com/go-sql-driver/mysql/README.md @@ -35,7 +35,7 @@ A MySQL-Driver for Go's [database/sql](https://golang.org/pkg/database/sql/) pac * Supports queries larger than 16MB * Full [`sql.RawBytes`](https://golang.org/pkg/database/sql/#RawBytes) support. * Intelligent `LONG DATA` handling in prepared statements - * Secure `LOAD DATA LOCAL INFILE` support with file Whitelisting and `io.Reader` support + * Secure `LOAD DATA LOCAL INFILE` support with file allowlisting and `io.Reader` support * Optional `time.Time` parsing * Optional placeholder interpolation @@ -56,15 +56,37 @@ Make sure [Git is installed](https://git-scm.com/downloads) on your machine and _Go MySQL Driver_ is an implementation of Go's `database/sql/driver` interface. You only need to import the driver and can use the full [`database/sql`](https://golang.org/pkg/database/sql/) API then. Use `mysql` as `driverName` and a valid [DSN](#dsn-data-source-name) as `dataSourceName`: + ```go -import "database/sql" -import _ "github.com/go-sql-driver/mysql" +import ( + "database/sql" + "time" + + _ "github.com/go-sql-driver/mysql" +) + +// ... db, err := sql.Open("mysql", "user:password@/dbname") +if err != nil { + panic(err) +} +// See "Important settings" section. +db.SetConnMaxLifetime(time.Minute * 3) +db.SetMaxOpenConns(10) +db.SetMaxIdleConns(10) ``` [Examples are available in our Wiki](https://github.com/go-sql-driver/mysql/wiki/Examples "Go-MySQL-Driver Examples"). +### Important settings + +`db.SetConnMaxLifetime()` is required to ensure connections are closed by the driver safely before connection is closed by MySQL server, OS, or other middlewares. Since some middlewares close idle connections by 5 minutes, we recommend timeout shorter than 5 minutes. This setting helps load balancing and changing system variables too. + +`db.SetMaxOpenConns()` is highly recommended to limit the number of connection used by the application. There is no recommended limit number because it depends on application and MySQL server. + +`db.SetMaxIdleConns()` is recommended to be set same to (or greater than) `db.SetMaxOpenConns()`. When it is smaller than `SetMaxOpenConns()`, connections can be opened and closed very frequently than you expect. Idle connections can be closed by the `db.SetConnMaxLifetime()`. If you want to close idle connections more rapidly, you can use `db.SetConnMaxIdleTime()` since Go 1.15. + ### DSN (Data Source Name) @@ -122,7 +144,7 @@ Valid Values: true, false Default: false ``` -`allowAllFiles=true` disables the file Whitelist for `LOAD DATA LOCAL INFILE` and allows *all* files. +`allowAllFiles=true` disables the file allowlist for `LOAD DATA LOCAL INFILE` and allows *all* files. [*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html) ##### `allowCleartextPasswords` @@ -133,7 +155,7 @@ Valid Values: true, false Default: false ``` -`allowCleartextPasswords=true` allows using the [cleartext client side plugin](http://dev.mysql.com/doc/en/cleartext-authentication-plugin.html) if required by an account, such as one defined with the [PAM authentication plugin](http://dev.mysql.com/doc/en/pam-authentication-plugin.html). Sending passwords in clear text may be a security problem in some configurations. To avoid problems if there is any possibility that the password would be intercepted, clients should connect to MySQL Server using a method that protects the password. Possibilities include [TLS / SSL](#tls), IPsec, or a private network. +`allowCleartextPasswords=true` allows using the [cleartext client side plugin](https://dev.mysql.com/doc/en/cleartext-pluggable-authentication.html) if required by an account, such as one defined with the [PAM authentication plugin](http://dev.mysql.com/doc/en/pam-authentication-plugin.html). Sending passwords in clear text may be a security problem in some configurations. To avoid problems if there is any possibility that the password would be intercepted, clients should connect to MySQL Server using a method that protects the password. Possibilities include [TLS / SSL](#tls), IPsec, or a private network. ##### `allowNativePasswords` @@ -230,7 +252,7 @@ Default: false If `interpolateParams` is true, placeholders (`?`) in calls to `db.Query()` and `db.Exec()` are interpolated into a single query string with given parameters. This reduces the number of roundtrips, since the driver has to prepare a statement, execute it with given parameters and close the statement again with `interpolateParams=false`. -*This can not be used together with the multibyte encodings BIG5, CP932, GB2312, GBK or SJIS. These are blacklisted as they may [introduce a SQL injection vulnerability](http://stackoverflow.com/a/12118602/3430118)!* +*This can not be used together with the multibyte encodings BIG5, CP932, GB2312, GBK or SJIS. These are rejected as they may [introduce a SQL injection vulnerability](http://stackoverflow.com/a/12118602/3430118)!* ##### `loc` @@ -376,7 +398,7 @@ Rules: Examples: * `autocommit=1`: `SET autocommit=1` * [`time_zone=%27Europe%2FParis%27`](https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html): `SET time_zone='Europe/Paris'` - * [`tx_isolation=%27REPEATABLE-READ%27`](https://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_tx_isolation): `SET tx_isolation='REPEATABLE-READ'` + * [`transaction_isolation=%27REPEATABLE-READ%27`](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_transaction_isolation): `SET transaction_isolation='REPEATABLE-READ'` #### Examples @@ -445,7 +467,7 @@ For this feature you need direct access to the package. Therefore you must chang import "github.com/go-sql-driver/mysql" ``` -Files must be whitelisted by registering them with `mysql.RegisterLocalFile(filepath)` (recommended) or the Whitelist check must be deactivated by using the DSN parameter `allowAllFiles=true` ([*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)). +Files must be explicitly allowed by registering them with `mysql.RegisterLocalFile(filepath)` (recommended) or the allowlist check must be deactivated by using the DSN parameter `allowAllFiles=true` ([*Might be insecure!*](http://dev.mysql.com/doc/refman/5.7/en/load-data-local.html)). To use a `io.Reader` a handler function must be registered with `mysql.RegisterReaderHandler(name, handler)` which returns a `io.Reader` or `io.ReadCloser`. The Reader is available with the filepath `Reader::` then. Choose different names for different handlers and `DeregisterReaderHandler` when you don't need it anymore. @@ -459,8 +481,6 @@ However, many want to scan MySQL `DATE` and `DATETIME` values into `time.Time` v **Caution:** As of Go 1.1, this makes `time.Time` the only variable type you can scan `DATE` and `DATETIME` values into. This breaks for example [`sql.RawBytes` support](https://github.com/go-sql-driver/mysql/wiki/Examples#rawbytes). -Alternatively you can use the [`NullTime`](https://godoc.org/github.com/go-sql-driver/mysql#NullTime) type as the scan destination, which works with both `time.Time` and `string` / `[]byte`. - ### Unicode support Since version 1.5 Go-MySQL-Driver automatically uses the collation ` utf8mb4_general_ci` by default. @@ -477,7 +497,7 @@ To run the driver tests you may need to adjust the configuration. See the [Testi Go-MySQL-Driver is not feature-complete yet. Your help is very appreciated. If you want to contribute, you can work on an [open issue](https://github.com/go-sql-driver/mysql/issues?state=open) or review a [pull request](https://github.com/go-sql-driver/mysql/pulls). -See the [Contribution Guidelines](https://github.com/go-sql-driver/mysql/blob/master/CONTRIBUTING.md) for details. +See the [Contribution Guidelines](https://github.com/go-sql-driver/mysql/blob/master/.github/CONTRIBUTING.md) for details. --------------------------------------- @@ -498,4 +518,3 @@ Please read the [MPL 2.0 FAQ](https://www.mozilla.org/en-US/MPL/2.0/FAQ/) if you You can read the full terms here: [LICENSE](https://raw.github.com/go-sql-driver/mysql/master/LICENSE). ![Go Gopher and MySQL Dolphin](https://raw.github.com/wiki/go-sql-driver/mysql/go-mysql-driver_m.jpg "Golang Gopher transporting the MySQL Dolphin in a wheelbarrow") - diff --git a/vendor/github.com/go-sql-driver/mysql/auth.go b/vendor/github.com/go-sql-driver/mysql/auth.go index fec7040..b2f19e8 100644 --- a/vendor/github.com/go-sql-driver/mysql/auth.go +++ b/vendor/github.com/go-sql-driver/mysql/auth.go @@ -15,6 +15,7 @@ import ( "crypto/sha256" "crypto/x509" "encoding/pem" + "fmt" "sync" ) @@ -136,10 +137,6 @@ func pwHash(password []byte) (result [2]uint32) { // Hash password using insecure pre 4.1 method func scrambleOldPassword(scramble []byte, password string) []byte { - if len(password) == 0 { - return nil - } - scramble = scramble[:8] hashPw := pwHash([]byte(password)) @@ -247,6 +244,9 @@ func (mc *mysqlConn) auth(authData []byte, plugin string) ([]byte, error) { if !mc.cfg.AllowOldPasswords { return nil, ErrOldPassword } + if len(mc.cfg.Passwd) == 0 { + return nil, nil + } // Note: there are edge cases where this should work but doesn't; // this is currently "wontfix": // https://github.com/go-sql-driver/mysql/issues/184 @@ -372,7 +372,10 @@ func (mc *mysqlConn) handleAuthResult(oldAuthData []byte, plugin string) error { return err } - block, _ := pem.Decode(data[1:]) + block, rest := pem.Decode(data[1:]) + if block == nil { + return fmt.Errorf("No Pem data found, data: %s", rest) + } pkix, err := x509.ParsePKIXPublicKey(block.Bytes) if err != nil { return err diff --git a/vendor/github.com/go-sql-driver/mysql/collations.go b/vendor/github.com/go-sql-driver/mysql/collations.go index 8d2b556..326a9f7 100644 --- a/vendor/github.com/go-sql-driver/mysql/collations.go +++ b/vendor/github.com/go-sql-driver/mysql/collations.go @@ -247,7 +247,7 @@ var collations = map[string]byte{ "utf8mb4_0900_ai_ci": 255, } -// A blacklist of collations which is unsafe to interpolate parameters. +// A denylist of collations which is unsafe to interpolate parameters. // These multibyte encodings may contains 0x5c (`\`) in their trailing bytes. var unsafeCollations = map[string]bool{ "big5_chinese_ci": true, diff --git a/vendor/github.com/go-sql-driver/mysql/connection.go b/vendor/github.com/go-sql-driver/mysql/connection.go index e4bb59e..835f897 100644 --- a/vendor/github.com/go-sql-driver/mysql/connection.go +++ b/vendor/github.com/go-sql-driver/mysql/connection.go @@ -12,6 +12,7 @@ import ( "context" "database/sql" "database/sql/driver" + "encoding/json" "io" "net" "strconv" @@ -46,9 +47,10 @@ type mysqlConn struct { // Handles parameters set in DSN after the connection is established func (mc *mysqlConn) handleParams() (err error) { + var cmdSet strings.Builder for param, val := range mc.cfg.Params { switch param { - // Charset + // Charset: character_set_connection, character_set_client, character_set_results case "charset": charsets := strings.Split(val, ",") for i := range charsets { @@ -62,12 +64,25 @@ func (mc *mysqlConn) handleParams() (err error) { return } - // System Vars + // Other system vars accumulated in a single SET command default: - err = mc.exec("SET " + param + "=" + val + "") - if err != nil { - return + if cmdSet.Len() == 0 { + // Heuristic: 29 chars for each other key=value to reduce reallocations + cmdSet.Grow(4 + len(param) + 1 + len(val) + 30*(len(mc.cfg.Params)-1)) + cmdSet.WriteString("SET ") + } else { + cmdSet.WriteByte(',') } + cmdSet.WriteString(param) + cmdSet.WriteByte('=') + cmdSet.WriteString(val) + } + } + + if cmdSet.Len() > 0 { + err = mc.exec(cmdSet.String()) + if err != nil { + return } } @@ -230,47 +245,21 @@ func (mc *mysqlConn) interpolateParams(query string, args []driver.Value) (strin if v.IsZero() { buf = append(buf, "'0000-00-00'"...) } else { - v := v.In(mc.cfg.Loc) - v = v.Add(time.Nanosecond * 500) // To round under microsecond - year := v.Year() - year100 := year / 100 - year1 := year % 100 - month := v.Month() - day := v.Day() - hour := v.Hour() - minute := v.Minute() - second := v.Second() - micro := v.Nanosecond() / 1000 - - buf = append(buf, []byte{ - '\'', - digits10[year100], digits01[year100], - digits10[year1], digits01[year1], - '-', - digits10[month], digits01[month], - '-', - digits10[day], digits01[day], - ' ', - digits10[hour], digits01[hour], - ':', - digits10[minute], digits01[minute], - ':', - digits10[second], digits01[second], - }...) - - if micro != 0 { - micro10000 := micro / 10000 - micro100 := micro / 100 % 100 - micro1 := micro % 100 - buf = append(buf, []byte{ - '.', - digits10[micro10000], digits01[micro10000], - digits10[micro100], digits01[micro100], - digits10[micro1], digits01[micro1], - }...) + buf = append(buf, '\'') + buf, err = appendDateTime(buf, v.In(mc.cfg.Loc)) + if err != nil { + return "", err } buf = append(buf, '\'') } + case json.RawMessage: + buf = append(buf, '\'') + if mc.status&statusNoBackslashEscapes == 0 { + buf = escapeBytesBackslash(buf, v) + } else { + buf = escapeBytesQuotes(buf, v) + } + buf = append(buf, '\'') case []byte: if v == nil { buf = append(buf, "NULL"...) @@ -480,6 +469,10 @@ func (mc *mysqlConn) Ping(ctx context.Context) (err error) { // BeginTx implements driver.ConnBeginTx interface func (mc *mysqlConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error) { + if mc.closed.IsSet() { + return nil, driver.ErrBadConn + } + if err := mc.watchCancel(ctx); err != nil { return nil, err } @@ -649,3 +642,9 @@ func (mc *mysqlConn) ResetSession(ctx context.Context) error { mc.reset = true return nil } + +// IsValid implements driver.Validator interface +// (From Go 1.15) +func (mc *mysqlConn) IsValid() bool { + return !mc.closed.IsSet() +} diff --git a/vendor/github.com/go-sql-driver/mysql/dsn.go b/vendor/github.com/go-sql-driver/mysql/dsn.go index 75c8c24..93f3548 100644 --- a/vendor/github.com/go-sql-driver/mysql/dsn.go +++ b/vendor/github.com/go-sql-driver/mysql/dsn.go @@ -375,7 +375,7 @@ func parseDSNParams(cfg *Config, params string) (err error) { // cfg params switch value := param[1]; param[0] { - // Disable INFILE whitelist / enable all files + // Disable INFILE allowlist / enable all files case "allowAllFiles": var isBool bool cfg.AllowAllFiles, isBool = readBool(value) diff --git a/vendor/github.com/go-sql-driver/mysql/fields.go b/vendor/github.com/go-sql-driver/mysql/fields.go index e1e2ece..ed6c7a3 100644 --- a/vendor/github.com/go-sql-driver/mysql/fields.go +++ b/vendor/github.com/go-sql-driver/mysql/fields.go @@ -106,7 +106,7 @@ var ( scanTypeInt64 = reflect.TypeOf(int64(0)) scanTypeNullFloat = reflect.TypeOf(sql.NullFloat64{}) scanTypeNullInt = reflect.TypeOf(sql.NullInt64{}) - scanTypeNullTime = reflect.TypeOf(NullTime{}) + scanTypeNullTime = reflect.TypeOf(nullTime{}) scanTypeUint8 = reflect.TypeOf(uint8(0)) scanTypeUint16 = reflect.TypeOf(uint16(0)) scanTypeUint32 = reflect.TypeOf(uint32(0)) diff --git a/vendor/github.com/go-sql-driver/mysql/fuzz.go b/vendor/github.com/go-sql-driver/mysql/fuzz.go new file mode 100644 index 0000000..fa75adf --- /dev/null +++ b/vendor/github.com/go-sql-driver/mysql/fuzz.go @@ -0,0 +1,24 @@ +// Go MySQL Driver - A MySQL-Driver for Go's database/sql package. +// +// Copyright 2020 The Go-MySQL-Driver Authors. All rights reserved. +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at http://mozilla.org/MPL/2.0/. + +// +build gofuzz + +package mysql + +import ( + "database/sql" +) + +func Fuzz(data []byte) int { + db, err := sql.Open("mysql", string(data)) + if err != nil { + return 0 + } + db.Close() + return 1 +} diff --git a/vendor/github.com/go-sql-driver/mysql/infile.go b/vendor/github.com/go-sql-driver/mysql/infile.go index 273cb0b..60effdf 100644 --- a/vendor/github.com/go-sql-driver/mysql/infile.go +++ b/vendor/github.com/go-sql-driver/mysql/infile.go @@ -23,7 +23,7 @@ var ( readerRegisterLock sync.RWMutex ) -// RegisterLocalFile adds the given file to the file whitelist, +// RegisterLocalFile adds the given file to the file allowlist, // so that it can be used by "LOAD DATA LOCAL INFILE ". // Alternatively you can allow the use of all local files with // the DSN parameter 'allowAllFiles=true' @@ -45,7 +45,7 @@ func RegisterLocalFile(filePath string) { fileRegisterLock.Unlock() } -// DeregisterLocalFile removes the given filepath from the whitelist. +// DeregisterLocalFile removes the given filepath from the allowlist. func DeregisterLocalFile(filePath string) { fileRegisterLock.Lock() delete(fileRegister, strings.Trim(filePath, `"`)) diff --git a/vendor/github.com/go-sql-driver/mysql/nulltime.go b/vendor/github.com/go-sql-driver/mysql/nulltime.go index afa8a89..651723a 100644 --- a/vendor/github.com/go-sql-driver/mysql/nulltime.go +++ b/vendor/github.com/go-sql-driver/mysql/nulltime.go @@ -28,11 +28,11 @@ func (nt *NullTime) Scan(value interface{}) (err error) { nt.Time, nt.Valid = v, true return case []byte: - nt.Time, err = parseDateTime(string(v), time.UTC) + nt.Time, err = parseDateTime(v, time.UTC) nt.Valid = (err == nil) return case string: - nt.Time, err = parseDateTime(v, time.UTC) + nt.Time, err = parseDateTime([]byte(v), time.UTC) nt.Valid = (err == nil) return } diff --git a/vendor/github.com/go-sql-driver/mysql/nulltime_go113.go b/vendor/github.com/go-sql-driver/mysql/nulltime_go113.go index c392594..453b4b3 100644 --- a/vendor/github.com/go-sql-driver/mysql/nulltime_go113.go +++ b/vendor/github.com/go-sql-driver/mysql/nulltime_go113.go @@ -28,4 +28,13 @@ import ( // } // // This NullTime implementation is not driver-specific +// +// Deprecated: NullTime doesn't honor the loc DSN parameter. +// NullTime.Scan interprets a time as UTC, not the loc DSN parameter. +// Use sql.NullTime instead. type NullTime sql.NullTime + +// for internal use. +// the mysql package uses sql.NullTime if it is available. +// if not, the package uses mysql.NullTime. +type nullTime = sql.NullTime // sql.NullTime is available diff --git a/vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go b/vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go index 86d159d..9f7ae27 100644 --- a/vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go +++ b/vendor/github.com/go-sql-driver/mysql/nulltime_legacy.go @@ -32,3 +32,8 @@ type NullTime struct { Time time.Time Valid bool // Valid is true if Time is not NULL } + +// for internal use. +// the mysql package uses sql.NullTime if it is available. +// if not, the package uses mysql.NullTime. +type nullTime = NullTime // sql.NullTime is not available diff --git a/vendor/github.com/go-sql-driver/mysql/packets.go b/vendor/github.com/go-sql-driver/mysql/packets.go index 82ad7a2..6664e5a 100644 --- a/vendor/github.com/go-sql-driver/mysql/packets.go +++ b/vendor/github.com/go-sql-driver/mysql/packets.go @@ -13,6 +13,7 @@ import ( "crypto/tls" "database/sql/driver" "encoding/binary" + "encoding/json" "errors" "fmt" "io" @@ -348,6 +349,12 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string return errors.New("unknown collation") } + // Filler [23 bytes] (all 0x00) + pos := 13 + for ; pos < 13+23; pos++ { + data[pos] = 0 + } + // SSL Connection Request Packet // http://dev.mysql.com/doc/internals/en/connection-phase-packets.html#packet-Protocol::SSLRequest if mc.cfg.tls != nil { @@ -366,12 +373,6 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string mc.buf.nc = tlsConn } - // Filler [23 bytes] (all 0x00) - pos := 13 - for ; pos < 13+23; pos++ { - data[pos] = 0 - } - // User [null terminated string] if len(mc.cfg.User) > 0 { pos += copy(data[pos:], mc.cfg.User) @@ -777,7 +778,7 @@ func (rows *textRows) readRow(dest []driver.Value) error { case fieldTypeTimestamp, fieldTypeDateTime, fieldTypeDate, fieldTypeNewDate: dest[i], err = parseDateTime( - string(dest[i].([]byte)), + dest[i].([]byte), mc.cfg.Loc, ) if err == nil { @@ -1003,6 +1004,9 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error { continue } + if v, ok := arg.(json.RawMessage); ok { + arg = []byte(v) + } // cache types and values switch v := arg.(type) { case int64: @@ -1112,7 +1116,10 @@ func (stmt *mysqlStmt) writeExecutePacket(args []driver.Value) error { if v.IsZero() { b = append(b, "0000-00-00"...) } else { - b = v.In(mc.cfg.Loc).AppendFormat(b, timeFormat) + b, err = appendDateTime(b, v.In(mc.cfg.Loc)) + if err != nil { + return err + } } paramValues = appendLengthEncodedInteger(paramValues, diff --git a/vendor/github.com/go-sql-driver/mysql/statement.go b/vendor/github.com/go-sql-driver/mysql/statement.go index f7e3709..18a3ae4 100644 --- a/vendor/github.com/go-sql-driver/mysql/statement.go +++ b/vendor/github.com/go-sql-driver/mysql/statement.go @@ -10,6 +10,7 @@ package mysql import ( "database/sql/driver" + "encoding/json" "fmt" "io" "reflect" @@ -43,6 +44,11 @@ func (stmt *mysqlStmt) ColumnConverter(idx int) driver.ValueConverter { return converter{} } +func (stmt *mysqlStmt) CheckNamedValue(nv *driver.NamedValue) (err error) { + nv.Value, err = converter{}.ConvertValue(nv.Value) + return +} + func (stmt *mysqlStmt) Exec(args []driver.Value) (driver.Result, error) { if stmt.mc.closed.IsSet() { errLog.Print(ErrInvalidConn) @@ -129,6 +135,8 @@ func (stmt *mysqlStmt) query(args []driver.Value) (*binaryRows, error) { return rows, err } +var jsonType = reflect.TypeOf(json.RawMessage{}) + type converter struct{} // ConvertValue mirrors the reference/default converter in database/sql/driver @@ -146,12 +154,17 @@ func (c converter) ConvertValue(v interface{}) (driver.Value, error) { if err != nil { return nil, err } - if !driver.IsValue(sv) { - return nil, fmt.Errorf("non-Value type %T returned from Value", sv) + if driver.IsValue(sv) { + return sv, nil } - return sv, nil + // A value returend from the Valuer interface can be "a type handled by + // a database driver's NamedValueChecker interface" so we should accept + // uint64 here as well. + if u, ok := sv.(uint64); ok { + return u, nil + } + return nil, fmt.Errorf("non-Value type %T returned from Value", sv) } - rv := reflect.ValueOf(v) switch rv.Kind() { case reflect.Ptr: @@ -170,11 +183,14 @@ func (c converter) ConvertValue(v interface{}) (driver.Value, error) { case reflect.Bool: return rv.Bool(), nil case reflect.Slice: - ek := rv.Type().Elem().Kind() - if ek == reflect.Uint8 { + switch t := rv.Type(); { + case t == jsonType: + return v, nil + case t.Elem().Kind() == reflect.Uint8: return rv.Bytes(), nil + default: + return nil, fmt.Errorf("unsupported type %T, a slice of %s", v, t.Elem().Kind()) } - return nil, fmt.Errorf("unsupported type %T, a slice of %s", v, ek) case reflect.String: return rv.String(), nil } diff --git a/vendor/github.com/go-sql-driver/mysql/utils.go b/vendor/github.com/go-sql-driver/mysql/utils.go index 9552e80..d6545f5 100644 --- a/vendor/github.com/go-sql-driver/mysql/utils.go +++ b/vendor/github.com/go-sql-driver/mysql/utils.go @@ -106,27 +106,136 @@ func readBool(input string) (value bool, valid bool) { * Time related utils * ******************************************************************************/ -func parseDateTime(str string, loc *time.Location) (t time.Time, err error) { - base := "0000-00-00 00:00:00.0000000" - switch len(str) { +func parseDateTime(b []byte, loc *time.Location) (time.Time, error) { + const base = "0000-00-00 00:00:00.000000" + switch len(b) { case 10, 19, 21, 22, 23, 24, 25, 26: // up to "YYYY-MM-DD HH:MM:SS.MMMMMM" - if str == base[:len(str)] { - return + if string(b) == base[:len(b)] { + return time.Time{}, nil } - t, err = time.Parse(timeFormat[:len(str)], str) + + year, err := parseByteYear(b) + if err != nil { + return time.Time{}, err + } + if year <= 0 { + year = 1 + } + + if b[4] != '-' { + return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[4]) + } + + m, err := parseByte2Digits(b[5], b[6]) + if err != nil { + return time.Time{}, err + } + if m <= 0 { + m = 1 + } + month := time.Month(m) + + if b[7] != '-' { + return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[7]) + } + + day, err := parseByte2Digits(b[8], b[9]) + if err != nil { + return time.Time{}, err + } + if day <= 0 { + day = 1 + } + if len(b) == 10 { + return time.Date(year, month, day, 0, 0, 0, 0, loc), nil + } + + if b[10] != ' ' { + return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[10]) + } + + hour, err := parseByte2Digits(b[11], b[12]) + if err != nil { + return time.Time{}, err + } + if b[13] != ':' { + return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[13]) + } + + min, err := parseByte2Digits(b[14], b[15]) + if err != nil { + return time.Time{}, err + } + if b[16] != ':' { + return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[16]) + } + + sec, err := parseByte2Digits(b[17], b[18]) + if err != nil { + return time.Time{}, err + } + if len(b) == 19 { + return time.Date(year, month, day, hour, min, sec, 0, loc), nil + } + + if b[19] != '.' { + return time.Time{}, fmt.Errorf("bad value for field: `%c`", b[19]) + } + nsec, err := parseByteNanoSec(b[20:]) + if err != nil { + return time.Time{}, err + } + return time.Date(year, month, day, hour, min, sec, nsec, loc), nil default: - err = fmt.Errorf("invalid time string: %s", str) - return + return time.Time{}, fmt.Errorf("invalid time bytes: %s", b) } +} - // Adjust location - if err == nil && loc != time.UTC { - y, mo, d := t.Date() - h, mi, s := t.Clock() - t, err = time.Date(y, mo, d, h, mi, s, t.Nanosecond(), loc), nil +func parseByteYear(b []byte) (int, error) { + year, n := 0, 1000 + for i := 0; i < 4; i++ { + v, err := bToi(b[i]) + if err != nil { + return 0, err + } + year += v * n + n = n / 10 } + return year, nil +} - return +func parseByte2Digits(b1, b2 byte) (int, error) { + d1, err := bToi(b1) + if err != nil { + return 0, err + } + d2, err := bToi(b2) + if err != nil { + return 0, err + } + return d1*10 + d2, nil +} + +func parseByteNanoSec(b []byte) (int, error) { + ns, digit := 0, 100000 // max is 6-digits + for i := 0; i < len(b); i++ { + v, err := bToi(b[i]) + if err != nil { + return 0, err + } + ns += v * digit + digit /= 10 + } + // nanoseconds has 10-digits. (needs to scale digits) + // 10 - 6 = 4, so we have to multiple 1000. + return ns * 1000, nil +} + +func bToi(b byte) (int, error) { + if b < '0' || b > '9' { + return 0, errors.New("not [0-9]") + } + return int(b - '0'), nil } func parseBinaryDateTime(num uint64, data []byte, loc *time.Location) (driver.Value, error) { @@ -167,6 +276,64 @@ func parseBinaryDateTime(num uint64, data []byte, loc *time.Location) (driver.Va return nil, fmt.Errorf("invalid DATETIME packet length %d", num) } +func appendDateTime(buf []byte, t time.Time) ([]byte, error) { + year, month, day := t.Date() + hour, min, sec := t.Clock() + nsec := t.Nanosecond() + + if year < 1 || year > 9999 { + return buf, errors.New("year is not in the range [1, 9999]: " + strconv.Itoa(year)) // use errors.New instead of fmt.Errorf to avoid year escape to heap + } + year100 := year / 100 + year1 := year % 100 + + var localBuf [len("2006-01-02T15:04:05.999999999")]byte // does not escape + localBuf[0], localBuf[1], localBuf[2], localBuf[3] = digits10[year100], digits01[year100], digits10[year1], digits01[year1] + localBuf[4] = '-' + localBuf[5], localBuf[6] = digits10[month], digits01[month] + localBuf[7] = '-' + localBuf[8], localBuf[9] = digits10[day], digits01[day] + + if hour == 0 && min == 0 && sec == 0 && nsec == 0 { + return append(buf, localBuf[:10]...), nil + } + + localBuf[10] = ' ' + localBuf[11], localBuf[12] = digits10[hour], digits01[hour] + localBuf[13] = ':' + localBuf[14], localBuf[15] = digits10[min], digits01[min] + localBuf[16] = ':' + localBuf[17], localBuf[18] = digits10[sec], digits01[sec] + + if nsec == 0 { + return append(buf, localBuf[:19]...), nil + } + nsec100000000 := nsec / 100000000 + nsec1000000 := (nsec / 1000000) % 100 + nsec10000 := (nsec / 10000) % 100 + nsec100 := (nsec / 100) % 100 + nsec1 := nsec % 100 + localBuf[19] = '.' + + // milli second + localBuf[20], localBuf[21], localBuf[22] = + digits01[nsec100000000], digits10[nsec1000000], digits01[nsec1000000] + // micro second + localBuf[23], localBuf[24], localBuf[25] = + digits10[nsec10000], digits01[nsec10000], digits10[nsec100] + // nano second + localBuf[26], localBuf[27], localBuf[28] = + digits01[nsec100], digits10[nsec1], digits01[nsec1] + + // trim trailing zeros + n := len(localBuf) + for n > 0 && localBuf[n-1] == '0' { + n-- + } + + return append(buf, localBuf[:n]...), nil +} + // zeroDateTime is used in formatBinaryDateTime to avoid an allocation // if the DATE or DATETIME has the zero value. // It must never be changed. diff --git a/vendor/github.com/pingcap/errors/.gitignore b/vendor/github.com/pingcap/errors/.gitignore index daf913b..0c9e329 100644 --- a/vendor/github.com/pingcap/errors/.gitignore +++ b/vendor/github.com/pingcap/errors/.gitignore @@ -6,6 +6,7 @@ # Folders _obj _test +.idea # Architecture specific extensions/prefixes *.[568vq] diff --git a/vendor/github.com/pingcap/errors/compatible_shim.go b/vendor/github.com/pingcap/errors/compatible_shim.go new file mode 100644 index 0000000..ba446e0 --- /dev/null +++ b/vendor/github.com/pingcap/errors/compatible_shim.go @@ -0,0 +1,99 @@ +// Copyright 2020 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package errors + +import ( + "encoding/json" + "strconv" + "strings" +) + +// class2RFCCode is used for compatible with old version of TiDB. When +// marshal Error to json, old version of TiDB contain a 'class' field +// which is represented for error class. In order to parse and convert +// json to errors.Error, using this map to convert error class to RFC +// error code text. here is reference: +// https://github.com/pingcap/parser/blob/release-3.0/terror/terror.go#L58 +var class2RFCCode = map[int]string{ + 1: "autoid", + 2: "ddl", + 3: "domain", + 4: "evaluator", + 5: "executor", + 6: "expression", + 7: "admin", + 8: "kv", + 9: "meta", + 10: "planner", + 11: "parser", + 12: "perfschema", + 13: "privilege", + 14: "schema", + 15: "server", + 16: "struct", + 17: "variable", + 18: "xeval", + 19: "table", + 20: "types", + 21: "global", + 22: "mocktikv", + 23: "json", + 24: "tikv", + 25: "session", + 26: "plugin", + 27: "util", +} +var rfcCode2class map[string]int + +func init() { + rfcCode2class = make(map[string]int) + for k, v := range class2RFCCode { + rfcCode2class[v] = k + } +} + + +// MarshalJSON implements json.Marshaler interface. +// aware that this function cannot save a 'registered' status, +// since we cannot access the registry when unmarshaling, +// and the original global registry would be removed here. +// This function is reserved for compatibility. +func (e *Error) MarshalJSON() ([]byte, error) { + ec := strings.Split(string(e.codeText), ":")[0] + return json.Marshal(&jsonError{ + Class: rfcCode2class[ec], + Code: int(e.code), + Msg: e.GetMsg(), + RFCCode: string(e.codeText), + }) +} + +// UnmarshalJSON implements json.Unmarshaler interface. +// aware that this function cannot create a 'registered' error, +// since we cannot access the registry in this context, +// and the original global registry is removed. +// This function is reserved for compatibility. +func (e *Error) UnmarshalJSON(data []byte) error { + tErr := &jsonError{} + if err := json.Unmarshal(data, &tErr); err != nil { + return Trace(err) + } + e.codeText = ErrCodeText(tErr.RFCCode) + if tErr.RFCCode == "" && tErr.Class > 0 { + e.codeText = ErrCodeText(class2RFCCode[tErr.Class] + ":" + strconv.Itoa(tErr.Code)) + } + e.code = ErrCode(tErr.Code) + e.message = tErr.Msg + return nil +} diff --git a/vendor/github.com/pingcap/errors/go.mod b/vendor/github.com/pingcap/errors/go.mod new file mode 100644 index 0000000..f5a4166 --- /dev/null +++ b/vendor/github.com/pingcap/errors/go.mod @@ -0,0 +1,11 @@ +module github.com/pingcap/errors + +go 1.14 + +require ( + github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8 + github.com/pingcap/log v0.0.0-20200511115504-543df19646ad + github.com/pkg/errors v0.9.1 + go.uber.org/atomic v1.6.0 + go.uber.org/zap v1.15.0 +) diff --git a/vendor/github.com/pingcap/errors/go.sum b/vendor/github.com/pingcap/errors/go.sum new file mode 100644 index 0000000..f2f8f42 --- /dev/null +++ b/vendor/github.com/pingcap/errors/go.sum @@ -0,0 +1,66 @@ +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +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/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8 h1:USx2/E1bX46VG32FIw034Au6seQ2fY9NEILmNh/UlQg= +github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8/go.mod h1:B1+S9LNcuMyLH/4HMTViQOJevkGiik3wW2AN9zb2fNQ= +github.com/pingcap/errors v0.11.0/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pingcap/log v0.0.0-20200511115504-543df19646ad h1:SveG82rmu/GFxYanffxsSF503SiQV+2JLnWEiGiF+Tc= +github.com/pingcap/log v0.0.0-20200511115504-543df19646ad/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.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/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= +go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A= +go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= +go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.15.0 h1:ZZCA22JRF2gQE5FoNmhmrf7jeJJ2uhqDUNRYKm8dvmM= +go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +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= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5 h1:hKsoRgsbwY1NafxrwTs+k64bikrLBkAgPir1TNCj3Zs= +golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +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/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.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/vendor/github.com/pingcap/errors/juju_adaptor.go b/vendor/github.com/pingcap/errors/juju_adaptor.go index 8bcfe2f..ece86cd 100644 --- a/vendor/github.com/pingcap/errors/juju_adaptor.go +++ b/vendor/github.com/pingcap/errors/juju_adaptor.go @@ -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) diff --git a/vendor/github.com/pingcap/errors/normalize.go b/vendor/github.com/pingcap/errors/normalize.go new file mode 100644 index 0000000..5712fe7 --- /dev/null +++ b/vendor/github.com/pingcap/errors/normalize.go @@ -0,0 +1,313 @@ +// Copyright 2020 PingCAP, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// See the License for the specific language governing permissions and +// limitations under the License. + +package errors + +import ( + "fmt" + "runtime" + "strconv" + + "go.uber.org/atomic" +) + +// RedactLogEnabled defines whether the arguments of Error need to be redacted. +var RedactLogEnabled atomic.Bool + +// ErrCode represents a specific error type in a error class. +// Same error code can be used in different error classes. +type ErrCode int + +// ErrCodeText is a textual error code that represents a specific error type in a error class. +type ErrCodeText string + +type ErrorID string +type RFCErrorCode string + +// Error is the 'prototype' of a type of errors. +// Use DefineError to make a *Error: +// var ErrUnavailable = errors.Normalize("Region %d is unavailable", errors.RFCCodeText("Unavailable")) +// +// "throw" it at runtime: +// func Somewhat() error { +// ... +// if err != nil { +// // generate a stackful error use the message template at defining, +// // also see FastGen(it's stackless), GenWithStack(it uses custom message template). +// return ErrUnavailable.GenWithStackByArgs(region.ID) +// } +// } +// +// testing whether an error belongs to a prototype: +// if ErrUnavailable.Equal(err) { +// // handle this error. +// } +type Error struct { + code ErrCode + // codeText is the textual describe of the error code + codeText ErrCodeText + // message is a template of the description of this error. + // printf-style formatting is enabled. + message string + // redactArgsPos defines the positions of arguments in message that need to be redacted. + // And it is controlled by the global var RedactLogEnabled. + // For example, an original error is `Duplicate entry 'PRIMARY' for key 'key'`, + // when RedactLogEnabled is ON and redactArgsPos is [0, 1], the error is `Duplicate entry '?' for key '?'`. + redactArgsPos []int + // Cause is used to warp some third party error. + cause error + args []interface{} + file string + line int +} + +// Code returns the numeric code of this error. +// ID() will return textual error if there it is, +// when you just want to get the purely numeric error +// (e.g., for mysql protocol transmission.), this would be useful. +func (e *Error) Code() ErrCode { + return e.code +} + +// Code returns ErrorCode, by the RFC: +// +// The error code is a 3-tuple of abbreviated component name, error class and error code, +// joined by a colon like {Component}:{ErrorClass}:{InnerErrorCode}. +func (e *Error) RFCCode() RFCErrorCode { + return RFCErrorCode(e.ID()) +} + +// ID returns the ID of this error. +func (e *Error) ID() ErrorID { + if e.codeText != "" { + return ErrorID(e.codeText) + } + return ErrorID(strconv.Itoa(int(e.code))) +} + +// Location returns the location where the error is created, +// implements juju/errors locationer interface. +func (e *Error) Location() (file string, line int) { + return e.file, e.line +} + +// MessageTemplate returns the error message template of this error. +func (e *Error) MessageTemplate() string { + return e.message +} + +// Error implements error interface. +func (e *Error) Error() string { + if e == nil { + return "" + } + describe := e.codeText + if len(describe) == 0 { + describe = ErrCodeText(strconv.Itoa(int(e.code))) + } + return fmt.Sprintf("[%s]%s", e.RFCCode(), e.GetMsg()) +} + +func (e *Error) GetMsg() string { + if len(e.args) > 0 { + return fmt.Sprintf(e.message, e.args...) + } + return e.message +} + +func (e *Error) fillLineAndFile(skip int) { + // skip this + _, file, line, ok := runtime.Caller(skip + 1) + if !ok { + e.file = "" + e.line = -1 + return + } + e.file = file + e.line = line +} + +// GenWithStack generates a new *Error with the same class and code, and a new formatted message. +func (e *Error) GenWithStack(format string, args ...interface{}) error { + // TODO: RedactErrorArg + err := *e + err.message = format + err.args = args + err.fillLineAndFile(1) + return AddStack(&err) +} + +// GenWithStackByArgs generates a new *Error with the same class and code, and new arguments. +func (e *Error) GenWithStackByArgs(args ...interface{}) error { + RedactErrorArg(args, e.redactArgsPos) + err := *e + err.args = args + err.fillLineAndFile(1) + return AddStack(&err) +} + +// FastGen generates a new *Error with the same class and code, and a new formatted message. +// This will not call runtime.Caller to get file and line. +func (e *Error) FastGen(format string, args ...interface{}) error { + // TODO: RedactErrorArg + err := *e + err.message = format + err.args = args + return 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 { + RedactErrorArg(args, e.redactArgsPos) + err := *e + err.args = args + return SuspendStack(&err) +} + +// Equal checks if err is equal to e. +func (e *Error) Equal(err error) bool { + originErr := Cause(err) + if originErr == nil { + return false + } + if error(e) == originErr { + return true + } + inErr, ok := originErr.(*Error) + if !ok { + return false + } + idEquals := e.ID() == inErr.ID() + return idEquals +} + +// NotEqual checks if err is not equal to e. +func (e *Error) NotEqual(err error) bool { + return !e.Equal(err) +} + +// RedactErrorArg redacts the args by position if RedactLogEnabled is enabled. +func RedactErrorArg(args []interface{}, position []int) { + if RedactLogEnabled.Load() { + for _, pos := range position { + if len(args) > pos { + args[pos] = "?" + } + } + } +} + +// ErrorEqual returns a boolean indicating whether err1 is equal to err2. +func ErrorEqual(err1, err2 error) bool { + e1 := Cause(err1) + e2 := Cause(err2) + + if e1 == e2 { + return true + } + + if e1 == nil || e2 == nil { + return e1 == e2 + } + + te1, ok1 := e1.(*Error) + te2, ok2 := e2.(*Error) + if ok1 && ok2 { + return te1.Equal(te2) + } + + return e1.Error() == e2.Error() +} + +// ErrorNotEqual returns a boolean indicating whether err1 isn't equal to err2. +func ErrorNotEqual(err1, err2 error) bool { + return !ErrorEqual(err1, err2) +} + +type jsonError struct { + // Deprecated field, please use `RFCCode` instead. + Class int `json:"class"` + Code int `json:"code"` + Msg string `json:"message"` + RFCCode string `json:"rfccode"` +} + +func (e *Error) Wrap(err error) *Error { + if err != nil { + newErr := *e + newErr.cause = err + return &newErr + } + return nil +} + +func (e *Error) Cause() error { + root := Unwrap(e.cause) + if root == nil { + return e.cause + } + return root +} + +func (e *Error) FastGenWithCause(args ...interface{}) error { + err := *e + if e.cause != nil { + err.message = e.cause.Error() + } + err.args = args + return SuspendStack(&err) +} + +func (e *Error) GenWithStackByCause(args ...interface{}) error { + err := *e + if e.cause != nil { + err.message = e.cause.Error() + } + err.args = args + err.fillLineAndFile(1) + return AddStack(&err) +} + +type NormalizeOption func(*Error) + +func RedactArgs(pos []int) NormalizeOption { + return func(e *Error) { + e.redactArgsPos = pos + } +} + +// RFCCodeText returns a NormalizeOption to set RFC error code. +func RFCCodeText(codeText string) NormalizeOption { + return func(e *Error) { + e.codeText = ErrCodeText(codeText) + } +} + +// MySQLErrorCode returns a NormalizeOption to set error code. +func MySQLErrorCode(code int) NormalizeOption { + return func(e *Error) { + e.code = ErrCode(code) + } +} + +// Normalize creates a new Error object. +func Normalize(message string, opts ...NormalizeOption) *Error { + e := &Error{ + message: message, + } + for _, opt := range opts { + opt(e) + } + return e +} diff --git a/vendor/github.com/siddontang/go-mysql/mysql/position.go b/vendor/github.com/siddontang/go-mysql/mysql/position.go deleted file mode 100644 index bee5485..0000000 --- a/vendor/github.com/siddontang/go-mysql/mysql/position.go +++ /dev/null @@ -1,33 +0,0 @@ -package mysql - -import ( - "fmt" -) - -// For binlog filename + position based replication -type Position struct { - Name string - Pos uint32 -} - -func (p Position) Compare(o Position) int { - // First compare binlog name - if p.Name > o.Name { - return 1 - } else if p.Name < o.Name { - return -1 - } else { - // Same binlog file, compare position - if p.Pos > o.Pos { - return 1 - } else if p.Pos < o.Pos { - return -1 - } else { - return 0 - } - } -} - -func (p Position) String() string { - return fmt.Sprintf("(%s, %d)", p.Name, p.Pos) -} diff --git a/vendor/go.uber.org/atomic/.codecov.yml b/vendor/go.uber.org/atomic/.codecov.yml new file mode 100644 index 0000000..571116c --- /dev/null +++ b/vendor/go.uber.org/atomic/.codecov.yml @@ -0,0 +1,19 @@ +coverage: + range: 80..100 + round: down + precision: 2 + + status: + project: # measuring the overall project coverage + default: # context, you can create multiple ones with custom titles + enabled: yes # must be yes|true to enable this status + target: 100 # specify the target coverage for each commit status + # option: "auto" (must increase from parent commit or pull request base) + # option: "X%" a static target percentage to hit + if_not_found: success # if parent is not found report status as success, error, or failure + if_ci_failed: error # if ci fails report status as success, error, or failure + +# Also update COVER_IGNORE_PKGS in the Makefile. +ignore: + - /internal/gen-atomicint/ + - /internal/gen-valuewrapper/ diff --git a/vendor/go.uber.org/atomic/.gitignore b/vendor/go.uber.org/atomic/.gitignore new file mode 100644 index 0000000..c3fa253 --- /dev/null +++ b/vendor/go.uber.org/atomic/.gitignore @@ -0,0 +1,12 @@ +/bin +.DS_Store +/vendor +cover.html +cover.out +lint.log + +# Binaries +*.test + +# Profiling output +*.prof diff --git a/vendor/go.uber.org/atomic/.travis.yml b/vendor/go.uber.org/atomic/.travis.yml new file mode 100644 index 0000000..13d0a4f --- /dev/null +++ b/vendor/go.uber.org/atomic/.travis.yml @@ -0,0 +1,27 @@ +sudo: false +language: go +go_import_path: go.uber.org/atomic + +env: + global: + - GO111MODULE=on + +matrix: + include: + - go: oldstable + - go: stable + env: LINT=1 + +cache: + directories: + - vendor + +before_install: + - go version + +script: + - test -z "$LINT" || make lint + - make cover + +after_success: + - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/go.uber.org/atomic/CHANGELOG.md b/vendor/go.uber.org/atomic/CHANGELOG.md new file mode 100644 index 0000000..24c0274 --- /dev/null +++ b/vendor/go.uber.org/atomic/CHANGELOG.md @@ -0,0 +1,76 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.7.0] - 2020-09-14 +### Added +- Support JSON serialization and deserialization of primitive atomic types. +- Support Text marshalling and unmarshalling for string atomics. + +### Changed +- Disallow incorrect comparison of atomic values in a non-atomic way. + +### Removed +- Remove dependency on `golang.org/x/{lint, tools}`. + +## [1.6.0] - 2020-02-24 +### Changed +- Drop library dependency on `golang.org/x/{lint, tools}`. + +## [1.5.1] - 2019-11-19 +- Fix bug where `Bool.CAS` and `Bool.Toggle` do work correctly together + causing `CAS` to fail even though the old value matches. + +## [1.5.0] - 2019-10-29 +### Changed +- With Go modules, only the `go.uber.org/atomic` import path is supported now. + If you need to use the old import path, please add a `replace` directive to + your `go.mod`. + +## [1.4.0] - 2019-05-01 +### Added + - Add `atomic.Error` type for atomic operations on `error` values. + +## [1.3.2] - 2018-05-02 +### Added +- Add `atomic.Duration` type for atomic operations on `time.Duration` values. + +## [1.3.1] - 2017-11-14 +### Fixed +- Revert optimization for `atomic.String.Store("")` which caused data races. + +## [1.3.0] - 2017-11-13 +### Added +- Add `atomic.Bool.CAS` for compare-and-swap semantics on bools. + +### Changed +- Optimize `atomic.String.Store("")` by avoiding an allocation. + +## [1.2.0] - 2017-04-12 +### Added +- Shadow `atomic.Value` from `sync/atomic`. + +## [1.1.0] - 2017-03-10 +### Added +- Add atomic `Float64` type. + +### Changed +- Support new `go.uber.org/atomic` import path. + +## [1.0.0] - 2016-07-18 + +- Initial release. + +[1.7.0]: https://github.com/uber-go/atomic/compare/v1.6.0...v1.7.0 +[1.6.0]: https://github.com/uber-go/atomic/compare/v1.5.1...v1.6.0 +[1.5.1]: https://github.com/uber-go/atomic/compare/v1.5.0...v1.5.1 +[1.5.0]: https://github.com/uber-go/atomic/compare/v1.4.0...v1.5.0 +[1.4.0]: https://github.com/uber-go/atomic/compare/v1.3.2...v1.4.0 +[1.3.2]: https://github.com/uber-go/atomic/compare/v1.3.1...v1.3.2 +[1.3.1]: https://github.com/uber-go/atomic/compare/v1.3.0...v1.3.1 +[1.3.0]: https://github.com/uber-go/atomic/compare/v1.2.0...v1.3.0 +[1.2.0]: https://github.com/uber-go/atomic/compare/v1.1.0...v1.2.0 +[1.1.0]: https://github.com/uber-go/atomic/compare/v1.0.0...v1.1.0 +[1.0.0]: https://github.com/uber-go/atomic/releases/tag/v1.0.0 diff --git a/vendor/go.uber.org/atomic/LICENSE.txt b/vendor/go.uber.org/atomic/LICENSE.txt new file mode 100644 index 0000000..8765c9f --- /dev/null +++ b/vendor/go.uber.org/atomic/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright (c) 2016 Uber Technologies, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/go.uber.org/atomic/Makefile b/vendor/go.uber.org/atomic/Makefile new file mode 100644 index 0000000..1b1376d --- /dev/null +++ b/vendor/go.uber.org/atomic/Makefile @@ -0,0 +1,78 @@ +# Directory to place `go install`ed binaries into. +export GOBIN ?= $(shell pwd)/bin + +GOLINT = $(GOBIN)/golint +GEN_ATOMICINT = $(GOBIN)/gen-atomicint +GEN_ATOMICWRAPPER = $(GOBIN)/gen-atomicwrapper +STATICCHECK = $(GOBIN)/staticcheck + +GO_FILES ?= $(shell find . '(' -path .git -o -path vendor ')' -prune -o -name '*.go' -print) + +# Also update ignore section in .codecov.yml. +COVER_IGNORE_PKGS = \ + go.uber.org/atomic/internal/gen-atomicint \ + go.uber.org/atomic/internal/gen-atomicwrapper + +.PHONY: build +build: + go build ./... + +.PHONY: test +test: + go test -race ./... + +.PHONY: gofmt +gofmt: + $(eval FMT_LOG := $(shell mktemp -t gofmt.XXXXX)) + gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true + @[ ! -s "$(FMT_LOG)" ] || (echo "gofmt failed:" && cat $(FMT_LOG) && false) + +$(GOLINT): + cd tools && go install golang.org/x/lint/golint + +$(STATICCHECK): + cd tools && go install honnef.co/go/tools/cmd/staticcheck + +$(GEN_ATOMICWRAPPER): $(wildcard ./internal/gen-atomicwrapper/*) + go build -o $@ ./internal/gen-atomicwrapper + +$(GEN_ATOMICINT): $(wildcard ./internal/gen-atomicint/*) + go build -o $@ ./internal/gen-atomicint + +.PHONY: golint +golint: $(GOLINT) + $(GOLINT) ./... + +.PHONY: staticcheck +staticcheck: $(STATICCHECK) + $(STATICCHECK) ./... + +.PHONY: lint +lint: gofmt golint staticcheck generatenodirty + +# comma separated list of packages to consider for code coverage. +COVER_PKG = $(shell \ + go list -find ./... | \ + grep -v $(foreach pkg,$(COVER_IGNORE_PKGS),-e "^$(pkg)$$") | \ + paste -sd, -) + +.PHONY: cover +cover: + go test -coverprofile=cover.out -coverpkg $(COVER_PKG) -v ./... + go tool cover -html=cover.out -o cover.html + +.PHONY: generate +generate: $(GEN_ATOMICINT) $(GEN_ATOMICWRAPPER) + go generate ./... + +.PHONY: generatenodirty +generatenodirty: + @[ -z "$$(git status --porcelain)" ] || ( \ + echo "Working tree is dirty. Commit your changes first."; \ + exit 1 ) + @make generate + @status=$$(git status --porcelain); \ + [ -z "$$status" ] || ( \ + echo "Working tree is dirty after `make generate`:"; \ + echo "$$status"; \ + echo "Please ensure that the generated code is up-to-date." ) diff --git a/vendor/go.uber.org/atomic/README.md b/vendor/go.uber.org/atomic/README.md new file mode 100644 index 0000000..ade0c20 --- /dev/null +++ b/vendor/go.uber.org/atomic/README.md @@ -0,0 +1,63 @@ +# atomic [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Go Report Card][reportcard-img]][reportcard] + +Simple wrappers for primitive types to enforce atomic access. + +## Installation + +```shell +$ go get -u go.uber.org/atomic@v1 +``` + +### Legacy Import Path + +As of v1.5.0, the import path `go.uber.org/atomic` is the only supported way +of using this package. If you are using Go modules, this package will fail to +compile with the legacy import path path `github.com/uber-go/atomic`. + +We recommend migrating your code to the new import path but if you're unable +to do so, or if your dependencies are still using the old import path, you +will have to add a `replace` directive to your `go.mod` file downgrading the +legacy import path to an older version. + +``` +replace github.com/uber-go/atomic => github.com/uber-go/atomic v1.4.0 +``` + +You can do so automatically by running the following command. + +```shell +$ go mod edit -replace github.com/uber-go/atomic=github.com/uber-go/atomic@v1.4.0 +``` + +## Usage + +The standard library's `sync/atomic` is powerful, but it's easy to forget which +variables must be accessed atomically. `go.uber.org/atomic` preserves all the +functionality of the standard library, but wraps the primitive types to +provide a safer, more convenient API. + +```go +var atom atomic.Uint32 +atom.Store(42) +atom.Sub(2) +atom.CAS(40, 11) +``` + +See the [documentation][doc] for a complete API specification. + +## Development Status + +Stable. + +--- + +Released under the [MIT License](LICENSE.txt). + +[doc-img]: https://godoc.org/github.com/uber-go/atomic?status.svg +[doc]: https://godoc.org/go.uber.org/atomic +[ci-img]: https://travis-ci.com/uber-go/atomic.svg?branch=master +[ci]: https://travis-ci.com/uber-go/atomic +[cov-img]: https://codecov.io/gh/uber-go/atomic/branch/master/graph/badge.svg +[cov]: https://codecov.io/gh/uber-go/atomic +[reportcard-img]: https://goreportcard.com/badge/go.uber.org/atomic +[reportcard]: https://goreportcard.com/report/go.uber.org/atomic diff --git a/vendor/go.uber.org/atomic/bool.go b/vendor/go.uber.org/atomic/bool.go new file mode 100644 index 0000000..9cf1914 --- /dev/null +++ b/vendor/go.uber.org/atomic/bool.go @@ -0,0 +1,81 @@ +// @generated Code generated by gen-atomicwrapper. + +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +import ( + "encoding/json" +) + +// Bool is an atomic type-safe wrapper for bool values. +type Bool struct { + _ nocmp // disallow non-atomic comparison + + v Uint32 +} + +var _zeroBool bool + +// NewBool creates a new Bool. +func NewBool(v bool) *Bool { + x := &Bool{} + if v != _zeroBool { + x.Store(v) + } + return x +} + +// Load atomically loads the wrapped bool. +func (x *Bool) Load() bool { + return truthy(x.v.Load()) +} + +// Store atomically stores the passed bool. +func (x *Bool) Store(v bool) { + x.v.Store(boolToInt(v)) +} + +// CAS is an atomic compare-and-swap for bool values. +func (x *Bool) CAS(o, n bool) bool { + return x.v.CAS(boolToInt(o), boolToInt(n)) +} + +// Swap atomically stores the given bool and returns the old +// value. +func (x *Bool) Swap(o bool) bool { + return truthy(x.v.Swap(boolToInt(o))) +} + +// MarshalJSON encodes the wrapped bool into JSON. +func (x *Bool) MarshalJSON() ([]byte, error) { + return json.Marshal(x.Load()) +} + +// UnmarshalJSON decodes a bool from JSON. +func (x *Bool) UnmarshalJSON(b []byte) error { + var v bool + if err := json.Unmarshal(b, &v); err != nil { + return err + } + x.Store(v) + return nil +} diff --git a/vendor/go.uber.org/atomic/bool_ext.go b/vendor/go.uber.org/atomic/bool_ext.go new file mode 100644 index 0000000..c7bf7a8 --- /dev/null +++ b/vendor/go.uber.org/atomic/bool_ext.go @@ -0,0 +1,53 @@ +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +import ( + "strconv" +) + +//go:generate bin/gen-atomicwrapper -name=Bool -type=bool -wrapped=Uint32 -pack=boolToInt -unpack=truthy -cas -swap -json -file=bool.go + +func truthy(n uint32) bool { + return n == 1 +} + +func boolToInt(b bool) uint32 { + if b { + return 1 + } + return 0 +} + +// Toggle atomically negates the Boolean and returns the previous value. +func (b *Bool) Toggle() bool { + for { + old := b.Load() + if b.CAS(old, !old) { + return old + } + } +} + +// String encodes the wrapped value as a string. +func (b *Bool) String() string { + return strconv.FormatBool(b.Load()) +} diff --git a/vendor/go.uber.org/atomic/doc.go b/vendor/go.uber.org/atomic/doc.go new file mode 100644 index 0000000..ae7390e --- /dev/null +++ b/vendor/go.uber.org/atomic/doc.go @@ -0,0 +1,23 @@ +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// Package atomic provides simple wrappers around numerics to enforce atomic +// access. +package atomic diff --git a/vendor/go.uber.org/atomic/duration.go b/vendor/go.uber.org/atomic/duration.go new file mode 100644 index 0000000..027cfcb --- /dev/null +++ b/vendor/go.uber.org/atomic/duration.go @@ -0,0 +1,82 @@ +// @generated Code generated by gen-atomicwrapper. + +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +import ( + "encoding/json" + "time" +) + +// Duration is an atomic type-safe wrapper for time.Duration values. +type Duration struct { + _ nocmp // disallow non-atomic comparison + + v Int64 +} + +var _zeroDuration time.Duration + +// NewDuration creates a new Duration. +func NewDuration(v time.Duration) *Duration { + x := &Duration{} + if v != _zeroDuration { + x.Store(v) + } + return x +} + +// Load atomically loads the wrapped time.Duration. +func (x *Duration) Load() time.Duration { + return time.Duration(x.v.Load()) +} + +// Store atomically stores the passed time.Duration. +func (x *Duration) Store(v time.Duration) { + x.v.Store(int64(v)) +} + +// CAS is an atomic compare-and-swap for time.Duration values. +func (x *Duration) CAS(o, n time.Duration) bool { + return x.v.CAS(int64(o), int64(n)) +} + +// Swap atomically stores the given time.Duration and returns the old +// value. +func (x *Duration) Swap(o time.Duration) time.Duration { + return time.Duration(x.v.Swap(int64(o))) +} + +// MarshalJSON encodes the wrapped time.Duration into JSON. +func (x *Duration) MarshalJSON() ([]byte, error) { + return json.Marshal(x.Load()) +} + +// UnmarshalJSON decodes a time.Duration from JSON. +func (x *Duration) UnmarshalJSON(b []byte) error { + var v time.Duration + if err := json.Unmarshal(b, &v); err != nil { + return err + } + x.Store(v) + return nil +} diff --git a/vendor/go.uber.org/atomic/duration_ext.go b/vendor/go.uber.org/atomic/duration_ext.go new file mode 100644 index 0000000..6273b66 --- /dev/null +++ b/vendor/go.uber.org/atomic/duration_ext.go @@ -0,0 +1,40 @@ +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +import "time" + +//go:generate bin/gen-atomicwrapper -name=Duration -type=time.Duration -wrapped=Int64 -pack=int64 -unpack=time.Duration -cas -swap -json -imports time -file=duration.go + +// Add atomically adds to the wrapped time.Duration and returns the new value. +func (d *Duration) Add(n time.Duration) time.Duration { + return time.Duration(d.v.Add(int64(n))) +} + +// Sub atomically subtracts from the wrapped time.Duration and returns the new value. +func (d *Duration) Sub(n time.Duration) time.Duration { + return time.Duration(d.v.Sub(int64(n))) +} + +// String encodes the wrapped value as a string. +func (d *Duration) String() string { + return d.Load().String() +} diff --git a/vendor/go.uber.org/atomic/error.go b/vendor/go.uber.org/atomic/error.go new file mode 100644 index 0000000..a6166fb --- /dev/null +++ b/vendor/go.uber.org/atomic/error.go @@ -0,0 +1,51 @@ +// @generated Code generated by gen-atomicwrapper. + +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +// Error is an atomic type-safe wrapper for error values. +type Error struct { + _ nocmp // disallow non-atomic comparison + + v Value +} + +var _zeroError error + +// NewError creates a new Error. +func NewError(v error) *Error { + x := &Error{} + if v != _zeroError { + x.Store(v) + } + return x +} + +// Load atomically loads the wrapped error. +func (x *Error) Load() error { + return unpackError(x.v.Load()) +} + +// Store atomically stores the passed error. +func (x *Error) Store(v error) { + x.v.Store(packError(v)) +} diff --git a/vendor/go.uber.org/atomic/error_ext.go b/vendor/go.uber.org/atomic/error_ext.go new file mode 100644 index 0000000..ffe0be2 --- /dev/null +++ b/vendor/go.uber.org/atomic/error_ext.go @@ -0,0 +1,39 @@ +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +// atomic.Value panics on nil inputs, or if the underlying type changes. +// Stabilize by always storing a custom struct that we control. + +//go:generate bin/gen-atomicwrapper -name=Error -type=error -wrapped=Value -pack=packError -unpack=unpackError -file=error.go + +type packedError struct{ Value error } + +func packError(v error) interface{} { + return packedError{v} +} + +func unpackError(v interface{}) error { + if err, ok := v.(packedError); ok { + return err.Value + } + return nil +} diff --git a/vendor/go.uber.org/atomic/float64.go b/vendor/go.uber.org/atomic/float64.go new file mode 100644 index 0000000..0719060 --- /dev/null +++ b/vendor/go.uber.org/atomic/float64.go @@ -0,0 +1,76 @@ +// @generated Code generated by gen-atomicwrapper. + +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +import ( + "encoding/json" + "math" +) + +// Float64 is an atomic type-safe wrapper for float64 values. +type Float64 struct { + _ nocmp // disallow non-atomic comparison + + v Uint64 +} + +var _zeroFloat64 float64 + +// NewFloat64 creates a new Float64. +func NewFloat64(v float64) *Float64 { + x := &Float64{} + if v != _zeroFloat64 { + x.Store(v) + } + return x +} + +// Load atomically loads the wrapped float64. +func (x *Float64) Load() float64 { + return math.Float64frombits(x.v.Load()) +} + +// Store atomically stores the passed float64. +func (x *Float64) Store(v float64) { + x.v.Store(math.Float64bits(v)) +} + +// CAS is an atomic compare-and-swap for float64 values. +func (x *Float64) CAS(o, n float64) bool { + return x.v.CAS(math.Float64bits(o), math.Float64bits(n)) +} + +// MarshalJSON encodes the wrapped float64 into JSON. +func (x *Float64) MarshalJSON() ([]byte, error) { + return json.Marshal(x.Load()) +} + +// UnmarshalJSON decodes a float64 from JSON. +func (x *Float64) UnmarshalJSON(b []byte) error { + var v float64 + if err := json.Unmarshal(b, &v); err != nil { + return err + } + x.Store(v) + return nil +} diff --git a/vendor/go.uber.org/atomic/float64_ext.go b/vendor/go.uber.org/atomic/float64_ext.go new file mode 100644 index 0000000..927b1ad --- /dev/null +++ b/vendor/go.uber.org/atomic/float64_ext.go @@ -0,0 +1,47 @@ +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +import "strconv" + +//go:generate bin/gen-atomicwrapper -name=Float64 -type=float64 -wrapped=Uint64 -pack=math.Float64bits -unpack=math.Float64frombits -cas -json -imports math -file=float64.go + +// Add atomically adds to the wrapped float64 and returns the new value. +func (f *Float64) Add(s float64) float64 { + for { + old := f.Load() + new := old + s + if f.CAS(old, new) { + return new + } + } +} + +// Sub atomically subtracts from the wrapped float64 and returns the new value. +func (f *Float64) Sub(s float64) float64 { + return f.Add(-s) +} + +// String encodes the wrapped value as a string. +func (f *Float64) String() string { + // 'g' is the behavior for floats with %v. + return strconv.FormatFloat(f.Load(), 'g', -1, 64) +} diff --git a/vendor/go.uber.org/atomic/gen.go b/vendor/go.uber.org/atomic/gen.go new file mode 100644 index 0000000..50d6b24 --- /dev/null +++ b/vendor/go.uber.org/atomic/gen.go @@ -0,0 +1,26 @@ +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +//go:generate bin/gen-atomicint -name=Int32 -wrapped=int32 -file=int32.go +//go:generate bin/gen-atomicint -name=Int64 -wrapped=int64 -file=int64.go +//go:generate bin/gen-atomicint -name=Uint32 -wrapped=uint32 -unsigned -file=uint32.go +//go:generate bin/gen-atomicint -name=Uint64 -wrapped=uint64 -unsigned -file=uint64.go diff --git a/vendor/go.uber.org/atomic/go.mod b/vendor/go.uber.org/atomic/go.mod new file mode 100644 index 0000000..daa7599 --- /dev/null +++ b/vendor/go.uber.org/atomic/go.mod @@ -0,0 +1,8 @@ +module go.uber.org/atomic + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/stretchr/testify v1.3.0 +) + +go 1.13 diff --git a/vendor/go.uber.org/atomic/go.sum b/vendor/go.uber.org/atomic/go.sum new file mode 100644 index 0000000..4f76e62 --- /dev/null +++ b/vendor/go.uber.org/atomic/go.sum @@ -0,0 +1,9 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +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/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= diff --git a/vendor/go.uber.org/atomic/int32.go b/vendor/go.uber.org/atomic/int32.go new file mode 100644 index 0000000..18ae564 --- /dev/null +++ b/vendor/go.uber.org/atomic/int32.go @@ -0,0 +1,102 @@ +// @generated Code generated by gen-atomicint. + +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +import ( + "encoding/json" + "strconv" + "sync/atomic" +) + +// Int32 is an atomic wrapper around int32. +type Int32 struct { + _ nocmp // disallow non-atomic comparison + + v int32 +} + +// NewInt32 creates a new Int32. +func NewInt32(i int32) *Int32 { + return &Int32{v: i} +} + +// Load atomically loads the wrapped value. +func (i *Int32) Load() int32 { + return atomic.LoadInt32(&i.v) +} + +// Add atomically adds to the wrapped int32 and returns the new value. +func (i *Int32) Add(n int32) int32 { + return atomic.AddInt32(&i.v, n) +} + +// Sub atomically subtracts from the wrapped int32 and returns the new value. +func (i *Int32) Sub(n int32) int32 { + return atomic.AddInt32(&i.v, -n) +} + +// Inc atomically increments the wrapped int32 and returns the new value. +func (i *Int32) Inc() int32 { + return i.Add(1) +} + +// Dec atomically decrements the wrapped int32 and returns the new value. +func (i *Int32) Dec() int32 { + return i.Sub(1) +} + +// CAS is an atomic compare-and-swap. +func (i *Int32) CAS(old, new int32) bool { + return atomic.CompareAndSwapInt32(&i.v, old, new) +} + +// Store atomically stores the passed value. +func (i *Int32) Store(n int32) { + atomic.StoreInt32(&i.v, n) +} + +// Swap atomically swaps the wrapped int32 and returns the old value. +func (i *Int32) Swap(n int32) int32 { + return atomic.SwapInt32(&i.v, n) +} + +// MarshalJSON encodes the wrapped int32 into JSON. +func (i *Int32) MarshalJSON() ([]byte, error) { + return json.Marshal(i.Load()) +} + +// UnmarshalJSON decodes JSON into the wrapped int32. +func (i *Int32) UnmarshalJSON(b []byte) error { + var v int32 + if err := json.Unmarshal(b, &v); err != nil { + return err + } + i.Store(v) + return nil +} + +// String encodes the wrapped value as a string. +func (i *Int32) String() string { + v := i.Load() + return strconv.FormatInt(int64(v), 10) +} diff --git a/vendor/go.uber.org/atomic/int64.go b/vendor/go.uber.org/atomic/int64.go new file mode 100644 index 0000000..2bcbbfa --- /dev/null +++ b/vendor/go.uber.org/atomic/int64.go @@ -0,0 +1,102 @@ +// @generated Code generated by gen-atomicint. + +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +import ( + "encoding/json" + "strconv" + "sync/atomic" +) + +// Int64 is an atomic wrapper around int64. +type Int64 struct { + _ nocmp // disallow non-atomic comparison + + v int64 +} + +// NewInt64 creates a new Int64. +func NewInt64(i int64) *Int64 { + return &Int64{v: i} +} + +// Load atomically loads the wrapped value. +func (i *Int64) Load() int64 { + return atomic.LoadInt64(&i.v) +} + +// Add atomically adds to the wrapped int64 and returns the new value. +func (i *Int64) Add(n int64) int64 { + return atomic.AddInt64(&i.v, n) +} + +// Sub atomically subtracts from the wrapped int64 and returns the new value. +func (i *Int64) Sub(n int64) int64 { + return atomic.AddInt64(&i.v, -n) +} + +// Inc atomically increments the wrapped int64 and returns the new value. +func (i *Int64) Inc() int64 { + return i.Add(1) +} + +// Dec atomically decrements the wrapped int64 and returns the new value. +func (i *Int64) Dec() int64 { + return i.Sub(1) +} + +// CAS is an atomic compare-and-swap. +func (i *Int64) CAS(old, new int64) bool { + return atomic.CompareAndSwapInt64(&i.v, old, new) +} + +// Store atomically stores the passed value. +func (i *Int64) Store(n int64) { + atomic.StoreInt64(&i.v, n) +} + +// Swap atomically swaps the wrapped int64 and returns the old value. +func (i *Int64) Swap(n int64) int64 { + return atomic.SwapInt64(&i.v, n) +} + +// MarshalJSON encodes the wrapped int64 into JSON. +func (i *Int64) MarshalJSON() ([]byte, error) { + return json.Marshal(i.Load()) +} + +// UnmarshalJSON decodes JSON into the wrapped int64. +func (i *Int64) UnmarshalJSON(b []byte) error { + var v int64 + if err := json.Unmarshal(b, &v); err != nil { + return err + } + i.Store(v) + return nil +} + +// String encodes the wrapped value as a string. +func (i *Int64) String() string { + v := i.Load() + return strconv.FormatInt(int64(v), 10) +} diff --git a/vendor/go.uber.org/atomic/nocmp.go b/vendor/go.uber.org/atomic/nocmp.go new file mode 100644 index 0000000..a8201cb --- /dev/null +++ b/vendor/go.uber.org/atomic/nocmp.go @@ -0,0 +1,35 @@ +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +// nocmp is an uncomparable struct. Embed this inside another struct to make +// it uncomparable. +// +// type Foo struct { +// nocmp +// // ... +// } +// +// This DOES NOT: +// +// - Disallow shallow copies of structs +// - Disallow comparison of pointers to uncomparable structs +type nocmp [0]func() diff --git a/vendor/go.uber.org/atomic/string.go b/vendor/go.uber.org/atomic/string.go new file mode 100644 index 0000000..225b7a2 --- /dev/null +++ b/vendor/go.uber.org/atomic/string.go @@ -0,0 +1,54 @@ +// @generated Code generated by gen-atomicwrapper. + +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +// String is an atomic type-safe wrapper for string values. +type String struct { + _ nocmp // disallow non-atomic comparison + + v Value +} + +var _zeroString string + +// NewString creates a new String. +func NewString(v string) *String { + x := &String{} + if v != _zeroString { + x.Store(v) + } + return x +} + +// Load atomically loads the wrapped string. +func (x *String) Load() string { + if v := x.v.Load(); v != nil { + return v.(string) + } + return _zeroString +} + +// Store atomically stores the passed string. +func (x *String) Store(v string) { + x.v.Store(v) +} diff --git a/vendor/go.uber.org/atomic/string_ext.go b/vendor/go.uber.org/atomic/string_ext.go new file mode 100644 index 0000000..3a95582 --- /dev/null +++ b/vendor/go.uber.org/atomic/string_ext.go @@ -0,0 +1,43 @@ +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +//go:generate bin/gen-atomicwrapper -name=String -type=string -wrapped=Value -file=string.go + +// String returns the wrapped value. +func (s *String) String() string { + return s.Load() +} + +// MarshalText encodes the wrapped string into a textual form. +// +// This makes it encodable as JSON, YAML, XML, and more. +func (s *String) MarshalText() ([]byte, error) { + return []byte(s.Load()), nil +} + +// UnmarshalText decodes text and replaces the wrapped string with it. +// +// This makes it decodable from JSON, YAML, XML, and more. +func (s *String) UnmarshalText(b []byte) error { + s.Store(string(b)) + return nil +} diff --git a/vendor/go.uber.org/atomic/uint32.go b/vendor/go.uber.org/atomic/uint32.go new file mode 100644 index 0000000..a973aba --- /dev/null +++ b/vendor/go.uber.org/atomic/uint32.go @@ -0,0 +1,102 @@ +// @generated Code generated by gen-atomicint. + +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +import ( + "encoding/json" + "strconv" + "sync/atomic" +) + +// Uint32 is an atomic wrapper around uint32. +type Uint32 struct { + _ nocmp // disallow non-atomic comparison + + v uint32 +} + +// NewUint32 creates a new Uint32. +func NewUint32(i uint32) *Uint32 { + return &Uint32{v: i} +} + +// Load atomically loads the wrapped value. +func (i *Uint32) Load() uint32 { + return atomic.LoadUint32(&i.v) +} + +// Add atomically adds to the wrapped uint32 and returns the new value. +func (i *Uint32) Add(n uint32) uint32 { + return atomic.AddUint32(&i.v, n) +} + +// Sub atomically subtracts from the wrapped uint32 and returns the new value. +func (i *Uint32) Sub(n uint32) uint32 { + return atomic.AddUint32(&i.v, ^(n - 1)) +} + +// Inc atomically increments the wrapped uint32 and returns the new value. +func (i *Uint32) Inc() uint32 { + return i.Add(1) +} + +// Dec atomically decrements the wrapped uint32 and returns the new value. +func (i *Uint32) Dec() uint32 { + return i.Sub(1) +} + +// CAS is an atomic compare-and-swap. +func (i *Uint32) CAS(old, new uint32) bool { + return atomic.CompareAndSwapUint32(&i.v, old, new) +} + +// Store atomically stores the passed value. +func (i *Uint32) Store(n uint32) { + atomic.StoreUint32(&i.v, n) +} + +// Swap atomically swaps the wrapped uint32 and returns the old value. +func (i *Uint32) Swap(n uint32) uint32 { + return atomic.SwapUint32(&i.v, n) +} + +// MarshalJSON encodes the wrapped uint32 into JSON. +func (i *Uint32) MarshalJSON() ([]byte, error) { + return json.Marshal(i.Load()) +} + +// UnmarshalJSON decodes JSON into the wrapped uint32. +func (i *Uint32) UnmarshalJSON(b []byte) error { + var v uint32 + if err := json.Unmarshal(b, &v); err != nil { + return err + } + i.Store(v) + return nil +} + +// String encodes the wrapped value as a string. +func (i *Uint32) String() string { + v := i.Load() + return strconv.FormatUint(uint64(v), 10) +} diff --git a/vendor/go.uber.org/atomic/uint64.go b/vendor/go.uber.org/atomic/uint64.go new file mode 100644 index 0000000..3b6c71f --- /dev/null +++ b/vendor/go.uber.org/atomic/uint64.go @@ -0,0 +1,102 @@ +// @generated Code generated by gen-atomicint. + +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +import ( + "encoding/json" + "strconv" + "sync/atomic" +) + +// Uint64 is an atomic wrapper around uint64. +type Uint64 struct { + _ nocmp // disallow non-atomic comparison + + v uint64 +} + +// NewUint64 creates a new Uint64. +func NewUint64(i uint64) *Uint64 { + return &Uint64{v: i} +} + +// Load atomically loads the wrapped value. +func (i *Uint64) Load() uint64 { + return atomic.LoadUint64(&i.v) +} + +// Add atomically adds to the wrapped uint64 and returns the new value. +func (i *Uint64) Add(n uint64) uint64 { + return atomic.AddUint64(&i.v, n) +} + +// Sub atomically subtracts from the wrapped uint64 and returns the new value. +func (i *Uint64) Sub(n uint64) uint64 { + return atomic.AddUint64(&i.v, ^(n - 1)) +} + +// Inc atomically increments the wrapped uint64 and returns the new value. +func (i *Uint64) Inc() uint64 { + return i.Add(1) +} + +// Dec atomically decrements the wrapped uint64 and returns the new value. +func (i *Uint64) Dec() uint64 { + return i.Sub(1) +} + +// CAS is an atomic compare-and-swap. +func (i *Uint64) CAS(old, new uint64) bool { + return atomic.CompareAndSwapUint64(&i.v, old, new) +} + +// Store atomically stores the passed value. +func (i *Uint64) Store(n uint64) { + atomic.StoreUint64(&i.v, n) +} + +// Swap atomically swaps the wrapped uint64 and returns the old value. +func (i *Uint64) Swap(n uint64) uint64 { + return atomic.SwapUint64(&i.v, n) +} + +// MarshalJSON encodes the wrapped uint64 into JSON. +func (i *Uint64) MarshalJSON() ([]byte, error) { + return json.Marshal(i.Load()) +} + +// UnmarshalJSON decodes JSON into the wrapped uint64. +func (i *Uint64) UnmarshalJSON(b []byte) error { + var v uint64 + if err := json.Unmarshal(b, &v); err != nil { + return err + } + i.Store(v) + return nil +} + +// String encodes the wrapped value as a string. +func (i *Uint64) String() string { + v := i.Load() + return strconv.FormatUint(uint64(v), 10) +} diff --git a/vendor/go.uber.org/atomic/value.go b/vendor/go.uber.org/atomic/value.go new file mode 100644 index 0000000..671f3a3 --- /dev/null +++ b/vendor/go.uber.org/atomic/value.go @@ -0,0 +1,31 @@ +// Copyright (c) 2020 Uber Technologies, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +package atomic + +import "sync/atomic" + +// Value shadows the type of the same name from sync/atomic +// https://godoc.org/sync/atomic#Value +type Value struct { + atomic.Value + + _ nocmp // disallow non-atomic comparison +} diff --git a/vendor/modules.txt b/vendor/modules.txt index ac86e5e..66b92cb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,7 +1,14 @@ # github.com/go-ini/ini v1.62.0 ## explicit github.com/go-ini/ini -# github.com/go-sql-driver/mysql v1.5.0 +# github.com/go-mysql-org/go-mysql v1.3.0 +## explicit +github.com/go-mysql-org/go-mysql/client +github.com/go-mysql-org/go-mysql/mysql +github.com/go-mysql-org/go-mysql/packet +github.com/go-mysql-org/go-mysql/replication +github.com/go-mysql-org/go-mysql/utils +# github.com/go-sql-driver/mysql v1.6.0 ## explicit github.com/go-sql-driver/mysql # github.com/openark/golib v0.0.0-20210531070646-355f37940af8 @@ -9,10 +16,8 @@ github.com/go-sql-driver/mysql github.com/openark/golib/log github.com/openark/golib/sqlutils github.com/openark/golib/tests -# github.com/pingcap/errors v0.11.0 +# github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3 github.com/pingcap/errors -# github.com/pkg/errors v0.9.1 -## explicit # github.com/satori/go.uuid v1.2.0 ## explicit github.com/satori/go.uuid @@ -23,15 +28,10 @@ github.com/siddontang/go/hack # github.com/siddontang/go-log v0.0.0-20180807004314-8d05993dda07 github.com/siddontang/go-log/log github.com/siddontang/go-log/loggers -# github.com/siddontang/go-mysql v1.1.0 -## explicit -github.com/siddontang/go-mysql/client -github.com/siddontang/go-mysql/mysql -github.com/siddontang/go-mysql/packet -github.com/siddontang/go-mysql/replication -github.com/siddontang/go-mysql/utils # github.com/smartystreets/goconvey v1.6.4 ## explicit +# go.uber.org/atomic v1.7.0 +go.uber.org/atomic # golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 ## explicit golang.org/x/crypto/ssh/terminal @@ -45,7 +45,7 @@ golang.org/x/sys/unix golang.org/x/sys/windows # golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 golang.org/x/term -# golang.org/x/text v0.3.5 +# golang.org/x/text v0.3.6 ## explicit golang.org/x/text/encoding golang.org/x/text/encoding/charmap