MySQL OCF RA to not chose all-zero-uuid as possible masters
Select possible masters from nodes with non zero uuids and fall back
to zero ids if only no more meaningfull ids were found.
For example, if 4 nodes have 00000000-0000-0000-0000-000000000000,
and 5th has ef3c5d28-1045-11e6-941c-82b1df28ba4c, chose the latter
and ignore a majority of zero uuids. Otherwise, the possible master
may not be always found as crm_simulate may return negative score
for all candidates with zero ids.
Fuel-CI: disable
Related-bug: #1576244
Change-Id: I0a5108cb6ceb6ef869d89f4993897390c8f4c749
Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
(cherry picked from commit 52b12dab71
)
Signed-off-by: Sergii Golovatiuk <sgolovatiuk@mirantis.com>
This commit is contained in:
parent
0197b09fc6
commit
1a43fd1e22
|
@ -375,7 +375,8 @@ get_master() {
|
|||
|
||||
# Find possible masters
|
||||
# Cut the seqnums off the stored GTID:SEQNO pairs, then find the most seen GTID for the nodes
|
||||
MASTER_GTID=$(printf -- '%s\n' ${TMP[@]%:*} | grep -vE "^0$" | sort | uniq -c | awk '{print $2}' | head -1)
|
||||
MASTER_GTID=$(printf -- '%s\n' ${TMP[@]%:*} | grep -vE -e "^0$" -e $ZEROID | sort | uniq -c | awk '{print $2}' | head -1)
|
||||
[ "${MASTER_GTID}" ] || MASTER_GTID=$ZEROID
|
||||
ocf_log info "${LH} The most seen GTID is: ${MASTER_GTID}"
|
||||
for NODE in $NODES; do
|
||||
NODE_SCORE=`crm_simulate -Ls | awk "/${OCF_RESOURCE_INSTANCE}/ && /clone_color/ && !/${OCF_RESOURCE_INSTANCE}:/ && /${NODE}/" | sed -r -e 's/.*score on (.*)/\1/' | awk -F ':' '{print $2}' | tr -d '[:space:]'`
|
||||
|
@ -717,6 +718,7 @@ mysql_stop() {
|
|||
##########################################################################
|
||||
DEBUG_LOG="/tmp/mysql.ocf.ra.debug/log"
|
||||
UUID_REGEX="\w{8}-\w{4}-\w{4}-\w{4}-\w{12}:([[:digit:]]+|-1)"
|
||||
ZEROID="00000000-0000-0000-0000-000000000000"
|
||||
if [ "${DEBUG_LOG}" -a -w "${DEBUG_LOG}" -a ! -L "${DEBUG_LOG}" ]; then
|
||||
DEBUG_LOG_DIR="${DEBUG_LOG%/*}"
|
||||
if [ -d "${DEBUG_LOG_DIR}" ]; then
|
||||
|
|
Loading…
Reference in New Issue