Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
dm-portal: don't generate table list for mydumper if DoTables is empty (
Browse files Browse the repository at this point in the history
  • Loading branch information
sre-bot authored and WangXiangUSTC committed Dec 12, 2019
1 parent 17b3959 commit 8ecc2c8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dm/portal/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,12 +563,17 @@ func generateMydumperCfg(bwList *filter.Rules) *config.MydumperConfig {
tables = append(tables, fmt.Sprintf("%s.%s", table.Schema, table.Name))
}

extraArgs := ""
if len(tables) != 0 {
extraArgs = fmt.Sprintf("-T %s", strings.Join(tables, ","))
}

return &config.MydumperConfig{
MydumperPath: "bin/mydumper",
Threads: 4,
ChunkFilesize: 64,
SkipTzUTC: true,
ExtraArgs: fmt.Sprintf("-T %s", strings.Join(tables, ",")),
ExtraArgs: extraArgs,
}
}

Expand Down
4 changes: 4 additions & 0 deletions dm/portal/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ func (t *testPortalSuite) TestGenerateMydumperTableCfg(c *C) {
}
mydumperCfg := generateMydumperCfg(bwList)
c.Assert(mydumperCfg.ExtraArgs, Equals, "-T db_1.t_1,db_1.t_2")

bwList = &filter.Rules{}
mydumperCfg = generateMydumperCfg(bwList)
c.Assert(mydumperCfg.ExtraArgs, Equals, "")
}

func (t *testPortalSuite) TestGenerateMydumperCfgName(c *C) {
Expand Down

0 comments on commit 8ecc2c8

Please sign in to comment.