From: Amitay Isaacs Date: Thu, 11 Feb 2016 03:32:34 +0000 (+1100) Subject: ctdb-recovery: Create recovery databases in state dir X-Git-Tag: tevent-0.9.27~33 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=19a411f839c5c34fec2aa5e6cb095346be56d94e;p=thirdparty%2Fsamba.git ctdb-recovery: Create recovery databases in state dir This matches the behaviour during serial database recovery. Signed-off-by: Amitay Isaacs Reviewed-by: Martin Schwenke Autobuild-User(master): Martin Schwenke Autobuild-Date(master): Thu Feb 11 08:01:14 CET 2016 on sn-devel-144 --- diff --git a/ctdb/server/ctdb_recoverd.c b/ctdb/server/ctdb_recoverd.c index c89649a3c55..e42433de473 100644 --- a/ctdb/server/ctdb_recoverd.c +++ b/ctdb/server/ctdb_recoverd.c @@ -1781,6 +1781,8 @@ static int db_recovery_parallel(struct ctdb_recoverd *rec, TALLOC_CTX *mem_ctx) goto fail; } + setenv("CTDB_DBDIR_STATE", rec->ctdb->db_directory_state, 1); + if (!ctdb_vfork_with_logging(state, rec->ctdb, "recovery", prog, nargs, args, NULL, NULL, &state->pid)) { DEBUG(DEBUG_ERR, diff --git a/ctdb/server/ctdb_recovery_helper.c b/ctdb/server/ctdb_recovery_helper.c index d7288e2d1d2..8fc27916739 100644 --- a/ctdb/server/ctdb_recovery_helper.c +++ b/ctdb/server/ctdb_recovery_helper.c @@ -80,6 +80,7 @@ static struct recdb_context *recdb_create(TALLOC_CTX *mem_ctx, uint32_t db_id, const char *db_path, uint32_t hash_size, bool persistent) { + static char *db_dir_state = NULL; struct recdb_context *recdb; unsigned int tdb_flags; @@ -88,10 +89,16 @@ static struct recdb_context *recdb_create(TALLOC_CTX *mem_ctx, uint32_t db_id, return NULL; } + if (db_dir_state == NULL) { + db_dir_state = getenv("CTDB_DBDIR_STATE"); + } + recdb->db_name = db_name; recdb->db_id = db_id; recdb->db_path = talloc_asprintf(recdb, "%s/recdb.%s", - dirname(discard_const(db_path)), + db_dir_state != NULL ? + db_dir_state : + dirname(discard_const(db_path)), db_name); if (recdb->db_path == NULL) { talloc_free(recdb);