summaryrefslogtreecommitdiff
path: root/ctdb
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-recoverd: Broadcast takeover run message when verifying IPsMartin Schwenke2020-08-181-3/+5
| | | | | | | | | | | This makes it consistent with the monitoring code. If the master has changed then this means the master will always get the message. 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 Aug 18 06:24:11 UTC 2020 on sn-devel-184
* ctdb-recoverd: Rename update_local_flags() -> update_flags()Martin Schwenke2020-08-181-6/+6
| | | | | | | | This also updates remote flags so the name is misleading. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Change update_local_flags() to use already retrieved nodemapsMartin Schwenke2020-08-181-17/+9
| | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Get remote nodemaps earlierMartin Schwenke2020-08-181-7/+7
| | | | | | | | update_local_flags() will be changed to use these nodemaps. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Do not fetch the nodemap from the recovery masterMartin Schwenke2020-08-181-1/+10
| | | | | | | | | | | The nodemap has already been fetched from the local node and is actually passed to this function. Care must be taken to avoid referencing the "remote" nodemap for the recovery master. It also isn't useful to do so, since it would be the same nodemap. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Change get_remote_nodemaps() to use connected nodesMartin Schwenke2020-08-181-3/+2
| | | | | | | | | | | | | | | | | The plan here is to use the nodemaps retrieved by get_remote_nodes() in update_local_flags(). This will improve efficiency, since get_remote_nodes() fetches flags from nodes in parallel. It also means that get_remote_nodes() can be used exactly once early on in main_loop() to retrieve remote nodemaps. Retrieving nodemaps multiple times is unnecessary and racy - a single monitoring iteration should not fetch flags multiple times and compare them. This introduces a temporary behaviour change but it will be of no consequence when the above changes are made. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Fix node_pnn check and assignment of nodemap into arrayMartin Schwenke2020-08-181-3/+11
| | | | | | | | This array is indexed by the same index as nodemap, not the PNN. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Add fail callback to assign banning creditsMartin Schwenke2020-08-181-8/+17
| | | | | | | | | Also drop error handling in main_loop() that is replaced by this change. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Add an intermediate state struct for nodemap fetchingMartin Schwenke2020-08-181-2/+11
| | | | | | | | This will allow an error callback to be added. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Move memory allocation into get_remote_nodemaps()Martin Schwenke2020-08-181-12/+20
| | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Change signature of get_remote_nodemaps()Martin Schwenke2020-08-181-6/+7
| | | | | | | | | Change 1st argument to a rec context, since this will be needed later. Drop the nodemap argument and access it via rec->nodemap instead. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Fix a local memory leakMartin Schwenke2020-08-181-0/+1
| | | | | | | | | | | The memory is allocated off the memory context used by the current iteration of main loop. It is freed when main loop completes the fix doesn't require backporting to stable branches. However, it is sloppy so it is worth fixing. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Basic cleanups for get_remote_nodemaps()Martin Schwenke2020-08-181-16/+23
| | | | | | | | | | Don't log an error on failure - let the caller can do this. Apart from this: fix up coding style and modernise the remaining error message. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14466 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-doc: Link to CTDB page in wikiMartin Schwenke2020-08-171-0/+8
| | | | | | | | 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 Aug 17 06:13:11 UTC 2020 on sn-devel-184
* ctdb-tools: Drop "ctdb isnotrecmaster" commandMartin Schwenke2020-08-173-58/+1
| | | | | | | | This isn't used anywhere and can easily be checked via "ctdb pnn" and "ctdb recmaster" commands. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* lib: relicense smb_strtoul(l) under LGPLv3Ralph Boehme2020-08-036-0/+6
| | | | | | | | | Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Swen Schillig <swen@linux.ibm.com> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Aug 3 22:21:04 UTC 2020 on sn-devel-184
* ctdb-scripts: Use nfsconf as a last resort get nfsd thread countMartin Schwenke2020-07-272-0/+8
| | | | | | | | | | | | | | | If nfsconf exists then use it as last resort to attempt to extract [nfsd]:threads from /etc/nfs.conf. Invocation of nfsconf requires "|| true" because this script uses "set -e". Add a stub that always fails to at least test this much. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14444 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 Jul 27 07:06:58 UTC 2020 on sn-devel-184
* ctdb-scripts: Use nfsconf as a last resort to set NFS_HOSTNAMEMartin Schwenke2020-07-271-4/+17
| | | | | | | | | If nfsconf exists then use it as last resort to attempt to extract [statd]:name from /etc/nfs.conf. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14444 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb: Change LVS to use leader/followerMartin Schwenke2020-07-2419-56/+56
| | | | | | | | | | | Instead of master/slave. Nearly all of these are simple textual substitutions, which preserve the case of the original. A couple of minor cleanups were made in the documentation (such as "LVSMASTER" -> "LVS leader"). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb: Change NAT gateway to use leader/followerMartin Schwenke2020-07-2436-189/+189
| | | | | | | | | | Instead of master/slave. Nearly all of these are simple textual substitutions, which preserve the case of the original. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Simplify calculation of new flagsMartin Schwenke2020-07-241-3/+1
| | | | | | | | 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): Fri Jul 24 06:03:23 UTC 2020 on sn-devel-184
* ctdb-recoverd: Correctly find nodemap entry for pnnMartin Schwenke2020-07-241-2/+8
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Do not retrieve nodemap from recovery masterMartin Schwenke2020-07-241-16/+2
| | | | | | | It is already in rec->nodemap. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Flatten update_flags_on_all_nodes()Martin Schwenke2020-07-241-43/+26
| | | | | | | | | | | | | | | | | The logic currently in ctdb_ctrl_modflags() will be optimised so that it no longer matches the pattern for a control function. So, remove this function and squash its functionality into the only caller. Although there are some superficial changes, the behaviour is unchanged. Flattening the 2 functions produces some seriously weird logic for setting the new flags, to the point where using ctdb_ctrl_modflags() for this purpose now looks very strange. The weirdness will be cleaned up in a subsequent commit. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Move ctdb_ctrl_modflags() to ctdb_recoverd.cMartin Schwenke2020-07-243-70/+68
| | | | | | | This file is the only user of this function. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Improve a call to update_flags_on_all_nodes()Martin Schwenke2020-07-241-1/+1
| | | | | | | This should take a PNN, not an array index. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Use update_flags_on_all_nodes()Martin Schwenke2020-07-241-12/+6
| | | | | | | This is clearer than using the MODFLAGS control directly. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Introduce some local variables to improve readabilityMartin Schwenke2020-07-241-10/+21
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Change update_flags_on_all_nodes() to take rec argumentMartin Schwenke2020-07-241-4/+5
| | | | | | | | This makes fields such as recmaster and nodemap easily available if required. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Drop unused nodemap argument from update_flags_on_all_nodes()Martin Schwenke2020-07-241-5/+15
| | | | | | | | An unused argument needlessly extends the length of function calls. A subsequent change will allow rec->nodemap to be used if necessary. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Improve test portability/qualityMartin Schwenke2020-07-221-25/+23
| | | | | | | | | | | | Avoid use of non-portable md5sum by constructing database names using index. Improve indentation, use more modern commands, code improvements (shellcheck). 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 09:14:35 UTC 2020 on sn-devel-184
* ctdb-tests: Improve test qualityMartin Schwenke2020-07-221-12/+9
| | | | | | Simplify code, use more modern commands, code improvements (shellcheck). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Improve test portabilityMartin Schwenke2020-07-221-1/+1
| | | | | | | "wc -l" on some platforms (e.g. FreeBSD) contains leading spaces, so strip them. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Improve test qualityMartin Schwenke2020-07-221-20/+18
| | | | | | | | Select test node with IPs instead of using a fixed node. Remove unnecessary code, use more modern commands, code improvements (shellcheck). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Improve test portabilityMartin Schwenke2020-07-221-14/+29
| | | | | | | | "wc -l" on some platforms (e.g. FreeBSD) contains leading spaces and stops "$num from being a number. Create a more portable solution and put it in a function instead of repeating the logic. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop uses of "onnode any ..." in testcasesMartin Schwenke2020-07-228-23/+25
| | | | | | | | | | | | It would be nice to get rid of "onnode any". There's no use making tests nondeterministic. If covering different cases matters then they should be explicitly handled. In most places "any" is replaced by "$test_node". In some cases, where $test_node is not set, a fixed node that is already used elsewhere can be reused. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Don't bother shutting down daemons in ctdb_init()Martin Schwenke2020-07-221-2/+0
| | | | | | They'll never be up here... Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Separate custom cluster startup from test initialisationMartin Schwenke2020-07-224-14/+30
| | | | | | | | | | | | | | | | | | | Separate cluster startup from test initialisation for tests that start the cluster with customised configuration. In these cases the result of the cluster startup is actually the point of the test. Additionally, pubips.013.failover_noop.sh claims to have completed test initialisation twice, which just seems wrong. The result is: * ctdb_test_init() takes one option (-n) to indicate when it should not configure/start the cluster * New function ctdb_nodes_start_custom() accepts options for special cluster configuration, only operates on local daemons and triggers a test failure rather than a test error on failure. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Do not trigger ctdb_test_error() from ctdb_init()Martin Schwenke2020-07-221-6/+15
| | | | | | | | The only caller calls ctdb_test_error() on failure and nesting this calls can be confusing. A future change will make this even more confusing. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Make unit.sh pass shellcheckMartin Schwenke2020-07-222-6/+12
| | | | | | | | | Mostly avoidance of quoting warnings. Silencing warnings about unquoted $CTDB_TEST_CAT_RESULTS_OPTS is handled by passing '-' to cat when that variable's value is empty. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Make integration.bash pass shellcheckMartin Schwenke2020-07-222-41/+52
| | | | | | | | | | | | | | | | Apart from the non-constant sourcing of include files. Mostly avoidance of quoting warnings. One subtle change is to simply pass "120" to wait_until_ready() to stop warnings that it expects arguments but none are passed (both SC2119 and SC2120). There seems no way to indicate to structure function argument handling so that shellcheck realises arguments are optional. In later shellcheck versions, disabling SC2120 for a function also silences complaints about its callers... but not all of our testing uses "later" shellcheck versions. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Use "#!/usr/bin/env bash" for improved portabilityMartin Schwenke2020-07-221-1/+1
| | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Update preamble for INTEGRATION testsMartin Schwenke2020-07-2262-1060/+313
| | | | | | | | | | | | | | | | | | | | * Use "#!/usr/bin/env bash" for improved portability * Drop test_info() definition and replace it with a comment The use of test_info() is pointless. * Drop call to cluster_is_healthy() This is a holdover from when the previous test would restart daemons to get things ready for a test. There was also a bug where going into recovery during the restart would sometimes cause the cluster to become unhealthy. If we really need something like this then we can add it to ctdb_test_init(). * Make order of preamble consistent Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop unreachable lineMartin Schwenke2020-07-221-1/+0
| | | | | | ctdb_test_skip() will exit. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Redirect stderr too when checking for shellcheckMartin Schwenke2020-07-221-1/+1
| | | | | | | | | | | Avoid: .../UNIT/shellcheck/scripts/local.sh: line 14: type: shellcheck: not found The "type" command in dash prints the "not found" message to stdout but the bash version prints to stderr, so redirect stderr too. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Show hung script debugging outputMartin Schwenke2020-07-221-0/+5
| | | | | | | | | | The output in a test failure appears to contain no pstree output because "00\.test\.script,.*" does not match. However, this is just a guess because the output is not shown. Showing the output makes it easier to understand test failures. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Enable SOCKET_WRAPPER_DIR_ALLOW_ORIGMartin Schwenke2020-07-221-0/+1
| | | | | | | | This will allow local daemons to be used in more contexts, especially in tests run by Jenkins where the directory names for some targets can be very long. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-build: Don't build/install tests in top-level build by defaultMartin Schwenke2020-07-221-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>
* ctdb-tests: Stop cat command failure from causing test failureMartin Schwenke2020-07-221-1/+1
| | | | | | | | | | | | In certain circumstance, which aren't obvious, cat(1) can fail when attempting to write a lot of data. This is due to something (probably write(2)) returning EAGAIN. Given that the -v option should only really be used for test debugging, ignore the failure instead of spending time debugging it. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14446 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* Revert "ctdb-build: Don't build/install tests in top-level build by default"Martin Schwenke2020-07-221-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