From 5cb78383fafa15c2ff7a4ccd194cccd5cf5cd263 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 19 Jan 2007 03:54:48 +0000 Subject: r20889: import ctdb cluster backend from bzr it will be interesting to see how the build farm handles this (This used to be commit 53be449630bd67d649a9e70cc7e25a9799c0616b) --- source4/cluster/ctdb/ctdb_cluster.c | 138 ++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 source4/cluster/ctdb/ctdb_cluster.c (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c new file mode 100644 index 0000000000..df16f2f8b5 --- /dev/null +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -0,0 +1,138 @@ +/* + Unix SMB/CIFS implementation. + + ctdb clustering hooks + + Copyright (C) Andrew Tridgell 2006 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "lib/events/events.h" +#include "cluster/cluster.h" +#include "system/filesys.h" +#include "cluster/cluster_private.h" +#include "lib/tdb/include/tdb.h" +#include "cluster/ctdb/include/ctdb.h" + +struct cluster_state { + struct ctdb_context *ctdb; +}; + + +/* + return a server_id for a ctdb node +*/ +static struct server_id ctdb_id(struct cluster_ops *ops, uint32_t id) +{ + struct ctdb_context *ctdb = ops->private; + struct server_id server_id; + server_id.node = ctdb_get_vnn(ctdb); + server_id.id = id; + return server_id; +} + + +/* + return a server_id as a string +*/ +static const char *ctdb_id_string(struct cluster_ops *ops, + TALLOC_CTX *mem_ctx, struct server_id id) +{ + return talloc_asprintf(mem_ctx, "%u.%u", id.node, id.id); +} + +static struct cluster_ops cluster_ctdb_ops = { + .cluster_id = ctdb_id, + .cluster_id_string = ctdb_id_string, + .private = NULL +}; + +/* initialise ctdb */ +void cluster_ctdb_init(struct event_context *ev) +{ + const char *nlist; + const char *address; + const char *transport; + struct cluster_state *state; + int ret; + + nlist = lp_parm_string(-1, "ctdb", "nlist"); + if (nlist == NULL) return; + + address = lp_parm_string(-1, "ctdb", "address"); + if (address == NULL) return; + + transport = lp_parm_string(-1, "ctdb", "transport"); + if (transport == NULL) { + transport = "tcp"; + } + + state = talloc(ev, struct cluster_state); + if (state == NULL) goto failed; + + state->ctdb = ctdb_init(ev); + if (state->ctdb == NULL) goto failed; + + cluster_ctdb_ops.private = state->ctdb; + + ret = ctdb_set_transport(state->ctdb, transport); + if (ret == -1) { + DEBUG(0,("ctdb_set_transport failed - %s\n", + ctdb_errstr(state->ctdb))); + goto failed; + } + +// ctdb_set_flags(state->ctdb, CTDB_FLAG_SELF_CONNECT); + + /* tell ctdb what address to listen on */ + ret = ctdb_set_address(state->ctdb, address); + if (ret == -1) { + DEBUG(0,("ctdb_set_address failed - %s\n", ctdb_errstr(state->ctdb))); + goto failed; + } + + /* tell ctdb what nodes are available */ + ret = ctdb_set_nlist(state->ctdb, nlist); + if (ret == -1) { + DEBUG(0,("ctdb_set_nlist failed - %s\n", ctdb_errstr(state->ctdb))); + goto failed; + } + + ret = ctdb_attach(state->ctdb, "cluster.tdb", TDB_DEFAULT, O_RDWR|O_CREAT|O_TRUNC, 0666); + if (ret == -1) { + DEBUG(0,("ctdb_attach failed - %s\n", ctdb_errstr(state->ctdb))); + goto failed; + } + + /* start the protocol running */ + ret = ctdb_start(state->ctdb); + if (ret == -1) { + DEBUG(0,("ctdb_start failed - %s\n", ctdb_errstr(state->ctdb))); + goto failed; + } + + /* wait until all nodes are connected (should not be needed + outide of test code) */ + ctdb_connect_wait(state->ctdb); + + cluster_set_ops(&cluster_ctdb_ops); + return; + +failed: + DEBUG(0,("cluster_ctdb_init failed\n")); + talloc_free(state); +} -- cgit From 2e8a95ced74c010261029f8ab20c346d5b692848 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 19 Jan 2007 04:07:21 +0000 Subject: r20892: add parameter for enabling ctdb self connect (This used to be commit ba3ce8abe3457a1245fd4746af780c6055d39425) --- source4/cluster/ctdb/ctdb_cluster.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index df16f2f8b5..49a61ff494 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -95,8 +95,11 @@ void cluster_ctdb_init(struct event_context *ev) ctdb_errstr(state->ctdb))); goto failed; } - -// ctdb_set_flags(state->ctdb, CTDB_FLAG_SELF_CONNECT); + + if (lp_parm_bool(-1, "ctdb", "selfconnect", False)) { + DEBUG(0,("Enabling ctdb selfconnect\n")); + ctdb_set_flags(state->ctdb, CTDB_FLAG_SELF_CONNECT); + } /* tell ctdb what address to listen on */ ret = ctdb_set_address(state->ctdb, address); -- cgit From faf800d871b72ca4938c5f392d8b6183cce16e9d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 19 Jan 2007 04:32:04 +0000 Subject: r20896: make the maximum lacount configurable in smb.conf at the moment the brlock_ctdb backend will sometimes fail after dmaster migrations. So to pass tests this needs to be set high. Thats a priority to fix. (This used to be commit 45f5c272f366f6a793941d97c9522c5b2b0cb639) --- source4/cluster/ctdb/ctdb_cluster.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 49a61ff494..183d5c1831 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -68,7 +68,7 @@ void cluster_ctdb_init(struct event_context *ev) const char *address; const char *transport; struct cluster_state *state; - int ret; + int ret, lacount; nlist = lp_parm_string(-1, "ctdb", "nlist"); if (nlist == NULL) return; @@ -101,6 +101,11 @@ void cluster_ctdb_init(struct event_context *ev) ctdb_set_flags(state->ctdb, CTDB_FLAG_SELF_CONNECT); } + lacount = lp_parm_int(-1, "ctdb", "maxlacount", -1); + if (lacount != -1) { + ctdb_set_max_lacount(state->ctdb, lacount); + } + /* tell ctdb what address to listen on */ ret = ctdb_set_address(state->ctdb, address); if (ret == -1) { -- cgit From efc68d8bf6d5acc009285e8f34b30a3a5b252884 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 20 Jan 2007 00:48:31 +0000 Subject: r20919: add a function cluster_tdb_tmp_open() which can be used in a cluster environment for subsystems that have not yet been converted to use ctdb to get a shared temporary tdb (This used to be commit 0ed91384497aed6817b2220c31344bfcd45fd033) --- source4/cluster/ctdb/ctdb_cluster.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 183d5c1831..0e7255f060 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -27,6 +27,7 @@ #include "cluster/cluster_private.h" #include "lib/tdb/include/tdb.h" #include "cluster/ctdb/include/ctdb.h" +#include "db_wrap.h" struct cluster_state { struct ctdb_context *ctdb; @@ -55,9 +56,35 @@ static const char *ctdb_id_string(struct cluster_ops *ops, return talloc_asprintf(mem_ctx, "%u.%u", id.node, id.id); } +/* + this is an interim method for subsystems that have not yet been + converted to use the ctdb api. It opens a shared database in the + cluster temporary area, using TDB_CLEAR_IF_FIRST which relies on + correct operation of fcntl locks on the shared fileystem. +*/ +static struct tdb_wrap *ctdb_tdb_tmp_open(struct cluster_ops *ops, + TALLOC_CTX *mem_ctx, const char *dbname, + int flags) +{ + const char *dir = lp_parm_string(-1, "ctdb", "shared data"); + char *path; + struct tdb_wrap *w; + if (dir == NULL) { + DEBUG(0,("ERROR: You must set 'ctdb:shared data' to a cluster shared path\n")); + return NULL; + } + path = talloc_asprintf(mem_ctx, "%s/%s", dir, dbname); + w = tdb_wrap_open(mem_ctx, path, 0, + flags | TDB_CLEAR_IF_FIRST, + O_RDWR|O_CREAT, 0600); + talloc_free(path); + return w; +} + static struct cluster_ops cluster_ctdb_ops = { - .cluster_id = ctdb_id, - .cluster_id_string = ctdb_id_string, + .cluster_id = ctdb_id, + .cluster_id_string = ctdb_id_string, + .cluster_tdb_tmp_open = ctdb_tdb_tmp_open, .private = NULL }; -- cgit From e7d0d22806e249e315c0cb6ebed4caa93b80e8e5 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 24 Jan 2007 04:34:19 +0000 Subject: r20991: use relative includes for ctdb headers. This works with both standalone and built-in ctdb (This used to be commit 3e5f29bddfd83914eeec706367b2b1bd30aba31e) --- source4/cluster/ctdb/ctdb_cluster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 0e7255f060..1d8d3a5252 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -26,7 +26,7 @@ #include "system/filesys.h" #include "cluster/cluster_private.h" #include "lib/tdb/include/tdb.h" -#include "cluster/ctdb/include/ctdb.h" +#include "include/ctdb.h" #include "db_wrap.h" struct cluster_state { -- cgit From 07478016d7354274cd53ff2b4ec1dda3f0f439d1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 8 Feb 2007 00:58:17 +0000 Subject: r21230: added the hooks needed in the cluster layer and the messaging code for handling messages to remote nodes. Implemented dummy functions in the 'local' cluster backend for the messaging hooks, and modified the messaging layer to check if the destination is remote and redirect messages via the cluster layer (This used to be commit 4474552e8fb73efebef32ad8480d7fe9a1e379ef) --- source4/cluster/ctdb/ctdb_cluster.c | 38 +++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 1d8d3a5252..464cb8ecba 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -39,7 +39,8 @@ struct cluster_state { */ static struct server_id ctdb_id(struct cluster_ops *ops, uint32_t id) { - struct ctdb_context *ctdb = ops->private; + struct cluster_state *state = ops->private; + struct ctdb_context *ctdb = state->ctdb; struct server_id server_id; server_id.node = ctdb_get_vnn(ctdb); server_id.id = id; @@ -81,10 +82,43 @@ static struct tdb_wrap *ctdb_tdb_tmp_open(struct cluster_ops *ops, return w; } +/* + get at the ctdb handle +*/ +static void *ctdb_backend_handle(struct cluster_ops *ops) +{ + struct cluster_state *state = ops->private; + return (void *)state->ctdb; +} + +/* + setup a handler for ctdb messages +*/ +static NTSTATUS ctdb_message_init(struct cluster_ops *ops, + struct messaging_context *msg, + struct server_id server, + cluster_message_fn_t handler) +{ + return NT_STATUS_OK; +} + +/* + send a ctdb message to another node +*/ +static NTSTATUS ctdb_message_send(struct cluster_ops *ops, + struct server_id server, uint32_t msg_type, + DATA_BLOB *data) +{ + return NT_STATUS_INVALID_DEVICE_REQUEST; +} + static struct cluster_ops cluster_ctdb_ops = { .cluster_id = ctdb_id, .cluster_id_string = ctdb_id_string, .cluster_tdb_tmp_open = ctdb_tdb_tmp_open, + .backend_handle = ctdb_backend_handle, + .message_init = ctdb_message_init, + .message_send = ctdb_message_send, .private = NULL }; @@ -114,7 +148,7 @@ void cluster_ctdb_init(struct event_context *ev) state->ctdb = ctdb_init(ev); if (state->ctdb == NULL) goto failed; - cluster_ctdb_ops.private = state->ctdb; + cluster_ctdb_ops.private = state; ret = ctdb_set_transport(state->ctdb, transport); if (ret == -1) { -- cgit From a2eff69b4b26ba6b3227b4bbe4557bc9b618d400 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 8 Feb 2007 02:59:58 +0000 Subject: r21233: first version of samba4 messaging using ctdb is working. This means we should now work on a real cluster, and not just a localhost simulator (This used to be commit f05072ad74fb08fd906bc500c5e89930bcc3387f) --- source4/cluster/ctdb/ctdb_cluster.c | 78 ++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 464cb8ecba..95adbafadf 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -28,12 +28,25 @@ #include "lib/tdb/include/tdb.h" #include "include/ctdb.h" #include "db_wrap.h" +#include "lib/util/dlinklist.h" + +/* a linked list of messaging handlers, allowing incoming messages + to be directed to the right messaging context */ +struct cluster_messaging_list { + struct cluster_messaging_list *next, *prev; + struct cluster_state *state; + struct messaging_context *msg; + struct server_id server; + cluster_message_fn_t handler; +}; struct cluster_state { struct ctdb_context *ctdb; + struct cluster_messaging_list *list; }; + /* return a server_id for a ctdb node */ @@ -91,6 +104,33 @@ static void *ctdb_backend_handle(struct cluster_ops *ops) return (void *)state->ctdb; } +/* + dispatch incoming ctdb messages +*/ +static void ctdb_message_handler(struct ctdb_context *ctdb, uint32_t srvid, + TDB_DATA data, void *private) +{ + struct cluster_state *state = talloc_get_type(private, struct cluster_state); + struct cluster_messaging_list *m; + for (m=state->list;m;m=m->next) { + if (srvid == m->server.id) { + DATA_BLOB bdata; + bdata.data = data.dptr; + bdata.length = data.dsize; + m->handler(m->msg, bdata); + } + } +} + +/* + destroy a element of messaging list (when messaging context goes away) +*/ +static int cluster_messaging_destructor(struct cluster_messaging_list *m) +{ + DLIST_REMOVE(m->state->list, m); + return 0; +} + /* setup a handler for ctdb messages */ @@ -99,6 +139,19 @@ static NTSTATUS ctdb_message_init(struct cluster_ops *ops, struct server_id server, cluster_message_fn_t handler) { + struct cluster_state *state = ops->private; + struct cluster_messaging_list *m; + m = talloc(msg, struct cluster_messaging_list); + NT_STATUS_HAVE_NO_MEMORY(m); + + m->state = state; + m->msg = msg; + m->server = server; + m->handler = handler; + DLIST_ADD(state->list, m); + + talloc_set_destructor(m, cluster_messaging_destructor); + return NT_STATUS_OK; } @@ -109,7 +162,19 @@ static NTSTATUS ctdb_message_send(struct cluster_ops *ops, struct server_id server, uint32_t msg_type, DATA_BLOB *data) { - return NT_STATUS_INVALID_DEVICE_REQUEST; + struct cluster_state *state = ops->private; + struct ctdb_context *ctdb = state->ctdb; + TDB_DATA tdata; + int ret; + + tdata.dptr = data->data; + tdata.dsize = data->length; + + ret = ctdb_send_message(ctdb, server.node, server.id, msg_type, tdata); + if (ret != 0) { + return NT_STATUS_INTERNAL_DB_CORRUPTION; + } + return NT_STATUS_OK; } static struct cluster_ops cluster_ctdb_ops = { @@ -148,6 +213,8 @@ void cluster_ctdb_init(struct event_context *ev) state->ctdb = ctdb_init(ev); if (state->ctdb == NULL) goto failed; + state->list = NULL; + cluster_ctdb_ops.private = state; ret = ctdb_set_transport(state->ctdb, transport); @@ -181,6 +248,14 @@ void cluster_ctdb_init(struct event_context *ev) goto failed; } + /* setup messaging handler */ + ret = ctdb_set_message_handler(state->ctdb, ctdb_message_handler, state); + if (ret == -1) { + DEBUG(0,("ctdb_set_message_handler failed - %s\n", + ctdb_errstr(state->ctdb))); + goto failed; + } + ret = ctdb_attach(state->ctdb, "cluster.tdb", TDB_DEFAULT, O_RDWR|O_CREAT|O_TRUNC, 0666); if (ret == -1) { DEBUG(0,("ctdb_attach failed - %s\n", ctdb_errstr(state->ctdb))); @@ -199,6 +274,7 @@ void cluster_ctdb_init(struct event_context *ev) ctdb_connect_wait(state->ctdb); cluster_set_ops(&cluster_ctdb_ops); + return; failed: -- cgit From 8de4c33d8f089f2f47817278f8781f194da898d0 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 9 Feb 2007 01:52:13 +0000 Subject: r21256: - msg_type is not needed in the cluster messaging API - merge ctdb_get_num_nodes() from bzr tree (This used to be commit 3df7527aedeba7ce2f4a6ca2d3b7167f58c6b68a) --- source4/cluster/ctdb/ctdb_cluster.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 95adbafadf..917a56d2b8 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -159,8 +159,7 @@ static NTSTATUS ctdb_message_init(struct cluster_ops *ops, send a ctdb message to another node */ static NTSTATUS ctdb_message_send(struct cluster_ops *ops, - struct server_id server, uint32_t msg_type, - DATA_BLOB *data) + struct server_id server, DATA_BLOB *data) { struct cluster_state *state = ops->private; struct ctdb_context *ctdb = state->ctdb; @@ -170,7 +169,7 @@ static NTSTATUS ctdb_message_send(struct cluster_ops *ops, tdata.dptr = data->data; tdata.dsize = data->length; - ret = ctdb_send_message(ctdb, server.node, server.id, msg_type, tdata); + ret = ctdb_send_message(ctdb, server.node, server.id, tdata); if (ret != 0) { return NT_STATUS_INTERNAL_DB_CORRUPTION; } -- cgit From a78be2150ba06738f4c7e85ca2980200d4a3c533 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 4 Apr 2007 04:57:30 +0000 Subject: r22070: merge in the changes from the bzr ctdb tree, and convert the brlock ctdb backend to use the updated multi-database API (This used to be commit 44dcac9e4d81bfc078512248967b6240db9d1bd8) --- source4/cluster/ctdb/ctdb_cluster.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 917a56d2b8..4892f3e173 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -193,7 +193,8 @@ void cluster_ctdb_init(struct event_context *ev) const char *address; const char *transport; struct cluster_state *state; - int ret, lacount; + int ret, lacount, i; + const char *db_list[] = { "brlock", "opendb" }; nlist = lp_parm_string(-1, "ctdb", "nlist"); if (nlist == NULL) return; @@ -255,10 +256,12 @@ void cluster_ctdb_init(struct event_context *ev) goto failed; } - ret = ctdb_attach(state->ctdb, "cluster.tdb", TDB_DEFAULT, O_RDWR|O_CREAT|O_TRUNC, 0666); - if (ret == -1) { - DEBUG(0,("ctdb_attach failed - %s\n", ctdb_errstr(state->ctdb))); - goto failed; + /* attach all the databases we will need */ + for (i=0;ictdb, db_list[i], TDB_DEFAULT, + O_RDWR|O_CREAT|O_TRUNC, 0666); + if (ctdb_db == NULL) goto failed; } /* start the protocol running */ -- cgit From 23508a7c86ada00038cc903af511550e570f5673 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 5 Apr 2007 04:20:55 +0000 Subject: r22084: use a TDB_INTERNAL tdb for the local ctdb tdb for now (This used to be commit e2fe45cf4073b68e2a1c6577928d0765e26f3267) --- source4/cluster/ctdb/ctdb_cluster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 4892f3e173..ceff53ee5d 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -259,7 +259,7 @@ void cluster_ctdb_init(struct event_context *ev) /* attach all the databases we will need */ for (i=0;ictdb, db_list[i], TDB_DEFAULT, + ctdb_db = ctdb_attach(state->ctdb, db_list[i], TDB_INTERNAL, O_RDWR|O_CREAT|O_TRUNC, 0666); if (ctdb_db == NULL) goto failed; } -- cgit From c9f04d8648cfdd573d45d47467bc964ef01f754d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 16 Apr 2007 00:18:54 +0000 Subject: r22231: merge from bzr ctdb tree (This used to be commit 807b959082d3b9a929c9f6597714e636638a940e) --- source4/cluster/ctdb/ctdb_cluster.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index ceff53ee5d..aee47c6281 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -141,6 +141,17 @@ static NTSTATUS ctdb_message_init(struct cluster_ops *ops, { struct cluster_state *state = ops->private; struct cluster_messaging_list *m; + int ret; + + /* setup messaging handler */ + ret = ctdb_set_message_handler(state->ctdb, ctdb_message_handler, + server.id, state); + if (ret == -1) { + DEBUG(0,("ctdb_set_message_handler failed - %s\n", + ctdb_errstr(state->ctdb))); + exit(1); + } + m = talloc(msg, struct cluster_messaging_list); NT_STATUS_HAVE_NO_MEMORY(m); @@ -248,14 +259,6 @@ void cluster_ctdb_init(struct event_context *ev) goto failed; } - /* setup messaging handler */ - ret = ctdb_set_message_handler(state->ctdb, ctdb_message_handler, state); - if (ret == -1) { - DEBUG(0,("ctdb_set_message_handler failed - %s\n", - ctdb_errstr(state->ctdb))); - goto failed; - } - /* attach all the databases we will need */ for (i=0;i Date: Mon, 16 Apr 2007 00:29:13 +0000 Subject: r22232: add a special message handler ID meaning "all messages please" This better fits the way Samba4 does message dispatch (This used to be commit 2c12f8e72fb999f4f66700291dd4d7f6f73a8eae) --- source4/cluster/ctdb/ctdb_cluster.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index aee47c6281..82eea6a3d4 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -144,8 +144,8 @@ static NTSTATUS ctdb_message_init(struct cluster_ops *ops, int ret; /* setup messaging handler */ - ret = ctdb_set_message_handler(state->ctdb, ctdb_message_handler, - server.id, state); + ret = ctdb_set_message_handler(state->ctdb, CTDB_SRVID_ALL, + ctdb_message_handler, state); if (ret == -1) { DEBUG(0,("ctdb_set_message_handler failed - %s\n", ctdb_errstr(state->ctdb))); -- cgit From e24cf892883b54a567f294eacbd94a23d7d420e4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 16 Apr 2007 04:47:11 +0000 Subject: r22234: merge test suite changes from bzr tree (This used to be commit d825f4e6cc96a365061805352a2df3818df2364e) --- source4/cluster/ctdb/ctdb_cluster.c | 63 +++++++++++-------------------------- 1 file changed, 18 insertions(+), 45 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 82eea6a3d4..c9233696e8 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -110,25 +110,6 @@ static void *ctdb_backend_handle(struct cluster_ops *ops) static void ctdb_message_handler(struct ctdb_context *ctdb, uint32_t srvid, TDB_DATA data, void *private) { - struct cluster_state *state = talloc_get_type(private, struct cluster_state); - struct cluster_messaging_list *m; - for (m=state->list;m;m=m->next) { - if (srvid == m->server.id) { - DATA_BLOB bdata; - bdata.data = data.dptr; - bdata.length = data.dsize; - m->handler(m->msg, bdata); - } - } -} - -/* - destroy a element of messaging list (when messaging context goes away) -*/ -static int cluster_messaging_destructor(struct cluster_messaging_list *m) -{ - DLIST_REMOVE(m->state->list, m); - return 0; } /* @@ -139,30 +120,7 @@ static NTSTATUS ctdb_message_init(struct cluster_ops *ops, struct server_id server, cluster_message_fn_t handler) { - struct cluster_state *state = ops->private; - struct cluster_messaging_list *m; - int ret; - - /* setup messaging handler */ - ret = ctdb_set_message_handler(state->ctdb, CTDB_SRVID_ALL, - ctdb_message_handler, state); - if (ret == -1) { - DEBUG(0,("ctdb_set_message_handler failed - %s\n", - ctdb_errstr(state->ctdb))); - exit(1); - } - - m = talloc(msg, struct cluster_messaging_list); - NT_STATUS_HAVE_NO_MEMORY(m); - - m->state = state; - m->msg = msg; - m->server = server; - m->handler = handler; - DLIST_ADD(state->list, m); - - talloc_set_destructor(m, cluster_messaging_destructor); - + /* nothing to do - we're now using the wildcard message handler */ return NT_STATUS_OK; } @@ -198,7 +156,7 @@ static struct cluster_ops cluster_ctdb_ops = { }; /* initialise ctdb */ -void cluster_ctdb_init(struct event_context *ev) +void cluster_ctdb_init(struct event_context *ev, const char *model) { const char *nlist; const char *address; @@ -240,6 +198,11 @@ void cluster_ctdb_init(struct event_context *ev) ctdb_set_flags(state->ctdb, CTDB_FLAG_SELF_CONNECT); } + if (strcmp(model, "single") != 0) { + DEBUG(0,("Enabling ctdb daemon mode\n")); + ctdb_set_flags(state->ctdb, CTDB_FLAG_DAEMON_MODE); + } + lacount = lp_parm_int(-1, "ctdb", "maxlacount", -1); if (lacount != -1) { ctdb_set_max_lacount(state->ctdb, lacount); @@ -267,6 +230,15 @@ void cluster_ctdb_init(struct event_context *ev) if (ctdb_db == NULL) goto failed; } + /* setup a global message handler */ + ret = ctdb_set_message_handler(state->ctdb, CTDB_SRVID_ALL, + ctdb_message_handler, state); + if (ret == -1) { + DEBUG(0,("ctdb_set_message_handler failed - %s\n", + ctdb_errstr(state->ctdb))); + exit(1); + } + /* start the protocol running */ ret = ctdb_start(state->ctdb); if (ret == -1) { @@ -275,7 +247,7 @@ void cluster_ctdb_init(struct event_context *ev) } /* wait until all nodes are connected (should not be needed - outide of test code) */ + outside of test code) */ ctdb_connect_wait(state->ctdb); cluster_set_ops(&cluster_ctdb_ops); @@ -286,3 +258,4 @@ failed: DEBUG(0,("cluster_ctdb_init failed\n")); talloc_free(state); } + -- cgit From 650d81b252cc669ef848448afad7e9bb79c4f20e Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 21 Apr 2007 07:23:42 +0000 Subject: r22421: merged in latest ctdb changes from bzr (This used to be commit 3633f862b966866819c9a0a6ad0238a858e15e62) --- source4/cluster/ctdb/ctdb_cluster.c | 69 ++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 16 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index c9233696e8..e3e60685b0 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -104,12 +104,30 @@ static void *ctdb_backend_handle(struct cluster_ops *ops) return (void *)state->ctdb; } +struct ctdb_handler_state { + struct cluster_state *state; + cluster_message_fn_t handler; + struct messaging_context *msg; +}; + /* dispatch incoming ctdb messages */ static void ctdb_message_handler(struct ctdb_context *ctdb, uint32_t srvid, TDB_DATA data, void *private) { + struct ctdb_handler_state *s = talloc_get_type(private, + struct ctdb_handler_state); + DATA_BLOB blob; + blob.data = data.dptr; + blob.length = data.dsize; + s->handler(s->msg, blob); +} + +static int ctdb_handler_destructor(struct ctdb_handler_state *s) +{ + /* XXX - tell ctdb to de-register the message handler */ + return 0; } /* @@ -120,7 +138,28 @@ static NTSTATUS ctdb_message_init(struct cluster_ops *ops, struct server_id server, cluster_message_fn_t handler) { - /* nothing to do - we're now using the wildcard message handler */ + struct cluster_state *state = ops->private; + struct ctdb_handler_state *h; + int ret; + + h = talloc(msg, struct ctdb_handler_state); + NT_STATUS_HAVE_NO_MEMORY(h); + + h->state = state; + h->handler = handler; + h->msg = msg; + + talloc_set_destructor(h, ctdb_handler_destructor); + + /* setup a message handler */ + ret = ctdb_set_message_handler(state->ctdb, server.id, + ctdb_message_handler, h); + if (ret == -1) { + DEBUG(0,("ctdb_set_message_handler failed - %s\n", + ctdb_errstr(state->ctdb))); + exit(1); + } + return NT_STATUS_OK; } @@ -198,11 +237,6 @@ void cluster_ctdb_init(struct event_context *ev, const char *model) ctdb_set_flags(state->ctdb, CTDB_FLAG_SELF_CONNECT); } - if (strcmp(model, "single") != 0) { - DEBUG(0,("Enabling ctdb daemon mode\n")); - ctdb_set_flags(state->ctdb, CTDB_FLAG_DAEMON_MODE); - } - lacount = lp_parm_int(-1, "ctdb", "maxlacount", -1); if (lacount != -1) { ctdb_set_max_lacount(state->ctdb, lacount); @@ -215,6 +249,12 @@ void cluster_ctdb_init(struct event_context *ev, const char *model) goto failed; } + ret = ctdb_set_tdb_dir(state->ctdb, lp_lockdir()); + if (ret == -1) { + DEBUG(0,("ctdb_set_tdb_dir failed - %s\n", ctdb_errstr(state->ctdb))); + goto failed; + } + /* tell ctdb what nodes are available */ ret = ctdb_set_nlist(state->ctdb, nlist); if (ret == -1) { @@ -230,14 +270,13 @@ void cluster_ctdb_init(struct event_context *ev, const char *model) if (ctdb_db == NULL) goto failed; } - /* setup a global message handler */ - ret = ctdb_set_message_handler(state->ctdb, CTDB_SRVID_ALL, - ctdb_message_handler, state); - if (ret == -1) { - DEBUG(0,("ctdb_set_message_handler failed - %s\n", - ctdb_errstr(state->ctdb))); - exit(1); - } + cluster_set_ops(&cluster_ctdb_ops); + + /* nasty hack for now ... */ + { + void brl_ctdb_init_ops(void); + brl_ctdb_init_ops(); + } /* start the protocol running */ ret = ctdb_start(state->ctdb); @@ -250,8 +289,6 @@ void cluster_ctdb_init(struct event_context *ev, const char *model) outside of test code) */ ctdb_connect_wait(state->ctdb); - cluster_set_ops(&cluster_ctdb_ops); - return; failed: -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/cluster/ctdb/ctdb_cluster.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index e3e60685b0..caade047d5 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From 6504900f1f52927adab3489b8d04b6644ceaee7d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 08:06:51 +0000 Subject: r23806: update Samba4 with the latest ctdb code. This doesn't get the ctdb code fully working in Samba4, it just gets it building and not breaking non-clustered use of Samba. It will take a bit longer to update some of the calling ctdb_cluster.c code to make it work correctly in Samba4. Note also that Samba4 now only links to the client portion of ctdb. For the moment I am leaving the ctdbd as a separate daemon, which you install separately from http://ctdb.samba.org/. (This used to be commit b196077cbb55cbecad87065133c2d67198e31066) --- source4/cluster/ctdb/ctdb_cluster.c | 75 ++----------------------------------- 1 file changed, 3 insertions(+), 72 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index caade047d5..b7aa52a7eb 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -112,7 +112,7 @@ struct ctdb_handler_state { /* dispatch incoming ctdb messages */ -static void ctdb_message_handler(struct ctdb_context *ctdb, uint32_t srvid, +static void ctdb_message_handler(struct ctdb_context *ctdb, uint64_t srvid, TDB_DATA data, void *private) { struct ctdb_handler_state *s = talloc_get_type(private, @@ -196,22 +196,10 @@ static struct cluster_ops cluster_ctdb_ops = { /* initialise ctdb */ void cluster_ctdb_init(struct event_context *ev, const char *model) { - const char *nlist; - const char *address; - const char *transport; struct cluster_state *state; - int ret, lacount, i; - const char *db_list[] = { "brlock", "opendb" }; - nlist = lp_parm_string(-1, "ctdb", "nlist"); - if (nlist == NULL) return; - - address = lp_parm_string(-1, "ctdb", "address"); - if (address == NULL) return; - - transport = lp_parm_string(-1, "ctdb", "transport"); - if (transport == NULL) { - transport = "tcp"; + if (!lp_parm_bool(-1, "ctdb", "enable", False)) { + return; } state = talloc(ev, struct cluster_state); @@ -224,51 +212,6 @@ void cluster_ctdb_init(struct event_context *ev, const char *model) cluster_ctdb_ops.private = state; - ret = ctdb_set_transport(state->ctdb, transport); - if (ret == -1) { - DEBUG(0,("ctdb_set_transport failed - %s\n", - ctdb_errstr(state->ctdb))); - goto failed; - } - - if (lp_parm_bool(-1, "ctdb", "selfconnect", False)) { - DEBUG(0,("Enabling ctdb selfconnect\n")); - ctdb_set_flags(state->ctdb, CTDB_FLAG_SELF_CONNECT); - } - - lacount = lp_parm_int(-1, "ctdb", "maxlacount", -1); - if (lacount != -1) { - ctdb_set_max_lacount(state->ctdb, lacount); - } - - /* tell ctdb what address to listen on */ - ret = ctdb_set_address(state->ctdb, address); - if (ret == -1) { - DEBUG(0,("ctdb_set_address failed - %s\n", ctdb_errstr(state->ctdb))); - goto failed; - } - - ret = ctdb_set_tdb_dir(state->ctdb, lp_lockdir()); - if (ret == -1) { - DEBUG(0,("ctdb_set_tdb_dir failed - %s\n", ctdb_errstr(state->ctdb))); - goto failed; - } - - /* tell ctdb what nodes are available */ - ret = ctdb_set_nlist(state->ctdb, nlist); - if (ret == -1) { - DEBUG(0,("ctdb_set_nlist failed - %s\n", ctdb_errstr(state->ctdb))); - goto failed; - } - - /* attach all the databases we will need */ - for (i=0;ictdb, db_list[i], TDB_INTERNAL, - O_RDWR|O_CREAT|O_TRUNC, 0666); - if (ctdb_db == NULL) goto failed; - } - cluster_set_ops(&cluster_ctdb_ops); /* nasty hack for now ... */ @@ -277,21 +220,9 @@ void cluster_ctdb_init(struct event_context *ev, const char *model) brl_ctdb_init_ops(); } - /* start the protocol running */ - ret = ctdb_start(state->ctdb); - if (ret == -1) { - DEBUG(0,("ctdb_start failed - %s\n", ctdb_errstr(state->ctdb))); - goto failed; - } - - /* wait until all nodes are connected (should not be needed - outside of test code) */ - ctdb_connect_wait(state->ctdb); - return; failed: DEBUG(0,("cluster_ctdb_init failed\n")); talloc_free(state); } - -- cgit From 7ee3cbd9eb4c9a6f74061e9a2d0fa6c6fa046b4f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 8 Aug 2007 03:19:38 +0000 Subject: r24275: - setup the connection to the ctdb daemon - disable the brlock ctdb backend for now (This used to be commit b04bcf46e135af597b89994148a28275d29cdba6) --- source4/cluster/ctdb/ctdb_cluster.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index b7aa52a7eb..8acb794251 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -42,6 +42,7 @@ struct cluster_messaging_list { struct cluster_state { struct ctdb_context *ctdb; struct cluster_messaging_list *list; + uint32_t vnn; }; @@ -197,6 +198,7 @@ static struct cluster_ops cluster_ctdb_ops = { void cluster_ctdb_init(struct event_context *ev, const char *model) { struct cluster_state *state; + int ret; if (!lp_parm_bool(-1, "ctdb", "enable", False)) { return; @@ -208,17 +210,32 @@ void cluster_ctdb_init(struct event_context *ev, const char *model) state->ctdb = ctdb_init(ev); if (state->ctdb == NULL) goto failed; + ret = ctdb_socket_connect(state->ctdb); + if (ret == -1) { + DEBUG(0,(__location__ " Failed to connect to ctdb socket\n")); + goto failed; + } + + /* get our vnn */ + state->vnn = ctdb_ctrl_getvnn(state->ctdb, timeval_zero(), CTDB_CURRENT_NODE); + if (state->vnn == (uint32_t)-1) { + DEBUG(0,(__location__ " Failed to get ctdb vnn\n")); + goto failed; + } + state->list = NULL; cluster_ctdb_ops.private = state; cluster_set_ops(&cluster_ctdb_ops); +#if 0 /* nasty hack for now ... */ { void brl_ctdb_init_ops(void); brl_ctdb_init_ops(); } +#endif return; -- cgit From cd962355abad90a2161765a7be7d26e63572cab7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 7 Sep 2007 15:08:14 +0000 Subject: r25000: Fix some more C++ compatibility warnings. (This used to be commit 08bb1ef643ab906f1645cf6f32763dc73b1884e4) --- source4/cluster/ctdb/ctdb_cluster.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 8acb794251..d416a63374 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -52,7 +52,7 @@ struct cluster_state { */ static struct server_id ctdb_id(struct cluster_ops *ops, uint32_t id) { - struct cluster_state *state = ops->private; + struct cluster_state *state = (struct cluster_state *)ops->private; struct ctdb_context *ctdb = state->ctdb; struct server_id server_id; server_id.node = ctdb_get_vnn(ctdb); @@ -100,7 +100,7 @@ static struct tdb_wrap *ctdb_tdb_tmp_open(struct cluster_ops *ops, */ static void *ctdb_backend_handle(struct cluster_ops *ops) { - struct cluster_state *state = ops->private; + struct cluster_state *state = (struct cluster_state *)ops->private; return (void *)state->ctdb; } @@ -138,7 +138,7 @@ static NTSTATUS ctdb_message_init(struct cluster_ops *ops, struct server_id server, cluster_message_fn_t handler) { - struct cluster_state *state = ops->private; + struct cluster_state *state = (struct cluster_state *)ops->private; struct ctdb_handler_state *h; int ret; @@ -169,7 +169,7 @@ static NTSTATUS ctdb_message_init(struct cluster_ops *ops, static NTSTATUS ctdb_message_send(struct cluster_ops *ops, struct server_id server, DATA_BLOB *data) { - struct cluster_state *state = ops->private; + struct cluster_state *state = (struct cluster_state *)ops->private; struct ctdb_context *ctdb = state->ctdb; TDB_DATA tdata; int ret; -- cgit From ffeee68e4b72dd94fee57366bd8d38b8c284c3d4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 12:42:09 +0000 Subject: r25026: Move param/param.h out of includes.h (This used to be commit abe8349f9b4387961ff3665d8c589d61cd2edf31) --- source4/cluster/ctdb/ctdb_cluster.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index d416a63374..693de9fef3 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -28,6 +28,7 @@ #include "include/ctdb.h" #include "db_wrap.h" #include "lib/util/dlinklist.h" +#include "param/param.h" /* a linked list of messaging handlers, allowing incoming messages to be directed to the right messaging context */ -- cgit From 98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 16:46:30 +0000 Subject: r25035: Fix some more warnings, use service pointer rather than service number in more places. (This used to be commit df9cebcb97e20564359097148665bd519f31bc6f) --- source4/cluster/ctdb/ctdb_cluster.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 693de9fef3..ad35a5effe 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -81,7 +81,7 @@ static struct tdb_wrap *ctdb_tdb_tmp_open(struct cluster_ops *ops, TALLOC_CTX *mem_ctx, const char *dbname, int flags) { - const char *dir = lp_parm_string(-1, "ctdb", "shared data"); + const char *dir = lp_parm_string(NULL, "ctdb", "shared data"); char *path; struct tdb_wrap *w; if (dir == NULL) { @@ -201,7 +201,7 @@ void cluster_ctdb_init(struct event_context *ev, const char *model) struct cluster_state *state; int ret; - if (!lp_parm_bool(-1, "ctdb", "enable", False)) { + if (!lp_parm_bool(NULL, "ctdb", "enable", false)) { return; } -- cgit From 9b009c900987517359485799be8be4167494b376 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 23 Sep 2007 21:35:03 +0000 Subject: r25301: Merge my includes.h cleanups. (This used to be commit 37425495f392a2d0122a93aa2c42758eab7dab5a) --- source4/cluster/ctdb/ctdb_cluster.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index ad35a5effe..8cb1c0c459 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -29,6 +29,7 @@ #include "db_wrap.h" #include "lib/util/dlinklist.h" #include "param/param.h" +#include "librpc/gen_ndr/misc.h" /* a linked list of messaging handlers, allowing incoming messages to be directed to the right messaging context */ -- cgit From 60a1046c5c5783799bd64fe18e03534670f83d82 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 29 Sep 2007 18:00:19 +0000 Subject: r25430: Add the loadparm context to all parametric options. (This used to be commit fd697d77c9fe67a00939a1f04b35c451316fff58) --- source4/cluster/ctdb/ctdb_cluster.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 8cb1c0c459..d8860aabd0 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -82,7 +82,7 @@ static struct tdb_wrap *ctdb_tdb_tmp_open(struct cluster_ops *ops, TALLOC_CTX *mem_ctx, const char *dbname, int flags) { - const char *dir = lp_parm_string(NULL, "ctdb", "shared data"); + const char *dir = lp_parm_string(global_loadparm, NULL, "ctdb", "shared data"); char *path; struct tdb_wrap *w; if (dir == NULL) { @@ -202,7 +202,7 @@ void cluster_ctdb_init(struct event_context *ev, const char *model) struct cluster_state *state; int ret; - if (!lp_parm_bool(NULL, "ctdb", "enable", false)) { + if (!lp_parm_bool(global_loadparm, NULL, "ctdb", "enable", false)) { return; } -- cgit From ca0b72a1fdb7bd965065e833df34662afef0423e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 16 Nov 2007 20:12:00 +0100 Subject: r26003: Split up DB_WRAP, as first step in an attempt to sanitize dependencies. (This used to be commit 56dfcb4f2f8e74c9d8b2fe3a0df043781188a555) --- source4/cluster/ctdb/ctdb_cluster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index d8860aabd0..e4a9742401 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -26,7 +26,7 @@ #include "cluster/cluster_private.h" #include "lib/tdb/include/tdb.h" #include "include/ctdb.h" -#include "db_wrap.h" +#include "tdb_wrap.h" #include "lib/util/dlinklist.h" #include "param/param.h" #include "librpc/gen_ndr/misc.h" -- cgit From 0184e5ef2d4ebd19e1617ca8daaf2102b8e5a9f0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Dec 2007 23:32:59 +0100 Subject: r26269: Fix a couple more references to global_loadparm. (This used to be commit 1cb849dfba21b9b5d00b20ba8201f0e142bfeb07) --- source4/cluster/ctdb/ctdb_cluster.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index e4a9742401..cf24829a3e 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -197,12 +197,13 @@ static struct cluster_ops cluster_ctdb_ops = { }; /* initialise ctdb */ -void cluster_ctdb_init(struct event_context *ev, const char *model) +void cluster_ctdb_init(struct loadparm_context *lp_ctx, + struct event_context *ev, const char *model) { struct cluster_state *state; int ret; - if (!lp_parm_bool(global_loadparm, NULL, "ctdb", "enable", false)) { + if (!lp_parm_bool(lp_ctx, NULL, "ctdb", "enable", false)) { return; } -- cgit From fc2f06d31b6b52c5cbd83f34a34e5107649a5134 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 4 Dec 2007 00:12:03 +0100 Subject: r26274: Some syntax fixes, remove more global_loadparm instances. (This used to be commit 3809113d86dbd35b906356a05bb481a1e2bfe4b7) --- source4/cluster/ctdb/ctdb_cluster.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index cf24829a3e..6bac350805 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -79,8 +79,8 @@ static const char *ctdb_id_string(struct cluster_ops *ops, correct operation of fcntl locks on the shared fileystem. */ static struct tdb_wrap *ctdb_tdb_tmp_open(struct cluster_ops *ops, - TALLOC_CTX *mem_ctx, const char *dbname, - int flags) + TALLOC_CTX *mem_ctx, + const char *dbname, int flags) { const char *dir = lp_parm_string(global_loadparm, NULL, "ctdb", "shared data"); char *path; -- cgit From 61873ce94c172c801a4831de5550a8e0fe54c5f5 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 13 Dec 2007 22:46:23 +0100 Subject: r26431: Require ndr_push creators to specify a iconv_convenience context. (This used to be commit 7352206f4450fdf881b95bda064cedd9d2477e4c) --- source4/cluster/ctdb/ctdb_cluster.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 6bac350805..9a543ee3ee 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -80,6 +80,7 @@ static const char *ctdb_id_string(struct cluster_ops *ops, */ static struct tdb_wrap *ctdb_tdb_tmp_open(struct cluster_ops *ops, TALLOC_CTX *mem_ctx, + struct loadparm_context *lp_ctx, const char *dbname, int flags) { const char *dir = lp_parm_string(global_loadparm, NULL, "ctdb", "shared data"); -- cgit From 9d136bc0a323171b13ec047816033ae4fac9e9d4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 2 Jan 2008 01:52:18 -0600 Subject: r26640: Janitorial: Remove some more uses of global_loadparm. (This used to be commit c863f4ebde8efa1a695b4469142d6719e30bc419) --- source4/cluster/ctdb/ctdb_cluster.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 9a543ee3ee..53df1e968e 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -83,7 +83,7 @@ static struct tdb_wrap *ctdb_tdb_tmp_open(struct cluster_ops *ops, struct loadparm_context *lp_ctx, const char *dbname, int flags) { - const char *dir = lp_parm_string(global_loadparm, NULL, "ctdb", "shared data"); + const char *dir = lp_parm_string(lp_ctx, NULL, "ctdb", "shared data"); char *path; struct tdb_wrap *w; if (dir == NULL) { -- cgit From 77f71c1b65358723771354fd9ff1dc418b227ccc Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 4 Feb 2008 17:51:38 +1100 Subject: Rework cluster_id() to take an additional argument, as we need .. to be unique in a prefork process environment. Andrew Bartlett and David Disseldorp (This used to be commit 931994a7f185bbc98924823e9e8cef1011dd0957) --- source4/cluster/ctdb/ctdb_cluster.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source4/cluster/ctdb/ctdb_cluster.c') diff --git a/source4/cluster/ctdb/ctdb_cluster.c b/source4/cluster/ctdb/ctdb_cluster.c index 53df1e968e..ce295c4474 100644 --- a/source4/cluster/ctdb/ctdb_cluster.c +++ b/source4/cluster/ctdb/ctdb_cluster.c @@ -52,13 +52,14 @@ struct cluster_state { /* return a server_id for a ctdb node */ -static struct server_id ctdb_id(struct cluster_ops *ops, uint32_t id) +static struct server_id ctdb_id(struct cluster_ops *ops, uint64_t id, uint32_t id2) { struct cluster_state *state = (struct cluster_state *)ops->private; struct ctdb_context *ctdb = state->ctdb; struct server_id server_id; server_id.node = ctdb_get_vnn(ctdb); server_id.id = id; + server_id.id2 = id2; return server_id; } @@ -69,7 +70,7 @@ static struct server_id ctdb_id(struct cluster_ops *ops, uint32_t id) static const char *ctdb_id_string(struct cluster_ops *ops, TALLOC_CTX *mem_ctx, struct server_id id) { - return talloc_asprintf(mem_ctx, "%u.%u", id.node, id.id); + return talloc_asprintf(mem_ctx, "%u.%llu.%u", id.node, (unsigned long long)id.id, id.id2); } /* -- cgit