Skip to content

Commit

Permalink
lightning: rename and move some struct (#41946)
Browse files Browse the repository at this point in the history
ref #40499
  • Loading branch information
D3Hunter authored Mar 6, 2023
1 parent 8ba69c5 commit 9958a93
Show file tree
Hide file tree
Showing 53 changed files with 958 additions and 895 deletions.
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",
"//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",
"//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
@@ -1,20 +1,21 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "restore",
name = "importer",
srcs = [
"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 @@ -91,22 +92,22 @@ go_library(
)

go_test(
name = "restore_test",
name = "importer_test",
timeout = "short",
srcs = [
"check_info_test.go",
"checksum_test.go",
"chunk_restore_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",
"restore_test.go",
"table_restore_test.go",
"table_import_test.go",
"tidb_test.go",
],
embed = [":restore"],
embed = [":importer"],
flaky = True,
deps = [
"//br/pkg/lightning/backend",
Expand All @@ -118,11 +119,11 @@ 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/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

0 comments on commit 9958a93

Please sign in to comment.