Skip to content

Commit 867d4cc

Browse files
authored
go-mysqldump: Add option to skip binlog position (#941)
When running against MariaDB 11.4 without binlogs enabled: - `mysqldump` 9.1.0 fails to dump when called with `--source-data` due to the `SHOW BINARY LOG STATUS` not being supported by MariaDB. - `mariadb-dump` 11.4 fails to dump when called with `--master-data` due to binlogs not being enabled. Other situations where this can be useful: - Permission issues
1 parent 5acb569 commit 867d4cc

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

cmd/go-mysqldump/main.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@ var (
1818
execution = flag.String("exec", "mysqldump", "mysqldump execution path")
1919
output = flag.String("o", "", "dump output, empty for stdout")
2020

21-
dbs = flag.String("dbs", "", "dump databases, separated by comma")
22-
tables = flag.String("tables", "", "dump tables, separated by comma, will overwrite dbs")
23-
tableDB = flag.String("table_db", "", "database for dump tables")
24-
ignoreTables = flag.String("ignore_tables", "", "ignore tables, must be database.table format, separated by comma")
21+
dbs = flag.String("dbs", "", "dump databases, separated by comma")
22+
tables = flag.String("tables", "", "dump tables, separated by comma, will overwrite dbs")
23+
tableDB = flag.String("table_db", "", "database for dump tables")
24+
ignoreTables = flag.String("ignore_tables", "", "ignore tables, must be database.table format, separated by comma")
25+
skipBinlogPos = flag.Bool("skip-binlog-pos", false, "skip fetching binlog position via --master-data/--source-data")
2526
)
2627

2728
func main() {
@@ -33,6 +34,8 @@ func main() {
3334
os.Exit(1)
3435
}
3536

37+
d.SkipMasterData(*skipBinlogPos)
38+
3639
if len(*ignoreTables) > 0 {
3740
subs := strings.Split(*ignoreTables, ",")
3841
for _, sub := range subs {

0 commit comments

Comments
 (0)