@@ -32,7 +32,7 @@ func acceptSignals(migrationContext *base.MigrationContext) {
32
32
for sig := range c {
33
33
switch sig {
34
34
case syscall .SIGHUP :
35
- log .Infof ("Received SIGHUP. Reloading configuration" )
35
+ migrationContext . Log .Infof ("Received SIGHUP. Reloading configuration" )
36
36
if err := migrationContext .ReadConfigFile (); err != nil {
37
37
log .Errore (err )
38
38
} else {
@@ -158,19 +158,19 @@ func main() {
158
158
return
159
159
}
160
160
161
- log .SetLevel (log .ERROR )
161
+ migrationContext . Log .SetLevel (log .ERROR )
162
162
if * verbose {
163
- log .SetLevel (log .INFO )
163
+ migrationContext . Log .SetLevel (log .INFO )
164
164
}
165
165
if * debug {
166
- log .SetLevel (log .DEBUG )
166
+ migrationContext . Log .SetLevel (log .DEBUG )
167
167
}
168
168
if * stack {
169
- log .SetPrintStackTrace (* stack )
169
+ migrationContext . Log .SetPrintStackTrace (* stack )
170
170
}
171
171
if * quiet {
172
172
// Override!!
173
- log .SetLevel (log .ERROR )
173
+ migrationContext . Log .SetLevel (log .ERROR )
174
174
}
175
175
176
176
if migrationContext .AlterStatement == "" {
@@ -194,43 +194,43 @@ func main() {
194
194
}
195
195
migrationContext .Noop = ! (* executeFlag )
196
196
if migrationContext .AllowedRunningOnMaster && migrationContext .TestOnReplica {
197
- log .Fatalf ("--allow-on-master and --test-on-replica are mutually exclusive" )
197
+ migrationContext . Log .Fatalf ("--allow-on-master and --test-on-replica are mutually exclusive" )
198
198
}
199
199
if migrationContext .AllowedRunningOnMaster && migrationContext .MigrateOnReplica {
200
- log .Fatalf ("--allow-on-master and --migrate-on-replica are mutually exclusive" )
200
+ migrationContext . Log .Fatalf ("--allow-on-master and --migrate-on-replica are mutually exclusive" )
201
201
}
202
202
if migrationContext .MigrateOnReplica && migrationContext .TestOnReplica {
203
- log .Fatalf ("--migrate-on-replica and --test-on-replica are mutually exclusive" )
203
+ migrationContext . Log .Fatalf ("--migrate-on-replica and --test-on-replica are mutually exclusive" )
204
204
}
205
205
if migrationContext .SwitchToRowBinlogFormat && migrationContext .AssumeRBR {
206
- log .Fatalf ("--switch-to-rbr and --assume-rbr are mutually exclusive" )
206
+ migrationContext . Log .Fatalf ("--switch-to-rbr and --assume-rbr are mutually exclusive" )
207
207
}
208
208
if migrationContext .TestOnReplicaSkipReplicaStop {
209
209
if ! migrationContext .TestOnReplica {
210
- log .Fatalf ("--test-on-replica-skip-replica-stop requires --test-on-replica to be enabled" )
210
+ migrationContext . Log .Fatalf ("--test-on-replica-skip-replica-stop requires --test-on-replica to be enabled" )
211
211
}
212
- log .Warning ("--test-on-replica-skip-replica-stop enabled. We will not stop replication before cut-over. Ensure you have a plugin that does this." )
212
+ migrationContext . Log .Warning ("--test-on-replica-skip-replica-stop enabled. We will not stop replication before cut-over. Ensure you have a plugin that does this." )
213
213
}
214
214
if migrationContext .CliMasterUser != "" && migrationContext .AssumeMasterHostname == "" {
215
- log .Fatalf ("--master-user requires --assume-master-host" )
215
+ migrationContext . Log .Fatalf ("--master-user requires --assume-master-host" )
216
216
}
217
217
if migrationContext .CliMasterPassword != "" && migrationContext .AssumeMasterHostname == "" {
218
- log .Fatalf ("--master-password requires --assume-master-host" )
218
+ migrationContext . Log .Fatalf ("--master-password requires --assume-master-host" )
219
219
}
220
220
if migrationContext .TLSCACertificate != "" && ! migrationContext .UseTLS {
221
- log .Fatalf ("--ssl-ca requires --ssl" )
221
+ migrationContext . Log .Fatalf ("--ssl-ca requires --ssl" )
222
222
}
223
223
if migrationContext .TLSCertificate != "" && ! migrationContext .UseTLS {
224
- log .Fatalf ("--ssl-cert requires --ssl" )
224
+ migrationContext . Log .Fatalf ("--ssl-cert requires --ssl" )
225
225
}
226
226
if migrationContext .TLSKey != "" && ! migrationContext .UseTLS {
227
- log .Fatalf ("--ssl-key requires --ssl" )
227
+ migrationContext . Log .Fatalf ("--ssl-key requires --ssl" )
228
228
}
229
229
if migrationContext .TLSAllowInsecure && ! migrationContext .UseTLS {
230
- log .Fatalf ("--ssl-allow-insecure requires --ssl" )
230
+ migrationContext . Log .Fatalf ("--ssl-allow-insecure requires --ssl" )
231
231
}
232
232
if * replicationLagQuery != "" {
233
- log .Warningf ("--replication-lag-query is deprecated" )
233
+ migrationContext . Log .Warningf ("--replication-lag-query is deprecated" )
234
234
}
235
235
236
236
switch * cutOver {
@@ -239,19 +239,19 @@ func main() {
239
239
case "two-step" :
240
240
migrationContext .CutOverType = base .CutOverTwoStep
241
241
default :
242
- log .Fatalf ("Unknown cut-over: %s" , * cutOver )
242
+ migrationContext . Log .Fatalf ("Unknown cut-over: %s" , * cutOver )
243
243
}
244
244
if err := migrationContext .ReadConfigFile (); err != nil {
245
- log .Fatale (err )
245
+ migrationContext . Log .Fatale (err )
246
246
}
247
247
if err := migrationContext .ReadThrottleControlReplicaKeys (* throttleControlReplicas ); err != nil {
248
- log .Fatale (err )
248
+ migrationContext . Log .Fatale (err )
249
249
}
250
250
if err := migrationContext .ReadMaxLoad (* maxLoad ); err != nil {
251
- log .Fatale (err )
251
+ migrationContext . Log .Fatale (err )
252
252
}
253
253
if err := migrationContext .ReadCriticalLoad (* criticalLoad ); err != nil {
254
- log .Fatale (err )
254
+ migrationContext . Log .Fatale (err )
255
255
}
256
256
if migrationContext .ServeSocketFile == "" {
257
257
migrationContext .ServeSocketFile = fmt .Sprintf ("/tmp/gh-ost.%s.%s.sock" , migrationContext .DatabaseName , migrationContext .OriginalTableName )
@@ -260,7 +260,7 @@ func main() {
260
260
fmt .Println ("Password:" )
261
261
bytePassword , err := terminal .ReadPassword (int (syscall .Stdin ))
262
262
if err != nil {
263
- log .Fatale (err )
263
+ migrationContext . Log .Fatale (err )
264
264
}
265
265
migrationContext .CliPassword = string (bytePassword )
266
266
}
@@ -275,13 +275,13 @@ func main() {
275
275
migrationContext .SetDefaultNumRetries (* defaultRetries )
276
276
migrationContext .ApplyCredentials ()
277
277
if err := migrationContext .SetupTLS (); err != nil {
278
- log .Fatale (err )
278
+ migrationContext . Log .Fatale (err )
279
279
}
280
280
if err := migrationContext .SetCutOverLockTimeoutSeconds (* cutOverLockTimeoutSeconds ); err != nil {
281
- log .Errore (err )
281
+ migrationContext . Log .Errore (err )
282
282
}
283
283
if err := migrationContext .SetExponentialBackoffMaxInterval (* exponentialBackoffMaxInterval ); err != nil {
284
- log .Errore (err )
284
+ migrationContext . Log .Errore (err )
285
285
}
286
286
287
287
log .Infof ("starting gh-ost %+v" , AppVersion )
@@ -291,7 +291,7 @@ func main() {
291
291
err := migrator .Migrate ()
292
292
if err != nil {
293
293
migrator .ExecOnFailureHook ()
294
- log .Fatale (err )
294
+ migrationContext . Log .Fatale (err )
295
295
}
296
296
fmt .Fprintf (os .Stdout , "# Done\n " )
297
297
}
0 commit comments