diff --git a/go.mod b/go.mod index fff8652d..fd8d99e1 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/deckarep/golang-set/v2 v2.3.0 github.com/dlmiddlecote/sqlstats v1.0.2 github.com/dustin/go-humanize v1.0.1 - github.com/go-mysql-org/go-mysql v1.6.0 + github.com/go-mysql-org/go-mysql v1.7.0 github.com/go-sql-driver/mysql v1.7.0 github.com/golang/mock v1.6.0 github.com/mightyguava/autotx v0.1.1 @@ -67,7 +67,7 @@ require ( github.com/opentracing-contrib/go-grpc v0.0.0-20210225150812-73cb765af46e // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/philhofer/fwd v1.1.2 // indirect - github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3 // indirect + github.com/pingcap/errors v0.11.5-0.20210425183316-da1aaba5fb63 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect diff --git a/go.sum b/go.sum index 3f6245d4..8c729233 100644 --- a/go.sum +++ b/go.sum @@ -35,6 +35,7 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -67,12 +68,9 @@ github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyphar/filepath-securejoin v0.2.3 h1:YX6ebbZCZP7VkM3scTTokDgBL2TY741X51MTk3ycuNI= github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= -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= @@ -112,10 +110,10 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-mysql-org/go-mysql v1.6.0 h1:19B5fojzZcri/1wj9G/1+ws8RJ3N6rJs2X5c/+kBLuQ= -github.com/go-mysql-org/go-mysql v1.6.0/go.mod h1:GX0clmylJLdZEYAojPCDTCvwZxbTBrke93dV55715u0= -github.com/go-sql-driver/mysql v1.3.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-mysql-org/go-mysql v1.7.0 h1:qE5FTRb3ZeTQmlk3pjE+/m2ravGxxRDrVDTyDe9tvqI= +github.com/go-mysql-org/go-mysql v1.7.0/go.mod h1:9cRWLtuXNKhamUPMkrDVzBhaomGvqLRLtBiyjvjc4pk= github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= +github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -162,7 +160,6 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -248,12 +245,10 @@ github.com/philhofer/fwd v1.1.2/go.mod h1:qkPdfjR2SIEbspLqpe1tO4n5yICnr2DY7mqEx2 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/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/pingcap/errors v0.11.5-0.20210425183316-da1aaba5fb63 h1:+FZIDR/D97YOPik4N4lPDaUcLDF/EQPogxtlHB2ZZRM= +github.com/pingcap/errors v0.11.5-0.20210425183316-da1aaba5fb63/go.mod h1:X2r9ueLEUZgtx2cIogM0v4Zj5uvvzhuuiu7Pn8HzMPg= +github.com/pingcap/log v0.0.0-20210625125904-98ed8e2eb1c7/go.mod h1:8AanEdAHATuRurdGxZXBz0At+9avep+ub7U1AGYLIMM= +github.com/pingcap/tidb/parser v0.0.0-20221126021158-6b02a5d8ba7d/go.mod h1:ElJiub4lRy6UZDb+0JHDkGEdr6aOli+ykhyej7VCLoI= github.com/pires/go-proxyproto v0.6.2 h1:KAZ7UteSOt6urjme6ZldyFm4wDe/z0ZUP0Yv0Dos0d8= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -284,9 +279,8 @@ github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+Gx github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= +github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -354,14 +348,12 @@ go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= 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.10.0/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= +go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go4.org/intern v0.0.0-20211027215823-ae77deb06f29/go.mod h1:cS2ma+47FKrLPdXFpr7CuxiTW3eyJbWew4qx0qtQWDA= go4.org/intern v0.0.0-20220617035311-6925f38cc365 h1:t9hFvR102YlOqU0fQn1wgwhNvSbHGBbbJxX9JKfU3l0= go4.org/intern v0.0.0-20220617035311-6925f38cc365/go.mod h1:WXRv3p7T6gzt0CcJm43AAKdKVZmcQbwwC7EwquU5BZU= @@ -370,20 +362,19 @@ go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760 h1:FyBZqvo go4.org/unsafe/assume-no-moving-gc v0.0.0-20220617031537-928513b29760/go.mod h1:FftLjUGFEDu5k8lt0ddY+HcrH/qU/0qk+H8j9/nTl3E= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-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-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= +golang.org/x/exp v0.0.0-20181106170214-d68db9428509/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20230131160201-f062dba9d201 h1:BEABXpNXLEz0WxtA+6CQIz2xkg80e+1zrhWyMcq8VzE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= 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.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -472,7 +463,6 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.3.0/go.mod h1:q750SLmJuPmVoN1blW3UFBPREJfb1KmY3vwxfr+nFDA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/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.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -488,10 +478,9 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/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-20191108193012-7d206e10da11/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-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20201125231158-b5590deeca9b/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -552,7 +541,6 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 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/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= @@ -560,10 +548,12 @@ gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= @@ -572,11 +562,23 @@ gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= gotest.tools/v3 v3.2.0 h1:I0DwBVMGAx26dttAj1BtJLAkVGncrkkUXfJLC4Flt/I= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= inet.af/netaddr v0.0.0-20220811202034-502d2d690317 h1:U2fwK6P2EqmopP/hFLTOAjWTki0qgd4GMJn5X8wOleU= inet.af/netaddr v0.0.0-20220811202034-502d2d690317/go.mod h1:OIezDfdzOgFhuw4HuWapWq2e9l0H9tK4F1j+ETRtF3k= k8s.io/apimachinery v0.26.1 h1:8EZ/eGJL+hY/MYCNwhmDzVqq2lPl3N3Bo8rvweJwXUQ= k8s.io/apimachinery v0.26.1/go.mod h1:tnPmbONNJ7ByJNz9+n9kMjNP8ON+1qoAIIC70lztu74= +modernc.org/fileutil v1.0.0/go.mod h1:JHsWpkrk/CnVV1H/eGlFf85BEpfkrp56ro8nojIq9Q8= +modernc.org/golex v1.0.1/go.mod h1:QCA53QtsT1NdGkaZZkF5ezFwk4IXh4BGNafAARTC254= +modernc.org/lex v1.0.0/go.mod h1:G6rxMTy3cH2iA0iXL/HRRv4Znu8MK4higxph/lE7ypk= +modernc.org/lexer v1.0.0/go.mod h1:F/Dld0YKYdZCLQ7bD0USbWL4YKCyTDRDHiDTOs0q0vk= +modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= +modernc.org/mathutil v1.4.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= +modernc.org/parser v1.0.0/go.mod h1:H20AntYJ2cHHL6MHthJ8LZzXCdDCHMWt1KZXtIMjejA= +modernc.org/parser v1.0.2/go.mod h1:TXNq3HABP3HMaqLK7brD1fLA/LfN0KS6JxZn71QdDqs= +modernc.org/scanner v1.0.1/go.mod h1:OIzD2ZtjYk6yTuyqZr57FmifbM9fIH74SumloSsajuE= +modernc.org/sortutil v1.0.0/go.mod h1:1QO0q8IlIlmjBIwm6t/7sof874+xCfZouyqZMLIAtxM= +modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= +modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= +modernc.org/y v1.0.1/go.mod h1:Ho86I+LVHEI+LYXoUKlmOMAM1JTXOCfj8qi1T8PsClE= software.sslmate.com/src/go-pkcs12 v0.0.0-20200830195227-52f69702a001 h1:AVd6O+azYjVQYW1l55IqkbL8/JxjrLtO6q4FCmV8N5c= software.sslmate.com/src/go-pkcs12 v0.0.0-20200830195227-52f69702a001/go.mod h1:/xvNRWUqm0+/ZMiF4EX00vrSCMsE4/NHb+Pt3freEeQ= vitess.io/vitess v0.16.1 h1:4jyOxT+FOIZiqBIyfxuXmMlV8AZt/FeJwr/bwyqbQuA= diff --git a/vendor/github.com/go-mysql-org/go-mysql/client/auth.go b/vendor/github.com/go-mysql-org/go-mysql/client/auth.go index 8410edc4..eb2db6eb 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/client/auth.go +++ b/vendor/github.com/go-mysql-org/go-mysql/client/auth.go @@ -110,9 +110,9 @@ 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. -// here the \NUL needs to be added when sending back the empty password or cleartext password in 'sha256_password' -// authentication. +// 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) { // password hashing switch c.authPluginName { @@ -120,6 +120,8 @@ func (c *Conn) genAuthResponse(authData []byte) ([]byte, bool, error) { return CalcPassword(authData[:20], []byte(c.password)), false, nil case AUTH_CACHING_SHA2_PASSWORD: return CalcCachingSha2Password(authData, c.password), false, nil + case AUTH_CLEAR_PASSWORD: + return []byte(c.password), true, nil case AUTH_SHA256_PASSWORD: if len(c.password) == 0 { return nil, true, nil diff --git a/vendor/github.com/go-mysql-org/go-mysql/client/conn.go b/vendor/github.com/go-mysql-org/go-mysql/client/conn.go index 5cbe3002..5b65af89 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/client/conn.go +++ b/vendor/github.com/go-mysql-org/go-mysql/client/conn.go @@ -61,14 +61,12 @@ func getNetProto(addr string) string { // Connect to a MySQL server, addr can be ip:port, or a unix socket domain like /var/sock. // Accepts a series of configuration functions as a variadic argument. func Connect(addr string, user string, password string, dbName string, options ...func(*Conn)) (*Conn, error) { - proto := getNetProto(addr) - ctx, cancel := context.WithTimeout(context.Background(), time.Second*10) defer cancel() dialer := &net.Dialer{} - return ConnectWithDialer(ctx, proto, addr, user, password, dbName, dialer.DialContext, options...) + return ConnectWithDialer(ctx, "", addr, user, password, dbName, dialer.DialContext, options...) } // Dialer connects to the address on the named network using the provided context. @@ -78,22 +76,21 @@ type Dialer func(ctx context.Context, network, address string) (net.Conn, error) func ConnectWithDialer(ctx context.Context, network string, addr string, user string, password string, dbName string, dialer Dialer, options ...func(*Conn)) (*Conn, error) { c := new(Conn) + if network == "" { + network = getNetProto(addr) + } + var err error conn, err := dialer(ctx, network, addr) if err != nil { return nil, errors.Trace(err) } - if c.tlsConfig != nil { - c.Conn = packet.NewTLSConn(conn) - } else { - c.Conn = packet.NewConn(conn) - } - c.user = user c.password = password c.db = dbName c.proto = network + c.Conn = packet.NewConn(conn) // use default charset here, utf-8 c.charset = DEFAULT_CHARSET @@ -103,6 +100,12 @@ func ConnectWithDialer(ctx context.Context, network string, addr string, user st options[i](c) } + if c.tlsConfig != nil { + seq := c.Conn.Sequence + c.Conn = packet.NewTLSConn(conn) + c.Conn.Sequence = seq + } + if err = c.handshake(); err != nil { return nil, errors.Trace(err) } @@ -214,11 +217,10 @@ func (c *Conn) Execute(command string, args ...interface{}) (*Result, error) { // // Example: // -// queries := "SELECT 1; SELECT NOW();" -// conn.ExecuteMultiple(queries, func(result *mysql.Result, err error) { -// // Use the result as you want -// }) -// +// queries := "SELECT 1; SELECT NOW();" +// conn.ExecuteMultiple(queries, func(result *mysql.Result, err error) { +// // Use the result as you want +// }) func (c *Conn) ExecuteMultiple(query string, perResultCallback ExecPerResultCallback) (*Result, error) { if err := c.writeCommandStr(COM_QUERY, query); err != nil { return nil, errors.Trace(err) @@ -268,20 +270,19 @@ func (c *Conn) ExecuteMultiple(query string, perResultCallback ExecPerResultCall } // ExecuteSelectStreaming will call perRowCallback for every row in resultset -// WITHOUT saving any row data to Result.{Values/RawPkg/RowDatas} fields. +// WITHOUT saving any row data to Result.{Values/RawPkg/RowDatas} fields. // When given, perResultCallback will be called once per result // // 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 -// }, nil) -// +// 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 +// }, nil) func (c *Conn) ExecuteSelectStreaming(command string, result *Result, perRowCallback SelectPerRowCallback, perResultCallback SelectPerResultCallback) error { if err := c.writeCommandStr(COM_QUERY, command); err != nil { return errors.Trace(err) @@ -327,22 +328,19 @@ func (c *Conn) FieldList(table string, wildcard string) ([]*Field, error) { return nil, errors.Trace(err) } - data, err := c.ReadPacket() - if err != nil { - return nil, errors.Trace(err) - } - fs := make([]*Field, 0, 4) var f *Field - if data[0] == ERR_HEADER { - return nil, c.handleErrorPacket(data) - } - for { - if data, err = c.ReadPacket(); err != nil { + data, err := c.ReadPacket() + if err != nil { return nil, errors.Trace(err) } + // ERR Packet + if data[0] == ERR_HEADER { + return nil, c.handleErrorPacket(data) + } + // EOF Packet if c.isEOFPacket(data) { return fs, nil 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 index 029487e4..263d5277 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/client/pool.go +++ b/vendor/github.com/go-mysql-org/go-mysql/client/pool.go @@ -75,10 +75,10 @@ var ( ) // 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). +// 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, diff --git a/vendor/github.com/go-mysql-org/go-mysql/client/resp.go b/vendor/github.com/go-mysql-org/go-mysql/client/resp.go index 0c94b398..ab809cc6 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/client/resp.go +++ b/vendor/github.com/go-mysql-org/go-mysql/client/resp.go @@ -336,7 +336,7 @@ func (c *Conn) readResultsetStreaming(data []byte, binary bool, result *Result, } func (c *Conn) readResultColumns(result *Result) (err error) { - var i int = 0 + var i = 0 var data []byte for { diff --git a/vendor/github.com/go-mysql-org/go-mysql/client/stmt.go b/vendor/github.com/go-mysql-org/go-mysql/client/stmt.go index 761b131b..dd2cb79c 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/client/stmt.go +++ b/vendor/github.com/go-mysql-org/go-mysql/client/stmt.go @@ -74,7 +74,7 @@ func (s *Stmt) write(args ...interface{}) error { for i := range args { if args[i] == nil { - nullBitmap[i/8] |= (1 << (uint(i) % 8)) + nullBitmap[i/8] |= 1 << (uint(i) % 8) paramTypes[i<<1] = MYSQL_TYPE_NULL continue } diff --git a/vendor/github.com/go-mysql-org/go-mysql/mysql/const.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/const.go index 9721cf8e..e2f3a0af 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/mysql/const.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/const.go @@ -20,6 +20,7 @@ const ( const ( AUTH_MYSQL_OLD_PASSWORD = "mysql_old_password" AUTH_NATIVE_PASSWORD = "mysql_native_password" + AUTH_CLEAR_PASSWORD = "mysql_clear_password" AUTH_CACHING_SHA2_PASSWORD = "caching_sha2_password" AUTH_SHA256_PASSWORD = "sha256_password" ) diff --git a/vendor/github.com/go-mysql-org/go-mysql/mysql/field.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/field.go index e0f8e6f3..7ffce400 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/mysql/field.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/field.go @@ -146,7 +146,7 @@ func (f *Field) Dump() []byte { f = &Field{} } if f.Data != nil { - return []byte(f.Data) + return f.Data } l := len(f.Schema) + len(f.Table) + len(f.OrgTable) + len(f.Name) + len(f.OrgName) + len(f.DefaultValue) + 48 diff --git a/vendor/github.com/go-mysql-org/go-mysql/mysql/gtid.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/gtid.go index f35c4d73..ae519ef2 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/mysql/gtid.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/gtid.go @@ -1,6 +1,8 @@ package mysql -import "github.com/pingcap/errors" +import ( + "github.com/pingcap/errors" +) type GTIDSet interface { String() string diff --git a/vendor/github.com/go-mysql-org/go-mysql/mysql/mysql_gtid.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/mysql_gtid.go index b410bdbc..47eae629 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/mysql/mysql_gtid.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/mysql_gtid.go @@ -111,6 +111,48 @@ func (s IntervalSlice) Normalize() IntervalSlice { return n } +func min(a, b int64) int64 { + if a < b { + return a + } + return b +} + +func max(a, b int64) int64 { + if a > b { + return a + } + return b +} + +func (s *IntervalSlice) InsertInterval(interval Interval) { + var ( + count int + i int + ) + + *s = append(*s, interval) + total := len(*s) + for i = total - 1; i > 0; i-- { + if (*s)[i].Stop < (*s)[i-1].Start { + (*s)[i], (*s)[i-1] = (*s)[i-1], (*s)[i] + } else if (*s)[i].Start > (*s)[i-1].Stop { + break + } else { + (*s)[i-1].Start = min((*s)[i-1].Start, (*s)[i].Start) + (*s)[i-1].Stop = max((*s)[i-1].Stop, (*s)[i].Stop) + count++ + } + } + if count > 0 { + i++ + if i+count < total { + copy((*s)[i:], (*s)[i+count:]) + } + *s = (*s)[:total-count] + } +} + // Contain returns true if sub in s func (s IntervalSlice) Contain(sub IntervalSlice) bool { j := 0 @@ -343,10 +385,9 @@ func (s *UUIDSet) Decode(data []byte) error { func (s *UUIDSet) Clone() *UUIDSet { clone := new(UUIDSet) - - copy(clone.SID[:], s.SID[:]) - clone.Intervals = s.Intervals.Normalize() - + clone.SID = s.SID + clone.Intervals = make([]Interval, len(s.Intervals)) + copy(clone.Intervals, s.Intervals) return clone } @@ -439,6 +480,16 @@ func (s *MysqlGTIDSet) Update(GTIDStr string) error { return nil } +func (s *MysqlGTIDSet) AddGTID(uuid uuid.UUID, gno int64) { + sid := uuid.String() + o, ok := s.Sets[sid] + if ok { + o.Intervals.InsertInterval(Interval{gno, gno + 1}) + } else { + s.Sets[sid] = &UUIDSet{uuid, IntervalSlice{Interval{gno, gno + 1}}} + } +} + func (s *MysqlGTIDSet) Add(addend MysqlGTIDSet) error { for _, uuidSet := range addend.Sets { s.AddSet(uuidSet) diff --git a/vendor/github.com/go-mysql-org/go-mysql/mysql/resultset_helper.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/resultset_helper.go index 0cc859d7..8c632066 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/mysql/resultset_helper.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/resultset_helper.go @@ -192,7 +192,7 @@ func BuildSimpleBinaryResultset(names []string, values [][]interface{}) (*Result var b []byte - bitmapLen := ((len(names) + 7 + 2) >> 3) + bitmapLen := (len(names) + 7 + 2) >> 3 for i, vs := range values { if len(vs) != len(r.Fields) { @@ -220,7 +220,7 @@ func BuildSimpleBinaryResultset(names []string, values [][]interface{}) (*Result } } if value == nil { - nullBitmap[(i+2)/8] |= (1 << (uint(i+2) % 8)) + nullBitmap[(i+2)/8] |= 1 << (uint(i+2) % 8) continue } diff --git a/vendor/github.com/go-mysql-org/go-mysql/mysql/util.go b/vendor/github.com/go-mysql-org/go-mysql/mysql/util.go index 1a86a6bc..e8d436fa 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/mysql/util.go +++ b/vendor/github.com/go-mysql-org/go-mysql/mysql/util.go @@ -107,14 +107,14 @@ func AppendLengthEncodedInteger(b []byte, n uint64) []byte { byte(n>>32), byte(n>>40), byte(n>>48), byte(n>>56)) } -func RandomBuf(size int) ([]byte, error) { +func RandomBuf(size int) []byte { buf := make([]byte, size) mrand.Seed(time.Now().UTC().UnixNano()) min, max := 30, 127 for i := 0; i < size; i++ { buf[i] = byte(min + mrand.Intn(max-min)) } - return buf, nil + return buf } // FixedLengthInt: little endian diff --git a/vendor/github.com/go-mysql-org/go-mysql/packet/conn.go b/vendor/github.com/go-mysql-org/go-mysql/packet/conn.go index 60de437c..8d020fe9 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/packet/conn.go +++ b/vendor/github.com/go-mysql-org/go-mysql/packet/conn.go @@ -40,9 +40,7 @@ func (b *BufPool) Return(buf *bytes.Buffer) { b.pool.Put(buf) } -/* - Conn is the base class to handle MySQL protocol. -*/ +// Conn is the base class to handle MySQL protocol. type Conn struct { net.Conn @@ -92,7 +90,9 @@ func (c *Conn) ReadPacket() ([]byte, error) { func (c *Conn) ReadPacketReuseMem(dst []byte) ([]byte, error) { // Here we use `sync.Pool` to avoid allocate/destroy buffers frequently. buf := utils.BytesBufferGet() - defer utils.BytesBufferPut(buf) + defer func() { + utils.BytesBufferPut(buf) + }() if err := c.ReadPacketTo(buf); err != nil { return nil, errors.Trace(err) diff --git a/vendor/github.com/go-mysql-org/go-mysql/replication/binlogstreamer.go b/vendor/github.com/go-mysql-org/go-mysql/replication/binlogstreamer.go index 56b8622a..61254fba 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/replication/binlogstreamer.go +++ b/vendor/github.com/go-mysql-org/go-mysql/replication/binlogstreamer.go @@ -84,7 +84,7 @@ func (s *BinlogStreamer) closeWithError(err error) { } } -func newBinlogStreamer() *BinlogStreamer { +func NewBinlogStreamer() *BinlogStreamer { s := new(BinlogStreamer) s.ch = make(chan *BinlogEvent, 10240) @@ -92,3 +92,24 @@ func newBinlogStreamer() *BinlogStreamer { return s } + +// AddEventToStreamer adds a binlog event to the streamer. You can use it when you want to add an event to the streamer manually. +// can be used in replication handlers +func (s *BinlogStreamer) AddEventToStreamer(ev *BinlogEvent) error { + select { + case s.ch <- ev: + return nil + case err := <-s.ech: + return err + } +} + +// AddErrorToStreamer adds an error to the streamer. +func (s *BinlogStreamer) AddErrorToStreamer(err error) bool { + select { + case s.ech <- err: + return true + default: + return false + } +} diff --git a/vendor/github.com/go-mysql-org/go-mysql/replication/binlogsyncer.go b/vendor/github.com/go-mysql-org/go-mysql/replication/binlogsyncer.go index aa5ac747..7f8b06b7 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/replication/binlogsyncer.go +++ b/vendor/github.com/go-mysql-org/go-mysql/replication/binlogsyncer.go @@ -7,9 +7,12 @@ import ( "fmt" "net" "os" + "strconv" "sync" "time" + "github.com/siddontang/go-log/loggers" + "github.com/google/uuid" "github.com/pingcap/errors" "github.com/siddontang/go-log/log" @@ -111,7 +114,14 @@ type BinlogSyncerConfig struct { Option func(*client.Conn) error // Set Logger - Logger *log.Logger + Logger loggers.Advanced + + // Set Dialer + Dialer client.Dialer + + RowsEventDecodeFunc func(*RowsEvent, []byte) error + + DiscardGTIDSet bool } // BinlogSyncer syncs binlog event from server. @@ -130,6 +140,9 @@ type BinlogSyncer struct { prevGset, currGset GTIDSet + // instead of GTIDSet.Clone, use this to speed up calculate prevGset + prevMySQLGTIDEvent *GTIDEvent + running bool ctx context.Context @@ -149,11 +162,15 @@ func NewBinlogSyncer(cfg BinlogSyncerConfig) *BinlogSyncer { if cfg.ServerID == 0 { cfg.Logger.Fatal("can't use 0 as the server ID") } + if cfg.Dialer == nil { + dialer := &net.Dialer{} + cfg.Dialer = dialer.DialContext + } // Clear the Password to avoid outputing it in log. pass := cfg.Password cfg.Password = "" - cfg.Logger.Infof("create BinlogSyncer with config %v", cfg) + cfg.Logger.Infof("create BinlogSyncer with config %+v", cfg) cfg.Password = pass b := new(BinlogSyncer) @@ -166,6 +183,7 @@ func NewBinlogSyncer(cfg BinlogSyncerConfig) *BinlogSyncer { b.parser.SetTimestampStringLocation(b.cfg.TimestampStringLocation) b.parser.SetUseDecimal(b.cfg.UseDecimal) b.parser.SetVerifyChecksum(b.cfg.VerifyChecksum) + b.parser.SetRowsEventDecodeFunc(b.cfg.RowsEventDecodeFunc) b.running = false b.ctx, b.cancel = context.WithCancel(context.Background()) @@ -202,7 +220,7 @@ func (b *BinlogSyncer) close() { // Use a new connection to kill the binlog syncer // because calling KILL from the same connection // doesn't actually disconnect it. - c, err := b.newConnection() + c, err := b.newConnection(context.Background()) if err == nil { b.killConnection(c, b.lastConnectionID) c.Close() @@ -233,7 +251,7 @@ func (b *BinlogSyncer) registerSlave() error { } var err error - b.c, err = b.newConnection() + b.c, err = b.newConnection(b.ctx) if err != nil { return errors.Trace(err) } @@ -375,7 +393,7 @@ func (b *BinlogSyncer) prepare() error { func (b *BinlogSyncer) startDumpStream() *BinlogStreamer { b.running = true - s := newBinlogStreamer() + s := NewBinlogStreamer() b.wg.Add(1) go b.onStream(s) @@ -409,6 +427,7 @@ func (b *BinlogSyncer) StartSync(pos Position) (*BinlogStreamer, error) { func (b *BinlogSyncer) StartSyncGTID(gset GTIDSet) (*BinlogStreamer, error) { b.cfg.Logger.Infof("begin to sync binlog from GTID set %s", gset) + b.prevMySQLGTIDEvent = nil b.prevGset = gset b.m.Lock() @@ -605,6 +624,7 @@ func (b *BinlogSyncer) retrySync() error { defer b.m.Unlock() b.parser.Reset() + b.prevMySQLGTIDEvent = nil if b.prevGset != nil { msg := fmt.Sprintf("begin to re-sync from %s", b.prevGset.String()) @@ -764,7 +784,7 @@ func (b *BinlogSyncer) parseEvent(s *BinlogStreamer, data []byte) error { needACK := false if b.cfg.SemiSyncEnabled && (data[0] == SemiSyncIndicator) { - needACK = (data[1] == 0x01) + needACK = data[1] == 0x01 //skip semi sync header data = data[2:] } @@ -786,21 +806,6 @@ func (b *BinlogSyncer) parseEvent(s *BinlogStreamer, data []byte) error { return b.currGset.Clone() } - advanceCurrentGtidSet := func(gtid string) error { - if b.currGset == nil { - b.currGset = b.prevGset.Clone() - } - prev := b.currGset.Clone() - err := b.currGset.Update(gtid) - if err == nil { - // right after reconnect we will see same gtid as we saw before, thus currGset will not get changed - if !b.currGset.Equal(prev) { - b.prevGset = prev - } - } - return err - } - switch event := e.Event.(type) { case *RotateEvent: b.nextPos.Name = string(event.NextLogName) @@ -810,24 +815,40 @@ func (b *BinlogSyncer) parseEvent(s *BinlogStreamer, data []byte) error { if b.prevGset == nil { break } + if b.currGset == nil { + b.currGset = b.prevGset.Clone() + } u, _ := uuid.FromBytes(event.SID) - err := advanceCurrentGtidSet(fmt.Sprintf("%s:%d", u.String(), event.GNO)) - if err != nil { - return errors.Trace(err) + b.currGset.(*MysqlGTIDSet).AddGTID(u, event.GNO) + if b.prevMySQLGTIDEvent != nil { + u, _ = uuid.FromBytes(b.prevMySQLGTIDEvent.SID) + b.prevGset.(*MysqlGTIDSet).AddGTID(u, b.prevMySQLGTIDEvent.GNO) } + b.prevMySQLGTIDEvent = event case *MariadbGTIDEvent: if b.prevGset == nil { break } - GTID := event.GTID - err := advanceCurrentGtidSet(fmt.Sprintf("%d-%d-%d", GTID.DomainID, GTID.ServerID, GTID.SequenceNumber)) + if b.currGset == nil { + b.currGset = b.prevGset.Clone() + } + prev := b.currGset.Clone() + err = b.currGset.(*MariadbGTIDSet).AddSet(&event.GTID) if err != nil { return errors.Trace(err) } + // right after reconnect we will see same gtid as we saw before, thus currGset will not get changed + if !b.currGset.Equal(prev) { + b.prevGset = prev + } case *XIDEvent: - event.GSet = getCurrentGtidSet() + if !b.cfg.DiscardGTIDSet { + event.GSet = getCurrentGtidSet() + } case *QueryEvent: - event.GSet = getCurrentGtidSet() + if !b.cfg.DiscardGTIDSet { + event.GSet = getCurrentGtidSet() + } } needStop := false @@ -856,17 +877,21 @@ func (b *BinlogSyncer) LastConnectionID() uint32 { return b.lastConnectionID } -func (b *BinlogSyncer) newConnection() (*client.Conn, error) { +func (b *BinlogSyncer) newConnection(ctx context.Context) (*client.Conn, error) { var addr string if b.cfg.Port != 0 { - addr = fmt.Sprintf("%s:%d", b.cfg.Host, b.cfg.Port) + addr = net.JoinHostPort(b.cfg.Host, strconv.Itoa(int(b.cfg.Port))) } else { addr = b.cfg.Host } - return client.Connect(addr, b.cfg.User, b.cfg.Password, "", func(c *client.Conn) { - c.SetTLSConfig(b.cfg.TLSConfig) - }) + timeoutCtx, cancel := context.WithTimeout(ctx, time.Second*10) + defer cancel() + + return client.ConnectWithDialer(timeoutCtx, "", addr, b.cfg.User, b.cfg.Password, + "", b.cfg.Dialer, func(c *client.Conn) { + c.SetTLSConfig(b.cfg.TLSConfig) + }) } func (b *BinlogSyncer) killConnection(conn *client.Conn, id uint32) { diff --git a/vendor/github.com/go-mysql-org/go-mysql/replication/const.go b/vendor/github.com/go-mysql-org/go-mysql/replication/const.go index ce7b98b4..a8821ba2 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/replication/const.go +++ b/vendor/github.com/go-mysql-org/go-mysql/replication/const.go @@ -7,7 +7,7 @@ const ( var ( //binlog header [ fe `bin` ] - BinLogFileHeader []byte = []byte{0xfe, 0x62, 0x69, 0x6e} + BinLogFileHeader = []byte{0xfe, 0x62, 0x69, 0x6e} SemiSyncIndicator byte = 0xef ) diff --git a/vendor/github.com/go-mysql-org/go-mysql/replication/event.go b/vendor/github.com/go-mysql-org/go-mysql/replication/event.go index 1862d3f8..5a1f5c65 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/replication/event.go +++ b/vendor/github.com/go-mysql-org/go-mysql/replication/event.go @@ -108,11 +108,11 @@ func (h *EventHeader) Dump(w io.Writer) { } var ( - checksumVersionSplitMysql []int = []int{5, 6, 1} - checksumVersionProductMysql int = (checksumVersionSplitMysql[0]*256+checksumVersionSplitMysql[1])*256 + checksumVersionSplitMysql[2] + checksumVersionSplitMysql = []int{5, 6, 1} + checksumVersionProductMysql = (checksumVersionSplitMysql[0]*256+checksumVersionSplitMysql[1])*256 + checksumVersionSplitMysql[2] - checksumVersionSplitMariaDB []int = []int{5, 3, 0} - checksumVersionProductMariaDB int = (checksumVersionSplitMariaDB[0]*256+checksumVersionSplitMariaDB[1])*256 + checksumVersionSplitMariaDB[2] + checksumVersionSplitMariaDB = []int{5, 3, 0} + checksumVersionProductMariaDB = (checksumVersionSplitMariaDB[0]*256+checksumVersionSplitMariaDB[1])*256 + checksumVersionSplitMariaDB[2] ) // server version format X.Y.Zabc, a is not . or number @@ -141,7 +141,7 @@ func splitServerVersion(server string) []int { func calcVersionProduct(server string) int { versionSplit := splitServerVersion(server) - return ((versionSplit[0]*256+versionSplit[1])*256 + versionSplit[2]) + return (versionSplit[0]*256+versionSplit[1])*256 + versionSplit[2] } type FormatDescriptionEvent struct { diff --git a/vendor/github.com/go-mysql-org/go-mysql/replication/json_binary.go b/vendor/github.com/go-mysql-org/go-mysql/replication/json_binary.go index 5771bea7..f1e0abd3 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/replication/json_binary.go +++ b/vendor/github.com/go-mysql-org/go-mysql/replication/json_binary.go @@ -444,7 +444,7 @@ func (d *jsonBinaryDecoder) decodeDateTime(data []byte) interface{} { year := ym / 13 month := ym % 13 day := ymd % (1 << 5) - hour := (hms >> 12) + hour := hms >> 12 minute := (hms >> 6) % (1 << 6) second := hms % (1 << 6) frac := v % (1 << 24) diff --git a/vendor/github.com/go-mysql-org/go-mysql/replication/parser.go b/vendor/github.com/go-mysql-org/go-mysql/replication/parser.go index 7688fe7b..329159d2 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/replication/parser.go +++ b/vendor/github.com/go-mysql-org/go-mysql/replication/parser.go @@ -40,6 +40,8 @@ type BinlogParser struct { useDecimal bool ignoreJSONDecodeErr bool verifyChecksum bool + + rowsEventDecodeFunc func(*RowsEvent, []byte) error } func NewBinlogParser() *BinlogParser { @@ -212,6 +214,10 @@ func (p *BinlogParser) SetFlavor(flavor string) { p.flavor = flavor } +func (p *BinlogParser) SetRowsEventDecodeFunc(rowsEventDecodeFunc func(*RowsEvent, []byte) error) { + p.rowsEventDecodeFunc = rowsEventDecodeFunc +} + func (p *BinlogParser) parseHeader(data []byte) (*EventHeader, error) { h := new(EventHeader) err := h.Decode(data) @@ -297,7 +303,13 @@ func (p *BinlogParser) parseEvent(h *EventHeader, data []byte, rawData []byte) ( } } - if err := e.Decode(data); err != nil { + var err error + if re, ok := e.(*RowsEvent); ok && p.rowsEventDecodeFunc != nil { + err = p.rowsEventDecodeFunc(re, data) + } else { + err = e.Decode(data) + } + if err != nil { return nil, &EventError{h, err.Error(), data} } diff --git a/vendor/github.com/go-mysql-org/go-mysql/replication/row_event.go b/vendor/github.com/go-mysql-org/go-mysql/replication/row_event.go index fa014cbf..fa3c0526 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/replication/row_event.go +++ b/vendor/github.com/go-mysql-org/go-mysql/replication/row_event.go @@ -11,7 +11,6 @@ import ( "github.com/pingcap/errors" "github.com/shopspring/decimal" - "github.com/siddontang/go-log/log" "github.com/siddontang/go/hack" . "github.com/go-mysql-org/go-mysql/mysql" @@ -197,13 +196,13 @@ func (e *TableMapEvent) decodeMeta(data []byte) error { for i, t := range e.ColumnType { switch t { case MYSQL_TYPE_STRING: - var x uint16 = uint16(data[pos]) << 8 //real type - x += uint16(data[pos+1]) //pack or field length + var x = uint16(data[pos]) << 8 //real type + x += uint16(data[pos+1]) //pack or field length e.ColumnMeta[i] = x pos += 2 case MYSQL_TYPE_NEWDECIMAL: - var x uint16 = uint16(data[pos]) << 8 //precision - x += uint16(data[pos+1]) //decimals + var x = uint16(data[pos]) << 8 //precision + x += uint16(data[pos+1]) //decimals e.ColumnMeta[i] = x pos += 2 case MYSQL_TYPE_VAR_STRING, @@ -857,7 +856,7 @@ type RowsEvent struct { ignoreJSONDecodeErr bool } -func (e *RowsEvent) Decode(data []byte) (err2 error) { +func (e *RowsEvent) DecodeHeader(data []byte) (int, error) { pos := 0 e.TableID = FixedLengthInt(data[0:e.tableIDSize]) pos += e.tableIDSize @@ -890,20 +889,23 @@ func (e *RowsEvent) Decode(data []byte) (err2 error) { e.Table, ok = e.tables[e.TableID] if !ok { if len(e.tables) > 0 { - return errors.Errorf("invalid table id %d, no corresponding table map event", e.TableID) + return 0, errors.Errorf("invalid table id %d, no corresponding table map event", e.TableID) } else { - return errors.Annotatef(errMissingTableMapEvent, "table id %d", e.TableID) + return 0, errors.Annotatef(errMissingTableMapEvent, "table id %d", e.TableID) } } + return pos, nil +} - var err error - +func (e *RowsEvent) DecodeData(pos int, data []byte) (err2 error) { + var ( + n int + err error + ) // ... repeat rows until event-end defer func() { if r := recover(); r != nil { - 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)) + err2 = errors.Errorf("parse rows event panic %v, data %q, parsed rows %#v, table map %#v", r, data, e, e.Table) } }() @@ -932,6 +934,14 @@ func (e *RowsEvent) Decode(data []byte) (err2 error) { return nil } +func (e *RowsEvent) Decode(data []byte) error { + pos, err := e.DecodeHeader(data) + if err != nil { + return err + } + return e.DecodeData(pos, data) +} + func isBitSet(bitmap []byte, i int) bool { return bitmap[i>>3]&(1<<(uint(i)&7)) > 0 } @@ -1002,7 +1012,7 @@ func (e *RowsEvent) parseFracTime(t interface{}) interface{} { // see mysql sql/log_event.cc log_event_print_value func (e *RowsEvent) decodeValue(data []byte, tp byte, meta uint16) (v interface{}, n int, err error) { - var length int = 0 + var length = 0 if tp == MYSQL_TYPE_STRING { if meta >= 256 { @@ -1428,7 +1438,7 @@ func decodeDatetime2(data []byte, dec uint16) (interface{}, int, error) { second := int(hms % (1 << 6)) minute := int((hms >> 6) % (1 << 6)) - hour := int((hms >> 12)) + hour := int(hms >> 12) // DATETIME encoding for nonfractional part after MySQL 5.6.4 // https://dev.mysql.com/doc/internals/en/date-and-time-data-type-representation.html diff --git a/vendor/github.com/go-mysql-org/go-mysql/schema/schema.go b/vendor/github.com/go-mysql-org/go-mysql/schema/schema.go index ea2ec558..61e65318 100644 --- a/vendor/github.com/go-mysql-org/go-mysql/schema/schema.go +++ b/vendor/github.com/go-mysql-org/go-mysql/schema/schema.go @@ -183,10 +183,23 @@ func (ta *Table) FindColumn(name string) int { return -1 } +// Get TableColumn by column index of primary key. func (ta *Table) GetPKColumn(index int) *TableColumn { + if index >= len(ta.PKColumns) { + return nil + } return &ta.Columns[ta.PKColumns[index]] } +func (ta *Table) IsPrimaryKey(colIndex int) bool { + for _, i := range ta.PKColumns { + if i == colIndex { + return true + } + } + return false +} + func (ta *Table) AddIndex(name string) (index *Index) { index = NewIndex(name) ta.Indexes = append(ta.Indexes, index) @@ -413,6 +426,7 @@ func (ta *Table) fetchPrimaryKeyColumns() error { return nil } + // Primary key must be the first index? pkIndex := ta.Indexes[0] if pkIndex.Name != "PRIMARY" { return nil diff --git a/vendor/github.com/pingcap/errors/.travis.yml b/vendor/github.com/pingcap/errors/.travis.yml index 15e5a192..eaaabc55 100644 --- a/vendor/github.com/pingcap/errors/.travis.yml +++ b/vendor/github.com/pingcap/errors/.travis.yml @@ -1,14 +1,11 @@ +arch: + - amd64 + language: go -go_import_path: github.com/pkg/errors +go_import_path: github.com/pingcap/errors go: - - 1.4.x - - 1.5.x - - 1.6.x - - 1.7.x - - 1.8.x - - 1.9.x - - 1.10.x - - tip + - 1.13.x + - stable script: - go test -v ./... diff --git a/vendor/github.com/pingcap/errors/appveyor.yml b/vendor/github.com/pingcap/errors/appveyor.yml deleted file mode 100644 index a932eade..00000000 --- a/vendor/github.com/pingcap/errors/appveyor.yml +++ /dev/null @@ -1,32 +0,0 @@ -version: build-{build}.{branch} - -clone_folder: C:\gopath\src\github.com\pkg\errors -shallow_clone: true # for startup speed - -environment: - GOPATH: C:\gopath - -platform: - - x64 - -# http://www.appveyor.com/docs/installed-software -install: - # some helpful output for debugging builds - - go version - - go env - # pre-installed MinGW at C:\MinGW is 32bit only - # but MSYS2 at C:\msys64 has mingw64 - - set PATH=C:\msys64\mingw64\bin;%PATH% - - gcc --version - - g++ --version - -build_script: - - go install -v ./... - -test_script: - - set PATH=C:\gopath\bin;%PATH% - - go test -v ./... - -#artifacts: -# - path: '%GOPATH%\bin\*.exe' -deploy: off diff --git a/vendor/github.com/pingcap/errors/compatible_shim.go b/vendor/github.com/pingcap/errors/compatible_shim.go index ba446e08..0835a0cd 100644 --- a/vendor/github.com/pingcap/errors/compatible_shim.go +++ b/vendor/github.com/pingcap/errors/compatible_shim.go @@ -63,7 +63,6 @@ func init() { } } - // MarshalJSON implements json.Marshaler interface. // aware that this function cannot save a 'registered' status, // since we cannot access the registry when unmarshaling, diff --git a/vendor/github.com/pingcap/errors/normalize.go b/vendor/github.com/pingcap/errors/normalize.go index 5712fe72..40a6ec12 100644 --- a/vendor/github.com/pingcap/errors/normalize.go +++ b/vendor/github.com/pingcap/errors/normalize.go @@ -115,6 +115,9 @@ func (e *Error) Error() string { if len(describe) == 0 { describe = ErrCodeText(strconv.Itoa(int(e.code))) } + if e.cause != nil { + return fmt.Sprintf("[%s]%s: %s", e.RFCCode(), e.GetMsg(), e.cause.Error()) + } return fmt.Sprintf("[%s]%s", e.RFCCode(), e.GetMsg()) } diff --git a/vendor/modules.txt b/vendor/modules.txt index e7c6b64a..04a142aa 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -106,7 +106,7 @@ github.com/docker/go-units # github.com/dustin/go-humanize v1.0.1 ## explicit; go 1.16 github.com/dustin/go-humanize -# github.com/go-mysql-org/go-mysql v1.6.0 +# github.com/go-mysql-org/go-mysql v1.7.0 ## explicit; go 1.16 github.com/go-mysql-org/go-mysql/client github.com/go-mysql-org/go-mysql/mysql @@ -219,7 +219,7 @@ github.com/pavel-v-chernykh/keystore-go # github.com/philhofer/fwd v1.1.2 ## explicit; go 1.15 github.com/philhofer/fwd -# github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3 +# github.com/pingcap/errors v0.11.5-0.20210425183316-da1aaba5fb63 ## explicit; go 1.14 github.com/pingcap/errors # github.com/pkg/errors v0.9.1