From 099eb05ba5da71f99ee4d0556fe1a58e62b01ea1 Mon Sep 17 00:00:00 2001 From: Chunzhu Li Date: Fri, 2 Oct 2020 01:26:22 -0500 Subject: [PATCH] set default statement size for dumpling (#160) * set default statement size for dumpling --- dumpling/cmd/dumpling/main.go | 2 +- dumpling/v4/export/config.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dumpling/cmd/dumpling/main.go b/dumpling/cmd/dumpling/main.go index c6d37122..1823d92b 100644 --- a/dumpling/cmd/dumpling/main.go +++ b/dumpling/cmd/dumpling/main.go @@ -98,7 +98,7 @@ func main() { pflag.BoolVar(&allowCleartextPasswords, "allow-cleartext-passwords", false, "Allow passwords to be sent in cleartext (warning: don't use without TLS)") pflag.IntVarP(&threads, "threads", "t", 4, "Number of goroutines to use, default 4") pflag.StringVarP(&fileSizeStr, "filesize", "F", "", "The approximate size of output file") - pflag.Uint64VarP(&statementSize, "statement-size", "s", export.UnspecifiedSize, "Attempted size of INSERT statement in bytes") + pflag.Uint64VarP(&statementSize, "statement-size", "s", export.DefaultStatementSize, "Attempted size of INSERT statement in bytes") pflag.StringVarP(&outputDir, "output", "o", defaultOutputDir, "Output directory") pflag.StringVar(&logLevel, "loglevel", "info", "Log level: {debug|info|warn|error|dpanic|panic|fatal}") pflag.StringVarP(&logFile, "logfile", "L", "", "Log file `path`, leave empty to write to console") diff --git a/dumpling/v4/export/config.go b/dumpling/v4/export/config.go index af482eef..94ea0113 100644 --- a/dumpling/v4/export/config.go +++ b/dumpling/v4/export/config.go @@ -84,7 +84,7 @@ func DefaultConfig() *Config { Logger: nil, StatusAddr: ":8281", FileSize: UnspecifiedSize, - StatementSize: UnspecifiedSize, + StatementSize: DefaultStatementSize, OutputDirPath: ".", ServerInfo: ServerInfoUnknown, SortByPk: true, @@ -139,6 +139,7 @@ func (config *Config) createExternalStorage(ctx context.Context) (storage.Extern const ( UnspecifiedSize = 0 DefaultTiDBMemQuotaQuery = 32 * (1 << 30) + DefaultStatementSize = 1000000 defaultDumpThreads = 128 defaultDumpGCSafePointTTL = 5 * 60 dumplingServiceSafePointID = "dumpling"