TDB_DATA *outdata, int32_t status, const char *errormsg);
int32_t ctdb_control_freeze(struct ctdb_context *ctdb, struct ctdb_req_control *c, bool *async_reply);
-int32_t ctdb_control_thaw(struct ctdb_context *ctdb, uint32_t priority);
+int32_t ctdb_control_thaw(struct ctdb_context *ctdb, uint32_t priority,
+ bool check_recmode);
int ctdb_start_recoverd(struct ctdb_context *ctdb);
void ctdb_stop_recoverd(struct ctdb_context *ctdb);
case CTDB_CONTROL_THAW:
CHECK_CONTROL_DATA_SIZE(0);
- return ctdb_control_thaw(ctdb, (uint32_t)c->srvid);
+ return ctdb_control_thaw(ctdb, (uint32_t)c->srvid, true);
case CTDB_CONTROL_SET_RECMODE:
CHECK_CONTROL_DATA_SIZE(sizeof(uint32_t));
/*
thaw the databases
*/
-int32_t ctdb_control_thaw(struct ctdb_context *ctdb, uint32_t priority)
+int32_t ctdb_control_thaw(struct ctdb_context *ctdb, uint32_t priority,
+ bool check_recmode)
{
-
if (priority > NUM_DB_PRIORITIES) {
- DEBUG(DEBUG_ERR,(__location__ " Invalid db priority : %u\n", priority));
+ DEBUG(DEBUG_ERR,(__location__ " Invalid db priority : %u\n",
+ priority));
+ return -1;
+ }
+
+ if (check_recmode && ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE) {
+ DEBUG(DEBUG_ERR, ("Failing to thaw databases while "
+ "recovery is active\n"));
return -1;
}
/* force the databases to thaw */
for (i=1; i<=NUM_DB_PRIORITIES; i++) {
if (ctdb->freeze_handles[i] != NULL) {
- ctdb_control_thaw(ctdb, i);
+ ctdb_control_thaw(ctdb, i, false);
}
}