messaging: Always register CTDB_SRVID_SAMBA_PROCESS
authorVolker Lendecke <vl@samba.org>
Tue, 25 Jul 2017 15:10:27 +0000 (17:10 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 4 Dec 2017 23:56:12 +0000 (00:56 +0100)
This will be used to broadcast to all processes, avoiding the costly
traverse of serverid.tdb.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/include/ctdb_srvids.h
source3/lib/messages_ctdb.c

index 500b5069e67d9ab9cb32cad3160c7f8171e00a5c..b51a458506059c3de7bd41f515998227200a4aba 100644 (file)
@@ -38,3 +38,9 @@
  * locally according to the non-clustered local notify.tdb
  */
 #define CTDB_SRVID_SAMBA_NOTIFY_PROXY  0xFE00000000000001LL
+
+/*
+ * SRVID for all processes that come from Samba. Used to be
+ * MSG_SRVID_SAMBA in the past. Now used for message_send_all.
+ */
+#define CTDB_SRVID_SAMBA_PROCESS  0xFE00000000000002LL
index a2a7c215f2346aac7af9d09e85185963ddcb2a48..66b9f55d256d580cb6e4328ca2b3ded788dfede2 100644 (file)
@@ -26,6 +26,7 @@
 #include "lib/messages_util.h"
 #include "ctdbd_conn.h"
 #include "lib/cluster_support.h"
+#include "ctdb_srvids.h"
 
 struct messaging_ctdb_context;
 
@@ -111,6 +112,14 @@ int messaging_ctdb_init(const char *sockname, int timeout, uint64_t unique_id,
                goto fail;
        }
 
+       ret = register_with_ctdbd(ctx->conn, CTDB_SRVID_SAMBA_PROCESS,
+                                 messaging_ctdb_recv, ctx);
+       if (ret != 0) {
+               DBG_DEBUG("register_with_ctdbd returned %s (%d)\n",
+                         strerror(ret), ret);
+               goto fail;
+       }
+
        ret = register_with_ctdbd(ctx->conn, unique_id, NULL, NULL);
        if (ret != 0) {
                DBG_DEBUG("register_with_ctdbd returned %s (%d)\n",