From 45f109083ced40c816dbe162f9aeac84284b4b8f Mon Sep 17 00:00:00 2001 From: Xuecheng Zhang Date: Wed, 21 Oct 2020 17:12:31 +0800 Subject: [PATCH] cherry pick #1195 to release-2.0 Signed-off-by: ti-srebot --- dumpling/util.go | 2 +- dumpling/util_test.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dumpling/util.go b/dumpling/util.go index a1a5880593..ed51c28181 100644 --- a/dumpling/util.go +++ b/dumpling/util.go @@ -65,7 +65,7 @@ func parseExtraArgs(logger *log.Logger, dumpCfg *export.Config, args []string) e dumplingFlagSet.StringSliceVarP(&tablesList, "tables-list", "T", nil, "Comma delimited table list to dump; must be qualified table names") 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", dumpCfg.StatementSize, "Attempted size of INSERT statement in bytes") + 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") diff --git a/dumpling/util_test.go b/dumpling/util_test.go index fc9ab1ce20..c093ec2ef2 100644 --- a/dumpling/util_test.go +++ b/dumpling/util_test.go @@ -98,12 +98,13 @@ func (m *testDumplingSuite) TestParseArgsWontOverwrite(c *C) { } cfg.BAList = rules // make sure we enter `parseExtraArgs` - cfg.ExtraArgs = "--statement-size=4000 --consistency lock" + cfg.ExtraArgs = "-s=4000 --consistency lock" d := NewDumpling(cfg) exportCfg, err := d.constructArgs() c.Assert(err, IsNil) + c.Assert(exportCfg.StatementSize, Equals, uint64(4000)) c.Assert(exportCfg.FileSize, Equals, uint64(1*units.MiB)) f, err2 := tfilter.ParseMySQLReplicationRules(rules)