Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: allow mysql migration even if binlog is off (#3502)

Danny Xu9f13a7383cd9
diff --git a/plugin/db/mysql/dump.go b/plugin/db/mysql/dump.go
index 6f2c859760..a61f63f35d 100644
--- a/plugin/db/mysql/dump.go
+++ b/plugin/db/mysql/dump.go
@@ -369,7 +369,8 @@ func GetBinlogInfo(ctx context.Context, db *sql.DB) (api.BinlogInfo, error) {
&unused,
); err != nil {
if err == sql.ErrNoRows {
- return api.BinlogInfo{}, common.FormatDBErrorEmptyRowWithQuery(query)
+ // SHOW MASTER STATUS returns empty row when binlog is off. We should not fail migration in this case for this expected case.
+ return api.BinlogInfo{}, nil
}
return api.BinlogInfo{}, err
}
diff --git a/server/task_executor.go b/server/task_executor.go
index 7d58897c6d..150d6bbf0f 100644
--- a/server/task_executor.go
+++ b/server/task_executor.go
@@ -200,6 +200,10 @@ func setThreadIDAndStartBinlogCoordinate(ctx context.Context, driver db.Driver,
if err != nil {
return nil, errors.Wrap(err, "failed to get the binlog info before executing the migration transaction")
}
+ if (binlogInfo == api.BinlogInfo{}) {
+ log.Warn("binlog is not enabled", zap.Int("task", task.ID))
+ return task, nil
+ }
payload.BinlogFileStart = binlogInfo.FileName
payload.BinlogPosStart = binlogInfo.Position
@@ -235,6 +239,10 @@ func setMigrationIDAndEndBinlogCoordinate(ctx context.Context, driver db.Driver,
if err != nil {
return nil, errors.Wrap(err, "failed to get the binlog info before executing the migration transaction")
}
+ if (binlogInfo == api.BinlogInfo{}) {
+ log.Warn("binlog is not enabled", zap.Int("task", task.ID))
+ return task, nil
+ }
payload.BinlogFileEnd = binlogInfo.FileName
payload.BinlogPosEnd = binlogInfo.Position