|
|
a89620 |
From 8c61f2019d11781b737251b5cf839437b25fc53f Mon Sep 17 00:00:00 2001
|
|
|
a89620 |
From: David Disseldorp <ddiss@suse.de>
|
|
|
a89620 |
Date: Wed, 25 Jul 2018 23:15:10 +0200
|
|
|
a89620 |
Subject: [PATCH 1/3] CTDB: fix incorrect db corruption reports (bsc#1101668)
|
|
|
a89620 |
|
|
|
a89620 |
If a database was disconnected during an active transaction, then
|
|
|
a89620 |
tdbdump may fail with e.g.:
|
|
|
a89620 |
> /usr/bin/tdbdump /var/lib/ctdb/persistent/secrets.tdb.1
|
|
|
a89620 |
Failed to open /var/lib/ctdb/persistent/secrets.tdb.1
|
|
|
a89620 |
tdb(/var/lib/ctdb/persistent/secrets.tdb.1): FATAL:
|
|
|
a89620 |
tdb_transaction_recover: attempt to recover read only database
|
|
|
a89620 |
|
|
|
a89620 |
This does *not* indicate corruption, only that tdbdump, which opens the
|
|
|
a89620 |
database readonly, isn't able to perform recovery.
|
|
|
a89620 |
|
|
|
a89620 |
Using tdbtool check, instead of tdbdump, passes:
|
|
|
a89620 |
> tdbtool /var/lib/ctdb/persistent/secrets.tdb.1 check
|
|
|
a89620 |
tdb_transaction_recover: recovered 2146304 byte database
|
|
|
a89620 |
Database integrity is OK and has 2 records.
|
|
|
a89620 |
|
|
|
a89620 |
Drop the tdbdump checks, and instead rely on the core ctdb event script,
|
|
|
a89620 |
which performs the same checks with tdbtool.
|
|
|
a89620 |
|
|
|
a89620 |
Signed-off-by: David Disseldorp <ddiss@suse.de>
|
|
|
a89620 |
---
|
|
|
a89620 |
heartbeat/CTDB.in | 18 ++++--------------
|
|
|
a89620 |
1 file changed, 4 insertions(+), 14 deletions(-)
|
|
|
a89620 |
|
|
|
a89620 |
diff --git a/heartbeat/CTDB.in b/heartbeat/CTDB.in
|
|
|
a89620 |
index 1456ea32b..28e58cea0 100755
|
|
|
a89620 |
--- a/heartbeat/CTDB.in
|
|
|
a89620 |
+++ b/heartbeat/CTDB.in
|
|
|
a89620 |
@@ -392,6 +392,8 @@ enable_event_scripts() {
|
|
|
a89620 |
local event_dir
|
|
|
a89620 |
event_dir=$OCF_RESKEY_ctdb_config_dir/events.d
|
|
|
a89620 |
|
|
|
a89620 |
+ chmod u+x "$event_dir/00.ctdb" # core database health check
|
|
|
a89620 |
+
|
|
|
a89620 |
if [ -f "${OCF_RESKEY_ctdb_config_dir}/public_addresses" ]; then
|
|
|
a89620 |
chmod u+x "$event_dir/10.interface"
|
|
|
a89620 |
else
|
|
|
a89620 |
@@ -563,17 +565,6 @@ ctdb_start() {
|
|
|
a89620 |
rv=$?
|
|
|
a89620 |
[ $rv -ne 0 ] && return $rv
|
|
|
a89620 |
|
|
|
a89620 |
- # Die if databases are corrupted
|
|
|
a89620 |
- persistent_db_dir="${OCF_RESKEY_ctdb_dbdir}/persistent"
|
|
|
a89620 |
- mkdir -p $persistent_db_dir 2>/dev/null
|
|
|
a89620 |
- for pdbase in $persistent_db_dir/*.tdb.[0-9]; do
|
|
|
a89620 |
- [ -f "$pdbase" ] || break
|
|
|
a89620 |
- /usr/bin/tdbdump "$pdbase" >/dev/null 2>/dev/null || {
|
|
|
a89620 |
- ocf_exit_reason "Persistent database $pdbase is corrupted! CTDB will not start."
|
|
|
a89620 |
- return $OCF_ERR_GENERIC
|
|
|
a89620 |
- }
|
|
|
a89620 |
- done
|
|
|
a89620 |
-
|
|
|
a89620 |
# Add necessary configuration to smb.conf
|
|
|
a89620 |
init_smb_conf
|
|
|
a89620 |
if [ $? -ne 0 ]; then
|
|
|
a89620 |
@@ -737,9 +728,8 @@ ctdb_monitor() {
|
|
|
a89620 |
|
|
|
a89620 |
|
|
|
a89620 |
ctdb_validate() {
|
|
|
a89620 |
- # Required binaries (full path to tdbdump is intentional, as that's
|
|
|
a89620 |
- # what's used in ctdb_start, which was lifted from the init script)
|
|
|
a89620 |
- for binary in pkill /usr/bin/tdbdump; do
|
|
|
a89620 |
+ # Required binaries
|
|
|
a89620 |
+ for binary in pkill; do
|
|
|
a89620 |
check_binary $binary
|
|
|
a89620 |
done
|
|
|
a89620 |
|
|
|
a89620 |
|
|
|
a89620 |
From 1ff4ce7cbe58b5309f00ac1bbe124c562b6dcaf6 Mon Sep 17 00:00:00 2001
|
|
|
a89620 |
From: David Disseldorp <ddiss@suse.de>
|
|
|
a89620 |
Date: Fri, 27 Jul 2018 16:02:26 +0200
|
|
|
a89620 |
Subject: [PATCH 2/3] CTDB: explicitly use bash shell
|
|
|
a89620 |
|
|
|
a89620 |
Upcoming recovery lock substring processing is bash specific.
|
|
|
a89620 |
|
|
|
a89620 |
Signed-off-by: David Disseldorp <ddiss@suse.de>
|
|
|
a89620 |
---
|
|
|
a89620 |
configure.ac | 1 +
|
|
|
a89620 |
heartbeat/CTDB.in | 2 +-
|
|
|
a89620 |
2 files changed, 2 insertions(+), 1 deletion(-)
|
|
|
a89620 |
|
|
|
a89620 |
diff --git a/heartbeat/CTDB.in b/heartbeat/CTDB.in
|
|
|
a89620 |
index 7d87a4ef7..f9b5c564f 100755
|
|
|
a89620 |
--- a/heartbeat/CTDB.in
|
|
|
a89620 |
+++ b/heartbeat/CTDB.in
|
|
|
a89620 |
@@ -134,8 +134,8 @@ For more information see http://linux-ha.org/wiki/CTDB_(resource_agent)
|
|
|
a89620 |
|
|
|
a89620 |
<parameter name="ctdb_recovery_lock" unique="1" required="1">
|
|
|
a89620 |
<longdesc lang="en">
|
|
|
a89620 |
-The location of a shared lock file, common across all nodes.
|
|
|
a89620 |
-This must be on shared storage, e.g.: /shared-fs/samba/ctdb.lock
|
|
|
a89620 |
+The location of a shared lock file or helper binary, common across all nodes.
|
|
|
a89620 |
+See CTDB documentation for details.
|
|
|
a89620 |
</longdesc>
|
|
|
a89620 |
<shortdesc lang="en">CTDB shared lock file</shortdesc>
|
|
|
a89620 |
<content type="string" default="" />
|
|
|
a89620 |
@@ -757,13 +757,24 @@ ctdb_validate() {
|
|
|
a89620 |
return $OCF_ERR_CONFIGURED
|
|
|
a89620 |
fi
|
|
|
a89620 |
|
|
|
a89620 |
- lock_dir=$(dirname "$OCF_RESKEY_ctdb_recovery_lock")
|
|
|
a89620 |
- touch "$lock_dir/$$" 2>/dev/null
|
|
|
a89620 |
- if [ $? != 0 ]; then
|
|
|
a89620 |
- ocf_exit_reason "Directory for lock file '$OCF_RESKEY_ctdb_recovery_lock' does not exist, or is not writable."
|
|
|
a89620 |
- return $OCF_ERR_ARGS
|
|
|
a89620 |
+ if [ "${OCF_RESKEY_ctdb_recovery_lock:0:1}" == '!' ]; then
|
|
|
a89620 |
+ # '!' prefix means recovery lock is handled via a helper binary
|
|
|
a89620 |
+ binary="${OCF_RESKEY_ctdb_recovery_lock:1}"
|
|
|
a89620 |
+ binary="${binary%% *}" # trim any parameters
|
|
|
a89620 |
+ if [ -z "$binary" ]; then
|
|
|
a89620 |
+ ocf_exit_reason "ctdb_recovery_lock invalid helper"
|
|
|
a89620 |
+ return $OCF_ERR_CONFIGURED
|
|
|
a89620 |
+ fi
|
|
|
a89620 |
+ check_binary "${binary}"
|
|
|
a89620 |
+ else
|
|
|
a89620 |
+ lock_dir=$(dirname "$OCF_RESKEY_ctdb_recovery_lock")
|
|
|
a89620 |
+ touch "$lock_dir/$$" 2>/dev/null
|
|
|
a89620 |
+ if [ $? != 0 ]; then
|
|
|
a89620 |
+ ocf_exit_reason "Directory for lock file '$OCF_RESKEY_ctdb_recovery_lock' does not exist, or is not writable."
|
|
|
a89620 |
+ return $OCF_ERR_ARGS
|
|
|
a89620 |
+ fi
|
|
|
a89620 |
+ rm "$lock_dir/$$"
|
|
|
a89620 |
fi
|
|
|
a89620 |
- rm "$lock_dir/$$"
|
|
|
a89620 |
|
|
|
a89620 |
return $OCF_SUCCESS
|
|
|
a89620 |
}
|