Skip to content

Commit

Permalink
lightning config: tolerate tidb backend parallel-import (#50139)
Browse files Browse the repository at this point in the history
close #50136
  • Loading branch information
lance6716 authored Jan 8, 2024
1 parent e56efc6 commit 5fe0847
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions br/pkg/lightning/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -1347,9 +1347,9 @@ func (c *Conflict) adjust(i *TikvImporter, l *Lightning) error {
"unsupported `%s` (%s)", strategyConfigFrom, c.Strategy)
}
if c.Strategy != "" {
if i.ParallelImport {
if i.ParallelImport && i.Backend == BackendLocal {
return common.ErrInvalidConfig.GenWithStack(
"%s cannot be used with tikv-importer.parallel-import",
`%s cannot be used with tikv-importer.parallel-import and tikv-importer.backend = "local"`,
strategyConfigFrom)
}
if i.DuplicateResolution != DupeResAlgNone {
Expand Down
6 changes: 5 additions & 1 deletion br/pkg/lightning/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -987,7 +987,11 @@ func TestAdjustConflictStrategy(t *testing.T) {
cfg.TikvImporter.Backend = BackendLocal
cfg.Conflict.Strategy = ReplaceOnDup
cfg.TikvImporter.ParallelImport = true
require.ErrorContains(t, cfg.Adjust(ctx), "conflict.strategy cannot be used with tikv-importer.parallel-import")
require.ErrorContains(t, cfg.Adjust(ctx), `conflict.strategy cannot be used with tikv-importer.parallel-import and tikv-importer.backend = "local"`)

cfg.TikvImporter.Backend = BackendTiDB
cfg.Conflict.Strategy = IgnoreOnDup
require.NoError(t, cfg.Adjust(ctx))

cfg.TikvImporter.Backend = BackendLocal
cfg.Conflict.Strategy = ReplaceOnDup
Expand Down

0 comments on commit 5fe0847

Please sign in to comment.