The Samba-Bugzilla – Attachment 13372 Details for
Bug 12891
Enable TDB mutexes in dbwrap and ctdb
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patches for v4-7
BZ12891-v4-7.patch (text/plain), 11.99 KB, created by
Amitay Isaacs
on 2017-07-13 07:14:03 UTC
(
hide
)
Description:
Patches for v4-7
Filename:
MIME Type:
Creator:
Amitay Isaacs
Created:
2017-07-13 07:14:03 UTC
Size:
11.99 KB
patch
obsolete
>From 55f26083c1f0473376d32d207032aa5bb088a598 Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Sun, 9 Jul 2017 16:20:11 +0200 >Subject: [PATCH 1/6] ctdb: enable mutexes for volatile TDBs by default > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=12891 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 2bce9cb72f3ac7efc2f4f48b0cffa1876364ae8c) >--- > 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..14f6828 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", 1, false, > 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 54035d090e671ff741500cbae224b1967541232b Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Sun, 9 Jul 2017 16:23:20 +0200 >Subject: [PATCH 2/6] dbwrap: enable mutexes by default for volatile TDBs > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=12891 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit a70be43246ab74f0a2bbe245ab31f24460b70547) >--- > 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 > > >From f984c4e9f6294d77d3bf372655f2df4195984a64 Mon Sep 17 00:00:00 2001 >From: Amitay Isaacs <amitay@gmail.com> >Date: Tue, 11 Jul 2017 00:38:59 +1000 >Subject: [PATCH 3/6] dbwrap: CTDB ignores tdb_flags passed to db attach > controls > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=12891 > >Signed-off-by: Amitay Isaacs <amitay@gmail.com> >Reviewed-by: Ralph Boehme <slow@samba.org> >(cherry picked from commit 6ae063a109ca88bf815fd1bf5e8865053bea41b9) >--- > source3/lib/ctdbd_conn.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c >index 3adb57d..d38789a 100644 >--- a/source3/lib/ctdbd_conn.c >+++ b/source3/lib/ctdbd_conn.c >@@ -832,7 +832,7 @@ int ctdbd_db_attach(struct ctdbd_connection *conn, > persistent > ? CTDB_CONTROL_DB_ATTACH_PERSISTENT > : CTDB_CONTROL_DB_ATTACH, >- tdb_flags, 0, data, NULL, &data, &cstatus); >+ 0, 0, data, NULL, &data, &cstatus); > if (ret != 0) { > DEBUG(0, (__location__ " ctdb_control for db_attach " > "failed: %s\n", strerror(ret))); >-- >2.9.4 > > >From 316499b41083f1099f87469360fbedd0ebeaef64 Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Tue, 11 Jul 2017 20:36:35 +0200 >Subject: [PATCH 4/6] ctdbd_conn: move CTDB_CONTROL_ENABLE_SEQNUM control to > db_open_ctdb > >No change in behaviour. > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=12891 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit 0077296cee1cd54a5adb12fc706cbf99203a8213) >--- > source3/lib/ctdbd_conn.c | 15 --------------- > source3/lib/dbwrap/dbwrap_ctdb.c | 16 ++++++++++++++++ > 2 files changed, 16 insertions(+), 15 deletions(-) > >diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c >index d38789a..70d3d83 100644 >--- a/source3/lib/ctdbd_conn.c >+++ b/source3/lib/ctdbd_conn.c >@@ -847,21 +847,6 @@ int ctdbd_db_attach(struct ctdbd_connection *conn, > *db_id = *(uint32_t *)data.dptr; > talloc_free(data.dptr); > >- if (!(tdb_flags & TDB_SEQNUM)) { >- return 0; >- } >- >- data.dptr = (uint8_t *)db_id; >- data.dsize = sizeof(*db_id); >- >- ret = ctdbd_control_local(conn, CTDB_CONTROL_ENABLE_SEQNUM, 0, 0, data, >- NULL, NULL, &cstatus); >- if ((ret != 0) || cstatus != 0) { >- DEBUG(0, (__location__ " ctdb_control for enable seqnum " >- "failed: %s\n", strerror(ret))); >- return (ret == 0) ? EIO : ret; >- } >- > return 0; > } > >diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c >index 8e303e6..001d2c4 100644 >--- a/source3/lib/dbwrap/dbwrap_ctdb.c >+++ b/source3/lib/dbwrap/dbwrap_ctdb.c >@@ -1779,6 +1779,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, > struct db_ctdb_ctx *db_ctdb; > char *db_path; > struct loadparm_context *lp_ctx; >+ TDB_DATA data; > int32_t cstatus; > int ret; > >@@ -1818,6 +1819,21 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, > return NULL; > } > >+ if (tdb_flags & TDB_SEQNUM) { >+ data.dptr = (uint8_t *)&db_ctdb->db_id; >+ data.dsize = sizeof(db_ctdb->db_id); >+ >+ ret = ctdbd_control_local(conn, CTDB_CONTROL_ENABLE_SEQNUM, >+ 0, 0, data, >+ NULL, NULL, &cstatus); >+ if ((ret != 0) || cstatus != 0) { >+ DBG_ERR("ctdb_control for enable seqnum " >+ "failed: %s\n", strerror(ret)); >+ TALLOC_FREE(result); >+ return NULL; >+ } >+ } >+ > db_path = ctdbd_dbpath(db_ctdb->conn, db_ctdb, db_ctdb->db_id); > > result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0); >-- >2.9.4 > > >From 25015a00e50f0156ffe1ce445622709ac7fe39c7 Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Tue, 11 Jul 2017 20:41:43 +0200 >Subject: [PATCH 5/6] ctdbd_conn: pass persistent bool instead of tdb_flags > >ctdbd_db_attach() only needs to know the ctdb database model, not the >rest of the flags. > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=12891 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> >(cherry picked from commit b2b7e3b9710fa22716f931177265dcd8de74532b) >--- > source3/include/ctdbd_conn.h | 2 +- > source3/lib/ctdbd_conn.c | 3 +-- > source3/lib/dbwrap/dbwrap_ctdb.c | 5 +++-- > 3 files changed, 5 insertions(+), 5 deletions(-) > >diff --git a/source3/include/ctdbd_conn.h b/source3/include/ctdbd_conn.h >index 06fbcc3..38477d3 100644 >--- a/source3/include/ctdbd_conn.h >+++ b/source3/include/ctdbd_conn.h >@@ -55,7 +55,7 @@ char *ctdbd_dbpath(struct ctdbd_connection *conn, > TALLOC_CTX *mem_ctx, uint32_t db_id); > > int ctdbd_db_attach(struct ctdbd_connection *conn, const char *name, >- uint32_t *db_id, int tdb_flags); >+ uint32_t *db_id, bool persistent); > > int ctdbd_migrate(struct ctdbd_connection *conn, uint32_t db_id, TDB_DATA key); > >diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c >index 70d3d83..b81feca 100644 >--- a/source3/lib/ctdbd_conn.c >+++ b/source3/lib/ctdbd_conn.c >@@ -819,12 +819,11 @@ char *ctdbd_dbpath(struct ctdbd_connection *conn, > * attach to a ctdb database > */ > int ctdbd_db_attach(struct ctdbd_connection *conn, >- const char *name, uint32_t *db_id, int tdb_flags) >+ const char *name, uint32_t *db_id, bool persistent) > { > int ret; > TDB_DATA data; > int32_t cstatus; >- bool persistent = (tdb_flags & TDB_CLEAR_IF_FIRST) == 0; > > data = string_term_tdb_data(name); > >diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c >index 001d2c4..07e35f8 100644 >--- a/source3/lib/dbwrap/dbwrap_ctdb.c >+++ b/source3/lib/dbwrap/dbwrap_ctdb.c >@@ -1780,6 +1780,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, > char *db_path; > struct loadparm_context *lp_ctx; > TDB_DATA data; >+ bool persistent = (tdb_flags & TDB_CLEAR_IF_FIRST); > int32_t cstatus; > int ret; > >@@ -1811,7 +1812,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, > db_ctdb->db = result; > db_ctdb->conn = conn; > >- ret = ctdbd_db_attach(db_ctdb->conn, name, &db_ctdb->db_id, tdb_flags); >+ ret = ctdbd_db_attach(db_ctdb->conn, name, &db_ctdb->db_id, persistent); > if (ret != 0) { > DEBUG(0, ("ctdbd_db_attach failed for %s: %s\n", name, > strerror(ret))); >@@ -1836,7 +1837,7 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, > > db_path = ctdbd_dbpath(db_ctdb->conn, db_ctdb, db_ctdb->db_id); > >- result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0); >+ result->persistent = persistent; > result->lock_order = lock_order; > > /* only pass through specific flags */ >-- >2.9.4 > > >From 0c8e25c9968bb194b7fc3ca94af70890f04f19c6 Mon Sep 17 00:00:00 2001 >From: Ralph Boehme <slow@samba.org> >Date: Tue, 11 Jul 2017 21:35:17 +0200 >Subject: [PATCH 6/6] dbwrap: Ask CTDB for local tdb open flags >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Bug: https://bugzilla.samba.org/show_bug.cgi?id=12891 > >Signed-off-by: Ralph Boehme <slow@samba.org> >Reviewed-by: Amitay Isaacs <amitay@gmail.com> > >Autobuild-User(master): Ralph Böhme <slow@samba.org> >Autobuild-Date(master): Wed Jul 12 13:25:11 CEST 2017 on sn-devel-144 > >(cherry picked from commit de9d21957706bd5d811db01b7b5d88a0bb17034b) >--- > source3/lib/dbwrap/dbwrap_ctdb.c | 22 +++++++++++++++++++--- > 1 file changed, 19 insertions(+), 3 deletions(-) > >diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c >index 07e35f8..6bdaab0 100644 >--- a/source3/lib/dbwrap/dbwrap_ctdb.c >+++ b/source3/lib/dbwrap/dbwrap_ctdb.c >@@ -1840,9 +1840,25 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx, > result->persistent = persistent; > result->lock_order = lock_order; > >- /* only pass through specific flags */ >- tdb_flags &= TDB_SEQNUM|TDB_VOLATILE| >- TDB_MUTEX_LOCKING|TDB_CLEAR_IF_FIRST; >+ data.dptr = (uint8_t *)&db_ctdb->db_id; >+ data.dsize = sizeof(db_ctdb->db_id); >+ >+ ret = ctdbd_control_local(conn, CTDB_CONTROL_DB_OPEN_FLAGS, >+ 0, 0, data, NULL, &data, &cstatus); >+ if (ret != 0) { >+ DBG_ERR(" ctdb control for db_open_flags " >+ "failed: %s\n", strerror(ret)); >+ TALLOC_FREE(result); >+ return NULL; >+ } >+ >+ if (cstatus != 0 || data.dsize != sizeof(int)) { >+ DBG_ERR("ctdb_control for db_open_flags failed\n"); >+ TALLOC_FREE(result); >+ return NULL; >+ } >+ >+ tdb_flags = *(int *)data.dptr; > > if (!result->persistent) { > ret = ctdb_async_ctx_init(NULL, messaging_tevent_context(msg_ctx)); >-- >2.9.4 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
slow
:
review+
Actions:
View
Attachments on
bug 12891
:
13372
|
13407