ctdb-recoverd: Mark CTDB_SRVID_SET_NODE_FLAGS obsolete
authorMartin Schwenke <martin@meltin.net>
Wed, 17 Jan 2018 08:04:34 +0000 (19:04 +1100)
committerAmitay Isaacs <amitay@samba.org>
Thu, 9 Sep 2021 01:46:49 +0000 (01:46 +0000)
CTDB_SRVID_SET_NODE_FLAGS is no longer sent so drop monitor_handler()
and replace with srvid_not_implemented().  Mark the SRVID obsolete in
its comment.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14784
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/protocol/protocol.h
ctdb/server/ctdb_recoverd.c

index 9fd7f1cdecbb477de9b5214c94184de945c88d96..5f788f6f2a853e06c0ea6a64d542cb05ffad52ad 100644 (file)
@@ -137,7 +137,7 @@ struct ctdb_call {
 /* SRVID to inform clients that an IP address has been taken over */
 #define CTDB_SRVID_TAKE_IP 0xF301000000000000LL
 
-/* SRVID to inform recovery daemon of the node flags */
+/* SRVID to inform recovery daemon of the node flags - OBSOLETE */
 #define CTDB_SRVID_SET_NODE_FLAGS 0xF400000000000000LL
 
 /* SRVID to inform recovery daemon to update public ip assignment */
index 79f4cb03b0f10f19ffd1501ac168022ffaa37226..dfa6d0d089bce39560614bcc6d775fe121679882 100644 (file)
@@ -1781,54 +1781,21 @@ static void force_election(struct ctdb_recoverd *rec, uint32_t pnn,
 }
 
 
-
-/*
-  handler for when a node changes its flags
-*/
-static void monitor_handler(uint64_t srvid, TDB_DATA data, void *private_data)
+static void srvid_not_implemented(uint64_t srvid,
+                                 TDB_DATA data,
+                                 void *private_data)
 {
-       struct ctdb_recoverd *rec = talloc_get_type(
-               private_data, struct ctdb_recoverd);
-       struct ctdb_context *ctdb = rec->ctdb;
-       int ret;
-       struct ctdb_node_flag_change *c = (struct ctdb_node_flag_change *)data.dptr;
-       struct ctdb_node_map_old *nodemap=NULL;
-       TALLOC_CTX *tmp_ctx;
-       unsigned int i;
-
-       if (data.dsize != sizeof(*c)) {
-               DEBUG(DEBUG_ERR,(__location__ "Invalid data in ctdb_node_flag_change\n"));
-               return;
-       }
-
-       tmp_ctx = talloc_new(ctdb);
-       CTDB_NO_MEMORY_VOID(ctdb, tmp_ctx);
+       const char *s;
 
-       ret = ctdb_ctrl_getnodemap(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, tmp_ctx, &nodemap);
-       if (ret != 0) {
-               DEBUG(DEBUG_ERR,(__location__ "ctdb_ctrl_getnodemap failed in monitor_handler\n"));
-               talloc_free(tmp_ctx);
-               return;         
-       }
-
-
-       for (i=0;i<nodemap->num;i++) {
-               if (nodemap->nodes[i].pnn == c->pnn) break;
-       }
-
-       if (i == nodemap->num) {
-               DEBUG(DEBUG_CRIT,(__location__ "Flag change for non-existant node %u\n", c->pnn));
-               talloc_free(tmp_ctx);
-               return;
-       }
-
-       if (c->old_flags != c->new_flags) {
-               DEBUG(DEBUG_NOTICE,("Node %u has changed flags - now 0x%x  was 0x%x\n", c->pnn, c->new_flags, c->old_flags));
+       switch (srvid) {
+       case CTDB_SRVID_SET_NODE_FLAGS:
+               s = "CTDB_SRVID_SET_NODE_FLAGS";
+               break;
+       default:
+               s = "UNKNOWN";
        }
 
-       nodemap->nodes[i].flags = c->new_flags;
-
-       talloc_free(tmp_ctx);
+       D_WARNING("SRVID %s (0x%" PRIx64 ") is obsolete\n", s, srvid);
 }
 
 /*
@@ -2998,8 +2965,10 @@ static void monitor_cluster(struct ctdb_context *ctdb)
        /* register a message port for recovery elections */
        ctdb_client_set_message_handler(ctdb, CTDB_SRVID_ELECTION, election_handler, rec);
 
-       /* when nodes are disabled/enabled */
-       ctdb_client_set_message_handler(ctdb, CTDB_SRVID_SET_NODE_FLAGS, monitor_handler, rec);
+       ctdb_client_set_message_handler(ctdb,
+                                       CTDB_SRVID_SET_NODE_FLAGS,
+                                       srvid_not_implemented,
+                                       rec);
 
        /* when we are asked to puch out a flag change */
        ctdb_client_set_message_handler(ctdb, CTDB_SRVID_PUSH_NODE_FLAGS, push_flags_handler, rec);