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

Commit

Permalink
dumpling: fix args config (#875)
Browse files Browse the repository at this point in the history
  • Loading branch information
GMHDBJD authored Aug 10, 2020
1 parent 0e34545 commit 1dc9d10
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
18 changes: 9 additions & 9 deletions dumpling/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,16 @@ func parseExtraArgs(dumpCfg *export.Config, args []string) error {
fileSizeStr string
)

dumplingFlagSet.StringSliceVarP(&dumpCfg.Databases, "database", "B", nil, "Database to dump")
dumplingFlagSet.IntVarP(&dumpCfg.Threads, "threads", "t", 4, "Number of goroutines to use, default 4")
dumplingFlagSet.StringSliceVarP(&dumpCfg.Databases, "database", "B", dumpCfg.Databases, "Database to dump")
dumplingFlagSet.IntVarP(&dumpCfg.Threads, "threads", "t", dumpCfg.Threads, "Number of goroutines to use, default 4")
dumplingFlagSet.StringVarP(&fileSizeStr, "filesize", "F", "", "The approximate size of output file")
dumplingFlagSet.Uint64VarP(&dumpCfg.StatementSize, "statement-size", "S", export.UnspecifiedSize, "Attempted size of INSERT statement in bytes")
dumplingFlagSet.StringVar(&dumpCfg.Consistency, "consistency", "auto", "Consistency level during dumping: {auto|none|flush|lock|snapshot}")
dumplingFlagSet.StringVar(&dumpCfg.Snapshot, "snapshot", "", "Snapshot position. Valid only when consistency=snapshot")
dumplingFlagSet.BoolVarP(&dumpCfg.NoViews, "no-views", "W", true, "Do not dump views")
dumplingFlagSet.Uint64VarP(&dumpCfg.Rows, "rows", "r", export.UnspecifiedSize, "Split table into chunks of this many rows, default unlimited")
dumplingFlagSet.StringVar(&dumpCfg.Where, "where", "", "Dump only selected records")
dumplingFlagSet.BoolVar(&dumpCfg.EscapeBackslash, "escape-backslash", true, "use backslash to escape quotation marks")
dumplingFlagSet.Uint64VarP(&dumpCfg.StatementSize, "statement-size", "S", dumpCfg.StatementSize, "Attempted size of INSERT statement in bytes")
dumplingFlagSet.StringVar(&dumpCfg.Consistency, "consistency", dumpCfg.Consistency, "Consistency level during dumping: {auto|none|flush|lock|snapshot}")
dumplingFlagSet.StringVar(&dumpCfg.Snapshot, "snapshot", dumpCfg.Snapshot, "Snapshot position. Valid only when consistency=snapshot")
dumplingFlagSet.BoolVarP(&dumpCfg.NoViews, "no-views", "W", dumpCfg.NoViews, "Do not dump views")
dumplingFlagSet.Uint64VarP(&dumpCfg.Rows, "rows", "r", dumpCfg.Rows, "Split table into chunks of this many rows, default unlimited")
dumplingFlagSet.StringVar(&dumpCfg.Where, "where", dumpCfg.Where, "Dump only selected records")
dumplingFlagSet.BoolVar(&dumpCfg.EscapeBackslash, "escape-backslash", dumpCfg.EscapeBackslash, "use backslash to escape quotation marks")

err := dumplingFlagSet.Parse(args)
if err != nil {
Expand Down
4 changes: 3 additions & 1 deletion dumpling/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ func (m *testDumplingSuite) TestParseArgs(c *C) {
c.Assert(exportCfg.Threads, Equals, 8)
c.Assert(exportCfg.FileSize, Equals, uint64(50))

extraArgs := `--statement-size=100 --skip-tz-utc`
extraArgs := `--threads 16 --skip-tz-utc`
err = parseExtraArgs(exportCfg, strings.Fields(extraArgs))
c.Assert(err, NotNil)
c.Assert(exportCfg.Threads, Equals, 16)
c.Assert(exportCfg.StatementSize, Equals, uint64(100))
}
2 changes: 1 addition & 1 deletion tests/shardddl1/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function DM_001_CASE() {
}

function DM_001() {
run_case 001 "no-sharding" "init_table 111 112" "clean_table" ""
run_case 001 "single-source-no-sharding" "init_table 111 112" "clean_table" ""
}

function DM_002_CASE() {
Expand Down

0 comments on commit 1dc9d10

Please sign in to comment.