Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: migrate tidb-tools #33296

Merged
merged 28 commits into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
41dea0b
migrate util
hawkingrei Mar 21, 2022
7d3f3a3
migrate cpu
hawkingrei Mar 21, 2022
6e08b40
migrate dbutil
hawkingrei Mar 21, 2022
d9ce997
migrate error
hawkingrei Mar 21, 2022
f375446
migrate processinfo
hawkingrei Mar 21, 2022
3a28243
migrate urls
hawkingrei Mar 21, 2022
29548f3
migrate tso
hawkingrei Mar 21, 2022
e02c90a
migrate tls_test
hawkingrei Mar 21, 2022
30c0bbd
migrate table-rule-selector
hawkingrei Mar 21, 2022
d65d7f2
migrate table-router
hawkingrei Mar 21, 2022
2b75e33
migrate table-filter
hawkingrei Mar 21, 2022
82b5a58
migrate security
hawkingrei Mar 21, 2022
679eee0
migrate schemacmp
hawkingrei Mar 21, 2022
e759a48
migrate regexpr-router
hawkingrei Mar 21, 2022
57f93b2
migrate etcd
hawkingrei Mar 21, 2022
c5e937e
migrate filter
hawkingrei Mar 21, 2022
50dc09b
migrate printer
hawkingrei Mar 21, 2022
e1fb237
migrate tidb-binlog
hawkingrei Mar 21, 2022
dc5edcb
remove tidb-tools
hawkingrei Mar 21, 2022
9be1af1
remove tidb-tools
hawkingrei Mar 21, 2022
5962c8e
update gomod
hawkingrei Mar 21, 2022
92ddc79
update chore
hawkingrei Mar 21, 2022
aa913f6
update chore
hawkingrei Mar 21, 2022
82a653b
Merge branch 'master' into migrate_tidb_tools
hawkingrei Mar 23, 2022
50ed45c
Merge branch 'master' into migrate_tidb_tools
ti-chi-bot Mar 25, 2022
ae02865
Merge branch 'master' into migrate_tidb_tools
ti-chi-bot Mar 25, 2022
29aa784
Merge branch 'master' into migrate_tidb_tools
ti-chi-bot Mar 25, 2022
eed32dd
Merge branch 'master' into migrate_tidb_tools
ti-chi-bot Mar 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/licenserc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ header:
- '.golangci.yml'
- '.golangci_br.yml'
- 'LICENSES/'
- '**/*.key'
- '**/*.md'
- '**/*.json'
- '**/*.pem'
Expand All @@ -28,4 +29,6 @@ header:
- '.github/'
- 'parser/'
- 'dumpling/'
- 'tidb-binlog/driver/example'
- 'tidb-binlog/proto/go-binlog/secondary_binlog.pb.go'
comment: on-failure
2 changes: 1 addition & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ PACKAGE_DIRECTORIES_TIDB_TESTS := $(PACKAGE_LIST_TIDB_TESTS) | sed 's|github.com
FILES := $$(find $$($(PACKAGE_DIRECTORIES)) -name "*.go")
FILES_TIDB_TESTS := $$(find $$($(PACKAGE_DIRECTORIES_TIDB_TESTS)) -name "*.go")

UNCONVERT_PACKAGES_LIST := go list ./...| grep -vE "lightning\/checkpoints|lightning\/manual|lightning\/common"
UNCONVERT_PACKAGES_LIST := go list ./...| grep -vE "lightning\/checkpoints|lightning\/manual|lightning\/common|tidb-binlog\/proto\/go-binlog"
UNCONVERT_PACKAGES := $$($(UNCONVERT_PACKAGES_LIST))

FAILPOINT_ENABLE := find $$PWD/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/failpoint-ctl enable
Expand Down
2 changes: 1 addition & 1 deletion bindinfo/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"sync/atomic"
"time"

tablefilter "github.com/pingcap/tidb-tools/pkg/table-filter"
"github.com/pingcap/tidb/metrics"
"github.com/pingcap/tidb/parser"
"github.com/pingcap/tidb/parser/ast"
Expand All @@ -42,6 +41,7 @@ import (
utilparser "github.com/pingcap/tidb/util/parser"
"github.com/pingcap/tidb/util/sqlexec"
"github.com/pingcap/tidb/util/stmtsummary"
tablefilter "github.com/pingcap/tidb/util/table-filter"
"github.com/pingcap/tidb/util/timeutil"
"go.uber.org/zap"
)
Expand Down
2 changes: 1 addition & 1 deletion br/cmd/br/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import (

"github.com/pingcap/errors"
"github.com/pingcap/log"
tidbutils "github.com/pingcap/tidb-tools/pkg/utils"
"github.com/pingcap/tidb/br/pkg/gluetidb"
"github.com/pingcap/tidb/br/pkg/redact"
"github.com/pingcap/tidb/br/pkg/summary"
"github.com/pingcap/tidb/br/pkg/task"
"github.com/pingcap/tidb/br/pkg/utils"
"github.com/pingcap/tidb/br/pkg/version/build"
"github.com/pingcap/tidb/config"
tidbutils "github.com/pingcap/tidb/util"
"github.com/pingcap/tidb/util/logutil"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/backup/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"github.com/pingcap/kvproto/pkg/kvrpcpb"
"github.com/pingcap/kvproto/pkg/metapb"
"github.com/pingcap/log"
filter "github.com/pingcap/tidb-tools/pkg/table-filter"
"github.com/pingcap/tidb/br/pkg/conn"
berrors "github.com/pingcap/tidb/br/pkg/errors"
"github.com/pingcap/tidb/br/pkg/logutil"
Expand All @@ -39,6 +38,7 @@ import (
"github.com/pingcap/tidb/util"
"github.com/pingcap/tidb/util/codec"
"github.com/pingcap/tidb/util/ranger"
filter "github.com/pingcap/tidb/util/table-filter"
"github.com/tikv/client-go/v2/oracle"
"github.com/tikv/client-go/v2/tikv"
"github.com/tikv/client-go/v2/txnkv/txnlock"
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/backup/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import (
"github.com/golang/protobuf/proto"
backuppb "github.com/pingcap/kvproto/pkg/brpb"
"github.com/pingcap/kvproto/pkg/encryptionpb"
filter "github.com/pingcap/tidb-tools/pkg/table-filter"
"github.com/pingcap/tidb/br/pkg/backup"
"github.com/pingcap/tidb/br/pkg/metautil"
"github.com/pingcap/tidb/br/pkg/mock"
"github.com/pingcap/tidb/br/pkg/storage"
"github.com/pingcap/tidb/br/pkg/utils"
"github.com/pingcap/tidb/sessionctx/variable"
"github.com/pingcap/tidb/testkit"
filter "github.com/pingcap/tidb/util/table-filter"
"github.com/stretchr/testify/require"
)

Expand Down
4 changes: 2 additions & 2 deletions br/pkg/lightning/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ import (
"github.com/docker/go-units"
gomysql "github.com/go-sql-driver/mysql"
"github.com/pingcap/errors"
filter "github.com/pingcap/tidb-tools/pkg/table-filter"
router "github.com/pingcap/tidb-tools/pkg/table-router"
"github.com/pingcap/tidb/br/pkg/lightning/common"
"github.com/pingcap/tidb/br/pkg/lightning/log"
tidbcfg "github.com/pingcap/tidb/config"
"github.com/pingcap/tidb/parser/mysql"
filter "github.com/pingcap/tidb/util/table-filter"
router "github.com/pingcap/tidb/util/table-router"
"go.uber.org/atomic"
"go.uber.org/zap"
)
Expand Down
4 changes: 2 additions & 2 deletions br/pkg/lightning/mydump/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ import (
"strings"

"github.com/pingcap/errors"
regexprrouter "github.com/pingcap/tidb-tools/pkg/regexpr-router"
filter "github.com/pingcap/tidb-tools/pkg/table-filter"
"github.com/pingcap/tidb/br/pkg/lightning/common"
"github.com/pingcap/tidb/br/pkg/lightning/config"
"github.com/pingcap/tidb/br/pkg/lightning/log"
"github.com/pingcap/tidb/br/pkg/storage"
regexprrouter "github.com/pingcap/tidb/util/regexpr-router"
filter "github.com/pingcap/tidb/util/table-filter"
"go.uber.org/zap"
)

Expand Down
4 changes: 2 additions & 2 deletions br/pkg/lightning/mydump/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import (
"path/filepath"
"testing"

filter "github.com/pingcap/tidb-tools/pkg/table-filter"
router "github.com/pingcap/tidb-tools/pkg/table-router"
"github.com/pingcap/tidb/br/pkg/lightning/config"
md "github.com/pingcap/tidb/br/pkg/lightning/mydump"
"github.com/pingcap/tidb/br/pkg/storage"
filter "github.com/pingcap/tidb/util/table-filter"
router "github.com/pingcap/tidb/util/table-router"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/mydump/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"

"github.com/pingcap/errors"
"github.com/pingcap/tidb-tools/pkg/filter"
"github.com/pingcap/tidb/util/filter"
"github.com/pingcap/tidb/util/slice"
"go.uber.org/zap"

Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/mydump/router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"strings"
"testing"

"github.com/pingcap/tidb-tools/pkg/filter"
"github.com/pingcap/tidb/br/pkg/lightning/config"
"github.com/pingcap/tidb/util/filter"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/restore/restore_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/DATA-DOG/go-sqlmock"
"github.com/golang/mock/gomock"
"github.com/pingcap/errors"
filter "github.com/pingcap/tidb-tools/pkg/table-filter"
filter "github.com/pingcap/tidb/util/table-filter"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"

Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/restore/table_restore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import (
"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
"github.com/pingcap/kvproto/pkg/metapb"
filter "github.com/pingcap/tidb-tools/pkg/table-filter"
"github.com/pingcap/tidb/br/pkg/lightning/backend"
"github.com/pingcap/tidb/br/pkg/lightning/backend/kv"
"github.com/pingcap/tidb/br/pkg/lightning/backend/noop"
Expand All @@ -62,6 +61,7 @@ import (
"github.com/pingcap/tidb/table/tables"
"github.com/pingcap/tidb/types"
tmock "github.com/pingcap/tidb/util/mock"
filter "github.com/pingcap/tidb/util/table-filter"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/restore/systable_restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (

"github.com/pingcap/errors"
"github.com/pingcap/log"
filter "github.com/pingcap/tidb-tools/pkg/table-filter"
berrors "github.com/pingcap/tidb/br/pkg/errors"
"github.com/pingcap/tidb/br/pkg/logutil"
"github.com/pingcap/tidb/br/pkg/utils"
"github.com/pingcap/tidb/parser/model"
"github.com/pingcap/tidb/parser/mysql"
filter "github.com/pingcap/tidb/util/table-filter"
"go.uber.org/multierr"
"go.uber.org/zap"
)
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/task/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import (
backuppb "github.com/pingcap/kvproto/pkg/brpb"
"github.com/pingcap/kvproto/pkg/encryptionpb"
"github.com/pingcap/log"
filter "github.com/pingcap/tidb-tools/pkg/table-filter"
"github.com/pingcap/tidb/br/pkg/conn"
berrors "github.com/pingcap/tidb/br/pkg/errors"
"github.com/pingcap/tidb/br/pkg/glue"
"github.com/pingcap/tidb/br/pkg/metautil"
"github.com/pingcap/tidb/br/pkg/storage"
"github.com/pingcap/tidb/br/pkg/utils"
"github.com/pingcap/tidb/sessionctx/variable"
filter "github.com/pingcap/tidb/util/table-filter"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
pd "github.com/tikv/pd/client"
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/utils/dyn_pprof_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package utils

import tidbutils "github.com/pingcap/tidb-tools/pkg/utils"
import tidbutils "github.com/pingcap/tidb/util"

// StartDynamicPProfListener starts the listener that will enable pprof when received `startPProfSignal`
func StartDynamicPProfListener(tls *tidbutils.TLS) {
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/utils/dyn_pprof_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"syscall"

"github.com/pingcap/log"
tidbutils "github.com/pingcap/tidb-tools/pkg/utils"
tidbutils "github.com/pingcap/tidb/util"
"go.uber.org/zap"
)

Expand Down
9 changes: 4 additions & 5 deletions br/pkg/utils/pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@ package utils

import (
"fmt"
"net"
"os"
"sync"

"net" //nolint:goimports
// #nosec
// register HTTP handler for /debug/pprof
"net/http"
// For pprof
_ "net/http/pprof" // #nosec G108
"os"
"sync"

"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
"github.com/pingcap/log"
tidbutils "github.com/pingcap/tidb-tools/pkg/utils"
berrors "github.com/pingcap/tidb/br/pkg/errors"
tidbutils "github.com/pingcap/tidb/util"
"go.uber.org/zap"
)

Expand Down
2 changes: 1 addition & 1 deletion ddl/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
"github.com/ngaut/pools"
"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
pumpcli "github.com/pingcap/tidb-tools/tidb-binlog/pump_client"
"github.com/pingcap/tidb/config"
"github.com/pingcap/tidb/ddl/util"
"github.com/pingcap/tidb/infoschema"
Expand All @@ -46,6 +45,7 @@ import (
"github.com/pingcap/tidb/sessionctx/variable"
"github.com/pingcap/tidb/statistics/handle"
"github.com/pingcap/tidb/table"
pumpcli "github.com/pingcap/tidb/tidb-binlog/pump_client"
goutil "github.com/pingcap/tidb/util"
tidbutil "github.com/pingcap/tidb/util"
"github.com/pingcap/tidb/util/gcutil"
Expand Down
2 changes: 1 addition & 1 deletion ddl/ddl_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"github.com/pingcap/errors"
"github.com/pingcap/failpoint"
"github.com/pingcap/kvproto/pkg/kvrpcpb"
pumpcli "github.com/pingcap/tidb-tools/tidb-binlog/pump_client"
"github.com/pingcap/tidb/ddl/util"
"github.com/pingcap/tidb/kv"
"github.com/pingcap/tidb/meta"
Expand All @@ -36,6 +35,7 @@ import (
"github.com/pingcap/tidb/sessionctx"
"github.com/pingcap/tidb/sessionctx/binloginfo"
"github.com/pingcap/tidb/sessionctx/variable"
pumpcli "github.com/pingcap/tidb/tidb-binlog/pump_client"
tidbutil "github.com/pingcap/tidb/util"
"github.com/pingcap/tidb/util/admin"
"github.com/pingcap/tidb/util/dbterror"
Expand Down
4 changes: 2 additions & 2 deletions dumpling/export/block_allow_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"strings"
"testing"

"github.com/pingcap/tidb-tools/pkg/filter"
tf "github.com/pingcap/tidb-tools/pkg/table-filter"
"github.com/pingcap/tidb/util/filter"
tf "github.com/pingcap/tidb/util/table-filter"
"github.com/stretchr/testify/require"

"github.com/pingcap/tidb/br/pkg/version"
Expand Down
11 changes: 5 additions & 6 deletions dumpling/export/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ import (
"github.com/docker/go-units"
"github.com/go-sql-driver/mysql"
"github.com/pingcap/errors"
filter "github.com/pingcap/tidb-tools/pkg/table-filter"
"github.com/pingcap/tidb-tools/pkg/utils"
"github.com/pingcap/tidb/br/pkg/storage"
"github.com/pingcap/tidb/br/pkg/version"
"github.com/pingcap/tidb/util"
filter "github.com/pingcap/tidb/util/table-filter"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/pflag"
"go.uber.org/zap"

"github.com/pingcap/tidb/br/pkg/storage"
"github.com/pingcap/tidb/br/pkg/version"
)

const (
Expand Down Expand Up @@ -616,7 +615,7 @@ func registerTLSConfig(conf *Config) error {
return errors.Trace(err)
}
}
tlsConfig, err = utils.ToTLSConfigWithVerifyByRawbytes(conf.Security.SSLCABytes,
tlsConfig, err = util.ToTLSConfigWithVerifyByRawbytes(conf.Security.SSLCABytes,
conf.Security.SSLCertBytes, conf.Security.SSLKEYBytes, []string{})
if err != nil {
return errors.Trace(err)
Expand Down
2 changes: 1 addition & 1 deletion dumpling/export/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/go-sql-driver/mysql"
"github.com/pingcap/errors"
"github.com/pingcap/tidb-tools/pkg/dbutil"
"github.com/pingcap/tidb/util/dbutil"
"go.uber.org/zap"

"github.com/pingcap/tidb/br/pkg/utils"
Expand Down
2 changes: 1 addition & 1 deletion executor/brie.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/pingcap/errors"
backuppb "github.com/pingcap/kvproto/pkg/brpb"
"github.com/pingcap/kvproto/pkg/encryptionpb"
filter "github.com/pingcap/tidb-tools/pkg/table-filter"
"github.com/pingcap/tidb/br/pkg/glue"
"github.com/pingcap/tidb/br/pkg/storage"
"github.com/pingcap/tidb/br/pkg/task"
Expand All @@ -47,6 +46,7 @@ import (
"github.com/pingcap/tidb/util/printer"
"github.com/pingcap/tidb/util/sem"
"github.com/pingcap/tidb/util/sqlexec"
filter "github.com/pingcap/tidb/util/table-filter"
"github.com/tikv/client-go/v2/oracle"
pd "github.com/tikv/pd/client"
)
Expand Down
2 changes: 1 addition & 1 deletion executor/change.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"strings"

"github.com/pingcap/errors"
"github.com/pingcap/tidb-tools/tidb-binlog/node"
"github.com/pingcap/tidb/config"
"github.com/pingcap/tidb/parser/ast"
"github.com/pingcap/tidb/tidb-binlog/node"
"github.com/pingcap/tidb/util/chunk"
)

Expand Down
9 changes: 4 additions & 5 deletions executor/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ import (

"github.com/cznic/mathutil"
"github.com/pingcap/errors"
"github.com/pingcap/tidb-tools/pkg/etcd"
"github.com/pingcap/tidb-tools/pkg/utils"
"github.com/pingcap/tidb-tools/tidb-binlog/node"
"github.com/pingcap/tidb/bindinfo"
"github.com/pingcap/tidb/config"
"github.com/pingcap/tidb/ddl"
Expand All @@ -54,11 +51,13 @@ import (
"github.com/pingcap/tidb/store/helper"
"github.com/pingcap/tidb/table"
"github.com/pingcap/tidb/table/tables"
"github.com/pingcap/tidb/tidb-binlog/node"
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/types/json"
"github.com/pingcap/tidb/util"
"github.com/pingcap/tidb/util/chunk"
"github.com/pingcap/tidb/util/collate"
"github.com/pingcap/tidb/util/etcd"
"github.com/pingcap/tidb/util/format"
"github.com/pingcap/tidb/util/hack"
"github.com/pingcap/tidb/util/hint"
Expand Down Expand Up @@ -1679,15 +1678,15 @@ func (e *ShowExec) fetchShowPumpOrDrainerStatus(kind string) error {
if n.State == node.Offline {
continue
}
e.appendRow([]interface{}{n.NodeID, n.Addr, n.State, n.MaxCommitTS, utils.TSOToRoughTime(n.UpdateTS).Format(types.TimeFormat)})
e.appendRow([]interface{}{n.NodeID, n.Addr, n.State, n.MaxCommitTS, util.TSOToRoughTime(n.UpdateTS).Format(types.TimeFormat)})
}

return nil
}

// createRegistry returns an ectd registry
func createRegistry(urls string) (*node.EtcdRegistry, error) {
ectdEndpoints, err := utils.ParseHostPortAddr(urls)
ectdEndpoints, err := util.ParseHostPortAddr(urls)
if err != nil {
return nil, errors.Trace(err)
}
Expand Down
Loading