[SCM] CTDB repository - branch 2.5 updated - ctdb-2.5.3-1-g3639856
Amitay Isaacs
amitay at samba.org
Mon Apr 7 20:52:55 MDT 2014
The branch, 2.5 has been updated
via 3639856145063750fdda3e85daa7b4361fc72450 (commit)
from 6f985ee9378893470c180a1cd864dc4c96d3ad5b (commit)
http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=2.5
- Log -----------------------------------------------------------------
commit 3639856145063750fdda3e85daa7b4361fc72450
Author: Amitay Isaacs <amitay at gmail.com>
Date: Wed Apr 2 17:17:47 2014 +1100
daemon: Always update database priority cluster wide
Database priority is a global property and all the nodes should have the
priority set for the databases. Just setting priority on one node can
lead to problems in the recovery as a database can be frozen at wrong
priority and then freezing database would not succeed.
Signed-off-by: Amitay Isaacs <amitay at gmail.com>
Reviewed-by: David Disseldorp <ddiss at samba.org>
Autobuild-User(master): David Disseldorp <ddiss at samba.org>
Autobuild-Date(master): Mon Apr 7 14:06:26 CEST 2014 on sn-devel-104
(Imported from commit 01de7818def1367fd55d8fbd80432c5a02c3e1f6)
-----------------------------------------------------------------------
Summary of changes:
include/ctdb_private.h | 3 ++-
server/ctdb_control.c | 2 +-
server/ctdb_ltdb_server.c | 10 +++++++++-
server/ctdb_recoverd.c | 19 +++++--------------
4 files changed, 17 insertions(+), 17 deletions(-)
Changeset truncated at 500 lines:
diff --git a/include/ctdb_private.h b/include/ctdb_private.h
index 8ed867d..2206f4e 100644
--- a/include/ctdb_private.h
+++ b/include/ctdb_private.h
@@ -1440,7 +1440,8 @@ int32_t ctdb_control_disable_script(struct ctdb_context *ctdb, TDB_DATA indata);
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);
diff --git a/server/ctdb_control.c b/server/ctdb_control.c
index b407a1f..b56b624 100644
--- a/server/ctdb_control.c
+++ b/server/ctdb_control.c
@@ -603,7 +603,7 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
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;
diff --git a/server/ctdb_ltdb_server.c b/server/ctdb_ltdb_server.c
index 234ecac..aafba42 100644
--- a/server/ctdb_ltdb_server.c
+++ b/server/ctdb_ltdb_server.c
@@ -1425,7 +1425,8 @@ int32_t ctdb_ltdb_enable_seqnum(struct ctdb_context *ctdb, 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;
@@ -1444,6 +1445,13 @@ int32_t ctdb_control_set_db_priority(struct ctdb_context *ctdb, TDB_DATA indata)
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;
}
diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index 179eb7d..ac692ec 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -458,13 +458,9 @@ static int update_db_priority_on_remote_nodes(struct ctdb_context *ctdb,
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;
@@ -477,16 +473,11 @@ static int update_db_priority_on_remote_nodes(struct ctdb_context *ctdb,
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));
}
}
--
CTDB repository
More information about the samba-cvs
mailing list