summaryrefslogtreecommitdiff
path: root/ctdb/wscript
AgeCommit message (Collapse)AuthorFilesLines
2026-02-25ctdb-daemon: Remove helper variable CTDB_CLUSTER_MUTEX_HELPERMartin Schwenke1-0/+1
Use path_helperdir() to help construct the path and then cache the result in the existing static buffer (with length adjusted because POSIX says the +1 is not necessary). Given the way this is used by cluster_mutex_test, there is no (other) sane place to cache it. path_helperdir_append() could be used to construct the path, but then there would be an unnecessary talloc() result to free. The flexibility in unit test cluster_mutex_003.sh was never used, so remove this test. If other cluster mutex helpers are added then they can be tested by separate tests. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-25ctdb-build: Store generator rules in variablesMartin Schwenke1-14/+14
This improves readability and maintainability. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-25ctdb-build: Ensure generated scripts are executable and symlinkedMartin Schwenke1-8/+22
Ensure that all generated scripts are executable. All of the generated scripts (except test harnesses ctdb_run_tests, ctdb_local_daemons) also need to be linked into the bin/ directory so they can be more easily run during self-test. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2026-02-20ctdb-wscript: support building ctdb command with janssonJohn Mulligan1-1/+3
Pair-Programmed-With: Shachar Sharon <ssharon@redhat.com> Signed-off-by: Shachar Sharon <ssharon@redhat.com> Signed-off-by: John Mulligan <jmulligan@redhat.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Anoop C S <anoopcs@samba.org>
2025-09-08ctdb: fix build against PCP 7.0.0Alexander Bokovoy1-10/+11
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15904 Signed-off-by: Alexander Bokovoy <ab@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Mon Sep 8 04:47:37 UTC 2025 on atb-devel-224
2024-10-08ctdb-build: Add missing ctdb-tcp dependencyAnoop C S1-0/+1
Since 02c9e7a63f00998bb0dae2e8c6bd8e020e9408da, common/path.h is included within ctdb/tcp/tcp_connect.c. Therefore add ctdb-util as a dependency for ctdb-tcp. Signed-off-by: Anoop C S <anoopcs@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Tue Oct 8 12:27:17 UTC 2024 on atb-devel-224
2024-10-07ctdb-tcp: Only attempt to automatically bind to local IPsMartin Schwenke1-1/+7
Automatic node address selection in the TCP transport does not work if net.ipv4.ip_nonlocal_bind=1 because all nodes will be able to bind() to the first address in the nodes list. Before getting to the bind() step, add a check to see if an address is local (i.e. on an interface). If not, it is not considered. This is defensively coded so that this step is skipped if local addresses can not be retrieved. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: John Mulligan <jmulligan@redhat.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2024-10-07ctdb-common: Add functions for local IP address checkingMartin Schwenke1-1/+9
This is a wrapper around getifaddrs(2), which is in libreplace, so should always be available. Some users want to set net.ipv4.ip_nonlocal_bind = 1. So, CTDB needs a way of testing if public IPs are present, without using bind(2). Doing all of this unconditionally in ctdb_sys_have_ip() will be inefficient in the recovery daemon's local IP verification if there are a lot of IP addresses. Split it this way so the interface information can be retrieved once and used multiple times. This doesn't appear to need IP canonicalisation for IPv4-mapped IPv6 addresses. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: John Mulligan <jmulligan@redhat.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2024-08-29ctdb-scripts: Add support for backing up persistent TDBsMartin Schwenke1-0/+1
Signed-off-by: Vinit Agnihotri <vagnihotri@ddn.com> Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2024-08-29ctdb-scripts: Move database handling to its own event scriptMartin Schwenke1-0/+1
Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2024-08-29ctdb-scripts: Use nfs-utils' sm-notify instead of CTDB's smnotifyMartin Schwenke1-24/+0
CTDB's smnotify does not support IPv6 and is difficult to maintain. So, create directories of files and pass them to NFS util's sm-notify. There is an implied change here, because NFS utils sm-notify stopped sending IP addresses as mon_name back in 2010: http://git.linux-nfs.org/?p=steved/nfs-utils.git;a=commitdiff;h=900df0e7c0b9006d72d8459b30dc2cd69ce495a5 This will change advice given in the wiki to use a hostname for the cluster with round-robin DNS, since this is what is best supported. Another behavioural change is that sm-notify only sends "up" notifications with an odd state. Signed-off-by: Martin Schwenke <martin@meltin.net> Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2024-08-29ctdb-failover: Add ctdb_smnotify_helperMartin Schwenke1-0/+5
statd callout will shortly be updated to use NFS utils' sm-notify. This tiny helper will be used to create on-disk state files used by sm-notify. These state files contain endian-specific fields, so better to write a simple C implementation than to do crazy things in a shell script (or call out to Python). Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2024-08-20ctdb-tcp: Remove a use of ctdb_addr_to_str()Martin Schwenke1-1/+1
This one is in a rarely used error path, so call a function that talloc()s the string instead. Again, this will also print the port, which might be useful if we ever add the ability to also specify ports in the nodes list. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Aug 20 14:24:14 UTC 2024 on atb-devel-224
2024-08-06ctdb-tools: update cli tool to optionally load nodes from commandJohn Mulligan1-0/+1
Similar to the recent changes to the ctdb server code, add the ability to load the nodes from a subprocess stdout. Signed-off-by: John Mulligan <jmulligan@redhat.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
2024-07-23ctdb-daemon: Use ctdb_read_nodes() in ctdbdMartin Schwenke1-3/+15
ctdb_control_getnodesfile() calls ctdb_read_nodes(), which returns a struct ctdb_node_map rather than the old version, so update associated marshalling. While here modernise a debug message and wrap the function arguments. For ctdb_load_nodes_file() to use ctdb_read_nodes(), tweak convert_node_map_to_list() to also use the modern node map structure. Remove unused copy of ctdb_read_nodes_file(). Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2024-07-23ctdb-tests: Use ctdb_read_nodes() in the fake ctdbdMartin Schwenke1-3/+9
Remove unused copy of ctdb_read_nodes_file(). Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2024-07-23ctdb-tools: Use ctdb_read_nodes() in the ctdb toolMartin Schwenke1-2/+10
Remove unused copy of ctdb_read_nodes_file(). Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2024-07-23ctdb-conf: Add a common node address handling moduleMartin Schwenke1-0/+10
These functions are intended to be used in ctdbd, the ctdb tool and fake_ctdbd, replacing the different copies in each place. ctdb_read_nodes() will replace ctdb_read_nodes_file(). The name change is intentional - in future the location may be something other than a simple filename. The static copies of ctdb_read_nodes_file() and node_map_add() are slightly sanitised versions of those in tools/ctdb.c, with a call to ctdb_parse_node_address(). A bit more care is taken in node_map_add() to avoid undefined behaviour if talloc_realloc() fails. ctdb_parse_node_address() will replace ctdb_parse_address(). There is an obvious argument change, since the ctdb context argument was unused. It can only fail on an invalid node address, so return a bool. This function might be changed later to allow the input address string to include an optional port. Where to put this module isn't entirely clear. It could go in common, so be part of ctdb-util. However, if it later needs ctdb-conf (e.g. to allow the node list location to be configurable) then there would be a direct cyclic dependency. This is configuration handling, so conf/ seems sane. However, I didn't want to put it into the ctdb-conf target, since some code might need to parse a nodes list but not need to parse ctdb.conf. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2024-07-23ctdb-build: Remove unused dependencies on ctdb-utilMartin Schwenke1-2/+2
Since commit ba8f8ef33cd99ea60fc2682727a5497995b5f569. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Anoop C S <anoopcs@samba.org>
2024-07-02ctdb/wscript: Remove long pending unsupported optionAnoop C S1-8/+0
It has been a while since --with-libcephfs option was dropped. Therefore stop advertising it through waf scripts. Signed-off-by: Anoop C S <anoopcs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Jul 2 09:13:20 UTC 2024 on atb-devel-224
2024-06-28ctdb-conf: Move conf.[ch] to conf/ subdirectoryMartin Schwenke1-2/+2
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Guenther Deschner <gd@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2024-06-28ctdb-conf: Move all conf files to new conf/ subdirectoryMartin Schwenke1-38/+14
Leave common/conf.[ch] where they are to make this commit comprehensible. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Guenther Deschner <gd@samba.org> Reviewed-by: Anoop C S <anoopcs@samba.org>
2024-06-25ctdb-failover: Split statd_callout add-client/del-clientMartin Schwenke1-1/+14
rpc.statd is single-threaded and runs its HA callout synchronously. If it is too slow then latency accumulates and rpc.statd's backlog grows. Running a pair of add-client/del-client events with the current code averages ~0.030s in my test environment. This mean that 1000 clients reclaiming locks after failover can easily cause 10s of latency. This could cause rpc.statd to become unresponsive, resulting in a time out for an rpcinfo-based health check of the status service. Split the add-client/del-client events out to a standalone statd_callout executable, written in C, to be used as the HA callout for rpc.statd. All other functions move to statd_callout_helper. Now, running a pair of add-client/del-client events in my test environment averages only ~0.002s. This seems less likely to cause latency problems. The standalone statd_callout executable needs to read a configuration file, which is generated by statd_callout_helper from the "startup" event. It also needs access to a list of currently assigned public IPs. For backward compatibility, during installation a symlink is created from $CTDB_BASE/statd-callout to the new statd_callout, which is installed in the helper directory. Testing this as part of the eventscript unit tests starts to become even more of a hack than it used to be. However, the dependency on stubs and the corresponding setup of fake state makes it hard to move this elsewhere. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Martin Schwenke <martins@samba.org> Autobuild-Date(master): Tue Jun 25 04:24:57 UTC 2024 on atb-devel-224
2024-05-30ctdb-scripts: No longer run statd-callout under sudoMartin Schwenke1-7/+0
This simplifies and removes a bad hack. Also, in my test environment, it also drops the average time take to run an add-client/del-client pair from ~0.055s to ~0.030s. Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Volker Lendecke <vl@samba.org>
2024-04-16ctdb: Remove common/line.[ch]Volker Lendecke1-2/+0
This was an implementation of getline(3), use that instead. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Martin Schwenke <mschwenke@ddn.com>
2023-08-15ctdb-common: Set immediate mode for pcap captureMartin Schwenke1-0/+1
Fix a problem where ctdb_killtcp (almost always) fails to capture packets with --enable-pcap and libpcap ≥ 1.9.1. The problem is due to a gradual change in libpcap semantics when using pcap_get_selectable_fd(3PCAP) to get a file descriptor and then using that file descriptor in non-blocking mode. pcap_set_immediate_mode(3PCAP) says: pcap_set_immediate_mode() sets whether immediate mode should be set on a capture handle when the handle is activated. In immediate mode, packets are always delivered as soon as they arrive, with no buffering. and On Linux, with previous releases of libpcap, capture devices are always in immediate mode; however, in 1.5.0 and later, they are, by default, not in immediate mode, so if pcap_set_immediate_mode() is available, it should be used. However, it wasn't until libpcap commit 2ade7676101366983bd4f86bc039ffd25da8c126 (before libpcap 1.9.1) that it became a requirement to use pcap_set_immediate_mode(), even with a timeout of 0. More explanation in this libpcap issue comment: https://github.com/the-tcpdump-group/libpcap/issues/860#issuecomment-541204548 Do a configure check for pcap_set_immediate_mode() even though it has existed for 10 years. It is easy enough. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15451 Signed-off-by: Martin Schwenke <mschwenke@ddn.com> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Tue Aug 15 10:53:52 UTC 2023 on atb-devel-224
2022-09-20ctdb-build: Add --enable-pcap configure optionMartin Schwenke1-1/+6
This forces the use pcap for packet capture on Linux. It appears that using a raw socket for capture does not work with infiniband - pcap support for that to come. Don't (yet?) change the default capture method to pcap. On some platforms (e.g. my personal Intel NUC, running Debian testing), pcap is much less reliable than the raw socket. However, pcap seems fine on most other platforms. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-09-20ctdb-build: Use pcap-config when availableMartin Schwenke1-0/+6
The build currently fails on AIX, which can't find the pcap headers because they're installed in a non-standard place. However, there is a pcap-config script available. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-07-28ctdb-mutex: Do inode checks in a child processMartin Schwenke1-1/+1
In future this will allow extra I/O tests and a timeout in the parent to (hopefully) release the lock if the child gets wedged. For simplicity, use tmon only to detect when either parent or child goes away. Plumbing a timeout for pings from child to parent will be done later. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-07-28ctdb-tests: Add tests for trivial FD monitoringMartin Schwenke1-0/+18
tmon_ping_test covers complex 2-way interaction between processes using tmon_ping_send(), including via a socketpair(). tmon_test covers the more general functionality of tmon_send() but uses a simpler 1-way harness with wide coverage. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-07-28ctdb-common: Add trivial FD monitoring abstractionMartin Schwenke1-2/+11
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-07-28ctdb-build: Link in backtrace support for ctdb_util_testsMartin Schwenke1-2/+10
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-07-28ctdb-build: Separate test backtrace support into separate subsystemMartin Schwenke1-3/+8
A convention when testing members of ctdb-util is to include the .c file so that static functions can potentially be tested. This means that such tests can't be linked against ctdb-util or duplicate symbols will be encountered. ctdb-tests-common depends on ctdb-client, which depends in turn on ctdb-util, so this can't be used to pull in backtrace support. Instead, make ctdb-tests-backtrace its own subsystem. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-07-28ctdb-build: Sort sources in ctdb-util and ctdb_unit_testsMartin Schwenke1-19/+30
Also, rename ctdb_unit_tests to ctdb_util_tests. The sorting makes it clear that only items from ctdb-util are tested here. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-07-22ctdb-build: Add missing dependency on tallocMartin Schwenke1-1/+1
The include isn't strictly necessary, since it is included via common/reqid.c anyway. However, it is a useful hint. 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 Jul 22 17:01:00 UTC 2022 on sn-devel-184
2022-05-03ctdb-tests: Add backtrace on abort to some testsMartin Schwenke1-2/+10
These are easier to debug with a backtrace. 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 May 3 10:13:23 UTC 2022 on sn-devel-184
2022-05-03ctdb-tests: Provide a method to dump the stack on abortMartin Schwenke1-1/+4
Some tests make generous use of assert() and it can be difficult to guess the cause of failures without resorting to GDB. This provides some help. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-05-03build: Add missing ctdb-client dependenciesMartin Schwenke1-2/+16
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-05-03ctdb-build: Drop unnecessary uses of include/ sub-directoryMartin Schwenke1-6/+0
None of these include any files from the include/ sub-directory. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-04-06ctdb-scripts: Drop unused ctdbd_wrapperMartin Schwenke1-8/+0
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-04-06ctdb-tests: Add unit tests for tunables codeMartin Schwenke1-0/+1
This aims to test ctdb_tunable_load_file() but also exercises ctdb_tunable_names() and ctdb_tunable_get_value(). ctdb_tunable_set_value() is indirectly exercised via ctdb_tunable_load_file(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2022-02-23ctdb-tests: Dump a stack trace on abortMartin Schwenke1-1/+1
Debugging a test failure here without GDB is not possible. Dumping a stack trace gives a good hint. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2021-05-28ctdb-utils: Add tdb_mutex_check utilityAmitay Isaacs1-0/+17
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
2020-09-11ctdb: Prevent man page duplicationDavid Mulder1-1/+1
The new waf detects a duplicate instance of ctdb_mutex_ceph_rados_helper.7.xml, which is due to manpages_extra being a pointer to manpages_misc, therefore each call to build() added duplicate entries to the manpages_misc global entry. Signed-off-by: David Mulder <dmulder@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2020-07-22ctdb-build: Don't build/install tests in top-level build by defaultMartin Schwenke1-0/+7
The standalone build still includes tests, as does the top-level build when --enable-selftest is used. The latter is consistent with the use of --enable-selftest in the rest of the tree. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-07-22Revert "ctdb-build: Don't build/install tests in top-level build by default"Martin Schwenke1-7/+0
Fix missing Reviewed-by: tag. This reverts commit 91c36c16c8516359380a00ee3d2229422b048d9f. 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): Wed Jul 22 06:29:43 UTC 2020 on sn-devel-184
2020-07-22ctdb-build: Don't build/install tests in top-level build by defaultMartin Schwenke1-0/+7
The standalone build still includes tests, as does the top-level build when --enable-selftest is used. The latter is consistent with the use of --enable-selftest in the rest of the tree. Signed-off-by: Martin Schwenke <martin@meltin.net>
2020-05-22ctdb-build: Fix a typoMartin Schwenke1-1/+1
Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2020-05-06ctdb-build: Add messages_dgm build to ctdbAmitay Isaacs1-0/+4
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Amitay Isaacs <amitay@samba.org> Autobuild-Date(master): Wed May 6 01:47:16 UTC 2020 on sn-devel-184
2020-05-06lib/util: Build genrand for util coreAmitay Isaacs1-0/+4
messages_dgm depends on genrand. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>