[SCM] CTDB repository - branch origin updated - ctdb-1.0.65-8-g6579a6a

Ronnie Sahlberg sahlberg at samba.org
Mon Dec 15 22:52:47 GMT 2008


The branch, origin has been updated
       via  6579a6a2a7161214adedf0f67dce62f4a4ad1afe (commit)
       via  fe6ddf7992ca3e72a26dbac6666e0f6270da611f (commit)
       via  0a6f9326cb99f14b5c9edd0d8854d8229df49910 (commit)
       via  7a18f33ec7512100dd067c65f0470889ff8fd591 (commit)
       via  a9a1156ea4e10483a4bf4265b8e9203f0af033aa (commit)
       via  1f25958dc739677a487fa496fbeffcda7a0f2204 (commit)
       via  b75e2263c565c21ecbbd98fbd2c10787e467bf5c (commit)
       via  aba984f1b85f5a2d370b093061cf15843ee53758 (commit)
       via  8c6a02fb423a8cbcbfc706767e3d353cd48073c3 (commit)
       via  1d581dcd507e8e13d7ae085ff4d6a9f3e2aaeba5 (commit)
       via  1a7ff4577d33f0dd470f7465c7d0e875c962f54e (commit)
       via  403c68f96e1380dd07217c688de2730464f77ea0 (commit)
       via  59a879626a6a55fb6a43cadf5338c1aa6afe96d1 (commit)
       via  e25ea88ea4f270ba65ed5fdacd693f1248f343c0 (commit)
       via  4b0f32047e8bece0a052bdbe2209afe91b7e8ce3 (commit)
       via  82fd2b6b5cd8e988c38fa6b74121a048757bdeef (commit)
       via  06097b88709ced09d1f9f869eed9a54e6d2fedbf (commit)
       via  cdc79d4f22f1a6aec5c34115969421f93663932a (commit)
       via  49431e799ba7f7c78f596fdf896316a2e22c745e (commit)
       via  8313dfb6fc5404cd2d065af6620412f8664ada11 (commit)
       via  5403ed6dcfdfc101b05b43f83002e720d81b4e38 (commit)
       via  0098efd4443038f2d902e3a7c3640e63f06be7d1 (commit)
       via  3b8d49bf58f4145cdca08565f06cd43fd36991e1 (commit)
       via  f9779d3a237db59d7fdad92185ac7e42715466e6 (commit)
       via  6fb2f8a36239e5902e27cf10213f85faf216d6f1 (commit)
       via  9b1d089c99413f3681440f3cf33c293d118c9108 (commit)
       via  c0b3bd8a3fa580dca5afa97c8012fccb25231373 (commit)
       via  77ed0d71b1fb8d06d70d01a8e8f9eb04ffe7f02f (commit)
       via  5747dd2d80af29d6252afb6aeb3e66328ee20de5 (commit)
       via  d13da2e8fe2fab619540525d98a5502a23ab7d20 (commit)
       via  8e912abc2c68f5fe7b06c600ba6fec1a6900127c (commit)
       via  6b76c520f97127099bd9fbaa0fa7af1c61947fb7 (commit)
       via  dc9cd4779db4a89697731e4cf415be51067a07c1 (commit)
       via  07dd4c7d2e8ba10f53d4cf2644fc4b7b8647e286 (commit)
       via  a5d5aa455c7f7eb93d3fa6f403d5b8e0b795109d (commit)
       via  dc108adada33bb713f71a2859eda3b439ed0cd1a (commit)
       via  5f96b33a379c80ed8a39de1ee41f254cf48733f9 (commit)
       via  8e504fc8c01f750d1cb5d2289ef12c423daf1ad4 (commit)
       via  4237bd3753dcb024c17461e974414bef1b609416 (commit)
       via  e701a531868149f16561011e65794a4a46ee6596 (commit)
       via  d9779c310e98c9d4eab71a8d1705849ac90deb10 (commit)
       via  000018f2f4fb9f2452f56731b027dd6a7beda111 (commit)
       via  85f6032cbdb197f3a003d86f086afa2cee898a4d (commit)
       via  647003da975d4823abe8ed2bfb46153d68ea0fb0 (commit)
       via  a06abf6bff6c4d379453e5063d8de1a6542c982a (commit)
       via  475cfada33b4c13aaaca773d5485bbe26bffbf46 (commit)
       via  196968c552e6ebcb57389d769a4b25f42fa8bc5d (commit)
       via  5e641ef9d6cca286061138a9680dcf2495736e8b (commit)
       via  95bf36559d62f29e6f538f3a173b504ef3258341 (commit)
       via  0aca4daf908b76d6013ff3dfad41beb9114fc1a3 (commit)
       via  a120c734c5425ebb2e09c2009374aa0bc5a432e8 (commit)
       via  2583d0c8f9932e023b7377582f62c840e264be80 (commit)
       via  1d5d13345086201fe55517aea5f8674ff3db1090 (commit)
       via  2b70953cd51e879dc1fa113d68c6614051da5260 (commit)
       via  3ff0711fd3b288c153218ad33e8462a94b8d3275 (commit)
       via  d1aa7953450de6ae215589404fb19e05edd3906f (commit)
       via  666c3835376cd6b66aeaa110c76ecf052cd71a0a (commit)
       via  616b71fef54a3d1ea2638602099722a19ef6f41d (commit)
       via  a72f5b7d1560e427e18b1c55a2932a7fb037f4c7 (commit)
       via  a89977f8cb2463a87147dcc0ad936cb5d4131670 (commit)
       via  cd69d292292eaab3aac0e9d9fc57cb621597c63c (commit)
       via  e26ce5140ed005725f8b7ac8ba23a180fd7d5337 (commit)
       via  8060e591b0eb2d184b5a7444487477225d2e1dbf (commit)
       via  c4bc4317df4106e81b238dbfaf861ca6104304c1 (commit)
       via  4d1c0418cfe6170bc081684dbe45908a5d285f0b (commit)
       via  f84d0a9a8c7e9589e8833f21e1f977a0adab356b (commit)
       via  2a8bf5e7dc7364a8280d96db0f9579d2582a8524 (commit)
       via  0709093af11e0735ed1e13b06ac073990631e692 (commit)
       via  7da0c65c8526d66d4f2a788bd646d39237befa54 (commit)
       via  12bc85c90a640a72ff538c003eb81da9dd1f2e3f (commit)
       via  4dfbfb4618433d9ed79ca1bdb1e2e51d96d4ee62 (commit)
       via  293d12a40501320a21efaf592b8f20e8590a5197 (commit)
       via  2f8b33948e395228cbac3450c0c684e49069abf0 (commit)
       via  1157d61a0bc557d8ffc453c518dfc48473492bfd (commit)
       via  b0fe4c45fc5ba1ecf62ebb921092c8a34e28a2bd (commit)
       via  6da7b36b7ccc4ee9b809867ea32036f09a801bb3 (commit)
       via  83735951352a243da185031e4853e7e40c43a0fb (commit)
       via  0a38ea11af9237501f2951fee698a59b46f8750d (commit)
       via  bf6effef0cc9e5f2eeeb38fce855a90624a76239 (commit)
       via  1f131f21386f428bbbbb29098d56c2f64596583b (commit)
       via  48fad9c06185a1f2580473cac02b3722e35c2023 (commit)
       via  ff413beb4bb31e277e843235a1ce5e5ad7b92c71 (commit)
       via  0674b33a7492cc1a194833f5ca87d8b30457faee (commit)
       via  77762170ad1dbc4620565bb898af5d493fac117d (commit)
       via  b567e215f5c58d646a392408b9cc1df8ef029b33 (commit)
       via  c4ad24e7c2b27b168d43ebfa95c459da27697d1e (commit)
       via  7769edbd5507f791e77cc5e5642d854bebec2df0 (commit)
       via  196973fef38a9b258e0976d5454161d11d573ddc (commit)
       via  fb7f69b1d6dd8b0715258dde736dc03e1c5e43aa (commit)
       via  96df98d9f86ecc6bb1a458eb2101e5c1bc0f96e6 (commit)
       via  c94b295b078dc009c18aa416d0de232a12241014 (commit)
       via  29aaa339ef745208fb0b746db5cbc3a32d0d81b2 (commit)
       via  d6061214b4ef7e628ba7d27d81f23174c5364f67 (commit)
       via  a09864519d04f1e6a7ba498a795b6390183902a8 (commit)
       via  082dd600ef25431efbf087ebf1957fbfd61cf104 (commit)
      from  db6bc3745a56cc12e60e727190a098a6527690d6 (commit)

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


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 Makefile.in                   |    2 +
 client/ctdb_client.c          |  242 ++++++++++++++--
 common/cmdline.c              |   31 ++-
 common/ctdb_util.c            |  163 +++++++-----
 common/system_aix.c           |  108 +++++---
 common/system_linux.c         |  260 ++++++++++++------
 config/ctdb.init              |   27 +-
 config/ctdb.sysconfig         |    4 +-
 config/events.d/10.interface  |    1 -
 config/events.d/20.multipathd |   99 +++++++
 config/events.d/50.samba      |    2 +-
 config/events.d/99.routing    |   37 +++
 config/functions              |   14 +-
 doc/ctdb.1                    |  296 ++++++++++----------
 doc/ctdb.1.html               |   98 ++++----
 doc/ctdb.1.xml                |    2 +-
 doc/ctdbd.1                   |  623 ++++++++++++++++++++++++++++++-----------
 doc/ctdbd.1.html              |   72 +++---
 doc/ctdbd.1.xml               |   22 +-
 doc/onnode.1                  |  333 ++++------------------
 doc/onnode.1.html             |   16 +-
 doc/onnode.1.xml              |   65 ++++-
 include/ctdb.h                |   20 ++-
 include/ctdb_private.h        |  120 ++++++---
 lib/util/idtree.c             |   18 +-
 packaging/RPM/ctdb.spec       |   57 ++++-
 server/ctdb_control.c         |   31 ++-
 server/ctdb_daemon.c          |   50 +---
 server/ctdb_keepalive.c       |    6 +-
 server/ctdb_lockwait.c        |    2 +-
 server/ctdb_logging.c         |   12 +-
 server/ctdb_monitor.c         |   46 ++--
 server/ctdb_persistent.c      |    2 +-
 server/ctdb_recover.c         |  164 ++++++++++--
 server/ctdb_recoverd.c        |  163 ++++++-----
 server/ctdb_server.c          |   15 +-
 server/ctdb_takeover.c        |  532 ++++++++++++++++++++++-------------
 server/ctdb_tunables.c        |    3 +
 server/ctdbd.c                |   20 +-
 server/eventscript.c          |   18 +-
 tcp/tcp_connect.c             |  131 ++++++----
 tcp/tcp_init.c                |    6 +-
 tests/start_daemons.sh        |    9 +-
 tools/ctdb.c                  |  532 +++++++++++++++++++++++++++++++----
 tools/ctdb_diagnostics        |   24 ++-
 tools/onnode                  |  103 ++++++-
 utils/ipmux/ipmux.c           |    8 +-
 web/index.html                |    2 +-
 48 files changed, 3101 insertions(+), 1510 deletions(-)
 create mode 100644 config/events.d/20.multipathd
 create mode 100755 config/events.d/99.routing


Changeset truncated at 500 lines:

diff --git a/Makefile.in b/Makefile.in
index cf1240b..779bd8b 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -189,6 +189,7 @@ install: all
 	${INSTALLCMD} -m 644 config/events.d/README $(DESTDIR)/$(docdir)/ctdb/README.eventscripts
 	${INSTALLCMD} -m 755 config/events.d/00.ctdb $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/10.interface $(DESTDIR)$(etcdir)/ctdb/events.d
+	${INSTALLCMD} -m 755 config/events.d/20.multipathd $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/40.vsftpd $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/41.httpd $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/50.samba $(DESTDIR)$(etcdir)/ctdb/events.d
@@ -197,6 +198,7 @@ install: all
 	${INSTALLCMD} -m 755 config/events.d/70.iscsi $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/90.ipmux $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 config/events.d/91.lvs $(DESTDIR)$(etcdir)/ctdb/events.d
+	${INSTALLCMD} -m 755 config/events.d/99.routing $(DESTDIR)$(etcdir)/ctdb/events.d
 	${INSTALLCMD} -m 755 tools/ctdb_diagnostics $(DESTDIR)$(bindir)
 	${INSTALLCMD} -m 755 tools/onnode $(DESTDIR)$(bindir)
 	if [ -f doc/ctdb.1 ];then ${INSTALLCMD} -d $(DESTDIR)$(mandir)/man1; fi
diff --git a/client/ctdb_client.c b/client/ctdb_client.c
index 0d85374..16fc03b 100644
--- a/client/ctdb_client.c
+++ b/client/ctdb_client.c
@@ -26,6 +26,7 @@
 #include "system/network.h"
 #include "system/filesys.h"
 #include "system/locale.h"
+#include <stdlib.h>
 #include "../include/ctdb_private.h"
 #include "lib/util/dlinklist.h"
 
@@ -1221,7 +1222,7 @@ int ctdb_ctrl_getdbmap(struct ctdb_context *ctdb, struct timeval timeout, uint32
 			   CTDB_CONTROL_GET_DBMAP, 0, tdb_null, 
 			   mem_ctx, &outdata, &res, &timeout, NULL);
 	if (ret != 0 || res != 0) {
-		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getdbmap failed\n"));
+		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getdbmap failed ret:%d res:%d\n", ret, res));
 		return -1;
 	}
 
@@ -1245,8 +1246,12 @@ int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
 	ret = ctdb_control(ctdb, destnode, 0, 
 			   CTDB_CONTROL_GET_NODEMAP, 0, tdb_null, 
 			   mem_ctx, &outdata, &res, &timeout, NULL);
+	if (ret == 0 && res == -1 && outdata.dsize == 0) {
+		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodes failed, falling back to ipv4-only control\n"));
+		return ctdb_ctrl_getnodemapv4(ctdb, timeout, destnode, mem_ctx, nodemap);
+	}
 	if (ret != 0 || res != 0 || outdata.dsize == 0) {
-		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodes failed\n"));
+		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodes failed ret:%d res:%d\n", ret, res));
 		return -1;
 	}
 
@@ -1257,6 +1262,45 @@ int ctdb_ctrl_getnodemap(struct ctdb_context *ctdb,
 }
 
 /*
+  old style ipv4-only get a list of nodes (vnn and flags ) from a remote node
+ */
+int ctdb_ctrl_getnodemapv4(struct ctdb_context *ctdb, 
+		struct timeval timeout, uint32_t destnode, 
+		TALLOC_CTX *mem_ctx, struct ctdb_node_map **nodemap)
+{
+	int ret, i, len;
+	TDB_DATA outdata;
+	struct ctdb_node_mapv4 *nodemapv4;
+	int32_t res;
+
+	ret = ctdb_control(ctdb, destnode, 0, 
+			   CTDB_CONTROL_GET_NODEMAPv4, 0, tdb_null, 
+			   mem_ctx, &outdata, &res, &timeout, NULL);
+	if (ret != 0 || res != 0 || outdata.dsize == 0) {
+		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getnodesv4 failed ret:%d res:%d\n", ret, res));
+		return -1;
+	}
+
+	nodemapv4 = (struct ctdb_node_mapv4 *)outdata.dptr;
+
+	len = offsetof(struct ctdb_node_map, nodes) + nodemapv4->num*sizeof(struct ctdb_node_and_flags);
+	(*nodemap) = talloc_zero_size(mem_ctx, len);
+	CTDB_NO_MEMORY(ctdb, (*nodemap));
+
+	(*nodemap)->num = nodemapv4->num;
+	for (i=0; i<nodemapv4->num; i++) {
+		(*nodemap)->nodes[i].pnn     = nodemapv4->nodes[i].pnn;
+		(*nodemap)->nodes[i].flags   = nodemapv4->nodes[i].flags;
+		(*nodemap)->nodes[i].addr.ip = nodemapv4->nodes[i].sin;
+		(*nodemap)->nodes[i].addr.sa.sa_family = AF_INET;
+	}
+		
+	talloc_free(outdata.dptr);
+		    
+	return 0;
+}
+
+/*
   drop the transport, reload the nodes file and restart the transport
  */
 int ctdb_ctrl_reload_nodes_file(struct ctdb_context *ctdb, 
@@ -2050,14 +2094,26 @@ int ctdb_ctrl_takeover_ip(struct ctdb_context *ctdb, struct timeval timeout,
 			  uint32_t destnode, struct ctdb_public_ip *ip)
 {
 	TDB_DATA data;
+	struct ctdb_public_ipv4 ipv4;
 	int ret;
 	int32_t res;
 
-	data.dsize = sizeof(*ip);
-	data.dptr  = (uint8_t *)ip;
+	if (ip->addr.sa.sa_family == AF_INET) {
+		ipv4.pnn = ip->pnn;
+		ipv4.sin = ip->addr.ip;
 
-	ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_TAKEOVER_IP, 0, data, NULL,
+		data.dsize = sizeof(ipv4);
+		data.dptr  = (uint8_t *)&ipv4;
+
+		ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_TAKEOVER_IPv4, 0, data, NULL,
+			   NULL, &res, &timeout, NULL);
+	} else {
+		data.dsize = sizeof(*ip);
+		data.dptr  = (uint8_t *)ip;
+
+		ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_TAKEOVER_IP, 0, data, NULL,
 			   NULL, &res, &timeout, NULL);
+	}
 
 	if (ret != 0 || res != 0) {
 		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for takeover_ip failed\n"));
@@ -2075,14 +2131,26 @@ int ctdb_ctrl_release_ip(struct ctdb_context *ctdb, struct timeval timeout,
 			 uint32_t destnode, struct ctdb_public_ip *ip)
 {
 	TDB_DATA data;
+	struct ctdb_public_ipv4 ipv4;
 	int ret;
 	int32_t res;
 
-	data.dsize = sizeof(*ip);
-	data.dptr  = (uint8_t *)ip;
+	if (ip->addr.sa.sa_family == AF_INET) {
+		ipv4.pnn = ip->pnn;
+		ipv4.sin = ip->addr.ip;
 
-	ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_RELEASE_IP, 0, data, NULL,
-			   NULL, &res, &timeout, NULL);
+		data.dsize = sizeof(ipv4);
+		data.dptr  = (uint8_t *)&ipv4;
+
+		ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_RELEASE_IPv4, 0, data, NULL,
+				   NULL, &res, &timeout, NULL);
+	} else {
+		data.dsize = sizeof(*ip);
+		data.dptr  = (uint8_t *)ip;
+
+		ret = ctdb_control(ctdb, destnode, 0, CTDB_CONTROL_RELEASE_IP, 0, data, NULL,
+				   NULL, &res, &timeout, NULL);
+	}
 
 	if (ret != 0 || res != 0) {
 		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for release_ip failed\n"));
@@ -2230,8 +2298,12 @@ int ctdb_ctrl_get_public_ips(struct ctdb_context *ctdb,
 	ret = ctdb_control(ctdb, destnode, 0, 
 			   CTDB_CONTROL_GET_PUBLIC_IPS, 0, tdb_null, 
 			   mem_ctx, &outdata, &res, &timeout, NULL);
+	if (ret == 0 && res == -1) {
+		DEBUG(DEBUG_ERR,(__location__ " ctdb_control to get public ips failed, falling back to ipv4-only version\n"));
+		return ctdb_ctrl_get_public_ipsv4(ctdb, timeout, destnode, mem_ctx, ips);
+	}
 	if (ret != 0 || res != 0) {
-		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpublicips failed\n"));
+	  DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpublicips failed ret:%d res:%d\n", ret, res));
 		return -1;
 	}
 
@@ -2241,6 +2313,38 @@ int ctdb_ctrl_get_public_ips(struct ctdb_context *ctdb,
 	return 0;
 }
 
+int ctdb_ctrl_get_public_ipsv4(struct ctdb_context *ctdb, 
+			struct timeval timeout, uint32_t destnode, 
+			TALLOC_CTX *mem_ctx, struct ctdb_all_public_ips **ips)
+{
+	int ret, i, len;
+	TDB_DATA outdata;
+	int32_t res;
+	struct ctdb_all_public_ipsv4 *ipsv4;
+
+	ret = ctdb_control(ctdb, destnode, 0, 
+			   CTDB_CONTROL_GET_PUBLIC_IPSv4, 0, tdb_null, 
+			   mem_ctx, &outdata, &res, &timeout, NULL);
+	if (ret != 0 || res != 0) {
+		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for getpublicips failed\n"));
+		return -1;
+	}
+
+	ipsv4 = (struct ctdb_all_public_ipsv4 *)outdata.dptr;
+	len = offsetof(struct ctdb_all_public_ips, ips) +
+		ipsv4->num*sizeof(struct ctdb_public_ip);
+	*ips = talloc_zero_size(mem_ctx, len);
+	(*ips)->num = ipsv4->num;
+	for (i=0; i<ipsv4->num; i++) {
+		(*ips)->ips[i].pnn     = ipsv4->ips[i].pnn;
+		(*ips)->ips[i].addr.ip = ipsv4->ips[i].sin;
+	}
+
+	talloc_free(outdata.dptr);
+		    
+	return 0;
+}
+
 /*
   set/clear the permanent disabled bit on a remote node
  */
@@ -2249,23 +2353,59 @@ int ctdb_ctrl_modflags(struct ctdb_context *ctdb, struct timeval timeout, uint32
 {
 	int ret;
 	TDB_DATA data;
-	struct ctdb_node_modflags m;
-	int32_t res;
+	struct ctdb_node_map *nodemap=NULL;
+	struct ctdb_node_flag_change c;
+	TALLOC_CTX *tmp_ctx = talloc_new(ctdb);
+	uint32_t recmaster;
+	uint32_t *nodes;
 
-	m.set = set;
-	m.clear = clear;
 
-	data.dsize = sizeof(m);
-	data.dptr = (unsigned char *)&m;
+	/* find the recovery master */
+	ret = ctdb_ctrl_getrecmaster(ctdb, tmp_ctx, timeout, CTDB_CURRENT_NODE, &recmaster);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR, (__location__ " Unable to get recmaster from local node\n"));
+		talloc_free(tmp_ctx);
+		return ret;
+	}
 
-	ret = ctdb_control(ctdb, destnode, 0, 
-			   CTDB_CONTROL_MODIFY_FLAGS, 0, data, 
-			   NULL, NULL, &res, &timeout, NULL);
-	if (ret != 0 || res != 0) {
-		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for modflags failed\n"));
+
+	/* read the node flags from the recmaster */
+	ret = ctdb_ctrl_getnodemap(ctdb, timeout, recmaster, tmp_ctx, &nodemap);
+	if (ret != 0) {
+		DEBUG(DEBUG_ERR, (__location__ " Unable to get nodemap from node %u\n", destnode));
+		talloc_free(tmp_ctx);
+		return -1;
+	}
+	if (destnode >= nodemap->num) {
+		DEBUG(DEBUG_ERR,(__location__ " Nodemap from recmaster does not contain node %d\n", destnode));
+		talloc_free(tmp_ctx);
+		return -1;
+	}
+
+	c.pnn       = destnode;
+	c.old_flags = nodemap->nodes[destnode].flags;
+	c.new_flags = c.old_flags;
+	c.new_flags |= set;
+	c.new_flags &= ~clear;
+
+	data.dsize = sizeof(c);
+	data.dptr = (unsigned char *)&c;
+
+	/* send the flags update to all connected nodes */
+	nodes = list_of_connected_nodes(ctdb, nodemap, tmp_ctx, true);
+
+	if (ctdb_client_async_control(ctdb, CTDB_CONTROL_MODIFY_FLAGS,
+					nodes,
+					timeout, false, data,
+					NULL, NULL,
+					NULL) != 0) {
+		DEBUG(DEBUG_ERR, (__location__ " ctdb_control to disable node failed\n"));
+
+		talloc_free(tmp_ctx);
 		return -1;
 	}
 
+	talloc_free(tmp_ctx);
 	return 0;
 }
 
@@ -2422,20 +2562,20 @@ int ctdb_ctrl_gratious_arp(struct ctdb_context *ctdb,
 int ctdb_ctrl_get_tcp_tickles(struct ctdb_context *ctdb, 
 			      struct timeval timeout, uint32_t destnode, 
 			      TALLOC_CTX *mem_ctx, 
-			      struct sockaddr_in *ip,
+			      ctdb_sock_addr *addr,
 			      struct ctdb_control_tcp_tickle_list **list)
 {
 	int ret;
 	TDB_DATA data, outdata;
 	int32_t status;
 
-	data.dptr = (uint8_t*)ip;
-	data.dsize = sizeof(struct sockaddr_in);
+	data.dptr = (uint8_t*)addr;
+	data.dsize = sizeof(ctdb_sock_addr);
 
 	ret = ctdb_control(ctdb, destnode, 0, 
 			   CTDB_CONTROL_GET_TCP_TICKLE_LIST, 0, data, 
 			   mem_ctx, &outdata, &status, NULL, NULL);
-	if (ret != 0) {
+	if (ret != 0 || status != 0) {
 		DEBUG(DEBUG_ERR,(__location__ " ctdb_control for get tcp tickles failed\n"));
 		return -1;
 	}
@@ -2855,6 +2995,40 @@ uint32_t *list_of_active_nodes(struct ctdb_context *ctdb,
 	return nodes;
 }
 
+uint32_t *list_of_connected_nodes(struct ctdb_context *ctdb,
+				struct ctdb_node_map *node_map,
+				TALLOC_CTX *mem_ctx,
+				bool include_self)
+{
+	int i, j, num_nodes;
+	uint32_t *nodes;
+
+	for (i=num_nodes=0;i<node_map->num;i++) {
+		if (node_map->nodes[i].flags & NODE_FLAGS_DISCONNECTED) {
+			continue;
+		}
+		if (node_map->nodes[i].pnn == ctdb->pnn && !include_self) {
+			continue;
+		}
+		num_nodes++;
+	} 
+
+	nodes = talloc_array(mem_ctx, uint32_t, num_nodes);
+	CTDB_NO_MEMORY_FATAL(ctdb, nodes);
+
+	for (i=j=0;i<node_map->num;i++) {
+		if (node_map->nodes[i].flags & NODE_FLAGS_DISCONNECTED) {
+			continue;
+		}
+		if (node_map->nodes[i].pnn == ctdb->pnn && !include_self) {
+			continue;
+		}
+		nodes[j++] = node_map->nodes[i].pnn;
+	} 
+
+	return nodes;
+}
+
 /* 
   this is used to test if a pnn lock exists and if it exists will return
   the number of connections that pnn has reported or -1 if that recovery
@@ -3280,3 +3454,21 @@ again:
 	talloc_free(h);
 	return 0;
 }
+
+/*
+  recovery daemon ping to main daemon
+ */
+int ctdb_ctrl_recd_ping(struct ctdb_context *ctdb)
+{
+	int ret;
+	int32_t res;
+
+	ret = ctdb_control(ctdb, CTDB_CURRENT_NODE, 0, CTDB_CONTROL_RECD_PING, 0, tdb_null, 
+			   ctdb, NULL, &res, NULL, NULL);
+	if (ret != 0 || res != 0) {
+		DEBUG(DEBUG_ERR,("Failed to send recd ping\n"));
+		return -1;
+	}
+
+	return 0;
+}
diff --git a/common/cmdline.c b/common/cmdline.c
index b6e3541..ea81faf 100644
--- a/common/cmdline.c
+++ b/common/cmdline.c
@@ -33,7 +33,6 @@ static struct {
 	int torture;
 	const char *events;
 } ctdb_cmdline = {
-	.socketname = CTDB_PATH,
 	.torture = 0,
 };
 
@@ -81,11 +80,14 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev)
 		ctdb_set_flags(ctdb, CTDB_FLAG_TORTURE);
 	}
 
-	/* tell ctdb the socket address */
-	ret = ctdb_set_socketname(ctdb, ctdb_cmdline.socketname);
-	if (ret == -1) {
-		printf("ctdb_set_socketname failed - %s\n", ctdb_errstr(ctdb));
-		exit(1);
+	/* command line specified a socket name */
+	if (ctdb_cmdline.socketname != NULL) {
+		ret = ctdb_set_socketname(ctdb, ctdb_cmdline.socketname);
+		if (ret == -1) {
+			printf("ctdb_set_socketname failed - %s\n",
+						    ctdb_errstr(ctdb));
+			exit(1);
+		}
 	}
 
 	/* set up the tree to store server ids */
@@ -101,6 +103,7 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev)
 struct ctdb_context *ctdb_cmdline_client(struct event_context *ev)
 {
 	struct ctdb_context *ctdb;
+	char *socket_name;
 	int ret;
 
 	/* initialise ctdb */
@@ -111,10 +114,18 @@ struct ctdb_context *ctdb_cmdline_client(struct event_context *ev)
 	}
 
 	/* tell ctdb the socket address */
-	ret = ctdb_set_socketname(ctdb, ctdb_cmdline.socketname);
-	if (ret == -1) {
-		fprintf(stderr, "ctdb_set_socketname failed - %s\n", ctdb_errstr(ctdb));
-		exit(1);
+	socket_name = getenv("CTDB_SOCKET");
+	if (socket_name != NULL) {
+		ctdb_set_socketname(ctdb, socket_name);
+	}
+
+	if (ctdb_cmdline.socketname != NULL) {
+		ret = ctdb_set_socketname(ctdb, ctdb_cmdline.socketname);
+		if (ret == -1) {
+			fprintf(stderr, "ctdb_set_socketname failed - %s\n",
+					ctdb_errstr(ctdb));
+			exit(1);
+		}
 	}
 
 	ret = ctdb_socket_connect(ctdb);
diff --git a/common/ctdb_util.c b/common/ctdb_util.c
index b096a52..b5a3508 100644
--- a/common/ctdb_util.c
+++ b/common/ctdb_util.c
@@ -124,12 +124,18 @@ static void *_idr_find_type(struct idr_context *idp, int id, const char *type, c
 /*
   update a max latency number
  */
-void ctdb_latency(double *latency, struct timeval t)
+void ctdb_latency(struct ctdb_db_context *ctdb_db, const char *name, double *latency, struct timeval t)
 {
 	double l = timeval_elapsed(&t);
 	if (l > *latency) {
 		*latency = l;
 	}
+
+	if (ctdb_db->ctdb->tunable.log_latency_ms !=0) {
+		if (l*1000 > ctdb_db->ctdb->tunable.log_latency_ms) {
+			DEBUG(DEBUG_WARNING, ("High latency %fs for operation %s on database %s\n", l*1000000, name, ctdb_db->db_name));
+		}
+	}
 }
 
 uint32_t ctdb_reqid_new(struct ctdb_context *ctdb, void *state)
@@ -147,7 +153,7 @@ void *_ctdb_reqid_find(struct ctdb_context *ctdb, uint32_t reqid, const char *ty
 
 	p = _idr_find_type(ctdb->idr, (reqid>>16)&0xFFFF, type, location);
 	if (p == NULL) {
-		DEBUG(DEBUG_ERR, ("Could not find idr:%u\n",reqid));
+		DEBUG(DEBUG_WARNING, ("Could not find idr:%u\n",reqid));
 	}
 
 	return p;
@@ -362,46 +368,12 @@ void set_close_on_exec(int fd)
 }
 
 
-/*
-  parse a ip:num pair with the given separator
- */
-static bool parse_ip_num(const char *s, struct in_addr *addr, unsigned *num, const char sep)
-{
-	const char *p;
-	char *endp = NULL;
-	char buf[16];
-
-	p = strchr(s, sep);
-	if (p == NULL) {
-		return false;
-	}
-
-	if (p - s > 15) {
-		return false;
-	}
-
-	*num = strtoul(p+1, &endp, 10);
-	if (endp == NULL || *endp != 0) {
-		/* trailing garbage */
-		return false;
-	}
-
-	strlcpy(buf, s, 1+p-s);
-


-- 
CTDB repository


More information about the samba-cvs mailing list