[PATCH] Enable TDB mutexes by default in dbwrap and ctdb

Ralph Böhme slow at samba.org
Mon Jul 10 10:17:50 UTC 2017


Hi all,

as discussed previously, attached patchset enables TDB mutexes by default in
dbwrap and in ctdb.

Amitay and Martin: did I miss any pieces in ctdb?

I filed a bugnumber for this to get it into 4.7.

Please review.

Cheerio!
-slow
-------------- next part --------------
From ac1fb434609376cd2639a781ae2384ac5e10d221 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Sun, 9 Jul 2017 16:20:11 +0200
Subject: [PATCH 1/2] ctdb: enable mutexes for volatile TDBs by default

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12891

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 ctdb/common/tunable.c                | 2 +-
 ctdb/config/ctdbd.conf               | 2 +-
 ctdb/doc/ctdb-tunables.7.xml         | 2 +-
 ctdb/doc/ctdb.1.xml                  | 2 +-
 ctdb/tests/tool/ctdb.listvars.001.sh | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/ctdb/common/tunable.c b/ctdb/common/tunable.c
index ed7a52d..e218801 100644
--- a/ctdb/common/tunable.c
+++ b/ctdb/common/tunable.c
@@ -145,7 +145,7 @@ static struct {
 		offsetof(struct ctdb_tunable_list, no_ip_host_on_all_disabled) },
 	{ "Samba3AvoidDeadlocks", 0, true,
 		offsetof(struct ctdb_tunable_list, samba3_hack) },
-	{ "TDBMutexEnabled", 0, false,
+	{ "TDBMutexEnabled", 0, true,
 		offsetof(struct ctdb_tunable_list, mutex_enabled) },
 	{ "LockProcessesPerDB", 200, false,
 		offsetof(struct ctdb_tunable_list, lock_processes_per_db) },
diff --git a/ctdb/config/ctdbd.conf b/ctdb/config/ctdbd.conf
index e75c65c..2d525c5 100644
--- a/ctdb/config/ctdbd.conf
+++ b/ctdb/config/ctdbd.conf
@@ -29,4 +29,4 @@
 # CTDB_DEBUGLEVEL=ERR
 
 # Set some CTDB tunable variables during CTDB startup?
-# CTDB_SET_TDBMutexEnabled=1
+# CTDB_SET_TDBMutexEnabled=0
diff --git a/ctdb/doc/ctdb-tunables.7.xml b/ctdb/doc/ctdb-tunables.7.xml
index d0bb450..7b059b7 100644
--- a/ctdb/doc/ctdb-tunables.7.xml
+++ b/ctdb/doc/ctdb-tunables.7.xml
@@ -658,7 +658,7 @@
 
     <refsect2>
       <title>TDBMutexEnabled</title>
-      <para>Default: 0</para>
+      <para>Default: 1</para>
       <para>
 	This parameter enables TDB_MUTEX_LOCKING feature on volatile
 	databases if the robust mutexes are supported. This optimizes the
diff --git a/ctdb/doc/ctdb.1.xml b/ctdb/doc/ctdb.1.xml
index 1af1f50..3aceb73 100644
--- a/ctdb/doc/ctdb.1.xml
+++ b/ctdb/doc/ctdb.1.xml
@@ -843,7 +843,7 @@ DBRecordSizeWarn        = 10000000
 DBSizeWarn              = 100000000
 PullDBPreallocation     = 10485760
 NoIPHostOnAllDisabled   = 0
-TDBMutexEnabled         = 0
+TDBMutexEnabled         = 1
 LockProcessesPerDB      = 200
 RecBufferSizeLimit      = 1000000
 QueueBufferSize         = 1024
diff --git a/ctdb/tests/tool/ctdb.listvars.001.sh b/ctdb/tests/tool/ctdb.listvars.001.sh
index f6010a4..fc8f42c 100755
--- a/ctdb/tests/tool/ctdb.listvars.001.sh
+++ b/ctdb/tests/tool/ctdb.listvars.001.sh
@@ -59,7 +59,7 @@ DBRecordSizeWarn           = 10000000
 DBSizeWarn                 = 100000000
 PullDBPreallocation        = 10485760
 NoIPHostOnAllDisabled      = 0
-TDBMutexEnabled            = 0
+TDBMutexEnabled            = 1
 LockProcessesPerDB         = 200
 RecBufferSizeLimit         = 1000000
 QueueBufferSize            = 1024
-- 
2.9.4


From 9668d91b5899a7f3a6d7e529bf9ff8c4c0c13747 Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Sun, 9 Jul 2017 16:23:20 +0200
Subject: [PATCH 2/2] dbwrap: enable mutexes by default for volatile TDBs

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12891

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 source3/lib/dbwrap/dbwrap_open.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c
index 55e0adb..801ebcb 100644
--- a/source3/lib/dbwrap/dbwrap_open.c
+++ b/source3/lib/dbwrap/dbwrap_open.c
@@ -98,7 +98,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
 
 	if (tdb_flags & TDB_CLEAR_IF_FIRST) {
 		const char *base;
-		bool try_mutex = false;
+		bool try_mutex = true;
 		bool require_mutex = false;
 
 		base = strrchr_m(name, '/');
-- 
2.9.4



More information about the samba-technical mailing list