outdata->dsize = offsetof(struct ctdb_dbid_map, dbids) + 4*len;
outdata->dptr = (unsigned char *)talloc_zero_size(outdata, outdata->dsize);
if (!outdata->dptr) {
- DEBUG(0, (__location__ "Failed to allocate dbmap array\n"));
+ DEBUG(0, (__location__ " Failed to allocate dbmap array\n"));
exit(1);
}
outdata->dsize = offsetof(struct ctdb_node_map, nodes) + num_nodes*sizeof(struct ctdb_node_and_flags);
outdata->dptr = (unsigned char *)talloc_zero_size(outdata, outdata->dsize);
if (!outdata->dptr) {
- DEBUG(0, (__location__ "Failed to allocate nodemap array\n"));
+ DEBUG(0, (__location__ " Failed to allocate nodemap array\n"));
exit(1);
}
ret = ctdb_ltdb_fetch(ctdb_db, key, &header, NULL, NULL);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to fetch record\n"));
+ DEBUG(0, (__location__ " Unable to fetch record\n"));
tdb_unlockall(ctdb_db->ltdb->tdb);
return -1;
}
if (header.rsn < hdr->rsn) {
ret = ctdb_ltdb_store(ctdb_db, key, hdr, data);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to store record\n"));
+ DEBUG(0, (__location__ " Unable to store record\n"));
tdb_unlockall(ctdb_db->ltdb->tdb);
return -1;
}
ret = tdb_store(tdb, key, data, TDB_REPLACE);
if (ret) {
- DEBUG(0,(__location__ "failed to write tdb data back ret:%d\n",ret));
+ DEBUG(0,(__location__ " failed to write tdb data back ret:%d\n",ret));
return ret;
}
return 0;
ret = tdb_delete(tdb, key);
if (ret) {
- DEBUG(0,(__location__ "failed to delete tdb record\n"));
+ DEBUG(0,(__location__ " failed to delete tdb record\n"));
return ret;
}
return 0;
return 0;
}
+
+
+/*
+ lock all databases
+ */
+static int ctdb_lock_all_databases(struct ctdb_context *ctdb)
+{
+ struct ctdb_db_context *ctdb_db;
+ for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
+ if (tdb_lockall(ctdb_db->ltdb->tdb) != 0) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+/*
+ lock all databases - mark only
+ */
+static int ctdb_lock_all_databases_mark(struct ctdb_context *ctdb)
+{
+ struct ctdb_db_context *ctdb_db;
+ for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
+ if (tdb_lockall_mark(ctdb_db->ltdb->tdb) != 0) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+/*
+ lock all databases - unmark only
+ */
+static int ctdb_lock_all_databases_unmark(struct ctdb_context *ctdb)
+{
+ struct ctdb_db_context *ctdb_db;
+ for (ctdb_db=ctdb->db_list;ctdb_db;ctdb_db=ctdb_db->next) {
+ if (tdb_lockall_unmark(ctdb_db->ltdb->tdb) != 0) {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+/*
+ a list of control requests waiting for a recovery lock child to gets
+ the database locks
+ */
+struct ctdb_recovery_waiter {
+ struct ctdb_recovery_waiter *next, *prev;
+ struct ctdb_context *ctdb;
+ struct ctdb_req_control *c;
+ int32_t status;
+};
+
+/* a handle to a recovery lock child process */
+struct ctdb_recovery_handle {
+ struct ctdb_context *ctdb;
+ pid_t child;
+ int fd;
+ struct ctdb_recovery_waiter *waiters;
+};
+
+/*
+ destroy a recovery handle
+ */
+static int ctdb_recovery_handle_destructor(struct ctdb_recovery_handle *h)
+{
+ if (h->ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE) {
+ ctdb_lock_all_databases_unmark(h->ctdb);
+ }
+ kill(h->child, SIGKILL);
+ waitpid(h->child, NULL, 0);
+ return 0;
+}
+
+/*
+ called when the child writes its status to us
+ */
+static void ctdb_recovery_lock_handler(struct event_context *ev, struct fd_event *fde,
+ uint16_t flags, void *private_data)
+{
+ struct ctdb_recovery_handle *h = talloc_get_type(private_data, struct ctdb_recovery_handle);
+ int32_t status;
+ struct ctdb_recovery_waiter *w;
+ int ret;
+
+ if (read(h->fd, &status, sizeof(status)) != sizeof(status)) {
+ DEBUG(0,("read error from recovery lock child\n"));
+ status = -1;
+ }
+
+ if (status == -1) {
+ DEBUG(0,("Failed to get locks in ctdb_recovery_child\n"));
+ /* we didn't get the locks - destroy the handle */
+ talloc_free(h);
+ return;
+ }
+
+ ret = ctdb_lock_all_databases_mark(h->ctdb);
+ if (ret == -1) {
+ DEBUG(0,("Failed to mark locks in ctdb_recovery\n"));
+ talloc_free(h);
+ return;
+ }
+
+ h->ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE;
+
+ /* notify the waiters */
+ while ((w = h->ctdb->recovery_handle->waiters)) {
+ w->status = status;
+ DLIST_REMOVE(h->ctdb->recovery_handle->waiters, w);
+ talloc_free(w);
+ }
+
+ talloc_free(fde);
+}
+
+/*
+ create a child which gets locks on all the open databases, then calls the callback telling the parent
+ that it is done
+ */
+static struct ctdb_recovery_handle *ctdb_recovery_lock(struct ctdb_context *ctdb)
+{
+ struct ctdb_recovery_handle *h;
+ int fd[2];
+ struct fd_event *fde;
+
+ h = talloc_zero(ctdb, struct ctdb_recovery_handle);
+ CTDB_NO_MEMORY_VOID(ctdb, h);
+
+ h->ctdb = ctdb;
+
+ /* use socketpair() instead of pipe() so we have bi-directional fds */
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, fd) != 0) {
+ DEBUG(0,("Failed to create pipe for ctdb_recovery_lock\n"));
+ talloc_free(h);
+ return NULL;
+ }
+
+ h->child = fork();
+ if (h->child == -1) {
+ DEBUG(0,("Failed to fork child for ctdb_recovery_lock\n"));
+ talloc_free(h);
+ return NULL;
+ }
+
+ if (h->child == 0) {
+ int ret;
+ /* in the child */
+ close(fd[0]);
+ ret = ctdb_lock_all_databases(ctdb);
+ if (ret != 0) {
+ _exit(0);
+ }
+ write(fd[1], &ret, sizeof(ret));
+ /* the read here means we will die if the parent exits */
+ read(fd[1], &ret, sizeof(ret));
+ _exit(0);
+ }
+
+ talloc_set_destructor(h, ctdb_recovery_handle_destructor);
+
+ close(fd[1]);
+
+ h->fd = fd[0];
+
+ fde = event_add_fd(ctdb->ev, h, h->fd, EVENT_FD_READ|EVENT_FD_AUTOCLOSE,
+ ctdb_recovery_lock_handler, h);
+ if (fde == NULL) {
+ DEBUG(0,("Failed to setup fd event for ctdb_recovery_lock\n"));
+ close(fd[0]);
+ talloc_free(h);
+ return NULL;
+ }
+
+ return h;
+}
+
+/*
+ destroy a waiter for a recovery mode change
+ */
+static int ctdb_recovery_waiter_destructor(struct ctdb_recovery_waiter *w)
+{
+ DLIST_REMOVE(w->ctdb->recovery_handle->waiters, w);
+ ctdb_request_control_reply(w->ctdb, w->c, NULL, w->status);
+ return 0;
+}
+
+/*
+ set the recovery mode
+ */
+void ctdb_control_set_recmode(struct ctdb_context *ctdb, struct ctdb_req_control *c, TDB_DATA data)
+{
+ uint32_t recmode = *(uint32_t *)data.dptr;
+ struct ctdb_recovery_waiter *w;
+
+ if (recmode == CTDB_RECOVERY_NORMAL) {
+ /* switching to normal mode is easy */
+ talloc_free(ctdb->recovery_handle);
+ ctdb->recovery_handle = NULL;
+ ctdb->recovery_mode = CTDB_RECOVERY_NORMAL;
+ ctdb_request_control_reply(ctdb, c, NULL, 0);
+ return;
+ }
+
+ if (ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE) {
+ /* we're already active */
+ ctdb_request_control_reply(ctdb, c, NULL, 0);
+ return;
+ }
+
+ /* if there isn't a recovery lock child then create one */
+ if (!ctdb->recovery_handle) {
+ ctdb->recovery_handle = ctdb_recovery_lock(ctdb);
+ CTDB_NO_MEMORY_VOID(ctdb, ctdb->recovery_handle);
+ }
+
+ /* add ourselves to list of waiters */
+ w = talloc(ctdb->recovery_handle, struct ctdb_recovery_waiter);
+ CTDB_NO_MEMORY_VOID(ctdb, w);
+ w->ctdb = ctdb;
+ w->c = talloc_steal(w, c);
+ w->status = -1;
+ talloc_set_destructor(w, ctdb_recovery_waiter_destructor);
+ DLIST_ADD(ctdb->recovery_handle->waiters, w);
+}
+
+
ret = ctdb_ctrl_setrecmode(ctdb, timeval_current_ofs(1, 0), nodemap->nodes[j].vnn, rec_mode);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to set recmode on node %u\n", nodemap->nodes[j].vnn));
+ DEBUG(0, (__location__ " Unable to set recmode on node %u\n", nodemap->nodes[j].vnn));
return -1;
}
}
ret = ctdb_ctrl_setrecmaster(ctdb, timeval_current_ofs(1, 0), nodemap->nodes[j].vnn, vnn);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to set recmaster on node %u\n", nodemap->nodes[j].vnn));
+ DEBUG(0, (__location__ " Unable to set recmaster on node %u\n", nodemap->nodes[j].vnn));
return -1;
}
}
ret = ctdb_ctrl_getdbmap(ctdb, timeval_current_ofs(1, 0), nodemap->nodes[j].vnn, mem_ctx, &remote_dbmap);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to get dbids from node %u\n", vnn));
+ DEBUG(0, (__location__ " Unable to get dbids from node %u\n", vnn));
return -1;
}
/* ok so we need to create this database */
ctdb_ctrl_getdbname(ctdb, timeval_current_ofs(1, 0), vnn, dbmap->dbids[db], mem_ctx, &name);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to get dbname from node %u\n", vnn));
+ DEBUG(0, (__location__ " Unable to get dbname from node %u\n", vnn));
return -1;
}
ctdb_ctrl_createdb(ctdb, timeval_current_ofs(1, 0), nodemap->nodes[j].vnn, mem_ctx, name);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to create remote db:%s\n", name));
+ DEBUG(0, (__location__ " Unable to create remote db:%s\n", name));
return -1;
}
}
ret = ctdb_ctrl_getdbmap(ctdb, timeval_current_ofs(1, 0), nodemap->nodes[j].vnn, mem_ctx, &remote_dbmap);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to get dbids from node %u\n", vnn));
+ DEBUG(0, (__location__ " Unable to get dbids from node %u\n", vnn));
return -1;
}
*/
ctdb_ctrl_getdbname(ctdb, timeval_current_ofs(1, 0), nodemap->nodes[j].vnn, remote_dbmap->dbids[db], mem_ctx, &name);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to get dbname from node %u\n", nodemap->nodes[j].vnn));
+ DEBUG(0, (__location__ " Unable to get dbname from node %u\n", nodemap->nodes[j].vnn));
return -1;
}
ctdb_ctrl_createdb(ctdb, timeval_current_ofs(1, 0), vnn, mem_ctx, name);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to create local db:%s\n", name));
+ DEBUG(0, (__location__ " Unable to create local db:%s\n", name));
return -1;
}
ret = ctdb_ctrl_getdbmap(ctdb, timeval_current_ofs(1, 0), vnn, mem_ctx, dbmap);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to reread dbmap on node %u\n", vnn));
+ DEBUG(0, (__location__ " Unable to reread dbmap on node %u\n", vnn));
return -1;
}
}
}
ret = ctdb_ctrl_copydb(ctdb, timeval_current_ofs(2, 0), nodemap->nodes[j].vnn, vnn, dbmap->dbids[i], CTDB_LMASTER_ANY, mem_ctx);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to copy db from node %u to node %u\n", nodemap->nodes[j].vnn, vnn));
+ DEBUG(0, (__location__ " Unable to copy db from node %u to node %u\n", nodemap->nodes[j].vnn, vnn));
return -1;
}
}
}
ret = ctdb_ctrl_setdmaster(ctdb, timeval_current_ofs(1, 0), nodemap->nodes[j].vnn, ctdb, dbmap->dbids[i], vnn);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to set dmaster for node %u db:0x%08x\n", nodemap->nodes[j].vnn, dbmap->dbids[i]));
+ DEBUG(0, (__location__ " Unable to set dmaster for node %u db:0x%08x\n", nodemap->nodes[j].vnn, dbmap->dbids[i]));
return -1;
}
}
}
ret = ctdb_ctrl_copydb(ctdb, timeval_current_ofs(1, 0), vnn, nodemap->nodes[j].vnn, dbmap->dbids[i], CTDB_LMASTER_ANY, mem_ctx);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to copy db from node %u to node %u\n", vnn, nodemap->nodes[j].vnn));
+ DEBUG(0, (__location__ " Unable to copy db from node %u to node %u\n", vnn, nodemap->nodes[j].vnn));
return -1;
}
}
ret = ctdb_ctrl_setvnnmap(ctdb, timeval_current_ofs(1, 0), nodemap->nodes[j].vnn, mem_ctx, vnnmap);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to set vnnmap for node %u\n", vnn));
+ DEBUG(0, (__location__ " Unable to set vnnmap for node %u\n", vnn));
return -1;
}
}
uint32_t generation;
struct ctdb_dbid_map *dbmap;
- DEBUG(0, (__location__ "Recovery initiated\n"));
+ DEBUG(0, (__location__ " Recovery initiated\n"));
/* pick a new generation number */
generation = random();
vnnmap->generation = generation;
ret = ctdb_ctrl_setvnnmap(ctdb, timeval_current_ofs(1, 0), vnn, mem_ctx, vnnmap);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to set vnnmap for node %u\n", vnn));
+ DEBUG(0, (__location__ " Unable to set vnnmap for node %u\n", vnn));
return -1;
}
/* set recovery mode to active on all nodes */
ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_ACTIVE);
if (ret!=0) {
- DEBUG(0, (__location__ "Unable to set recovery mode to active on cluster\n"));
+ DEBUG(0, (__location__ " Unable to set recovery mode to active on cluster\n"));
return -1;
}
/* get a list of all databases */
ret = ctdb_ctrl_getdbmap(ctdb, timeval_current_ofs(1, 0), vnn, mem_ctx, &dbmap);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to get dbids from node :%d\n", vnn));
+ DEBUG(0, (__location__ " Unable to get dbids from node :%d\n", vnn));
return -1;
}
/* verify that all other nodes have all our databases */
ret = create_missing_remote_databases(ctdb, nodemap, vnn, dbmap, mem_ctx);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to create missing remote databases\n"));
+ DEBUG(0, (__location__ " Unable to create missing remote databases\n"));
return -1;
}
/* verify that we have all the databases any other node has */
ret = create_missing_local_databases(ctdb, nodemap, vnn, &dbmap, mem_ctx);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to create missing local databases\n"));
+ DEBUG(0, (__location__ " Unable to create missing local databases\n"));
return -1;
}
/* verify that all other nodes have all our databases */
ret = create_missing_remote_databases(ctdb, nodemap, vnn, dbmap, mem_ctx);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to create missing remote databases\n"));
+ DEBUG(0, (__location__ " Unable to create missing remote databases\n"));
return -1;
}
*/
ret = update_dmaster_on_all_databases(ctdb, nodemap, 0xffffffff, dbmap, mem_ctx);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to update dmaster on all databases\n"));
+ DEBUG(0, (__location__ " Unable to update dmaster on all databases\n"));
return -1;
}
/* pull all remote databases onto the local node */
ret = pull_all_remote_databases(ctdb, nodemap, vnn, dbmap, mem_ctx);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to pull remote databases\n"));
+ DEBUG(0, (__location__ " Unable to pull remote databases\n"));
return -1;
}
/* push all local databases to the remote nodes */
ret = push_all_local_databases(ctdb, nodemap, vnn, dbmap, mem_ctx);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to push local databases\n"));
+ DEBUG(0, (__location__ " Unable to push local databases\n"));
return -1;
}
/* update to the new vnnmap on all nodes */
ret = update_vnnmap_on_all_nodes(ctdb, nodemap, vnn, vnnmap, mem_ctx);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to update vnnmap on all nodes\n"));
+ DEBUG(0, (__location__ " Unable to update vnnmap on all nodes\n"));
return -1;
}
/* update recmaster to point to us for all nodes */
ret = set_recovery_master(ctdb, nodemap, vnn);
if (ret!=0) {
- DEBUG(0, (__location__ "Unable to set recovery master\n"));
+ DEBUG(0, (__location__ " Unable to set recovery master\n"));
return -1;
}
*/
ret = update_dmaster_on_all_databases(ctdb, nodemap, vnn, dbmap, mem_ctx);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to update dmaster on all databases\n"));
+ DEBUG(0, (__location__ " Unable to update dmaster on all databases\n"));
return -1;
}
/* disable recovery mode */
ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_NORMAL);
if (ret!=0) {
- DEBUG(0, (__location__ "Unable to set recovery mode to normal on cluster\n"));
+ DEBUG(0, (__location__ " Unable to set recovery mode to normal on cluster\n"));
return -1;
}
- DEBUG(0, (__location__ "Recovery complete\n"));
+ DEBUG(0, (__location__ " Recovery complete\n"));
return 0;
}
*/
ret = ctdb_ctrl_setrecmaster(ctdb, timeval_current_ofs(1, 0), vnn, vnn);
if (ret != 0) {
- DEBUG(0, (__location__ "failed to send recmaster election request"));
+ DEBUG(0, (__location__ " failed to send recmaster election request"));
return -1;
}
if (em->vnn > ctdb_get_vnn(ctdb)) {
ret = send_election_request(ctdb, mem_ctx, ctdb_get_vnn(ctdb));
if (ret!=0) {
- DEBUG(0, (__location__ "failed to initiate recmaster election"));
+ DEBUG(0, (__location__ " failed to initiate recmaster election"));
}
talloc_free(mem_ctx);
return;
/* ok, let that guy become recmaster then */
ret = ctdb_ctrl_setrecmaster(ctdb, timeval_current_ofs(1, 0), ctdb_get_vnn(ctdb), em->vnn);
if (ret != 0) {
- DEBUG(0, (__location__ "failed to send recmaster election request"));
+ DEBUG(0, (__location__ " failed to send recmaster election request"));
talloc_free(mem_ctx);
return;
}
/* set all nodes to recovery mode to stop all internode traffic */
ret = set_recovery_mode(ctdb, nodemap, CTDB_RECOVERY_ACTIVE);
if (ret!=0) {
- DEBUG(0, (__location__ "Unable to set recovery mode to active on cluster\n"));
+ DEBUG(0, (__location__ " Unable to set recovery mode to active on cluster\n"));
return;
}
ret = send_election_request(ctdb, mem_ctx, vnn);
if (ret!=0) {
- DEBUG(0, (__location__ "failed to initiate recmaster election"));
+ DEBUG(0, (__location__ " failed to initiate recmaster election"));
return;
}
/* get the vnnmap */
ret = ctdb_ctrl_getvnnmap(ctdb, timeval_current_ofs(1, 0), vnn, mem_ctx, &vnnmap);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to get vnnmap from node %u\n", vnn));
+ DEBUG(0, (__location__ " Unable to get vnnmap from node %u\n", vnn));
goto again;
}
/* get number of nodes */
ret = ctdb_ctrl_getnodemap(ctdb, timeval_current_ofs(1, 0), vnn, mem_ctx, &nodemap);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to get nodemap from node %u\n", vnn));
+ DEBUG(0, (__location__ " Unable to get nodemap from node %u\n", vnn));
goto again;
}
/* check which node is the recovery master */
ret = ctdb_ctrl_getrecmaster(ctdb, timeval_current_ofs(1, 0), vnn, &recmaster);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to get recmaster from node %u\n", vnn));
+ DEBUG(0, (__location__ " Unable to get recmaster from node %u\n", vnn));
goto again;
}
ret = ctdb_ctrl_getrecmaster(ctdb, timeval_current_ofs(1, 0), nodemap->nodes[j].vnn, &recmaster);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to get recmaster from node %u\n", vnn));
+ DEBUG(0, (__location__ " Unable to get recmaster from node %u\n", vnn));
goto again;
}
goto again;
}
if (recmode!=CTDB_RECOVERY_NORMAL) {
- DEBUG(0, (__location__ "Node:%d was in recovery mode. Restart recovery process\n", nodemap->nodes[j].vnn));
+ DEBUG(0, (__location__ " Node:%d was in recovery mode. Restart recovery process\n", nodemap->nodes[j].vnn));
do_recovery(ctdb, ev, mem_ctx, vnn, num_active, nodemap, vnnmap);
goto again;
}
ret = ctdb_ctrl_getnodemap(ctdb, timeval_current_ofs(1, 0), nodemap->nodes[j].vnn, mem_ctx, &remote_nodemap);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to get nodemap from remote node %u\n", nodemap->nodes[j].vnn));
+ DEBUG(0, (__location__ " Unable to get nodemap from remote node %u\n", nodemap->nodes[j].vnn));
goto again;
}
then this is a good reason to try recovery
*/
if (remote_nodemap->num != nodemap->num) {
- DEBUG(0, (__location__ "Remote node:%d has different node count. %d vs %d of the local node\n", nodemap->nodes[j].vnn, remote_nodemap->num, nodemap->num));
+ DEBUG(0, (__location__ " Remote node:%d has different node count. %d vs %d of the local node\n", nodemap->nodes[j].vnn, remote_nodemap->num, nodemap->num));
do_recovery(ctdb, ev, mem_ctx, vnn, num_active, nodemap, vnnmap);
goto again;
}
for (i=0;i<nodemap->num;i++) {
if ((remote_nodemap->nodes[i].vnn != nodemap->nodes[i].vnn)
|| (remote_nodemap->nodes[i].flags != nodemap->nodes[i].flags)) {
- DEBUG(0, (__location__ "Remote node:%d has different nodemap.\n", nodemap->nodes[j].vnn));
+ DEBUG(0, (__location__ " Remote node:%d has different nodemap.\n", nodemap->nodes[j].vnn));
do_recovery(ctdb, ev, mem_ctx, vnn, num_active, nodemap, vnnmap);
goto again;
}
as there are active nodes or we will have to do a recovery
*/
if (vnnmap->size != num_active) {
- DEBUG(0, (__location__ "The vnnmap count is different from the number of active nodes. %d vs %d\n", vnnmap->size, num_active));
+ DEBUG(0, (__location__ " The vnnmap count is different from the number of active nodes. %d vs %d\n", vnnmap->size, num_active));
do_recovery(ctdb, ev, mem_ctx, vnn, num_active, nodemap, vnnmap);
goto again;
}
}
}
if (i==vnnmap->size) {
- DEBUG(0, (__location__ "Node %d is active in the nodemap but did not exist in the vnnmap\n", nodemap->nodes[j].vnn));
+ DEBUG(0, (__location__ " Node %d is active in the nodemap but did not exist in the vnnmap\n", nodemap->nodes[j].vnn));
do_recovery(ctdb, ev, mem_ctx, vnn, num_active, nodemap, vnnmap);
goto again;
}
ret = ctdb_ctrl_getvnnmap(ctdb, timeval_current_ofs(1, 0), nodemap->nodes[j].vnn, mem_ctx, &remote_vnnmap);
if (ret != 0) {
- DEBUG(0, (__location__ "Unable to get vnnmap from remote node %u\n", nodemap->nodes[j].vnn));
+ DEBUG(0, (__location__ " Unable to get vnnmap from remote node %u\n", nodemap->nodes[j].vnn));
goto again;
}
/* verify the vnnmap generation is the same */
if (vnnmap->generation != remote_vnnmap->generation) {
- DEBUG(0, (__location__ "Remote node %d has different generation of vnnmap. %d vs %d (ours)\n", nodemap->nodes[j].vnn, remote_vnnmap->generation, vnnmap->generation));
+ DEBUG(0, (__location__ " Remote node %d has different generation of vnnmap. %d vs %d (ours)\n", nodemap->nodes[j].vnn, remote_vnnmap->generation, vnnmap->generation));
do_recovery(ctdb, ev, mem_ctx, vnn, num_active, nodemap, vnnmap);
goto again;
}
/* verify the vnnmap size is the same */
if (vnnmap->size != remote_vnnmap->size) {
- DEBUG(0, (__location__ "Remote node %d has different size of vnnmap. %d vs %d (ours)\n", nodemap->nodes[j].vnn, remote_vnnmap->size, vnnmap->size));
+ DEBUG(0, (__location__ " Remote node %d has different size of vnnmap. %d vs %d (ours)\n", nodemap->nodes[j].vnn, remote_vnnmap->size, vnnmap->size));
do_recovery(ctdb, ev, mem_ctx, vnn, num_active, nodemap, vnnmap);
goto again;
}
/* verify the vnnmap is the same */
for (i=0;i<vnnmap->size;i++) {
if (remote_vnnmap->map[i] != vnnmap->map[i]) {
- DEBUG(0, (__location__ "Remote node %d has different vnnmap.\n", nodemap->nodes[j].vnn));
+ DEBUG(0, (__location__ " Remote node %d has different vnnmap.\n", nodemap->nodes[j].vnn));
do_recovery(ctdb, ev, mem_ctx, vnn, num_active, nodemap, vnnmap);
goto again;
}
/* initialise ctdb */
ctdb = ctdb_cmdline_client(ev);
if (ctdb == NULL) {
- DEBUG(0, (__location__ "Failed to init ctdb\n"));
+ DEBUG(0, (__location__ " Failed to init ctdb\n"));
exit(1);
}