Only allow -switch-to-rbr when inspecting replica

Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
This commit is contained in:
Shlomi Noach 2021-06-20 08:55:07 +03:00
parent 1876a90818
commit 47f14a4d40

View File

@ -796,6 +796,9 @@ func (this *Migrator) initiateInspector() (err error) {
} else if this.migrationContext.InspectorIsAlsoApplier() && !this.migrationContext.AllowedRunningOnMaster {
return fmt.Errorf("It seems like this migration attempt to run directly on master. Preferably it would be executed on a replica (and this reduces load from the master). To proceed please provide --allow-on-master. Inspector config=%+v, applier config=%+v", this.migrationContext.InspectorConnectionConfig, this.migrationContext.ApplierConnectionConfig)
}
if this.migrationContext.InspectorIsAlsoApplier() && this.migrationContext.SwitchToRowBinlogFormat {
return fmt.Errorf("--switch-to-rbr is only allowed when inspecting a replica. This migration seems to run on the primary %+v", *this.migrationContext.ApplierConnectionConfig.ImpliedKey)
}
if err := this.inspector.validateLogSlaveUpdates(); err != nil {
return err
}