[SCM] CTDB repository - branch master updated - 9f501cee9132114e7467a33dab5cfe0737f94f44

Ronnie Sahlberg sahlberg at samba.org
Thu Jun 26 23:36:38 GMT 2008


The branch, master has been updated
       via  9f501cee9132114e7467a33dab5cfe0737f94f44 (commit)
       via  9b8179ad043a80e0e18eeba427a7b7b15690d039 (commit)
       via  4f2d722cf29175c3c207e6ebb6d4f9e370767249 (commit)
       via  a928857e38d645baca62cea7f7367488d140dca7 (commit)
       via  f71287a28d66db202fe52f9a43b6daf2389d7f66 (commit)
       via  9a98a21979558dcd6421b3fcb97d21ab82b792d8 (commit)
       via  251aeadc8b16a9c27a4bae78c97ad6e93e6cfdf4 (commit)
       via  d481f0f3d11e66d259cbc84f34cb6ae27d09e42c (commit)
       via  b8c8c5cb351747863c5d1366b57c96122ade5db0 (commit)
       via  3387597926ad71e4140cc504b828486d99a3ec8e (commit)
       via  b99d687894cb69d863345713055d9c8dc1b29194 (commit)
       via  f15b224e42e81cda84b98f01f919d463e80fb89f (commit)
      from  8734bd32809ad817ad28d96315a139674429c395 (commit)

http://gitweb.samba.org/?p=sahlberg/ctdb.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 9f501cee9132114e7467a33dab5cfe0737f94f44
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Jun 27 09:31:18 2008 +1000

    initdit/ctdb is not a config file

commit 9b8179ad043a80e0e18eeba427a7b7b15690d039
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Fri Jun 27 09:29:38 2008 +1000

    make /etc/ctdb/functions executable and add a hashbang to it so
    rpmlint wont complain

commit 4f2d722cf29175c3c207e6ebb6d4f9e370767249
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Jun 26 14:14:37 2008 +1000

    test

commit a928857e38d645baca62cea7f7367488d140dca7
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Jun 26 14:00:36 2008 +1000

    Revert "test"
    
    This reverts commit f71287a28d66db202fe52f9a43b6daf2389d7f66.

commit f71287a28d66db202fe52f9a43b6daf2389d7f66
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Jun 26 13:51:18 2008 +1000

    test

commit 9a98a21979558dcd6421b3fcb97d21ab82b792d8
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Jun 26 13:15:41 2008 +1000

    reduce loglevel of the info message we are updating the flags on all nodes

commit 251aeadc8b16a9c27a4bae78c97ad6e93e6cfdf4
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Jun 26 13:08:37 2008 +1000

    force an update of the flags from the recmaster after each monitoring run

commit d481f0f3d11e66d259cbc84f34cb6ae27d09e42c
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Jun 26 12:43:30 2008 +1000

    /etc/ctdb/functions should not be executable

commit b8c8c5cb351747863c5d1366b57c96122ade5db0
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Jun 26 11:52:26 2008 +1000

    third attempt for fixing a freeze child writing to the socket

commit 3387597926ad71e4140cc504b828486d99a3ec8e
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Jun 26 11:08:09 2008 +1000

    verify that the recmaster has the correct flags for us   and if not tell the recmaster what the flags should be

commit b99d687894cb69d863345713055d9c8dc1b29194
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Jun 26 11:02:08 2008 +1000

    only loop over the write it the write failed

commit f15b224e42e81cda84b98f01f919d463e80fb89f
Author: Ronnie Sahlberg <ronniesahlberg at gmail.com>
Date:   Thu Jun 26 09:54:27 2008 +1000

    the write() from the freeze child process can fail
    try writing many times and log an error if the write failed

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

Summary of changes:
 config/functions        |    1 +
 packaging/RPM/ctdb.spec |    2 +-
 server/ctdb_freeze.c    |   18 +++++++++++++++++-
 server/ctdb_recover.c   |    6 ++++++
 server/ctdb_recoverd.c  |   36 ++++++++++++++++++++++++++++++++++++
 5 files changed, 61 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/config/functions b/config/functions
index 13bba6f..3c47e4a 100644
--- a/config/functions
+++ b/config/functions
@@ -1,3 +1,4 @@
+#!/bin/sh
 # utility functions for ctdb event scripts
 
 #######################################
diff --git a/packaging/RPM/ctdb.spec b/packaging/RPM/ctdb.spec
index 023f3d8..00cff5b 100644
--- a/packaging/RPM/ctdb.spec
+++ b/packaging/RPM/ctdb.spec
@@ -90,7 +90,7 @@ fi
 %defattr(-,root,root)
 
 %config(noreplace) %{_sysconfdir}/sysconfig/ctdb
-%attr(755,root,root) %config %{initdir}/ctdb
+%attr(755,root,root) %{initdir}/ctdb
 
 %{_sysconfdir}/ctdb/functions
 %{_sysconfdir}/ctdb/events.d/README
diff --git a/server/ctdb_freeze.c b/server/ctdb_freeze.c
index f7fb38d..47fb476 100644
--- a/server/ctdb_freeze.c
+++ b/server/ctdb_freeze.c
@@ -142,13 +142,29 @@ static struct ctdb_freeze_handle *ctdb_freeze_lock(struct ctdb_context *ctdb)
 
 	if (h->child == 0) {
 		int ret;
+		int count = 0;
 		/* in the child */
 		close(fd[0]);
 		ret = ctdb_lock_all_databases(ctdb);
 		if (ret != 0) {
 			_exit(0);
 		}
-		write(fd[1], &ret, sizeof(ret));
+
+		alarm(30);
+
+		while (count++ < 30) {
+			ret = write(fd[1], &ret, sizeof(ret));
+			if (ret == sizeof(ret)) {
+				break;
+			}
+			DEBUG(DEBUG_ERR, (__location__ " Failed to write to socket from freeze child. ret:%d errno:%u\n", ret, errno));
+			sleep (1);
+		}
+		if (count >= 30) {
+			DEBUG(DEBUG_ERR, (__location__ " Failed to write to socket from freeze child. Aborting freeze child\n"));
+			_exit(0);
+		}
+
 		/* the read here means we will die if the parent exits */
 		read(fd[1], &ret, sizeof(ret));
 		_exit(0);
diff --git a/server/ctdb_recover.c b/server/ctdb_recover.c
index 8ca3a8f..bef9451 100644
--- a/server/ctdb_recover.c
+++ b/server/ctdb_recover.c
@@ -534,6 +534,12 @@ int32_t ctdb_control_set_recmode(struct ctdb_context *ctdb,
 	}
 
 	/* some special handling when ending recovery mode */
+
+	/* force the databased to thaw */
+	if (ctdb->freeze_handle) {
+		ctdb_control_thaw(ctdb);
+	}
+
 	state = talloc(ctdb, struct ctdb_set_recmode_state);
 	CTDB_NO_MEMORY(ctdb, state);
 
diff --git a/server/ctdb_recoverd.c b/server/ctdb_recoverd.c
index affd139..76a6a12 100644
--- a/server/ctdb_recoverd.c
+++ b/server/ctdb_recoverd.c
@@ -671,6 +671,23 @@ static int update_flags_on_all_nodes(struct ctdb_context *ctdb, struct ctdb_node
 	return 0;
 }
 
+static int update_our_flags_on_all_nodes(struct ctdb_context *ctdb, uint32_t pnn, struct ctdb_node_map *nodemap)
+{
+	struct ctdb_node_flag_change c;
+	TDB_DATA data;
+
+	c.pnn = nodemap->nodes[pnn].pnn;
+	c.old_flags = nodemap->nodes[pnn].flags;
+	c.new_flags = nodemap->nodes[pnn].flags;
+
+	data.dptr = (uint8_t *)&c;
+	data.dsize = sizeof(c);
+
+	ctdb_send_message(ctdb, CTDB_BROADCAST_CONNECTED,
+			  CTDB_SRVID_NODE_FLAGS_CHANGED, data);
+
+	return 0;
+}
 
 /*
   ensure all nodes have the same vnnmap we do
@@ -2498,6 +2515,14 @@ again:
 		goto again;
 	}
 
+
+	/* verify that we and the recmaster agrees on our flags */
+	if (nodemap->nodes[pnn].flags != remote_nodemap->nodes[pnn].flags) {
+		DEBUG(DEBUG_ERR, (__location__ " Recmaster disagrees on our flags flags:0x%x recmaster_flags:0x%x  Broadcasting out flags.\n", nodemap->nodes[pnn].flags, remote_nodemap->nodes[pnn].flags));
+
+		update_our_flags_on_all_nodes(ctdb, pnn, nodemap);
+	}
+
 	/* verify that the public ip address allocation is consistent */
 	ret = ctdb_ctrl_get_public_ips(ctdb, CONTROL_TIMEOUT(), CTDB_CURRENT_NODE, mem_ctx, &ips);
 	if (ret != 0) {
@@ -2809,6 +2834,17 @@ again:
 #endif
 	}
 
+
+	DEBUG(DEBUG_INFO, (__location__ " Update flags on all nodes\n"));
+	/*
+	  update all nodes to have the same flags that we have
+	 */
+	ret = update_flags_on_all_nodes(ctdb, nodemap);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR, (__location__ " Unable to update flags on all nodes\n"));
+		goto again;
+	}
+
 	goto again;
 
 }


-- 
CTDB repository


More information about the samba-cvs mailing list