[SCM] CTDB repository - branch master updated - ctdb-1.10-419-g8d89bfd

Ronnie Sahlberg sahlberg at samba.org
Mon Aug 22 21:02:09 MDT 2011


The branch, master has been updated
       via  8d89bfdfd1f55dfeb22890b8bb0f08f31d1fa91a (commit)
      from  e25559087c9752502580875f7e33f3c416c05f84 (commit)

http://gitweb.samba.org/?p=ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 8d89bfdfd1f55dfeb22890b8bb0f08f31d1fa91a
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue Aug 23 12:43:16 2011 +1000

    LibCTDB: add commands where an application can query how many commands are active
    and we have not yet received a reply to.
    Applications may use this command to query if it is "safe" to stop the event system and sleep
    or whether it should first wait for all activity to ctdb daemons to cease first.

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

Summary of changes:
 include/ctdb.h |   39 +++++++++++++++++++++++++++++++++++++++
 libctdb/ctdb.c |   29 +++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/ctdb.h b/include/ctdb.h
index fad3233..ae62a17 100644
--- a/include/ctdb.h
+++ b/include/ctdb.h
@@ -116,6 +116,45 @@ void ctdb_disconnect(struct ctdb_connection *ctdb);
  ***/
 
 /**
+ * ctdb_num_active - get the number of active commands
+ * @ctdb: the ctdb_connection from ctdb_connect.
+ *
+ * This command can be used to find the number of active commands we have
+ * issued. An active command is a command we have queued, or sent
+ * to the ctdb daemon but which we have not yet received a reply to.
+ *
+ * See Also:
+ *	ctdb_num_in_flight(), ctdb_num_out_queue()
+ */
+int ctdb_num_active(struct ctdb_connection *ctdb);
+
+/**
+ * ctdb_num_in_flight - get the number of commands in flight.
+ * @ctdb: the ctdb_connection from ctdb_connect.
+ *
+ * This command can be used to find the number of commands we have
+ * sent to the ctdb daemon to which we have not yet received/processed
+ * the reply.
+ *
+ * See Also:
+ *	ctdb_num_out_queue(), ctdb_num_active()
+ */
+int ctdb_num_in_flight(struct ctdb_connection *ctdb);
+
+/**
+ * ctdb_num_out_queue - get the number of commands in the out queue
+ * @ctdb: the ctdb_connection from ctdb_connect.
+ *
+ * This command can be used to find the number of commands we have
+ * queued for delivery to the ctdb daemon but have not yet been
+ * written to the domain socket.
+ *
+ * See Also:
+ *	ctdb_num_in_flight(), ctdb_num_active()
+ */
+int ctdb_num_out_queue(struct ctdb_connection *ctdb);
+
+/**
  * ctdb_get_fd - get the filedescriptor to select/poll on
  * @ctdb: the ctdb_connection from ctdb_connect.
  *
diff --git a/libctdb/ctdb.c b/libctdb/ctdb.c
index e407910..d51f4a1 100644
--- a/libctdb/ctdb.c
+++ b/libctdb/ctdb.c
@@ -1133,3 +1133,32 @@ bool ctdb_traverse_async(struct ctdb_db *ctdb_db,
 
 	return true;
 }
+
+int ctdb_num_out_queue(struct ctdb_connection *ctdb)
+{
+	struct ctdb_request *req;
+	int i;
+
+	for (i = 0, req = ctdb->outq; req; req = req->next, i++)
+		;
+
+	return i;
+}
+
+int ctdb_num_in_flight(struct ctdb_connection *ctdb)
+{
+	struct ctdb_request *req;
+	int i;
+
+	for (i = 0, req = ctdb->doneq; req; req = req->next, i++)
+		;
+
+	return i;
+}
+
+int ctdb_num_active(struct ctdb_connection *ctdb)
+{
+	return ctdb_num_out_queue(ctdb)
+		 + ctdb_num_in_flight(ctdb);
+}
+


-- 
CTDB repository


More information about the samba-cvs mailing list