From d43a1be76bb1a9180e60d24c26af7092a18b4212 Mon Sep 17 00:00:00 2001 From: kennytm Date: Mon, 11 May 2020 21:54:19 +0800 Subject: [PATCH 1/2] go.mod: update dependencies (#272) * go.mod: update dependencies * *: fix import cycle in tests * *: fix lints --- Makefile | 20 +++- go.mod | 39 ++++---- go.sum | 171 ++++++++++++++++++++++++++++------ pkg/backup/client.go | 9 +- pkg/backup/client_test.go | 28 +++--- pkg/backup/metrics.go | 2 +- pkg/backup/safe_point_test.go | 11 ++- pkg/backup/schema.go | 5 +- pkg/backup/schema_test.go | 17 ++-- pkg/checksum/executor.go | 19 +++- pkg/checksum/executor_test.go | 29 +++--- pkg/mock/mock_cluster_test.go | 14 ++- pkg/restore/backoff.go | 48 ++++++---- pkg/restore/backoff_test.go | 36 +++---- pkg/restore/client.go | 3 +- pkg/restore/client_test.go | 13 +-- pkg/restore/db.go | 4 +- pkg/restore/db_test.go | 7 +- pkg/restore/import.go | 34 +++---- pkg/restore/range.go | 14 ++- pkg/restore/range_test.go | 11 ++- pkg/restore/split.go | 16 ++-- pkg/restore/split_client.go | 1 - pkg/restore/split_test.go | 72 +++++++------- pkg/restore/util.go | 11 +-- pkg/restore/util_test.go | 50 +++++----- pkg/rtree/rtree_test.go | 42 +++++---- pkg/storage/gcs.go | 1 - pkg/storage/gcs_test.go | 4 +- pkg/storage/local.go | 5 +- pkg/storage/parse_test.go | 1 - pkg/storage/s3.go | 8 +- pkg/storage/s3_test.go | 2 +- pkg/storage/storage.go | 2 +- pkg/summary/collector.go | 2 +- pkg/utils/key_test.go | 1 - pkg/utils/progress.go | 2 +- pkg/utils/retry.go | 4 +- pkg/utils/unit.go | 6 +- pkg/utils/worker.go | 4 +- tools/go.mod | 3 +- tools/go.sum | 44 +++++---- 42 files changed, 504 insertions(+), 311 deletions(-) diff --git a/Makefile b/Makefile index 53d5db636..d2b79a611 100644 --- a/Makefile +++ b/Makefile @@ -68,19 +68,31 @@ static: tools tools/bin/goimports -w -d -format-only -local $(BR_PKG) $$($(PACKAGE_DIRECTORIES)) 2>&1 | $(GOCHECKER) tools/bin/govet --shadow $$($(PACKAGE_DIRECTORIES)) 2>&1 | $(GOCHECKER) + @# why some lints are disabled? + @# gochecknoglobals - disabled because we do use quite a lot of globals + @# goimports - executed above already + @# gofmt - ditto + @# wsl - too pedantic about the formatting + @# funlen - PENDING REFACTORING + @# gocognit - PENDING REFACTORING + @# godox - TODO + @# gomnd - too many magic numbers, and too pedantic (even 2*x got flagged...) + @# testpackage - several test packages still rely on private functions + @# nestif - PENDING REFACTORING + @# goerr113 - it mistaken pingcap/errors with standard errors CGO_ENABLED=0 tools/bin/golangci-lint run --enable-all --deadline 120s \ --disable gochecknoglobals \ - --disable gochecknoinits \ - --disable interfacer \ --disable goimports \ --disable gofmt \ --disable wsl \ --disable funlen \ - --disable whitespace \ --disable gocognit \ --disable godox \ --disable gomnd \ - $$($(PACKAGE_DIRECTORIES)) || true + --disable testpackage \ + --disable nestif \ + --disable goerr113 \ + $$($(PACKAGE_DIRECTORIES)) lint: tools @echo "linting" diff --git a/go.mod b/go.mod index 8d5a03b8e..cfe9b90d6 100644 --- a/go.mod +++ b/go.mod @@ -3,13 +3,13 @@ module github.com/pingcap/br go 1.13 require ( - cloud.google.com/go/storage v1.4.0 - github.com/aws/aws-sdk-go v1.26.1 - github.com/cheggaaa/pb/v3 v3.0.1 + cloud.google.com/go/storage v1.5.0 + github.com/aws/aws-sdk-go v1.30.24 + github.com/cheggaaa/pb/v3 v3.0.4 github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect - github.com/fsouza/fake-gcs-server v1.15.0 - github.com/go-sql-driver/mysql v1.4.1 + github.com/fsouza/fake-gcs-server v1.17.0 + github.com/go-sql-driver/mysql v1.5.0 github.com/gogo/protobuf v1.3.1 github.com/google/btree v1.0.0 github.com/google/uuid v1.1.1 @@ -17,26 +17,27 @@ require ( github.com/montanaflynn/stats v0.5.0 // indirect github.com/onsi/ginkgo v1.11.0 // indirect github.com/onsi/gomega v1.8.1 // indirect + github.com/opentracing/opentracing-go v1.1.0 // indirect github.com/pingcap/check v0.0.0-20200212061837-5e12011dc712 github.com/pingcap/errors v0.11.5-0.20190809092503-95897b64e011 - github.com/pingcap/kvproto v0.0.0-20200424032552-6650270c39c3 + github.com/pingcap/kvproto v0.0.0-20200509065137-6a4d5c264a8b github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd - github.com/pingcap/parser v0.0.0-20200425031156-fb338edcaac2 - github.com/pingcap/pd/v4 v4.0.0-rc.1.0.20200422143320-428acd53eba2 - github.com/pingcap/tidb v1.1.0-beta.0.20200424160056-7267747ae0ec + github.com/pingcap/parser v0.0.0-20200507065322-e562e27ebd85 + github.com/pingcap/pd/v4 v4.0.0-rc.1.0.20200511074607-3bb650739add + github.com/pingcap/tidb v1.1.0-beta.0.20200424154252-5ede18f10eed github.com/pingcap/tidb-tools v4.0.0-rc.1.0.20200421113014-507d2bb3a15e+incompatible github.com/pingcap/tipb v0.0.0-20200417094153-7316d94df1ee - github.com/prometheus/client_golang v1.0.0 - github.com/prometheus/common v0.4.1 - github.com/sirupsen/logrus v1.4.2 - github.com/spf13/cobra v0.0.5 + github.com/prometheus/client_golang v1.5.1 + github.com/prometheus/common v0.9.1 + github.com/sirupsen/logrus v1.6.0 + github.com/spf13/cobra v1.0.0 github.com/spf13/pflag v1.0.5 github.com/syndtr/goleveldb v1.0.1-0.20190625010220-02440ea7a285 // indirect - github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect + github.com/uber/jaeger-client-go v2.22.1+incompatible // indirect + github.com/uber/jaeger-lib v2.2.0+incompatible // indirect go.etcd.io/etcd v0.5.0-alpha.5.0.20191023171146-3cf2f69b5738 - go.opencensus.io v0.22.2 // indirect - go.uber.org/zap v1.14.1 - golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 - google.golang.org/api v0.14.0 - google.golang.org/grpc v1.25.1 + go.uber.org/zap v1.15.0 + golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6 + google.golang.org/api v0.15.1 + google.golang.org/grpc v1.26.0 ) diff --git a/go.sum b/go.sum index 1e74fb0f2..8b44a559e 100644 --- a/go.sum +++ b/go.sum @@ -8,14 +8,21 @@ cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxK cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3 h1:AVXDdKsrtX33oR9fbCMu/+c1o8Ofjq6Ku/MInaLVg5Y= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0 h1:0E3eE8MX426vUOs7aHfI7aN1BrIzzzf4ccKCSfSjGmc= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= cloud.google.com/go/bigquery v1.0.1 h1:hL+ycaJpVE9M7nLoiXb/Pn10ENE2u+oddxbD8uu0ZVU= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0 h1:sAbMqjY1PEQKZBWfbu6Y6bsupJ9c4QdHnzg/VvYTLcE= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/datastore v1.0.0 h1:Kt+gOPPp2LEPWp8CSfxhsM8ik9CcyE/gYu+0r+RnZvM= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/pubsub v1.0.1 h1:W9tAK3E57P75u0XLLR82LZyw8VpAnhmyTOxW9qzmyj8= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= -cloud.google.com/go/storage v1.4.0 h1:KDdqY5VTXBTqpSbctVTt0mVvfanP6JZzNzLE0qNY100= -cloud.google.com/go/storage v1.4.0/go.mod h1:ZusYJWlOshgSBGbt6K3GnB3MT3H1xs2id9+TCl4fDBA= +cloud.google.com/go/pubsub v1.1.0 h1:9/vpR43S4aJaROxqQHQ3nH9lfyKKV0dC3vOmnw8ebQQ= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0 h1:RPUcBvDeYgQFMfQu1eBMq6piD1SXmLH+vK3qjewZPus= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= @@ -36,33 +43,41 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 h1:Hs82Z41s6SdL1CELW+XaDYmOH4hkBN4/N9og/AsOv7E= +github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q= github.com/appleboy/gin-jwt/v2 v2.6.3/go.mod h1:MfPYA4ogzvOcVkRwAxT7quHOtQmVKDpTwxyUrC2DNw0= github.com/appleboy/gofight/v2 v2.1.2/go.mod h1:frW+U1QZEdDgixycTj4CygQ48yLTUhplt43+Wczp3rw= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/aws/aws-sdk-go v1.26.1 h1:JGQggXhOiNJIqsmbYUl3cYtJZUffeOWlHtxfzGK7WPI= -github.com/aws/aws-sdk-go v1.26.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.30.24 h1:y3JPD51VuEmVqN3BEDVm4amGpDma2cKJcDPuAU1OR58= +github.com/aws/aws-sdk-go v1.30.24/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/blacktear23/go-proxyprotocol v0.0.0-20180807104634-af7a81e8dd0d h1:rQlvB2AYWme2bIB18r/SipGiMEVJYE9U0z+MGoU/LtQ= github.com/blacktear23/go-proxyprotocol v0.0.0-20180807104634-af7a81e8dd0d/go.mod h1:VKt7CNAQxpFpSDz3sXyj9hY/GbVsQCr0sB3w59nE7lU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/cheggaaa/pb/v3 v3.0.1 h1:m0BngUk2LuSRYdx4fujDKNRXNDpbNCfptPfVT2m6OJY= -github.com/cheggaaa/pb/v3 v3.0.1/go.mod h1:SqqeMF/pMOIu3xgGoxtPYhMNQP258xE4x/XRTYua+KU= +github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= +github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cheggaaa/pb/v3 v3.0.4 h1:QZEPYOj2ix6d5oEg63fbHmpolrnNiwjUsk+h74Yt4bM= +github.com/cheggaaa/pb/v3 v3.0.4/go.mod h1:7rgWxLrAUcFMkvJuv09+DYi7mMUYi8nO9iOWcvGJPfw= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20171208011716-f6d7a1f6fbf3/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa h1:OaNxuTZr7kxeODyLWsRMC+OD03aFUH+mW6r2d+MWa5Y= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd h1:qMd81Ts1T2OTKmB4acZcyKaMtRnY5Y44NuXGX2GFJ1w= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= 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-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= @@ -70,13 +85,15 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142 h1:3jFq2xL4ZajGK4aZY8jz+DAF0FHjI51BXjjSwCzS1Dk= github.com/coreos/go-systemd v0.0.0-20181031085051-9002847aa142/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f h1:JOrtw2xFKzlg+cbHpyrpLDmnN1HqhBfnX7WDiW7eG2c= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/corona10/goimagehash v1.0.2/go.mod h1:/l9umBhvcHQXVtQO1V6Gp1yD20STawkhRnnX0D1bvVI= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/cznic/golex v0.0.0-20181122101858-9c343928389c/go.mod h1:+bmmJDNmKlhWNG+gwWCkaBoTy39Fs+bzRxVBzoTQbIc= github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 h1:iwZdTE0PVqJCos1vaoKsclOGD3ADKpshg3SRtYBbwso= @@ -97,6 +114,7 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumC github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -108,6 +126,7 @@ github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZi github.com/elazarl/go-bindata-assetfs v1.0.0 h1:G/bYguwHIzWq9ZoyUQqrjTmJbbYn3j3CKKpKinvZLFk= github.com/elazarl/go-bindata-assetfs v1.0.0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= @@ -115,11 +134,13 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= +github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsouza/fake-gcs-server v1.15.0 h1:ss/ztlt10Y64A5qslmxZKsiqW/i28t5DkRtv6qSFaLQ= -github.com/fsouza/fake-gcs-server v1.15.0/go.mod h1:HNxAJ/+FY/XSsxuwz8iIYdp2GtMmPbJ8WQjjGMxd6Qk= +github.com/fsouza/fake-gcs-server v1.17.0 h1:OeH75kBZcZa3ZE+zz/mFdJ2btt9FgqfjI7gIh9+5fvk= +github.com/fsouza/fake-gcs-server v1.17.0/go.mod h1:D1rTE4YCyHFNa99oyJJ5HyclvN/0uQR+pM/VdlL83bw= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ERFA1PUxfmGpolnw2v0bKOREu5ew= github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32/go.mod h1:GIjDIg/heH5DOkXY3YJ/wNhfHsQHoXGjl8G8amsYQ1I= github.com/gin-contrib/gzip v0.0.1/go.mod h1:fGBJBCdt6qCZuCAOwWuFhBB4OOq9EFqlo5dEaFhhu5w= github.com/gin-contrib/sse v0.0.0-20170109093832-22d885f9ecc7/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s= @@ -131,8 +152,11 @@ github.com/gin-gonic/gin v1.5.0/go.mod h1:Nd6IXA8m5kNZdNEHMBd93KT+mdY3+bewLgRvmC github.com/go-bindata/go-bindata/v3 v3.1.3/go.mod h1:1/zrpXsLD8YDIbhZRqXzm1Ghc7NhEvIN9+Z6R5/xH4I= github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +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-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= @@ -157,19 +181,26 @@ github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEK github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-sql-driver/mysql v1.4.1 h1:g24URVg0OFbNUTx9qqY1IRZ9D9z3iPyi5zKhQZpNwpA= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= +github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/goccy/go-graphviz v0.0.5/go.mod h1:wXVsXxmyMQU6TN3zGRttjNn3h+iCAS7xQFC6TlNvLhk= 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.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20181024230925-c65c006176ff/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7 h1:5ZkaAPbicIKTF2I64qf5Fh8Aa83Q/dnOafMYV0OMwjA= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s= @@ -193,6 +224,8 @@ github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= @@ -200,6 +233,8 @@ github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OI github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190930153522-6ce02741cba3 h1:3CYI9xg87xNAD+es02gZxbX/ky4KQeoFBsNOzuoAQZg= github.com/google/pprof v0.0.0-20190930153522-6ce02741cba3/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20200407044318-7d83b28da2e9 h1:K+lX49/3eURCE1IjlaZN//u6c+9nfDAMnyQ9E2dsJbY= +github.com/google/pprof v0.0.0-20200407044318-7d83b28da2e9/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/shlex v0.0.0-20181106134648-c34317bd91bf/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -208,16 +243,20 @@ github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg= +github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ= github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4 h1:z53tR0945TRRQO/fLEVPI6SMv7ZflF0TEaTAoU7tOzg= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5 h1:UImYN5qQ8tuGpGE16ZmjvcTtTw24zw1QAp/SlnNrZhI= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.12.1 h1:zCy2xE9ablevUOrUZc3Dl72Dt+ya2FNAvC2yLYMHzi4= @@ -232,13 +271,16 @@ github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/hypnoglow/gormzap v0.3.0/go.mod h1:5Wom8B7Jl2oK0Im9hs6KQ+Kl92w4Y7gKCrj66rhyvw0= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jinzhu/gorm v1.9.12/go.mod h1:vhTjlKSJUTWNtcbQtrMBFCxy7eXTzeCAzfL5fBZT/Qs= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af h1:pmfjZENx5imkbgOkpRUYLnmbU7UEFbjtDA2hxJ1ichM= -github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.3.0 h1:OS12ieG61fsCg5+qLJ+SsW9NicxNkg3b25OyT2yCeUc= +github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0 h1:VKV+ZcuP6l3yW9doeqz6ziZGgcynBVQO+obU0+0hcPo= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= @@ -251,6 +293,8 @@ github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGn github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024 h1:rBMNdlhTLzJjJSDIjNEXX1Pz3Hmwmz91v+zycvx9PJc= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/juju/ratelimit v1.0.1 h1:+7AIFJVQ0EQgq/K9+0Krm7m530Du7tIz0METWzN0RgY= github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= @@ -267,6 +311,8 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.1 h1:mweAR1A6xJ3oS2pRaGi github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s= github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8= +github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -292,11 +338,10 @@ github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.4 h1:2BvfKmzob6Bmd4YsL0zygOqfdFnK7GR4QL06Do4/p7Y= -github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= @@ -321,11 +366,13 @@ github.com/montanaflynn/stats v0.0.0-20180911141734-db72e6cae808/go.mod h1:wL8QJ github.com/montanaflynn/stats v0.5.0 h1:2EkzeTSqBB4V4bJwWrt5gIIrZmpJBcoIRGS2kWLgzmk= github.com/montanaflynn/stats v0.5.0/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= +github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= 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/nicksnyder/go-i18n v1.10.0/go.mod h1:HrK7VCrbOvQoUAQ7Vpy7i87N7JZZZ7R2xBGjv0j365Q= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= github.com/onsi/ginkgo v1.6.0 h1:Ix8l273rp3QzYgXSR+c8d1fTG7UPgYkOSELPhiY/YGw= @@ -342,12 +389,16 @@ github.com/opentracing/basictracer-go v1.0.0 h1:YyUAhaEfjoWXclZVJ9sGoNct7j4TVk7l 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/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= +github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.3.0 h1:e5+lF2E4Y2WCIxBefVowBuB0iHrUH4HZ8q+6mGF7fJc= github.com/pelletier/go-toml v1.3.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= +github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= github.com/phf/go-queue v0.0.0-20170504031614-9abe38d0371d h1:U+PMnTlV2tu7RuMK5etusZG3Cf+rpow5hqQByeCzJ2g= github.com/phf/go-queue v0.0.0-20170504031614-9abe38d0371d/go.mod h1:lXfE4PvvTW5xOjO6Mba8zDPyw8M93B6AQ7frTGnMlA8= github.com/pingcap-incubator/tidb-dashboard v0.0.0-20200407064406-b2b8ad403d01/go.mod h1:77fCh8d3oKzC5ceOJWeZXAS/mLzVgdZ7rKniwmOyFuo= +github.com/pingcap-incubator/tidb-dashboard v0.0.0-20200424032813-662fb05948e7/go.mod h1:DwotQY91ds7eiwnY6QrQX9t5iimDtsJVIjI9tZYMaUM= 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/check v0.0.0-20191107115940-caf2b9e6ccf4 h1:iRtOAQ6FXkY/BGvst3CDfTva4nTqh6CL8WXvanLdbu0= @@ -374,22 +425,25 @@ github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO github.com/pingcap/kvproto v0.0.0-20200214064158-62d31900d88e/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= github.com/pingcap/kvproto v0.0.0-20200417092353-efbe03bcffbd/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= github.com/pingcap/kvproto v0.0.0-20200420075417-e0c6e8842f22/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= -github.com/pingcap/kvproto v0.0.0-20200424032552-6650270c39c3 h1:EBq71gaLG7bxgCjR5DA00mzvF5dwEZBPd8xuGSztamw= -github.com/pingcap/kvproto v0.0.0-20200424032552-6650270c39c3/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= +github.com/pingcap/kvproto v0.0.0-20200509065137-6a4d5c264a8b h1:lzOE8Z3TnbgpK8d1h4Jze/SKJrQ7gHgLeUVy0vi0l6o= +github.com/pingcap/kvproto v0.0.0-20200509065137-6a4d5c264a8b/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9 h1:AJD9pZYm72vMgPcQDww9rkZ1DnWfl0pXV3BOWlkYIjA= github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd h1:CV3VsP3Z02MVtdpTMfEgRJ4T9NGgGTxdHpJerent7rM= github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= -github.com/pingcap/parser v0.0.0-20200422082501-7329d80eaf2c/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4= -github.com/pingcap/parser v0.0.0-20200425031156-fb338edcaac2 h1:M4ZwwFQ38yTQhqHFx7kRUfavCgsyPqhZtVA3CXxT0YY= -github.com/pingcap/parser v0.0.0-20200425031156-fb338edcaac2/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4= +github.com/pingcap/parser v0.0.0-20200424075042-8222d8b724a4 h1:1dFbm4zVXWvdwjEdyjMlu1PCxnlxK+JfNq+HhbGjDtc= +github.com/pingcap/parser v0.0.0-20200424075042-8222d8b724a4/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4= +github.com/pingcap/parser v0.0.0-20200507065322-e562e27ebd85 h1:GPpy0eUg9WnbQ879aDvIn8pDQl/NiIzPEZ2QVIT19CI= +github.com/pingcap/parser v0.0.0-20200507065322-e562e27ebd85/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4= github.com/pingcap/pd/v4 v4.0.0-rc.1.0.20200422143320-428acd53eba2 h1:JTzYYukREvxVSKW/ncrzNjFitd8snoQ/Xz32pw8i+s8= github.com/pingcap/pd/v4 v4.0.0-rc.1.0.20200422143320-428acd53eba2/go.mod h1:s+utZtXDznOiL24VK0qGmtoHjjXNsscJx3m1n8cC56s= +github.com/pingcap/pd/v4 v4.0.0-rc.1.0.20200511074607-3bb650739add h1:a/H871xZl++EjOvYmFLXBVKcV75dCj5GQfuHMA8tQHk= +github.com/pingcap/pd/v4 v4.0.0-rc.1.0.20200511074607-3bb650739add/go.mod h1:lEf22fUhISqUo2/TCJL7fTfFgG+VXjOfDCd2s8q0BRU= github.com/pingcap/sysutil v0.0.0-20200206130906-2bfa6dc40bcd/go.mod h1:EB/852NMQ+aRKioCpToQ94Wl7fktV+FNnxf3CX/TTXI= github.com/pingcap/sysutil v0.0.0-20200408114249-ed3bd6f7fdb1 h1:PI8YpTl45F8ilNkrPtT4IdbcZB1SCEa+gK/U5GJYl3E= github.com/pingcap/sysutil v0.0.0-20200408114249-ed3bd6f7fdb1/go.mod h1:EB/852NMQ+aRKioCpToQ94Wl7fktV+FNnxf3CX/TTXI= -github.com/pingcap/tidb v1.1.0-beta.0.20200424160056-7267747ae0ec h1:/cIJBjoTvXxOZcZkJdwNLw75gaUz8La9O6JhpOmeTL8= -github.com/pingcap/tidb v1.1.0-beta.0.20200424160056-7267747ae0ec/go.mod h1:KJXj2xHYfl1x4zcusC2JEANzVci+ietFOMh/CAmrYdw= +github.com/pingcap/tidb v1.1.0-beta.0.20200424154252-5ede18f10eed h1:5mKxIq52K8pZaoKay6K6MLWIcOza8ok+kEyzOk4jYvU= +github.com/pingcap/tidb v1.1.0-beta.0.20200424154252-5ede18f10eed/go.mod h1:m2VDlJDbUeHPCXAfKPajqLmB1uLvWpkKk3zALNqDYdw= github.com/pingcap/tidb-tools v4.0.0-beta.1.0.20200306084441-875bd09aa3d5+incompatible h1:84F7MFMfdAYObrznvRslmVu43aoihrlL+7mMyMlOi0o= github.com/pingcap/tidb-tools v4.0.0-beta.1.0.20200306084441-875bd09aa3d5+incompatible/go.mod h1:XGdcy9+yqlDSEMTpOXnwf3hiTeqrV6MN/u1se9N8yIM= github.com/pingcap/tidb-tools v4.0.0-rc.1.0.20200421113014-507d2bb3a15e+incompatible h1:+K5bqDYG5HT+GqLdx4GH5VmS84+xHgpHbGg6Xt6qQec= @@ -405,26 +459,39 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= +github.com/prometheus/client_golang v1.5.1 h1:bdHYieyGlH+6OLEk2YQha8THib30KP0/yD0YH9m6xcA= +github.com/prometheus/client_golang v1.5.1/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx/RA8rT8tKFRuGUZhuA90OyIBpPCXkcbwU8DE= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= +github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= +github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/procfs v0.0.8 h1:+fpWZdT24pJBiqJdAwYBjPSk+5YmQzYNPYzQsdzLkt8= +github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237 h1:HQagqIiBmr8YXawX/le3+O26N+vPPC1PtjaF3mwnook= github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= 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/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sergi/go-diff v1.0.1-0.20180205163309-da645544ed44/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v2.19.10+incompatible h1:lA4Pi29JEVIQIgATSeftHSY0rMGI9CLrl2ZvDLiahto= @@ -440,6 +507,8 @@ github.com/sirupsen/logrus v1.2.0 h1:juTguoYk5qI21pwyTXY3B3Y5cOTH3ZUyZCg1v/mihuo github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= +github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= +github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/soheilhy/cmux v0.1.4 h1:0HKaf1o97UwFjHH9o5XsHUOF+tqmdA7KEzXLpiyaw0E= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ= @@ -449,8 +518,8 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= -github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -458,7 +527,7 @@ github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= 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/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= @@ -467,6 +536,8 @@ github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0 github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= github.com/swaggo/gin-swagger v1.2.0/go.mod h1:qlH2+W7zXGZkczuL+r2nEBR2JTT+/lX05Nn6vPhc7OI= github.com/swaggo/http-swagger v0.0.0-20200103000832-0e9263c4b516/go.mod h1:O1lAbCgAAX/KZ80LM/OXwtWFI/5TvZlwxSg8Cq08PV0= @@ -493,14 +564,19 @@ github.com/uber-go/atomic v1.3.2 h1:Azu9lPBWRNKzYXSIwRfgRuDuS0YKsK4NFhiQv98gkxo= github.com/uber-go/atomic v1.3.2/go.mod h1:/Ct5t2lcmbJ4OSe/waGBoaVvVqtO0bmtfVNex1PFV8g= github.com/uber/jaeger-client-go v2.15.0+incompatible h1:NP3qsSqNxh8VYr956ur1N/1C1PjvOJnJykCzcD5QHbk= github.com/uber/jaeger-client-go v2.15.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= +github.com/uber/jaeger-client-go v2.22.1+incompatible h1:NHcubEkVbahf9t3p75TOCR83gdUHXjRJvjoBh1yACsM= +github.com/uber/jaeger-client-go v2.22.1+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= github.com/uber/jaeger-lib v1.5.0 h1:OHbgr8l656Ub3Fw5k9SWnBfIEwvoHQ+W2y+Aa9D1Uyo= github.com/uber/jaeger-lib v1.5.0/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= +github.com/uber/jaeger-lib v2.2.0+incompatible h1:MxZXOiR2JuoANZ3J6DE/U0kSFv/eJ/GfSYVCjK7dyaw= +github.com/uber/jaeger-lib v2.2.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/oBQZ/0= +github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.5-pre/go.mod h1:tULtS6Gy1AE1yCENaw4Vb//HLH5njI2tfCQDUqRd8fI= +github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/unrolled/render v0.0.0-20171102162132-65450fb6b2d3 h1:ZsIlNwu/G0zbChIZaWOeZ2TPGNmKMt46jZLXi3e8LFc= github.com/unrolled/render v0.0.0-20171102162132-65450fb6b2d3/go.mod h1:tu82oB5W2ykJRVioYsB+IQKcft7ryBr7w12qMBUPyXg= @@ -515,6 +591,7 @@ github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1: github.com/yookoala/realpath v1.0.0 h1:7OA9pj4FZd+oZDsyvXWQvjn5oBdcHRTV44PpdMSuImQ= github.com/yookoala/realpath v1.0.0/go.mod h1:gJJMA9wuX7AcqLy1+ffPatSCySA1FQ2S8Ya9AIoYBpE= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.3 h1:MUGmc65QhB3pIlaQ5bB4LwqSj6GIonVJXpZiaKNyaKk= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= @@ -527,6 +604,7 @@ go.opencensus.io v0.22.2 h1:75k/FF0Q2YM8QYo07VPddOLBslDt1MZOdEslOHvmzAs= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= 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/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0 h1:OI5t8sDa1Or+q8AeE+yKeB/SDYioSHAgcVljj9JIETY= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk= @@ -545,6 +623,7 @@ go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A= go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= +go.uber.org/zap v1.8.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= @@ -553,8 +632,9 @@ go.uber.org/zap v1.12.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.14.1 h1:nYDKopTbvAPq/NrUVZwT15y2lpROBiLLyoRTbXOYWOo= go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= +go.uber.org/zap v1.15.0 h1:ZZCA22JRF2gQE5FoNmhmrf7jeJJ2uhqDUNRYKm8dvmM= +go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/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-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -564,14 +644,20 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 h1:ULYEB3JvPRE/IfO+9uO7vKV/xzVTO7XPAwm8xbf4w2g= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72 h1:+ELyKg6m8UBf0nPFSqD0mi7zUfwPyXo23HNjMnXPz7w= +golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136 h1:A1gGSx58LAGVHUUsOf7IiR0u8Xb6W51gRwfDBhkdcaw= golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299 h1:zQpM52jfKHG6II1ISZY1ZcpygvuSFZpLwfluuF89XOg= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= 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-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -606,13 +692,17 @@ golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190611141213-3f473d35a33a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191002035440-2ec189313ef0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k= golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= @@ -620,6 +710,8 @@ golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAG golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6 h1:pE8b58s1HRDMi8RDc79m0HISf9D4TzseP40cEA6IGfs= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -633,7 +725,6 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -646,9 +737,15 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190610200419-93c9922d18ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190616124812-15dcb6c0061f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= @@ -687,12 +784,15 @@ golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191030062658-86caa796c7ab/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191107010934-f79515f33823 h1:akkRBeitX2EZP59KdtKw310CI4WGPCNPyrLbE7WZA8Y= golang.org/x/tools v0.0.0-20191107010934-f79515f33823/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191114200427-caa0b0f7d508/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2 h1:EtTFh6h4SAKemS+CURDMTDIANuduG5zKEXShyy18bGA= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/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-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200225230052-807dcd883420/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200325010219-a49f79bcc224/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= @@ -707,8 +807,13 @@ google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEt google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/api v0.14.0 h1:uMf5uLi4eQMRrMKhCplNik4U4H8Z6C1br3zOtAa/aDE= google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0 h1:yzlyyDW/J0w8yNFJIhiAJy4kq74S+1DOLdawELNxFMA= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.1 h1:5mMS6mYvK5LVB8+ujVBC33Y8gltBo/kT6HBm6kU80G4= +google.golang.org/api v0.15.1/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -716,6 +821,8 @@ google.golang.org/appengine v1.5.0 h1:KxkO13IPW4Lslp2bz+KHP2E3gtFlrIGNThxkZQ3g+4 google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20181004005441-af9cb2a35e7f/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -727,17 +834,24 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20190927181202-20e1ac93f88c/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9 h1:6XzpBoANz1NqMNfDXzc2QmHmbb1vyMsvRfoP5rM+K1I= google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb h1:ADPHZzpzM4tk4V4S5cnCrr5SwzvlrPRmqqCuJDB8UTs= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/grpc v0.0.0-20180607172857-7a6a684ca69e/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.24.0/go.mod h1:XDChyiUovWa60DnaeDeZmSW86xtLtjtZbwvSiRnRtcA= google.golang.org/grpc v1.25.1 h1:wdKvqQk7IttEw92GoRyKG2IDrUIpgpj6H6m81yfeMW0= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0 h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= gopkg.in/alecthomas/gometalinter.v2 v2.0.12/go.mod h1:NDRytsqEZyolNuAgTzJkZMkSQM7FIKyzVzGhjB/qfYo= gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= @@ -766,6 +880,7 @@ 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 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo= gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= diff --git a/pkg/backup/client.go b/pkg/backup/client.go index 16df96a9d..e05534bb3 100644 --- a/pkg/backup/client.go +++ b/pkg/backup/client.go @@ -169,7 +169,9 @@ func (bc *Client) SaveBackupMeta(ctx context.Context, ddlJobs []*model.Job) erro return bc.storage.Write(ctx, utils.MetaFile, backupMetaData) } -func buildTableRanges(tbl *model.TableInfo) ([]kv.KeyRange, error) { +// BuildTableRanges returns the key ranges encompassing the entire table, +// and its partitions if exists. +func BuildTableRanges(tbl *model.TableInfo) ([]kv.KeyRange, error) { pis := tbl.GetPartitionInfo() if pis == nil { // Short path, no partition. @@ -202,7 +204,6 @@ func appendRanges(tbl *model.TableInfo, tblID int64) ([]kv.KeyRange, error) { kvRanges = append(kvRanges, idxRanges...) } return kvRanges, nil - } // BuildBackupRangeAndSchema gets the range and schema of tables. @@ -270,7 +271,7 @@ func BuildBackupRangeAndSchema( } backupSchemas.pushPending(schema, dbInfo.Name.L, tableInfo.Name.L) - tableRanges, err := buildTableRanges(tableInfo) + tableRanges, err := BuildTableRanges(tableInfo) if err != nil { return nil, nil, err } @@ -877,7 +878,7 @@ func (bc *Client) CollectChecksums() ([]Checksum, error) { // CompleteMeta wait response of admin checksum from TiDB to complete backup meta func (bc *Client) CompleteMeta(backupSchemas *Schemas) error { - schemas, err := backupSchemas.finishTableChecksum() + schemas, err := backupSchemas.FinishTableChecksum() if err != nil { return err } diff --git a/pkg/backup/client_test.go b/pkg/backup/client_test.go index 63f3d5d5f..e649b6dcc 100644 --- a/pkg/backup/client_test.go +++ b/pkg/backup/client_test.go @@ -1,6 +1,6 @@ // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. -package backup +package backup_test import ( "context" @@ -10,12 +10,14 @@ import ( . "github.com/pingcap/check" "github.com/pingcap/parser/model" + pd "github.com/pingcap/pd/v4/client" "github.com/pingcap/tidb/kv" "github.com/pingcap/tidb/store/mockstore/mocktikv" "github.com/pingcap/tidb/store/tikv/oracle" "github.com/pingcap/tidb/tablecodec" "github.com/pingcap/tidb/util/codec" + "github.com/pingcap/br/pkg/backup" "github.com/pingcap/br/pkg/conn" ) @@ -23,7 +25,8 @@ type testBackup struct { ctx context.Context cancel context.CancelFunc - backupClient *Client + mockPDClient pd.Client + backupClient *backup.Client } var _ = Suite(&testBackup{}) @@ -33,15 +36,14 @@ func TestT(t *testing.T) { } func (r *testBackup) SetUpSuite(c *C) { - mockPDClient := mocktikv.NewPDClient(mocktikv.NewCluster()) + r.mockPDClient = mocktikv.NewPDClient(mocktikv.NewCluster()) r.ctx, r.cancel = context.WithCancel(context.Background()) mockMgr := &conn.Mgr{} - mockMgr.SetPDClient(mockPDClient) + mockMgr.SetPDClient(r.mockPDClient) mockMgr.SetPDHTTP([]string{"test"}, nil) - r.backupClient = &Client{ - clusterID: mockPDClient.GetClusterID(r.ctx), - mgr: mockMgr, - } + var err error + r.backupClient, err = backup.NewBackupClient(r.ctx, mockMgr) + c.Assert(err, IsNil) } func (r *testBackup) TestGetTS(c *C) { @@ -81,10 +83,10 @@ func (r *testBackup) TestGetTS(c *C) { c.Assert(err, ErrorMatches, "backup ts overflow.*") // timeago = "10h" exceed GCSafePoint - p, l, err := r.backupClient.mgr.GetPDClient().GetTS(r.ctx) + p, l, err := r.mockPDClient.GetTS(r.ctx) c.Assert(err, IsNil) now := oracle.ComposeTS(p, l) - _, err = r.backupClient.mgr.GetPDClient().UpdateGCSafePoint(r.ctx, now) + _, err = r.mockPDClient.UpdateGCSafePoint(r.ctx, now) c.Assert(err, IsNil) _, err = r.backupClient.GetTS(r.ctx, 10*time.Hour, 0) c.Assert(err, ErrorMatches, "GC safepoint [0-9]+ exceed TS [0-9]+") @@ -94,7 +96,6 @@ func (r *testBackup) TestGetTS(c *C) { ts, err = r.backupClient.GetTS(r.ctx, time.Minute, backupts) c.Assert(err, IsNil) c.Assert(ts, Equals, backupts) - } func (r *testBackup) TestBuildTableRange(c *C) { @@ -125,16 +126,15 @@ func (r *testBackup) TestBuildTableRange(c *C) { tbl.Partition.Definitions = append(tbl.Partition.Definitions, model.PartitionDefinition{ID: id}) } - ranges, err := buildTableRanges(tbl) + ranges, err := backup.BuildTableRanges(tbl) c.Assert(err, IsNil) c.Assert(ranges, DeepEquals, cs.trs) } tbl := &model.TableInfo{ID: 7} - ranges, err := buildTableRanges(tbl) + ranges, err := backup.BuildTableRanges(tbl) c.Assert(err, IsNil) c.Assert(ranges, DeepEquals, []kv.KeyRange{ {StartKey: tablecodec.EncodeRowKey(7, low), EndKey: tablecodec.EncodeRowKey(7, high)}, }) - } diff --git a/pkg/backup/metrics.go b/pkg/backup/metrics.go index 67d5fe1e5..426fe2f56 100644 --- a/pkg/backup/metrics.go +++ b/pkg/backup/metrics.go @@ -25,7 +25,7 @@ var ( }) ) -func init() { +func init() { // nolint:gochecknoinits prometheus.MustRegister(backupRegionCounters) prometheus.MustRegister(backupRegionHistogram) } diff --git a/pkg/backup/safe_point_test.go b/pkg/backup/safe_point_test.go index 6ded3d0ab..f48c8ff56 100644 --- a/pkg/backup/safe_point_test.go +++ b/pkg/backup/safe_point_test.go @@ -1,6 +1,6 @@ // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. -package backup +package backup_test import ( "context" @@ -10,6 +10,7 @@ import ( pd "github.com/pingcap/pd/v4/client" "github.com/pingcap/tidb/util/testleak" + "github.com/pingcap/br/pkg/backup" "github.com/pingcap/br/pkg/mock" ) @@ -36,19 +37,19 @@ func (s *testSafePointSuite) TestCheckGCSafepoint(c *C) { ctx := context.Background() pdClient := &mockSafePoint{Client: s.mock.PDClient, safepoint: 2333} { - err := CheckGCSafePoint(ctx, pdClient, 2333+1) + err := backup.CheckGCSafePoint(ctx, pdClient, 2333+1) c.Assert(err, IsNil) } { - err := CheckGCSafePoint(ctx, pdClient, 2333) + err := backup.CheckGCSafePoint(ctx, pdClient, 2333) c.Assert(err, NotNil) } { - err := CheckGCSafePoint(ctx, pdClient, 2333-1) + err := backup.CheckGCSafePoint(ctx, pdClient, 2333-1) c.Assert(err, NotNil) } { - err := CheckGCSafePoint(ctx, pdClient, 0) + err := backup.CheckGCSafePoint(ctx, pdClient, 0) c.Assert(err, ErrorMatches, "GC safepoint 2333 exceed TS 0") } } diff --git a/pkg/backup/schema.go b/pkg/backup/schema.go index d1b5943a8..59bb8b5b9 100644 --- a/pkg/backup/schema.go +++ b/pkg/backup/schema.go @@ -29,7 +29,7 @@ const ( DefaultSchemaConcurrency = 64 ) -// Schemas is task for backuping schemas +// Schemas is task for backuping schemas. type Schemas struct { // name -> schema schemas map[string]backup.Schema @@ -110,7 +110,8 @@ func (pending *Schemas) Start( }() } -func (pending *Schemas) finishTableChecksum() ([]*backup.Schema, error) { +// FinishTableChecksum waits until all schemas' checksums are verified. +func (pending *Schemas) FinishTableChecksum() ([]*backup.Schema, error) { schemas := make([]*backup.Schema, 0, len(pending.schemas)) for { select { diff --git a/pkg/backup/schema_test.go b/pkg/backup/schema_test.go index 98173dd55..06584a6b5 100644 --- a/pkg/backup/schema_test.go +++ b/pkg/backup/schema_test.go @@ -1,6 +1,6 @@ // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. -package backup +package backup_test import ( "context" @@ -12,6 +12,7 @@ import ( "github.com/pingcap/tidb/util/testkit" "github.com/pingcap/tidb/util/testleak" + "github.com/pingcap/br/pkg/backup" "github.com/pingcap/br/pkg/mock" ) @@ -60,7 +61,7 @@ func (s *testBackupSchemaSuite) TestBuildBackupRangeAndSchema(c *C) { DoTables: []*filter.Table{{Schema: "test", Name: "t1"}}, }) c.Assert(err, IsNil) - _, backupSchemas, err := BuildBackupRangeAndSchema( + _, backupSchemas, err := backup.BuildBackupRangeAndSchema( s.mock.Domain, s.mock.Storage, testFilter, math.MaxUint64) c.Assert(err, IsNil) c.Assert(backupSchemas, IsNil) @@ -70,7 +71,7 @@ func (s *testBackupSchemaSuite) TestBuildBackupRangeAndSchema(c *C) { DoTables: []*filter.Table{{Schema: "foo", Name: "t1"}}, }) c.Assert(err, IsNil) - _, backupSchemas, err = BuildBackupRangeAndSchema( + _, backupSchemas, err = backup.BuildBackupRangeAndSchema( s.mock.Domain, s.mock.Storage, fooFilter, math.MaxUint64) c.Assert(err, IsNil) c.Assert(backupSchemas, IsNil) @@ -78,7 +79,7 @@ func (s *testBackupSchemaSuite) TestBuildBackupRangeAndSchema(c *C) { // Empty database. noFilter, err := filter.New(false, &filter.Rules{}) c.Assert(err, IsNil) - _, backupSchemas, err = BuildBackupRangeAndSchema( + _, backupSchemas, err = backup.BuildBackupRangeAndSchema( s.mock.Domain, s.mock.Storage, noFilter, math.MaxUint64) c.Assert(err, IsNil) c.Assert(backupSchemas, IsNil) @@ -88,13 +89,13 @@ func (s *testBackupSchemaSuite) TestBuildBackupRangeAndSchema(c *C) { tk.MustExec("create table t1 (a int);") tk.MustExec("insert into t1 values (10);") - _, backupSchemas, err = BuildBackupRangeAndSchema( + _, backupSchemas, err = backup.BuildBackupRangeAndSchema( s.mock.Domain, s.mock.Storage, testFilter, math.MaxUint64) c.Assert(err, IsNil) c.Assert(backupSchemas.Len(), Equals, 1) updateCh := new(simpleProgress) backupSchemas.Start(context.Background(), s.mock.Storage, math.MaxUint64, 1, updateCh) - schemas, err := backupSchemas.finishTableChecksum() + schemas, err := backupSchemas.FinishTableChecksum() c.Assert(updateCh.get(), Equals, int64(1)) c.Assert(err, IsNil) c.Assert(len(schemas), Equals, 1) @@ -108,13 +109,13 @@ func (s *testBackupSchemaSuite) TestBuildBackupRangeAndSchema(c *C) { tk.MustExec("insert into t2 values (10);") tk.MustExec("insert into t2 values (11);") - _, backupSchemas, err = BuildBackupRangeAndSchema( + _, backupSchemas, err = backup.BuildBackupRangeAndSchema( s.mock.Domain, s.mock.Storage, noFilter, math.MaxUint64) c.Assert(err, IsNil) c.Assert(backupSchemas.Len(), Equals, 2) updateCh.reset() backupSchemas.Start(context.Background(), s.mock.Storage, math.MaxUint64, 2, updateCh) - schemas, err = backupSchemas.finishTableChecksum() + schemas, err = backupSchemas.FinishTableChecksum() c.Assert(updateCh.get(), Equals, int64(2)) c.Assert(err, IsNil) c.Assert(len(schemas), Equals, 2) diff --git a/pkg/checksum/executor.go b/pkg/checksum/executor.go index fac944fa0..ff884c65a 100644 --- a/pkg/checksum/executor.go +++ b/pkg/checksum/executor.go @@ -6,6 +6,7 @@ import ( "context" "log" + "github.com/gogo/protobuf/proto" "github.com/pingcap/errors" "github.com/pingcap/parser/model" "github.com/pingcap/tidb/distsql" @@ -240,7 +241,7 @@ func updateChecksumResponse(resp, update *tipb.ChecksumResponse) { resp.TotalBytes += update.TotalBytes } -// Executor is a checksum executor +// Executor is a checksum executor. type Executor struct { reqs []*kv.Request } @@ -250,7 +251,21 @@ func (exec *Executor) Len() int { return len(exec.reqs) } -// Execute executes a checksum executor +// RawRequests extracts the raw requests associated with this executor. +// This is mainly used for debugging only. +func (exec *Executor) RawRequests() ([]*tipb.ChecksumRequest, error) { + res := make([]*tipb.ChecksumRequest, 0, len(exec.reqs)) + for _, req := range exec.reqs { + rawReq := new(tipb.ChecksumRequest) + if err := proto.Unmarshal(req.Data, rawReq); err != nil { + return nil, err + } + res = append(res, rawReq) + } + return res, nil +} + +// Execute executes a checksum executor. func (exec *Executor) Execute( ctx context.Context, client kv.Client, diff --git a/pkg/checksum/executor_test.go b/pkg/checksum/executor_test.go index 43c90761d..ec78f8051 100644 --- a/pkg/checksum/executor_test.go +++ b/pkg/checksum/executor_test.go @@ -1,19 +1,18 @@ // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. -package checksum +package checksum_test import ( "context" "math" "testing" - "github.com/gogo/protobuf/proto" . "github.com/pingcap/check" "github.com/pingcap/parser/model" "github.com/pingcap/tidb/util/testkit" "github.com/pingcap/tidb/util/testleak" - "github.com/pingcap/tipb/go-tipb" + "github.com/pingcap/br/pkg/checksum" "github.com/pingcap/br/pkg/mock" "github.com/pingcap/br/pkg/utils" ) @@ -59,9 +58,9 @@ func (s *testChecksumSuite) TestChecksum(c *C) { tk.MustExec("create table t1 (a int);") tk.MustExec("insert into t1 values (10);") tableInfo1 := s.getTableInfo(c, "test", "t1") - exe1, err := NewExecutorBuilder(tableInfo1, math.MaxUint64).Build() + exe1, err := checksum.NewExecutorBuilder(tableInfo1, math.MaxUint64).Build() c.Assert(err, IsNil) - c.Assert(len(exe1.reqs), Equals, 1) + c.Assert(exe1.Len(), Equals, 1) resp, err := exe1.Execute(context.TODO(), s.mock.Storage.GetClient(), func() {}) c.Assert(err, IsNil) // Cluster returns a dummy checksum (all fields are 1). @@ -74,9 +73,9 @@ func (s *testChecksumSuite) TestChecksum(c *C) { tk.MustExec("alter table t2 add index i2(a);") tk.MustExec("insert into t2 values (10);") tableInfo2 := s.getTableInfo(c, "test", "t2") - exe2, err := NewExecutorBuilder(tableInfo2, math.MaxUint64).Build() + exe2, err := checksum.NewExecutorBuilder(tableInfo2, math.MaxUint64).Build() c.Assert(err, IsNil) - c.Assert(len(exe2.reqs), Equals, 2, Commentf("%v", tableInfo2)) + c.Assert(exe2.Len(), Equals, 2, Commentf("%v", tableInfo2)) resp2, err := exe2.Execute(context.TODO(), s.mock.Storage.GetClient(), func() {}) c.Assert(err, IsNil) c.Assert(resp2.Checksum, Equals, uint64(0), Commentf("%v", resp2)) @@ -87,18 +86,16 @@ func (s *testChecksumSuite) TestChecksum(c *C) { tk.MustExec("alter table t1 add index i2(a);") tableInfo1 = s.getTableInfo(c, "test", "t1") oldTable := utils.Table{Info: tableInfo1} - exe2, err = NewExecutorBuilder(tableInfo2, math.MaxUint64). + exe2, err = checksum.NewExecutorBuilder(tableInfo2, math.MaxUint64). SetOldTable(&oldTable).Build() c.Assert(err, IsNil) - c.Assert(len(exe2.reqs), Equals, 2) - req := tipb.ChecksumRequest{} - err = proto.Unmarshal(exe2.reqs[0].Data, &req) + c.Assert(exe2.Len(), Equals, 2) + rawReqs, err := exe2.RawRequests() c.Assert(err, IsNil) - c.Assert(req.Rule, NotNil) - req = tipb.ChecksumRequest{} - err = proto.Unmarshal(exe2.reqs[1].Data, &req) - c.Assert(err, IsNil) - c.Assert(req.Rule, NotNil) + c.Assert(rawReqs, HasLen, 2) + for _, rawReq := range rawReqs { + c.Assert(rawReq.Rule, NotNil) + } resp2, err = exe2.Execute(context.TODO(), s.mock.Storage.GetClient(), func() {}) c.Assert(err, IsNil) c.Assert(resp2, NotNil) diff --git a/pkg/mock/mock_cluster_test.go b/pkg/mock/mock_cluster_test.go index 1db0f5a8c..2ca00923c 100644 --- a/pkg/mock/mock_cluster_test.go +++ b/pkg/mock/mock_cluster_test.go @@ -1,21 +1,29 @@ // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. -package mock +package mock_test import ( + "testing" + . "github.com/pingcap/check" "github.com/pingcap/tidb/util/testleak" + + "github.com/pingcap/br/pkg/mock" ) +func Test(t *testing.T) { + TestingT(t) +} + var _ = Suite(&testClusterSuite{}) type testClusterSuite struct { - mock *Cluster + mock *mock.Cluster } func (s *testClusterSuite) SetUpSuite(c *C) { var err error - s.mock, err = NewCluster() + s.mock, err = mock.NewCluster() c.Assert(err, IsNil) } diff --git a/pkg/restore/backoff.go b/pkg/restore/backoff.go index a84014c11..77b57b3e7 100644 --- a/pkg/restore/backoff.go +++ b/pkg/restore/backoff.go @@ -13,13 +13,24 @@ import ( ) var ( - errEpochNotMatch = errors.NewNoStackError("epoch not match") - errKeyNotInRegion = errors.NewNoStackError("key not in region") - errRewriteRuleNotFound = errors.NewNoStackError("rewrite rule not found") - errRangeIsEmpty = errors.NewNoStackError("range is empty") - errGrpc = errors.NewNoStackError("gRPC error") - errDownloadFailed = errors.NewNoStackError("download sst failed") - errIngestFailed = errors.NewNoStackError("ingest sst failed") + // ErrEpochNotMatch is the error raised when ingestion failed with "epoch + // not match". This error is retryable. + ErrEpochNotMatch = errors.NewNoStackError("epoch not match") + // ErrKeyNotInRegion is the error raised when ingestion failed with "key not + // in region". This error cannot be retried. + ErrKeyNotInRegion = errors.NewNoStackError("key not in region") + // ErrRewriteRuleNotFound is the error raised when download failed with + // "rewrite rule not found". This error cannot be retried + ErrRewriteRuleNotFound = errors.NewNoStackError("rewrite rule not found") + // ErrRangeIsEmpty is the error raised when download failed with "range is + // empty". This error cannot be retried. + ErrRangeIsEmpty = errors.NewNoStackError("range is empty") + // ErrGRPC indicates any gRPC communication error. This error can be retried. + ErrGRPC = errors.NewNoStackError("gRPC error") + // ErrDownloadFailed indicates a generic, non-retryable download error. + ErrDownloadFailed = errors.NewNoStackError("download sst failed") + // ErrIngestFailed indicates a generic, retryable ingest error. + ErrIngestFailed = errors.NewNoStackError("ingest sst failed") ) const ( @@ -42,28 +53,29 @@ type importerBackoffer struct { maxDelayTime time.Duration } -func newImportSSTBackoffer() utils.Backoffer { +// NewBackoffer creates a new controller regulating a truncated exponential backoff. +func NewBackoffer(attempt int, delayTime, maxDelayTime time.Duration) utils.Backoffer { return &importerBackoffer{ - attempt: importSSTRetryTimes, - delayTime: importSSTWaitInterval, - maxDelayTime: importSSTMaxWaitInterval, + attempt: attempt, + delayTime: delayTime, + maxDelayTime: maxDelayTime, } } +func newImportSSTBackoffer() utils.Backoffer { + return NewBackoffer(importSSTRetryTimes, importSSTWaitInterval, importSSTMaxWaitInterval) +} + func newDownloadSSTBackoffer() utils.Backoffer { - return &importerBackoffer{ - attempt: downloadSSTRetryTimes, - delayTime: downloadSSTWaitInterval, - maxDelayTime: downloadSSTMaxWaitInterval, - } + return NewBackoffer(downloadSSTRetryTimes, downloadSSTWaitInterval, downloadSSTMaxWaitInterval) } func (bo *importerBackoffer) NextBackoff(err error) time.Duration { switch errors.Cause(err) { - case errGrpc, errEpochNotMatch, errIngestFailed: + case ErrGRPC, ErrEpochNotMatch, ErrIngestFailed: bo.delayTime = 2 * bo.delayTime bo.attempt-- - case errRangeIsEmpty, errRewriteRuleNotFound: + case ErrRangeIsEmpty, ErrRewriteRuleNotFound: // Excepted error, finish the operation bo.delayTime = 0 bo.attempt = 0 diff --git a/pkg/restore/backoff_test.go b/pkg/restore/backoff_test.go index a07c0839b..5ee63e885 100644 --- a/pkg/restore/backoff_test.go +++ b/pkg/restore/backoff_test.go @@ -1,6 +1,6 @@ // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. -package restore +package restore_test import ( "context" @@ -10,6 +10,7 @@ import ( "github.com/pingcap/tidb/util/testleak" "github.com/pingcap/br/pkg/mock" + "github.com/pingcap/br/pkg/restore" "github.com/pingcap/br/pkg/utils" ) @@ -29,33 +30,32 @@ func (s *testBackofferSuite) TearDownSuite(c *C) { testleak.AfterTest(c)() } -func (s *testBackofferSuite) TestImporterBackoffer(c *C) { +func (s *testBackofferSuite) TestBackoffWithFatalError(c *C) { var counter int + backoffer := restore.NewBackoffer(10, time.Nanosecond, time.Nanosecond) err := utils.WithRetry(context.Background(), func() error { defer func() { counter++ }() switch counter { case 0: - return errGrpc + return restore.ErrGRPC case 1: - return errEpochNotMatch + return restore.ErrEpochNotMatch case 2: - return errRangeIsEmpty + return restore.ErrRangeIsEmpty } return nil - }, newImportSSTBackoffer()) + }, backoffer) c.Assert(counter, Equals, 3) - c.Assert(err, Equals, errRangeIsEmpty) - - counter = 0 - backoffer := importerBackoffer{ - attempt: 10, - delayTime: time.Nanosecond, - maxDelayTime: time.Nanosecond, - } - err = utils.WithRetry(context.Background(), func() error { + c.Assert(err, Equals, restore.ErrRangeIsEmpty) +} + +func (s *testBackofferSuite) TestBackoffWithRetryableError(c *C) { + var counter int + backoffer := restore.NewBackoffer(10, time.Nanosecond, time.Nanosecond) + err := utils.WithRetry(context.Background(), func() error { defer func() { counter++ }() - return errEpochNotMatch - }, &backoffer) + return restore.ErrEpochNotMatch + }, backoffer) c.Assert(counter, Equals, 10) - c.Assert(err, Equals, errEpochNotMatch) + c.Assert(err, Equals, restore.ErrEpochNotMatch) } diff --git a/pkg/restore/client.go b/pkg/restore/client.go index 2b685e599..bda1f3010 100644 --- a/pkg/restore/client.go +++ b/pkg/restore/client.go @@ -47,7 +47,7 @@ import ( // checksum tasks. const defaultChecksumConcurrency = 64 -// Client sends requests to restore files +// Client sends requests to restore files. type Client struct { ctx context.Context cancel context.CancelFunc @@ -527,7 +527,6 @@ func (rc *Client) RestoreRaw(startKey []byte, endKey []byte, files []*backup.Fil err := rc.fileImporter.SetRawRange(startKey, endKey) if err != nil { - return errors.Trace(err) } diff --git a/pkg/restore/client_test.go b/pkg/restore/client_test.go index 13b5caa0a..96425ffb4 100644 --- a/pkg/restore/client_test.go +++ b/pkg/restore/client_test.go @@ -1,6 +1,6 @@ // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. -package restore +package restore_test import ( "context" @@ -16,6 +16,7 @@ import ( "github.com/pingcap/br/pkg/gluetidb" "github.com/pingcap/br/pkg/mock" + "github.com/pingcap/br/pkg/restore" "github.com/pingcap/br/pkg/utils" ) @@ -39,11 +40,8 @@ func (s *testRestoreClientSuite) TestCreateTables(c *C) { c.Assert(s.mock.Start(), IsNil) defer s.mock.Stop() - client := Client{} - db, err := NewDB(gluetidb.Glue{}, s.mock.Storage) + client, err := restore.NewRestoreClient(context.Background(), gluetidb.Glue{}, s.mock.PDClient, s.mock.Storage, nil) c.Assert(err, IsNil) - client.db = db - client.ctx = context.Background() info, err := s.mock.Domain.GetSnapshotInfoSchema(math.MaxInt64) c.Assert(err, IsNil) @@ -100,11 +98,8 @@ func (s *testRestoreClientSuite) TestIsOnline(c *C) { c.Assert(s.mock.Start(), IsNil) defer s.mock.Stop() - client := Client{} - db, err := NewDB(gluetidb.Glue{}, s.mock.Storage) + client, err := restore.NewRestoreClient(context.Background(), gluetidb.Glue{}, s.mock.PDClient, s.mock.Storage, nil) c.Assert(err, IsNil) - client.db = db - client.ctx = context.Background() c.Assert(client.IsOnline(), IsFalse) client.EnableOnline() diff --git a/pkg/restore/db.go b/pkg/restore/db.go index 4ff1b5ea2..12afbae73 100644 --- a/pkg/restore/db.go +++ b/pkg/restore/db.go @@ -146,16 +146,14 @@ func (db *DB) AlterTiflashReplica(ctx context.Context, table *utils.Table, count zap.Stringer("db", table.Db.Name), zap.Stringer("table", table.Info.Name), zap.Error(err)) - return err } else if table.TiFlashReplicas > 0 { log.Warn("alter tiflash replica done", zap.Stringer("db", table.Db.Name), zap.Stringer("table", table.Info.Name), zap.Int("originalReplicaCount", table.TiFlashReplicas), zap.Int("replicaCount", count)) - } - return nil + return err } // Close closes the connection diff --git a/pkg/restore/db_test.go b/pkg/restore/db_test.go index 3f77a53dd..8e1807be7 100644 --- a/pkg/restore/db_test.go +++ b/pkg/restore/db_test.go @@ -1,6 +1,6 @@ // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. -package restore +package restore_test import ( "context" @@ -17,6 +17,7 @@ import ( "github.com/pingcap/br/pkg/backup" "github.com/pingcap/br/pkg/gluetidb" "github.com/pingcap/br/pkg/mock" + "github.com/pingcap/br/pkg/restore" "github.com/pingcap/br/pkg/utils" ) @@ -74,7 +75,7 @@ func (s *testRestoreSchemaSuite) TestRestoreAutoIncID(c *C) { c.Assert(autoIncID, Equals, uint64(globalAutoID)) // Alter AutoIncID to the next AutoIncID + 100 table.Info.AutoIncID = globalAutoID + 100 - db, err := NewDB(gluetidb.Glue{}, s.mock.Storage) + db, err := restore.NewDB(gluetidb.Glue{}, s.mock.Storage) c.Assert(err, IsNil, Commentf("Error create DB")) tk.MustExec("drop database if exists test;") // Test empty collate value @@ -126,7 +127,7 @@ func (s *testRestoreSchemaSuite) TestFilterDDLJobs(c *C) { Db: dbInfo, Info: tableInfo.Meta(), }} - ddlJobs := FilterDDLJobs(allDDLJobs, tables) + ddlJobs := restore.FilterDDLJobs(allDDLJobs, tables) for _, job := range ddlJobs { c.Logf("get ddl job: %s", job.Query) } diff --git a/pkg/restore/import.go b/pkg/restore/import.go index ee5cef6ca..39defeca5 100644 --- a/pkg/restore/import.go +++ b/pkg/restore/import.go @@ -27,7 +27,7 @@ import ( const importScanRegionTime = 10 * time.Second const scanRegionPaginationLimit = int(128) -// ImporterClient is used to import a file to TiKV +// ImporterClient is used to import a file to TiKV. type ImporterClient interface { DownloadSST( ctx context.Context, @@ -204,7 +204,7 @@ func (importer *FileImporter) Import( ctx, cancel := context.WithTimeout(importer.ctx, importScanRegionTime) defer cancel() // Scan regions covered by the file range - regionInfos, errScanRegion := paginateScanRegion( + regionInfos, errScanRegion := PaginateScanRegion( ctx, importer.metaClient, startKey, endKey, scanRegionPaginationLimit) if errScanRegion != nil { return errors.Trace(errScanRegion) @@ -242,7 +242,7 @@ func (importer *FileImporter) Import( return e }, newDownloadSSTBackoffer()) if errDownload != nil { - if errDownload == errRewriteRuleNotFound || errDownload == errRangeIsEmpty { + if errDownload == ErrRewriteRuleNotFound || errDownload == ErrRangeIsEmpty { // Skip this region continue } @@ -285,7 +285,7 @@ func (importer *FileImporter) Import( zap.Stringer("newLeader", newInfo.Leader)) if !checkRegionEpoch(newInfo, info) { - errIngest = errors.AddStack(errEpochNotMatch) + errIngest = errors.AddStack(ErrEpochNotMatch) break ingestRetry } ingestResp, errIngest = importer.ingestSST(downloadMeta, newInfo) @@ -293,14 +293,14 @@ func (importer *FileImporter) Import( // TODO handle epoch not match error // 1. retry download if needed // 2. retry ingest - errIngest = errors.AddStack(errEpochNotMatch) + errIngest = errors.AddStack(ErrEpochNotMatch) break ingestRetry case errPb.KeyNotInRegion != nil: - errIngest = errors.AddStack(errKeyNotInRegion) + errIngest = errors.AddStack(ErrKeyNotInRegion) break ingestRetry default: // Other errors like `ServerIsBusy`, `RegionNotFound`, etc. should be retryable - errIngest = errors.Annotatef(errIngestFailed, "ingest error %s", errPb) + errIngest = errors.Annotatef(ErrIngestFailed, "ingest error %s", errPb) break ingestRetry } } @@ -345,13 +345,13 @@ func (importer *FileImporter) downloadSST( } regionRule := matchNewPrefix(key, rewriteRules) if regionRule == nil { - return nil, errors.Trace(errRewriteRuleNotFound) + return nil, errors.Trace(ErrRewriteRuleNotFound) } rule := import_sstpb.RewriteRule{ OldKeyPrefix: encodeKeyPrefix(regionRule.GetOldKeyPrefix()), NewKeyPrefix: encodeKeyPrefix(regionRule.GetNewKeyPrefix()), } - sstMeta := getSSTMetaFromFile(id, file, regionInfo.Region, &rule) + sstMeta := GetSSTMetaFromFile(id, file, regionInfo.Region, &rule) req := &import_sstpb.DownloadRequest{ Sst: sstMeta, @@ -367,13 +367,13 @@ func (importer *FileImporter) downloadSST( for _, peer := range regionInfo.Region.GetPeers() { resp, err = importer.importClient.DownloadSST(importer.ctx, peer.GetStoreId(), req) if err != nil { - return nil, errors.Annotatef(errGrpc, "%s", err) + return nil, errors.Annotatef(ErrGRPC, "%s", err) } if resp.GetError() != nil { - return nil, errors.Annotate(errDownloadFailed, resp.GetError().GetMessage()) + return nil, errors.Annotate(ErrDownloadFailed, resp.GetError().GetMessage()) } if resp.GetIsEmpty() { - return nil, errors.Trace(errRangeIsEmpty) + return nil, errors.Trace(ErrRangeIsEmpty) } } sstMeta.Range.Start = truncateTS(resp.Range.GetStart()) @@ -391,7 +391,7 @@ func (importer *FileImporter) downloadRawKVSST( } // Empty rule var rule import_sstpb.RewriteRule - sstMeta := getSSTMetaFromFile(id, file, regionInfo.Region, &rule) + sstMeta := GetSSTMetaFromFile(id, file, regionInfo.Region, &rule) // Cut the SST file's range to fit in the restoring range. if bytes.Compare(importer.rawStartKey, sstMeta.Range.GetStart()) > 0 { @@ -402,7 +402,7 @@ func (importer *FileImporter) downloadRawKVSST( sstMeta.Range.End = importer.rawEndKey } if bytes.Compare(sstMeta.Range.GetStart(), sstMeta.Range.GetEnd()) > 0 { - return nil, errors.Trace(errRangeIsEmpty) + return nil, errors.Trace(ErrRangeIsEmpty) } req := &import_sstpb.DownloadRequest{ @@ -419,13 +419,13 @@ func (importer *FileImporter) downloadRawKVSST( for _, peer := range regionInfo.Region.GetPeers() { resp, err = importer.importClient.DownloadSST(importer.ctx, peer.GetStoreId(), req) if err != nil { - return nil, errors.Annotatef(errGrpc, "%s", err) + return nil, errors.Annotatef(ErrGRPC, "%s", err) } if resp.GetError() != nil { - return nil, errors.Annotate(errDownloadFailed, resp.GetError().GetMessage()) + return nil, errors.Annotate(ErrDownloadFailed, resp.GetError().GetMessage()) } if resp.GetIsEmpty() { - return nil, errors.Trace(errRangeIsEmpty) + return nil, errors.Trace(ErrRangeIsEmpty) } } sstMeta.Range.Start = resp.Range.GetStart() diff --git a/pkg/restore/range.go b/pkg/restore/range.go index 0d5192ca9..6459b0284 100644 --- a/pkg/restore/range.go +++ b/pkg/restore/range.go @@ -3,6 +3,8 @@ package restore import ( + "bytes" + "github.com/pingcap/errors" "github.com/pingcap/kvproto/pkg/import_sstpb" "github.com/pingcap/kvproto/pkg/metapb" @@ -13,8 +15,8 @@ import ( "github.com/pingcap/br/pkg/rtree" ) -// sortRanges checks if the range overlapped and sort them -func sortRanges(ranges []rtree.Range, rewriteRules *RewriteRules) ([]rtree.Range, error) { +// SortRanges checks if the range overlapped and sort them. +func SortRanges(ranges []rtree.Range, rewriteRules *RewriteRules) ([]rtree.Range, error) { rangeTree := rtree.NewRangeTree() for _, rg := range ranges { if rewriteRules != nil { @@ -63,6 +65,14 @@ type RegionInfo struct { Leader *metapb.Peer } +// ContainsInterior returns whether the region contains the given key, and also +// that the key does not fall on the boundary (start key) of the region. +func (region *RegionInfo) ContainsInterior(key []byte) bool { + return bytes.Compare(key, region.Region.GetStartKey()) > 0 && + (len(region.Region.GetEndKey()) == 0 || + bytes.Compare(key, region.Region.GetEndKey()) < 0) +} + // RewriteRules contains rules for rewriting keys of tables. type RewriteRules struct { Table []*import_sstpb.RewriteRule diff --git a/pkg/restore/range_test.go b/pkg/restore/range_test.go index 37561f6b4..259bc5bf2 100644 --- a/pkg/restore/range_test.go +++ b/pkg/restore/range_test.go @@ -1,6 +1,6 @@ // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. -package restore +package restore_test import ( "bytes" @@ -9,6 +9,7 @@ import ( "github.com/pingcap/kvproto/pkg/import_sstpb" "github.com/pingcap/tidb/tablecodec" + "github.com/pingcap/br/pkg/restore" "github.com/pingcap/br/pkg/rtree" ) @@ -44,7 +45,7 @@ func (s *testRangeSuite) TestSortRange(c *C) { {OldKeyPrefix: tablecodec.GenTableRecordPrefix(1), NewKeyPrefix: tablecodec.GenTableRecordPrefix(4)}, {OldKeyPrefix: tablecodec.GenTableRecordPrefix(2), NewKeyPrefix: tablecodec.GenTableRecordPrefix(5)}, } - rewriteRules := &RewriteRules{ + rewriteRules := &restore.RewriteRules{ Table: make([]*import_sstpb.RewriteRule, 0), Data: dataRules, } @@ -52,7 +53,7 @@ func (s *testRangeSuite) TestSortRange(c *C) { {StartKey: append(tablecodec.GenTableRecordPrefix(1), []byte("aaa")...), EndKey: append(tablecodec.GenTableRecordPrefix(1), []byte("bbb")...), Files: nil}, } - rs1, err := sortRanges(ranges1, rewriteRules) + rs1, err := restore.SortRanges(ranges1, rewriteRules) c.Assert(err, IsNil, Commentf("sort range1 failed: %v", err)) c.Assert(rs1, RangeEquals, []rtree.Range{ {StartKey: append(tablecodec.GenTableRecordPrefix(4), []byte("aaa")...), @@ -63,12 +64,12 @@ func (s *testRangeSuite) TestSortRange(c *C) { {StartKey: append(tablecodec.GenTableRecordPrefix(1), []byte("aaa")...), EndKey: append(tablecodec.GenTableRecordPrefix(2), []byte("bbb")...), Files: nil}, } - _, err = sortRanges(ranges2, rewriteRules) + _, err = restore.SortRanges(ranges2, rewriteRules) c.Assert(err, ErrorMatches, ".*table id does not match.*") ranges3 := initRanges() rewriteRules1 := initRewriteRules() - rs3, err := sortRanges(ranges3, rewriteRules1) + rs3, err := restore.SortRanges(ranges3, rewriteRules1) c.Assert(err, IsNil, Commentf("sort range1 failed: %v", err)) c.Assert(rs3, RangeEquals, []rtree.Range{ {StartKey: []byte("bbd"), EndKey: []byte("bbf"), Files: nil}, diff --git a/pkg/restore/split.go b/pkg/restore/split.go index 4138d0012..e1e37c8ed 100644 --- a/pkg/restore/split.go +++ b/pkg/restore/split.go @@ -70,7 +70,7 @@ func (rs *RegionSplitter) Split( } startTime := time.Now() // Sort the range for getting the min and max key of the ranges - sortedRanges, errSplit := sortRanges(ranges, rewriteRules) + sortedRanges, errSplit := SortRanges(ranges, rewriteRules) if errSplit != nil { return errors.Trace(errSplit) } @@ -96,7 +96,7 @@ func (rs *RegionSplitter) Split( scatterRegions := make([]*RegionInfo, 0) SplitRegions: for i := 0; i < SplitRetryTimes; i++ { - regions, errScan := paginateScanRegion(ctx, rs.client, minKey, maxKey, scanRegionPaginationLimit) + regions, errScan := PaginateScanRegion(ctx, rs.client, minKey, maxKey, scanRegionPaginationLimit) if errScan != nil { return errors.Trace(errScan) } @@ -272,7 +272,7 @@ func getSplitKeys(rewriteRules *RewriteRules, ranges []rtree.Range, regions []*R checkKeys = append(checkKeys, truncateRowKey(rg.EndKey)) } for _, key := range checkKeys { - if region := needSplit(key, regions); region != nil { + if region := NeedSplit(key, regions); region != nil { splitKeys, ok := splitKeyMap[region.Region.GetId()] if !ok { splitKeys = make([][]byte, 0, 1) @@ -287,8 +287,8 @@ func getSplitKeys(rewriteRules *RewriteRules, ranges []rtree.Range, regions []*R return splitKeyMap } -// needSplit checks whether a key is necessary to split, if true returns the split region -func needSplit(splitKey []byte, regions []*RegionInfo) *RegionInfo { +// NeedSplit checks whether a key is necessary to split, if true returns the split region. +func NeedSplit(splitKey []byte, regions []*RegionInfo) *RegionInfo { // If splitKey is the max key. if len(splitKey) == 0 { return nil @@ -300,7 +300,7 @@ func needSplit(splitKey []byte, regions []*RegionInfo) *RegionInfo { return nil } // If splitKey is in a region - if bytes.Compare(splitKey, region.Region.GetStartKey()) > 0 && beforeEnd(splitKey, region.Region.GetEndKey()) { + if region.ContainsInterior(splitKey) { return region } } @@ -322,10 +322,6 @@ func truncateRowKey(key []byte) []byte { return key } -func beforeEnd(key []byte, end []byte) bool { - return bytes.Compare(key, end) < 0 || len(end) == 0 -} - func replacePrefix(s []byte, rewriteRules *RewriteRules) ([]byte, *import_sstpb.RewriteRule) { // We should search the dataRules firstly. for _, rule := range rewriteRules.Data { diff --git a/pkg/restore/split_client.go b/pkg/restore/split_client.go index d9b5f8677..696945225 100644 --- a/pkg/restore/split_client.go +++ b/pkg/restore/split_client.go @@ -88,7 +88,6 @@ func (c *pdClient) GetStore(ctx context.Context, storeID uint64) (*metapb.Store, } c.storeCache[storeID] = store return store, nil - } func (c *pdClient) GetRegion(ctx context.Context, key []byte) (*RegionInfo, error) { diff --git a/pkg/restore/split_test.go b/pkg/restore/split_test.go index b21cbf781..0e2c22fa5 100644 --- a/pkg/restore/split_test.go +++ b/pkg/restore/split_test.go @@ -1,6 +1,6 @@ // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. -package restore +package restore_test import ( "bytes" @@ -16,18 +16,23 @@ import ( "github.com/pingcap/pd/v4/server/schedule/placement" "github.com/pingcap/tidb/util/codec" + "github.com/pingcap/br/pkg/restore" "github.com/pingcap/br/pkg/rtree" ) type testClient struct { mu sync.RWMutex stores map[uint64]*metapb.Store - regions map[uint64]*RegionInfo + regions map[uint64]*restore.RegionInfo regionsInfo *core.RegionsInfo // For now it's only used in ScanRegions nextRegionID uint64 } -func newTestClient(stores map[uint64]*metapb.Store, regions map[uint64]*RegionInfo, nextRegionID uint64) *testClient { +func newTestClient( + stores map[uint64]*metapb.Store, + regions map[uint64]*restore.RegionInfo, + nextRegionID uint64, +) *testClient { regionsInfo := core.NewRegionsInfo() for _, regionInfo := range regions { regionsInfo.AddRegion(core.NewRegionInfo(regionInfo.Region, regionInfo.Leader)) @@ -40,7 +45,7 @@ func newTestClient(stores map[uint64]*metapb.Store, regions map[uint64]*RegionIn } } -func (c *testClient) GetAllRegions() map[uint64]*RegionInfo { +func (c *testClient) GetAllRegions() map[uint64]*restore.RegionInfo { c.mu.RLock() defer c.mu.RUnlock() return c.regions @@ -56,7 +61,7 @@ func (c *testClient) GetStore(ctx context.Context, storeID uint64) (*metapb.Stor return store, nil } -func (c *testClient) GetRegion(ctx context.Context, key []byte) (*RegionInfo, error) { +func (c *testClient) GetRegion(ctx context.Context, key []byte) (*restore.RegionInfo, error) { c.mu.RLock() defer c.mu.RUnlock() for _, region := range c.regions { @@ -68,7 +73,7 @@ func (c *testClient) GetRegion(ctx context.Context, key []byte) (*RegionInfo, er return nil, errors.Errorf("region not found: key=%s", string(key)) } -func (c *testClient) GetRegionByID(ctx context.Context, regionID uint64) (*RegionInfo, error) { +func (c *testClient) GetRegionByID(ctx context.Context, regionID uint64) (*restore.RegionInfo, error) { c.mu.RLock() defer c.mu.RUnlock() region, ok := c.regions[regionID] @@ -78,10 +83,14 @@ func (c *testClient) GetRegionByID(ctx context.Context, regionID uint64) (*Regio return region, nil } -func (c *testClient) SplitRegion(ctx context.Context, regionInfo *RegionInfo, key []byte) (*RegionInfo, error) { +func (c *testClient) SplitRegion( + ctx context.Context, + regionInfo *restore.RegionInfo, + key []byte, +) (*restore.RegionInfo, error) { c.mu.Lock() defer c.mu.Unlock() - var target *RegionInfo + var target *restore.RegionInfo splitKey := codec.EncodeBytes([]byte{}, key) for _, region := range c.regions { if bytes.Compare(splitKey, region.Region.StartKey) >= 0 && @@ -92,7 +101,7 @@ func (c *testClient) SplitRegion(ctx context.Context, regionInfo *RegionInfo, ke if target == nil { return nil, errors.Errorf("region not found: key=%s", string(key)) } - newRegion := &RegionInfo{ + newRegion := &restore.RegionInfo{ Region: &metapb.Region{ Peers: target.Region.Peers, Id: c.nextRegionID, @@ -108,24 +117,23 @@ func (c *testClient) SplitRegion(ctx context.Context, regionInfo *RegionInfo, ke } func (c *testClient) BatchSplitRegions( - ctx context.Context, regionInfo *RegionInfo, keys [][]byte, -) ([]*RegionInfo, error) { + ctx context.Context, regionInfo *restore.RegionInfo, keys [][]byte, +) ([]*restore.RegionInfo, error) { c.mu.Lock() defer c.mu.Unlock() - newRegions := make([]*RegionInfo, 0) + newRegions := make([]*restore.RegionInfo, 0) for _, key := range keys { - var target *RegionInfo + var target *restore.RegionInfo splitKey := codec.EncodeBytes([]byte{}, key) for _, region := range c.regions { - if bytes.Compare(splitKey, region.Region.GetStartKey()) > 0 && - beforeEnd(splitKey, region.Region.GetEndKey()) { + if region.ContainsInterior(splitKey) { target = region } } if target == nil { continue } - newRegion := &RegionInfo{ + newRegion := &restore.RegionInfo{ Region: &metapb.Region{ Peers: target.Region.Peers, Id: c.nextRegionID, @@ -142,7 +150,7 @@ func (c *testClient) BatchSplitRegions( return newRegions, nil } -func (c *testClient) ScatterRegion(ctx context.Context, regionInfo *RegionInfo) error { +func (c *testClient) ScatterRegion(ctx context.Context, regionInfo *restore.RegionInfo) error { return nil } @@ -152,11 +160,11 @@ func (c *testClient) GetOperator(ctx context.Context, regionID uint64) (*pdpb.Ge }, nil } -func (c *testClient) ScanRegions(ctx context.Context, key, endKey []byte, limit int) ([]*RegionInfo, error) { +func (c *testClient) ScanRegions(ctx context.Context, key, endKey []byte, limit int) ([]*restore.RegionInfo, error) { infos := c.regionsInfo.ScanRange(key, endKey, limit) - regions := make([]*RegionInfo, 0, len(infos)) + regions := make([]*restore.RegionInfo, 0, len(infos)) for _, info := range infos { - regions = append(regions, &RegionInfo{ + regions = append(regions, &restore.RegionInfo{ Region: info.GetMeta(), Leader: info.GetLeader(), }) @@ -190,7 +198,7 @@ func (s *testRestoreUtilSuite) TestSplit(c *C) { client := initTestClient() ranges := initRanges() rewriteRules := initRewriteRules() - regionSplitter := NewRegionSplitter(client) + regionSplitter := restore.NewRegionSplitter(client) ctx := context.Background() err := regionSplitter.Split(ctx, ranges, rewriteRules, func(key [][]byte) {}) @@ -215,7 +223,7 @@ func initTestClient() *testClient { StoreId: 1, } keys := [6]string{"", "aay", "bba", "bbh", "cca", ""} - regions := make(map[uint64]*RegionInfo) + regions := make(map[uint64]*restore.RegionInfo) for i := uint64(1); i < 6; i++ { startKey := []byte(keys[i-1]) if len(startKey) != 0 { @@ -225,7 +233,7 @@ func initTestClient() *testClient { if len(endKey) != 0 { endKey = codec.EncodeBytes([]byte{}, endKey) } - regions[i] = &RegionInfo{ + regions[i] = &restore.RegionInfo{ Region: &metapb.Region{ Id: i, Peers: peers, @@ -263,7 +271,7 @@ func initRanges() []rtree.Range { return ranges[:] } -func initRewriteRules() *RewriteRules { +func initRewriteRules() *restore.RewriteRules { var rules [2]*import_sstpb.RewriteRule rules[0] = &import_sstpb.RewriteRule{ OldKeyPrefix: []byte("aa"), @@ -273,7 +281,7 @@ func initRewriteRules() *RewriteRules { OldKeyPrefix: []byte("cc"), NewKeyPrefix: []byte("bb"), } - return &RewriteRules{ + return &restore.RewriteRules{ Table: rules[:], Data: rules[:], } @@ -282,7 +290,7 @@ func initRewriteRules() *RewriteRules { // expected regions after split: // [, aay), [aay, bb), [bb, bba), [bba, bbf), [bbf, bbh), [bbh, bbj), // [bbj, cca), [cca, xx), [xx, xxe), [xxe, xxz), [xxz, ) -func validateRegions(regions map[uint64]*RegionInfo) bool { +func validateRegions(regions map[uint64]*restore.RegionInfo) bool { keys := [12]string{"", "aay", "bb", "bba", "bbf", "bbh", "bbj", "cca", "xx", "xxe", "xxz", ""} if len(regions) != 11 { return false @@ -309,7 +317,7 @@ FindRegion: } func (s *testRestoreUtilSuite) TestNeedSplit(c *C) { - regions := []*RegionInfo{ + regions := []*restore.RegionInfo{ { Region: &metapb.Region{ StartKey: codec.EncodeBytes([]byte{}, []byte("b")), @@ -318,15 +326,15 @@ func (s *testRestoreUtilSuite) TestNeedSplit(c *C) { }, } // Out of region - c.Assert(needSplit([]byte("a"), regions), IsNil) + c.Assert(restore.NeedSplit([]byte("a"), regions), IsNil) // Region start key - c.Assert(needSplit([]byte("b"), regions), IsNil) + c.Assert(restore.NeedSplit([]byte("b"), regions), IsNil) // In region - region := needSplit([]byte("c"), regions) + region := restore.NeedSplit([]byte("c"), regions) c.Assert(bytes.Compare(region.Region.GetStartKey(), codec.EncodeBytes([]byte{}, []byte("b"))), Equals, 0) c.Assert(bytes.Compare(region.Region.GetEndKey(), codec.EncodeBytes([]byte{}, []byte("d"))), Equals, 0) // Region end key - c.Assert(needSplit([]byte("d"), regions), IsNil) + c.Assert(restore.NeedSplit([]byte("d"), regions), IsNil) // Out of region - c.Assert(needSplit([]byte("e"), regions), IsNil) + c.Assert(restore.NeedSplit([]byte("e"), regions), IsNil) } diff --git a/pkg/restore/util.go b/pkg/restore/util.go index 2652b1e7b..3370689ee 100644 --- a/pkg/restore/util.go +++ b/pkg/restore/util.go @@ -81,9 +81,9 @@ func GetRewriteRules( } } -// getSSTMetaFromFile compares the keys in file, region and rewrite rules, then returns a sst conn. -// The range of the returned sst meta is [regionRule.NewKeyPrefix, append(regionRule.NewKeyPrefix, 0xff)] -func getSSTMetaFromFile( +// GetSSTMetaFromFile compares the keys in file, region and rewrite rules, then returns a sst conn. +// The range of the returned sst meta is [regionRule.NewKeyPrefix, append(regionRule.NewKeyPrefix, 0xff)]. +func GetSSTMetaFromFile( id []byte, file *backup.File, region *metapb.Region, @@ -165,7 +165,6 @@ func AttachFilesToRanges( rangeTree.Update(rg) } for _, f := range files { - rg := rangeTree.Find(&rtree.Range{ StartKey: f.GetStartKey(), EndKey: f.GetEndKey(), @@ -337,10 +336,10 @@ func encodeKeyPrefix(key []byte) []byte { return append(encodedPrefix[:len(encodedPrefix)-9], key[len(key)-ungroupedLen:]...) } -// paginateScanRegion scan regions with a limit pagination and +// PaginateScanRegion scan regions with a limit pagination and // return all regions at once. // It reduces max gRPC message size. -func paginateScanRegion( +func PaginateScanRegion( ctx context.Context, client SplitClient, startKey, endKey []byte, limit int, ) ([]*RegionInfo, error) { if len(endKey) != 0 && bytes.Compare(startKey, endKey) >= 0 { diff --git a/pkg/restore/util_test.go b/pkg/restore/util_test.go index d1a738fdb..b36a4be78 100644 --- a/pkg/restore/util_test.go +++ b/pkg/restore/util_test.go @@ -1,6 +1,6 @@ // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. -package restore +package restore_test import ( "context" @@ -12,6 +12,8 @@ import ( "github.com/pingcap/kvproto/pkg/metapb" "github.com/pingcap/tidb/tablecodec" "github.com/pingcap/tidb/util/codec" + + "github.com/pingcap/br/pkg/restore" ) var _ = Suite(&testRestoreUtilSuite{}) @@ -33,13 +35,13 @@ func (s *testRestoreUtilSuite) TestGetSSTMetaFromFile(c *C) { StartKey: []byte("t2abc"), EndKey: []byte("t3a"), } - sstMeta := getSSTMetaFromFile([]byte{}, file, region, rule) + sstMeta := restore.GetSSTMetaFromFile([]byte{}, file, region, rule) c.Assert(string(sstMeta.GetRange().GetStart()), Equals, "t2abc") c.Assert(string(sstMeta.GetRange().GetEnd()), Equals, "t2\xff") } func (s *testRestoreUtilSuite) TestValidateFileRanges(c *C) { - rules := &RewriteRules{ + rules := &restore.RewriteRules{ Table: []*import_sstpb.RewriteRule{&import_sstpb.RewriteRule{ OldKeyPrefix: []byte(tablecodec.EncodeTablePrefix(1)), NewKeyPrefix: []byte(tablecodec.EncodeTablePrefix(2)), @@ -47,7 +49,7 @@ func (s *testRestoreUtilSuite) TestValidateFileRanges(c *C) { } // Empty start/end key is not allowed. - _, err := ValidateFileRanges( + _, err := restore.ValidateFileRanges( []*backup.File{&backup.File{ Name: "file_write.sst", StartKey: []byte(""), @@ -58,7 +60,7 @@ func (s *testRestoreUtilSuite) TestValidateFileRanges(c *C) { c.Assert(err, ErrorMatches, ".*cannot find rewrite rule.*") // Range is not overlap, no rule found. - _, err = ValidateFileRanges( + _, err = restore.ValidateFileRanges( []*backup.File{{ Name: "file_write.sst", StartKey: tablecodec.EncodeTablePrefix(0), @@ -69,7 +71,7 @@ func (s *testRestoreUtilSuite) TestValidateFileRanges(c *C) { c.Assert(err, ErrorMatches, ".*cannot find rewrite rule.*") // No rule for end key. - _, err = ValidateFileRanges( + _, err = restore.ValidateFileRanges( []*backup.File{{ Name: "file_write.sst", StartKey: tablecodec.EncodeTablePrefix(1), @@ -84,7 +86,7 @@ func (s *testRestoreUtilSuite) TestValidateFileRanges(c *C) { OldKeyPrefix: tablecodec.EncodeTablePrefix(2), NewKeyPrefix: tablecodec.EncodeTablePrefix(3), }) - _, err = ValidateFileRanges( + _, err = restore.ValidateFileRanges( []*backup.File{{ Name: "file_write.sst", StartKey: tablecodec.EncodeTablePrefix(1), @@ -99,7 +101,7 @@ func (s *testRestoreUtilSuite) TestValidateFileRanges(c *C) { OldKeyPrefix: tablecodec.EncodeTablePrefix(2), NewKeyPrefix: tablecodec.EncodeTablePrefix(1), }) - _, err = ValidateFileRanges( + _, err = restore.ValidateFileRanges( []*backup.File{{ Name: "file_write.sst", StartKey: tablecodec.EncodeTablePrefix(1), @@ -121,12 +123,12 @@ func (s *testRestoreUtilSuite) TestPaginateScanRegion(c *C) { Id: 1, } - makeRegions := func(num uint64) (map[uint64]*RegionInfo, []*RegionInfo) { - regionsMap := make(map[uint64]*RegionInfo, num) - regions := make([]*RegionInfo, 0, num) + makeRegions := func(num uint64) (map[uint64]*restore.RegionInfo, []*restore.RegionInfo) { + regionsMap := make(map[uint64]*restore.RegionInfo, num) + regions := make([]*restore.RegionInfo, 0, num) endKey := make([]byte, 8) for i := uint64(0); i < num-1; i++ { - ri := &RegionInfo{ + ri := &restore.RegionInfo{ Region: &metapb.Region{ Id: i + 1, Peers: peers, @@ -151,7 +153,7 @@ func (s *testRestoreUtilSuite) TestPaginateScanRegion(c *C) { } else { endKey = codec.EncodeBytes([]byte{}, endKey) } - ri := &RegionInfo{ + ri := &restore.RegionInfo{ Region: &metapb.Region{ Id: num, Peers: peers, @@ -166,48 +168,48 @@ func (s *testRestoreUtilSuite) TestPaginateScanRegion(c *C) { } ctx := context.Background() - regionMap := make(map[uint64]*RegionInfo) - regions := []*RegionInfo{} - batch, err := paginateScanRegion(ctx, newTestClient(stores, regionMap, 0), []byte{}, []byte{}, 3) + regionMap := make(map[uint64]*restore.RegionInfo) + regions := []*restore.RegionInfo{} + batch, err := restore.PaginateScanRegion(ctx, newTestClient(stores, regionMap, 0), []byte{}, []byte{}, 3) c.Assert(err, IsNil) c.Assert(batch, DeepEquals, regions) regionMap, regions = makeRegions(1) - batch, err = paginateScanRegion(ctx, newTestClient(stores, regionMap, 0), []byte{}, []byte{}, 3) + batch, err = restore.PaginateScanRegion(ctx, newTestClient(stores, regionMap, 0), []byte{}, []byte{}, 3) c.Assert(err, IsNil) c.Assert(batch, DeepEquals, regions) regionMap, regions = makeRegions(2) - batch, err = paginateScanRegion(ctx, newTestClient(stores, regionMap, 0), []byte{}, []byte{}, 3) + batch, err = restore.PaginateScanRegion(ctx, newTestClient(stores, regionMap, 0), []byte{}, []byte{}, 3) c.Assert(err, IsNil) c.Assert(batch, DeepEquals, regions) regionMap, regions = makeRegions(3) - batch, err = paginateScanRegion(ctx, newTestClient(stores, regionMap, 0), []byte{}, []byte{}, 3) + batch, err = restore.PaginateScanRegion(ctx, newTestClient(stores, regionMap, 0), []byte{}, []byte{}, 3) c.Assert(err, IsNil) c.Assert(batch, DeepEquals, regions) regionMap, regions = makeRegions(8) - batch, err = paginateScanRegion(ctx, newTestClient(stores, regionMap, 0), []byte{}, []byte{}, 3) + batch, err = restore.PaginateScanRegion(ctx, newTestClient(stores, regionMap, 0), []byte{}, []byte{}, 3) c.Assert(err, IsNil) c.Assert(batch, DeepEquals, regions) regionMap, regions = makeRegions(8) - batch, err = paginateScanRegion( + batch, err = restore.PaginateScanRegion( ctx, newTestClient(stores, regionMap, 0), regions[1].Region.StartKey, []byte{}, 3) c.Assert(err, IsNil) c.Assert(batch, DeepEquals, regions[1:]) - batch, err = paginateScanRegion( + batch, err = restore.PaginateScanRegion( ctx, newTestClient(stores, regionMap, 0), []byte{}, regions[6].Region.EndKey, 3) c.Assert(err, IsNil) c.Assert(batch, DeepEquals, regions[:7]) - batch, err = paginateScanRegion( + batch, err = restore.PaginateScanRegion( ctx, newTestClient(stores, regionMap, 0), regions[1].Region.StartKey, regions[1].Region.EndKey, 3) c.Assert(err, IsNil) c.Assert(batch, DeepEquals, regions[1:2]) - _, err = paginateScanRegion(ctx, newTestClient(stores, regionMap, 0), []byte{2}, []byte{1}, 3) + _, err = restore.PaginateScanRegion(ctx, newTestClient(stores, regionMap, 0), []byte{2}, []byte{1}, 3) c.Assert(err, ErrorMatches, "startKey >= endKey.*") } diff --git a/pkg/rtree/rtree_test.go b/pkg/rtree/rtree_test.go index d3e151e25..720b1ca28 100644 --- a/pkg/rtree/rtree_test.go +++ b/pkg/rtree/rtree_test.go @@ -1,37 +1,43 @@ // Copyright 2020 PingCAP, Inc. Licensed under Apache-2.0. -package rtree +package rtree_test import ( "fmt" "testing" . "github.com/pingcap/check" + + "github.com/pingcap/br/pkg/rtree" ) +func Test(t *testing.T) { + TestingT(t) +} + var _ = Suite(&testRangeTreeSuite{}) type testRangeTreeSuite struct{} -func newRange(start, end []byte) *Range { - return &Range{ +func newRange(start, end []byte) *rtree.Range { + return &rtree.Range{ StartKey: start, EndKey: end, } } func (s *testRangeTreeSuite) TestRangeTree(c *C) { - rangeTree := NewRangeTree() + rangeTree := rtree.NewRangeTree() c.Assert(rangeTree.Get(newRange([]byte(""), []byte(""))), IsNil) - search := func(key []byte) *Range { + search := func(key []byte) *rtree.Range { rg := rangeTree.Get(newRange(key, []byte(""))) if rg == nil { return nil } - return rg.(*Range) + return rg.(*rtree.Range) } - assertIncomplete := func(startKey, endKey []byte, ranges []Range) { + assertIncomplete := func(startKey, endKey []byte, ranges []rtree.Range) { incomplete := rangeTree.GetIncompleteRange(startKey, endKey) c.Logf("%#v %#v\n%#v\n%#v\n", startKey, endKey, incomplete, ranges) c.Assert(len(incomplete), Equals, len(ranges)) @@ -45,7 +51,7 @@ func (s *testRangeTreeSuite) TestRangeTree(c *C) { for e := s + 1; e < 0xff; e++ { start := []byte{byte(s)} end := []byte{byte(e)} - assertIncomplete(start, end, []Range{}) + assertIncomplete(start, end, []rtree.Range{}) } } } @@ -58,23 +64,23 @@ func (s *testRangeTreeSuite) TestRangeTree(c *C) { rangeTree.Update(*rangeA) c.Assert(rangeTree.Len(), Equals, 1) - assertIncomplete([]byte("a"), []byte("b"), []Range{}) + assertIncomplete([]byte("a"), []byte("b"), []rtree.Range{}) assertIncomplete([]byte(""), []byte(""), - []Range{ + []rtree.Range{ {StartKey: []byte(""), EndKey: []byte("a")}, {StartKey: []byte("b"), EndKey: []byte("")}, }) rangeTree.Update(*rangeC) c.Assert(rangeTree.Len(), Equals, 2) - assertIncomplete([]byte("a"), []byte("c"), []Range{ + assertIncomplete([]byte("a"), []byte("c"), []rtree.Range{ {StartKey: []byte("b"), EndKey: []byte("c")}, }) - assertIncomplete([]byte("b"), []byte("c"), []Range{ + assertIncomplete([]byte("b"), []byte("c"), []rtree.Range{ {StartKey: []byte("b"), EndKey: []byte("c")}, }) assertIncomplete([]byte(""), []byte(""), - []Range{ + []rtree.Range{ {StartKey: []byte(""), EndKey: []byte("a")}, {StartKey: []byte("b"), EndKey: []byte("c")}, {StartKey: []byte("d"), EndKey: []byte("")}, @@ -90,7 +96,7 @@ func (s *testRangeTreeSuite) TestRangeTree(c *C) { c.Assert(rangeTree.Len(), Equals, 3) c.Assert(search([]byte("b")), DeepEquals, rangeB) assertIncomplete([]byte(""), []byte(""), - []Range{ + []rtree.Range{ {StartKey: []byte(""), EndKey: []byte("a")}, {StartKey: []byte("d"), EndKey: []byte("")}, }) @@ -98,7 +104,7 @@ func (s *testRangeTreeSuite) TestRangeTree(c *C) { rangeTree.Update(*rangeD) c.Assert(rangeTree.Len(), Equals, 4) c.Assert(search([]byte("d")), DeepEquals, rangeD) - assertIncomplete([]byte(""), []byte(""), []Range{ + assertIncomplete([]byte(""), []byte(""), []rtree.Range{ {StartKey: []byte(""), EndKey: []byte("a")}, }) @@ -115,7 +121,7 @@ func (s *testRangeTreeSuite) TestRangeTree(c *C) { // Overwrite range BD, c-d should be empty rangeTree.Update(*rangeB) c.Assert(rangeTree.Len(), Equals, 4) - assertIncomplete([]byte(""), []byte(""), []Range{ + assertIncomplete([]byte(""), []byte(""), []rtree.Range{ {StartKey: []byte("c"), EndKey: []byte("d")}, }) @@ -169,9 +175,9 @@ func (s *testRangeTreeSuite) TestRangeIntersect(c *C) { } func BenchmarkRangeTreeUpdate(b *testing.B) { - rangeTree := NewRangeTree() + rangeTree := rtree.NewRangeTree() for i := 0; i < b.N; i++ { - item := Range{ + item := rtree.Range{ StartKey: []byte(fmt.Sprintf("%20d", i)), EndKey: []byte(fmt.Sprintf("%20d", i+1))} rangeTree.Update(item) diff --git a/pkg/storage/gcs.go b/pkg/storage/gcs.go index 4af3ea059..35063724c 100644 --- a/pkg/storage/gcs.go +++ b/pkg/storage/gcs.go @@ -32,7 +32,6 @@ type GCSBackendOptions struct { } func (options *GCSBackendOptions) apply(gcs *backup.GCS) error { - gcs.Endpoint = options.Endpoint gcs.StorageClass = options.StorageClass gcs.PredefinedAcl = options.PredefinedACL diff --git a/pkg/storage/gcs_test.go b/pkg/storage/gcs_test.go index 60a26f616..05217518a 100644 --- a/pkg/storage/gcs_test.go +++ b/pkg/storage/gcs_test.go @@ -21,7 +21,7 @@ func (r *testStorageSuite) TestGCS(c *C) { server, err := fakestorage.NewServerWithOptions(opts) c.Assert(err, IsNil) bucketName := "testbucket" - server.CreateBucket(bucketName) + server.CreateBucketWithOpts(fakestorage.CreateBucketOpts{Name: bucketName}) gcs := &backup.GCS{ Bucket: bucketName, @@ -65,7 +65,7 @@ func (r *testStorageSuite) TestNewGCSStorage(c *C) { server, err := fakestorage.NewServerWithOptions(opts) c.Assert(err, IsNil) bucketName := "testbucket" - server.CreateBucket(bucketName) + server.CreateBucketWithOpts(fakestorage.CreateBucketOpts{Name: bucketName}) { gcs := &backup.GCS{ diff --git a/pkg/storage/local.go b/pkg/storage/local.go index d2555a978..319ed74d8 100644 --- a/pkg/storage/local.go +++ b/pkg/storage/local.go @@ -9,14 +9,15 @@ import ( "path" ) -// localStorage represents local file system storage +// localStorage represents local file system storage. type localStorage struct { base string } func (l *localStorage) Write(ctx context.Context, name string, data []byte) error { filepath := path.Join(l.base, name) - return ioutil.WriteFile(filepath, data, 0644) + return ioutil.WriteFile(filepath, data, 0644) // nolint:gosec + // the backupmeta file _is_ intended to be world-readable. } func (l *localStorage) Read(ctx context.Context, name string) ([]byte, error) { diff --git a/pkg/storage/parse_test.go b/pkg/storage/parse_test.go index 51669a806..dc4e11124 100644 --- a/pkg/storage/parse_test.go +++ b/pkg/storage/parse_test.go @@ -142,5 +142,4 @@ func (r *testStorageSuite) TestFormatBackendURL(c *C) { }, }) c.Assert(url.String(), Equals, "gcs://bucket/some%20prefix/") - } diff --git a/pkg/storage/s3.go b/pkg/storage/s3.go index 00107e2b9..aaa9b5826 100644 --- a/pkg/storage/s3.go +++ b/pkg/storage/s3.go @@ -33,7 +33,7 @@ const ( maxRetries = 3 ) -// s3Handlers make it easy to inject test functions +// s3Handlers make it easy to inject test functions. type s3Handlers interface { HeadObjectWithContext(context.Context, *s3.HeadObjectInput, ...request.Option) (*s3.HeadObjectOutput, error) GetObjectWithContext(context.Context, *s3.GetObjectInput, ...request.Option) (*s3.GetObjectOutput, error) @@ -42,14 +42,14 @@ type s3Handlers interface { WaitUntilObjectExistsWithContext(context.Context, *s3.HeadObjectInput, ...request.WaiterOption) error } -// S3Storage info for s3 storage +// S3Storage info for s3 storage. type S3Storage struct { session *session.Session svc s3Handlers options *backup.S3 } -// S3BackendOptions contains options for s3 storage +// S3BackendOptions contains options for s3 storage. type S3BackendOptions struct { Endpoint string `json:"endpoint" toml:"endpoint"` Region string `json:"region" toml:"region"` @@ -211,7 +211,7 @@ func newS3Storage( // revive:disable-line:flag-parameter }, nil } -// checkBucket checks if a bucket exists +// checkBucket checks if a bucket exists. var checkS3Bucket = func(svc *s3.S3, bucket string) error { input := &s3.HeadBucketInput{ Bucket: aws.String(bucket), diff --git a/pkg/storage/s3_test.go b/pkg/storage/s3_test.go index bd35b6faf..3e3d874fb 100644 --- a/pkg/storage/s3_test.go +++ b/pkg/storage/s3_test.go @@ -99,8 +99,8 @@ func (r *testStorageSuite) TestApplyUpdate(c *C) { s3 := u.GetS3() c.Assert(err, IsNil) c.Assert(s3, DeepEquals, test.s3) - } + tests := []testcase{ { name: "no region and no endpoint", diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 91143ca54..50bedc710 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -9,7 +9,7 @@ import ( "github.com/pingcap/kvproto/pkg/backup" ) -// ExternalStorage represents a kind of file system storage +// ExternalStorage represents a kind of file system storage. type ExternalStorage interface { // Write file to storage Write(ctx context.Context, name string, data []byte) error diff --git a/pkg/summary/collector.go b/pkg/summary/collector.go index 76dd8a121..7691f5980 100644 --- a/pkg/summary/collector.go +++ b/pkg/summary/collector.go @@ -23,7 +23,7 @@ const ( TotalBytes = "total bytes" ) -// LogCollector collects infos into summary log +// LogCollector collects infos into summary log. type LogCollector interface { SetUnit(unit string) diff --git a/pkg/utils/key_test.go b/pkg/utils/key_test.go index 3e20bae24..211515e70 100644 --- a/pkg/utils/key_test.go +++ b/pkg/utils/key_test.go @@ -30,7 +30,6 @@ func (r *testKeySuite) TestParseKey(c *C) { _, err = ParseKey("notSupport", rawKey) c.Assert(err, ErrorMatches, "*unknown format*") - } func (r *testKeySuite) TestCompareEndKey(c *C) { diff --git a/pkg/utils/progress.go b/pkg/utils/progress.go index da6b20364..f3ea8b5fe 100644 --- a/pkg/utils/progress.go +++ b/pkg/utils/progress.go @@ -12,7 +12,7 @@ import ( "go.uber.org/zap" ) -// ProgressPrinter prints a progress bar +// ProgressPrinter prints a progress bar. type ProgressPrinter struct { name string total int64 diff --git a/pkg/utils/retry.go b/pkg/utils/retry.go index 1dbbcdad2..4f5e5ec05 100644 --- a/pkg/utils/retry.go +++ b/pkg/utils/retry.go @@ -7,10 +7,10 @@ import ( "time" ) -// RetryableFunc presents a retryable opreation +// RetryableFunc presents a retryable operation. type RetryableFunc func() error -// Backoffer implements a backoff policy for retrying operations +// Backoffer implements a backoff policy for retrying operations. type Backoffer interface { // NextBackoff returns a duration to wait before retrying again NextBackoff(err error) time.Duration diff --git a/pkg/utils/unit.go b/pkg/utils/unit.go index 253d97eb6..7f1fc04e3 100644 --- a/pkg/utils/unit.go +++ b/pkg/utils/unit.go @@ -2,11 +2,15 @@ package utils -// unit of storage const ( + // B is number of bytes in one byte. B = uint64(1) << (iota * 10) + // KB is number of bytes in one kibibyte. KB + // MB is number of bytes in one mebibyte. MB + // GB is number of bytes in one gibibyte. GB + // TB is number of bytes in one tebibyte. TB ) diff --git a/pkg/utils/worker.go b/pkg/utils/worker.go index 2d800ddcd..25c128a17 100644 --- a/pkg/utils/worker.go +++ b/pkg/utils/worker.go @@ -7,14 +7,14 @@ import ( "go.uber.org/zap" ) -// WorkerPool contains a pool of workers +// WorkerPool contains a pool of workers. type WorkerPool struct { limit uint workers chan *Worker name string } -// Worker identified by ID +// Worker identified by ID. type Worker struct { ID uint64 } diff --git a/tools/go.mod b/tools/go.mod index 489a62fa0..f81d65744 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -5,8 +5,9 @@ go 1.13 require ( github.com/dnephin/govet v0.0.0-20171012192244-4a96d43e39d3 github.com/go-playground/overalls v0.0.0-20191218162659-7df9f728c018 - github.com/golangci/golangci-lint v1.25.0 + github.com/golangci/golangci-lint v1.26.0 github.com/mgechev/revive v1.0.2 github.com/yookoala/realpath v1.0.0 // indirect golang.org/x/tools v0.0.0-20200422205258-72e4a01eba43 + gopkg.in/go-playground/assert.v1 v1.2.1 // indirect ) diff --git a/tools/go.sum b/tools/go.sum index 8779d03b8..3ffe0be55 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -1,6 +1,8 @@ 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/Djarvur/go-err113 v0.0.0-20200410182137-af658d038157 h1:hY39LwQHh+1kaovmIjOrlqnXNX6tygSRfLkkK33IkZU= +github.com/Djarvur/go-err113 v0.0.0-20200410182137-af658d038157/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/OpenPeeDeeP/depguard v1.0.1 h1:VlW4R6jmBIv3/u1JNlawEvJMM4J+dPORPaZasQee8Us= github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= @@ -100,8 +102,8 @@ github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee h1:J2XAy40+7yz70u github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee/go.mod h1:ozx7R9SIwqmqf5pRP90DhR2Oay2UIjGuKheCBCNwAYU= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a/go.mod h1:9qCChq59u/eW8im404Q2WWTrnBUQKjpNYKMbU4M7EFU= -github.com/golangci/golangci-lint v1.25.0 h1:fwVdXtCBBCmk9e/7bTjkeCMx52bhq1IqmEQOVDbHXcg= -github.com/golangci/golangci-lint v1.25.0/go.mod h1:BaJNZmLU6vdaTLEGJKTTL/05I3B2OfXaD9SrNVkwr7w= +github.com/golangci/golangci-lint v1.26.0 h1:CLLGRSA9BLMiNvsWPXHioYAdfIx9tkgdVWyA6bIdYCo= +github.com/golangci/golangci-lint v1.26.0/go.mod h1:tefbO6RcigFzvTnDC+Y51kntVGgkuCAVsC+mnfbPruc= github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc h1:gLLhTLMk2/SutryVJ6D4VZCU3CUqr8YloG7FPIBWFpI= github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc/go.mod h1:e5tpTHCfVze+7EpLEozzMB3eafxo2KT5veNg1k6byQU= github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 h1:MfyDlzVjl1hoaPzPD4Gpb/QgoRfSBR0jdhwGyAWwMSA= @@ -187,7 +189,7 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk github.com/mitchellh/go-ps v0.0.0-20190716172923-621e5597135b/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mozilla/tls-observatory v0.0.0-20190404164649-a3c1b6cfecfd/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= +github.com/mozilla/tls-observatory v0.0.0-20200220173314-aae45faa4006/go.mod h1:SrKMQvPiws7F7iqYp8/TX+IhxCYhzr6N/1yb8cwHsGk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nakabonne/nestif v0.3.0 h1:+yOViDGhg8ygGrmII72nV9B/zGxY188TYpfolntsaPw= github.com/nakabonne/nestif v0.3.0/go.mod h1:dI314BppzXjJ4HsCnbo7XzrJHPszZsjnk5wEBSYHI2c= @@ -198,10 +200,11 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.11.0 h1:JAKSXpt1YjtLA7YpPiqO9ss6sNXEsPfSGdwN0UHqzrw= -github.com/onsi/ginkgo v1.11.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.8.1 h1:C5Dqfs/LeauYDX0jJXIe2SWmwCbGzx9yF8C8xy3Lh34= -github.com/onsi/gomega v1.8.1/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= +github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU= +github.com/onsi/ginkgo v1.12.0/go.mod h1:oUhWkIvk5aDxtKvDDuw8gItl8pKl42LzjC9KZE0HfGg= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.9.0 h1:R1uwffexN6Pr340GtYRIdZmAiN4J+iw6WG4wog1DUXg= +github.com/onsi/gomega v1.9.0/go.mod h1:Ho0h+IUsWyvy1OpqCwxlQ/21gkhVunqlU8fDGcoTdcA= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -225,10 +228,10 @@ github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1: github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= -github.com/ryancurrah/gomodguard v1.0.2 h1:vumZpZardqQ9EfFIZDNEpKaMxfqqEBMhu0uSRcDO5x4= -github.com/ryancurrah/gomodguard v1.0.2/go.mod h1:9T/Cfuxs5StfsocWr4WzDL36HqnX0fVb9d5fSEaLhoE= -github.com/securego/gosec v0.0.0-20200103095621-79fbf3af8d83 h1:AtnWoOvTioyDXFvu96MWEeE8qj4COSQnJogzLy/u41A= -github.com/securego/gosec v0.0.0-20200103095621-79fbf3af8d83/go.mod h1:vvbZ2Ae7AzSq3/kywjUDxSNq2SJ27RxCz2un0H3ePqE= +github.com/ryancurrah/gomodguard v1.0.4 h1:oCreMAt9GuFXDe9jW4HBpc3GjdX3R/sUEcLAGh1zPx8= +github.com/ryancurrah/gomodguard v1.0.4/go.mod h1:9T/Cfuxs5StfsocWr4WzDL36HqnX0fVb9d5fSEaLhoE= +github.com/securego/gosec v0.0.0-20200316084457-7da9f46445fd h1:qB+l4fYZsH78xORC1aqVS0zNmgkQp4rkj2rvfxQMtzc= +github.com/securego/gosec v0.0.0-20200316084457-7da9f46445fd/go.mod h1:NurAFZsWJAEZjogSwdVPlHkOZB3DOAU7gsPP8VFZCHc= github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e h1:MZM7FHLqUHYI0Y/mQAt3d2aYa0SiNms/hFqC9qJYolM= @@ -271,8 +274,10 @@ github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/tetafro/godot v0.2.5 h1:7+EYJM/Z4gYZhBFdRrVm6JTj5ZLw/QI1j4RfEOXJviE= -github.com/tetafro/godot v0.2.5/go.mod h1:pT6/T8+h6//L/LwQcFc4C0xpfy1euZwzS1sHdrFCms0= +github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2 h1:Xr9gkxfOP0KQWXKNqmwe8vEeSUiUj4Rlee9CMVX2ZUQ= +github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= +github.com/tetafro/godot v0.3.3 h1:uJjg8N+Ee10rAnaqJGet1WeI0YW4fiX9pKbwqnsqH6k= +github.com/tetafro/godot v0.3.3/go.mod h1:pT6/T8+h6//L/LwQcFc4C0xpfy1euZwzS1sHdrFCms0= github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e h1:RumXZ56IrCj4CL+g1b9OL/oH0QnsF976bC8xQFYUD5Q= github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= @@ -294,6 +299,7 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yookoala/realpath v1.0.0 h1:7OA9pj4FZd+oZDsyvXWQvjn5oBdcHRTV44PpdMSuImQ= github.com/yookoala/realpath v1.0.0/go.mod h1:gJJMA9wuX7AcqLy1+ffPatSCySA1FQ2S8Ya9AIoYBpE= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -306,6 +312,7 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= @@ -340,9 +347,10 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e h1:N7DeIrjYszNmSW409R3frPPwglRwMkXSBzwVbkOjLLA= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -364,8 +372,11 @@ golang.org/x/tools v0.0.0-20190719005602-e377ae9d6386/go.mod h1:jcCCGcm9btYwXyDq golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/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-20200102140908-9497f49d5709/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200225230052-807dcd883420/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200228224639-71482053b885/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200324003944-a576cf524670/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200414032229-332987a829c3/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200422022333-3d57cf2e726e/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200422205258-72e4a01eba43 h1:Lcsc5ErIWemp8qAbYffG5vPrqjJ0zk82RTFGifeS1Pc= golang.org/x/tools v0.0.0-20200422205258-72e4a01eba43/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= @@ -387,6 +398,8 @@ gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/go-playground/assert.v1 v1.2.1 h1:xoYuJVE7KT85PYWrN730RguIQO0ePzVRfFMXadIrXTM= +gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE= gopkg.in/ini.v1 v1.51.0 h1:AQvPpx3LzTDM0AjnIRlVFwFFGC+npRopjZxLJj6gdno= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= @@ -396,7 +409,6 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl 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.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= From ee558e21e2b628f317dec6f3b49affd95138e0b5 Mon Sep 17 00:00:00 2001 From: kennytm Date: Tue, 12 May 2020 04:24:40 +0800 Subject: [PATCH 2/2] *: fix build error and fix lints --- cmd/cmd.go | 2 +- cmd/restore.go | 2 +- go.mod | 14 ++----------- go.sum | 23 ++++++++++++++++++-- pkg/backup/client.go | 10 ++++----- pkg/backup/safe_point.go | 2 +- pkg/backup/schema.go | 2 +- pkg/checksum/executor.go | 8 +++---- pkg/conn/conn.go | 12 +++++------ pkg/gluetidb/glue.go | 18 ++++++++-------- pkg/gluetikv/glue.go | 14 ++++++------- pkg/mock/mock_cluster.go | 4 ++-- pkg/restore/client.go | 44 +++++++++++++++++++-------------------- pkg/restore/db.go | 8 +++---- pkg/restore/import.go | 2 +- pkg/restore/split.go | 2 +- pkg/restore/util.go | 6 +++--- pkg/rtree/rtree.go | 8 +++---- pkg/storage/gcs.go | 6 +++--- pkg/storage/local.go | 2 +- pkg/storage/noop.go | 6 +++--- pkg/storage/parse_test.go | 2 +- pkg/storage/s3.go | 8 +++---- pkg/storage/storage.go | 2 +- pkg/summary/collector.go | 2 +- pkg/summary/summary.go | 14 ++++++------- pkg/task/backup.go | 2 +- pkg/task/common.go | 4 ++-- pkg/task/restore.go | 4 ++-- pkg/utils/key.go | 2 +- pkg/utils/pd.go | 6 +++--- pkg/utils/progress.go | 6 +++--- pkg/utils/retry.go | 2 +- pkg/utils/schema.go | 2 +- pkg/utils/version.go | 2 +- pkg/utils/worker.go | 6 +++--- tools/go.sum | 4 ++++ 37 files changed, 138 insertions(+), 125 deletions(-) diff --git a/cmd/cmd.go b/cmd/cmd.go index ae0dd8d9d..89ad4b753 100644 --- a/cmd/cmd.go +++ b/cmd/cmd.go @@ -140,7 +140,7 @@ func Init(cmd *cobra.Command) (err error) { return err } -// HasLogFile returns whether we set a log file +// HasLogFile returns whether we set a log file. func HasLogFile() bool { return atomic.LoadUint64(&hasLogFile) != uint64(0) } diff --git a/cmd/restore.go b/cmd/restore.go index 1e894b4ee..547501d95 100644 --- a/cmd/restore.go +++ b/cmd/restore.go @@ -42,7 +42,7 @@ func runRestoreTiflashReplicaCommand(command *cobra.Command, cmdName string) err return task.RunRestoreTiflashReplica(GetDefaultContext(), tidbGlue, cmdName, &cfg) } -// NewRestoreCommand returns a restore subcommand +// NewRestoreCommand returns a restore subcommand. func NewRestoreCommand() *cobra.Command { command := &cobra.Command{ Use: "restore", diff --git a/go.mod b/go.mod index cfe9b90d6..e93409777 100644 --- a/go.mod +++ b/go.mod @@ -6,25 +6,18 @@ require ( cloud.google.com/go/storage v1.5.0 github.com/aws/aws-sdk-go v1.30.24 github.com/cheggaaa/pb/v3 v3.0.4 - github.com/coreos/go-semver v0.3.0 // indirect - github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect github.com/fsouza/fake-gcs-server v1.17.0 github.com/go-sql-driver/mysql v1.5.0 github.com/gogo/protobuf v1.3.1 github.com/google/btree v1.0.0 github.com/google/uuid v1.1.1 - github.com/klauspost/cpuid v1.2.0 // indirect - github.com/montanaflynn/stats v0.5.0 // indirect - github.com/onsi/ginkgo v1.11.0 // indirect - github.com/onsi/gomega v1.8.1 // indirect - github.com/opentracing/opentracing-go v1.1.0 // indirect github.com/pingcap/check v0.0.0-20200212061837-5e12011dc712 github.com/pingcap/errors v0.11.5-0.20190809092503-95897b64e011 github.com/pingcap/kvproto v0.0.0-20200509065137-6a4d5c264a8b github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd - github.com/pingcap/parser v0.0.0-20200507065322-e562e27ebd85 + github.com/pingcap/parser v0.0.0-20200427031542-879c7bd4f27d github.com/pingcap/pd/v4 v4.0.0-rc.1.0.20200511074607-3bb650739add - github.com/pingcap/tidb v1.1.0-beta.0.20200424154252-5ede18f10eed + github.com/pingcap/tidb v1.1.0-beta.0.20200511122205-5cc5d0e2acad github.com/pingcap/tidb-tools v4.0.0-rc.1.0.20200421113014-507d2bb3a15e+incompatible github.com/pingcap/tipb v0.0.0-20200417094153-7316d94df1ee github.com/prometheus/client_golang v1.5.1 @@ -32,9 +25,6 @@ require ( github.com/sirupsen/logrus v1.6.0 github.com/spf13/cobra v1.0.0 github.com/spf13/pflag v1.0.5 - github.com/syndtr/goleveldb v1.0.1-0.20190625010220-02440ea7a285 // indirect - github.com/uber/jaeger-client-go v2.22.1+incompatible // indirect - github.com/uber/jaeger-lib v2.2.0+incompatible // indirect go.etcd.io/etcd v0.5.0-alpha.5.0.20191023171146-3cf2f69b5738 go.uber.org/zap v1.15.0 golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6 diff --git a/go.sum b/go.sum index 8b44a559e..6900ed729 100644 --- a/go.sum +++ b/go.sum @@ -21,6 +21,7 @@ cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2k cloud.google.com/go/pubsub v1.1.0 h1:9/vpR43S4aJaROxqQHQ3nH9lfyKKV0dC3vOmnw8ebQQ= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.4.0/go.mod h1:ZusYJWlOshgSBGbt6K3GnB3MT3H1xs2id9+TCl4fDBA= cloud.google.com/go/storage v1.5.0 h1:RPUcBvDeYgQFMfQu1eBMq6piD1SXmLH+vK3qjewZPus= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= @@ -49,6 +50,7 @@ github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod h1:V8iCPQY github.com/appleboy/gin-jwt/v2 v2.6.3/go.mod h1:MfPYA4ogzvOcVkRwAxT7quHOtQmVKDpTwxyUrC2DNw0= github.com/appleboy/gofight/v2 v2.1.2/go.mod h1:frW+U1QZEdDgixycTj4CygQ48yLTUhplt43+Wczp3rw= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= +github.com/aws/aws-sdk-go v1.26.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.30.24 h1:y3JPD51VuEmVqN3BEDVm4amGpDma2cKJcDPuAU1OR58= github.com/aws/aws-sdk-go v1.30.24/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= @@ -64,6 +66,7 @@ github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cheggaaa/pb/v3 v3.0.1/go.mod h1:SqqeMF/pMOIu3xgGoxtPYhMNQP258xE4x/XRTYua+KU= github.com/cheggaaa/pb/v3 v3.0.4 h1:QZEPYOj2ix6d5oEg63fbHmpolrnNiwjUsk+h74Yt4bM= github.com/cheggaaa/pb/v3 v3.0.4/go.mod h1:7rgWxLrAUcFMkvJuv09+DYi7mMUYi8nO9iOWcvGJPfw= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -78,6 +81,7 @@ github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= github.com/coreos/etcd v3.3.10+incompatible h1:jFneRYjIvLMLhDLCzuTuU4rSJUjRplcJQ7pD7MnhC04= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= 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-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= @@ -92,6 +96,7 @@ github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfc github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbpBpLoyyu8B6e44T7hJy6potg= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/corona10/goimagehash v1.0.2/go.mod h1:/l9umBhvcHQXVtQO1V6Gp1yD20STawkhRnnX0D1bvVI= +github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= @@ -137,6 +142,7 @@ github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4 github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsouza/fake-gcs-server v1.15.0/go.mod h1:HNxAJ/+FY/XSsxuwz8iIYdp2GtMmPbJ8WQjjGMxd6Qk= github.com/fsouza/fake-gcs-server v1.17.0 h1:OeH75kBZcZa3ZE+zz/mFdJ2btt9FgqfjI7gIh9+5fvk= github.com/fsouza/fake-gcs-server v1.17.0/go.mod h1:D1rTE4YCyHFNa99oyJJ5HyclvN/0uQR+pM/VdlL83bw= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -279,6 +285,7 @@ github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJS github.com/jinzhu/gorm v1.9.12/go.mod h1:vhTjlKSJUTWNtcbQtrMBFCxy7eXTzeCAzfL5fBZT/Qs= github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= github.com/jinzhu/now v1.0.1/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.3.0 h1:OS12ieG61fsCg5+qLJ+SsW9NicxNkg3b25OyT2yCeUc= github.com/jmespath/go-jmespath v0.3.0/go.mod h1:9QtRXoHjLGCJ5IBSaohpXITPlowMeeYCZ7fLUTSywik= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= @@ -342,6 +349,7 @@ github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcME github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= +github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= @@ -399,6 +407,7 @@ github.com/phf/go-queue v0.0.0-20170504031614-9abe38d0371d h1:U+PMnTlV2tu7RuMK5e github.com/phf/go-queue v0.0.0-20170504031614-9abe38d0371d/go.mod h1:lXfE4PvvTW5xOjO6Mba8zDPyw8M93B6AQ7frTGnMlA8= github.com/pingcap-incubator/tidb-dashboard v0.0.0-20200407064406-b2b8ad403d01/go.mod h1:77fCh8d3oKzC5ceOJWeZXAS/mLzVgdZ7rKniwmOyFuo= github.com/pingcap-incubator/tidb-dashboard v0.0.0-20200424032813-662fb05948e7/go.mod h1:DwotQY91ds7eiwnY6QrQX9t5iimDtsJVIjI9tZYMaUM= +github.com/pingcap/br v0.0.0-20200426093517-dd11ae28b885/go.mod h1:4w3meMnk7HDNpNgjuRAxavruTeKJvUiXxoEWTjzXPnA= 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/check v0.0.0-20191107115940-caf2b9e6ccf4 h1:iRtOAQ6FXkY/BGvst3CDfTva4nTqh6CL8WXvanLdbu0= @@ -425,6 +434,8 @@ github.com/pingcap/kvproto v0.0.0-20191211054548-3c6b38ea5107/go.mod h1:WWLmULLO github.com/pingcap/kvproto v0.0.0-20200214064158-62d31900d88e/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= github.com/pingcap/kvproto v0.0.0-20200417092353-efbe03bcffbd/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= github.com/pingcap/kvproto v0.0.0-20200420075417-e0c6e8842f22/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= +github.com/pingcap/kvproto v0.0.0-20200423020121-038e31959c2a/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= +github.com/pingcap/kvproto v0.0.0-20200424032552-6650270c39c3/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= github.com/pingcap/kvproto v0.0.0-20200509065137-6a4d5c264a8b h1:lzOE8Z3TnbgpK8d1h4Jze/SKJrQ7gHgLeUVy0vi0l6o= github.com/pingcap/kvproto v0.0.0-20200509065137-6a4d5c264a8b/go.mod h1:IOdRDPLyda8GX2hE/jO7gqaCV/PNFh8BZQCQZXfIOqI= github.com/pingcap/log v0.0.0-20191012051959-b742a5d432e9 h1:AJD9pZYm72vMgPcQDww9rkZ1DnWfl0pXV3BOWlkYIjA= @@ -433,8 +444,8 @@ github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd h1:CV3VsP3Z02MVtdpTMfE github.com/pingcap/log v0.0.0-20200117041106-d28c14d3b1cd/go.mod h1:4rbK1p9ILyIfb6hU7OG2CiWSqMXnp3JMbiaVJ6mvoY8= github.com/pingcap/parser v0.0.0-20200424075042-8222d8b724a4 h1:1dFbm4zVXWvdwjEdyjMlu1PCxnlxK+JfNq+HhbGjDtc= github.com/pingcap/parser v0.0.0-20200424075042-8222d8b724a4/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4= -github.com/pingcap/parser v0.0.0-20200507065322-e562e27ebd85 h1:GPpy0eUg9WnbQ879aDvIn8pDQl/NiIzPEZ2QVIT19CI= -github.com/pingcap/parser v0.0.0-20200507065322-e562e27ebd85/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4= +github.com/pingcap/parser v0.0.0-20200427031542-879c7bd4f27d h1:iXKcmBOj5v8Vw4jbiWdY0LKyhJinSwqd1Hwyi0NvxBY= +github.com/pingcap/parser v0.0.0-20200427031542-879c7bd4f27d/go.mod h1:9v0Edh8IbgjGYW2ArJr19E+bvL8zKahsFp+ixWeId+4= github.com/pingcap/pd/v4 v4.0.0-rc.1.0.20200422143320-428acd53eba2 h1:JTzYYukREvxVSKW/ncrzNjFitd8snoQ/Xz32pw8i+s8= github.com/pingcap/pd/v4 v4.0.0-rc.1.0.20200422143320-428acd53eba2/go.mod h1:s+utZtXDznOiL24VK0qGmtoHjjXNsscJx3m1n8cC56s= github.com/pingcap/pd/v4 v4.0.0-rc.1.0.20200511074607-3bb650739add h1:a/H871xZl++EjOvYmFLXBVKcV75dCj5GQfuHMA8tQHk= @@ -444,6 +455,8 @@ github.com/pingcap/sysutil v0.0.0-20200408114249-ed3bd6f7fdb1 h1:PI8YpTl45F8ilNk github.com/pingcap/sysutil v0.0.0-20200408114249-ed3bd6f7fdb1/go.mod h1:EB/852NMQ+aRKioCpToQ94Wl7fktV+FNnxf3CX/TTXI= github.com/pingcap/tidb v1.1.0-beta.0.20200424154252-5ede18f10eed h1:5mKxIq52K8pZaoKay6K6MLWIcOza8ok+kEyzOk4jYvU= github.com/pingcap/tidb v1.1.0-beta.0.20200424154252-5ede18f10eed/go.mod h1:m2VDlJDbUeHPCXAfKPajqLmB1uLvWpkKk3zALNqDYdw= +github.com/pingcap/tidb v1.1.0-beta.0.20200511122205-5cc5d0e2acad h1:PelGZ5APxRnrtLUUQcpkPHjQeoMyvug6YuZDp6d+n18= +github.com/pingcap/tidb v1.1.0-beta.0.20200511122205-5cc5d0e2acad/go.mod h1:Ie9gC7tgjgGQYg3qtIvb5DYWKaOR2Gp7BXdqXD6kjv4= github.com/pingcap/tidb-tools v4.0.0-beta.1.0.20200306084441-875bd09aa3d5+incompatible h1:84F7MFMfdAYObrznvRslmVu43aoihrlL+7mMyMlOi0o= github.com/pingcap/tidb-tools v4.0.0-beta.1.0.20200306084441-875bd09aa3d5+incompatible/go.mod h1:XGdcy9+yqlDSEMTpOXnwf3hiTeqrV6MN/u1se9N8yIM= github.com/pingcap/tidb-tools v4.0.0-rc.1.0.20200421113014-507d2bb3a15e+incompatible h1:+K5bqDYG5HT+GqLdx4GH5VmS84+xHgpHbGg6Xt6qQec= @@ -490,6 +503,7 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So 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/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sasha-s/go-deadlock v0.2.0/go.mod h1:StQn567HiB1fF2yJ44N9au7wOhrPS3iZqiDbRupzT10= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= @@ -518,6 +532,7 @@ github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= @@ -527,6 +542,7 @@ github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= 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= @@ -575,6 +591,7 @@ github.com/ugorji/go v1.1.5-pre/go.mod h1:FwP/aQVg39TXzItUBMwnWp9T9gPQnXw4Poh4/o github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181022190402-e5e69e061d4f/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= +github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.5-pre/go.mod h1:tULtS6Gy1AE1yCENaw4Vb//HLH5njI2tfCQDUqRd8fI= github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= @@ -635,6 +652,7 @@ go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= go.uber.org/zap v1.15.0 h1:ZZCA22JRF2gQE5FoNmhmrf7jeJJ2uhqDUNRYKm8dvmM= go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/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-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -725,6 +743,7 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= diff --git a/pkg/backup/client.go b/pkg/backup/client.go index e05534bb3..38e2d4380 100644 --- a/pkg/backup/client.go +++ b/pkg/backup/client.go @@ -72,7 +72,7 @@ type Client struct { gcTTL int64 } -// NewBackupClient returns a new backup client +// NewBackupClient returns a new backup client. func NewBackupClient(ctx context.Context, mgr ClientMgr) (*Client, error) { log.Info("new backup client") pdClient := mgr.GetPDClient() @@ -122,7 +122,7 @@ func (bc *Client) GetTS(ctx context.Context, duration time.Duration, ts uint64) return backupTS, nil } -// SetGCTTL set gcTTL for client +// SetGCTTL set gcTTL for client. func (bc *Client) SetGCTTL(ttl int64) { bc.gcTTL = ttl } @@ -132,7 +132,7 @@ func (bc *Client) GetGCTTL() int64 { return bc.gcTTL } -// SetStorage set ExternalStorage for client +// SetStorage set ExternalStorage for client. func (bc *Client) SetStorage(ctx context.Context, backend *kvproto.StorageBackend, sendCreds bool) error { var err error bc.storage, err = storage.Create(ctx, backend, sendCreds) @@ -291,7 +291,7 @@ func BuildBackupRangeAndSchema( return ranges, backupSchemas, nil } -// GetBackupDDLJobs returns the ddl jobs are done in (lastBackupTS, backupTS] +// GetBackupDDLJobs returns the ddl jobs are done in (lastBackupTS, backupTS]. func GetBackupDDLJobs(dom *domain.Domain, lastBackupTS, backupTS uint64) ([]*model.Job, error) { snapMeta, err := dom.GetSnapshotMeta(backupTS) if err != nil { @@ -876,7 +876,7 @@ func (bc *Client) CollectChecksums() ([]Checksum, error) { return checksums, nil } -// CompleteMeta wait response of admin checksum from TiDB to complete backup meta +// CompleteMeta wait response of admin checksum from TiDB to complete backup meta. func (bc *Client) CompleteMeta(backupSchemas *Schemas) error { schemas, err := backupSchemas.FinishTableChecksum() if err != nil { diff --git a/pkg/backup/safe_point.go b/pkg/backup/safe_point.go index b867852c9..83be5c9fc 100644 --- a/pkg/backup/safe_point.go +++ b/pkg/backup/safe_point.go @@ -42,7 +42,7 @@ func CheckGCSafePoint(ctx context.Context, pdClient pd.Client, ts uint64) error return nil } -// UpdateServiceSafePoint register backupTS to PD, to lock down backupTS as safePoint with ttl seconds +// UpdateServiceSafePoint register backupTS to PD, to lock down backupTS as safePoint with ttl seconds. func UpdateServiceSafePoint(ctx context.Context, pdClient pd.Client, ttl int64, backupTS uint64) error { log.Debug("update PD safePoint limit with ttl", zap.Uint64("safePoint", backupTS), diff --git a/pkg/backup/schema.go b/pkg/backup/schema.go index 59bb8b5b9..edcd2c293 100644 --- a/pkg/backup/schema.go +++ b/pkg/backup/schema.go @@ -56,7 +56,7 @@ func (pending *Schemas) pushPending( pending.schemas[name] = schema } -// Start backups schemas +// Start backups schemas. func (pending *Schemas) Start( ctx context.Context, store kv.Storage, diff --git a/pkg/checksum/executor.go b/pkg/checksum/executor.go index ff884c65a..4860b02a0 100644 --- a/pkg/checksum/executor.go +++ b/pkg/checksum/executor.go @@ -28,7 +28,7 @@ type ExecutorBuilder struct { oldTable *utils.Table } -// NewExecutorBuilder returns a new executor builder +// NewExecutorBuilder returns a new executor builder. func NewExecutorBuilder(table *model.TableInfo, ts uint64) *ExecutorBuilder { return &ExecutorBuilder{ table: table, @@ -36,13 +36,13 @@ func NewExecutorBuilder(table *model.TableInfo, ts uint64) *ExecutorBuilder { } } -// SetOldTable set a old table info to the builder +// SetOldTable set a old table info to the builder. func (builder *ExecutorBuilder) SetOldTable(oldTable *utils.Table) *ExecutorBuilder { builder.oldTable = oldTable return builder } -// Build builds a checksum executor +// Build builds a checksum executor. func (builder *ExecutorBuilder) Build() (*Executor, error) { reqs, err := buildChecksumRequest(builder.table, builder.oldTable, builder.ts) if err != nil { @@ -246,7 +246,7 @@ type Executor struct { reqs []*kv.Request } -// Len returns the total number of checksum requests +// Len returns the total number of checksum requests. func (exec *Executor) Len() int { return len(exec.reqs) } diff --git a/pkg/conn/conn.go b/pkg/conn/conn.go index f43e7aaa2..20398c639 100644 --- a/pkg/conn/conn.go +++ b/pkg/conn/conn.go @@ -237,13 +237,13 @@ func NewMgr( return mgr, nil } -// SetPDHTTP set pd addrs and cli for test +// SetPDHTTP set pd addrs and cli for test. func (mgr *Mgr) SetPDHTTP(addrs []string, cli *http.Client) { mgr.pdHTTP.addrs = addrs mgr.pdHTTP.cli = cli } -// SetPDClient set pd addrs and cli for test +// SetPDClient set pd addrs and cli for test. func (mgr *Mgr) SetPDClient(pdClient pd.Client) { mgr.pdClient = pdClient } @@ -362,7 +362,7 @@ func (mgr *Mgr) GetTiKV() tikv.Storage { return mgr.storage } -// GetTLSConfig returns the tls config +// GetTLSConfig returns the tls config. func (mgr *Mgr) GetTLSConfig() *tls.Config { return mgr.tlsConf } @@ -377,7 +377,7 @@ func (mgr *Mgr) GetDomain() *domain.Domain { return mgr.dom } -// RemoveScheduler remove pd scheduler +// RemoveScheduler remove pd scheduler. func (mgr *Mgr) RemoveScheduler(ctx context.Context, scheduler string) error { return mgr.removeSchedulerWith(ctx, scheduler, pdRequest) } @@ -394,7 +394,7 @@ func (mgr *Mgr) removeSchedulerWith(ctx context.Context, scheduler string, delet return err } -// AddScheduler add pd scheduler +// AddScheduler add pd scheduler. func (mgr *Mgr) AddScheduler(ctx context.Context, scheduler string) error { return mgr.addSchedulerWith(ctx, scheduler, pdRequest) } @@ -411,7 +411,7 @@ func (mgr *Mgr) addSchedulerWith(ctx context.Context, scheduler string, post pdH return err } -// ListSchedulers list all pd scheduler +// ListSchedulers list all pd scheduler. func (mgr *Mgr) ListSchedulers(ctx context.Context) ([]string, error) { return mgr.listSchedulersWith(ctx, pdRequest) } diff --git a/pkg/gluetidb/glue.go b/pkg/gluetidb/glue.go index 73ef66e4f..73443f796 100644 --- a/pkg/gluetidb/glue.go +++ b/pkg/gluetidb/glue.go @@ -26,12 +26,12 @@ type tidbSession struct { se session.Session } -// GetDomain implements glue.Glue +// GetDomain implements glue.Glue. func (Glue) GetDomain(store kv.Storage) (*domain.Domain, error) { return session.GetDomain(store) } -// CreateSession implements glue.Glue +// CreateSession implements glue.Glue. func (Glue) CreateSession(store kv.Storage) (glue.Session, error) { se, err := session.CreateSession(store) if err != nil { @@ -40,28 +40,28 @@ func (Glue) CreateSession(store kv.Storage) (glue.Session, error) { return &tidbSession{se: se}, nil } -// Open implements glue.Glue +// Open implements glue.Glue. func (g Glue) Open(path string, option pd.SecurityOption) (kv.Storage, error) { return g.tikvGlue.Open(path, option) } -// OwnsStorage implements glue.Glue +// OwnsStorage implements glue.Glue. func (Glue) OwnsStorage() bool { return true } -// StartProgress implements glue.Glue +// StartProgress implements glue.Glue. func (g Glue) StartProgress(ctx context.Context, cmdName string, total int64, redirectLog bool) glue.Progress { return g.tikvGlue.StartProgress(ctx, cmdName, total, redirectLog) } -// Execute implements glue.Session +// Execute implements glue.Session. func (gs *tidbSession) Execute(ctx context.Context, sql string) error { _, err := gs.se.Execute(ctx, sql) return err } -// CreateDatabase implements glue.Session +// CreateDatabase implements glue.Session. func (gs *tidbSession) CreateDatabase(ctx context.Context, schema *model.DBInfo) error { d := domain.GetDomain(gs.se).DDL() schema = schema.Clone() @@ -71,7 +71,7 @@ func (gs *tidbSession) CreateDatabase(ctx context.Context, schema *model.DBInfo) return d.CreateSchemaWithInfo(gs.se, schema, ddl.OnExistIgnore, true) } -// CreateTable implements glue.Session +// CreateTable implements glue.Session. func (gs *tidbSession) CreateTable(ctx context.Context, dbName model.CIStr, table *model.TableInfo) error { d := domain.GetDomain(gs.se).DDL() @@ -86,7 +86,7 @@ func (gs *tidbSession) CreateTable(ctx context.Context, dbName model.CIStr, tabl return d.CreateTableWithInfo(gs.se, dbName, table, ddl.OnExistIgnore, true) } -// Close implements glue.Session +// Close implements glue.Session. func (gs *tidbSession) Close() { gs.se.Close() } diff --git a/pkg/gluetikv/glue.go b/pkg/gluetikv/glue.go index ab3c0d57f..78b0a4c28 100644 --- a/pkg/gluetikv/glue.go +++ b/pkg/gluetikv/glue.go @@ -18,17 +18,17 @@ import ( // Glue is an implementation of glue.Glue that accesses only TiKV without TiDB. type Glue struct{} -// GetDomain implements glue.Glue +// GetDomain implements glue.Glue. func (Glue) GetDomain(store kv.Storage) (*domain.Domain, error) { return nil, nil } -// CreateSession implements glue.Glue +// CreateSession implements glue.Glue. func (Glue) CreateSession(store kv.Storage) (glue.Session, error) { return nil, nil } -// Open implements glue.Glue +// Open implements glue.Glue. func (Glue) Open(path string, option pd.SecurityOption) (kv.Storage, error) { if option.CAPath != "" { conf := config.GetGlobalConfig() @@ -40,12 +40,12 @@ func (Glue) Open(path string, option pd.SecurityOption) (kv.Storage, error) { return tikv.Driver{}.Open(path) } -// OwnsStorage implements glue.Glue +// OwnsStorage implements glue.Glue. func (Glue) OwnsStorage() bool { return true } -// StartProgress implements glue.Glue +// StartProgress implements glue.Glue. func (Glue) StartProgress(ctx context.Context, cmdName string, total int64, redirectLog bool) glue.Progress { return progress{ch: utils.StartProgress(ctx, cmdName, total, redirectLog)} } @@ -54,12 +54,12 @@ type progress struct { ch chan<- struct{} } -// Inc implements glue.Progress +// Inc implements glue.Progress. func (p progress) Inc() { p.ch <- struct{}{} } -// Close implements glue.Progress +// Close implements glue.Progress. func (p progress) Close() { close(p.ch) } diff --git a/pkg/mock/mock_cluster.go b/pkg/mock/mock_cluster.go index f43702ed3..2827fafd8 100644 --- a/pkg/mock/mock_cluster.go +++ b/pkg/mock/mock_cluster.go @@ -83,7 +83,7 @@ func NewCluster() (*Cluster, error) { }, nil } -// Start runs a mock cluster +// Start runs a mock cluster. func (mock *Cluster) Start() error { statusURL, err := url.Parse(tempurl.Alloc()) if err != nil { @@ -125,7 +125,7 @@ func (mock *Cluster) Start() error { return nil } -// Stop stops a mock cluster +// Stop stops a mock cluster. func (mock *Cluster) Stop() { if mock.Domain != nil { mock.Domain.Close() diff --git a/pkg/restore/client.go b/pkg/restore/client.go index bda1f3010..1a05da760 100644 --- a/pkg/restore/client.go +++ b/pkg/restore/client.go @@ -73,7 +73,7 @@ type Client struct { backend *backup.StorageBackend } -// NewRestoreClient returns a new RestoreClient +// NewRestoreClient returns a new RestoreClient. func NewRestoreClient( ctx context.Context, g glue.Glue, @@ -103,7 +103,7 @@ func (rc *Client) SetRateLimit(rateLimit uint64) { rc.rateLimit = rateLimit } -// SetStorage set ExternalStorage for client +// SetStorage set ExternalStorage for client. func (rc *Client) SetStorage(ctx context.Context, backend *backup.StorageBackend, sendCreds bool) error { var err error rc.storage, err = storage.Create(ctx, backend, sendCreds) @@ -119,12 +119,12 @@ func (rc *Client) GetPDClient() pd.Client { return rc.pdClient } -// IsOnline tells if it's a online restore +// IsOnline tells if it's a online restore. func (rc *Client) IsOnline() bool { return rc.isOnline } -// Close a client +// Close a client. func (rc *Client) Close() { // rc.db can be nil in raw kv mode. if rc.db != nil { @@ -134,7 +134,7 @@ func (rc *Client) Close() { log.Info("Restore client closed") } -// InitBackupMeta loads schemas from BackupMeta to initialize RestoreClient +// InitBackupMeta loads schemas from BackupMeta to initialize RestoreClient. func (rc *Client) InitBackupMeta(backupMeta *backup.BackupMeta, backend *backup.StorageBackend) error { if !backupMeta.IsRawKv { databases, err := utils.LoadBackupTables(backupMeta) @@ -217,7 +217,7 @@ func (rc *Client) GetFilesInRawRange(startKey []byte, endKey []byte, cf string) return nil, errors.New("no backup data in the range") } -// SetConcurrency sets the concurrency of dbs tables files +// SetConcurrency sets the concurrency of dbs tables files. func (rc *Client) SetConcurrency(c uint) { rc.workerPool = utils.NewWorkerPool(c, "file") } @@ -227,12 +227,12 @@ func (rc *Client) EnableOnline() { rc.isOnline = true } -// GetTLSConfig returns the tls config +// GetTLSConfig returns the tls config. func (rc *Client) GetTLSConfig() *tls.Config { return rc.tlsConf } -// GetTS gets a new timestamp from PD +// GetTS gets a new timestamp from PD. func (rc *Client) GetTS(ctx context.Context) (uint64, error) { p, l, err := rc.pdClient.GetTS(ctx) if err != nil { @@ -242,7 +242,7 @@ func (rc *Client) GetTS(ctx context.Context) (uint64, error) { return restoreTS, nil } -// ResetTS resets the timestamp of PD to a bigger value +// ResetTS resets the timestamp of PD to a bigger value. func (rc *Client) ResetTS(pdAddrs []string) error { restoreTS := rc.backupMeta.GetEndVersion() log.Info("reset pd timestamp", zap.Uint64("ts", restoreTS)) @@ -254,7 +254,7 @@ func (rc *Client) ResetTS(pdAddrs []string) error { }, newPDReqBackoffer()) } -// GetPlacementRules return the current placement rules +// GetPlacementRules return the current placement rules. func (rc *Client) GetPlacementRules(pdAddrs []string) ([]placement.Rule, error) { var placementRules []placement.Rule i := 0 @@ -277,12 +277,12 @@ func (rc *Client) GetDatabases() []*utils.Database { return dbs } -// GetDatabase returns a database by name +// GetDatabase returns a database by name. func (rc *Client) GetDatabase(name string) *utils.Database { return rc.databases[name] } -// GetDDLJobs returns ddl jobs +// GetDDLJobs returns ddl jobs. func (rc *Client) GetDDLJobs() []*model.Job { return rc.ddlJobs } @@ -345,8 +345,8 @@ func (rc *Client) CreateTables( return rewriteRules, newTables, nil } -// RemoveTiFlashReplica removes all the tiflash replicas of a table -// TODO: remove this after tiflash supports restore +// RemoveTiFlashReplica removes all the tiflash replicas of a table. +// TODO: remove this after tiflash supports restore. func (rc *Client) RemoveTiFlashReplica( tables []*utils.Table, newTables []*model.TableInfo, placementRules []placement.Rule) error { schemas := make([]*backup.Schema, 0, len(tables)) @@ -402,8 +402,8 @@ func (rc *Client) RemoveTiFlashReplica( return nil } -// RecoverTiFlashReplica recovers all the tiflash replicas of a table -// TODO: remove this after tiflash supports restore +// RecoverTiFlashReplica recovers all the tiflash replicas of a table. +// TODO: remove this after tiflash supports restore. func (rc *Client) RecoverTiFlashReplica(tables []*utils.Table) error { for _, table := range tables { if table.TiFlashReplicas > 0 { @@ -567,12 +567,12 @@ func (rc *Client) RestoreRaw(startKey []byte, endKey []byte, files []*backup.Fil return nil } -//SwitchToImportMode switch tikv cluster to import mode +// SwitchToImportMode switch tikv cluster to import mode. func (rc *Client) SwitchToImportMode(ctx context.Context) error { return rc.switchTiKVMode(ctx, import_sstpb.SwitchMode_Import) } -//SwitchToNormalMode switch tikv cluster to normal mode +// SwitchToNormalMode switch tikv cluster to normal mode. func (rc *Client) SwitchToNormalMode(ctx context.Context) error { return rc.switchTiKVMode(ctx, import_sstpb.SwitchMode_Normal) } @@ -623,7 +623,7 @@ func (rc *Client) switchTiKVMode(ctx context.Context, mode import_sstpb.SwitchMo return nil } -//ValidateChecksum validate checksum after restore +// ValidateChecksum validate checksum after restore. func (rc *Client) ValidateChecksum( ctx context.Context, kvClient kv.Client, @@ -862,18 +862,18 @@ func (rc *Client) getRuleID(tableID int64) string { return "restore-t" + strconv.FormatInt(tableID, 10) } -// IsIncremental returns whether this backup is incremental +// IsIncremental returns whether this backup is incremental. func (rc *Client) IsIncremental() bool { return !(rc.backupMeta.StartVersion == rc.backupMeta.EndVersion || rc.backupMeta.StartVersion == 0) } -// EnableSkipCreateSQL sets switch of skip create schema and tables +// EnableSkipCreateSQL sets switch of skip create schema and tables. func (rc *Client) EnableSkipCreateSQL() { rc.noSchema = true } -// IsSkipCreateSQL returns whether we need skip create schema and tables in restore +// IsSkipCreateSQL returns whether we need skip create schema and tables in restore. func (rc *Client) IsSkipCreateSQL() bool { return rc.noSchema } diff --git a/pkg/restore/db.go b/pkg/restore/db.go index 12afbae73..ffd2116a4 100644 --- a/pkg/restore/db.go +++ b/pkg/restore/db.go @@ -22,7 +22,7 @@ type DB struct { se glue.Session } -// NewDB returns a new DB +// NewDB returns a new DB. func NewDB(g glue.Glue, store kv.Storage) (*DB, error) { se, err := g.CreateSession(store) if err != nil { @@ -123,7 +123,7 @@ func (db *DB) CreateTable(ctx context.Context, table *utils.Table) error { return errors.Trace(err) } -// AlterTiflashReplica alters the replica count of tiflash +// AlterTiflashReplica alters the replica count of tiflash. func (db *DB) AlterTiflashReplica(ctx context.Context, table *utils.Table, count int) error { switchDbSQL := fmt.Sprintf("use %s;", utils.EncloseName(table.Db.Name.O)) err := db.se.Execute(ctx, switchDbSQL) @@ -156,12 +156,12 @@ func (db *DB) AlterTiflashReplica(ctx context.Context, table *utils.Table, count return err } -// Close closes the connection +// Close closes the connection. func (db *DB) Close() { db.se.Close() } -// FilterDDLJobs filters ddl jobs +// FilterDDLJobs filters ddl jobs. func FilterDDLJobs(allDDLJobs []*model.Job, tables []*utils.Table) (ddlJobs []*model.Job) { // Sort the ddl jobs by schema version in descending order. sort.Slice(allDDLJobs, func(i, j int) bool { diff --git a/pkg/restore/import.go b/pkg/restore/import.go index 39defeca5..2f65b4ccf 100644 --- a/pkg/restore/import.go +++ b/pkg/restore/import.go @@ -55,7 +55,7 @@ type importClient struct { tlsConf *tls.Config } -// NewImportClient returns a new ImporterClient +// NewImportClient returns a new ImporterClient. func NewImportClient(metaClient SplitClient, tlsConf *tls.Config) ImporterClient { return &importClient{ metaClient: metaClient, diff --git a/pkg/restore/split.go b/pkg/restore/split.go index e1e37c8ed..21fc5b58a 100644 --- a/pkg/restore/split.go +++ b/pkg/restore/split.go @@ -258,7 +258,7 @@ func (rs *RegionSplitter) splitAndScatterRegions( } // getSplitKeys checks if the regions should be split by the new prefix of the rewrites rule and the end key of -// the ranges, groups the split keys by region id +// the ranges, groups the split keys by region id. func getSplitKeys(rewriteRules *RewriteRules, ranges []rtree.Range, regions []*RegionInfo) map[uint64][][]byte { splitKeyMap := make(map[uint64][][]byte) checkKeys := make([][]byte, 0) diff --git a/pkg/restore/util.go b/pkg/restore/util.go index 3370689ee..081eb61d6 100644 --- a/pkg/restore/util.go +++ b/pkg/restore/util.go @@ -186,7 +186,7 @@ func AttachFilesToRanges( return sortedRanges } -// ValidateFileRewriteRule uses rewrite rules to validate the ranges of a file +// ValidateFileRewriteRule uses rewrite rules to validate the ranges of a file. func ValidateFileRewriteRule(file *backup.File, rewriteRules *RewriteRules) error { // Check if the start key has a matched rewrite key _, startRule := rewriteRawKey(file.GetStartKey(), rewriteRules) @@ -227,7 +227,7 @@ func ValidateFileRewriteRule(file *backup.File, rewriteRules *RewriteRules) erro return nil } -// Rewrites a raw key and returns a encoded key +// rewriteRawKey rewrites a raw key and returns a encoded key. func rewriteRawKey(key []byte, rewriteRules *RewriteRules) ([]byte, *import_sstpb.RewriteRule) { if rewriteRules == nil { return codec.EncodeBytes([]byte{}, key), nil @@ -277,7 +277,7 @@ func truncateTS(key []byte) []byte { // SplitRanges splits region by // 1. data range after rewrite -// 2. rewrite rules +// 2. rewrite rules. func SplitRanges( ctx context.Context, client *Client, diff --git a/pkg/rtree/rtree.go b/pkg/rtree/rtree.go index 08b757af5..5744083b3 100644 --- a/pkg/rtree/rtree.go +++ b/pkg/rtree/rtree.go @@ -19,12 +19,12 @@ type Range struct { Files []*backup.File } -// String formats a range to a string +// String formats a range to a string. func (rg *Range) String() string { return fmt.Sprintf("[%x %x]", rg.StartKey, rg.EndKey) } -// Intersect returns +// Intersect returns? func (rg *Range) Intersect( start, end []byte, ) (subStart, subEnd []byte, isIntersect bool) { @@ -56,14 +56,14 @@ func (rg *Range) Intersect( return } -// Contains check if the range contains the given key, [start, end) +// Contains check if the range contains the given key, [start, end). func (rg *Range) Contains(key []byte) bool { start, end := rg.StartKey, rg.EndKey return bytes.Compare(key, start) >= 0 && (len(end) == 0 || bytes.Compare(key, end) < 0) } -// Less impls btree.Item +// Less impls btree.Item. func (rg *Range) Less(than btree.Item) bool { // rg.StartKey < than.StartKey ta := than.(*Range) diff --git a/pkg/storage/gcs.go b/pkg/storage/gcs.go index 35063724c..ccfaaf70b 100644 --- a/pkg/storage/gcs.go +++ b/pkg/storage/gcs.go @@ -83,7 +83,7 @@ type gcsStorage struct { bucket *storage.BucketHandle } -// Write file to storage +// Write file to storage. func (s *gcsStorage) Write(ctx context.Context, name string, data []byte) error { object := s.gcs.Prefix + name wc := s.bucket.Object(object).NewWriter(ctx) @@ -96,7 +96,7 @@ func (s *gcsStorage) Write(ctx context.Context, name string, data []byte) error return wc.Close() } -// Read storage file +// Read storage file. func (s *gcsStorage) Read(ctx context.Context, name string) ([]byte, error) { object := s.gcs.Prefix + name rc, err := s.bucket.Object(object).NewReader(ctx) @@ -110,7 +110,7 @@ func (s *gcsStorage) Read(ctx context.Context, name string) ([]byte, error) { return b, err } -// FileExists return true if file exists +// FileExists return true if file exists. func (s *gcsStorage) FileExists(ctx context.Context, name string) (bool, error) { object := s.gcs.Prefix + name _, err := s.bucket.Object(object).Attrs(ctx) diff --git a/pkg/storage/local.go b/pkg/storage/local.go index 319ed74d8..e49fe16ee 100644 --- a/pkg/storage/local.go +++ b/pkg/storage/local.go @@ -25,7 +25,7 @@ func (l *localStorage) Read(ctx context.Context, name string) ([]byte, error) { return ioutil.ReadFile(filepath) } -// FileExists implement ExternalStorage.FileExists +// FileExists implement ExternalStorage.FileExists. func (l *localStorage) FileExists(ctx context.Context, name string) (bool, error) { filepath := path.Join(l.base, name) return pathExists(filepath) diff --git a/pkg/storage/noop.go b/pkg/storage/noop.go index 1ee698342..bfd79a7cf 100644 --- a/pkg/storage/noop.go +++ b/pkg/storage/noop.go @@ -6,17 +6,17 @@ import "context" type noopStorage struct{} -// Write file to storage +// Write file to storage. func (*noopStorage) Write(ctx context.Context, name string, data []byte) error { return nil } -// Read storage file +// Read storage file. func (*noopStorage) Read(ctx context.Context, name string) ([]byte, error) { return []byte{}, nil } -// FileExists return true if file exists +// FileExists return true if file exists. func (*noopStorage) FileExists(ctx context.Context, name string) (bool, error) { return false, nil } diff --git a/pkg/storage/parse_test.go b/pkg/storage/parse_test.go index dc4e11124..4390bf746 100644 --- a/pkg/storage/parse_test.go +++ b/pkg/storage/parse_test.go @@ -55,7 +55,7 @@ func (r *testStorageSuite) TestCreateStorage(c *C) { c.Assert(s3.Prefix, Equals, "prefix") c.Assert(s3.Endpoint, Equals, "https://s3.example.com/") - s, err = ParseBackend("s3://bucket3/prefix/path?endpoint=https://127.0.0.1:9000&force_path_style=1&SSE=aws:kms&sse-kms-key-id=TestKey&xyz=abc", nil) + s, err = ParseBackend("s3://bucket3/prefix/path?endpoint=https://127.0.0.1:9000&force_path_style=1&SSE=aws:kms&sse-kms-key-id=TestKey&xyz=abc", nil) // nolint:lll c.Assert(err, IsNil) s3 = s.GetS3() c.Assert(s3, NotNil) diff --git a/pkg/storage/s3.go b/pkg/storage/s3.go index aaa9b5826..d8d6e780f 100644 --- a/pkg/storage/s3.go +++ b/pkg/storage/s3.go @@ -153,7 +153,7 @@ func (options *S3BackendOptions) parseFromFlags(flags *pflag.FlagSet) error { return nil } -// newS3Storage initialize a new s3 storage for metadata +// newS3Storage initialize a new s3 storage for metadata. func newS3Storage( // revive:disable-line:flag-parameter backend *backup.S3, sendCredential bool, @@ -220,7 +220,7 @@ var checkS3Bucket = func(svc *s3.S3, bucket string) error { return err } -// Write write to s3 storage +// Write write to s3 storage. func (rs *S3Storage) Write(ctx context.Context, file string, data []byte) error { input := &s3.PutObjectInput{ Body: aws.ReadSeekCloser(bytes.NewReader(data)), @@ -252,7 +252,7 @@ func (rs *S3Storage) Write(ctx context.Context, file string, data []byte) error return err } -// Read read file from s3 +// Read read file from s3. func (rs *S3Storage) Read(ctx context.Context, file string) ([]byte, error) { input := &s3.GetObjectInput{ Bucket: aws.String(rs.options.Bucket), @@ -271,7 +271,7 @@ func (rs *S3Storage) Read(ctx context.Context, file string) ([]byte, error) { return data, nil } -// FileExists check if file exists on s3 storage +// FileExists check if file exists on s3 storage. func (rs *S3Storage) FileExists(ctx context.Context, file string) (bool, error) { input := &s3.HeadObjectInput{ Bucket: aws.String(rs.options.Bucket), diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 50bedc710..f93acac55 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -19,7 +19,7 @@ type ExternalStorage interface { FileExists(ctx context.Context, name string) (bool, error) } -// Create creates ExternalStorage +// Create creates ExternalStorage. func Create(ctx context.Context, backend *backup.StorageBackend, sendCreds bool) (ExternalStorage, error) { switch backend := backend.Backend.(type) { case *backup.StorageBackend_Local: diff --git a/pkg/summary/collector.go b/pkg/summary/collector.go index 7691f5980..fbed44ba1 100644 --- a/pkg/summary/collector.go +++ b/pkg/summary/collector.go @@ -203,7 +203,7 @@ func (tc *logCollector) Summary(name string) { tc.log(name+" Success summary: "+msg, logFields...) } -// SetLogCollector allow pass LogCollector outside +// SetLogCollector allow pass LogCollector outside. func SetLogCollector(l LogCollector) { collector = l } diff --git a/pkg/summary/summary.go b/pkg/summary/summary.go index 852e936a9..c4843e090 100644 --- a/pkg/summary/summary.go +++ b/pkg/summary/summary.go @@ -4,37 +4,37 @@ package summary import "time" -// SetUnit set unit "backup/restore" for summary log +// SetUnit set unit "backup/restore" for summary log. func SetUnit(unit string) { collector.SetUnit(unit) } -// CollectSuccessUnit collects success time costs +// CollectSuccessUnit collects success time costs. func CollectSuccessUnit(name string, unitCount int, arg interface{}) { collector.CollectSuccessUnit(name, unitCount, arg) } -// CollectFailureUnit collects fail reason +// CollectFailureUnit collects fail reason. func CollectFailureUnit(name string, reason error) { collector.CollectFailureUnit(name, reason) } -// CollectDuration collects log time field +// CollectDuration collects log time field. func CollectDuration(name string, t time.Duration) { collector.CollectDuration(name, t) } -// CollectInt collects log int field +// CollectInt collects log int field. func CollectInt(name string, t int) { collector.CollectInt(name, t) } -// SetSuccessStatus sets final success status +// SetSuccessStatus sets final success status. func SetSuccessStatus(success bool) { collector.SetSuccessStatus(success) } -// Summary outputs summary log +// Summary outputs summary log. func Summary(name string) { collector.Summary(name) } diff --git a/pkg/task/backup.go b/pkg/task/backup.go index e6c479732..0f5d73de4 100644 --- a/pkg/task/backup.go +++ b/pkg/task/backup.go @@ -253,7 +253,7 @@ func checkChecksums(client *backup.Client, cfg *BackupConfig) error { return nil } -// parseTSString port from tidb setSnapshotTS +// parseTSString port from tidb setSnapshotTS. func parseTSString(ts string) (uint64, error) { if len(ts) == 0 { return 0, nil diff --git a/pkg/task/common.go b/pkg/task/common.go index e3b48748e..94e91495b 100644 --- a/pkg/task/common.go +++ b/pkg/task/common.go @@ -55,12 +55,12 @@ type TLSConfig struct { Key string `json:"key" toml:"key"` } -// IsEnabled checks if TLS open or not +// IsEnabled checks if TLS open or not. func (tls *TLSConfig) IsEnabled() bool { return tls.CA != "" } -// ToTLSConfig generate tls.Config +// ToTLSConfig generate tls.Config. func (tls *TLSConfig) ToTLSConfig() (*tls.Config, error) { tlsInfo := transport.TLSInfo{ CertFile: tls.Cert, diff --git a/pkg/task/restore.go b/pkg/task/restore.go index e75100e25..97797cdee 100644 --- a/pkg/task/restore.go +++ b/pkg/task/restore.go @@ -345,7 +345,7 @@ type clusterConfig struct { scheduleCfg map[string]interface{} } -// restorePreWork executes some prepare work before restore +// restorePreWork executes some prepare work before restore. func restorePreWork(ctx context.Context, client *restore.Client, mgr *conn.Mgr) (clusterConfig, error) { if client.IsOnline() { return clusterConfig{}, nil @@ -435,7 +435,7 @@ func removePDLeaderScheduler(ctx context.Context, mgr *conn.Mgr, existSchedulers return removedSchedulers, nil } -// restorePostWork executes some post work after restore +// restorePostWork executes some post work after restore. func restorePostWork( ctx context.Context, client *restore.Client, mgr *conn.Mgr, clusterCfg clusterConfig, ) { diff --git a/pkg/utils/key.go b/pkg/utils/key.go index 8caeb2833..785769923 100644 --- a/pkg/utils/key.go +++ b/pkg/utils/key.go @@ -12,7 +12,7 @@ import ( "github.com/pingcap/errors" ) -// ParseKey parse key by given format +// ParseKey parse key by given format. func ParseKey(format, key string) ([]byte, error) { switch format { case "raw": diff --git a/pkg/utils/pd.go b/pkg/utils/pd.go index 7a65a2ac4..662996bdc 100644 --- a/pkg/utils/pd.go +++ b/pkg/utils/pd.go @@ -23,7 +23,7 @@ const ( placementRuleURL = "/pd/api/v1/config/rules" ) -// ResetTS resets the timestamp of PD to a bigger value +// ResetTS resets the timestamp of PD to a bigger value. func ResetTS(pdAddr string, ts uint64, tlsConf *tls.Config) error { req, err := json.Marshal(struct { TSO string `json:"tso,omitempty"` @@ -53,7 +53,7 @@ func ResetTS(pdAddr string, ts uint64, tlsConf *tls.Config) error { return nil } -// GetPlacementRules return the current placement rules +// GetPlacementRules return the current placement rules. func GetPlacementRules(pdAddr string, tlsConf *tls.Config) ([]placement.Rule, error) { cli := &http.Client{Timeout: 30 * time.Second} prefix := "http://" @@ -88,7 +88,7 @@ func GetPlacementRules(pdAddr string, tlsConf *tls.Config) ([]placement.Rule, er return rules, nil } -// SearchPlacementRule returns the placement rule matched to the table or nil +// SearchPlacementRule returns the placement rule matched to the table or nil. func SearchPlacementRule(tableID int64, placementRules []placement.Rule, role placement.PeerRoleType) *placement.Rule { for _, rule := range placementRules { key, err := hex.DecodeString(rule.StartKeyHex) diff --git a/pkg/utils/progress.go b/pkg/utils/progress.go index f3ea8b5fe..fcabd53b5 100644 --- a/pkg/utils/progress.go +++ b/pkg/utils/progress.go @@ -21,7 +21,7 @@ type ProgressPrinter struct { updateCh chan struct{} } -// NewProgressPrinter returns a new progress printer +// NewProgressPrinter returns a new progress printer. func NewProgressPrinter( name string, total int64, @@ -35,12 +35,12 @@ func NewProgressPrinter( } } -// UpdateCh returns an update channel +// UpdateCh returns an update channel. func (pp *ProgressPrinter) UpdateCh() chan<- struct{} { return pp.updateCh } -// goPrintProgress starts a gorouinte and prints progress +// goPrintProgress starts a gorouinte and prints progress. func (pp *ProgressPrinter) goPrintProgress( ctx context.Context, testWriter io.Writer, // Only for tests diff --git a/pkg/utils/retry.go b/pkg/utils/retry.go index 4f5e5ec05..c1b8008e9 100644 --- a/pkg/utils/retry.go +++ b/pkg/utils/retry.go @@ -18,7 +18,7 @@ type Backoffer interface { Attempt() int } -// WithRetry retrys a given operation with a backoff policy +// WithRetry retrys a given operation with a backoff policy. func WithRetry( ctx context.Context, retryableFunc RetryableFunc, diff --git a/pkg/utils/schema.go b/pkg/utils/schema.go index a135dac1c..51cb4770c 100644 --- a/pkg/utils/schema.go +++ b/pkg/utils/schema.go @@ -114,7 +114,7 @@ func LoadBackupTables(meta *backup.BackupMeta) (map[string]*Database, error) { return databases, nil } -// EncloseName formats name in sql +// EncloseName formats name in sql. func EncloseName(name string) string { return "`" + strings.ReplaceAll(name, "`", "``") + "`" } diff --git a/pkg/utils/version.go b/pkg/utils/version.go index e3d46e301..b8248f969 100644 --- a/pkg/utils/version.go +++ b/pkg/utils/version.go @@ -46,7 +46,7 @@ func BRInfo() string { return buf.String() } -// LogArguments prints origin command arguments +// LogArguments prints origin command arguments. func LogArguments(cmd *cobra.Command) { var fields []zap.Field cmd.Flags().VisitAll(func(f *pflag.Flag) { diff --git a/pkg/utils/worker.go b/pkg/utils/worker.go index 25c128a17..635748314 100644 --- a/pkg/utils/worker.go +++ b/pkg/utils/worker.go @@ -21,7 +21,7 @@ type Worker struct { type taskFunc func() -// NewWorkerPool returns a WorkPool +// NewWorkerPool returns a WorkPool. func NewWorkerPool(limit uint, name string) *WorkerPool { workers := make(chan *Worker, limit) for i := uint(0); i < limit; i++ { @@ -34,7 +34,7 @@ func NewWorkerPool(limit uint, name string) *WorkerPool { } } -// Apply executes a task +// Apply executes a task. func (pool *WorkerPool) Apply(fn taskFunc) { var worker *Worker select { @@ -56,7 +56,7 @@ func (pool *WorkerPool) recycle(worker *Worker) { pool.workers <- worker } -// HasWorker checks if the pool has unallocated workers +// HasWorker checks if the pool has unallocated workers. func (pool *WorkerPool) HasWorker() bool { return len(pool.workers) > 0 } diff --git a/tools/go.sum b/tools/go.sum index 3ffe0be55..40223bd83 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -35,6 +35,7 @@ github.com/dnephin/govet v0.0.0-20171012192244-4a96d43e39d3/go.mod h1:pPTX0MEEoA github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= +github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -177,10 +178,12 @@ github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM= github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= +github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/mgechev/dots v0.0.0-20190921121421-c36f7dcfbb81 h1:QASJXOGm2RZ5Ardbc86qNFvby9AqkLDibfChMtAg5QM= github.com/mgechev/dots v0.0.0-20190921121421-c36f7dcfbb81/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg= github.com/mgechev/revive v1.0.2 h1:v0NxxQ7fSFz/u1NQydPo6EGdq7va0J1BtsZmae6kzUg= github.com/mgechev/revive v1.0.2/go.mod h1:rb0dQy1LVAxW9SWy5R3LPUjevzUbUS316U5MFySA2lo= @@ -198,6 +201,7 @@ github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d/go.mod h1:o96d github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/olekukonko/tablewriter v0.0.4 h1:vHD/YYe1Wolo78koG299f7V/VAS08c6IpCLn+Ejf/w8= github.com/olekukonko/tablewriter v0.0.4/go.mod h1:zq6QwlOf5SlnkVbMSr5EoBv3636FWnp+qbPhuoO21uA= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.0 h1:Iw5WCbBcaAAd0fpRb1c9r5YCylv4XDoCSigm1zLevwU=