The branch, master has been updated 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) from 85f6032cbdb197f3a003d86f086afa2cee898a4d (commit)
http://gitweb.samba.org/?p=tridge/ctdb.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit fe6ddf7992ca3e72a26dbac6666e0f6270da611f Merge: 5403ed6dcfdfc101b05b43f83002e720d81b4e38 0a6f9326cb99f14b5c9edd0d8854d8229df49910 Author: Andrew Tridgell <[EMAIL PROTECTED]> Date: Thu Nov 20 21:23:26 2008 +1100 Merge commit 'ronnie/master' commit 0a6f9326cb99f14b5c9edd0d8854d8229df49910 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Thu Nov 20 16:39:56 2008 +1100 dont override/change CTDB_BASE if it is already set by the shell commit 7a18f33ec7512100dd067c65f0470889ff8fd591 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Thu Nov 20 13:35:08 2008 +1100 Keepalive packets were only sent every KeepaliveInterval if the socket had been completely idle during that interval. If we had been sending other packets such as Messages, Calls or Controls there wouldnt be any need for an explicit keepalive and thus we didnt send one. This does make it somewhat awkward when analyzing traces since it is non-intuitive when keepalives are sent and when they are not sent. Change the keepalive logic to always send a keepalive regardless of whether the link is idle or not. commit a9a1156ea4e10483a4bf4265b8e9203f0af033aa Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Wed Nov 19 14:43:46 2008 +1100 reqrite the handling of flag updates across the cluster to eliminate a race between the ctdb tool and the recovery daemon both at once trying to push flag changes across the cluster. commit 1f25958dc739677a487fa496fbeffcda7a0f2204 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Thu Nov 13 10:55:20 2008 +1100 new version 1.0.65 update the example sysconfig file. the default log level is 2, not 0 commit b75e2263c565c21ecbbd98fbd2c10787e467bf5c Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Tue Nov 11 14:49:30 2008 +1100 add a CTDB_SOCKET variable that can be used to override the default /tmp/ctdb.socket commit aba984f1b85f5a2d370b093061cf15843ee53758 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Mon Nov 3 21:54:52 2008 +1100 we actually need a ctdb_db variable commit 8c6a02fb423a8cbcbfc706767e3d353cd48073c3 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Thu Oct 30 13:34:10 2008 +1100 latency is measured in us, not ms use an explicit ctdb_db variable instead of dereferencing state commit 1d581dcd507e8e13d7ae085ff4d6a9f3e2aaeba5 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Thu Oct 30 12:49:53 2008 +1100 add control and logging of very high latencies. log the type of operation and the database name for all latencies higher than a treshold commit 1a7ff4577d33f0dd470f7465c7d0e875c962f54e Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Wed Oct 22 11:06:18 2008 +1100 new version 1.0.64 commit 403c68f96e1380dd07217c688de2730464f77ea0 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Wed Oct 22 11:04:41 2008 +1100 add a context and a timed event so that once we have been in recovery mode for too long we drop all public ip addresses commit 59a879626a6a55fb6a43cadf5338c1aa6afe96d1 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Mon Oct 20 09:47:54 2008 +1100 new version 1.0.63 commit e25ea88ea4f270ba65ed5fdacd693f1248f343c0 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Mon Oct 20 09:45:15 2008 +1100 dont log "running periodic cleanup" ... commit 4b0f32047e8bece0a052bdbe2209afe91b7e8ce3 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Fri Oct 17 21:38:42 2008 +1100 null out the pointer before we reload the nodes file commit 82fd2b6b5cd8e988c38fa6b74121a048757bdeef Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Fri Oct 17 21:18:06 2008 +1100 when we reload the nodes file, we may need to reload the nodes file inside the recovery daemon as well. commit 06097b88709ced09d1f9f869eed9a54e6d2fedbf Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Fri Oct 17 09:02:03 2008 +1100 make it possible to set the script log level in CTDB sysconfig commit cdc79d4f22f1a6aec5c34115969421f93663932a Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Fri Oct 17 07:56:12 2008 +1100 specify a "script log level" on the commandline to set under which log level any/all output from eventscripts will be logged as commit 49431e799ba7f7c78f596fdf896316a2e22c745e Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Thu Oct 16 17:59:55 2008 +1100 new version 1.0.62 commit 8313dfb6fc5404cd2d065af6620412f8664ada11 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Thu Oct 16 17:57:50 2008 +1100 allow multiple eventscripts using the same prefix. this eases the pain for users that use out of tree eventscripts commit 5403ed6dcfdfc101b05b43f83002e720d81b4e38 Merge: a5d5aa455c7f7eb93d3fa6f403d5b8e0b795109d 6fb2f8a36239e5902e27cf10213f85faf216d6f1 Author: Andrew Tridgell <[EMAIL PROTECTED]> Date: Thu Oct 16 12:58:25 2008 +1100 Merge commit 'ronnie/master' commit 0098efd4443038f2d902e3a7c3640e63f06be7d1 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Wed Oct 15 16:40:44 2008 +1100 new version 1.0.61 commit 3b8d49bf58f4145cdca08565f06cd43fd36991e1 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Wed Oct 15 16:29:09 2008 +1100 install the new multipath monitoring event script commit f9779d3a237db59d7fdad92185ac7e42715466e6 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Wed Oct 15 16:27:33 2008 +1100 add an eventscript to monitor that the multipath devices are healthy commit 6fb2f8a36239e5902e27cf10213f85faf216d6f1 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Wed Oct 15 08:33:37 2008 +1100 we must also check the status returned from the get tickles control to determine whether it was successful or not commit 9b1d089c99413f3681440f3cf33c293d118c9108 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Wed Oct 15 03:02:09 2008 +1100 lower the loglevel for the informational message that a TCP_ADD opeation described an ip address not known to be a public address. This could happen if someone for genuine reasons accesses a share through a static ip address. It can also happen if non homogenous public address configurations are used and when a tcp description is pushed out to a different node that does not server/know the specific ip address. commit c0b3bd8a3fa580dca5afa97c8012fccb25231373 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Wed Oct 15 01:49:19 2008 +1100 change ip route add to route add -net since this works more reliably update the makefile and rpm to install 99.routing commit 77ed0d71b1fb8d06d70d01a8e8f9eb04ffe7f02f Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Wed Oct 15 01:32:46 2008 +1100 new version 1.0.60 commit 5747dd2d80af29d6252afb6aeb3e66328ee20de5 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Wed Oct 15 01:23:57 2008 +1100 verify that the nodes we try to ban/unban are operational and print an error to the user othervise. commit d13da2e8fe2fab619540525d98a5502a23ab7d20 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Wed Oct 15 01:08:29 2008 +1100 Revert "from Mathieu Parent <[EMAIL PROTECTED]>" This reverts commit dc9cd4779db4a89697731e4cf415be51067a07c1. Conflicts: commit 8e912abc2c68f5fe7b06c600ba6fec1a6900127c Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Wed Oct 15 00:24:44 2008 +1100 update the client side of getnodemap and getpublicips controls to fallback to the old-style ipv4-only controls if the new-style ipv4/ipv6 control fails. this allows a 1.0.59+ (ipv4/ipv6) ctdb daemon being recmaster to be compatible with pre-1.0.59 versions of ctdb that are ipv4 only. commit 6b76c520f97127099bd9fbaa0fa7af1c61947fb7 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Tue Oct 14 10:40:29 2008 +1100 update TAKEIP/RELEASEIP/GETPUBLICIP/GETNODEMAP controls so we retain an older ipv4-only version of these controls. We need this so that we are backwardcompatible with old versions of ctdb and so that we can interoperate with a ipv4-only recmaster during a rolling upgrade. commit dc9cd4779db4a89697731e4cf415be51067a07c1 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Mon Oct 13 08:27:33 2008 +1100 from Mathieu Parent <[EMAIL PROTECTED]> Hi, I have attached a patch necessary as debian log dir (/var/log) is not a subdir of VARDIR (/var/lib on rpm systems, /var/lib/ctdb on debian). As I don't know much about autotools and friends, this patch may be hacky. This is part of the process to minimize diff between distributions. commit 07dd4c7d2e8ba10f53d4cf2644fc4b7b8647e286 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Mon Oct 13 08:21:20 2008 +1100 From Mathieu Parent patch to make debian systems log the package versions in ctdb_diagnostics commit a5d5aa455c7f7eb93d3fa6f403d5b8e0b795109d Author: Andrew Tridgell <[EMAIL PROTECTED]> Date: Thu Oct 9 18:45:12 2008 +1100 added some more gpfs commands per-filesystem commit dc108adada33bb713f71a2859eda3b439ed0cd1a Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Tue Oct 7 19:34:34 2008 +1100 skip empty lines in the public addresses file, not skip all non-empty lines commit 5f96b33a379c80ed8a39de1ee41f254cf48733f9 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Tue Oct 7 19:25:10 2008 +1100 from Michael Adams : allow #-style comments in the nodes and public addresses file commit 8e504fc8c01f750d1cb5d2289ef12c423daf1ad4 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Tue Oct 7 18:23:12 2008 +1100 new version 1.0.59 commit 4237bd3753dcb024c17461e974414bef1b609416 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Tue Oct 7 18:14:44 2008 +1100 remove an unused variable commit e701a531868149f16561011e65794a4a46ee6596 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Tue Oct 7 18:12:54 2008 +1100 When we reload the nodes file instead of shutting down/restarting the entire tcp layer just bounce all outgoing connections and reconnect commit d9779c310e98c9d4eab71a8d1705849ac90deb10 Author: Ronnie Sahlberg <[EMAIL PROTECTED]> Date: Tue Oct 7 11:03:30 2008 +1100 add a new eventscript : 99.routing that is used to add static routes to interfaces when they are activated (an ip address is added during takeip) commit 000018f2f4fb9f2452f56731b027dd6a7beda111 Author: Andrew Tridgell <[EMAIL PROTECTED]> Date: Tue Sep 30 07:16:17 2008 -0700 The author of the upstream code asked for this code to be GPLv2+ not GPLv3 ----------------------------------------------------------------------- Summary of changes: Makefile.in | 2 + client/ctdb_client.c | 218 ++++++++++++++-- common/cmdline.c | 31 ++- common/ctdb_util.c | 22 +- config/ctdb.init | 3 + config/ctdb.sysconfig | 4 +- config/events.d/20.multipathd | 99 +++++++ config/events.d/50.samba | 2 +- config/events.d/99.routing | 37 +++ doc/ctdbd.1 | 562 +++++++++++++++++++++++++++++++---------- include/ctdb.h | 19 ++- include/ctdb_private.h | 62 ++++- lib/util/idtree.c | 2 +- packaging/RPM/ctdb.spec | 47 ++++- server/ctdb_control.c | 25 ++- server/ctdb_daemon.c | 45 +--- 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 | 99 ++++++-- server/ctdb_recoverd.c | 133 +++++----- server/ctdb_server.c | 15 +- server/ctdb_takeover.c | 162 ++++++++++-- server/ctdb_tunables.c | 1 + server/ctdbd.c | 14 +- server/eventscript.c | 18 +- tcp/tcp_init.c | 6 +- tests/nodes.txt | 3 + tools/ctdb.c | 17 +- tools/ctdb_diagnostics | 13 + 32 files changed, 1328 insertions(+), 401 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 6d80efc..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; } @@ -2435,7 +2575,7 @@ int ctdb_ctrl_get_tcp_tickles(struct ctdb_context *ctdb, 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 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 cc68291..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) @@ -362,12 +368,12 @@ void set_close_on_exec(int fd) } -static bool parse_ipv4(const char *s, unsigned port, ctdb_sock_addr *saddr) +bool parse_ipv4(const char *s, unsigned port, struct sockaddr_in *sin) { - saddr->ip.sin_family = AF_INET; - saddr->ip.sin_port = htons(port); + sin->sin_family = AF_INET; + sin->sin_port = htons(port); - if (inet_pton(AF_INET, s, &saddr->ip.sin_addr) != 1) { + if (inet_pton(AF_INET, s, &sin->sin_addr) != 1) { DEBUG(DEBUG_ERR, (__location__ " Failed to translate %s into sin_addr\n", s)); return false; } @@ -427,7 +433,7 @@ bool parse_ip_port(const char *addr, ctdb_sock_addr *saddr) /* now is this a ipv4 or ipv6 address ?*/ p = index(s, ':'); if (p == NULL) { - ret = parse_ipv4(s, port, saddr); + ret = parse_ipv4(s, port, &saddr->ip); } else { ret = parse_ipv6(s, port, saddr); } @@ -447,7 +453,7 @@ bool parse_ip(const char *addr, ctdb_sock_addr *saddr) /* now is this a ipv4 or ipv6 address ?*/ p = index(addr, ':'); if (p == NULL) { - ret = parse_ipv4(addr, 0, saddr); + ret = parse_ipv4(addr, 0, &saddr->ip); } else { ret = parse_ipv6(addr, 0, saddr); } @@ -493,7 +499,7 @@ bool parse_ip_mask(const char *str, ctdb_sock_addr *addr, unsigned *mask) /* now is this a ipv4 or ipv6 address ?*/ p = index(s, ':'); if (p == NULL) { - ret = parse_ipv4(s, 0, addr); + ret = parse_ipv4(s, 0, &addr->ip); } else { ret = parse_ipv6(s, 0, addr); } diff --git a/config/ctdb.init b/config/ctdb.init index eb56ef6..9e06c24 100755 --- a/config/ctdb.init +++ b/config/ctdb.init @@ -75,6 +75,9 @@ CTDB_OPTIONS="$CTDB_OPTIONS --reclock=$CTDB_RECOVERY_LOCK" [ -z "$CTDB_LVS_PUBLIC_IP" ] || { CTDB_OPTIONS="$CTDB_OPTIONS --lvs" } +[ -z "$CTDB_SCRIPT_LOG_LEVEL" ] || { + CTDB_OPTIONS="$CTDB_OPTIONS --script-log-level=$CTDB_SCRIPT_LOG_LEVEL" +} if [ "$CTDB_VALGRIND" = "yes" ]; then init_style="valgrind" diff --git a/config/ctdb.sysconfig b/config/ctdb.sysconfig index 84a90d0..35a9819 100644 --- a/config/ctdb.sysconfig +++ b/config/ctdb.sysconfig @@ -135,8 +135,8 @@ # CTDB_LOGFILE=/var/log/log.ctdb # what debug level to run at. Higher means more verbose -# the default is 0 -# CTDB_DEBUGLEVEL=0 +# the default is 2 +CTDB_DEBUGLEVEL=2 # set any default tuning options for ctdb # use CTDB_SET_XXXX=value where XXXX is the name of the tuning diff --git a/config/events.d/20.multipathd b/config/events.d/20.multipathd new file mode 100644 index 0000000..93a58ab --- /dev/null -- CTDB repository