Skip to content

Commit 83e12da

Browse files
Merge pull request #25 from y-trudeau/DISTMYSQL-185
DISTMYSQL-185: Fix error management during relocation of replicas.
2 parents c7abced + a986c44 commit 83e12da

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

docker/Dockerfile.system

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN echo "ci_env_repo: $ci_env_repo"
88
RUN echo "ci_env_branch: $ci_env_branch"
99

1010
RUN apt-get update -q -y
11-
RUN apt-get install -y sudo haproxy python git jq rsync libaio1 libnuma1 default-mysql-client bsdmainutils less vim
11+
RUN apt-get install -y sudo haproxy python git jq rsync libaio1 libnuma1 default-mysql-client bsdmainutils less vim libncurses5
1212

1313
RUN mkdir /orchestrator
1414
WORKDIR /orchestrator

go/inst/instance_topology.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2814,6 +2814,7 @@ func relocateReplicasInternal(replicas [](*Instance), instance, other *Instance)
28142814
return RepointTo(replicas, &other.Key)
28152815
}
28162816
// GTID
2817+
gtidErrorsMsg := ""
28172818
{
28182819
movedReplicas, unmovedReplicas, err, errs := moveReplicasViaGTID(replicas, other, nil)
28192820

@@ -2824,6 +2825,18 @@ func relocateReplicasInternal(replicas [](*Instance), instance, other *Instance)
28242825
// something was moved via GTID; let's try further on
28252826
return relocateReplicasInternal(unmovedReplicas, instance, other)
28262827
}
2828+
2829+
// Making sure that if there are any errors in errs, they are reported
2830+
if len(errs) > 0 {
2831+
// There are errors, maybe more than one. Let's concatenate them
2832+
// so they can be reported correctly in the UI
2833+
gtidErrorsMsg = "Error(s): "
2834+
2835+
for _, err := range errs {
2836+
gtidErrorsMsg = fmt.Sprintf("%s; %v", gtidErrorsMsg, err)
2837+
}
2838+
2839+
}
28272840
// Otherwise nothing was moved via GTID. Maybe we don't have any GTIDs, we continue.
28282841
}
28292842

@@ -2847,7 +2860,11 @@ func relocateReplicasInternal(replicas [](*Instance), instance, other *Instance)
28472860
}
28482861

28492862
// Too complex
2850-
return nil, log.Errorf("Relocating %+v replicas of %+v below %+v turns to be too complex; please do it manually", len(replicas), instance.Key, other.Key), errs
2863+
// if the len of gtidErrorsMsg is less than 21, no errors were added
2864+
if len(gtidErrorsMsg) > 0 {
2865+
gtidErrorsMsg = "Additional Errors: " + gtidErrorsMsg
2866+
}
2867+
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
28512868
}
28522869

28532870
// RelocateReplicas will attempt moving replicas of an instance indicated by instanceKey below another instance.

0 commit comments

Comments
 (0)