summaryrefslogtreecommitdiff
path: root/source3/lib/dbwrap.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-06-10 17:02:09 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:14 -0500
commitde565785f5e1f097bd75f57331425c4185185f80 (patch)
treeaf24bb44388f9ffa2077435cc3fea134557c186b /source3/lib/dbwrap.c
parentb05c7b97830f6029c264fc44831c2f5eae4f0c83 (diff)
downloadsamba-de565785f5e1f097bd75f57331425c4185185f80.tar.gz
samba-de565785f5e1f097bd75f57331425c4185185f80.tar.bz2
samba-de565785f5e1f097bd75f57331425c4185185f80.zip
r23410: Merge the core of the cluster code.
I'm 100% certain I've forgotten to merge something, but the main code should be in. It's mainly in dbwrap_ctdb.c, ctdbd_conn.c and messages_ctdbd.c. There should be no changes to the non-cluster case, it does survive make test on my laptop. It survives some very basic tests with ctdbd enables, I did not do the full test suite for clusters yet. Phew... Volker (This used to be commit 15553d6327a3aecdd2b0b94a3656d04bf4106323)
Diffstat (limited to 'source3/lib/dbwrap.c')
-rw-r--r--source3/lib/dbwrap.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c
index 9f74a9eb48..c06cd4bb16 100644
--- a/source3/lib/dbwrap.c
+++ b/source3/lib/dbwrap.c
@@ -48,6 +48,32 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
{
struct db_context *result = NULL;
+#ifdef CLUSTER_SUPPORT
+
+ if (lp_clustering()) {
+ const char *partname;
+ /* ctdb only wants the file part of the name */
+ partname = strrchr(name, '/');
+ if (partname) {
+ partname++;
+ } else {
+ partname = name;
+ }
+ /* allow ctdb for individual databases to be disabled */
+ if (lp_parm_bool(-1, "ctdb", partname, True)) {
+ result = db_open_ctdb(mem_ctx, partname, hash_size,
+ tdb_flags, open_flags, mode);
+ if (result == NULL) {
+ DEBUG(0,("failed to attach to ctdb %s\n",
+ partname));
+ smb_panic("failed to attach to a ctdb "
+ "database");
+ }
+ }
+ }
+
+#endif
+
if (result == NULL) {
result = db_open_tdb(mem_ctx, name, hash_size,
tdb_flags, open_flags, mode);