From 32df537a24f8f24a90dd9f159efc5e2bf527e43f Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 14 Jul 2008 10:43:28 +0200 Subject: dbwrap: when clustering = yes, don't fall back to db_open_tdb in db_open Michael (This used to be commit 33188a991f7e2f8dc1b5beed1dde1b7f77403e1a) --- source3/lib/dbwrap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source3/lib/dbwrap.c') diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c index 7fe1631bff..a686ba6b7c 100644 --- a/source3/lib/dbwrap.c +++ b/source3/lib/dbwrap.c @@ -60,8 +60,15 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx, sockname = CTDB_PATH; } - if (lp_clustering() && socket_exist(sockname)) { + if (lp_clustering()) { const char *partname; + + if (!socket_exist(sockname)) { + DEBUG(1, ("ctdb socket does not exist - is ctdb not " + "running?\n")); + return NULL; + } + /* ctdb only wants the file part of the name */ partname = strrchr(name, '/'); if (partname) { -- cgit From 56681032b288ed924b40ab353c632a1fb153759d Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Mon, 14 Jul 2008 10:53:06 +0200 Subject: dbwrap: when clustering = yes, don't fall back to db_open_tdb in db_open_trans. Michael (This used to be commit 013d29c70438bfd43bd11cbb13ba707b256f9b18) --- source3/lib/dbwrap.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'source3/lib/dbwrap.c') diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c index a686ba6b7c..6dfe0b3766 100644 --- a/source3/lib/dbwrap.c +++ b/source3/lib/dbwrap.c @@ -127,8 +127,15 @@ struct db_context *db_open_trans(TALLOC_CTX *mem_ctx, sockname = CTDB_PATH; } - if (lp_clustering() && socket_exist(sockname)) { + if (lp_clustering()) { const char *partname; + + if (!socket_exist(sockname)) { + DEBUG(1, ("ctdb socket does not exist - is ctdb not " + "running?\n")); + return NULL; + } + /* ctdb only wants the file part of the name */ partname = strrchr(name, '/'); if (partname) { -- cgit From 5a8b0fe99f302e5d1ff2b47a1fe617ccd3a8b7b7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 15 Jul 2008 15:27:14 +0200 Subject: dbwrap: don't panic in db_open() when attaching to ctdb fails. Michael (This used to be commit b9c008d9bd8b8119007e7ad03a40235998af4f5c) --- source3/lib/dbwrap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'source3/lib/dbwrap.c') diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c index 6dfe0b3766..b498c46615 100644 --- a/source3/lib/dbwrap.c +++ b/source3/lib/dbwrap.c @@ -83,8 +83,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx, if (result == NULL) { DEBUG(0,("failed to attach to ctdb %s\n", partname)); - smb_panic("failed to attach to a ctdb " - "database"); + return NULL; } } } -- cgit From 3899851af02bb5b858ee025504b4c7f12385c0c7 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 15 Jul 2008 15:27:46 +0200 Subject: dbwrap: don't panic in db_open_trans() when attaching to ctdb fails. Michael (This used to be commit 308fc7d5bf5f5ccfc73677b052a4e6ecede25921) --- source3/lib/dbwrap.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source3/lib/dbwrap.c') diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c index b498c46615..2bff5d9257 100644 --- a/source3/lib/dbwrap.c +++ b/source3/lib/dbwrap.c @@ -150,8 +150,6 @@ struct db_context *db_open_trans(TALLOC_CTX *mem_ctx, if (result == NULL) { DEBUG(0,("failed to attach to ctdb %s\n", partname)); - smb_panic("failed to attach to a ctdb " - "database"); } return result; } -- cgit From fc6216b2da1087065c26e874058de74ced692fcc Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Tue, 15 Jul 2008 16:43:26 +0200 Subject: dbwrap: don't panic in db_open_trans() if called with TDB_CLEAR_IF_FIRST. return NULL instead and leave appropriated measures to the caller. Michael (This used to be commit 1002507b56a13420d8178c5397610edd839a7584) --- source3/lib/dbwrap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source3/lib/dbwrap.c') diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c index 2bff5d9257..eec15a84bd 100644 --- a/source3/lib/dbwrap.c +++ b/source3/lib/dbwrap.c @@ -118,7 +118,7 @@ struct db_context *db_open_trans(TALLOC_CTX *mem_ctx, if (tdb_flags & TDB_CLEAR_IF_FIRST) { DEBUG(0,("db_open_trans: called with TDB_CLEAR_IF_FIRST: %s\n", name)); - smb_panic("db_open_trans: called with TDB_CLEAR_IF_FIRST"); + return NULL; } #ifdef CLUSTER_SUPPORT -- cgit