1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

ctdb-daemon: Do not thaw databases if recovery is active

This prevents ctdb tool from thawing databases prematurely in
thaw/wipedb/restoredb commands if recovery is active.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
Amitay Isaacs 2014-05-06 14:20:44 +10:00 committed by Martin Schwenke
parent 28a1b75886
commit 2855173dac
4 changed files with 14 additions and 6 deletions

View File

@ -1059,7 +1059,8 @@ void ctdb_request_control_reply(struct ctdb_context *ctdb, struct ctdb_req_contr
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);

View File

@ -318,7 +318,7 @@ static int32_t ctdb_control_dispatch(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));

View File

@ -267,11 +267,18 @@ static void thaw_priority(struct ctdb_context *ctdb, uint32_t priority)
/*
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;
}

View File

@ -623,7 +623,7 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
/* 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);
}
}