Skip to content

Commit

Permalink
go-mysqldump: Add option to skip binlog position (#941)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dveeden authored Nov 8, 2024
1 parent 5acb569 commit 867d4cc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cmd/go-mysqldump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ var (
execution = flag.String("exec", "mysqldump", "mysqldump execution path")
output = flag.String("o", "", "dump output, empty for stdout")

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

func main() {
Expand All @@ -33,6 +34,8 @@ func main() {
os.Exit(1)
}

d.SkipMasterData(*skipBinlogPos)

if len(*ignoreTables) > 0 {
subs := strings.Split(*ignoreTables, ",")
for _, sub := range subs {
Expand Down

0 comments on commit 867d4cc

Please sign in to comment.