summaryrefslogtreecommitdiff
path: root/ctdb
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-tests: Add some tool unit tests to ensure that timeouts workMartin Schwenke2020-02-103-0/+75
| | | | | | | | 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): Mon Feb 10 05:34:08 UTC 2020 on sn-devel-184
* ctdb-tools: Allow shorter runtime limit to be specifiedMartin Schwenke2020-02-101-4/+0
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tools: When in test mode set process group in top-level ctdb toolMartin Schwenke2020-02-101-0/+11
| | | | | | | | | | If ctdbd hangs when shutting down in post-test clean-up then killing the process group can kill the test. When in test mode, create a process group but only in the top-level ctdb tool - the natgw and lvs helpers also run the ctdb tool. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Use $PWD/bin/ if it exists when running in-treeMartin Schwenke2020-02-101-6/+27
| | | | | | | | When running tests from a top-level build, a stale build in ctdb/bin/ will be preferred and may cause confusing results. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Make $ctdb_dir absoluteMartin Schwenke2020-02-101-2/+2
| | | | | | | This is used to set several variables so it might as well be cd-proof. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Fork when not interactive and test mode is enabledMartin Schwenke2020-02-102-3/+27
| | | | | | | | | | | | | There is no sane way of keeping stdin open when using the shell to background ctdbd in local_daemons.sh. Instead, have ctdbd fork when not interactive and when test mode is enabled. become_daemon() can't be used for this: if it forks then it also closes stdin. For the interactive case, become_daemon() wasn't doing anything special, so do nothing instead. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Make some conditions more explicitMartin Schwenke2020-02-101-2/+2
| | | | | | | | | These don't need to depend on do_fork. Child logging should be set up whenever the daemon is not interactive. The stdin handler should be setup whenever test mode is enabled. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Pass more information to ctdb_start_daemon()Martin Schwenke2020-02-103-6/+8
| | | | | | | | | | No functional changes. This is staging for a change that makes ctdbd fork when test mode is enabled but interactive is not set. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Don't actually close stdin in fake sshMartin Schwenke2020-02-101-1/+1
| | | | | | | | A subsequent file descriptor allocation may return 0 and unexpected things may then happen. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Redirect stdin from /dev/null when running a testMartin Schwenke2020-02-101-1/+1
| | | | | | | | Otherwise, if the test is run via ssh it will "unexpectedly" find itself at the other end of a pipe. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* Revert "ctdb-tests: Enable job control when keeping stdin open"Martin Schwenke2020-02-101-1/+1
| | | | | | | | | This doesn't work when stdin is not a tty. This reverts commit ea754bfdec9d537c500036d4d521bd41d34c0835. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-test: Fix a typoVolker Lendecke2020-01-301-1/+1
| | | | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Jan 30 13:53:22 UTC 2020 on sn-devel-184
* ctdb-tests: Enable job control when keeping stdin openMartin Schwenke2020-01-281-1/+1
| | | | | | | | | | | | | | | | | | | | POSIX says: If job control is disabled (see set, -m), the standard input for an asynchronous list, before any explicit redirections are performed, shall be considered to be assigned to a file that has the same properties as /dev/null. This shall not happen if job control is enabled. In all cases, explicit redirection of standard input shall override this activity. ctdbd is backgrounded at startup, so the above causes stdin to be redirected from /dev/null. Enable job control to work around this. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Tue Jan 28 11:24:35 UTC 2020 on sn-devel-184
* ctdb-tests: Don't close stdin when starting local daemonsMartin Schwenke2020-01-281-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Shut down if interactive and stdin is closedMartin Schwenke2020-01-281-0/+59
| | | | | | | | | This allows a test environment to simply close its end of a pipe to cleanly shutdown ctdbd. Like in smbd, this is only done if stdin is a pipe or a socket. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Only stop monitoring if it has been initialisedMartin Schwenke2020-01-281-2/+6
| | | | | | | | | | This avoids a crash if ctdb_shutdown_sequence() is called before monitoring is initialised. Switch to using TALLOC_FREE() while touching this function. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-mutex: Change default re-check time for fcntl helper to 5sMartin Schwenke2020-01-211-1/+1
| | | | | | | | Testing against a commonly used cluster filesystem has shown no performance impact, as expected. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add some tests to check recovery from recovery lock issuesMartin Schwenke2020-01-212-0/+164
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Put recovery lock for local daemons into a subdirectoryMartin Schwenke2020-01-211-1/+3
| | | | | | | | This makes it more like the way it works with a cluster filesystem. It also allows the subdirectory to be manipulated in tests. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add local_daemons.sh option for recovery lock recheck intervalMartin Schwenke2020-01-211-2/+11
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdbd: Use struct initializationVolker Lendecke2020-01-191-3/+1
| | | | | | | 2 lines less Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* ctdb-tests: Skip some tests that don't work with IPv6Martin Schwenke2020-01-032-0/+18
| | | | | | | | | | | | | | | See the comments added to the tests. It may be possible to rewrite these so they do something sane for IPv6... some other time. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14227 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 Jan 3 00:00:55 UTC 2020 on sn-devel-184
* ctdb-scripts: Strip square brackets when gathering connection infoMartin Schwenke2020-01-021-0/+6
| | | | | | | | | | | | | | | | | | ss added square brackets around IPv6 addresses in versions > 4.12.0 via commit aba9c23a6e1cb134840c998df14888dca469a485. CentOS 7 added this feature somewhere mid-release. So, backward compatibility is obviously needed. As per the comment protocol/protocol_util.c should probably print and parse such square brackets. However, for backward compatibility the brackets would have to be stripped in both places in update_tickles()... or added to the ss output when missing. Best to leave this until we have a connection tracking daemon. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14227 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Add tests for cmdline_add() apiAmitay Isaacs2019-11-142-0/+113
| | | | | | | | 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): Thu Nov 14 12:03:46 UTC 2019 on sn-devel-184
* ctdb-common: Add api to add new section/commands to cmdlineAmitay Isaacs2019-11-142-0/+20
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-common: Change cmdline implementation to support multiple sectionsAmitay Isaacs2019-11-141-33/+101
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tests: Update cmdline tests for section nameAmitay Isaacs2019-11-142-4/+4
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-common: Add section to group commands in cmdlineAmitay Isaacs2019-11-147-13/+78
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-common: Generate usage message from cmdline_parse()Amitay Isaacs2019-11-143-24/+34
| | | | | | | | If any of the option parsing or command parsing fails, generate usage message. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tcp: Simplify freeing of transport data on shutdownMartin Schwenke2019-11-141-4/+1
| | | | | | | | | | The type-checking is superfluous and gets in the way of readability. 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): Thu Nov 14 03:45:44 UTC 2019 on sn-devel-184
* ctdb-daemon: Rename ctdb_context private_data to transport_dataMartin Schwenke2019-11-144-11/+14
| | | | | | | This gives a casual reader a useful clue. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Rename ctdb_node private_data to transport_dataMartin Schwenke2019-11-146-17/+23
| | | | | | | This gives a casual reader a useful clue. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tcp: Close inflight connecting TCP sockets after forkVolker Lendecke2019-11-141-0/+6
| | | | | | | | | | | | | | | | | | | | | | | Commit c68b6f96f26 changed the talloc hierarchy such that outgoing TCP sockets while sitting in the async connect() syscall are not freed via ctdb_tcp_shutdown() anymore, they are hanging off a longer-running structure. Free this structure as well. If an outgoing TCP socket leaks into a long-running child process (possibly the recovery daemon), this connection will never be closed as seen by the destination node. Because with recent changes incoming connections will not be accepted as long as any incoming connection is alive, with that socket leak into the recovery daemon we will never again be able to successfully connect to the node that is affected by this leak. Further attempts to connect will be discarded by the destination as long as the recovery daemon keeps this socket alive. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175 RN: Avoid communication breakdown on node reconnect Signed-off-by: Martin Schwenke <martin@meltin.net> Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ib: Fix build errors for infiniband transportAmitay Isaacs2019-11-132-3/+2
| | | | | | | | 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): Wed Nov 13 13:31:10 UTC 2019 on sn-devel-184
* build: Remove workaround for missing os.path.relpath in Python < 2.6Andrew Bartlett2019-11-131-1/+1
| | | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: David Mulder <dmulder@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org>
* ctdb: Use TALLOC_FREE() in a few placesVolker Lendecke2019-11-082-10/+5
| | | | | | | | | | We have a macro for NULLing out the pointer Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Fri Nov 8 01:35:11 UTC 2019 on sn-devel-184
* ctdb-tests: Make process exists test more resilientMartin Schwenke2019-11-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This can fail as follows: --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- Running test ./tests/UNIT/tool/ctdb.process-exists.003.sh (02:26:30) --==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==--==-- ctdb.process-exists.003 - ctdbd process with multiple connections on node 0 Setting up fake ctdbd <10||0| OK <10|PID 26107 exists |0| OK ================================================== Running "ctdb -d NOTICE process-exists 26107 0x1234567812345678" PASSED ================================================== Running "ctdb -d NOTICE process-exists 26107 0xaebbccdd12345678" Registered SRVID 0xaebbccdd12345678 -------------------------------------------------- Output (Exit status: 1): -------------------------------------------------- PID 26107 with SRVID 0xaebbccdd12345678 does not exist -------------------------------------------------- Required output (Exit status: 0): -------------------------------------------------- PID 26107 with SRVID 0xaebbccdd12345678 exists FAILED connection to daemon closed, exiting ========================================================================== TEST FAILED: ./tests/UNIT/tool/ctdb.process-exists.003.sh (status 1) (duration: 0s) ========================================================================== This happens when dummy_client has not registered the SRVID (for its 10th connection) before the 2nd simple_test. Change the initial wait to ensure that the SRVID is registered. 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 Nov 6 02:46:24 UTC 2019 on sn-devel-184
* ctdb-tests: Improve code quality in ctdb_init()Martin Schwenke2019-11-061-7/+9
| | | | | | | | Improve quoting and indentation. Print a clear error if the cluster goes back into recovery and doesn't come back out. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: No longer retry starting the clusterMartin Schwenke2019-11-061-30/+4
| | | | | | | | Retrying like this hides bugs. The cluster should come up first time, every time. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tcp: Drop tracking of file descriptor for incoming connectionsMartin Schwenke2019-11-064-11/+0
| | | | | | | | | | | This file descriptor is owned by the incoming queue. It will be closed when the queue is torn down. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175 RN: Avoid communication breakdown on node reconnect Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tcp: Avoid orphaning the TCP incoming queueMartin Schwenke2019-11-061-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CTDB's incoming queue handling does not check whether an existing queue exists, so can overwrite the pointer to the queue. This used to be harmless until commit c68b6f96f26664459187ab2fbd56767fb31767e0 changed the read callback to use a parent structure as the callback data. Instead of cleaning up an orphaned queue on disconnect, as before, this will now free the new queue. At first glance it doesn't seem possible that 2 incoming connections from the same node could be processed before the intervening disconnect. However, the incoming connections and disconnect occur on different file descriptors. The queue can become orphaned on node A when the following sequence occurs: 1. Node A comes up 2. Node A accepts an incoming connection from node B 3. Node B processes a timeout before noticing that outgoing the queue is writable 4. Node B tears down the outgoing connection to node A 5. Node B initiates a new connection to node A 6. Node A accepts an incoming connection from node B Node A processes then the disconnect of the old incoming connection from (2) but tears down the new incoming connection from (6). This then occurs until the originally affected node is restarted. However, due to the number of outgoing connection attempts and associated teardowns, this induces the same behaviour on the corresponding incoming queue on all nodes that node A attempts to connect to. Therefore, other nodes become affected and need to be restarted too. As a result, the whole cluster probably needs to be restarted to recover from this situation. The problem can occur any time CTDB is started on a node. The fix is to avoid accepting new incoming connections when a queue for incoming connections is already present. The connecting node will simply retry establishing its outgoing connection. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tcp: Check incoming queue to see if incoming connection is upMartin Schwenke2019-11-061-1/+1
| | | | | | | | | | This makes it consistent with the reverse case. Also, in_fd will soon be removed. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14175 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb/utils/smnotify/smnotify.c: typo fixesBjörn Jacke2019-10-311-5/+5
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb/utils/scsi_io/scsi_io.c: typo fixesBjörn Jacke2019-10-311-10/+10
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb/server/ctdb_daemon.c: typo fixesBjörn Jacke2019-10-311-4/+4
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb/server/ctdb_client.c: typo fixesBjörn Jacke2019-10-311-3/+3
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb/server/ctdb_call.c: typo fixesBjörn Jacke2019-10-311-3/+3
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb/include/ctdb_private.h: typo fixesBjörn Jacke2019-10-311-1/+1
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb/ib/ibwrapper_test.c: typo fixesBjörn Jacke2019-10-311-1/+1
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb/ib/ibw_ctdb.c: typo fixesBjörn Jacke2019-10-311-1/+1
| | | | | Signed-off-by: Bjoern Jacke <bjacke@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>