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