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

lightning: rename and move some struct #41946

Merged
merged 5 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
2 changes: 1 addition & 1 deletion br/cmd/tidb-lightning-ctl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ go_library(
"//br/pkg/lightning/checkpoints",
"//br/pkg/lightning/common",
"//br/pkg/lightning/config",
"//br/pkg/lightning/restore",
"//br/pkg/lightning/importer:restore",
"//br/pkg/lightning/tikv",
"@com_github_pingcap_errors//:errors",
],
Expand Down
6 changes: 3 additions & 3 deletions br/cmd/tidb-lightning-ctl/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"github.com/pingcap/tidb/br/pkg/lightning/checkpoints"
"github.com/pingcap/tidb/br/pkg/lightning/common"
"github.com/pingcap/tidb/br/pkg/lightning/config"
"github.com/pingcap/tidb/br/pkg/lightning/restore"
"github.com/pingcap/tidb/br/pkg/lightning/importer"
"github.com/pingcap/tidb/br/pkg/lightning/tikv"
)

Expand Down Expand Up @@ -128,7 +128,7 @@ func compactCluster(ctx context.Context, cfg *config.Config, tls *common.TLS) er
tls.WithHost(cfg.TiDB.PdAddr),
tikv.StoreStateDisconnected,
func(c context.Context, store *tikv.Store) error {
return tikv.Compact(c, tls, store.Address, restore.FullLevelCompact)
return tikv.Compact(c, tls, store.Address, importer.FullLevelCompact)
},
)
}
Expand Down Expand Up @@ -169,7 +169,7 @@ func checkpointErrorDestroy(ctx context.Context, cfg *config.Config, tls *common
//nolint: errcheck
defer cpdb.Close()

target, err := restore.NewTiDBManager(ctx, cfg.TiDB, tls)
target, err := importer.NewTiDBManager(ctx, cfg.TiDB, tls)
if err != nil {
return errors.Trace(err)
}
Expand Down
2 changes: 1 addition & 1 deletion br/pkg/lightning/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ go_library(
"//br/pkg/lightning/common",
"//br/pkg/lightning/config",
"//br/pkg/lightning/glue",
"//br/pkg/lightning/importer:restore",
"//br/pkg/lightning/log",
"//br/pkg/lightning/metric",
"//br/pkg/lightning/mydump",
"//br/pkg/lightning/restore",
"//br/pkg/lightning/tikv",
"//br/pkg/lightning/web",
"//br/pkg/redact",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ go_library(
"check_info.go",
"check_template.go",
"checksum.go",
"chunk_process.go",
"get_pre_info.go",
"import.go",
"meta_manager.go",
"precheck.go",
"precheck_impl.go",
"restore.go",
"table_restore.go",
"table_import.go",
"tidb.go",
],
importpath = "github.com/pingcap/tidb/br/pkg/lightning/restore",
importpath = "github.com/pingcap/tidb/br/pkg/lightning/importer",
visibility = ["//visibility:public"],
deps = [
"//br/pkg/checksum",
Expand All @@ -28,10 +29,10 @@ go_library(
"//br/pkg/lightning/config",
"//br/pkg/lightning/errormanager",
"//br/pkg/lightning/glue",
"//br/pkg/lightning/importer/opts",
"//br/pkg/lightning/log",
"//br/pkg/lightning/metric",
"//br/pkg/lightning/mydump",
"//br/pkg/lightning/restore/opts",
"//br/pkg/lightning/tikv",
"//br/pkg/lightning/verification",
"//br/pkg/lightning/web",
Expand Down Expand Up @@ -118,11 +119,89 @@ go_test(
"//br/pkg/lightning/config",
"//br/pkg/lightning/errormanager",
"//br/pkg/lightning/glue",
"//br/pkg/lightning/importer/mock",
"//br/pkg/lightning/importer/opts",
"//br/pkg/lightning/log",
"//br/pkg/lightning/metric",
"//br/pkg/lightning/mydump",
"//br/pkg/lightning/verification",
"//br/pkg/lightning/web",
"//br/pkg/lightning/worker",
"//br/pkg/mock",
"//br/pkg/storage",
"//br/pkg/streamhelper",
"//br/pkg/version/build",
"//ddl",
"//errno",
"//kv",
"//meta",
"//meta/autoid",
"//parser",
"//parser/ast",
"//parser/model",
"//parser/mysql",
"//store/mockstore",
"//store/pdtypes",
"//table/tables",
"//types",
"//util",
"//util/mock",
"//util/promutil",
"//util/table-filter",
"//util/table-router",
"@com_github_data_dog_go_sqlmock//:go-sqlmock",
"@com_github_docker_go_units//:go-units",
"@com_github_go_sql_driver_mysql//:mysql",
"@com_github_golang_mock//gomock",
"@com_github_google_uuid//:uuid",
"@com_github_pingcap_errors//:errors",
"@com_github_pingcap_failpoint//:failpoint",
"@com_github_pingcap_kvproto//pkg/metapb",
"@com_github_pingcap_tipb//go-tipb",
"@com_github_stretchr_testify//require",
"@com_github_stretchr_testify//suite",
"@com_github_tikv_client_go_v2//oracle",
"@com_github_tikv_pd_client//:client",
"@com_github_xitongsys_parquet_go//writer",
"@com_github_xitongsys_parquet_go_source//buffer",
"@io_etcd_go_etcd_client_v3//:client",
"@io_etcd_go_etcd_tests_v3//integration",
"@org_uber_go_atomic//:atomic",
"@org_uber_go_zap//:zap",
],
)

go_test(
name = "importer_test",
srcs = [
"check_info_test.go",
"checksum_test.go",
"chunk_process_test.go",
"get_pre_info_test.go",
"import_test.go",
"meta_manager_test.go",
"precheck_impl_test.go",
"precheck_test.go",
"restore_schema_test.go",
"table_import_test.go",
"tidb_test.go",
],
embed = [":importer"],
deps = [
"//br/pkg/lightning/backend",
"//br/pkg/lightning/backend/kv",
"//br/pkg/lightning/backend/noop",
"//br/pkg/lightning/backend/tidb",
"//br/pkg/lightning/checkpoints",
"//br/pkg/lightning/common",
"//br/pkg/lightning/config",
"//br/pkg/lightning/errormanager",
"//br/pkg/lightning/glue",
"//br/pkg/lightning/importer/mock",
"//br/pkg/lightning/importer/opts",
"//br/pkg/lightning/log",
"//br/pkg/lightning/metric",
"//br/pkg/lightning/mydump",
"//br/pkg/lightning/restore/mock",
"//br/pkg/lightning/restore/opts",
"//br/pkg/lightning/verification",
"//br/pkg/lightning/web",
"//br/pkg/lightning/worker",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package restore
package importer

import (
"context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package restore
package importer

import (
"context"
Expand Down Expand Up @@ -338,7 +338,7 @@ func TestCheckCSVHeader(t *testing.T) {
}

ioWorkers := worker.NewPool(context.Background(), 1, "io")
preInfoGetter := &PreRestoreInfoGetterImpl{
preInfoGetter := &PreImportInfoGetterImpl{
cfg: cfg,
srcStorage: mockStore,
ioWorkers: ioWorkers,
Expand Down Expand Up @@ -455,7 +455,7 @@ func TestCheckTableEmpty(t *testing.T) {
targetInfoGetter := &TargetInfoGetterImpl{
cfg: cfg,
}
preInfoGetter := &PreRestoreInfoGetterImpl{
preInfoGetter := &PreImportInfoGetterImpl{
cfg: cfg,
dbMetas: dbMetas,
targetInfoGetter: targetInfoGetter,
Expand Down Expand Up @@ -582,10 +582,10 @@ func TestCheckTableEmpty(t *testing.T) {
require.NoError(t, err)
require.NoError(t, mock.ExpectationsWereMet())

err = failpoint.Enable("github.com/pingcap/tidb/br/pkg/lightning/restore/CheckTableEmptyFailed", `return`)
err = failpoint.Enable("github.com/pingcap/tidb/br/pkg/lightning/importer/CheckTableEmptyFailed", `return`)
require.NoError(t, err)
defer func() {
_ = failpoint.Disable("github.com/pingcap/tidb/br/pkg/lightning/restore/CheckTableEmptyFailed")
_ = failpoint.Disable("github.com/pingcap/tidb/br/pkg/lightning/importer/CheckTableEmptyFailed")
}()

// restrict the concurrency to ensure there are more tables than workers
Expand All @@ -612,7 +612,7 @@ func TestLocalResource(t *testing.T) {
cfg.TikvImporter.SortedKVDir = dir
cfg.TikvImporter.Backend = "local"
ioWorkers := worker.NewPool(context.Background(), 1, "io")
preInfoGetter := &PreRestoreInfoGetterImpl{
preInfoGetter := &PreImportInfoGetterImpl{
cfg: cfg,
srcStorage: mockStore,
ioWorkers: ioWorkers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package restore
package importer

import (
"strings"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package restore
package importer

import (
"container/heap"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package restore
package importer

import (
"context"
Expand Down
Loading