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>
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;
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);
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,
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);
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)));