void ctdb_local_node_got_banned(struct ctdb_context *ctdb);
int32_t ctdb_control_set_ban_state(struct ctdb_context *ctdb, TDB_DATA indata);
int32_t ctdb_control_get_ban_state(struct ctdb_context *ctdb, TDB_DATA *outdata);
-int32_t ctdb_control_set_db_priority(struct ctdb_context *ctdb, TDB_DATA indata);
+int32_t ctdb_control_set_db_priority(struct ctdb_context *ctdb, TDB_DATA indata,
+ uint32_t client_id);
void ctdb_ban_self(struct ctdb_context *ctdb);
int32_t ctdb_control_register_notify(struct ctdb_context *ctdb, uint32_t client_id, TDB_DATA indata);
case CTDB_CONTROL_SET_DB_PRIORITY:
CHECK_CONTROL_DATA_SIZE(sizeof(struct ctdb_db_priority));
- return ctdb_control_set_db_priority(ctdb, indata);
+ return ctdb_control_set_db_priority(ctdb, indata, client_id);
case CTDB_CONTROL_GET_DB_PRIORITY: {
uint32_t db_id;
return 0;
}
-int32_t ctdb_control_set_db_priority(struct ctdb_context *ctdb, TDB_DATA indata)
+int32_t ctdb_control_set_db_priority(struct ctdb_context *ctdb, TDB_DATA indata,
+ uint32_t client_id)
{
struct ctdb_db_priority *db_prio = (struct ctdb_db_priority *)indata.dptr;
struct ctdb_db_context *ctdb_db;
ctdb_db->priority = db_prio->priority;
DEBUG(DEBUG_INFO,("Setting DB priority to %u for db 0x%08x\n", db_prio->priority, db_prio->db_id));
+ if (client_id != 0) {
+ /* Broadcast the update to the rest of the cluster */
+ ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_ALL, 0,
+ CTDB_CONTROL_SET_DB_PRIORITY, 0,
+ CTDB_CTRL_FLAG_NOREPLY, indata,
+ NULL, NULL);
+ }
return 0;
}
uint32_t pnn, struct ctdb_dbid_map *dbmap, TALLOC_CTX *mem_ctx)
{
int db;
- uint32_t *nodes;
-
- nodes = list_of_active_nodes(ctdb, nodemap, mem_ctx, true);
/* step through all local databases */
for (db=0; db<dbmap->num;db++) {
- TDB_DATA data;
struct ctdb_db_priority db_prio;
int ret;
DEBUG(DEBUG_INFO,("Update DB priority for db 0x%08x to %u\n", dbmap->dbs[db].dbid, db_prio.priority));
- data.dptr = (uint8_t *)&db_prio;
- data.dsize = sizeof(db_prio);
-
- if (ctdb_client_async_control(ctdb,
- CTDB_CONTROL_SET_DB_PRIORITY,
- nodes, 0,
- CONTROL_TIMEOUT(), false, data,
- NULL, NULL,
- NULL) != 0) {
- DEBUG(DEBUG_ERR,(__location__ " Failed to set DB priority for 0x%08x\n", db_prio.db_id));
+ ret = ctdb_ctrl_set_db_priority(ctdb, CONTROL_TIMEOUT(),
+ CTDB_CURRENT_NODE, &db_prio);
+ if (ret != 0) {
+ DEBUG(DEBUG_ERR,(__location__ " Failed to set DB priority for 0x%08x\n",
+ db_prio.db_id));
}
}