struct timeval t, void *private_data)
{
struct ctdb_context *ctdb = talloc_get_type(private_data, struct ctdb_context);
- bool freeze_failed = false;
- int i;
/* Make sure we were able to freeze databases during banning */
- for (i=1; i<=NUM_DB_PRIORITIES; i++) {
- if (ctdb->freeze_mode[i] != CTDB_FREEZE_FROZEN) {
- freeze_failed = true;
- break;
- }
- }
- if (freeze_failed) {
+ if (!ctdb_is_frozen(ctdb)) {
DEBUG(DEBUG_ERR, ("Banning timedout, but still unable to freeze databases\n"));
ctdb_ban_self(ctdb);
return;
}
case CTDB_CONTROL_STATISTICS: {
- int i;
CHECK_CONTROL_DATA_SIZE(0);
ctdb->statistics.memory_used = talloc_total_size(NULL);
ctdb->statistics.num_clients = ctdb->num_clients;
- ctdb->statistics.frozen = 0;
- for (i=1; i<= NUM_DB_PRIORITIES; i++) {
- if (ctdb->freeze_mode[i] == CTDB_FREEZE_FROZEN) {
- ctdb->statistics.frozen = 1;
- }
- }
+ ctdb->statistics.frozen = (ctdb_is_frozen(ctdb) ? 1 : 0);
ctdb->statistics.recovering = (ctdb->recovery_mode == CTDB_RECOVERY_ACTIVE);
ctdb->statistics.statistics_current_time = timeval_current();
ctdb_control_setvnnmap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata)
{
struct ctdb_vnn_map_wire *map = (struct ctdb_vnn_map_wire *)indata.dptr;
- int i;
- for(i=1; i<=NUM_DB_PRIORITIES; i++) {
- if (ctdb->freeze_mode[i] != CTDB_FREEZE_FROZEN) {
- DEBUG(DEBUG_ERR,("Attempt to set vnnmap when not frozen\n"));
- return -1;
- }
+ if (!ctdb_is_frozen(ctdb)) {
+ DEBUG(DEBUG_ERR,("Attempt to set vnnmap when not frozen\n"));
+ return -1;
}
talloc_free(ctdb->vnn_map);