if (strstr(ctdb_db->db_name, "notify") != NULL) {
continue;
}
+ if (tdb_transaction_write_lock_mark(ctdb_db->ltdb->tdb) != 0) {
+ return -1;
+ }
if (tdb_lockall_mark(ctdb_db->ltdb->tdb) != 0) {
+ tdb_transaction_write_lock_unmark(ctdb_db->ltdb->tdb);
return -1;
}
}
if (strstr(ctdb_db->db_name, "notify") == NULL) {
continue;
}
+ if (tdb_transaction_write_lock_mark(ctdb_db->ltdb->tdb) != 0) {
+ return -1;
+ }
if (tdb_lockall_mark(ctdb_db->ltdb->tdb) != 0) {
+ tdb_transaction_write_lock_unmark(ctdb_db->ltdb->tdb);
return -1;
}
}
if (ctdb_db->priority != priority) {
continue;
}
+ tdb_transaction_write_lock_unmark(ctdb_db->ltdb->tdb);
if (tdb_lockall_unmark(ctdb_db->ltdb->tdb) != 0) {
return -1;
}
}
params->pulldata = talloc_realloc_size(NULL, params->pulldata, rec->length + params->len);
if (params->pulldata == NULL) {
- DEBUG(DEBUG_ERR,(__location__ " Failed to expand pulldb_data to %u (%u records)\n",
- rec->length + params->len, params->pulldata->count));
- params->failed = true;
- return -1;
+ DEBUG(DEBUG_CRIT,(__location__ " Failed to expand pulldb_data to %u\n", rec->length + params->len));
+ ctdb_fatal(params->ctdb, "failed to allocate memory for recovery. shutting down\n");
}
params->pulldata->count++;
memcpy(params->len+(uint8_t *)params->pulldata, rec, rec->length);
{
double l = timeval_elapsed(&state->start_time);
- ctdb_reclock_latency(state->ctdb, "daemon reclock", &state->ctdb->statistics.reclock.ctdbd, l);
+ CTDB_UPDATE_RECLOCK_LATENCY(state->ctdb, "daemon reclock", reclock.ctdbd, l);
if (state->fd[0] != -1) {
state->fd[0] = -1;
ctdb_release_all_ips(ctdb);
}
+/*
+ * Set up an event to drop all public ips if we remain in recovery for too
+ * long
+ */
+int ctdb_deferred_drop_all_ips(struct ctdb_context *ctdb)
+{
+ if (ctdb->release_ips_ctx != NULL) {
+ talloc_free(ctdb->release_ips_ctx);
+ }
+ ctdb->release_ips_ctx = talloc_new(ctdb);
+ CTDB_NO_MEMORY(ctdb, ctdb->release_ips_ctx);
+
+ event_add_timed(ctdb->ev, ctdb->release_ips_ctx, timeval_current_ofs(ctdb->tunable.recovery_drop_all_ips, 0), ctdb_drop_all_ips_event, ctdb);
+ return 0;
+}
+
/*
set the recovery mode
*/
talloc_free(ctdb->release_ips_ctx);
ctdb->release_ips_ctx = NULL;
} else {
- talloc_free(ctdb->release_ips_ctx);
- ctdb->release_ips_ctx = talloc_new(ctdb);
- CTDB_NO_MEMORY(ctdb, ctdb->release_ips_ctx);
-
- event_add_timed(ctdb->ev, ctdb->release_ips_ctx, timeval_current_ofs(ctdb->tunable.recovery_drop_all_ips, 0), ctdb_drop_all_ips_event, ctdb);
+ if (ctdb_deferred_drop_all_ips(ctdb) != 0) {
+ DEBUG(DEBUG_ERR,("Failed to set up deferred drop all ips\n"));
+ }
}
if (recmode != ctdb->recovery_mode) {
char cc = 0;
close(state->fd[0]);
+ debug_extra = talloc_asprintf(NULL, "set_recmode:");
/* we should not be able to get the lock on the reclock file,
as it should be held by the recovery master
*/
struct recovery_callback_state *state = talloc_get_type(p, struct recovery_callback_state);
ctdb_enable_monitoring(ctdb);
- ctdb->statistics.num_recoveries++;
+ CTDB_INCREMENT_STAT(ctdb, num_recoveries);
if (status != 0) {
DEBUG(DEBUG_ERR,(__location__ " recovered event script failed (status %d)\n", status));