[Pkg-samba-maint] r3170 - trunk/ctdb/debian

sathieu at alioth.debian.org sathieu at alioth.debian.org
Fri Dec 18 10:36:10 UTC 2009


Author: sathieu
Date: 2009-12-18 10:36:10 +0000 (Fri, 18 Dec 2009)
New Revision: 3170

Modified:
   trunk/ctdb/debian/ctdb.init
Log:
Cherry picked 52e6d81f4d8a4035272d9256d01bafb8ed593027

Modified: trunk/ctdb/debian/ctdb.init
===================================================================
--- trunk/ctdb/debian/ctdb.init	2009-12-17 21:36:15 UTC (rev 3169)
+++ trunk/ctdb/debian/ctdb.init	2009-12-18 10:36:10 UTC (rev 3170)
@@ -172,8 +172,33 @@
     maybe_set "--no-lmaster"             "$CTDB_CAPABILITY_LMASTER"   "no"
     maybe_set "--lvs --single-public-ip" "$CTDB_LVS_PUBLIC_IP"
     maybe_set "--script-log-level"       "$CTDB_SCRIPT_LOG_LEVEL"
+    maybe_set "--syslog"                 "$CTDB_SYSLOG"               "yes"
 }
 
+check_tdb () {
+	local PDBASE=$1
+
+	local TDBTOOL_HAS_CHECK=`echo "help" | /usr/bin/tdbtool | grep check | wc -l`
+
+	test x"$TDBTOOL_HAS_CHECK" = x"1" && {
+		#
+		# Note tdbtool always exits with 0
+		#
+		local OK=`/usr/bin/tdbtool $PDBASE check | grep "Database integrity is OK" | wc -l`
+		test x"$OK" = x"1" || {
+			return 1;
+		}
+
+		return 0;
+	}
+
+	/usr/bin/tdbdump $PDBASE >/dev/null 2>/dev/null || {
+		return $?;
+	}
+
+	return 0;
+}
+
 check_persistent_databases () {
     case $init_style in
         debian) PERSISTENT_DB_DIR="${CTDB_DBDIR:-/var/lib/ctdb}/persistent" ;;
@@ -181,7 +206,7 @@
     esac
     mkdir -p $PERSISTENT_DB_DIR 2>/dev/null
     for PDBASE in `ls $PERSISTENT_DB_DIR/*.tdb.[0-9] 2>/dev/null`; do
-        /usr/bin/tdbdump $PDBASE >/dev/null 2>/dev/null || {
+        check_tdb $PDBASE || {
         echo "Persistent database $PDBASE is corrupted! CTDB will not start."
         return 1
     }




More information about the Pkg-samba-maint mailing list