ctdb-daemon: Add extra logging of hot keys
[amitay/samba.git] / ctdb / include / ctdb_private.h
index 1e9619faddf2f8d3ef7c7b60b7f27cfe169be0a8..9ca87332d6102b7dc01fbbc4900f315fdaad6c60 100644 (file)
@@ -36,6 +36,8 @@ struct ctdb_tcp_array {
 /*
   an installed ctdb remote call
 */
+typedef int (*ctdb_fn_t)(struct ctdb_call_info *);
+
 struct ctdb_registered_call {
        struct ctdb_registered_call *next, *prev;
        uint32_t id;
@@ -74,7 +76,7 @@ struct ctdb_node {
        struct ctdb_context *ctdb;
        ctdb_sock_addr address;
        const char *name; /* for debug messages */
-       void *private_data; /* private to transport */
+       void *transport_data; /* private to transport */
        uint32_t pnn;
        uint32_t flags;
 
@@ -87,7 +89,7 @@ struct ctdb_node {
           if the node becomes disconnected */
        struct daemon_control_state *pending_controls;
 
-       /* used by the recovery dameon to track when a node should be banned */
+       /* used by the recovery daemon to track when a node should be banned */
        struct ctdb_banning_state *ban_state; 
 };
 
@@ -286,7 +288,7 @@ struct ctdb_context {
        char *err_msg;
        const struct ctdb_methods *methods; /* transport methods */
        const struct ctdb_upcalls *upcalls; /* transport upcalls */
-       void *private_data; /* private to transport */
+       void *transport_data; /* private to transport */
        struct ctdb_db_context *db_list;
        struct srvid_context *srv;
        struct srvid_context *tunnels;
@@ -318,7 +320,7 @@ struct ctdb_context {
 
        TALLOC_CTX *banning_ctx;
 
-       struct ctdb_vacuum_child_context *vacuumers;
+       struct ctdb_vacuum_child_context *vacuumer;
 
        /* mapping from pid to ctdb_client * */
        struct ctdb_client_pid_list *client_pids;
@@ -340,6 +342,12 @@ struct ctdb_context {
        struct lock_context *lock_pending;
 };
 
+struct ctdb_db_hot_key {
+       uint32_t count;
+       TDB_DATA key;
+       uint32_t last_logged_count;
+};
+
 struct ctdb_db_context {
        struct ctdb_db_context *next, *prev;
        struct ctdb_context *ctdb;
@@ -359,6 +367,7 @@ struct ctdb_db_context {
        struct revokechild_handle *revokechild_active;
        struct ctdb_persistent_state *persistent_state;
        struct trbt_tree *delete_queue;
+       struct trbt_tree *fetch_queue;
        struct trbt_tree *sticky_records; 
        int (*ctdb_ltdb_store_fn)(struct ctdb_db_context *ctdb_db,
                                  TDB_DATA key,
@@ -372,10 +381,11 @@ struct ctdb_db_context {
        struct trbt_tree *defer_dmaster;
 
        struct ctdb_db_statistics_old statistics;
+       struct ctdb_db_hot_key hot_keys[MAX_HOT_KEYS];
 
        struct lock_context *lock_current;
        struct lock_context *lock_pending;
-       int lock_num_current;
+       unsigned int lock_num_current;
        struct db_hash_context *lock_log;
 
        struct ctdb_call_state *pending_calls;
@@ -481,7 +491,6 @@ int ctdb_ibw_init(struct ctdb_context *ctdb);
 
 /* from ctdb_banning.c */
 
-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);
 void ctdb_ban_self(struct ctdb_context *ctdb);
@@ -556,7 +565,9 @@ int daemon_deregister_message_handler(struct ctdb_context *ctdb,
 void daemon_tunnel_handler(uint64_t tunnel_id, TDB_DATA data,
                           void *private_data);
 
-int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork);
+int ctdb_start_daemon(struct ctdb_context *ctdb,
+                     bool interactive,
+                     bool test_mode_enabled);
 
 struct ctdb_req_header *_ctdb_transport_allocate(struct ctdb_context *ctdb,
                                                 TALLOC_CTX *mem_ctx,
@@ -819,6 +830,8 @@ int32_t ctdb_control_recd_ping(struct ctdb_context *ctdb);
 int32_t ctdb_control_set_recmaster(struct ctdb_context *ctdb,
                                   uint32_t opcode, TDB_DATA indata);
 
+void ctdb_node_become_inactive(struct ctdb_context *ctdb);
+
 int32_t ctdb_control_stop_node(struct ctdb_context *ctdb);
 int32_t ctdb_control_continue_node(struct ctdb_context *ctdb);
 
@@ -984,6 +997,11 @@ int32_t ctdb_control_uptime(struct ctdb_context *ctdb, TDB_DATA *outdata);
 
 /* from ctdb_vacuum.c */
 
+int32_t ctdb_control_db_vacuum(struct ctdb_context *ctdb,
+                              struct ctdb_req_control_old *c,
+                              TDB_DATA indata,
+                              bool *async_reply);
+
 void ctdb_stop_vacuuming(struct ctdb_context *ctdb);
 int ctdb_vacuum_init(struct ctdb_db_context *ctdb_db);
 
@@ -997,6 +1015,8 @@ void ctdb_local_remove_from_delete_queue(struct ctdb_db_context *ctdb_db,
                                         const struct ctdb_ltdb_header *hdr,
                                         const TDB_DATA key);
 
+int32_t ctdb_control_vacuum_fetch(struct ctdb_context *ctdb, TDB_DATA indata);
+
 /* from eventscript.c */
 
 int ctdb_start_eventd(struct ctdb_context *ctdb);