ctdb-recoverd: Push flags for a node if any remote node disagrees
authorMartin Schwenke <martin@meltin.net>
Sun, 11 Jul 2021 12:17:08 +0000 (22:17 +1000)
committerJule Anger <janger@samba.org>
Mon, 13 Sep 2021 11:47:10 +0000 (11:47 +0000)
This will usually happen if flags on the node in question change, so
keeping the code simple and pushing to all nodes won't hurt.  When all
nodes come up there might be differences in connected nodes, causing
such "fix ups".  Receiving nodes will ignore no-op pushes.

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>
(cherry picked from commit 8305f6a7f132f03b0bbdb26692b7491fd3f6c24f)

ctdb/server/ctdb_recoverd.c

index c6efd6e362ea0d3304b955e2dba816a5fa43755a..79f4cb03b0f10f19ffd1501ac168022ffaa37226 100644 (file)
@@ -555,13 +555,20 @@ static int update_flags(struct ctdb_recoverd *rec,
                uint32_t local_flags = nodemap->nodes[j].flags;
                uint32_t remote_pnn = nodemap->nodes[j].pnn;
                uint32_t remote_flags;
+               unsigned int i;
                int ret;
 
                if (local_flags & NODE_FLAGS_DISCONNECTED) {
                        continue;
                }
                if (remote_pnn == ctdb->pnn) {
-                       continue;
+                       /*
+                        * No remote nodemap for this node since this
+                        * is the local nodemap.  However, still need
+                        * to check this against the remote nodes and
+                        * push it if they are out-of-date.
+                        */
+                       goto compare_remotes;
                }
 
                remote_nodemap = remote_nodemaps[j];
@@ -582,6 +589,26 @@ static int update_flags(struct ctdb_recoverd *rec,
                        goto push;
                }
 
+compare_remotes:
+               for (i = 0; i < nodemap->num; i++) {
+                       if (i == j) {
+                               continue;
+                       }
+                       if (nodemap->nodes[i].flags & NODE_FLAGS_DISCONNECTED) {
+                               continue;
+                       }
+                       if (nodemap->nodes[i].pnn == ctdb->pnn) {
+                               continue;
+                       }
+
+                       remote_nodemap = remote_nodemaps[i];
+                       remote_flags = remote_nodemap->nodes[j].flags;
+
+                       if (local_flags != remote_flags) {
+                               goto push;
+                       }
+               }
+
                continue;
 
 push: