Skip to content

Commit d1ca1de

Browse files
nil checking
1 parent 61c72f0 commit d1ca1de

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

go/base/context.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,9 @@ func (this *MigrationContext) GetVoluntaryLockName() string {
356356

357357
// RequiresBinlogFormatChange is `true` when the original binlog format isn't `ROW`
358358
func (this *MigrationContext) RequiresBinlogFormatChange() bool {
359+
if this.InspectorServerInfo == nil {
360+
return true
361+
}
359362
return this.InspectorServerInfo.BinlogFormat != "ROW"
360363
}
361364

go/logic/server.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,18 +178,22 @@ help # This message
178178
return NoPrintStatusRule, fmt.Errorf("coordinates are read-only")
179179
}
180180
case "applier":
181-
if this.migrationContext.ApplierConnectionConfig != nil && this.migrationContext.ApplierConnectionConfig.ImpliedKey != nil {
182-
fmt.Fprintf(writer, "Host: %s, Version: %s\n",
181+
if this.migrationContext.ApplierConnectionConfig != nil && this.migrationContext.ApplierConnectionConfig.ImpliedKey != nil &&
182+
this.migrationContext.ApplierServerInfo != nil {
183+
fmt.Fprintf(writer, "Host: %s, Version: %s (%s)\n",
183184
this.migrationContext.ApplierConnectionConfig.ImpliedKey.String(),
184185
this.migrationContext.ApplierServerInfo.Version,
186+
this.migrationContext.ApplierServerInfo.VersionComment,
185187
)
186188
}
187189
return NoPrintStatusRule, nil
188190
case "inspector":
189-
if this.migrationContext.InspectorConnectionConfig != nil && this.migrationContext.InspectorConnectionConfig.ImpliedKey != nil {
190-
fmt.Fprintf(writer, "Host: %s, Version: %s\n",
191+
if this.migrationContext.InspectorConnectionConfig != nil && this.migrationContext.InspectorConnectionConfig.ImpliedKey != nil &&
192+
this.migrationContext.InspectorServerInfo != nil {
193+
fmt.Fprintf(writer, "Host: %s, Version: %s (%s)\n",
191194
this.migrationContext.InspectorConnectionConfig.ImpliedKey.String(),
192195
this.migrationContext.InspectorServerInfo.Version,
196+
this.migrationContext.InspectorServerInfo.VersionComment,
193197
)
194198
}
195199
return NoPrintStatusRule, nil

0 commit comments

Comments
 (0)