ctdb-tools: Fix spurious messages about deleted nodes being disconnected
authorMartin Schwenke <martin@meltin.net>
Wed, 1 Apr 2015 06:10:46 +0000 (17:10 +1100)
committerAmitay Isaacs <amitay@samba.org>
Tue, 7 Apr 2015 05:43:12 +0000 (07:43 +0200)
The code was too "clever".  The 4 different cases should be separate.
The "node remains deleted" case doesn't need the IP address comparison
(always 0.0.0.0) or the disconnected check.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tools/ctdb.c

index 2331ead7bdbcfb068be6987ef4fdcfa4049f7730..2c906a5423ea096c2769d4107edaa6cbeff291e8 100644 (file)
@@ -6279,8 +6279,15 @@ static bool sanity_check_nodes_file_changes(TALLOC_CTX *mem_ctx,
                        should_abort = true;
                        continue;
                }
-               if ((nodemap->nodes[i].flags & NODE_FLAGS_DELETED) ==
-                   (file_nodemap->nodes[i].flags & NODE_FLAGS_DELETED)) {
+               if (nodemap->nodes[i].flags & NODE_FLAGS_DELETED &&
+                   file_nodemap->nodes[i].flags & NODE_FLAGS_DELETED) {
+                       /* Node remains deleted */
+                       DEBUG(DEBUG_INFO,
+                             ("Node %u is unchanged (DELETED)\n",
+                              nodemap->nodes[i].pnn));
+               } else if (!(nodemap->nodes[i].flags & NODE_FLAGS_DELETED) &&
+                          !(file_nodemap->nodes[i].flags & NODE_FLAGS_DELETED)) {
+                       /* Node not newly nor previously deleted */
                        if (!ctdb_same_ip(&nodemap->nodes[i].addr,
                                          &file_nodemap->nodes[i].addr)) {
                                DEBUG(DEBUG_ERR,
@@ -6301,9 +6308,8 @@ static bool sanity_check_nodes_file_changes(TALLOC_CTX *mem_ctx,
                                               nodemap->nodes[i].pnn));
                                }
                        }
-                       continue;
-               }
-               if (file_nodemap->nodes[i].flags & NODE_FLAGS_DELETED) {
+               } else if (file_nodemap->nodes[i].flags & NODE_FLAGS_DELETED) {
+                       /* Node is being deleted */
                        DEBUG(DEBUG_NOTICE,
                              ("Node %u is DELETED\n",
                               nodemap->nodes[i].pnn));
@@ -6315,6 +6321,7 @@ static bool sanity_check_nodes_file_changes(TALLOC_CTX *mem_ctx,
                                should_abort = true;
                        }
                } else if (nodemap->nodes[i].flags & NODE_FLAGS_DELETED) {
+                       /* Node was previously deleted */
                        DEBUG(DEBUG_NOTICE,
                              ("Node %u is UNDELETED\n", nodemap->nodes[i].pnn));
                        have_changes = true;