summaryrefslogtreecommitdiffstats
path: root/ctdb/include
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronniesahlberg@gmail.com>2008-05-06 15:42:59 +1000
committerRonnie Sahlberg <ronniesahlberg@gmail.com>2008-05-06 15:42:59 +1000
commit92b61cd7d53321d2fbe3eab7f0290e233e47ee9f (patch)
treeae19da87e3072ab9b8f12d0466fe4ae820fe8d05 /ctdb/include
parent2c23959616ef1db2ae07172eba72ef313ccba0ed (diff)
Expand the client async framework so that it can take a callback function.
This allows us to use the async framework also for controls that return outdata. Add a "capabilities" field to the ctdb_node structure. This field is only initialized and kept valid inside the recovery daemon context and not inside the main ctdb daemon. change the GET_CAPABILITIES control to return the capabilities in outdata instead of in the res return variable. When performing a recovery inside the recovery daemon, read the capabilities from all connected nodes and update the ctdb->nodes list of nodes. when building the new vnnmap after the database rebuild in recovery, do not include any nodes which lack the LMASTER capability in the new vnnmap. Unless there are no available connected node that sports the LMASTER capability in which case we let the local node (recmaster) take on the lmaster role temporarily (i.e. become a member of the vnnmap list) (This used to be ctdb commit 0f1883c69c689b28b0c04148774840b2c4081df6)
Diffstat (limited to 'ctdb/include')
-rw-r--r--ctdb/include/ctdb_private.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index d2abc994af..d31b148fca 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -199,6 +199,11 @@ struct ctdb_node {
uint32_t rx_cnt;
uint32_t tx_cnt;
+ /* used to track node capabilities, is only valid/tracked inside the
+ recovery daemon.
+ */
+ uint32_t capabilities;
+
/* a list of controls pending to this node, so we can time them out quickly
if the node becomes disconnected */
struct daemon_control_state *pending_controls;
@@ -1276,10 +1281,13 @@ int32_t ctdb_monitoring_mode(struct ctdb_context *ctdb);
int ctdb_set_child_logging(struct ctdb_context *ctdb);
+typedef void (*client_async_callback)(struct ctdb_context *ctdb, uint32_t node_pnn, int32_t res, TDB_DATA outdata);
+
struct client_async_data {
bool dont_log_errors;
uint32_t count;
uint32_t fail_count;
+ client_async_callback callback;
};
void ctdb_client_async_add(struct client_async_data *data, struct ctdb_client_control_state *state);
int ctdb_client_async_wait(struct ctdb_context *ctdb, struct client_async_data *data);
@@ -1288,12 +1296,14 @@ int ctdb_client_async_control(struct ctdb_context *ctdb,
uint32_t *nodes,
struct timeval timeout,
bool dont_log_errors,
- TDB_DATA data);
+ TDB_DATA data,
+ client_async_callback client_callback);
void ctdb_load_nodes_file(struct ctdb_context *ctdb);
int ctdb_control_reload_nodes_file(struct ctdb_context *ctdb, uint32_t opcode);
int32_t ctdb_dump_memory(struct ctdb_context *ctdb, TDB_DATA *outdata);
+int32_t ctdb_control_get_capabilities(struct ctdb_context *ctdb, TDB_DATA *outdata);
#endif