Despite the name, gh-ost doesn't actually use panic() when PanicOnWarnings is enabled. When the PanicOnWarnings flag is enabled on the Migrator instance, and an SQL warning occurs, the error flows through these channels:
terminateRowIteration sends error to rowCopyComplete
consumeRowCopyComplete forwards error to PanicAbort
listenOnPanicAbort calls Log.Fatale(err)
Fatale calls os.Exit(1) which kills the entire process
When using gh-ost as a library, this prevents the calling application from recovering from panics since the entire process is terminated.
Despite the name,
gh-ostdoesn't actually usepanic()whenPanicOnWarningsis enabled. When thePanicOnWarningsflag is enabled on theMigratorinstance, and an SQL warning occurs, the error flows through these channels:terminateRowIterationsends error torowCopyCompleteconsumeRowCopyCompleteforwards error toPanicAbortlistenOnPanicAbortcallsLog.Fatale(err)Fatalecallsos.Exit(1)which kills the entire processWhen using
gh-ostas a library, this prevents the calling application from recovering from panics since the entire process is terminated.