Skip to content

Commit a986c44

Browse files
author
Yves Trudeau
committed
Modified according to Kamil's comments. Simplification of the process, initializing gtidErrorsMsg to empty string and adjusting the resulting error strings if there was any intermediate error.
1 parent e955a3e commit a986c44

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

go/inst/instance_topology.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2814,7 +2814,7 @@ func relocateReplicasInternal(replicas [](*Instance), instance, other *Instance)
28142814
return RepointTo(replicas, &other.Key)
28152815
}
28162816
// GTID
2817-
gtidErrorsMsg := "Additional Errors: "
2817+
gtidErrorsMsg := ""
28182818
{
28192819
movedReplicas, unmovedReplicas, err, errs := moveReplicasViaGTID(replicas, other, nil)
28202820

@@ -2826,14 +2826,14 @@ func relocateReplicasInternal(replicas [](*Instance), instance, other *Instance)
28262826
return relocateReplicasInternal(unmovedReplicas, instance, other)
28272827
}
28282828

2829-
// Making sure that if there are any errors in errs, they are reported
2829+
// Making sure that if there are any errors in errs, they are reported
28302830
if len(errs) > 0 {
28312831
// There are errors, maybe more than one. Let's concatenate them
28322832
// so they can be reported correctly in the UI
28332833
gtidErrorsMsg = "Error(s): "
28342834

28352835
for _, err := range errs {
2836-
gtidErrorsMsg = fmt.Sprintf("%s; %v",gtidErrorsMsg,err)
2836+
gtidErrorsMsg = fmt.Sprintf("%s; %v", gtidErrorsMsg, err)
28372837
}
28382838

28392839
}
@@ -2861,8 +2861,8 @@ func relocateReplicasInternal(replicas [](*Instance), instance, other *Instance)
28612861

28622862
// Too complex
28632863
// if the len of gtidErrorsMsg is less than 21, no errors were added
2864-
if len(gtidErrorsMsg) < 21 {
2865-
gtidErrorsMsg = ""
2864+
if len(gtidErrorsMsg) > 0 {
2865+
gtidErrorsMsg = "Additional Errors: " + gtidErrorsMsg
28662866
}
28672867
return nil, log.Errorf("Relocating %+v replicas of %+v below %+v turns to be too complex; please do it manually. %v", len(replicas), instance.Key, other.Key, gtidErrorsMsg), errs
28682868
}

0 commit comments

Comments
 (0)