[SCM] Samba Shared Repository - branch master updated

Amitay Isaacs amitay at samba.org
Tue Aug 20 08:33:02 UTC 2019


The branch, master has been updated
       via  e9f2e205ee8 ctdb-daemon: Make node inactive in the NODE_STOP control
       via  91ac4c13d84 ctdb-daemon: Drop unused function ctdb_local_node_got_banned()
       via  0f5f7b7cf4e ctdb-daemon: Switch banning code to use ctdb_node_become_inactive()
       via  a42bcaabb63 ctdb-daemon: Factor out new function ctdb_node_become_inactive()
      from  f8e79be2c15 build: fix mandatory typo in zlib configure check

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit e9f2e205ee89f4f3d6302cc11b4d0eb2efaf0f53
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Aug 19 21:48:04 2019 +1000

    ctdb-daemon: Make node inactive in the NODE_STOP control
    
    Currently some of this is supported by a periodic check in the
    recovery daemon's main_loop(), which notices the flag change, sets
    recovery mode active and freezes databases.  If STOP_NODE returns
    immediately then the associated recovery can complete and the node can
    be continued before databases are actually frozen.
    
    Instead, immediately do all of the things that make a node inactive.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087
    RN: Stop "ctdb stop" from completing before freezing databases
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>
    
    Autobuild-User(master): Amitay Isaacs <amitay at samba.org>
    Autobuild-Date(master): Tue Aug 20 08:32:27 UTC 2019 on sn-devel-184

commit 91ac4c13d8472955d1f04bd775ec4b3ff8bf1b61
Author: Martin Schwenke <martin at meltin.net>
Date:   Tue Aug 20 11:29:42 2019 +1000

    ctdb-daemon: Drop unused function ctdb_local_node_got_banned()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit 0f5f7b7cf4e970f3f36c5e0b3d09e710fe90801a
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Aug 19 21:52:57 2019 +1000

    ctdb-daemon: Switch banning code to use ctdb_node_become_inactive()
    
    There's no reason to avoid immediately setting recovery mode to active
    and initiating freeze of databases.
    
    This effectively reverts the following commits:
    
      d8f3b490bbb691c9916eed0df5b980c1aef23c85
      b4357a79d916b1f8ade8fa78563fbef0ce670aa9
    
    The latter is now implemented using a control, resulting in looser
    coupling.
    
    See also the following commit:
    
      f8141e91a693912ea1107a49320e83702a80757a
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

commit a42bcaabb63722411bee52b80cbfc795593defbc
Author: Martin Schwenke <martin at meltin.net>
Date:   Mon Aug 19 21:47:03 2019 +1000

    ctdb-daemon: Factor out new function ctdb_node_become_inactive()
    
    This is a superset of ctdb_local_node_got_banned() so will replace
    that function, and will also be used in the NODE_STOP control.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087
    
    Signed-off-by: Martin Schwenke <martin at meltin.net>
    Reviewed-by: Amitay Isaacs <amitay at gmail.com>

-----------------------------------------------------------------------

Summary of changes:
 ctdb/include/ctdb_private.h |  3 ++-
 ctdb/server/ctdb_banning.c  | 26 +-------------------------
 ctdb/server/ctdb_recover.c  | 45 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+), 26 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/include/ctdb_private.h b/ctdb/include/ctdb_private.h
index 1e9619faddf..1f168dae2b8 100644
--- a/ctdb/include/ctdb_private.h
+++ b/ctdb/include/ctdb_private.h
@@ -481,7 +481,6 @@ int ctdb_ibw_init(struct ctdb_context *ctdb);
 
 /* from ctdb_banning.c */
 
-void ctdb_local_node_got_banned(struct ctdb_context *ctdb);
 int32_t ctdb_control_set_ban_state(struct ctdb_context *ctdb, TDB_DATA indata);
 int32_t ctdb_control_get_ban_state(struct ctdb_context *ctdb, TDB_DATA *outdata);
 void ctdb_ban_self(struct ctdb_context *ctdb);
@@ -819,6 +818,8 @@ int32_t ctdb_control_recd_ping(struct ctdb_context *ctdb);
 int32_t ctdb_control_set_recmaster(struct ctdb_context *ctdb,
 				   uint32_t opcode, TDB_DATA indata);
 
+void ctdb_node_become_inactive(struct ctdb_context *ctdb);
+
 int32_t ctdb_control_stop_node(struct ctdb_context *ctdb);
 int32_t ctdb_control_continue_node(struct ctdb_context *ctdb);
 
diff --git a/ctdb/server/ctdb_banning.c b/ctdb/server/ctdb_banning.c
index 9cd163645a1..3c711575e8c 100644
--- a/ctdb/server/ctdb_banning.c
+++ b/ctdb/server/ctdb_banning.c
@@ -57,30 +57,6 @@ static void ctdb_ban_node_event(struct tevent_context *ev,
 	}
 }
 
-void ctdb_local_node_got_banned(struct ctdb_context *ctdb)
-{
-	struct ctdb_db_context *ctdb_db;
-
-	DEBUG(DEBUG_NOTICE, ("This node has been banned - releasing all public "
-			     "IPs and setting the generation to INVALID.\n"));
-
-	/* Reset the generation id to 1 to make us ignore any
-	   REQ/REPLY CALL/DMASTER someone sends to us.
-	   We are now banned so we shouldnt service database calls
-	   anymore.
-	*/
-	ctdb->vnn_map->generation = INVALID_GENERATION;
-	for (ctdb_db = ctdb->db_list; ctdb_db != NULL; ctdb_db = ctdb_db->next) {
-		ctdb_db->generation = INVALID_GENERATION;
-	}
-
-	/* Recovery daemon will set the recovery mode ACTIVE and freeze
-	 * databases.
-	 */
-
-	ctdb_release_all_ips(ctdb);
-}
-
 int32_t ctdb_control_set_ban_state(struct ctdb_context *ctdb, TDB_DATA indata)
 {
 	struct ctdb_ban_state *bantime = (struct ctdb_ban_state *)indata.dptr;
@@ -129,7 +105,7 @@ int32_t ctdb_control_set_ban_state(struct ctdb_context *ctdb, TDB_DATA indata)
 			 ctdb_ban_node_event, ctdb);
 
 	if (!already_banned) {
-		ctdb_local_node_got_banned(ctdb);
+		ctdb_node_become_inactive(ctdb);
 	}
 	return 0;
 }
diff --git a/ctdb/server/ctdb_recover.c b/ctdb/server/ctdb_recover.c
index 343728839c1..1654c6d3978 100644
--- a/ctdb/server/ctdb_recover.c
+++ b/ctdb/server/ctdb_recover.c
@@ -1420,12 +1420,57 @@ int32_t ctdb_control_set_recmaster(struct ctdb_context *ctdb, uint32_t opcode, T
 	return 0;
 }
 
+void ctdb_node_become_inactive(struct ctdb_context *ctdb)
+{
+	struct ctdb_db_context *ctdb_db;
+
+	D_WARNING("Making node INACTIVE\n");
+
+	/*
+	 * Do not service database calls - reset generation to invalid
+	 * so this node ignores any REQ/REPLY CALL/DMASTER
+	 */
+	ctdb->vnn_map->generation = INVALID_GENERATION;
+	for (ctdb_db = ctdb->db_list; ctdb_db != NULL; ctdb_db = ctdb_db->next) {
+		ctdb_db->generation = INVALID_GENERATION;
+	}
+
+	/*
+	 * Although this bypasses the control, the only thing missing
+	 * is the deferred drop of all public IPs, which isn't
+	 * necessary because they are dropped below
+	 */
+	if (ctdb->recovery_mode != CTDB_RECOVERY_ACTIVE) {
+		D_NOTICE("Recovery mode set to ACTIVE\n");
+		ctdb->recovery_mode = CTDB_RECOVERY_ACTIVE;
+	}
+
+	/*
+	 * Initiate database freeze - this will be scheduled for
+	 * immediate execution and will be in progress long before the
+	 * calling control returns
+	 */
+	ctdb_daemon_send_control(ctdb,
+				 ctdb->pnn,
+				 0,
+				 CTDB_CONTROL_FREEZE,
+				 0,
+				 CTDB_CTRL_FLAG_NOREPLY,
+				 tdb_null,
+				 NULL,
+				 NULL);
+
+	D_NOTICE("Dropping all public IP addresses\n");
+	ctdb_release_all_ips(ctdb);
+}
 
 int32_t ctdb_control_stop_node(struct ctdb_context *ctdb)
 {
 	DEBUG(DEBUG_ERR, ("Stopping node\n"));
 	ctdb->nodes[ctdb->pnn]->flags |= NODE_FLAGS_STOPPED;
 
+	ctdb_node_become_inactive(ctdb);
+
 	return 0;
 }
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list