diff --git a/Makefile b/Makefile index 2850ca62d..1942957a0 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,8 @@ fmt: check: #go get github.com/golang/lint/golint @echo "vet" - $(GO) vet -all $(PACKAGES) 2>&1 | tee /dev/stderr | $(FAIL_ON_STDOUT) + @$(GO) vet -composites=false $(PACKAGES) + @$(GO) vet -vettool=$(CURDIR)/bin/shadow $(PACKAGES) || true #@echo "golint" #@ golint ./... 2>&1 | grep -vE '\.pb\.go' | grep -vE 'vendor' | awk '{print} END{if(NR>0) {exit 1}}' @echo "gofmt (simplify)" diff --git a/go.mod1 b/go.mod1 index dd076978b..dc28d6fc1 100644 --- a/go.mod1 +++ b/go.mod1 @@ -3,87 +3,22 @@ module github.com/pingcap/tidb-tools require ( github.com/BurntSushi/toml v0.3.1 github.com/DATA-DOG/go-sqlmock v1.3.3 - github.com/Shopify/sarama v1.19.0 - github.com/Shopify/toxiproxy v2.1.3+incompatible // indirect - github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 // indirect - github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd // indirect + github.com/Shopify/sarama v1.21.0 github.com/coreos/bbolt v1.3.1-coreos.6 // indirect github.com/coreos/etcd v3.3.10+incompatible - github.com/coreos/go-semver v0.2.0 // indirect - github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142 // indirect - github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f // indirect - github.com/cznic/mathutil v0.0.0-20181021201202-eba54fb065b7 // indirect - github.com/cznic/sortutil v0.0.0-20150617083342-4c7342852e65 // indirect - github.com/dgrijalva/jwt-go v3.2.0+incompatible // indirect - github.com/dustin/go-humanize v1.0.0 // indirect - github.com/eapache/go-resiliency v1.1.0 // indirect - github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect - github.com/eapache/queue v0.0.0-20180227141424-093482f3f8ce // indirect - github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385 // indirect - github.com/etcd-io/gofail v0.0.0-20180808172546-51ce9a71510a // indirect - github.com/ghodss/yaml v1.0.0 // indirect github.com/go-sql-driver/mysql v1.4.0 - github.com/gogo/protobuf v1.1.1 // indirect - github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff // indirect github.com/golang/protobuf v1.2.0 - github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db // indirect - github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c // indirect - github.com/gorilla/context v1.1.1 // indirect - github.com/gorilla/mux v1.6.2 // indirect - github.com/gorilla/websocket v1.2.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 // indirect - github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect - github.com/grpc-ecosystem/grpc-gateway v1.5.1 // indirect - github.com/jonboulle/clockwork v0.1.0 // indirect - github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e // indirect - github.com/konsorten/go-windows-terminal-sequences v1.0.1 // indirect - github.com/kr/pretty v0.1.0 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/montanaflynn/stats v0.0.0-20180911141734-db72e6cae808 // indirect - github.com/ngaut/log v0.0.0-20180314031856-b8e36e7ba5ac - github.com/ngaut/pools v0.0.0-20180318154953-b7bc8c42aac7 // indirect - github.com/ngaut/sync2 v0.0.0-20141008032647-7a24ed77b2ef // indirect - github.com/opentracing/basictracer-go v1.0.0 // indirect - github.com/opentracing/opentracing-go v1.0.2 // indirect - github.com/pierrec/lz4 v2.0.5+incompatible // indirect - github.com/pingcap/check v0.0.0-20171206051426-1c287c953996 - github.com/pingcap/errors v0.11.0 - github.com/pingcap/goleveldb v0.0.0-20171020122428-b9ff6c35079e // indirect - github.com/pingcap/kvproto v0.0.0-20181028030329-855d2192cdc7 - github.com/pingcap/parser v0.0.0-20181024082006-53ac409ed043 + github.com/pingcap/check v0.0.0-20190102082844-67f458068fc8 + github.com/pingcap/errors v0.11.1 + github.com/pingcap/kvproto v0.0.0-20190215154024-7f2fc73ef562 + github.com/pingcap/log v0.0.0-20190307075452-bd41d9273596 + github.com/pingcap/parser v0.0.0-20190312024907-3f6280b08c8b github.com/pingcap/pd v2.1.0-rc.4+incompatible - github.com/pingcap/tidb v2.1.0-rc.3.0.20181101080907-32b1dbd8d59f+incompatible - github.com/pingcap/tipb v0.0.0-20181012112600-11e33c750323 - github.com/pkg/errors v0.8.0 // indirect - github.com/prometheus/client_golang v0.9.0 // indirect - github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 // indirect - github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39 // indirect - github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d // indirect - github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect - github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446 // indirect + github.com/pingcap/tidb v0.0.0-20190320062740-9071c7b5b9ed + github.com/pingcap/tipb v0.0.0-20190107072121-abbec73437b7 github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726 - github.com/sirupsen/logrus v1.1.1 - github.com/soheilhy/cmux v0.1.4 // indirect - github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 // indirect - github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 // indirect - github.com/twinj/uuid v1.0.0 // indirect - github.com/uber/jaeger-client-go v2.15.0+incompatible // indirect - github.com/uber/jaeger-lib v1.5.0 // indirect - github.com/ugorji/go v1.1.1 // indirect - github.com/unrolled/render v0.0.0-20180914162206-b9786414de4d // indirect - github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18 // indirect go.uber.org/atomic v1.3.2 - go.uber.org/multierr v1.1.0 // indirect - go.uber.org/zap v1.8.0 // indirect - golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16 // indirect - golang.org/x/net v0.0.0-20181029044818-c44066c5c816 - golang.org/x/sys v0.0.0-20181030150119-7e31e0c00fa0 // indirect - golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 // indirect - google.golang.org/appengine v1.2.0 // indirect - google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 // indirect - google.golang.org/grpc v1.16.0 - gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect - gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce // indirect - gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect - gopkg.in/yaml.v2 v2.2.1 // indirect + go.uber.org/zap v1.9.1 + golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e + google.golang.org/grpc v1.17.0 ) diff --git a/go.sum1 b/go.sum1 index 3cd7f3ce6..a68aa418e 100644 --- a/go.sum1 +++ b/go.sum1 @@ -1,183 +1,234 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/DATA-DOG/go-sqlmock v1.3.3 h1:CWUqKXe0s8A2z6qCgkP4Kru7wC11YoAnoupUKFDnH08= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= -github.com/Shopify/sarama v1.19.0 h1:9oksLxC6uxVPHPVYUmq6xhr1BOF/hHobWH2UzO67z1s= +github.com/DataDog/zstd v1.3.5 h1:DtpNbljikUepEPD16hD4LvIcmhnhdLTiW/5pHgbmp14= +github.com/DataDog/zstd v1.3.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= +github.com/Shopify/sarama v1.21.0 h1:0GKs+e8mn1RRUzfg9oUXv3v7ZieQLmOZF/bfnmmGhM8= +github.com/Shopify/sarama v1.21.0/go.mod h1:yuqtN/pe8cXRWG5zPaO7hCfNJp5MwmkoJEoLjkm5tCQ= github.com/Shopify/toxiproxy v2.1.3+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973 h1:xJ4a3vCFaGF/jqvzLMYoU8P317H5OQ+Via4RmuPwCS0= +github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= +github.com/StackExchange/wmi v0.0.0-20180725035823-b12b22c5341f/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= +github.com/apache/thrift v0.0.0-20161221203622-b2a4d4ae21c7/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= +github.com/beorn7/perks v0.0.0-20160229213445-3ac7bf7a47d1/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/blacktear23/go-proxyprotocol v0.0.0-20171102103907-62e368e1c470/go.mod h1:VKt7CNAQxpFpSDz3sXyj9hY/GbVsQCr0sB3w59nE7lU= +github.com/blacktear23/go-proxyprotocol v0.0.0-20180807104634-af7a81e8dd0d/go.mod h1:VKt7CNAQxpFpSDz3sXyj9hY/GbVsQCr0sB3w59nE7lU= +github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w= +github.com/cockroachdb/cmux v0.0.0-20170110192607-30d10be49292/go.mod h1:qRiX68mZX1lGBkTWyp3CLcenw9I94W2dLeRvMzcn9N4= +github.com/codahale/hdrhistogram v0.0.0-20160425231609-f8ad88b59a58/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coreos/bbolt v1.3.1-coreos.6 h1:uTXKg9gY70s9jMAKdfljFQcuh4e/BXOM+V+d00KFj3A= +github.com/coreos/bbolt v1.3.0 h1:HIgH5xUWXT914HCI671AxuTTqjj64UOFr7pHn48LUTI= +github.com/coreos/bbolt v1.3.0/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/bbolt v1.3.1-coreos.6/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04= +github.com/coreos/etcd v3.2.18+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.2.0 h1:3Jm3tLmsgAYcjC+4Up7hJrFBPr+n7rAqYeSw/SZazuY= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142 h1:3jFq2xL4ZajGK4aZY8jz+DAF0FHjI51BXjjSwCzS1Dk= +github.com/coreos/go-systemd v0.0.0-20180202092358-40e2722dffea/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg= +github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cznic/mathutil v0.0.0-20181021201202-eba54fb065b7 h1:y+DH9ARrWiiNBV+6waYP2IPcsRbxdU1qsnycPfShF4c= +github.com/cznic/mathutil v0.0.0-20160613104831-78ad7f262603/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= github.com/cznic/mathutil v0.0.0-20181021201202-eba54fb065b7/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= -github.com/cznic/sortutil v0.0.0-20150617083342-4c7342852e65 h1:hxuZop6tSoOi0sxFzoGGYdRqNrPubyaIf9KoBG9tPiE= +github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548/go.mod h1:e6NPNENfs9mPDVNRekM7lKScauxd5kXTr1Mfyig6TDM= github.com/cznic/sortutil v0.0.0-20150617083342-4c7342852e65/go.mod h1:q2w6Bg5jeox1B+QkJ6Wp/+Vn0G/bo3f1uY7Fn3vivIQ= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dustin/go-humanize v0.0.0-20180421182945-02af3965c54e/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/eapache/go-resiliency v1.1.0 h1:1NtRmCAqadE2FN4ZcN6g90TP3uk8cg9rn9eNK2197aU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 h1:YEetp8/yCZMuEPMUDHG0CW/brkkEp8mzqk2+ODEitlw= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v0.0.0-20180227141424-093482f3f8ce h1:wgJIjAWDwKCWtv+sEEuBOizA9xBmlOoMsP3Cs9ZDxKk= github.com/eapache/queue v0.0.0-20180227141424-093482f3f8ce/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= +github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= +github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/etcd-io/gofail v0.0.0-20180808172546-51ce9a71510a/go.mod h1:49H/RkXP8pKaZy4h0d+NW16rSLhyVBt4o6VLJbmOqDE= -github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-sql-driver/mysql v1.4.0 h1:7LxgVwFb2hIQtMm87NdgAVfXjnt4OePseqT1tKx+opk= +github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= +github.com/go-sql-driver/mysql v0.0.0-20170715192408-3955978caca4/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo= +github.com/gogo/protobuf v0.0.0-20180717141946-636bf0302bc9/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +github.com/golang/protobuf v0.0.0-20180814211427-aa810b61a9c7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c h1:964Od4U6p2jUkFxvCydnIczKteheJEzHRToSGK3Bnlw= +github.com/google/btree v0.0.0-20161217183710-316fb6d3f031/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/gorilla/context v0.0.0-20160226214623-1ea25387ff6f/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= +github.com/gorilla/mux v0.0.0-20170228224354-599cba5e7b61/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ= github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0 h1:Iju5GlWwrvL6UBg4zJJt3btmonfrMlCDdsejg4CZE7c= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/grpc-ecosystem/go-grpc-middleware v0.0.0-20171020063731-82921fcf811d/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= +github.com/grpc-ecosystem/go-grpc-prometheus v0.0.0-20160910222444-6b7015e65d36/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.5.1 h1:3scN4iuXkNOyP98jF55Lv8a9j1o/IwvnDIZ0LHJK1nk= +github.com/grpc-ecosystem/grpc-gateway v1.4.1/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= github.com/grpc-ecosystem/grpc-gateway v1.5.1/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw= -github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e h1:+lIPJOWl+jSiJOc70QXJ07+2eg2Jy2EC7Mi11BWujeM= +github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid v0.0.0-20180405133222-e7e905edc00e/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/konsorten/go-windows-terminal-sequences v0.0.0-20180402223658-b729f2633dfe/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= 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/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= +github.com/mailru/easyjson v0.0.0-20190312143242-1de009706dbe/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/montanaflynn/stats v0.0.0-20151014174947-eeaced052adb/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/montanaflynn/stats v0.0.0-20180911141734-db72e6cae808/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= +github.com/myesui/uuid v1.0.0/go.mod h1:2CDfNgU0LR8mIdO8vdWd8i9gWWxLlcoIGGpSNgafq84= github.com/ngaut/log v0.0.0-20180314031856-b8e36e7ba5ac/go.mod h1:ueVCjKQllPmX7uEvCYnZD5b8qjidGf1TCH61arVe4SU= -github.com/ngaut/pools v0.0.0-20180318154953-b7bc8c42aac7 h1:7KAv7KMGTTqSmYZtNdcNTgsos+vFzULLwyElndwn+5c= github.com/ngaut/pools v0.0.0-20180318154953-b7bc8c42aac7/go.mod h1:iWMfgwqYW+e8n5lC/jjNEhwcjbRDpl5NT7n2h+4UNcI= -github.com/ngaut/sync2 v0.0.0-20141008032647-7a24ed77b2ef h1:K0Fn+DoFqNqktdZtdV3bPQ/0cuYh2H4rkg0tytX/07k= github.com/ngaut/sync2 v0.0.0-20141008032647-7a24ed77b2ef/go.mod h1:7WjlapSfwQyo6LNmIvEWzsW1hbBQfpUO4JWnuQRmva8= -github.com/opentracing/basictracer-go v1.0.0 h1:YyUAhaEfjoWXclZVJ9sGoNct7j4TVk7lZWlQw5UXuoo= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= -github.com/opentracing/opentracing-go v1.0.2 h1:3jA2P6O1F9UOrWVpwrIo17pu01KWvNWg4X946/Y5Zwg= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I= +github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pingcap/check v0.0.0-20171206051426-1c287c953996 h1:ZBdiJCMan6GSo/aPAM7gywcUKa0z58gczVrnG6TQnAQ= github.com/pingcap/check v0.0.0-20171206051426-1c287c953996/go.mod h1:B1+S9LNcuMyLH/4HMTViQOJevkGiik3wW2AN9zb2fNQ= -github.com/pingcap/errors v0.11.0 h1:DCJQB8jrHbQ1VVlMFIrbj2ApScNNotVmkSNplu2yUt4= +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/goleveldb v0.0.0-20171020122428-b9ff6c35079e h1:P73/4dPCL96rGrobssy1nVy2VaVpNCuLpCbr+FEaTA8= +github.com/pingcap/errors v0.11.1 h1:BXFZ6MdDd2U1uJUa2sRAWTmm+nieEzuyYM0R4aUTcC8= +github.com/pingcap/errors v0.11.1/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= +github.com/pingcap/gofail v0.0.0-20181217135706-6a951c1e42c3/go.mod h1:DazNTg0PTldtpsQiT9I5tVJwV1onHMKBBgXzmJUlMns= +github.com/pingcap/goleveldb v0.0.0-20171020084629-8d44bfdf1030/go.mod h1:O17XtbryoCJhkKGbT62+L2OlrniwqiGLSqrmdHCMzZw= github.com/pingcap/goleveldb v0.0.0-20171020122428-b9ff6c35079e/go.mod h1:O17XtbryoCJhkKGbT62+L2OlrniwqiGLSqrmdHCMzZw= -github.com/pingcap/kvproto v0.0.0-20181028030329-855d2192cdc7 h1:CYssSnPvf90ZSbFdZpsZGSI7y+drG1EfKxqTOnKnHb0= github.com/pingcap/kvproto v0.0.0-20181028030329-855d2192cdc7/go.mod h1:0gwbe1F2iBIjuQ9AH0DbQhL+Dpr5GofU8fgYyXk+ykk= -github.com/pingcap/parser v0.0.0-20181024082006-53ac409ed043 h1:P9Osi8lei5j2fiRgsBi2Wch7qe4a3yWUOsS5vSan/JU= +github.com/pingcap/kvproto v0.0.0-20190215154024-7f2fc73ef562/go.mod h1:QMdbTAXCHzzygQzqcG9uVUgU2fKeSN1GmfMiykdSzzY= +github.com/pingcap/kvproto v0.0.0-20190226063853-f6c0b7ffff11/go.mod h1:0gwbe1F2iBIjuQ9AH0DbQhL+Dpr5GofU8fgYyXk+ykk= +github.com/pingcap/log v0.0.0-20190307075452-bd41d9273596/go.mod h1:WpHUKhNZ18v116SvGrmjkA9CBhYmuUTKL+p8JC9ANEw= github.com/pingcap/parser v0.0.0-20181024082006-53ac409ed043/go.mod h1:1FNvfp9+J0wvc4kl8eGNh7Rqrxveg15jJoWo/a0uHwA= -github.com/pingcap/pd v2.1.0-rc.4+incompatible h1:/buwGk04aHO5odk/+O8ZOXGs4qkUjYTJ2UpCJXna8NE= +github.com/pingcap/parser v0.0.0-20190227090929-c68bfe7e0257 h1:laWEk5dHgwrtECrDACHx6p58DFPlCNJQ7QRIrvF2Zuo= +github.com/pingcap/parser v0.0.0-20190227090929-c68bfe7e0257/go.mod h1:1FNvfp9+J0wvc4kl8eGNh7Rqrxveg15jJoWo/a0uHwA= +github.com/pingcap/parser v0.0.0-20190312024907-3f6280b08c8b h1:NlvTrxqezIJh6CD5Leky12IZ8E/GtpEEmzgNNb34wbw= +github.com/pingcap/parser v0.0.0-20190312024907-3f6280b08c8b/go.mod h1:1FNvfp9+J0wvc4kl8eGNh7Rqrxveg15jJoWo/a0uHwA= github.com/pingcap/pd v2.1.0-rc.4+incompatible/go.mod h1:nD3+EoYes4+aNNODO99ES59V83MZSI+dFbhyr667a0E= -github.com/pingcap/tidb v2.1.0-rc.3.0.20181101080907-32b1dbd8d59f+incompatible h1:CIZHlDunFGiLzenh8z5Rh05JgrK6DW2f5/nTRGiyF6I= -github.com/pingcap/tidb v2.1.0-rc.3.0.20181101080907-32b1dbd8d59f+incompatible/go.mod h1:I8C6jrPINP2rrVunTRd7C9fRRhQrtR43S1/CL5ix/yQ= -github.com/pingcap/tipb v0.0.0-20181012112600-11e33c750323 h1:mRKKzRjDNaUNPnAkPAHnRqpNmwNWBX1iA+hxlmvQ93I= +github.com/pingcap/tidb v0.0.0-20190228062803-4dc309315c84 h1:XQetfynT/fE/PR31FRBW9+ZrwiUas1Os8CwM/jfhxYM= +github.com/pingcap/tidb v0.0.0-20190228062803-4dc309315c84/go.mod h1:cS9CcsV5+WiqYOKn8NzkR3RKP+RCKJDN6y4tdVOYbaE= +github.com/pingcap/tidb v0.0.0-20190318101756-cb83d4cf1af2 h1:7ixvBx48UdivJqL2u3rWzCxcL8Jq64G8ZQ8HUui6IBU= +github.com/pingcap/tidb v0.0.0-20190318101756-cb83d4cf1af2/go.mod h1:6O4QBr5btg5/YtcvI+wUvHkgwqtuuJLeRcMb+I4ewvk= +github.com/pingcap/tidb v0.0.0-20190320062740-9071c7b5b9ed h1:hG3ByogjqGf/Yngmsf5RWZ4HrrwSA/cnApfKoslOlG8= +github.com/pingcap/tidb v0.0.0-20190320062740-9071c7b5b9ed/go.mod h1:FcgD4o1kq3YNk08MWtMRwNZXQJpM28bFdb/go9KpmEA= +github.com/pingcap/tidb-tools v2.1.3-0.20190116051332-34c808eef588+incompatible/go.mod h1:XGdcy9+yqlDSEMTpOXnwf3hiTeqrV6MN/u1se9N8yIM= +github.com/pingcap/tipb v0.0.0-20180910045846-371b48b15d93/go.mod h1:RtkHW8WbcNxj8lsbzjaILci01CtYnYbIkQhjyZWrWVI= github.com/pingcap/tipb v0.0.0-20181012112600-11e33c750323/go.mod h1:RtkHW8WbcNxj8lsbzjaILci01CtYnYbIkQhjyZWrWVI= -github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw= +github.com/pingcap/tipb v0.0.0-20190107072121-abbec73437b7/go.mod h1:RtkHW8WbcNxj8lsbzjaILci01CtYnYbIkQhjyZWrWVI= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.0 h1:tXuTFVHC03mW0D+Ua1Q2d1EAVqLTuggX50V0VLICCzY= +github.com/pquerna/ffjson v0.0.0-20181028064349-e517b90714f7/go.mod h1:YARuvh7BUWHNhzDq2OM5tzR2RiCcN2D7sapiKyCel/M= +github.com/prometheus/client_golang v0.8.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.0/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910 h1:idejC8f05m9MGOsuEi1ATq9shN03HrxNkD/luQvxCv8= +github.com/prometheus/client_model v0.0.0-20171117100541-99fa1f4be8e5/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39 h1:Cto4X6SVMWRPBkJ/3YHn1iDGDGc/Z+sW+AEMKHMVvN4= +github.com/prometheus/common v0.0.0-20180426121432-d811d2e9bf89/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d h1:GoAlyOgbOEIFdaDqxJVlbOQ1DtGmZWs/Qau0hIlk+WQ= +github.com/prometheus/procfs v0.0.0-20180408092902-8b1c2da0d56d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhDYGoxY8uLVpewe1GDZ2vu2Tr/vTdVAkFQ= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446 h1:/NRJ5vAYoqz+7sG51ubIDHXeWO8DlTSrToPu6q11ziA= github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= -github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726 h1:xT+JlYxNGqyT+XcU8iUrN18JYed2TvG9yN5ULG2jATM= +github.com/shirou/gopsutil v2.18.10+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shurcooL/httpfs v0.0.0-20171119174359-809beceb2371/go.mod h1:ZY1cvUeJuFPAdZ/B6v7RHavJWZn2YPVFQ1OSXhCGOkg= +github.com/shurcooL/vfsgen v0.0.0-20181020040650-a97a25d856ca/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726/go.mod h1:3yhqj7WBBfRhbBlzyOC3gUxftwsU0u8gqevxwIHQpMw= -github.com/sirupsen/logrus v1.1.1 h1:VzGj7lhU7KEB9e9gMpAV/v5XT2NVSvLJhJLCWbnkgXg= +github.com/sirupsen/logrus v0.0.0-20170323161349-3bcb09397d6d/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.1.1/go.mod h1:zrgwTnHtNr00buQ1vSptGe8m1f/BbgsPukg8qsT7A+A= -github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ= +github.com/spaolacci/murmur3 v0.0.0-20150829172844-0d12bf811670/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6 h1:lYIiVDtZnyTWlNwiAxLj0bbpTcx1BWCFhXjfsvmPdNc= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/struCoder/pidusage v0.1.2/go.mod h1:pWBlW3YuSwRl6h7R5KbvA4N8oOqe9LjaKW5CwT1SPjI= +github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2/go.mod h1:2PfKggNGDuadAa0LElHrByyrz4JPZ9fFx6Gs7nx7ZZU= +github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tmc/grpc-websocket-proxy v0.0.0-20171017195756-830351dc03c6/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/twinj/uuid v1.0.0 h1:fzz7COZnDrXGTAOHGuUGYd6sG+JMq+AoE7+Jlu0przk= +github.com/twinj/uuid v0.0.0-20150629100731-70cac2bcd273/go.mod h1:mMgcE1RHFUFqe5AfiwlINXisXfDGro23fWdPUfOMjRY= github.com/twinj/uuid v1.0.0/go.mod h1:mMgcE1RHFUFqe5AfiwlINXisXfDGro23fWdPUfOMjRY= -github.com/uber/jaeger-client-go v2.15.0+incompatible h1:NP3qsSqNxh8VYr956ur1N/1C1PjvOJnJykCzcD5QHbk= +github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= +github.com/uber/jaeger-client-go v2.8.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= github.com/uber/jaeger-client-go v2.15.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= -github.com/uber/jaeger-lib v1.5.0 h1:OHbgr8l656Ub3Fw5k9SWnBfIEwvoHQ+W2y+Aa9D1Uyo= +github.com/uber/jaeger-lib v1.1.0/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= github.com/uber/jaeger-lib v1.5.0/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= -github.com/ugorji/go v1.1.1 h1:gmervu+jDMvXTbcHQ0pd2wee85nEoE0BsVyEuzkfK8w= +github.com/ugorji/go v0.0.0-20171019201919-bdcc60b419d1 h1:UvhxfNjNqlZ/x3cDyqxMhoiUpemd3zXkVQApN6bM/lg= +github.com/ugorji/go v0.0.0-20171019201919-bdcc60b419d1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= github.com/ugorji/go v1.1.1/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ= +github.com/ugorji/go/codec v0.0.0-20181127175209-856da096dbdf h1:BLcwkDfQ8QPXNXBApZUATvuigovcYPXkHzez80QFGNg= +github.com/ugorji/go/codec v0.0.0-20181127175209-856da096dbdf/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/unrolled/render v0.0.0-20171102162132-65450fb6b2d3/go.mod h1:tu82oB5W2ykJRVioYsB+IQKcft7ryBr7w12qMBUPyXg= github.com/unrolled/render v0.0.0-20180914162206-b9786414de4d/go.mod h1:tu82oB5W2ykJRVioYsB+IQKcft7ryBr7w12qMBUPyXg= -github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18 h1:MPPkRncZLN9Kh4MEFmbnK4h3BD7AUmskWv2+EeZJCCs= github.com/xiang90/probing v0.0.0-20160813154853-07dd2e8dfe18/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -go.uber.org/atomic v1.3.2 h1:2Oa65PReHzfn29GpvgsYwloV9AVFHPDk8tYxt2c2tr4= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.8.0 h1:r6Za1Rii8+EGOYRDLvpooNOF6kP3iyDnkpzbw67gCQ8= -go.uber.org/zap v1.8.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180503215945-1f94bef427e3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16 h1:y6ce7gCWtnH+m3dCjzQ1PCuwl28DDIc3VNnvY29DlIA= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181029044818-c44066c5c816 h1:mVFkLpejdFLXVUv9E42f3XJVfMdqd0IVLVIVLjZWn5o= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181029044818-c44066c5c816/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181030150119-7e31e0c00fa0 h1:biUuj9O+0+XckRUCDzjoOGm6yFV5c0IHbm1ODP3e4Zw= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181030150119-7e31e0c00fa0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/sys v0.0.0-20190109145017-48ac38b7c8cb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2 h1:+DCIGbF/swA92ohVg0//6X2IVY3KZs6p9mix0ziNYJM= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c h1:fqgJT0MGcGpPgpWU7VRdRjuArfcOvC4AoJmILihzhDg= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181105230042-78dc5bac0cac/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190130214255-bb1329dc71a0/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180427144745-86e600f69ee4/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 h1:67iHsV9djwGdZpdZNbLuQj6FOzCaZe3w+vhLjn5AcFA= +google.golang.org/genproto v0.0.0-20181004005441-af9cb2a35e7f/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/grpc v1.16.0 h1:dz5IJGuC2BB7qXR5AyHNwAUBhZscK2xVez7mznh72sY= +google.golang.org/genproto v0.0.0-20190108161440-ae2f86662275/go.mod h1:7Ep/1NZk928CDR8SjdVbjWNpdIf6nzjE3BTgJDr2Atg= +google.golang.org/grpc v0.0.0-20180607172857-7a6a684ca69e/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= +google.golang.org/grpc v1.12.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio= +google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= 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/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= -gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= +gopkg.in/natefinch/lumberjack.v2 v2.0.0-20161104145732-dd45e6a67c53/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= -gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= +gopkg.in/stretchr/testify.v1 v1.2.2/go.mod h1:QI5V/q6UbPmuhtm10CaFZxED9NreB8PnFYN9JcR6TxU= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +sourcegraph.com/sourcegraph/appdash v0.0.0-20180531100431-4c381bd170b4/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= +sourcegraph.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67/go.mod h1:L5q+DGLGOQFpo1snNEkLOJT2d1YTW66rWNzatr3He1k= diff --git a/importer/main.go b/importer/main.go index d29a654b3..52c52858f 100644 --- a/importer/main.go +++ b/importer/main.go @@ -18,8 +18,9 @@ import ( "os" "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/pingcap/tidb-tools/pkg/importer" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) func main() { @@ -30,7 +31,7 @@ func main() { case flag.ErrHelp: os.Exit(0) default: - log.Errorf("parse cmd flags err %s\n", err) + log.Error("parse cmd flags failed", zap.Error(err)) os.Exit(2) } diff --git a/pkg/dbutil/common.go b/pkg/dbutil/common.go index d6a513c25..3459b673a 100644 --- a/pkg/dbutil/common.go +++ b/pkg/dbutil/common.go @@ -22,10 +22,11 @@ import ( "strings" "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/pingcap/parser/model" "github.com/pingcap/tidb-tools/pkg/utils" "github.com/pingcap/tidb/types" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) const ( @@ -156,7 +157,7 @@ func GetRowCount(ctx context.Context, db *sql.DB, schemaName string, tableName s if len(where) > 0 { query += fmt.Sprintf(" WHERE %s", where) } - log.Debugf("get row count by sql %s", query) + log.Debug("get row count", zap.String("sql", query)) var cnt sql.NullInt64 err := db.QueryRowContext(ctx, query).Scan(&cnt) @@ -199,7 +200,7 @@ func GetRandomValues(ctx context.Context, db *sql.DB, schemaName, table, column query := fmt.Sprintf("SELECT %[1]s, COUNT(*) count FROM (SELECT %[1]s FROM %[2]s WHERE %[3]s ORDER BY RAND() LIMIT %[4]d)rand_tmp GROUP BY %[1]s ORDER BY %[1]s%[5]s", escapeName(column), TableName(schemaName, table), limitRange, num, collation) - log.Debugf("get random values sql: %s, args: %v", query, limitArgs) + log.Debug("get random values", zap.String("sql", query), zap.Reflect("args", limitArgs)) rows, err := db.QueryContext(ctx, query, limitArgs...) if err != nil { @@ -243,7 +244,7 @@ func GetMinMaxValue(ctx context.Context, db *sql.DB, schema, table, column strin query := fmt.Sprintf("SELECT /*!40001 SQL_NO_CACHE */ MIN(`%s`%s) as MIN, MAX(`%s`%s) as MAX FROM `%s`.`%s` WHERE %s", column, collation, column, collation, schema, table, limitRange) - log.Debugf("GetMinMaxValue query: %v, args: %v", query, limitArgs) + log.Debug("GetMinMaxValue", zap.String("sql", query), zap.Reflect("args", limitArgs)) var min, max sql.NullString rows, err := db.QueryContext(ctx, query, limitArgs...) @@ -363,7 +364,7 @@ func GetCRC32Checksum(ctx context.Context, db *sql.DB, schemaName, tableName str query := fmt.Sprintf("SELECT BIT_XOR(CAST(CRC32(CONCAT_WS(',', %s, CONCAT(%s)))AS UNSIGNED)) AS checksum FROM %s WHERE %s;", strings.Join(columnNames, ", "), strings.Join(columnIsNull, ", "), TableName(schemaName, tableName), limitRange) - log.Debugf("checksum sql: %s, args: %v", query, args) + log.Debug("checksum", zap.String("sql", query), zap.Reflect("args", args)) var checksum sql.NullInt64 err := db.QueryRowContext(ctx, query, args...).Scan(&checksum) @@ -372,7 +373,7 @@ func GetCRC32Checksum(ctx context.Context, db *sql.DB, schemaName, tableName str } if !checksum.Valid { // if don't have any data, the checksum will be `NULL` - log.Warnf("get empty checksum by query %s, args %v", query, args) + log.Warn("get empty checksum", zap.String("sql", query), zap.Reflect("args", args)) return 0, nil } @@ -400,7 +401,7 @@ func GetBucketsInfo(ctx context.Context, db *sql.DB, schema, table string, table */ buckets := make(map[string][]Bucket) query := "SHOW STATS_BUCKETS WHERE db_name= ? AND table_name= ?;" - log.Debugf("GetBucketsInfo query: %s", query) + log.Debug("GetBucketsInfo", zap.String("sql", query)) rows, err := db.QueryContext(ctx, query, schema, table) if err != nil { @@ -538,7 +539,7 @@ func GetTidbLatestTSO(ctx context.Context, db *sql.DB) (int64, error) { // SetSnapshot set the snapshot variable for tidb func SetSnapshot(ctx context.Context, db *sql.DB, snapshot string) error { sql := fmt.Sprintf("SET @@tidb_snapshot='%s'", snapshot) - log.Infof("set history snapshot: %s", sql) + log.Info("set history snapshot", zap.String("sql", sql)) _, err := db.ExecContext(ctx, sql) return errors.Trace(err) } @@ -589,7 +590,7 @@ func GetDBVersion(ctx context.Context, db *sql.DB) (string, error) { func IsTiDB(ctx context.Context, db *sql.DB) (bool, error) { version, err := GetDBVersion(ctx, db) if err != nil { - log.Errorf("get database's version meets error %v", err) + log.Error("get database's version failed", zap.Error(err)) return false, errors.Trace(err) } diff --git a/pkg/ddl-checker/executable_checker.go b/pkg/ddl-checker/executable_checker.go index 963d60ce8..71e73ca87 100644 --- a/pkg/ddl-checker/executable_checker.go +++ b/pkg/ddl-checker/executable_checker.go @@ -18,6 +18,7 @@ import ( "fmt" "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/pingcap/parser" "github.com/pingcap/parser/ast" "github.com/pingcap/tidb/session" @@ -35,8 +36,10 @@ type ExecutableChecker struct { // NewExecutableChecker creates a new ExecutableChecker func NewExecutableChecker() (*ExecutableChecker, error) { - logutil.InitLogger(&logutil.LogConfig{ - Level: "error", + logutil.InitZapLogger(&logutil.LogConfig{ + Config: log.Config{ + Level: "error", + }, }) mockTikv, err := mockstore.NewMockTikvStore() if err != nil { diff --git a/pkg/diff/chunk.go b/pkg/diff/chunk.go index 50475cca5..00049fd8a 100644 --- a/pkg/diff/chunk.go +++ b/pkg/diff/chunk.go @@ -20,10 +20,11 @@ import ( "strings" "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/pingcap/parser/model" "github.com/pingcap/tidb-tools/pkg/dbutil" "github.com/pingcap/tidb-tools/pkg/utils" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) var ( @@ -57,6 +58,28 @@ func newChunkRange() *chunkRange { } } +// String returns the string of chunkRange, used for log. +func (c *chunkRange) String() string { + var s strings.Builder + s.WriteString("{") + for _, bound := range c.bounds { + s.WriteString("[ column: ") + s.WriteString(bound.column) + s.WriteString(", lower: ") + s.WriteString(bound.lower) + s.WriteString(", lowerSymbol: ") + s.WriteString(bound.lowerSymbol) + s.WriteString(", upper: ") + s.WriteString(bound.upper) + s.WriteString(", upperSymbol: ") + s.WriteString(bound.upperSymbol) + s.WriteString(" ], ") + } + s.WriteString("}") + + return s.String() +} + func (c *chunkRange) toString(mode string, collation string) (string, []string) { if collation != "" { collation = fmt.Sprintf(" COLLATE '%s'", collation) @@ -239,7 +262,7 @@ func (s *randomSpliter) splitRange(db *sql.DB, chunk *chunkRange, count int, sch symbolMax = chunk.bounds[colNum-1].upperSymbol } else { if len(columns) <= colNum { - log.Warnf("chunk %v can't be splited", chunk) + log.Warn("chunk can't be splited", zap.Stringer("chunk", chunk)) return append(chunks, chunk), nil } @@ -250,7 +273,7 @@ func (s *randomSpliter) splitRange(db *sql.DB, chunk *chunkRange, count int, sch min, max, err = dbutil.GetMinMaxValue(context.Background(), db, schema, table, splitCol, limitRange, utils.StringsToInterfaces(args), s.collation) if err != nil { if errors.Cause(err) == dbutil.ErrNoData { - log.Infof("no data found in %s.%s range %s, args %v", schema, table, limitRange, args) + log.Info("no data found", zap.String("table", dbutil.TableName(schema, table)), zap.String("range", limitRange), zap.Reflect("args", args)) return append(chunks, chunk), nil } return nil, errors.Trace(err) @@ -268,7 +291,7 @@ func (s *randomSpliter) splitRange(db *sql.DB, chunk *chunkRange, count int, sch if err != nil { return nil, errors.Trace(err) } - log.Debugf("split chunk %v, get split values from GetRandomValues: %v", chunk, randomValues) + log.Debug("get split values by random values", zap.Stringer("chunk", chunk), zap.Reflect("random values", randomValues)) /* for examples: @@ -360,8 +383,7 @@ func (s *randomSpliter) splitRange(db *sql.DB, chunk *chunkRange, count int, sch lowerSymbol = gte } - log.Debugf("getChunksForTable cut table: cnt=%d min=%s max=%s chunk=%d", count, min, max, len(chunks)) - + log.Debug("getChunksForTable cut table", zap.Int("count", count), zap.String("min", min), zap.String("max", max), zap.Int("chunk num", len(chunks))) return chunks, nil } @@ -455,7 +477,7 @@ func getChunksForTable(table *TableInstance, columns []*model.ColumnInfo, chunkS return chunks, bucketMode, nil } - log.Warnf("use tidb bucket information to get chunks error: %v, chunks num: %d, will split chunk by random again", errors.Trace(err), len(chunks)) + log.Warn("use tidb bucket information to get chunks failed, will split chunk by random again", zap.Int("get chunk", len(chunks)), zap.Error(err)) } // get chunks from tidb bucket information failed, use random. @@ -536,7 +558,7 @@ func GenerateCheckJob(table *TableInstance, splitFields, limits string, chunkSiz conditions, args := chunk.toString(mode, collation) where := fmt.Sprintf("(%s AND %s)", conditions, limits) - log.Debugf("%s.%s create check job, where: %s, args: %v", table.Schema, table.Table, where, args) + log.Debug("create check job", zap.String("table", dbutil.TableName(table.Schema, table.Table)), zap.String("where", where), zap.Reflect("args", args)) jobBucket = append(jobBucket, &CheckJob{ Schema: table.Schema, Table: table.Table, diff --git a/pkg/diff/diff.go b/pkg/diff/diff.go index 25c5f91b1..d90be8cb2 100644 --- a/pkg/diff/diff.go +++ b/pkg/diff/diff.go @@ -23,10 +23,11 @@ import ( "sync" "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/pingcap/parser/model" "github.com/pingcap/tidb-tools/pkg/dbutil" "github.com/pingcap/tidb-tools/pkg/utils" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) // TableInstance record a table instance @@ -201,7 +202,7 @@ func (t *TableDiff) EqualTableData(ctx context.Context) (equal bool, err error) checkNums := len(allJobs) * t.Sample / 100 checkNumArr := getRandomN(len(allJobs), checkNums) - log.Infof("total has %d check jobs, check %d of them", len(allJobs), len(checkNumArr)) + log.Info("check jobs", zap.Int("total job num", len(allJobs)), zap.Int("check job num", len(checkNumArr))) if checkNums == 0 { return true, nil } @@ -217,7 +218,7 @@ func (t *TableDiff) EqualTableData(ctx context.Context) (equal bool, err error) go func(checkJobs []*CheckJob) { eq, err := t.checkChunkDataEqual(ctx, checkJobs) if err != nil { - log.Errorf("check chunk data equal failed, error %v", errors.ErrorStack(err)) + log.Error("check chunk data equal failed", zap.Error(err)) } checkResultCh <- eq }(checkJobs) @@ -277,15 +278,15 @@ func (t *TableDiff) checkChunkDataEqual(ctx context.Context, checkJobs []*CheckJ return false, errors.Trace(err) } if sourceChecksum == targetChecksum { - log.Infof("table: %s, range: %s, args: %v, checksum is equal, checksum: %d", dbutil.TableName(job.Schema, job.Table), job.Where, job.Args, sourceChecksum) + log.Info("checksum is equal", zap.String("table", dbutil.TableName(job.Schema, job.Table)), zap.String("where", job.Where), zap.Reflect("args", job.Args), zap.Int64("checksum", sourceChecksum)) continue } - log.Warnf("table: %s, range: %s, args: %v, checksum is not equal, one is %d, another is %d", dbutil.TableName(job.Schema, job.Table), job.Where, job.Args, sourceChecksum, targetChecksum) + log.Warn("checksum is not equal", zap.String("table", dbutil.TableName(job.Schema, job.Table)), zap.String("where", job.Where), zap.Reflect("args", job.Args), zap.Int64("source checksum", sourceChecksum), zap.Int64("target checksum", targetChecksum)) } // if checksum is not equal or don't need compare checksum, compare the data - log.Infof("select data from %s for range (where: %s, args: %v) and then check data", dbutil.TableName(job.Schema, job.Table), job.Where, job.Args) + log.Info("select data and then check data", zap.String("table", dbutil.TableName(job.Schema, job.Table)), zap.String("where", job.Where), zap.Reflect("args", job.Args)) sourceRows := make(map[string][]map[string]*dbutil.ColumnData) for i, sourceTable := range t.SourceTables { rows, _, err := getChunkRows(ctx, sourceTable.Conn, sourceTable.Schema, sourceTable.Table, sourceTable.info, job.Where, utils.StringsToInterfaces(job.Args), utils.SliceToMap(t.IgnoreColumns), t.Collation) @@ -364,7 +365,7 @@ func (t *TableDiff) compareRows(sourceRows map[string][]map[string]*dbutil.Colum // all the rowsData2's data should be deleted for ; index2 < len(rowsData2); index2++ { sql := generateDML("delete", rowsData2[index2], orderKeyCols, t.TargetTable.info, t.TargetTable.Schema) - log.Infof("[delete] sql: %v", sql) + log.Info("[delete]", zap.String("sql", sql)) t.wg.Add(1) t.sqlCh <- sql equal = false @@ -375,7 +376,7 @@ func (t *TableDiff) compareRows(sourceRows map[string][]map[string]*dbutil.Colum // rowsData2 lack some data, should insert them for ; index1 < len(rowsData1); index1++ { sql := generateDML("replace", rowsData1[index1], orderKeyCols, t.TargetTable.info, t.TargetTable.Schema) - log.Infof("[insert] sql: %v", sql) + log.Info("[insert]", zap.String("sql", sql)) t.wg.Add(1) t.sqlCh <- sql equal = false @@ -396,21 +397,21 @@ func (t *TableDiff) compareRows(sourceRows map[string][]map[string]*dbutil.Colum case 1: // delete sql := generateDML("delete", rowsData2[index2], orderKeyCols, t.TargetTable.info, t.TargetTable.Schema) - log.Infof("[delete] sql: %s", sql) + log.Info("[delete]", zap.String("sql", sql)) t.wg.Add(1) t.sqlCh <- sql index2++ case -1: // insert sql := generateDML("replace", rowsData1[index1], orderKeyCols, t.TargetTable.info, t.TargetTable.Schema) - log.Infof("[insert] sql: %s", sql) + log.Info("[insert]", zap.String("sql", sql)) t.wg.Add(1) t.sqlCh <- sql index1++ case 0: // update sql := generateDML("replace", rowsData1[index1], orderKeyCols, t.TargetTable.info, t.TargetTable.Schema) - log.Infof("[update] sql: %s", sql) + log.Info("[update]", zap.String("sql", sql)) t.wg.Add(1) t.sqlCh <- sql index1++ @@ -432,7 +433,7 @@ func (t *TableDiff) WriteSqls(ctx context.Context, writeFixSQL func(string) erro err := writeFixSQL(fmt.Sprintf("%s\n", dml)) if err != nil { - log.Errorf("write sql: %s failed, error: %v", dml, err) + log.Error("write sql failed", zap.String("sql", dml), zap.Error(err)) } t.wg.Done() case <-ctx.Done(): @@ -477,7 +478,7 @@ func generateDML(tp string, data map[string]*dbutil.ColumnData, keys []*model.Co } sql = fmt.Sprintf("DELETE FROM `%s`.`%s` WHERE %s;", schema, table.Name, strings.Join(kvs, " AND ")) default: - log.Errorf("unknown sql type %s", tp) + log.Error("unknown sql type", zap.String("type", tp)) } return @@ -501,9 +502,9 @@ func compareData(map1, map2 map[string]*dbutil.ColumnData, orderKeyCols []*model } equal = false if data1.IsNull == data2.IsNull { - log.Errorf("find difference data in column %s, data1: %s, data2: %s", key, data1.Data, data2.Data) + log.Error("find difference data", zap.String("column", key), zap.Reflect("data1", map1), zap.Reflect("data2", map2)) } else { - log.Errorf("find difference data in column %s, one of them is NULL, data1: %s, data2: %s", key, data1.Data, data2.Data) + log.Error("find difference data, one of them is NULL", zap.String("column", key), zap.Reflect("data1", map1), zap.Reflect("data2", map2)) } break } @@ -583,7 +584,7 @@ func getChunkRows(ctx context.Context, db *sql.DB, schema, table string, tableIn query := fmt.Sprintf("SELECT /*!40001 SQL_NO_CACHE */ %s FROM `%s`.`%s` WHERE %s ORDER BY %s%s", columns, schema, table, where, strings.Join(orderKeys, ","), collation) - log.Debugf("select data by sql %s, args: %v", query, args) + log.Debug("select data", zap.String("sql", query), zap.Reflect("args", args)) rows, err := db.QueryContext(ctx, query, args...) if err != nil { return nil, nil, errors.Trace(err) diff --git a/pkg/diff/merge.go b/pkg/diff/merge.go index 1e6b34557..ee38e0a0f 100644 --- a/pkg/diff/merge.go +++ b/pkg/diff/merge.go @@ -16,9 +16,10 @@ package diff import ( "strconv" + "github.com/pingcap/log" "github.com/pingcap/parser/model" "github.com/pingcap/tidb-tools/pkg/dbutil" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) // RowData is the struct of rows selected from mysql/tidb @@ -60,9 +61,12 @@ func (r RowDatas) Less(i, j int) bool { return true } num1, err1 := strconv.ParseFloat(string(data1), 64) + if err1 != nil { + log.Fatal("convert string to float failed", zap.ByteString("data", data1), zap.Error(err1)) + } num2, err2 := strconv.ParseFloat(string(data2), 64) - if err1 != nil || err2 != nil { - log.Fatalf("convert %s, %s to float failed, err1: %v, err2: %v", string(data1), string(data2), err1, err2) + if err2 != nil { + log.Fatal("convert string to float failed", zap.ByteString("data", data2), zap.Error(err2)) } if num1 == num2 { diff --git a/pkg/diff/util.go b/pkg/diff/util.go index 3e98762e4..daf7cd83b 100644 --- a/pkg/diff/util.go +++ b/pkg/diff/util.go @@ -16,11 +16,12 @@ package diff import ( "math/rand" + "github.com/pingcap/log" "github.com/pingcap/parser/model" "github.com/pingcap/tidb-tools/pkg/dbutil" "github.com/pingcap/tidb-tools/pkg/utils" "github.com/pingcap/tidb/types" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) func equalStrings(str1, str2 []string) bool { @@ -82,7 +83,7 @@ func getColumnsFromIndex(index *model.IndexInfo, tableInfo *model.TableInfo) []* func getRandomN(total, num int) []int { if num > total { - log.Warnf("the num %d is greater than total %d", num, total) + log.Warn("the num is greater than total", zap.Int("num", num), zap.Int("total", total)) num = total } diff --git a/pkg/importer/db.go b/pkg/importer/db.go index fed382f48..caa5ba1e3 100644 --- a/pkg/importer/db.go +++ b/pkg/importer/db.go @@ -21,9 +21,10 @@ import ( _ "github.com/go-sql-driver/mysql" // for mysql driver "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/pingcap/parser/mysql" "github.com/pingcap/tidb-tools/pkg/dbutil" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) func intRangeValue(column *column, min int64, max int64) (int64, int64) { @@ -31,13 +32,13 @@ func intRangeValue(column *column, min int64, max int64) (int64, int64) { if len(column.min) > 0 { min, err = strconv.ParseInt(column.min, 10, 64) if err != nil { - log.Fatal(err) + log.Fatal("intRangeValue", zap.Error(err)) } if len(column.max) > 0 { max, err = strconv.ParseInt(column.max, 10, 64) if err != nil { - log.Fatal(err) + log.Fatal("intRangeValue", zap.Error(err)) } } } @@ -257,7 +258,7 @@ func closeDBs(dbs []*sql.DB) { for _, db := range dbs { err := closeDB(db) if err != nil { - log.Errorf("close db failed - %v", err) + log.Error("close db failed", zap.Error(err)) } } } diff --git a/pkg/importer/importer.go b/pkg/importer/importer.go index 3ba96b542..4d0ed7305 100644 --- a/pkg/importer/importer.go +++ b/pkg/importer/importer.go @@ -14,7 +14,8 @@ package importer import ( - log "github.com/sirupsen/logrus" + "github.com/pingcap/log" + "go.uber.org/zap" ) // DoProcess generates data. @@ -22,28 +23,28 @@ func DoProcess(cfg *Config) { table := newTable() err := parseTableSQL(table, cfg.TableSQL) if err != nil { - log.Fatal(err) + log.Fatal("parseTableSQL", zap.Error(err)) } err = parseIndexSQL(table, cfg.IndexSQL) if err != nil { - log.Fatal(err) + log.Fatal("parseIndexSQL", zap.Error(err)) } dbs, err := createDBs(cfg.DBCfg, cfg.WorkerCount) if err != nil { - log.Fatal(err) + log.Fatal("createDBs", zap.Error(err)) } defer closeDBs(dbs) err = execSQL(dbs[0], cfg.TableSQL) if err != nil { - log.Fatal(err) + log.Fatal("execSQL", zap.Error(err)) } err = execSQL(dbs[0], cfg.IndexSQL) if err != nil { - log.Fatal(err) + log.Fatal("execSQL", zap.Error(err)) } doProcess(table, dbs, cfg.JobCount, cfg.WorkerCount, cfg.Batch) diff --git a/pkg/importer/job.go b/pkg/importer/job.go index 497419337..12f73376e 100644 --- a/pkg/importer/job.go +++ b/pkg/importer/job.go @@ -18,8 +18,8 @@ import ( "fmt" "time" - "github.com/pingcap/errors" - log "github.com/sirupsen/logrus" + "github.com/pingcap/log" + "go.uber.org/zap" ) func addJobs(jobCount int, jobChan chan struct{}) { @@ -33,24 +33,24 @@ func addJobs(jobCount int, jobChan chan struct{}) { func doInsert(table *table, db *sql.DB, count int) { sqls, err := genRowDatas(table, count) if err != nil { - log.Fatalf(errors.ErrorStack(err)) + log.Fatal("genRowDatas", zap.Error(err)) } txn, err := db.Begin() if err != nil { - log.Fatalf(errors.ErrorStack(err)) + log.Fatal("begin transcation", zap.Error(err)) } for _, sql := range sqls { _, err = txn.Exec(sql) if err != nil { - log.Fatalf(errors.ErrorStack(err)) + log.Fatal("exec", zap.String("sql", sql), zap.Error(err)) } } err = txn.Commit() if err != nil { - log.Fatalf(errors.ErrorStack(err)) + log.Fatal("commit transcation", zap.Error(err)) } } diff --git a/pkg/importer/parser.go b/pkg/importer/parser.go index e5c4d4261..3ed34b6cb 100644 --- a/pkg/importer/parser.go +++ b/pkg/importer/parser.go @@ -19,11 +19,12 @@ import ( "strings" "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/pingcap/parser" "github.com/pingcap/parser/ast" "github.com/pingcap/parser/types" _ "github.com/pingcap/tidb/types/parser_driver" // for parser driver - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) type column struct { @@ -68,7 +69,7 @@ func (col *column) parseRule(kvs []string) { var err error col.step, err = strconv.ParseInt(value, 10, 64) if err != nil { - log.Fatal(err) + log.Fatal("parseRule", zap.Error(err)) } } else if key == "set" { fields := strings.Split(value, ",") diff --git a/sync_diff_inspector/config.go b/sync_diff_inspector/config.go index 301e5561d..66a57d7b8 100644 --- a/sync_diff_inspector/config.go +++ b/sync_diff_inspector/config.go @@ -20,10 +20,11 @@ import ( "github.com/BurntSushi/toml" "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/pingcap/parser/model" "github.com/pingcap/tidb-tools/pkg/dbutil" router "github.com/pingcap/tidb-tools/pkg/table-router" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) const ( @@ -137,7 +138,7 @@ func (t *TableInstance) Valid() bool { } if _, ok := sourceInstanceMap[t.InstanceID]; !ok { - log.Errorf("unknown database instance id %s", t.InstanceID) + log.Error("unknown database instance id", zap.String("instance id", t.InstanceID)) return false } @@ -273,12 +274,12 @@ func (c *Config) configFromFile(path string) error { func (c *Config) checkConfig() bool { if c.Sample > percent100 || c.Sample < percent0 { - log.Errorf("sample must be greater than 0 and less than or equal to 100!") + log.Error("sample must be greater than 0 and less than or equal to 100!") return false } if c.CheckThreadCount <= 0 { - log.Errorf("check-thcount must greater than 0!") + log.Error("check-thcount must greater than 0!") return false } @@ -297,7 +298,7 @@ func (c *Config) checkConfig() bool { c.TargetDBCfg.InstanceID = "target" } if _, ok := sourceInstanceMap[c.TargetDBCfg.InstanceID]; ok { - log.Errorf("target has same instance id %s in source", c.TargetDBCfg.InstanceID) + log.Error("target has same instance id in source", zap.String("instance id", c.TargetDBCfg.InstanceID)) return false } diff --git a/sync_diff_inspector/diff.go b/sync_diff_inspector/diff.go index 037018387..fb531a4b6 100644 --- a/sync_diff_inspector/diff.go +++ b/sync_diff_inspector/diff.go @@ -20,11 +20,12 @@ import ( "regexp" "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/pingcap/tidb-tools/pkg/dbutil" "github.com/pingcap/tidb-tools/pkg/diff" router "github.com/pingcap/tidb-tools/pkg/table-router" "github.com/pingcap/tidb-tools/pkg/utils" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) // Diff contains two sql DB, used for comparing. @@ -198,13 +199,13 @@ func (df *Diff) AdjustTableConfig(cfg *Config) (err error) { } if _, ok := df.tables[schemaTables.Schema][tableName]; ok { - log.Errorf("duplicate config for %s.%s", schemaTables.Schema, tableName) + log.Error("duplicate config for one table", zap.String("table", dbutil.TableName(schemaTables.Schema, tableName))) continue } sourceTables := make([]TableInstance, 0, 1) if _, ok := sourceTablesMap[schemaTables.Schema][tableName]; ok { - log.Infof("find matched source tables %v for %s.%s", sourceTablesMap[schemaTables.Schema][tableName], schemaTables.Schema, tableName) + log.Info("find matched source tables", zap.Reflect("source tables", sourceTablesMap[schemaTables.Schema][tableName]), zap.String("target schema", schemaTables.Schema), zap.String("table", tableName)) sourceTables = sourceTablesMap[schemaTables.Schema][tableName] } else { // use same database name and table name @@ -414,7 +415,7 @@ func (df *Diff) Equal() (err error) { return err }) if err != nil { - log.Errorf("check %s.%s equal failed, error %v", table.Schema, table.Table, errors.ErrorStack(err)) + log.Error("check failed", zap.String("table", dbutil.TableName(table.Schema, table.Table)), zap.Error(err)) return err } diff --git a/sync_diff_inspector/main.go b/sync_diff_inspector/main.go index b9888281f..39c42fbac 100644 --- a/sync_diff_inspector/main.go +++ b/sync_diff_inspector/main.go @@ -16,13 +16,15 @@ package main import ( "context" "flag" + "fmt" "os" "time" _ "github.com/go-sql-driver/mysql" "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/pingcap/tidb-tools/pkg/utils" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) func main() { @@ -33,22 +35,21 @@ func main() { case flag.ErrHelp: os.Exit(0) default: - log.Errorf("parse cmd flags err %s\n", errors.ErrorStack(err)) + log.Error("parse cmd flags", zap.Error(err)) os.Exit(2) } if cfg.PrintVersion { - log.Infof("version: \n%s", utils.GetRawInfo("sync_diff_inspector")) + fmt.Printf("version: \n%s", utils.GetRawInfo("sync_diff_inspector")) return } - logLevel, err := log.ParseLevel(cfg.LogLevel) - if err != nil { - log.Warnf("invalide log level %s", cfg.LogLevel) - log.SetLevel(log.InfoLevel) - } else { - log.SetLevel(logLevel) + l := zap.NewAtomicLevel() + if err := l.UnmarshalText([]byte(cfg.LogLevel)); err != nil { + log.Error("invalide log level", zap.String("log level", cfg.LogLevel)) + return } + log.SetLevel(l.Level()) ok := cfg.checkConfig() if !ok { @@ -67,20 +68,20 @@ func main() { func checkSyncState(ctx context.Context, cfg *Config) bool { beginTime := time.Now() defer func() { - log.Infof("check data finished, all cost %v", time.Since(beginTime)) + log.Info("check data finished", zap.Duration("cost", time.Since(beginTime))) }() d, err := NewDiff(ctx, cfg) if err != nil { - log.Fatalf("fail to initialize diff process %v", errors.ErrorStack(err)) + log.Fatal("fail to initialize diff process", zap.Error(err)) } err = d.Equal() if err != nil { - log.Fatalf("check data difference error %v", errors.ErrorStack(err)) + log.Fatal("check data difference failed", zap.Error(err)) } - log.Info(d.report) + log.Info("check report", zap.Stringer("report", d.report)) return d.report.Result == Pass } diff --git a/tidb-binlog/binlogctl/main.go b/tidb-binlog/binlogctl/main.go index a8e59fc06..3c849017c 100644 --- a/tidb-binlog/binlogctl/main.go +++ b/tidb-binlog/binlogctl/main.go @@ -17,9 +17,9 @@ import ( "flag" "os" - "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/pingcap/tidb-tools/tidb-binlog/node" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) const ( @@ -35,7 +35,7 @@ func main() { case flag.ErrHelp: os.Exit(0) default: - log.Errorf("parse cmd flags err %v", err) + log.Error("parse cmd flags", zap.Error(err)) os.Exit(2) } @@ -61,6 +61,6 @@ func main() { } if err != nil { - log.Fatalf("fail to execute %s error %v", cfg.Command, errors.ErrorStack(err)) + log.Fatal("fail to execute command", zap.String("command", cfg.Command), zap.Error(err)) } } diff --git a/tidb-binlog/binlogctl/meta.go b/tidb-binlog/binlogctl/meta.go index 9bfff5493..fea557199 100644 --- a/tidb-binlog/binlogctl/meta.go +++ b/tidb-binlog/binlogctl/meta.go @@ -16,16 +16,18 @@ package main import ( "bytes" "context" + "fmt" "os" "path" "time" "github.com/BurntSushi/toml" "github.com/pingcap/errors" + "github.com/pingcap/log" pd "github.com/pingcap/pd/client" "github.com/pingcap/tidb-tools/pkg/utils" "github.com/siddontang/go/ioutil2" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) const physicalShiftBits = 18 @@ -40,7 +42,7 @@ func generateMetaInfo(cfg *Config) error { // get newest ts from pd commitTS, err := GetTSO(cfg) if err != nil { - log.Errorf("get tso failed: %s", err) + log.Error("get tso failed", zap.Error(err)) return errors.Trace(err) } @@ -70,7 +72,7 @@ func GetTSO(cfg *Config) (int64, error) { } dist := time.Since(now) if dist > slowDist { - log.Warnf("get timestamp too slow: %s", dist) + log.Warn("get timestamp too slow", zap.Duration("dist", dist)) } return int64(composeTS(physical, logical)), nil @@ -86,6 +88,11 @@ type Meta struct { CommitTS int64 `toml:"commitTS" json:"commitTS"` } +// String returns the string of Meta +func (m *Meta) String() string { + return fmt.Sprintf("commitTS: %d", m.CommitTS) +} + // saveMeta saves current tso in meta file. func saveMeta(metaFileName string, ts int64, timeZone string) error { meta := &Meta{CommitTS: ts} @@ -101,7 +108,7 @@ func saveMeta(metaFileName string, ts int64, timeZone string) error { t := utils.TSOToRoughTime(ts) location, err1 := time.LoadLocation(timeZone) if err1 != nil { - log.Warningf("fail to load location %s, error %v", timeZone, err1) + log.Warn("fail to load location", zap.String("time zone", timeZone), zap.Error(err1)) } else { buf.WriteString(t.UTC().String()) buf.WriteByte('\n') @@ -114,6 +121,6 @@ func saveMeta(metaFileName string, ts int64, timeZone string) error { return errors.Annotatef(err, "save meta %+v into %s", meta, metaFileName) } - log.Infof("meta: %+v", meta) + log.Info("save meta", zap.Stringer("meta", meta)) return nil } diff --git a/tidb-binlog/binlogctl/nodes.go b/tidb-binlog/binlogctl/nodes.go index 747488f37..bfb4fb00b 100644 --- a/tidb-binlog/binlogctl/nodes.go +++ b/tidb-binlog/binlogctl/nodes.go @@ -20,10 +20,11 @@ import ( "time" "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/pingcap/tidb-tools/pkg/etcd" "github.com/pingcap/tidb-tools/pkg/utils" "github.com/pingcap/tidb-tools/tidb-binlog/node" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) var ( @@ -43,7 +44,7 @@ func queryNodesByKind(urls string, kind string) error { } for _, n := range nodes { - log.Infof("%s: %s", kind, formatNodeInfo(n)) + log.Info("query node", zap.String("type", kind), zap.Stringer("node", n)) } return nil @@ -113,14 +114,14 @@ func applyAction(urls, kind, nodeID string, action string) error { client := &http.Client{} url := fmt.Sprintf("http://%s/state/%s/%s", n.Addr, n.NodeID, action) - log.Debugf("send put http request %s", url) + log.Debug("send put http request", zap.String("url", url)) req, err := http.NewRequest("PUT", url, nil) if err != nil { return errors.Trace(err) } _, err = client.Do(req) if err == nil { - log.Infof("apply action %s on node %s success", action, n.NodeID) + log.Info("apply action on node success", zap.String("action", action), zap.String("NodeID", n.NodeID)) return nil } @@ -129,8 +130,3 @@ func applyAction(urls, kind, nodeID string, action string) error { return errors.NotFoundf("nodeID %s", nodeID) } - -func formatNodeInfo(status *node.Status) string { - updateTime := utils.TSOToRoughTime(status.UpdateTS) - return fmt.Sprintf("{NodeID: %s, Addr: %s, State: %s, MaxCommitTS: %d, UpdateTime: %v}", status.NodeID, status.Addr, status.State, status.MaxCommitTS, updateTime) -} diff --git a/tidb-binlog/driver/example/mysql/mysql.go b/tidb-binlog/driver/example/mysql/mysql.go index b64c4973f..d7982e609 100644 --- a/tidb-binlog/driver/example/mysql/mysql.go +++ b/tidb-binlog/driver/example/mysql/mysql.go @@ -21,12 +21,13 @@ import ( "github.com/Shopify/sarama" _ "github.com/go-sql-driver/mysql" + "github.com/pingcap/log" "github.com/pingcap/parser" "github.com/pingcap/parser/ast" "github.com/pingcap/tidb-tools/tidb-binlog/driver/reader" pb "github.com/pingcap/tidb-tools/tidb-binlog/slave_binlog_proto/go-binlog" _ "github.com/pingcap/tidb/types/parser_driver" // for parser driver - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) // a simple example to sync data to mysql @@ -77,26 +78,26 @@ func main() { for { select { case msg := <-breader.Messages(): - log.Debug("recv: ", msg.Binlog.String()) + log.Debug("recv", zap.Stringer("message", msg.Binlog)) binlog := msg.Binlog sqls, args := toSQL(binlog) tx, err := db.Begin() if err != nil { - log.Fatal(err) + log.Fatal("begin transcation failed", zap.Error(err)) } for i := 0; i < len(sqls); i++ { - log.Debug("exec: args: ", sqls[i], args[i]) + log.Debug("exec sql", zap.String("sql", sqls[i]), zap.Reflect("args", args[i])) _, err = tx.Exec(sqls[i], args[i]...) if err != nil { tx.Rollback() - log.Fatal(err) + log.Fatal("exec sql failed", zap.Error(err)) } } err = tx.Commit() if err != nil { - log.Fatal(err) + log.Fatal("commit transcation failed", zap.Error(err)) } } } @@ -257,7 +258,7 @@ func toSQL(binlog *pb.Binlog) ([]string, [][]interface{}) { ddl := binlog.DdlData isCreateDatabase, err := isCreateDatabase(string(ddl.DdlQuery)) if err != nil { - log.Fatal(err) + log.Fatal("parse ddl failed", zap.Error(err)) } if !isCreateDatabase { sql := fmt.Sprintf("use %s", ddl.GetSchemaName()) @@ -276,7 +277,7 @@ func toSQL(binlog *pb.Binlog) ([]string, [][]interface{}) { } default: - log.Fatal("unknown type: ", binlog.GetType()) + log.Fatal("unknown type", zap.Stringer("type", binlog.GetType())) } return allSQL, allArgs diff --git a/tidb-binlog/driver/example/print/print.go b/tidb-binlog/driver/example/print/print.go index 0cd3004b7..3c30c457a 100644 --- a/tidb-binlog/driver/example/print/print.go +++ b/tidb-binlog/driver/example/print/print.go @@ -17,8 +17,9 @@ import ( "flag" "github.com/Shopify/sarama" + "github.com/pingcap/log" "github.com/pingcap/tidb-tools/tidb-binlog/driver/reader" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) var ( @@ -47,7 +48,7 @@ func main() { for { select { case msg := <-breader.Messages(): - log.Info("recv: ", msg.Binlog.String()) + log.Info("recv", zap.Stringer("message", msg.Binlog)) } } } diff --git a/tidb-binlog/driver/reader/offset.go b/tidb-binlog/driver/reader/offset.go index 0e3d4a19d..96e753d06 100644 --- a/tidb-binlog/driver/reader/offset.go +++ b/tidb-binlog/driver/reader/offset.go @@ -16,8 +16,9 @@ package reader import ( "github.com/Shopify/sarama" "github.com/pingcap/errors" + "github.com/pingcap/log" pb "github.com/pingcap/tidb-tools/tidb-binlog/slave_binlog_proto/go-binlog" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) // KafkaSeeker seeks offset in kafka topics by given condition @@ -57,7 +58,7 @@ func (ks *KafkaSeeker) Seek(topic string, ts int64, partitions []int32) (offsets if len(partitions) == 0 { partitions, err = ks.consumer.Partitions(topic) if err != nil { - log.Errorf("get partitions from topic %s error %v", topic, err) + log.Error("get partitions from topic failed", zap.String("topic", topic), zap.Error(err)) return nil, errors.Trace(err) } } @@ -65,7 +66,7 @@ func (ks *KafkaSeeker) Seek(topic string, ts int64, partitions []int32) (offsets offsets, err = ks.seekOffsets(topic, partitions, ts) if err != nil { err = errors.Trace(err) - log.Errorf("seek offsets error %v", err) + log.Error("seek offsets failed", zap.Error(err)) } return } @@ -116,7 +117,7 @@ func (ks *KafkaSeeker) seekOffset(topic string, partition int32, start int64, en } if ts < startTS { - log.Warnf("given ts %v is smaller than oldest message's ts %v, some binlogs may lose", ts, startTS) + log.Warn("given ts is smaller than oldest message's ts, some binlogs may lose", zap.Int64("given ts", ts), zap.Int64("oldest ts", startTS)) offset = start return } else if ts == startTS { diff --git a/tidb-binlog/driver/reader/reader.go b/tidb-binlog/driver/reader/reader.go index 3d7e5a389..726f06484 100644 --- a/tidb-binlog/driver/reader/reader.go +++ b/tidb-binlog/driver/reader/reader.go @@ -16,8 +16,9 @@ package reader import ( "github.com/Shopify/sarama" "github.com/pingcap/errors" + "github.com/pingcap/log" pb "github.com/pingcap/tidb-tools/tidb-binlog/slave_binlog_proto/go-binlog" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) func init() { @@ -96,7 +97,7 @@ func NewReader(cfg *Config) (r *Reader, err error) { r = nil return } - log.Debug("set offset to: ", r.cfg.Offset) + log.Debug("set offset to", zap.Int64("offset", r.cfg.Offset)) } go r.run() @@ -137,17 +138,17 @@ func (r *Reader) getOffsetByTS(ts int64) (offset int64, err error) { func (r *Reader) run() { offset := r.cfg.Offset - log.Debug("start at offset: ", offset) + log.Debug("start at", zap.Int64("offset", offset)) consumer, err := sarama.NewConsumerFromClient(r.client) if err != nil { - log.Fatal(err) + log.Fatal("create kafka consumer failed", zap.Error(err)) } defer consumer.Close() topic, partition := r.getTopic() partitionConsumer, err := consumer.ConsumePartition(topic, partition, offset) if err != nil { - log.Fatal(err) + log.Fatal("create kafka partition consumer failed", zap.Error(err)) } defer partitionConsumer.Close() @@ -159,15 +160,15 @@ func (r *Reader) run() { log.Info("reader stop to run") return case kmsg := <-partitionConsumer.Messages(): - log.Debug("get kmsg offset: ", kmsg.Offset) + log.Debug("get kafka message", zap.Int64("offset", kmsg.Offset)) binlog := new(pb.Binlog) err := binlog.Unmarshal(kmsg.Value) if err != nil { - log.Warn(err) + log.Warn("unmarshal binlog failed", zap.Error(err)) continue } if r.cfg.CommitTS > 0 && binlog.CommitTs <= r.cfg.CommitTS { - log.Warn("skip binlog CommitTs: ", binlog.CommitTs) + log.Warn("skip binlog CommitTs", zap.Int64("commitTS", binlog.CommitTs)) continue } diff --git a/tidb-binlog/node/node.go b/tidb-binlog/node/node.go index a4f2e797d..58045e10d 100644 --- a/tidb-binlog/node/node.go +++ b/tidb-binlog/node/node.go @@ -13,6 +13,12 @@ package node +import ( + "fmt" + + "github.com/pingcap/tidb-tools/pkg/utils" +) + var ( // DefaultRootPath is the root path of the keys stored in etcd, the `v1` is the tidb-binlog's version. DefaultRootPath = "/tidb-binlog/v1" @@ -81,3 +87,8 @@ type Status struct { // UpdateTS is the last update ts of node's status. UpdateTS int64 `json:"updateTS"` } + +func (s *Status) String() string { + updateTime := utils.TSOToRoughTime(s.UpdateTS) + return fmt.Sprintf("{NodeID: %s, Addr: %s, State: %s, MaxCommitTS: %d, UpdateTime: %v}", s.NodeID, s.Addr, s.State, s.MaxCommitTS, updateTime) +} diff --git a/tidb-binlog/node/registry.go b/tidb-binlog/node/registry.go index d0ae86b60..6b1b2c61e 100644 --- a/tidb-binlog/node/registry.go +++ b/tidb-binlog/node/registry.go @@ -22,8 +22,9 @@ import ( "github.com/coreos/etcd/clientv3" "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/pingcap/tidb-tools/pkg/etcd" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) // EtcdRegistry wraps the reactions with etcd @@ -93,7 +94,7 @@ func (r *EtcdRegistry) UpdateNode(pctx context.Context, prefix string, status *S return errors.Trace(err) } else if !exists { // not found then create a new node - log.Infof("node %s dosen't exist, will create one", status.NodeID) + log.Info("node dosen't exist, will create one", zap.String("NodeID", status.NodeID)) return r.createNode(ctx, prefix, status) } else { // found it, update status infomation of the node @@ -175,12 +176,12 @@ func AnalyzeNodeID(key string) string { nodeIDOffset = 2 } } else { - log.Errorf("can't get nodeID or node type from key %s", key) + log.Error("can't get nodeID or node type", zap.String("key", key)) return "" } if len(paths) < nodeIDOffset+1 { - log.Errorf("can't get nodeID or node type from key %s", key) + log.Error("can't get nodeID or node type", zap.String("key", key)) return "" } diff --git a/tidb-binlog/pump_client/client.go b/tidb-binlog/pump_client/client.go index 1dabf416b..6bff915ff 100644 --- a/tidb-binlog/pump_client/client.go +++ b/tidb-binlog/pump_client/client.go @@ -24,13 +24,14 @@ import ( "github.com/coreos/etcd/mvcc/mvccpb" "github.com/pingcap/errors" + "github.com/pingcap/log" pd "github.com/pingcap/pd/client" "github.com/pingcap/tidb-tools/pkg/etcd" "github.com/pingcap/tidb-tools/pkg/utils" "github.com/pingcap/tidb-tools/tidb-binlog/node" "github.com/pingcap/tidb/util/logutil" pb "github.com/pingcap/tipb/go-binlog" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" ) @@ -50,9 +51,6 @@ const ( ) var ( - // Logger is ..., obsolete now. - Logger = log.New() - // ErrNoAvaliablePump means no avaliable pump to write binlog. ErrNoAvaliablePump = errors.New("no avaliable pump to write binlog") @@ -232,7 +230,7 @@ func (c *PumpsClient) getPumpStatus(pctx context.Context) (revision int64, err e } for _, status := range nodesStatus { - log.Debugf("[pumps client] get pump %v from pd", status) + log.Debug("[pumps client] get pump from pd", zap.Stringer("pump", status)) c.addPump(NewPumpStatus(status, c.Security), false) } @@ -285,7 +283,7 @@ func (c *PumpsClient) WriteBinlog(binlog *pb.Binlog) error { } meetError = true - log.Warnf("[pumps client] write binlog to pump %s (type: %s, start ts: %d, commit ts: %d, length: %d) error %v", pump.NodeID, binlog.Tp, binlog.StartTs, binlog.CommitTs, len(commitData), err) + log.Warn("[pumps client] write binlog to pump failed", zap.String("NodeID", pump.NodeID), zap.Stringer("binlog type", binlog.Tp), zap.Int64("start ts", binlog.StartTs), zap.Int64("commit ts", binlog.CommitTs), zap.Int("length", len(commitData)), zap.Error(err)) if binlog.Tp != pb.BinlogType_Prewrite { // only use one pump to write commit/rollback binlog, util write success or blocked for ten minutes. And will not return error to tidb. @@ -356,7 +354,7 @@ func (c *PumpsClient) backoffWriteBinlog(req *pb.WriteBinlogReq, binlogType pb.B err = errors.New(resp.Errmsg) } else { // if this pump can write binlog success, set this pump to avaliable. - log.Debugf("[pumps client] write binlog to unavaliable pump %s success, set this pump to avaliable", pump.NodeID) + log.Debug("[pumps client] write binlog to unavaliable pump success, set this pump to avaliable", zap.String("NodeID", pump.NodeID)) c.setPumpAvaliable(pump, true) return pump, nil } @@ -474,7 +472,7 @@ func (c *PumpsClient) watchStatus(revision int64) { case wresp := <-rch: if wresp.Err() != nil { // meet error, watch from the latest revision. - log.Warnf("[pumps client] watch status meet error %v", wresp.Err()) + log.Warn("[pumps client] watch status meet error", zap.Error(wresp.Err())) rch = c.EtcdRegistry.WatchNode(c.ctx, c.nodePath, revision) continue } @@ -485,28 +483,28 @@ func (c *PumpsClient) watchStatus(revision int64) { status := &node.Status{} err := json.Unmarshal(ev.Kv.Value, &status) if err != nil { - log.Errorf("[pumps client] unmarshal pump status %q failed", ev.Kv.Value) + log.Error("[pumps client] unmarshal pump status failed", zap.ByteString("value", ev.Kv.Value), zap.Error(err)) continue } switch ev.Type { case mvccpb.PUT: if !c.exist(status.NodeID) { - log.Infof("[pumps client] find a new pump %s", status.NodeID) + log.Info("[pumps client] find a new pump", zap.String("NodeID", status.NodeID)) c.addPump(NewPumpStatus(status, c.Security), true) continue } pump, avaliableChanged, avaliable := c.updatePump(status) if avaliableChanged { - log.Infof("[pumps client] pump %s's state is changed to %s", pump.Status.NodeID, status.State) + log.Info("[pumps client] pump's state is changed", zap.String("NodeID", pump.Status.NodeID), zap.String("state", status.State)) c.setPumpAvaliable(pump, avaliable) } case mvccpb.DELETE: // now will not delete pump node in fact, just for compatibility. nodeID := node.AnalyzeNodeID(string(ev.Kv.Key)) - log.Infof("[pumps client] remove pump %s", nodeID) + log.Info("[pumps client] remove pump", zap.String("NodeID", nodeID)) c.removePump(nodeID) } } @@ -525,7 +523,7 @@ func (c *PumpsClient) detect() { for { select { case <-c.ctx.Done(): - log.Infof("[pumps client] heartbeat finished") + log.Info("[pumps client] heartbeat finished") return case <-checkTick.C: // send detect binlog to pump, if this pump can return response without error @@ -544,10 +542,10 @@ func (c *PumpsClient) detect() { for _, pump := range needCheckPumps { _, err := pump.WriteBinlog(req, c.BinlogWriteTimeout) if err == nil { - log.Debugf("[pumps client] write detect binlog to unavaliable pump %s success", pump.NodeID) + log.Debug("[pumps client] write detect binlog to unavaliable pump success", zap.String("NodeID", pump.NodeID)) checkPassPumps = append(checkPassPumps, pump) } else { - log.Debugf("[pumps client] write detect binlog to pump %s error %v", pump.NodeID, err) + log.Debug("[pumps client] write detect binlog to pump failed", zap.String("NodeID", pump.NodeID), zap.Error(err)) } } @@ -560,10 +558,10 @@ func (c *PumpsClient) detect() { // Close closes the PumpsClient. func (c *PumpsClient) Close() { - log.Infof("[pumps client] is closing") + log.Info("[pumps client] is closing") c.cancel() c.wg.Wait() - log.Infof("[pumps client] is closed") + log.Info("[pumps client] is closed") } func isRetryableError(err error) bool { @@ -601,5 +599,5 @@ func copyPumps(pumps map[string]*PumpStatus) []*PumpStatus { // InitLogger initializes logger. func InitLogger(cfg *logutil.LogConfig) error { - return logutil.InitLogger(cfg) + return logutil.InitZapLogger(cfg) } diff --git a/tidb-binlog/pump_client/pump.go b/tidb-binlog/pump_client/pump.go index 9053d23ab..f37cd77e0 100644 --- a/tidb-binlog/pump_client/pump.go +++ b/tidb-binlog/pump_client/pump.go @@ -22,9 +22,10 @@ import ( "time" "github.com/pingcap/errors" + "github.com/pingcap/log" "github.com/pingcap/tidb-tools/tidb-binlog/node" pb "github.com/pingcap/tipb/go-binlog" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" "google.golang.org/grpc" "google.golang.org/grpc/credentials" ) @@ -95,7 +96,7 @@ func (p *PumpStatus) createGrpcClient() error { return net.DialTimeout("tcp", addr, timeout) }) } - log.Debugf("[pumps client] create grpc client at %s", p.Addr) + log.Debug("[pumps client] create grpc client", zap.String("address", p.Addr)) var clientConn *grpc.ClientConn var err error if p.security != nil { diff --git a/tidb-binlog/pump_client/selector.go b/tidb-binlog/pump_client/selector.go index 4c4f0fa5f..c70e394dd 100644 --- a/tidb-binlog/pump_client/selector.go +++ b/tidb-binlog/pump_client/selector.go @@ -18,8 +18,9 @@ import ( "strconv" "sync" + "github.com/pingcap/log" pb "github.com/pingcap/tipb/go-binlog" - log "github.com/sirupsen/logrus" + "go.uber.org/zap" ) const ( @@ -96,7 +97,7 @@ func (h *HashSelector) Select(binlog *pb.Binlog, retryTime int) *PumpStatus { } // this should never happened - log.Warnf("[pumps client] %s binlog with start ts %d don't have matched prewrite binlog", binlog.Tp, binlog.StartTs) + log.Warn("[pumps client] binlog don't have matched prewrite binlog", zap.Stringer("binlog type", binlog.Tp), zap.Int64("startTs", binlog.StartTs)) return nil } @@ -172,7 +173,7 @@ func (r *RangeSelector) Select(binlog *pb.Binlog, retryTime int) *PumpStatus { } // this should never happened - log.Warnf("[pumps client] %s binlog with start ts %d don't have matched prewrite binlog", binlog.Tp, binlog.StartTs) + log.Warn("[pumps client] binlog don't have matched prewrite binlog", zap.Stringer("binlog type", binlog.Tp), zap.Int64("startTs", binlog.StartTs)) return nil } @@ -262,10 +263,10 @@ func (s *ScoreSelector) Feedback(startTS int64, binlogType pb.BinlogType, pump * // TODO } -// NewSelector returns a PumpSelector according to the algorithm. -func NewSelector(algorithm string) PumpSelector { +// NewSelector returns a PumpSelector according to the strategy. +func NewSelector(strategy string) PumpSelector { var selector PumpSelector - switch algorithm { + switch strategy { case Range: selector = NewRangeSelector() case Hash: @@ -275,7 +276,7 @@ func NewSelector(algorithm string) PumpSelector { case LocalUnix: selector = NewLocalUnixSelector() default: - log.Warnf("[pumps client] unknown algorithm %s, use range as default", algorithm) + log.Warn("[pumps client] unknown strategy, use range as default", zap.String("strategy", strategy)) selector = NewRangeSelector() }