From: Martin Schwenke Date: Tue, 17 May 2016 08:24:53 +0000 (+1000) Subject: ctdb-daemon: Drop function ctdb_set_recovery_lock_file() X-Git-Tag: tdb-1.3.10~931 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f16b26bc9712a6d45818ad7af9243feb25fc40a2;p=thirdparty%2Fsamba.git ctdb-daemon: Drop function ctdb_set_recovery_lock_file() Setting the recovery lock file at startup can be done more simply. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h index a2f6dfce76c..f19ebe33dac 100644 --- a/ctdb/include/ctdb_private.h +++ b/ctdb/include/ctdb_private.h @@ -310,7 +310,7 @@ struct ctdb_context { uint64_t db_persistent_check_errors; uint64_t max_persistent_check_errors; const char *transport; - char *recovery_lock_file; + const char *recovery_lock_file; struct ctdb_cluster_mutex_handle *recovery_lock_handle; uint32_t pnn; /* our own pnn */ uint32_t num_nodes; @@ -922,8 +922,6 @@ int ctdb_set_transport(struct ctdb_context *ctdb, const char *transport); int ctdb_ip_to_nodeid(struct ctdb_context *ctdb, const ctdb_sock_addr *nodeip); -int ctdb_set_recovery_lock_file(struct ctdb_context *ctdb, const char *file); - void ctdb_load_nodes_file(struct ctdb_context *ctdb); int ctdb_set_address(struct ctdb_context *ctdb, const char *address); diff --git a/ctdb/server/ctdb_server.c b/ctdb/server/ctdb_server.c index 7d42c384d22..1712e39013c 100644 --- a/ctdb/server/ctdb_server.c +++ b/ctdb/server/ctdb_server.c @@ -65,27 +65,6 @@ int ctdb_ip_to_nodeid(struct ctdb_context *ctdb, const ctdb_sock_addr *nodeip) return -1; } -/* - choose the recovery lock file -*/ -int ctdb_set_recovery_lock_file(struct ctdb_context *ctdb, const char *file) -{ - if (ctdb->recovery_lock_file != NULL) { - talloc_free(ctdb->recovery_lock_file); - ctdb->recovery_lock_file = NULL; - } - - if (file == NULL) { - DEBUG(DEBUG_ALERT,("Recovery lock file set to \"\". Disabling recovery lock checking\n")); - return 0; - } - - ctdb->recovery_lock_file = talloc_strdup(ctdb, file); - CTDB_NO_MEMORY(ctdb, ctdb->recovery_lock_file); - - return 0; -} - /* Load a nodes list file into a nodes array */ static int convert_node_map_to_list(struct ctdb_context *ctdb, TALLOC_CTX *mem_ctx, diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c index 5d6b4be36cd..67f2b8e29a1 100644 --- a/ctdb/server/ctdbd.c +++ b/ctdb/server/ctdbd.c @@ -195,6 +195,11 @@ int main(int argc, const char *argv[]) ctdb->recovery_mode = CTDB_RECOVERY_NORMAL; ctdb->recovery_master = (uint32_t)-1; ctdb->upcalls = &ctdb_upcalls; + + if (options.recovery_lock_file == NULL) { + DEBUG(DEBUG_WARNING, ("Recovery lock file not set\n")); + } + ctdb->recovery_lock_file = options.recovery_lock_file; ctdb->recovery_lock_handle = NULL; TALLOC_FREE(ctdb->idr); @@ -206,12 +211,6 @@ int main(int argc, const char *argv[]) ctdb_tunables_set_defaults(ctdb); - ret = ctdb_set_recovery_lock_file(ctdb, options.recovery_lock_file); - if (ret == -1) { - DEBUG(DEBUG_ALERT,("ctdb_set_recovery_lock_file failed - %s\n", ctdb_errstr(ctdb))); - exit(1); - } - ret = ctdb_set_transport(ctdb, options.transport); if (ret == -1) { DEBUG(DEBUG_ALERT,("ctdb_set_transport failed - %s\n", ctdb_errstr(ctdb)));