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);
}
-
- for (i=1; i<=NUM_DB_PRIORITIES; i++) {
- if (ctdb->freeze_mode[i] != CTDB_FREEZE_FROZEN) {
- DEBUG(DEBUG_ERR,("Attempt to change recovery mode to %u when not frozen\n",
- recmode));
- (*errormsg) = "Cannot change recovery mode while not frozen";
- return -1;
- }
- }
-
if (recmode != ctdb->recovery_mode) {
DEBUG(DEBUG_NOTICE,(__location__ " Recovery mode set to %s\n",
recmode==CTDB_RECOVERY_NORMAL?"NORMAL":"ACTIVE"));
if (!ctdb_sys_have_ip(&ips->ips[j].addr)) {
DEBUG(DEBUG_CRIT,("Public address '%s' is missing and we should serve this ip\n",
ctdb_addr_to_str(&ips->ips[j].addr)));
- ret = ctdb_ctrl_freeze(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE);
+ ret = ctdb_ctrl_freeze_priority(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, 1);
if (ret != 0) {
DEBUG(DEBUG_ERR,(__location__ " Failed to freeze node due to public ip address mismatches\n"));
DEBUG(DEBUG_CRIT,("We are still serving a public address '%s' that we should not be serving.\n",
ctdb_addr_to_str(&ips->ips[j].addr)));
- ret = ctdb_ctrl_freeze(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE);
+ ret = ctdb_ctrl_freeze_priority(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, 1);
if (ret != 0) {
DEBUG(DEBUG_ERR,(__location__ " Failed to freeze node due to public ip address mismatches\n"));
if (ctdb->recovery_mode == CTDB_RECOVERY_NORMAL) {
DEBUG(DEBUG_ERR,("Node is stopped but recovery mode is not active. Activate recovery mode and lock databases\n"));
- ret = ctdb_ctrl_freeze(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE);
+ ret = ctdb_ctrl_freeze_priority(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, 1);
if (ret != 0) {
DEBUG(DEBUG_ERR,(__location__ " Failed to freeze node due to node being STOPPED\n"));
goto again;
nodes = list_of_active_nodes_except_pnn(ctdb, nodemap, tmp_ctx, pnn);
ret = ctdb_client_async_control(ctdb, CTDB_CONTROL_RELEASE_IP,
- nodes, TIMELIMIT(),
+ nodes, 0,
+ TIMELIMIT(),
false, data,
NULL, NULL,
NULL);
/* record the current generation number */
generation = get_generation(ctdb);
- ret = ctdb_ctrl_freeze(ctdb, TIMELIMIT(), options.pnn);
+ ret = ctdb_ctrl_freeze_priority(ctdb, TIMELIMIT(), options.pnn, 1);
if (ret != 0) {
DEBUG(DEBUG_ERR, ("Unable to freeze node\n"));
return ret;
struct ctdb_db_context *ctdb_db;
struct ctdb_node_map *nodemap=NULL;
struct ctdb_vnn_map *vnnmap=NULL;
- int fh;
+ int i, fh;
struct ctdb_control_wipe_database w;
uint32_t *nodes;
uint32_t generation;
/* freeze all nodes */
nodes = list_of_active_nodes(ctdb, nodemap, tmp_ctx, true);
- if (ctdb_client_async_control(ctdb, CTDB_CONTROL_FREEZE,
- nodes, TIMELIMIT(),
+ for (i=1; i<=NUM_DB_PRIORITIES; i++) {
+ if (ctdb_client_async_control(ctdb, CTDB_CONTROL_FREEZE,
+ nodes, i,
+ TIMELIMIT(),
false, tdb_null,
NULL, NULL,
NULL) != 0) {
- DEBUG(DEBUG_ERR, ("Unable to freeze nodes.\n"));
- ctdb_ctrl_setrecmode(ctdb, TIMELIMIT(), options.pnn, CTDB_RECOVERY_ACTIVE);
- talloc_free(tmp_ctx);
- return -1;
+ DEBUG(DEBUG_ERR, ("Unable to freeze nodes.\n"));
+ ctdb_ctrl_setrecmode(ctdb, TIMELIMIT(), options.pnn, CTDB_RECOVERY_ACTIVE);
+ talloc_free(tmp_ctx);
+ return -1;
+ }
}
generation = vnnmap->generation;
/* start a cluster wide transaction */
nodes = list_of_active_nodes(ctdb, nodemap, tmp_ctx, true);
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_TRANSACTION_START,
- nodes,
+ nodes, 0,
TIMELIMIT(), false, data,
NULL, NULL,
NULL) != 0) {
/* wipe all the remote databases. */
nodes = list_of_active_nodes(ctdb, nodemap, tmp_ctx, true);
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_WIPE_DATABASE,
- nodes,
+ nodes, 0,
TIMELIMIT(), false, data,
NULL, NULL,
NULL) != 0) {
/* push the database */
nodes = list_of_active_nodes(ctdb, nodemap, tmp_ctx, true);
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_PUSH_DB,
- nodes,
+ nodes, 0,
TIMELIMIT(), false, outdata,
NULL, NULL,
NULL) != 0) {
/* commit all the changes */
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_TRANSACTION_COMMIT,
- nodes,
+ nodes, 0,
TIMELIMIT(), false, data,
NULL, NULL,
NULL) != 0) {
/* thaw all nodes */
nodes = list_of_active_nodes(ctdb, nodemap, tmp_ctx, true);
if (ctdb_client_async_control(ctdb, CTDB_CONTROL_THAW,
- nodes, TIMELIMIT(),
+ nodes, 0,
+ TIMELIMIT(),
false, tdb_null,
NULL, NULL,
NULL) != 0) {