diff --git a/cmd/capture.go b/cmd/capture.go index 83e6f6e..229ef6c 100644 --- a/cmd/capture.go +++ b/cmd/capture.go @@ -42,15 +42,15 @@ func newCaptureCmd() *cobra.Command { } cmd.Flags().StringVar(&opt.mode, "mode", "", "online / offline") - cmd.Flags().StringVar(&opt.db1.addr, "addr1", "127.0.0.1", "address of the first TiDB") + cmd.Flags().StringVar(&opt.db1.addr, "addr1", "", "address of the first TiDB") cmd.Flags().StringVar(&opt.db1.port, "port1", "4000", "port of the first TiDB") cmd.Flags().StringVar(&opt.db1.statusPort, "status-port1", "10080", "status port of the first TiDB") - cmd.Flags().StringVar(&opt.db1.user, "user1", "", "user name to access the first TiDB") + cmd.Flags().StringVar(&opt.db1.user, "user1", "root", "user name to access the first TiDB") cmd.Flags().StringVar(&opt.db1.password, "password1", "", "password to access the first TiDB") - cmd.Flags().StringVar(&opt.db2.addr, "addr2", "127.0.0.1", "address of the first TiDB") - cmd.Flags().StringVar(&opt.db2.port, "port2", "4000", "port of the first TiDB") - cmd.Flags().StringVar(&opt.db2.user, "user2", "", "user name to access the first TiDB") - cmd.Flags().StringVar(&opt.db2.password, "password2", "", "password to access the first TiDB") + cmd.Flags().StringVar(&opt.db2.addr, "addr2", "", "address of the second TiDB") + cmd.Flags().StringVar(&opt.db2.port, "port2", "", "port of the second TiDB") + cmd.Flags().StringVar(&opt.db2.user, "user2", "root", "user name to access the second TiDB") + cmd.Flags().StringVar(&opt.db2.password, "password2", "", "password to access the second TiDB") cmd.Flags().StringVar(&opt.db1.version, "ver1", "", "version of the first TiDB") cmd.Flags().StringVar(&opt.db2.version, "ver2", "", "version of the second TiDB") cmd.Flags().StringVar(&opt.queryFile, "query-file", "", "query file path") diff --git a/cmd/import.go b/cmd/import.go index fa77363..8a1a323 100644 --- a/cmd/import.go +++ b/cmd/import.go @@ -99,6 +99,9 @@ func importSchemas(db *tidbHandler, dbName, table, dir string) error { func importStats(db *tidbHandler, dbName, table, dir string) error { statsPath := statsPath(dbName, table, dir) mysql.RegisterLocalFile(statsPath) - fmt.Printf("import schemas from %v successfully\n", statsPath) - return db.execute(fmt.Sprintf("load stats '%v'", statsPath)) + err := db.execute(fmt.Sprintf("load stats '%v'", statsPath)) + if err != nil { + fmt.Printf("import schemas from %v successfully\n", statsPath) + } + return err }