|
|
98e16c |
From 8fef58405fbac15c0ea93f0d890b114c870de0cc Mon Sep 17 00:00:00 2001
|
|
|
98e16c |
From: Damien Ciabrini <dciabrin@redhat.com>
|
|
|
98e16c |
Date: Wed, 8 Nov 2017 15:19:33 +0100
|
|
|
98e16c |
Subject: [PATCH] galera: recover from empty gvwstate.dat
|
|
|
98e16c |
|
|
|
98e16c |
While running, a galera node keeps track of the last known state of
|
|
|
98e16c |
the cluster in a temporary file gvwstate.dat. This file is normally
|
|
|
98e16c |
deleted once a node is shutdown gracefully.
|
|
|
98e16c |
|
|
|
98e16c |
Some ungraceful shutdowns can leave an empty gvwstate.dat on
|
|
|
98e16c |
disk. This will prevent galera to join the cluster if it is
|
|
|
98e16c |
configured to attempt PC recovery. Removing that file makes the
|
|
|
98e16c |
node fall back to the normal, unoptimized joining process next
|
|
|
98e16c |
time it is restarted.
|
|
|
98e16c |
---
|
|
|
98e16c |
heartbeat/galera | 11 +++++++++++
|
|
|
98e16c |
1 file changed, 11 insertions(+)
|
|
|
98e16c |
|
|
|
98e16c |
diff --git a/heartbeat/galera b/heartbeat/galera
|
|
|
98e16c |
index ab121a4be..ee8451427 100755
|
|
|
98e16c |
--- a/heartbeat/galera
|
|
|
98e16c |
+++ b/heartbeat/galera
|
|
|
98e16c |
@@ -586,6 +586,17 @@ detect_last_commit()
|
|
|
98e16c |
local recovery_file_regex='s/.*WSREP\:.*position\s*recovery.*--log_error='\''\([^'\'']*\)'\''.*/\1/p'
|
|
|
98e16c |
local recovered_position_regex='s/.*WSREP\:\s*[R|r]ecovered\s*position.*\:\(.*\)\s*$/\1/p'
|
|
|
98e16c |
|
|
|
98e16c |
+ # codership/galera#354
|
|
|
98e16c |
+ # Some ungraceful shutdowns can leave an empty gvwstate.dat on
|
|
|
98e16c |
+ # disk. This will prevent galera to join the cluster if it is
|
|
|
98e16c |
+ # configured to attempt PC recovery. Removing that file makes the
|
|
|
98e16c |
+ # node fall back to the normal, unoptimized joining process.
|
|
|
98e16c |
+ if [ -f ${OCF_RESKEY_datadir}/gvwstate.dat ] && \
|
|
|
98e16c |
+ [ ! -s ${OCF_RESKEY_datadir}/gvwstate.dat ]; then
|
|
|
98e16c |
+ ocf_log warn "empty ${OCF_RESKEY_datadir}/gvwstate.dat detected, removing it to prevent PC recovery failure at next restart"
|
|
|
98e16c |
+ rm -f ${OCF_RESKEY_datadir}/gvwstate.dat
|
|
|
98e16c |
+ fi
|
|
|
98e16c |
+
|
|
|
98e16c |
ocf_log info "attempting to detect last commit version by reading ${OCF_RESKEY_datadir}/grastate.dat"
|
|
|
98e16c |
last_commit="$(cat ${OCF_RESKEY_datadir}/grastate.dat | sed -n 's/^seqno.\s*\(.*\)\s*$/\1/p')"
|
|
|
98e16c |
if [ -z "$last_commit" ] || [ "$last_commit" = "-1" ]; then
|