Deferred attach : at early startup, defer any db attach calls until we are out of...
[sahlberg/ctdb.git] / include / ctdb_private.h
index 2d9315f6ac49bf0a79f4b2947c540bdf1ab3098c..c1499b46385837afbfecbea2500d23e932401385 100644 (file)
@@ -118,6 +118,7 @@ struct ctdb_tunable {
        uint32_t use_status_events_for_monitoring;
        uint32_t allow_unhealthy_db_read;
        uint32_t stat_history_interval;
+       uint32_t deferred_attach_timeout;
 };
 
 /*
@@ -488,6 +489,9 @@ struct ctdb_context {
 
        /* used in the recovery daemon to remember the ip allocation */
        struct trbt_tree *ip_tree;
+
+       /* Used to defer db attach requests while in recovery mode */
+       struct ctdb_deferred_attach_context *deferred_attach;
 };
 
 struct ctdb_db_context {
@@ -506,6 +510,9 @@ struct ctdb_db_context {
        bool transaction_active;
        struct ctdb_vacuum_handle *vacuum_handle;
        char *unhealthy_reason;
+       int pending_requests;
+       struct lockwait_handle *lockwait_active;
+       struct lockwait_handle *lockwait_overflow;
 };
 
 
@@ -796,7 +803,10 @@ int ctdb_daemon_send_control(struct ctdb_context *ctdb, uint32_t destnode,
                             void *private_data);
 
 int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata, 
-                              TDB_DATA *outdata, uint64_t tdb_flags, bool persistent);
+                              TDB_DATA *outdata, uint64_t tdb_flags,
+                              bool persistent, uint32_t client_id,
+                              struct ctdb_req_control *c,
+                              bool *async_reply);
 
 int ctdb_daemon_set_call(struct ctdb_context *ctdb, uint32_t db_id,
                         ctdb_fn_t fn, int id);
@@ -837,24 +847,6 @@ int ctdb_control_getnodemap(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA
 int ctdb_control_writerecord(struct ctdb_context *ctdb, uint32_t opcode, TDB_DATA indata, TDB_DATA *outdata);
 
 
-struct ctdb_traverse_start {
-       uint32_t db_id;
-       uint32_t reqid;
-       uint64_t srvid;
-};
-
-/*
-  structure used to pass record data between the child and parent
- */
-struct ctdb_rec_data {
-       uint32_t length;
-       uint32_t reqid;
-       uint32_t keylen;
-       uint32_t datalen;
-       uint8_t  data[1];
-};
-                                  
-
 /* structure used for pulldb control */
 struct ctdb_control_pulldb {
        uint32_t db_id;
@@ -1377,4 +1369,6 @@ int32_t ctdb_control_get_stat_history(struct ctdb_context *ctdb,
 
 int ctdb_deferred_drop_all_ips(struct ctdb_context *ctdb);
 
+int ctdb_process_deferred_attach(struct ctdb_context *ctdb);
+
 #endif