[SCM] CTDB repository - branch libctdb updated - ctdb-1.0.114-115-gd3a2827

Ronnie Sahlberg sahlberg at samba.org
Mon May 17 20:48:04 MDT 2010


The branch, libctdb has been updated
       via  d3a2827be3277cd1cd3c4d10c2d3035decc2bcfd (commit)
       via  43dfb4db16f695cdddf55a4b1895597e3395f780 (commit)
      from  029675b432cb455e466bca723db0dc90fdbf54b5 (commit)

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


- Log -----------------------------------------------------------------
commit d3a2827be3277cd1cd3c4d10c2d3035decc2bcfd
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue May 18 12:46:00 2010 +1000

    move the definition of server/message id port values to the public ctdb.h header
    
    change tst.c example to use message id ports from the range reserved for test purposes

commit 43dfb4db16f695cdddf55a4b1895597e3395f780
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Tue May 18 12:41:13 2010 +1000

    create macros that define that all server ids for messaging where
    the top 32 bits are all zero are reserved for samba
    
    allocate the prefix 0x00000001 for test purposes

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

Summary of changes:
 include/ctdb.h          |   93 +++++++++++++++++++++++++++++++++++++++++++++++
 include/ctdb_protocol.h |   70 -----------------------------------
 libctdb/tst.c           |    6 ++--
 3 files changed, 96 insertions(+), 73 deletions(-)


Changeset truncated at 500 lines:

diff --git a/include/ctdb.h b/include/ctdb.h
index 6e07a10..c9ca36a 100644
--- a/include/ctdb.h
+++ b/include/ctdb.h
@@ -145,6 +145,99 @@ int ctdb_writerecord(ctdb_handle *handle,
 
 
 /*
+   Messaging serverid ports
+*/
+/* 
+   a message handler ID meaning "give me all messages"
+ */
+#define CTDB_SRVID_ALL (~(uint64_t)0)
+
+/*
+   The top 32 bits of the server id represents the owner of
+   this part of the srvid space
+*/
+#define CTDB_SRVID_MASK	0xFFFFFFFF00000000LL
+
+
+/*
+   Samba owns all message handler IDs where the top 32 bits are all zero
+*/
+#define CTDB_SRVID_SAMBA	0x0000000000000000
+#define CTDB_IS_SAMBA_SRVID	((srvid & CTDB_SRVID_MASK) == CTDB_SRVID_SAMBA)
+
+/*
+   Server ids reserved for testing 
+*/
+#define CTDB_SRVID_TEST		0x0000000100000000
+#define CTDB_IS_TEST_SRVID	((srvid & CTDB_SRVID_MASK) == CTDB_SRVID_TEST)
+
+/*
+  srvid type : RECOVERY
+*/
+#define CTDB_SRVID_RECOVERY	0xF100000000000000LL
+
+/* 
+   a message handler ID meaning that the cluster has been reconfigured
+ */
+#define CTDB_SRVID_RECONFIGURE 0xF200000000000000LL
+
+/* 
+   a message handler ID meaning that an IP address has been released
+ */
+#define CTDB_SRVID_RELEASE_IP 0xF300000000000000LL
+
+/* 
+   a message ID to set the node flags in the recovery daemon
+ */
+#define CTDB_SRVID_SET_NODE_FLAGS 0xF400000000000000LL
+
+/* 
+   a message ID to ask the recovery daemon to update the expected node
+   assignment for a public ip
+ */
+#define CTDB_SRVID_RECD_UPDATE_IP 0xF500000000000000LL
+
+/*
+  a message to tell the recovery daemon to fetch a set of records
+ */
+#define CTDB_SRVID_VACUUM_FETCH 0xF700000000000000LL
+
+/*
+  a message to tell the recovery daemon to write a talloc memdump
+  to the log
+ */
+#define CTDB_SRVID_MEM_DUMP 0xF800000000000000LL
+
+/* 
+   a message ID to get the recovery daemon to push the node flags out
+ */
+#define CTDB_SRVID_PUSH_NODE_FLAGS 0xF900000000000000LL
+
+/* 
+   a message ID to get the recovery daemon to reload the nodes file
+ */
+#define CTDB_SRVID_RELOAD_NODES 0xFA00000000000000LL
+
+/* 
+   a message ID to get the recovery daemon to perform a takeover run
+ */
+#define CTDB_SRVID_TAKEOVER_RUN 0xFB00000000000000LL
+
+/* A message id to ask the recovery daemon to temporarily disable the
+   public ip checks
+*/
+#define CTDB_SRVID_DISABLE_IP_CHECK  0xFC00000000000000LL
+
+/* A dummy port used for sending back ipreallocate resposnes to the main
+   daemon
+*/
+#define CTDB_SRVID_TAKEOVER_RUN_RESPONSE  0xFD00000000000000LL
+
+/* A port reserved for samba (top 32 bits)
+ */
+#define CTDB_SRVID_SAMBA_NOTIFY  0xFE00000000000000LL
+
+/*
  * messaging functions
  * these functions provide a messaging layer for applications to communicate
  * with eachother across
diff --git a/include/ctdb_protocol.h b/include/ctdb_protocol.h
index 8eda5d4..bb72577 100644
--- a/include/ctdb_protocol.h
+++ b/include/ctdb_protocol.h
@@ -50,76 +50,6 @@ struct ctdb_call_info {
 */
 #define CTDB_FLAG_TORTURE      (1<<1)
 
-/* 
-   a message handler ID meaning "give me all messages"
- */
-#define CTDB_SRVID_ALL (~(uint64_t)0)
-
-/*
-  srvid type : RECOVERY
-*/
-#define CTDB_SRVID_RECOVERY	0xF100000000000000LL
-
-/* 
-   a message handler ID meaning that the cluster has been reconfigured
- */
-#define CTDB_SRVID_RECONFIGURE 0xF200000000000000LL
-
-/* 
-   a message handler ID meaning that an IP address has been released
- */
-#define CTDB_SRVID_RELEASE_IP 0xF300000000000000LL
-
-/* 
-   a message ID to set the node flags in the recovery daemon
- */
-#define CTDB_SRVID_SET_NODE_FLAGS 0xF400000000000000LL
-
-/* 
-   a message ID to ask the recovery daemon to update the expected node
-   assignment for a public ip
- */
-#define CTDB_SRVID_RECD_UPDATE_IP 0xF500000000000000LL
-
-/*
-  a message to tell the recovery daemon to fetch a set of records
- */
-#define CTDB_SRVID_VACUUM_FETCH 0xF700000000000000LL
-
-/*
-  a message to tell the recovery daemon to write a talloc memdump
-  to the log
- */
-#define CTDB_SRVID_MEM_DUMP 0xF800000000000000LL
-
-/* 
-   a message ID to get the recovery daemon to push the node flags out
- */
-#define CTDB_SRVID_PUSH_NODE_FLAGS 0xF900000000000000LL
-
-/* 
-   a message ID to get the recovery daemon to reload the nodes file
- */
-#define CTDB_SRVID_RELOAD_NODES 0xFA00000000000000LL
-
-/* 
-   a message ID to get the recovery daemon to perform a takeover run
- */
-#define CTDB_SRVID_TAKEOVER_RUN 0xFB00000000000000LL
-
-/* A message id to ask the recovery daemon to temporarily disable the
-   public ip checks
-*/
-#define CTDB_SRVID_DISABLE_IP_CHECK  0xFC00000000000000LL
-
-/* A dummy port used for sending back ipreallocate resposnes to the main
-   daemon
-*/
-#define CTDB_SRVID_TAKEOVER_RUN_RESPONSE  0xFD00000000000000LL
-
-/* A port reserved for samba (top 32 bits)
- */
-#define CTDB_SRVID_SAMBA_NOTIFY  0xFE00000000000000LL
 
 
 /* the key used for transaction locking on persistent databases */
diff --git a/libctdb/tst.c b/libctdb/tst.c
index ca968a4..abedd20 100644
--- a/libctdb/tst.c
+++ b/libctdb/tst.c
@@ -11,7 +11,7 @@ TDB_DATA key;
 
 void msg_h(struct ctdb_context *ctdb, uint64_t srvid, TDB_DATA data, void *private_data)
 {
-	printf("Message received on port %d : %s\n", (int)srvid, data.dptr);
+	printf("Message received on port 0x%016llx : %s\n", srvid, data.dptr);
 }
 
 
@@ -109,7 +109,7 @@ int main(int argc, char *argv[])
 
 	ctdb = ctdb_connect("/tmp/ctdb.socket");
 
-	handle = ctdb_set_message_handler_send(ctdb, 55, NULL, msg_h, NULL);
+	handle = ctdb_set_message_handler_send(ctdb, CTDB_SRVID_TEST|55, NULL, msg_h, NULL);
 	if (handle == NULL) {
 		printf("Failed to register message port\n");
 		exit(10);
@@ -123,7 +123,7 @@ int main(int argc, char *argv[])
 	msg.dptr="HelloWorld";
 	msg.dsize = strlen(msg.dptr);
 
-	ret = ctdb_send_message(ctdb, 0, 55, msg);
+	ret = ctdb_send_message(ctdb, 0, CTDB_SRVID_TEST|55, msg);
 	if (ret != 0) {
 		printf("Failed to send message. Aborting\n");
 		exit(10);


-- 
CTDB repository


More information about the samba-cvs mailing list