summaryrefslogtreecommitdiff
path: root/ctdb
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-docs: Provide example commands for "ctdb event ..."Martin Schwenke2020-02-181-2/+4
| | | | | | | | | | | | The example output doesn't tell a user what command generated it. Adding the command makes the examples much more useful. Reported-by: Stefan Kania <stefan@kania-online.de> 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): Tue Feb 18 04:22:56 UTC 2020 on sn-devel-184
* ctdb-tests: Flag setup, startup, shutdown failures as test errorsMartin Schwenke2020-02-181-3/+3
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Dump logs on shutdown failureMartin Schwenke2020-02-181-4/+21
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Avoid shutdown error when daemon already cleanly shut downMartin Schwenke2020-02-181-1/+4
| | | | | | | | | This depends on a small amount of internal knowledge but is the cleanest way of avoiding errors for nodes that have already been shut down. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Rationalise node stop/start/restartMartin Schwenke2020-02-186-50/+30
| | | | | | | | | | | | | Separate functions are not needed for stopping/starting/restarting individual nodes. The stop and start functions essentially just use onnode, though for local daemons this is embedded in local_daemons.sh. So, just provide one stop and one start function that takes an optional nodespec, defaulting to all nodes. Restarting becomes common. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Fix signed/unsigned comparisonMartin Schwenke2020-02-181-1/+1
| | | | | | | | | | csbuild says: ctdb/server/ctdb_lock.c: scope_hint: In function ‘ctdb_find_lock_context’ ctdb/server/ctdb_lock.c:671:33: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare] Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Check for lock count underflowMartin Schwenke2020-02-181-0/+3
| | | | | | | This is a programming error. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-common: Remove signed/unsigned comparisonsAmitay Isaacs2020-02-181-5/+5
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tests: Fix getdbmap test so that it actually works sanelyMartin Schwenke2020-02-121-3/+8
| | | | | | | | | | | | * Typo in variable name db_map_pattern * Variable num_db_init used before set * dbmap_pattern does not cover database flags 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 12 04:38:47 UTC 2020 on sn-devel-184
* ctdb-tests: Fix handling of --no-event-scripts optionMartin Schwenke2020-02-121-4/+4
| | | | | | | | Shellcheck noticed that pnn was never referenced. Not sure this ever worked or whether it got broken somewhere along the way. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Use a here document to improve readabilityMartin Schwenke2020-02-121-3/+4
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Use select_test_node()Martin Schwenke2020-02-122-3/+2
| | | | | | | select_test_node_and_ips() is not required in these cases. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Increase to dumping up to 500 lines of logs on errorMartin Schwenke2020-02-121-1/+1
| | | | | | | 100 lines are not enough to debug a current issue. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Fix return value of DB test tool delete commandMartin Schwenke2020-02-121-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tcp: Make error handling for outbound connection consistentMartin Schwenke2020-02-121-19/+17
| | | | | | | | | | | | | | | | | | | | If we can't bind the local end of an outgoing connection then something has gone wrong. Retrying is better than failing into a zombie state. The interface might come back up and/or the address my be reconfigured. While here, do the same thing for the other (potentially transient) failures. The unknown address family failure is special but just handle it via a retry. Technically it can't happen because the node address parsing can only return values with address family AF_INET or AF_INET6. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14274 Reported-by: 耿纪超 <gengjichao@jd.com> Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* 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>