- use a CTDB_BROADCAST_ALL for the attach message so it goes to currently disconnecte...
authorAndrew Tridgell <tridge@samba.org>
Wed, 30 May 2007 04:35:22 +0000 (14:35 +1000)
committerAndrew Tridgell <tridge@samba.org>
Wed, 30 May 2007 04:35:22 +0000 (14:35 +1000)
- start node monitoring only after transport starts
- check if a node is already disconnected in the node dead function

(This used to be ctdb commit b81ab6d507797282237768380c6f0e5a4c6519a5)

ctdb/common/ctdb.c
ctdb/common/ctdb_daemon.c
ctdb/common/ctdb_ltdb.c

index b7949f75e52531207d60eaf7805f6ead6445e263..3ceeaeb2a93d41619782937d2fd8fc8440c4ce6f 100644 (file)
@@ -371,6 +371,12 @@ static void ctdb_recv_pkt(struct ctdb_context *ctdb, uint8_t *data, uint32_t len
 */
 void ctdb_node_dead(struct ctdb_node *node)
 {
+       if (!(node->flags & NODE_FLAGS_CONNECTED)) {
+               DEBUG(1,("%s: node %s is already marked disconnected: %u connected\n", 
+                        node->ctdb->name, node->name, 
+                        node->ctdb->num_connected));
+               return;
+       }
        node->ctdb->num_connected--;
        node->flags &= ~NODE_FLAGS_CONNECTED;
        node->rx_cnt = 0;
@@ -385,6 +391,12 @@ void ctdb_node_dead(struct ctdb_node *node)
 */
 void ctdb_node_connected(struct ctdb_node *node)
 {
+       if (node->flags & NODE_FLAGS_CONNECTED) {
+               DEBUG(1,("%s: node %s is already marked connected: %u connected\n", 
+                        node->ctdb->name, node->name, 
+                        node->ctdb->num_connected));
+               return;
+       }
        node->ctdb->num_connected++;
        node->dead_count = 0;
        node->flags |= NODE_FLAGS_CONNECTED;
index 1ffd70f61fe23e823c6d03cb95a5c19d87d61cf9..a8339bb7fec0168b012a1e4ce1e638152b132d3c 100644 (file)
@@ -50,6 +50,9 @@ static void ctdb_start_transport(struct ctdb_context *ctdb, int status)
                DEBUG(0,("Failed to start recovery daemon\n"));
                exit(11);
        }
+
+       /* start monitoring for dead nodes */
+       ctdb_start_monitoring(ctdb);
 }
 
 /* go into main ctdb loop */
@@ -772,9 +775,6 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
 
        ctdb->ev = event_context_init(NULL);
 
-       /* start monitoring for dead nodes */
-       ctdb_start_monitoring(ctdb);
-
        /* start frozen, then let the first election sort things out */
        if (!ctdb_blocking_freeze(ctdb)) {
                DEBUG(0,("Failed to get initial freeze\n"));
index 0347c46ae62a4f111c3ec2732d5fe70eba9f0397..8d87bd24f0af25c860a302f1bd50dcd8a0717bee 100644 (file)
@@ -425,7 +425,7 @@ int32_t ctdb_control_db_attach(struct ctdb_context *ctdb, TDB_DATA indata,
        }
        
        /* tell all the other nodes about this database */
-       ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_VNNMAP, 0,
+       ctdb_daemon_send_control(ctdb, CTDB_BROADCAST_ALL, 0,
                                 CTDB_CONTROL_DB_ATTACH, 0, CTDB_CTRL_FLAG_NOREPLY,
                                 indata, NULL, NULL);