ctdb-daemon: Drop function ctdb_set_recovery_lock_file()
authorMartin Schwenke <martin@meltin.net>
Tue, 17 May 2016 08:24:53 +0000 (18:24 +1000)
committerMartin Schwenke <martins@samba.org>
Tue, 7 Jun 2016 22:51:28 +0000 (00:51 +0200)
Setting the recovery lock file at startup can be done more simply.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/include/ctdb_private.h
ctdb/server/ctdb_server.c
ctdb/server/ctdbd.c

index a2f6dfce76c7430132671ebdbd66c49b197d296b..f19ebe33dac7095b85bea2a971ab4bf295faa7fc 100644 (file)
@@ -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);
index 7d42c384d22d3519144e22a6c7bf0125e3bc1021..1712e39013ca81ae03f3f6abf2cd16659a5df759 100644 (file)
@@ -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,
index 5d6b4be36cdf6959cd740434d77662b2f168e2eb..67f2b8e29a1efff4fe9db08eddad7dc7c618e65e 100644 (file)
@@ -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)));