Skip to content

Commit

Permalink
lightning: mask pre-deduplication for local backend (#44702)
Browse files Browse the repository at this point in the history
ref #41629
  • Loading branch information
lance6716 authored Jun 15, 2023
1 parent beccd05 commit b4db489
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions br/pkg/lightning/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1203,6 +1203,8 @@ func (cfg *Config) AdjustCommon() (bool, error) {
}
cfg.TikvImporter.DuplicateResolution = DupeResAlgNone
case BackendLocal:
// force turn off pre-dedup for local backend
cfg.TikvImporter.OnDuplicate = ""
if cfg.TikvImporter.RegionSplitBatchSize <= 0 {
return mustHaveInternalConnections, common.ErrInvalidConfig.GenWithStack("`tikv-importer.region-split-batch-size` got %d, should be larger than 0", cfg.TikvImporter.RegionSplitBatchSize)
}
Expand Down
6 changes: 3 additions & 3 deletions br/pkg/lightning/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1006,18 +1006,18 @@ func TestAdjustOnDuplicate(t *testing.T) {
cfg.TikvImporter.Backend = config.BackendLocal
cfg.TikvImporter.OnDuplicate = config.ReplaceOnDup
require.NoError(t, cfg.Adjust(ctx))
require.Equal(t, config.ReplaceOnDup, cfg.TikvImporter.OnDuplicate)
require.Equal(t, "", cfg.TikvImporter.OnDuplicate)

cfg.TikvImporter.Backend = config.BackendLocal
cfg.TikvImporter.OnDuplicate = config.ReplaceOnDup
cfg.TikvImporter.IncrementalImport = true
require.ErrorContains(t, cfg.Adjust(ctx), "tikv-importer.on-duplicate cannot be used with tikv-importer.incremental-import")
require.NoError(t, cfg.Adjust(ctx))

cfg.TikvImporter.Backend = config.BackendLocal
cfg.TikvImporter.OnDuplicate = config.ReplaceOnDup
cfg.TikvImporter.IncrementalImport = false
cfg.TikvImporter.DuplicateResolution = config.DupeResAlgRemove
require.ErrorContains(t, cfg.Adjust(ctx), "tikv-importer.on-duplicate cannot be used with tikv-importer.duplicate-resolution")
require.NoError(t, cfg.Adjust(ctx))
}

func TestAdjustMaxErrorRecords(t *testing.T) {
Expand Down

0 comments on commit b4db489

Please sign in to comment.