[SCM] Samba Shared Repository - branch master updated

Martin Schwenke martins at samba.org
Fri Mar 25 05:58:06 UTC 2016


The branch, master has been updated
       via  c51b8c2 ctdb-recovery-helper: Add banning to parallel recovery
       via  ae366fb ctdb-recoverd: Add message handler to assigning banning credits
       via  fc63eae ctdb-protocol: Add srvid for assigning banning credits
       via  ad7a407 ctdb-recovery-helper: Introduce new #define variable
       via  e5a714a ctdb-recovery-helper: Improve log message
       via  a7b8ee8 ctdb-tests: Add a test for recovery of large databases
       via  ffea827 ctdb-recovery-helper: Introduce push database abstraction
       via  b96a475 ctdb-recovery-helper: Introduce pull database abstraction
       via  bb6541b ctdb-protocol: Add new capability
       via  c5776f0 ctdb-protocol: Add srvid for messages during recovery
       via  b1e8714 ctdb-protocol: Introduce variable for checking srvid prefix
       via  e1fdfdd ctdb-recovery-helper: Write recovery records to a recovery file
       via  9058fe0 ctdb-recovery-helper: Re-factor function to retain records from recdb
       via  76f653f ctdb-protocol: Add file IO functions for ctdb_rec_buffer
       via  a80ff09 ctdb-recovery-helper: Create accessors for recdb structure fields
       via  70011a1 ctdb-recovery-helper: Rename pnn to dmaster in recdb_records()
       via  5b926d8 ctdb-recovery-helper: Pass capabilities to database recovery functions
       via  5f43f92 ctdb-recovery-helper: Factor out generic recv function
       via  338e0dc ctdb-client: Add client API functions for new controls
       via  95a15cd ctdb-daemon: Implement new controls DB_PULL and DB_PUSH_START/DB_PUSH_CONFIRM
       via  0fd156a ctdb-protocol: Add new controls DB_PULL and DB_PUSH_START/DB_PUSH_CONFIRM
       via  fe69b72 ctdb-protocol: Add new data type ctdb_pulldb_ext for new control
       via  c41808e ctdb-tunables: Add new tunable RecBufferSizeLimit
       via  67799c7 ctdb-client: Add client API for sending message to multiple nodes
      from  8151ac2 s3: torture. Remove spurious lp_posix_pathnames() included by cut-and-paste error.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c51b8c22349bde6a3280c51ac147cab5ea27b5a6
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Mar 15 15:08:24 2016 +1100

    ctdb-recovery-helper: Add banning to parallel recovery
    
    If one or more nodes are misbehaving during recovery, keep track of
    failures as ban_credits.  If the node with the highest ban_credits exceeds
    5 ban credits, then tell recovery daemon to assign banning credits.
    
    This will ban only a single node at a time in case of recovery failure.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Fri Mar 25 06:57:32 CET 2016 on sn-devel-144

commit ae366fb932e9d42fbde5aa48f04d70e15dc36888
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Mar 17 17:26:30 2016 +1100

    ctdb-recoverd: Add message handler to assigning banning credits
    
    This will be called from recovery helper to assign banning credits to
    misbehaving node.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit fc63eae80b7b521598560b970a4ce10a0838a3ce
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Mar 17 17:16:09 2016 +1100

    ctdb-protocol: Add srvid for assigning banning credits
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit ad7a407a13b87ec13d94a808111d2583bfd1d217
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Mar 17 14:22:17 2016 +1100

    ctdb-recovery-helper: Introduce new #define variable
    
    ... instead of hardcoding number of retries.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit e5a714a3c29fd8fdebe0203e68c7ce19f54af2d3
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Mar 17 14:13:02 2016 +1100

    ctdb-recovery-helper: Improve log message
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit a7b8ee87fe1b58ffb9da02ae8e3959a385e628d9
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Sat Mar 5 15:04:48 2016 +1100

    ctdb-tests: Add a test for recovery of large databases
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit ffea827bae2a8054ad488ae82eedb021cdfb71c4
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Feb 25 18:07:11 2016 +1100

    ctdb-recovery-helper: Introduce push database abstraction
    
    This abstraction uses capabilities of the remote nodes to either send
    older PUSH_DB controls or newer DB_PUSH_START and DB_PUSH_CONFIRM
    controls.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit b96a4759b397d873d56ccdd0c0b26e770cc10b89
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Feb 24 18:10:49 2016 +1100

    ctdb-recovery-helper: Introduce pull database abstraction
    
    This abstraction depending on the capability of the remote node either
    uses older PULL_DB control or newer DB_PULL control.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit bb6541b386c7dfcc6dcbbd4cea39dc1ff80fe578
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Feb 23 14:52:51 2016 +1100

    ctdb-protocol: Add new capability
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit c5776f0529dd23979dd3ef36ffe7d7b8eb444d0d
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Feb 23 18:03:10 2016 +1100

    ctdb-protocol: Add srvid for messages during recovery
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit b1e8714bb851067a0e0cf5976ffe40095ba5ae03
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Wed Mar 23 14:35:42 2016 +1100

    ctdb-protocol: Introduce variable for checking srvid prefix
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit e1fdfdd1c13b0a81e4d2e8b87aeb6f6bafef1a92
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Mar 8 18:32:19 2016 +1100

    ctdb-recovery-helper: Write recovery records to a recovery file
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 9058fe06df7f24e9a1b8fd5792a537a1fa8f5a60
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Mar 8 17:48:46 2016 +1100

    ctdb-recovery-helper: Re-factor function to retain records from recdb
    
    Also, rename traverse function and traverse state for recdb_records
    consistently.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 76f653f0bc016dfa98a4d8688469be4ac450a17a
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Mar 8 17:20:30 2016 +1100

    ctdb-protocol: Add file IO functions for ctdb_rec_buffer
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit a80ff09ed3da49c544fb121ae88e3ccb351fc4e7
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Mon Feb 29 13:53:52 2016 +1100

    ctdb-recovery-helper: Create accessors for recdb structure fields
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 70011a1bfb24d9f4b2a042d353f907ef7c49bc1c
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Feb 26 15:42:53 2016 +1100

    ctdb-recovery-helper: Rename pnn to dmaster in recdb_records()
    
    This variable is used to set the dmaster value for each record in
    recdb_traverse().
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 5b926d882e3cf63d4ad3a9714fd0d440d6b5f3e5
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Feb 25 11:04:51 2016 +1100

    ctdb-recovery-helper: Pass capabilities to database recovery functions
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 5f43f92796f4f8130067e23555f94842bb803fcf
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Feb 26 17:36:39 2016 +1100

    ctdb-recovery-helper: Factor out generic recv function
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 338e0dccd903b63bf15ae9af38c47aad01c110d0
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Feb 19 11:14:40 2016 +1100

    ctdb-client: Add client API functions for new controls
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 95a15cde45c47e36d87d54464bcd769ee96e43c2
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Feb 19 17:32:09 2016 +1100

    ctdb-daemon: Implement new controls DB_PULL and DB_PUSH_START/DB_PUSH_CONFIRM
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 0fd156ae8478f2da35a68c6bd3f90f50a06aecb8
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Feb 19 10:54:15 2016 +1100

    ctdb-protocol: Add new controls DB_PULL and DB_PUSH_START/DB_PUSH_CONFIRM
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit fe69b72569494ef09dc8fa8673af02c0bfc18434
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Feb 19 10:45:19 2016 +1100

    ctdb-protocol: Add new data type ctdb_pulldb_ext for new control
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit c41808e6d292ec4cd861af545478e7dfb5c448e8
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Tue Mar 8 17:29:31 2016 +1100

    ctdb-tunables: Add new tunable RecBufferSizeLimit
    
    This will be used to limit the size of record buffer sent in newer
    controls for recovery and existing controls for vacuuming.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

commit 67799c73af486962b897d1841a8a4234fdee824b
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Fri Feb 26 14:12:19 2016 +1100

    ctdb-client: Add client API for sending message to multiple nodes
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Martin Schwenke <martin at meltin.net>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/client/client.h                           |   25 +
 ctdb/client/client_control_sync.c              |   86 ++
 ctdb/client/client_message.c                   |  132 +++
 ctdb/doc/ctdb-tunables.7.xml                   |   10 +
 ctdb/include/ctdb_private.h                    |   11 +
 ctdb/protocol/protocol.h                       |   24 +-
 ctdb/protocol/protocol_api.h                   |   18 +
 ctdb/protocol/protocol_client.c                |   70 ++
 ctdb/protocol/protocol_control.c               |   68 ++
 ctdb/protocol/protocol_debug.c                 |   22 +-
 ctdb/protocol/protocol_message.c               |   12 +
 ctdb/protocol/protocol_private.h               |    5 +
 ctdb/protocol/protocol_types.c                 |   90 ++
 ctdb/server/ctdb_control.c                     |   12 +
 ctdb/server/ctdb_recover.c                     |  340 ++++++
 ctdb/server/ctdb_recoverd.c                    |   28 +
 ctdb/server/ctdb_recovery_helper.c             | 1383 ++++++++++++++++++++----
 ctdb/server/ctdb_tunables.c                    |    1 +
 ctdb/tests/simple/78_ctdb_large_db_recovery.sh |  107 ++
 ctdb/tests/src/protocol_client_test.c          |   48 +
 ctdb/tests/src/protocol_types_test.c           |   67 ++
 21 files changed, 2313 insertions(+), 246 deletions(-)
 create mode 100755 ctdb/tests/simple/78_ctdb_large_db_recovery.sh


Changeset truncated at 500 lines:

diff --git a/ctdb/client/client.h b/ctdb/client/client.h
index df0b9b8..9869004 100644
--- a/ctdb/client/client.h
+++ b/ctdb/client/client.h
@@ -78,6 +78,16 @@ struct tevent_req *ctdb_client_message_send(TALLOC_CTX *mem_ctx,
 
 bool ctdb_client_message_recv(struct tevent_req *req, int *perr);
 
+struct tevent_req *ctdb_client_message_multi_send(
+				TALLOC_CTX *mem_ctx,
+				struct tevent_context *ev,
+				struct ctdb_client_context *client,
+				uint32_t *pnn_list, int count,
+				struct ctdb_req_message *message);
+
+bool ctdb_client_message_multi_recv(struct tevent_req *req, int *perr,
+				    TALLOC_CTX *mem_ctx, int **perr_list);
+
 int ctdb_client_message(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 			struct ctdb_client_context *client,
 			uint32_t destnode, struct ctdb_req_message *message);
@@ -726,6 +736,21 @@ int ctdb_ctrl_db_transaction_cancel(TALLOC_CTX *mem_ctx,
 				    int destnode, struct timeval timeout,
 				    uint32_t db_id);
 
+int ctdb_ctrl_db_pull(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+		      struct ctdb_client_context *client,
+		      int destnode, struct timeval timeout,
+		      struct ctdb_pulldb_ext *pulldb, uint32_t *num_records);
+
+int ctdb_ctrl_db_push_start(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+			    struct ctdb_client_context *client,
+			    int destnode, struct timeval timeout,
+			    struct ctdb_pulldb_ext *pulldb);
+
+int ctdb_ctrl_db_push_confirm(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+			      struct ctdb_client_context *client,
+			      int destnode, struct timeval timeout,
+			      uint32_t db_id, uint32_t *num_records);
+
 /* from client/client_db.c */
 
 struct tevent_req *ctdb_attach_send(TALLOC_CTX *mem_ctx,
diff --git a/ctdb/client/client_control_sync.c b/ctdb/client/client_control_sync.c
index 7c3cda2..7515623 100644
--- a/ctdb/client/client_control_sync.c
+++ b/ctdb/client/client_control_sync.c
@@ -3088,3 +3088,89 @@ int ctdb_ctrl_db_transaction_cancel(TALLOC_CTX *mem_ctx,
 
 	return 0;
 }
+
+int ctdb_ctrl_db_pull(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+		      struct ctdb_client_context *client,
+		      int destnode, struct timeval timeout,
+		      struct ctdb_pulldb_ext *pulldb, uint32_t *num_records)
+{
+	struct ctdb_req_control request;
+	struct ctdb_reply_control *reply;
+	int ret;
+
+	ctdb_req_control_db_pull(&request, pulldb);
+	ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
+				  &request, &reply);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR,
+		      ("Control DB_PULL failed to node %u, ret=%d\n",
+		       destnode, ret));
+		return ret;
+	}
+
+	ret = ctdb_reply_control_db_pull(reply, num_records);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR, ("Control DB_PULL failed, ret=%d\n", ret));
+		return ret;
+	}
+
+	return 0;
+}
+
+int ctdb_ctrl_db_push_start(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+			    struct ctdb_client_context *client,
+			    int destnode, struct timeval timeout,
+			    struct ctdb_pulldb_ext *pulldb)
+{
+	struct ctdb_req_control request;
+	struct ctdb_reply_control *reply;
+	int ret;
+
+	ctdb_req_control_db_push_start(&request, pulldb);
+	ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
+				  &request, &reply);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR,
+		      ("Control DB_PUSH failed to node %u, ret=%d\n",
+		       destnode, ret));
+		return ret;
+	}
+
+	ret = ctdb_reply_control_db_push_start(reply);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR,
+		      ("Control DB_PUSH failed, ret=%d\n", ret));
+		return ret;
+	}
+
+	return 0;
+}
+
+int ctdb_ctrl_db_push_confirm(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
+			      struct ctdb_client_context *client,
+			      int destnode, struct timeval timeout,
+			      uint32_t db_id, uint32_t *num_records)
+{
+	struct ctdb_req_control request;
+	struct ctdb_reply_control *reply;
+	int ret;
+
+	ctdb_req_control_db_push_confirm(&request, db_id);
+	ret = ctdb_client_control(mem_ctx, ev, client, destnode, timeout,
+				  &request, &reply);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR,
+		      ("Control DB_PUSH failed to node %u, ret=%d\n",
+		       destnode, ret));
+		return ret;
+	}
+
+	ret = ctdb_reply_control_db_push_confirm(reply, num_records);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR,
+		      ("Control DB_PUSH failed, ret=%d\n", ret));
+		return ret;
+	}
+
+	return 0;
+}
diff --git a/ctdb/client/client_message.c b/ctdb/client/client_message.c
index d533842..4b378a5 100644
--- a/ctdb/client/client_message.c
+++ b/ctdb/client/client_message.c
@@ -157,6 +157,138 @@ void ctdb_client_req_message(struct ctdb_client_context *client,
 }
 
 /*
+ * Handle multiple nodes
+ */
+
+struct ctdb_client_message_multi_state {
+	uint32_t *pnn_list;
+	int count;
+	int done;
+	int err;
+	int *err_list;
+};
+
+struct message_index_state {
+	struct tevent_req *req;
+	int index;
+};
+
+static void ctdb_client_message_multi_done(struct tevent_req *subreq);
+
+struct tevent_req *ctdb_client_message_multi_send(
+				TALLOC_CTX *mem_ctx,
+				struct tevent_context *ev,
+				struct ctdb_client_context *client,
+				uint32_t *pnn_list, int count,
+				struct ctdb_req_message *message)
+{
+	struct tevent_req *req, *subreq;
+	struct ctdb_client_message_multi_state *state;
+	int i;
+
+	if (pnn_list == NULL || count == 0) {
+		return NULL;
+	}
+
+	req = tevent_req_create(mem_ctx, &state,
+				struct ctdb_client_message_multi_state);
+	if (req == NULL) {
+		return NULL;
+	}
+
+	state->pnn_list = pnn_list;
+	state->count = count;
+	state->done = 0;
+	state->err = 0;
+	state->err_list = talloc_zero_array(state, int, count);
+	if (tevent_req_nomem(state->err_list, req)) {
+		return tevent_req_post(req, ev);
+	}
+
+	for (i=0; i<count; i++) {
+		struct message_index_state *substate;
+
+		subreq = ctdb_client_message_send(state, ev, client,
+						  pnn_list[i], message);
+		if (tevent_req_nomem(subreq, req)) {
+			return tevent_req_post(req, ev);
+		}
+
+		substate = talloc(subreq, struct message_index_state);
+		if (tevent_req_nomem(substate, req)) {
+			return tevent_req_post(req, ev);
+		}
+
+		substate->req = req;
+		substate->index = i;
+
+		tevent_req_set_callback(subreq, ctdb_client_message_multi_done,
+					substate);
+	}
+
+	return req;
+}
+
+static void ctdb_client_message_multi_done(struct tevent_req *subreq)
+{
+	struct message_index_state *substate = tevent_req_callback_data(
+		subreq, struct message_index_state);
+	struct tevent_req *req = substate->req;
+	int idx = substate->index;
+	struct ctdb_client_message_multi_state *state = tevent_req_data(
+		req, struct ctdb_client_message_multi_state);
+	bool status;
+	int ret;
+
+	status = ctdb_client_message_recv(subreq, &ret);
+	TALLOC_FREE(subreq);
+	if (! status) {
+		if (state->err == 0) {
+			state->err = ret;
+			state->err_list[idx] = state->err;
+		}
+	}
+
+	state->done += 1;
+
+	if (state->done == state->count) {
+		tevent_req_done(req);
+	}
+}
+
+bool ctdb_client_message_multi_recv(struct tevent_req *req, int *perr,
+				    TALLOC_CTX *mem_ctx, int **perr_list)
+{
+	struct ctdb_client_message_multi_state *state = tevent_req_data(
+		req, struct ctdb_client_message_multi_state);
+	int err;
+
+	if (tevent_req_is_unix_error(req, &err)) {
+		if (perr != NULL) {
+			*perr = err;
+		}
+		if (perr_list != NULL) {
+			*perr_list = talloc_steal(mem_ctx, state->err_list);
+		}
+		return false;
+	}
+
+	if (perr != NULL) {
+		*perr = state->err;
+	}
+
+	if (perr_list != NULL) {
+		*perr_list = talloc_steal(mem_ctx, state->err_list);
+	}
+
+	if (state->err != 0) {
+		return false;
+	}
+
+	return true;
+}
+
+/*
  * sync version of message send
  */
 
diff --git a/ctdb/doc/ctdb-tunables.7.xml b/ctdb/doc/ctdb-tunables.7.xml
index 591dcf5..d2d2616 100644
--- a/ctdb/doc/ctdb-tunables.7.xml
+++ b/ctdb/doc/ctdb-tunables.7.xml
@@ -394,6 +394,16 @@
     </refsect2>
 
     <refsect2>
+      <title>RecBufferSizeLimit</title>
+      <para>Default: 1000000</para>
+      <para>
+        This is the limit on the size of the record buffer to be sent
+        in various controls.  This limit is used by new controls used
+        for recovery and controls used in vacuuming.
+      </para>
+    </refsect2>
+
+    <refsect2>
       <title>RecdFailCount</title>
       <para>Default: 10</para>
       <para>
diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index b7c3e5d..04574fe 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -437,6 +437,9 @@ struct ctdb_db_context {
 	bool freeze_transaction_started;
 	uint32_t freeze_transaction_id;
 	uint32_t generation;
+
+	bool push_started;
+	void *push_state;
 };
 
 
@@ -873,6 +876,14 @@ int32_t ctdb_control_pull_db(struct ctdb_context *ctdb, TDB_DATA indata,
 			     TDB_DATA *outdata);
 int32_t ctdb_control_push_db(struct ctdb_context *ctdb, TDB_DATA indata);
 
+int32_t ctdb_control_db_pull(struct ctdb_context *ctdb,
+			     struct ctdb_req_control_old *c,
+			     TDB_DATA indata, TDB_DATA *outdata);
+int32_t ctdb_control_db_push_start(struct ctdb_context *ctdb,
+				   TDB_DATA indata);
+int32_t ctdb_control_db_push_confirm(struct ctdb_context *ctdb,
+				     TDB_DATA indata, TDB_DATA *outdata);
+
 int ctdb_deferred_drop_all_ips(struct ctdb_context *ctdb);
 
 int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
diff --git a/ctdb/protocol/protocol.h b/ctdb/protocol/protocol.h
index a4685d6..3914c69 100644
--- a/ctdb/protocol/protocol.h
+++ b/ctdb/protocol/protocol.h
@@ -121,6 +121,12 @@ struct ctdb_call {
 /* SRVID prefix used by CTDB */
 #define CTDB_SRVID_PREFIX	0xF000000000000000LL
 
+/* SRVID prefix used during recovery for pulling and pushing databases */
+#define CTDB_SRVID_RECOVERY	0xF001000000000000LL
+
+/* SRVID to assign of banning credits */
+#define CTDB_SRVID_BANNING	0xF002000000000000LL
+
 /* SRVID to inform of election data */
 #define CTDB_SRVID_ELECTION	0xF100000000000000LL
 
@@ -355,6 +361,9 @@ enum ctdb_controls {CTDB_CONTROL_PROCESS_EXISTS          = 0,
 		    CTDB_CONTROL_DB_TRANSACTION_START    = 143,
 		    CTDB_CONTROL_DB_TRANSACTION_COMMIT   = 144,
 		    CTDB_CONTROL_DB_TRANSACTION_CANCEL	 = 145,
+		    CTDB_CONTROL_DB_PULL                 = 146,
+		    CTDB_CONTROL_DB_PUSH_START           = 147,
+		    CTDB_CONTROL_DB_PUSH_CONFIRM         = 148,
 };
 
 #define CTDB_MONITORING_ACTIVE		0
@@ -457,6 +466,12 @@ struct ctdb_pulldb {
 	uint32_t lmaster;
 };
 
+struct ctdb_pulldb_ext {
+	uint32_t db_id;
+	uint32_t lmaster;
+	uint64_t srvid;
+};
+
 #define CTDB_RECOVERY_NORMAL		0
 #define CTDB_RECOVERY_ACTIVE		1
 
@@ -619,6 +634,7 @@ struct ctdb_tunable_list {
 	uint32_t samba3_hack;
 	uint32_t mutex_enabled;
 	uint32_t lock_processes_per_db;
+	uint32_t rec_buffer_size_limit;
 };
 
 struct ctdb_tickle_list {
@@ -703,8 +719,10 @@ struct ctdb_public_ip_list {
  * Node features
  */
 #define CTDB_CAP_PARALLEL_RECOVERY	0x00010000
+#define CTDB_CAP_FRAGMENTED_CONTROLS	0x00020000
 
-#define CTDB_CAP_FEATURES		(CTDB_CAP_PARALLEL_RECOVERY)
+#define CTDB_CAP_FEATURES		(CTDB_CAP_PARALLEL_RECOVERY | \
+					 CTDB_CAP_FRAGMENTED_CONTROLS)
 
 #define CTDB_CAP_DEFAULT		(CTDB_CAP_RECMASTER | \
 					 CTDB_CAP_LMASTER   | \
@@ -854,6 +872,7 @@ struct ctdb_req_control_data {
 		struct ctdb_vnn_map *vnnmap;
 		uint32_t loglevel;
 		struct ctdb_pulldb *pulldb;
+		struct ctdb_pulldb_ext *pulldb_ext;
 		struct ctdb_rec_buffer *recbuf;
 		uint32_t recmode;
 		const char *db_name;
@@ -922,6 +941,7 @@ struct ctdb_reply_control_data {
 		struct ctdb_uint8_array *u8_array;
 		struct ctdb_db_statistics *dbstats;
 		enum ctdb_runstate runstate;
+		uint32_t num_records;
 	} data;
 };
 
@@ -975,7 +995,7 @@ union ctdb_message_data {
 	uint32_t db_id;
 	/* SRVID_MEM_DUMP, SRVID_TAKEOVER_RUN */
 	struct ctdb_srvid_message *msg;
-	/* SRVID_REBALANCE_NODE */
+	/* SRVID_BANNING, SRVID_REBALANCE_NODE */
 	uint32_t pnn;
 	/* SRVID_DISABLE_TAKEOVER_RUNS, SRVID_DISABLE_RECOVERIES */
 	struct ctdb_disable_message *disable;
diff --git a/ctdb/protocol/protocol_api.h b/ctdb/protocol/protocol_api.h
index 8fa74e1..40753a9 100644
--- a/ctdb/protocol/protocol_api.h
+++ b/ctdb/protocol/protocol_api.h
@@ -52,6 +52,10 @@ int ctdb_rec_buffer_traverse(struct ctdb_rec_buffer *recbuf,
 			     ctdb_rec_parser_func_t func,
 			     void *private_data);
 
+int ctdb_rec_buffer_write(struct ctdb_rec_buffer *recbuf, int fd);
+int ctdb_rec_buffer_read(int fd, TALLOC_CTX *mem_ctx,
+			 struct ctdb_rec_buffer **out);
+
 size_t ctdb_server_id_len(struct ctdb_server_id *sid);
 void ctdb_server_id_push(struct ctdb_server_id *sid, uint8_t *buf);
 int ctdb_server_id_pull(uint8_t *buf, size_t buflen,
@@ -630,6 +634,20 @@ void ctdb_req_control_db_transaction_cancel(struct ctdb_req_control *request,
 					    uint32_t db_id);
 int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control *reply);
 
+void ctdb_req_control_db_pull(struct ctdb_req_control *request,
+			      struct ctdb_pulldb_ext *pulldb_ext);
+int ctdb_reply_control_db_pull(struct ctdb_reply_control *reply,
+			       uint32_t *num_records);
+
+void ctdb_req_control_db_push_start(struct ctdb_req_control *request,
+				    struct ctdb_pulldb_ext *pulldb_ext);
+int ctdb_reply_control_db_push_start(struct ctdb_reply_control *reply);
+
+void ctdb_req_control_db_push_confirm(struct ctdb_req_control *request,
+				      uint32_t db_id);
+int ctdb_reply_control_db_push_confirm(struct ctdb_reply_control *reply,
+				       uint32_t *num_records);
+
 /* From protocol/protocol_debug.c */
 
 void ctdb_packet_print(uint8_t *buf, size_t buflen, FILE *fp);
diff --git a/ctdb/protocol/protocol_client.c b/ctdb/protocol/protocol_client.c
index 7c983b8..6466fca 100644
--- a/ctdb/protocol/protocol_client.c
+++ b/ctdb/protocol/protocol_client.c
@@ -2448,3 +2448,73 @@ int ctdb_reply_control_db_transaction_cancel(struct ctdb_reply_control *reply)
 {
 	return ctdb_reply_control_generic(reply);
 }
+
+/* CTDB_CONTROL_DB_PULL */
+
+void ctdb_req_control_db_pull(struct ctdb_req_control *request,
+			      struct ctdb_pulldb_ext *pulldb_ext)
+{
+	request->opcode = CTDB_CONTROL_DB_PULL;
+	request->pad = 0;
+	request->srvid = 0;
+	request->client_id = 0;
+	request->flags = 0;
+
+	request->rdata.opcode = CTDB_CONTROL_DB_PULL;
+	request->rdata.data.pulldb_ext = pulldb_ext;
+}
+
+int ctdb_reply_control_db_pull(struct ctdb_reply_control *reply,
+			       uint32_t *num_records)
+{
+	if (reply->status == 0 &&
+	    reply->rdata.opcode == CTDB_CONTROL_DB_PULL) {
+		*num_records = reply->rdata.data.num_records;
+	}
+	return reply->status;
+}
+
+/* CTDB_CONTROL_DB_PUSH_START */
+
+void ctdb_req_control_db_push_start(struct ctdb_req_control *request,
+				    struct ctdb_pulldb_ext *pulldb_ext)
+{
+	request->opcode = CTDB_CONTROL_DB_PUSH_START;
+	request->pad = 0;
+	request->srvid = 0;
+	request->client_id = 0;
+	request->flags = 0;
+
+	request->rdata.opcode = CTDB_CONTROL_DB_PUSH_START;
+	request->rdata.data.pulldb_ext = pulldb_ext;
+}
+


-- 
Samba Shared Repository



More information about the samba-cvs mailing list