]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-recovery: Create recovery databases in state dir
authorAmitay Isaacs <amitay@gmail.com>
Thu, 11 Feb 2016 03:32:34 +0000 (14:32 +1100)
committerMartin Schwenke <martins@samba.org>
Thu, 11 Feb 2016 07:01:14 +0000 (08:01 +0100)
This matches the behaviour during serial database recovery.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Thu Feb 11 08:01:14 CET 2016 on sn-devel-144

ctdb/server/ctdb_recoverd.c
ctdb/server/ctdb_recovery_helper.c

index c89649a3c559e9476424ec3c6c6ffce396e57550..e42433de473f09907d2c7716bc7707d2438da561 100644 (file)
@@ -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,
index d7288e2d1d2bd2dd3a9ab05779f9724c93f8c25f..8fc27916739df2d693d31a6a3c522e847e575439 100644 (file)
@@ -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);