summaryrefslogtreecommitdiffstats
path: root/ctdb
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-tests: Check for readable, not executable, scriptMartin Schwenke2015-03-061-1/+1
| | | | | | | | | | | | | Scripts in eventscript unit tests are run under an explicitly specified shell so they do not need to be executable. Checking that the script is executable breaks on scripts that are installed without the execute bit set, such as disabled eventscripts. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Fri Mar 6 04:40:07 CET 2015 on sn-devel-104
* ctdb-locking: Back-off from logging every 10 secondsAmitay Isaacs2015-03-051-4/+16
| | | | | | | | | | | | | | | | | | | If ctdb_lock_helper cannot get a lock within 10 seconds, ctdb daemon logs a message and invokes an external debug script. This is repeated every 10 seconds. In case of a contention or on a loaded system, there can be multiple ctdb_lock_helper processes waiting to get lock on record(s). For each lock request taking longer, ctdb daemon will flood the log every 10 seconds. Instead of logging aggressively every 10 seconds, relax logging to every 100s and 1000s if the elapsed time has exceeded 100s and 1000s respectively. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Thu Mar 5 12:06:44 CET 2015 on sn-devel-104
* ctdb-tests: Correctly cascade test failures from the end of pipesAmitay Isaacs2015-03-052-3/+9
| | | | | | | | | | | | | Some eventscript unit test failures get lost because _passed=false is set in the tail of a pipe. Add a new function test_fail() and call it when necessary to ensure the value of _passed is set correctly. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Pair-programmed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Thu Mar 5 07:16:54 CET 2015 on sn-devel-104
* ctdb-scripts: Add a 'rm' stub so statd-callout tests work correctlyAmitay Isaacs2015-03-051-0/+6
| | | | | | | | | | statd-callout tries to remove global files from /var/lib/nfs/statd and this causes errors in tests. Add an rm stub that ignores attempts to remove these files but invokes /bin/rm for anything else. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Pair-programmed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-build: Specify absolute path to libsocket-wrapper.soAmitay Isaacs2015-03-041-1/+2
| | | | | | | | | | | | | Specifying a relative path to LD_PRELOAD can fail if any of the test scripts uses cd to change directory and execute commands. Adding statd-callout tests breaks autotest since statd-callout does "cd". Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Wed Mar 4 13:11:53 CET 2015 on sn-devel-104
* ctdb-tests: Remove the old, confusing INSTALL scriptMartin Schwenke2015-03-041-96/+0
| | | | | | | It is not used after switching to waf build. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Remove unused function nfs_statd_update()Martin Schwenke2015-03-041-17/+0
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Change statd-callout to be more scalableMartin Schwenke2015-03-0411-59/+123
| | | | | | | | | | | | | | | | Updating ctdb.tdb on each add-client, del-client and each delete during notify was too ambitious. Persistent transactions do not perform well enough to do this. Revert to having add-client and del-client create touch files. Each monitor event calls "statd-callout update" to convert touch files into ctdb.tdb records. Update testcases to do the "update" and add an extra test. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Fix a regression in statd-calloutMartin Schwenke2015-03-041-1/+1
| | | | | | | | | | | | | | | | Commit 4638010abb116aed0c180207aaa11475277aecb7 changed from using gensub() to gsub() in awk. However, it didn't halve the number of backslashes in the target strings. This is necessary because backslash is used in gensub() target strings to allow substitution of text matching parenthesised subexpressions. This is not the case with gsub(). So, halve the number of backslashes in the target string where gsub() is used in statd-callout. This is the only target string broken by changes made by the above commit Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Unit tests for statd-calloutMartin Schwenke2015-03-0411-13/+196
| | | | | | | | | With improvements to unit test infrastructure to support. This includes linking the real statd-callout into etc-ctdb/ in place of the placeholder script. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Make setup of public addresses more obviousMartin Schwenke2015-03-041-11/+28
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Extend eventscript unit test infrastructure for other scriptsMartin Schwenke2015-03-041-6/+19
| | | | | | | | There's so much infrastructure here that it would be a shame not to use it for testing things like statd-callout. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Support testing scripts that change directoryMartin Schwenke2015-03-042-0/+8
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Extend ctdb stub to support "ip" with and without -XMartin Schwenke2015-03-041-8/+20
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Extend ctdb stub to support "ptrans", "pdelete", "catdb"Martin Schwenke2015-03-041-14/+87
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-io: Do not use sys_write to write to client socketsAmitay Isaacs2015-02-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | When sending messages to clients, ctdb checks for EAGAIN error code and schedules next write in the subsequent event loop. Using sys_write in these places causes ctdb to loop hard till a client is able to read from the socket. With real time scheduling, ctdb daemon spins consuming 100% of CPU trying to write to the client sockets. This can be quite harmful when running under VMs or machines with single CPU. This regression was introduced when all read/write calls were replaced to use sys_read/sys_write wrappers (c1558adeaa980fb4bd6177d36250ec8262e9b9fe). The existing code backs off in case of EAGAIN failures and waits for an event loop to process the write again. This should give ctdb clients a chance to get scheduled and to process the ctdb socket. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Tue Feb 24 12:29:30 CET 2015 on sn-devel-104
* ctdb-scripts: Improve messages about invalid tunables during "setup"Martin Schwenke2015-02-182-5/+12
| | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Wed Feb 18 08:03:33 CET 2015 on sn-devel-104
* ctdb-tool: Print a warning when setting an obsolete tunable variableMartin Schwenke2015-02-183-0/+7
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-client: Return a value of 1 when setting obsolete tunable variableMartin Schwenke2015-02-182-2/+3
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: New tests for 00.ctdb "setup" event - set tunables from configMartin Schwenke2015-02-187-0/+109
| | | | | | | Unit test infrastructure tweaks to support. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Fix tunable setup code by making it shell-agnosticMartin Schwenke2015-02-181-3/+3
| | | | | | | | | | | | | | | | | | All tunables set in configuration are currently set to 0 on system where /bin/sh is dash (and perhaps other non-bash shells). dash puts single quotes around all values in the output of the "set" builtin command, whereas bash only puts them around values when something needs to be quoted. Tunables always have a simple integer value so dash will quote them and bash won't. The setup code currently passes the raw value, including any quotes to "ctdb setvar ...". This command does no error checking on the input, so "'1'" is converted to 0. Change the code so that the value is determined from the shell variable and is independent of the "set" output. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb: Change default debug level to NOTICE (2)Martin Schwenke2015-02-185-10/+8
| | | | | | | | | | | This was true for the daemon until commit b4589b954e1090a934fafd3f8e3c2cf1ed785c61. Defaulting to ERR in the ctdb CLI tool encourages logging notices at ERR level, so default to NOTICE instead. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb: server_id_get->server_id_fetchVolker Lendecke2015-02-131-3/+3
| | | | | | | | | | server_id_get with the next patch will be a global parsing function. I've decided to rename this here in ctdb, as it's only a static function in ctdb_client.c and apparently not intended for wider use. Please speak up if you don't like this :-) Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ctdb-recoverd: Abort when daemon can take recovery lock during recoveryMartin Schwenke2015-02-131-2/+4
| | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Fri Feb 13 09:48:15 CET 2015 on sn-devel-104
* ctdb-recoverd: Improve error messages on recovery lock coherence failMartin Schwenke2015-02-131-12/+14
| | | | | | | | | | | When the daemon is able to take the recovery lock during recovery we might as well guess that the cluster filesystem has a lock coherence problem and print a more useful message. This will be more helpful to those trying out cluster filesystems that don't have lock coherence or that are difficult to setup. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Don't release and re-take the recovery lockMartin Schwenke2015-02-131-20/+26
| | | | | | | | Just continue to hold it, otherwise a broken node might win an election and grab the lock. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Simplify ctdb_recovery_lock()Martin Schwenke2015-02-133-32/+22
| | | | | | | | | | | | | | Have it just silently take or fail to take the lock, except on an unexpected failure (where it should log an error). This means that when it is called we need to keep the old behaviour and explicitly release the lock. In do_recovery() the lock is released and a message is printed before attempting to take the lock. In the daemon sanity check the lock must be released in the error path if it is actually taken. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Remove check_recovery_lock()Martin Schwenke2015-02-131-179/+3
| | | | | | | | | This has not done anything useful since commit b9d8bb23af8abefb2d967e9b4e9d6e60c4a3b520. Instead, just check that the lock is held. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Improve logging when recovery lock file is changedMartin Schwenke2015-02-131-1/+5
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: New function ctdb_recovery_unlock()Martin Schwenke2015-02-133-19/+15
| | | | | | | | Unlock the recovery lock file. This way knowledge of the file descriptor isn't sprinkled throughout the code. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: New function ctdb_recovery_have_lock()Martin Schwenke2015-02-133-2/+8
| | | | | | | True if this recovery daemon holds the lock. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Log a warning when setting obsolete tunablesMartin Schwenke2015-02-131-0/+6
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Mark tunable VerifyRecoveryLock as obsoleteMartin Schwenke2015-02-136-36/+37
| | | | | | | | | | | | | | | It is pointless having a recovery lock but not sanity checking that it is working. Also, the logic that uses this tunable is confusing. In some places the recovery lock is released unnecessarily because the tunable isn't set. Simplify the logic by assuming that if a recovery lock is specified then it should be verified. Update documentation that references this tunable. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-doc: Improve documentation of the recovery lockMartin Schwenke2015-02-133-8/+68
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add new "ctdb setreclock" testMartin Schwenke2015-02-041-0/+117
| | | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Wed Feb 4 05:40:55 CET 2015 on sn-devel-104
* ctdb-daemon: Fix SET_RECLOCK_FILE regressionMartin Schwenke2015-02-041-1/+2
| | | | | | | | | If the recovery lock file is unset then this dereferences a NULL pointer. The regression is due to commit 6f1ac7af0f87d85402d708231e45a69713bba026. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Call iptables/ip6tables directly from iptables_wrapperMartin Schwenke2015-01-282-12/+8
| | | | | | | | | | | | | | | | | | | | | | Drops the iptables() and ip6tables() functions and, hence, the hardcoding of paths /sbin/iptables and /sbin/ip6tables. The latter avoids problems on openSUSE where (for example) /usr/sbin/iptables is used instead. This means that locking around ip*tables commands is only done when iptables_wrapper is called directly. This is fine because the only conflict is when "releaseip" or "takeip"/"updateip" events are run in parallel. The other uses in 11.natgw and 70.iscsi are in events where there will be no collisions. Making 11.natgw support IPv6 is unnecessary. Just put a static IPv6 address on each interface - they're plentiful. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Wed Jan 28 08:29:55 CET 2015 on sn-devel-104
* ctdb-scripts: Error message, comment and whitespace cleanupsMartin Schwenke2015-01-281-8/+10
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: iSCSI eventscript should fail when PNN can't be determinedMartin Schwenke2015-01-281-4/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Make 70.iscsi IPv6-awareMartin Schwenke2015-01-281-5/+29
| | | | | | | | | | | | Block iSCSI port for families of all address the node is configured to host. Could just unconditional add blocking using ip6tables instead. However, this would produce errors when no IPv6 public addresses are configured and ip6tables is not installed. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb: improve helpfulness of debug message when taking reclock failsMichael Adam2015-01-091-1/+5
| | | | | | | | | | Print out the errno if the fcntl call. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Richard Sharpe <rsharpe@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Fri Jan 9 04:25:02 CET 2015 on sn-devel-104
* ctdb-daemon: Handle out-of-memory when setting recovery lock fileMartin Schwenke2015-01-091-8/+26
| | | | | | | | Log a message when the reclock file actually changes and avoid a memory allocation when it doesn't change. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-scripts: Don't use the GNU awk gensub() functionMartin Schwenke2015-01-094-7/+11
| | | | | | | | | | | | | This is a gawk extension and can't be used reliably if just running "awk". It is simple enough to switch to using the standard sub() and gsub() functions. The alternative is to switch to explicitly running "gawk". However, although the eventscripts aren't exactly portable, it is probably better to move closer to portability than further away. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-scripts: Try to deal with Ubuntu having /usr/sbin/serviceMartin Schwenke2015-01-091-0/+2
| | | | | | | | | Falling back to running the initscript doesn't work because it detects that upstart is being used and fails. This was observed when trying to start winbind on Ubuntu 11.04. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-tests: Fix tickle sniffing for IPv4Martin Schwenke2015-01-091-1/+1
| | | | | | | | | | | | tcptickle_sniff_start() assumes that if $dst contains a ': then it should use the IPv6 sniffing code. However, $dst is a socket, so has a trailing ":<port>". Strip the trailing ":<port>" before checking for ':' as a marker for an IPv6 address. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-scripts: Fix bashism in ctdbd_wrapper scriptLed2015-01-091-1/+1
| | | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11007 Signed-off-by: Oleksandr Chumachenko <ledest@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-daemon: Use correct tdb flags when enabling robust mutex supportAmitay Isaacs2014-12-194-22/+70
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=11000 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ctdb/server: add format string checking to ctdb_tevent_logging()Stefan Metzmacher2014-12-171-1/+5
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-build: fix build without xsltprocBjörn Baumbach2014-12-151-3/+4
| | | | | | | | Check for XSLTPROC_MANPAGES before trying to build the docs. Signed-off-by: Björn Baumbach <bb@sernet.de> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-build: Fix the installation of config files for top-level buildAmitay Isaacs2014-12-151-2/+7
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>