Skip to content

Commit

Permalink
Fix error finding lowest IP of best nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
colinmollenhour committed Feb 8, 2017
1 parent da94230 commit 17dee3c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mysqld.sh
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ else
# Otherwise we will start a new Primary Component with the best node by position
MY_SEQNO=${POSITION#*:}
BEST_SEQNO=$(<$tmpfile awk -F: '/^seqno:/{print $4}' | sort -nu | tail -n 1)
echo "${LOG_MESSAGE} Comparing my seqno ($MY_SEQNO) to the best other node seqno ($BEST_SEQNO)..."
if [ "$MY_SEQNO" -gt "$BEST_SEQNO" ]; then
# This node is newer than all the others, start a new cluster
echo "${LOG_MESSAGE} This node is newer than all the others. Starting a new cluster..."
Expand All @@ -309,7 +310,7 @@ else
sleep $HEAD_START
else
# This and another node or nodes are the newest, lowest IP wins
LOWEST_IP=$(<$tmpfile awk -F: "/:$BEST_SEQNO$/{print \$2}" | sort -u | head -n 1)
LOWEST_IP=$(<$tmpfile awk -F: "/^seqno:/{ if (\$4==\"$BEST_SEQNO\") print \$2 }" | sort -u | head -n 1)
if [ "$NODE_ADDRESS" \< "$LOWEST_IP" ]; then
echo "${LOG_MESSAGE} This node is equal to the most advanced and has the lowest IP. Starting a new cluster..."
prepare_bootstrap
Expand Down

0 comments on commit 17dee3c

Please sign in to comment.