1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

8503 Commits

Author SHA1 Message Date
Martin Schwenke
e494eb3e8c ctdb-tests: Drop unused function ctdb_test_check_real_cluster()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
38138b42f7 ctdb-tests: Update preamble for CLUSTER tests
The main change is to source cluster.bash instead of integration.bash.

While touching the preamble, the following additional changes are also
made:

* Drop test_info() definition and replace it with a comment

  The use of test_info() is pointless.

* Drop call to ctdb_test_check_real_cluster()

  cluster.bash now does this.

* 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().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
653b35764a ctdb-tests: Add cluster.bash include file
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
5ad356c282 ctdb-tests: Add function ctdb_test_skip_on_cluster()
Use it in relevant tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
59055f4da1 ctdb-tests: Add function ctdb_test_on_cluster()
This centralises this logic.  Use it in a subset of tests - there are
other cases but these will be cleaned up soon.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:28 +00:00
Martin Schwenke
65ca431c95 ctdb-tests: Add functions for terminating tests on failure, skip, error
This allows standard exit codes for failed and skipped tests, and test
errors.

Skipped tests currently just succeed and a test error is the same as a
failure.  These can be easily changed later when run_tests.sh is ready
to handle them.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 09:41:27 +00:00
Martin Schwenke
2c54f6df71 ctdb-common: Mark VacuumLimit tunable as obsolete
Use of this tunable was dropped over 5 years ago in commit
16837bc309.

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 Oct  4 07:07:21 UTC 2019 on sn-devel-184
2019-10-04 07:07:21 +00:00
Martin Schwenke
815ae64400 ctdb-vacuum: Drop debug level of repacking message to NOTICE
This occurs rarely but can adversely impact performance, so it is
worth logging it more frequently.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 05:47:35 +00:00
Martin Schwenke
a8c4e7d1f6 ctdb-protocol: Initialise request->rdata.opcode where missing
Otherwise it is uninitialised, so...

==22889== Conditional jump or move depends on uninitialised value(s)
==22889==    at 0x12257B: ctdb_req_control_data_len (protocol_control.c:39)
==22889==    by 0x1228E9: ctdb_req_control_len (protocol_control.c:1786)
==22889==    by 0x12A51C: ctdb_client_control_send (client_control.c:101)
==22889==    by 0x138BE1: ctdb_tunnel_setup_send (client_tunnel.c:100)
==22889==    by 0x10EE4F: tunnel_test_send (tunnel_test.c:135)
==22889==    by 0x10EE4F: main (tunnel_test.c:463)

and similar.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-10-04 05:47:35 +00:00
Amitay Isaacs
33f1c9d965 ctdb-vacuum: Process all records not deleted on a remote node
This currently skips the last record.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14147
RN: Avoid potential data loss during recovery after vacuuming error

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-10-04 05:47:34 +00:00
Martin Schwenke
24f04c1cc5 ctdb-tests: Update README
Bring this up to date.  Drop descriptions of command-line options
because these tend to bit-rot - refer to "run_tests.sh -h" instead.

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 Sep 26 06:01:33 UTC 2019 on sn-devel-184
2019-09-26 06:01:33 +00:00
Martin Schwenke
8a5c4a60e1 ctdb-tests: Move simple tests to INTEGRATION/ subdirectory
Split some tests out into database/ and failover/ subdirectories.
Rename the remaining tests in simple/.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:37 +00:00
Martin Schwenke
658068184f ctdb-tests: Move complex tests to CLUSTER/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:37 +00:00
Martin Schwenke
df6800e330 ctdb-tests: Convert local daemons include file into top-level include
Do the same with the alternative code for real clusters.

Both of these can now be used by other test suites.

Fix some basic shellcheck warnings (e.g. avoid word-splitting by
quoting) while moving code and add the new files to the shellcheck
test.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:37 +00:00
Martin Schwenke
384381fbff ctdb-tests: Drop use of array in run_tests()
This doesn't accomplish anything.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:37 +00:00
Martin Schwenke
c438e0db45 ctdb-tests: Drop custom handling for unit tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:37 +00:00
Martin Schwenke
4046baad5c ctdb-tests: Skip README files in test directories/collections
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:37 +00:00
Martin Schwenke
75393cab0f ctdb-tests: Recurse into directories instead of explicitly looping
run_tests() already has a loop, so use it.

This means collections of test suites can be handled - but explicitly
check valid collection names to avoid running junk.

Add special cases for simple and complex.  These will be removed when
those test suites are moved to collections.  This seems to be the
smallest amount of churn to support bisection.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:37 +00:00
Martin Schwenke
4947fa5ffa ctdb-tests: Fold find_and_run_one_test() in to run_tests()
The additional function makes the logic harder to understand.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:37 +00:00
Martin Schwenke
1061bdf29d ctdb-tests: Move tool tests to UNIT/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:37 +00:00
Martin Schwenke
9585ece00c ctdb-tests: Move takeover_helper tests to UNIT/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:36 +00:00
Martin Schwenke
cf0b87f9b7 ctdb-tests: Move takeover tests to UNIT/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:36 +00:00
Martin Schwenke
010c1a85fa ctdb-tests: Move shellcheck tests to UNIT/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:36 +00:00
Martin Schwenke
a3cbb7eb21 ctdb-tests: Move onnode tests to UNIT/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:36 +00:00
Martin Schwenke
8ed075d396 ctdb-tests: Move eventscript tests to UNIT/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:36 +00:00
Martin Schwenke
330a106aaa ctdb-tests: Move eventd tests to UNIT/ subdirectory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:36 +00:00
Martin Schwenke
43ed3a6eb3 ctdb-tests: Move cunit tests to UNIT/ subdirectory
The UNIT subdirectory directory will contain all unit tests.  Use an
uppercase name to avoid conflicts with source code subdirectories.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-26 04:45:36 +00:00
Martin Schwenke
b8f4f141a2 ctdb-tests: Switch TEST_VAR_DIR to a local script variable
This is now local to run_tests.sh.

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 Sep 24 03:46:59 UTC 2019 on sn-devel-184
2019-09-24 03:46:59 +00:00
Martin Schwenke
e78c1a0ca2 ctdb-tests: Use CTDB_TEST_TMP_DIR in integration.bash
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24 02:27:30 +00:00
Martin Schwenke
263890b36d ctdb-tests: Switch simple tests to use CTDB_TEST_TMP_DIR
CTDB_TEST_TMP_DIR repaces SIMPLE_TESTS_VAR_DIR.  local.bash no longer
needs to ensure that TEST_VAR_DIR is set, since it longer uses this
variable.  Drop the comment because state has not been maintained
between tests for some time.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24 02:27:30 +00:00
Martin Schwenke
def929954a ctdb-tests: Switch takeover helper unit tests to use CTDB_TEST_TMP_DIR
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24 02:27:30 +00:00
Martin Schwenke
1934f673dc ctdb-tests: Switch tool unit tests to use CTDB_TEST_TMP_DIR
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24 02:27:30 +00:00
Martin Schwenke
18ecdbfb02 ctdb-tests: Switch onnode unit tests to use CTDB_TEST_TMP_DIR
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24 02:27:30 +00:00
Martin Schwenke
3b16aa2016 ctdb-tests: Switch eventscript unit tests to use CTDB_TEST_TMP_DIR
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24 02:27:30 +00:00
Martin Schwenke
96aa807f79 ctdb-tests: Switch eventd unit tests to use CTDB_TEST_TMP_DIR
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24 02:27:29 +00:00
Martin Schwenke
cbd27c0a14 ctdb-tests: Switch cunit unit tests to use CTDB_TEST_TMP_DIR
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24 02:27:29 +00:00
Martin Schwenke
cec8f3907e ctdb-tests: Add new variable CTDB_TEST_TMP_DIR
This is a subdirectory of TEST_VAR_DIR that is unique to the current
test suite.  It is recreated for each individual test.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24 02:27:29 +00:00
Martin Schwenke
e9ce035c2d ctdb-tests: Move setting of CTDB_TEST_SUITE_DIR to run_tests.sh
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24 02:27:29 +00:00
Martin Schwenke
02edfb0f19 ctdb-tests: Rename variable TEST_SUBDIR -> CTDB_TEST_SUITE_DIR
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24 02:27:29 +00:00
Martin Schwenke
f331f3f723 ctdb-tests: Use local_daemons.sh onnode for local daemons tests
With some upcoming changes, the setting of CTDB_BASE becomes
problematic because it will be included unconditionally whereas it is
currently being conveniently and almost accidentally not include in
some contexts.

So, instead of trying to coerce onnode into behaving as desired, have
the local daemons tests use local_daemons.sh onnode directly.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24 02:27:29 +00:00
Martin Schwenke
ae1e8002b0 ctdb-tests: Use local $ctdb_base instead of $CTDB_BASE
The latter might not be defined in a test.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24 02:27:29 +00:00
Martin Schwenke
08fea1ced3 ctdb-tests: Generalise pattern for matching valgrind memcheck executable
On my laptop this is "memcheck-amd64-linux instead of just "memcheck".

Alternatively, this part of the test could simply be skipped if
$VALGRIND is set.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-24 02:27:29 +00:00
Martin Schwenke
84f544b55f ctdb-client: Fix some typos in debug messages
tdb_sore -> tdb_store
  SCHDULE_FOR_DELETION -> SCHEDULE_FOR_DELETION

Switch to modern debug macros while touching the lines.

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 Sep 17 05:52:15 UTC 2019 on sn-devel-184
2019-09-17 05:52:15 +00:00
Martin Schwenke
fc7f3b99ac ctdb-scripts: Drop bit-rotted shellcheck directive
The code has changed so this is no longer needed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:27 +00:00
Martin Schwenke
80cbebce71 ctdb-scripts: Silence shellcheck warning SC2166
This covers the following:

  SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
  SC2166: Prefer [ p ] || [ q ] as [ p -o q ] is not well defined.

POSIX agrees that -a and -o should not be used:

  https://pubs.opengroup.org/onlinepubs/9699919799/utilities/test.html

Fixing these doesn't cause much churn.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:27 +00:00
Martin Schwenke
597039daeb ctdb-utils: CID 1273087 - Resource leak
Ensure that p is not leaked.

This is a test program and the program exits anyway.  No need to
backport.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:26 +00:00
Martin Schwenke
32b5ceb319 ctdb-tools: Stop deleted nodes from influencing ctdb nodestatus exit code
Deleted nodes should simply be ignored.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14129
RN: Stop deleted nodes from influencing ctdb nodestatus exit code

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:26 +00:00
Martin Schwenke
2b37d99a5f ctdb-tests: Put the summary file inside $TEST_VAR_DIR
This means less random files dropped in /tmp or similar.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:26 +00:00
Martin Schwenke
7a5a4a4494 ctdb-tests: Drop run_tests -d option
The usage message says it is dodgy and some test suites may not
support it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:26 +00:00
Martin Schwenke
2730e48360 ctdb-tests: Simplify setup_ctdb()
There is no point inventing a whole new set of options here.

Continue to locally implement the --no-event-scripts option.  This
must be first, though in practice only one option is ever passed to
setup_ctdb() from ctdb_test_init().

Simply pass all other options through to "local_daemons.sh setup".
This has the side effect of causing failure when an invalid option is
passed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:26 +00:00
Martin Schwenke
8443798846 ctdb-tests: Invert some logic so it makes sense
The test should be outside the loop.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:26 +00:00
Martin Schwenke
8038f4f64f ctdb-tests: Avoid shellcheck warnings
SC2086 Double quote to prevent globbing and word splitting

This one doesn't need the double quotes if it is contained within the
preceding variable expansion.

SC2181 Check exit code directly with e.g. 'if mycmd;', not indirectly with $?
SC2004 $/${} is unnecessary on arithmetic variables

These are straightforward.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:26 +00:00
Martin Schwenke
497ae563a0 ctdb-tests: Fix zero event scripts test so it tests something
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:26 +00:00
Martin Schwenke
429502186a ctdb-tests: Drop unused code from onnode unit test ctdb stub
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:26 +00:00
Martin Schwenke
bb040f2798 ctdb-tests: Only set TEST_SUBDIR when needed
This is only needed for setup_ctdb_base() so only set it when calling
this function.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:26 +00:00
Martin Schwenke
284bbca7c7 ctdb-tests: Move NFS test functions to complex local script
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:26 +00:00
Martin Schwenke
2c6b098c72 ctdb-tests: Don't run setup_ctdb_base() for real cluster
This has not been needed for some time.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:26 +00:00
Martin Schwenke
8aed06ce8c ctdb-tests: Use db_ctdb_cattdb_count_records()
Avoid reinventing the wheel.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:26 +00:00
Martin Schwenke
68684377c6 ctdb-tests: Use ctdb_get_all_pnns()
The nested, arbitrary use of onnode can cause messages from ssh on
stderr to appear in the node list:

  Getting list of nodes...
  Output of "onnode -pq all ctdb pnn | grep '^[0-9][0-9]*$'":
  Warning: Permanently added '10.0.0.72' (RSA) to the list of known hosts.^M
  Warning: Permanently added '10.0.0.75' (RSA) to the list of known hosts.^M
  Warning: Permanently added '10.0.0.73' (RSA) to the list of known hosts.^M
  Warning: Permanently added '10.0.0.74' (RSA) to the list of known hosts.^M
  1
  0
  3
  2
  Create/wipe test database rec_test.tdb
  Failed to execute "Permanently added '10.0.0.72' (RSA) to the list of known hosts.^M ctdb attach rec_test.tdb" on node(s) "Warning:"
  Invalid <nodespec>

Avoid that by using an existing function that does not nest ssh uses.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:26 +00:00
Martin Schwenke
522a8480fa ctdb-tests: Drop reference to unused ctdb_eventd test directory
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-09-17 04:35:25 +00:00
Amitay Isaacs
3bd68261ec ctdb-eventscripts: Remove non-posix -v option to mkdir
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): Fri Sep  6 11:11:02 UTC 2019 on sn-devel-184
2019-09-06 11:11:02 +00:00
Amitay Isaacs
4a7fc97daf ctdb-eventscripts: Fix the regression in 01.reclock.script
Commit ea7708d8c7 simplified
01.reclock.script and removed include of functions file which is
required for setting CTDB_HELPER_BINDIR and for die() function.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2019-09-06 09:52:48 +00:00
Björn Baumbach
16c3a00d2e build: remove unneeded libceph-common dependency
librados and libcephfs are both dependent on ceph-common, but
ctdb_mutex_ceph_rados_helper and vfs_ceph needn't be explicitly linked
against it.

Signed-off-by: Björn Baumbach <bb@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Sep  2 03:44:24 UTC 2019 on sn-devel-184
2019-09-02 03:44:24 +00:00
David Disseldorp
dfa4dcf386 build: drop --with-libcephfs=<path> support
--with-libcephfs=<path> provides a mechanism for explicitly specifying
header and library paths for Ceph. This adds unnecessary complexity and
can be achieved using generic compiler environment variables (e.g.
GCC LIBRARY_PATH and C_INCLUDE_PATH), so drop --with-libcephfs support.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-09-02 02:25:29 +00:00
Mathieu Parent
7cb0ca4171 Spelling fixes s/ dont / don't /
Excluding examples/tridge/smb.conf

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-09-01 22:21:27 +00:00
Mathieu Parent
736bb924f7 Spelling fixes s/ ot / to /
Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-09-01 22:21:27 +00:00
Mathieu Parent
781eaea07f Spelling fixes s/advertisment/advertisement/
Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
2019-09-01 22:21:25 +00:00
Martin Schwenke
8190993d99 ctdb-recoverd: Fix typo in previous fix
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

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 27 15:29:11 UTC 2019 on sn-devel-184
2019-08-27 15:29:11 +00:00
Swen Schillig
085e179dcb ctdb-tests: fix mem leak in ltdb_fetch
Direct leak of 256 byte(s) in 8 object(s) allocated from:
    #0 0x7f11b90d9c08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08)
    #1 0x7f11b8f395df in tdb_alloc_read ../../../lib/tdb/common/io.c:696
    #2 0x7f11b8f290ee in _tdb_fetch ../../../lib/tdb/common/tdb.c:274
    #3 0x7f11b8f29379 in tdb_fetch ../../../lib/tdb/common/tdb.c:283
    #4 0x473ecc in ltdb_fetch ../../tests/src/fake_ctdbd.c:904
    #5 0x478b40 in ltdb_transaction_update ../../tests/src/fake_ctdbd.c:993
    #6 0x41fef2 in ctdb_rec_buffer_traverse ../../protocol/protocol_types.c:1656
    #7 0x48108b in ltdb_transaction ../../tests/src/fake_ctdbd.c:1026
    #8 0x48108b in control_trans3_commit ../../tests/src/fake_ctdbd.c:2878
    #9 0x48108b in client_process_control ../../tests/src/fake_ctdbd.c:4147
    #10 0x48108b in client_process_packet ../../tests/src/fake_ctdbd.c:3839
    #11 0x4847f5 in client_read_handler ../../tests/src/fake_ctdbd.c:3806
    #12 0x44f620 in comm_read_done ../../common/comm.c:208
    #13 0x7f11b8f94fe8 in _tevent_req_notify_callback ../../../lib/tevent/tevent_req.c:141
    #14 0x7f11b8f951fd in tevent_req_finish ../../../lib/tevent/tevent_req.c:193
    #15 0x7f11b8f95265 in _tevent_req_done ../../../lib/tevent/tevent_req.c:199
    #16 0x44e876 in pkt_read_handler ../../common/pkt_read.c:133
    #17 0x44f315 in comm_fd_handler ../../common/comm.c:412
    #18 0x7f11b8f92896 in tevent_common_invoke_fd_handler ../../../lib/tevent/tevent_fd.c:138
    #19 0x7f11b8fa6937 in epoll_event_loop ../../../lib/tevent/tevent_epoll.c:736
    #20 0x7f11b8fa6937 in epoll_event_loop_once ../../../lib/tevent/tevent_epoll.c:937
    #21 0x7f11b8f9f53e in std_event_loop_once ../../../lib/tevent/tevent_standard.c:110
    #22 0x7f11b8f90f34 in _tevent_loop_once ../../../lib/tevent/tevent.c:772
    #23 0x7f11b8f955f1 in tevent_req_poll ../../../lib/tevent/tevent_req.c:300
    #24 0x485a04 in start_server ../../tests/src/fake_ctdbd.c:4450
    #25 0x485a04 in main ../../tests/src/fake_ctdbd.c:4544
    #26 0x7f11b8c60412 in __libc_start_main (/lib64/libc.so.6+0x24412)

Signed-off-by: Swen Schillig <swen@linux.ibm.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Aug 26 10:19:30 UTC 2019 on sn-devel-184
2019-08-26 10:19:30 +00:00
Martin Schwenke
71ad473ba8 ctdb-tests: Clear deleted record via recovery instead of vacuuming
This test has been flapping because sometimes the record is not
vacuumed within the expected time period, perhaps even because the
check for the record can interfere with vacuuming.  However, instead
of waiting for vacuuming the record can be cleared by doing a
recovery.  This should be much more reliable.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085
RN: Fix flapping CTDB tests

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 Aug 21 13:06:57 UTC 2019 on sn-devel-184
2019-08-21 13:06:57 +00:00
Martin Schwenke
45b9e02f8f ctdb-tests: Wait for child process when killing cluster mutex helper
The following test sometimes fails:

==================================================
Running "cluster_mutex_test lock-unlock-lock-unlock ./tests/var/cluster_mutex.lockfile"
--------------------------------------------------
Output (Exit status: 134):
--------------------------------------------------
LOCK
UNLOCK
CONTENTION
NOLOCK
cluster_mutex_test: ../../tests/src/cluster_mutex_test.c:307: test_lock_unlock_lock_unlock: Assertion `dl2->mh != NULL' failed.
--------------------------------------------------
Required output (Exit status: 0):
--------------------------------------------------
LOCK
UNLOCK
LOCK
UNLOCK

FAILED
==========================================================================
TEST FAILED: tests/cunit/cluster_mutex_001.sh (status 1) (duration: 0s)
==========================================================================

This is due to a race in the test.  For the first UNLOCK a signal is
sent to the cluster mutex handler but the test tries to retake the
lock before that process is scheduled and the signal is processed.
Therefore, the fcntl() lock is still held and contention is seen.

After unlocking, tests need to wait until the child has gone, so build
this into ctdb_kill().  This is one of the only places where the PID
is accessible.

Outside of testing, on a real system, nothing will never try
to (re)take the lock so quickly.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-21 11:50:30 +00:00
Martin Schwenke
ca4df06080 ctdb-tests: Strengthen volatile DB traverse test
Check the record count more often, from multiple nodes.  Add a case
with multiple records.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-21 11:50:30 +00:00
Martin Schwenke
5d655ac6f2 ctdb-recoverd: Only check for LMASTER nodes in the VNN map
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-21 11:50:30 +00:00
Martin Schwenke
53daeb2f87 ctdb-tests: Don't retrieve the VNN map from target node for notlmaster
Use the VNN map from the node running node_has_status().

This means that

  wait_until_node_has_status 1 notlmaster 10 0

will run "ctdb status" on node 0 and check (for up to 10 seconds) if
node 1 is in the VNN map.

If the LMASTER capability has been dropped on node 1 then the above
will wait for the VNN map to be updated on node 0.  This will happen
as part of the recovery that is triggered by the change of LMASTER
capability.  The next command will then only be able to attach to
$TESTDB after the recovery is complete thus guaranteeing a sane state
for the test to continue.

This stops simple/79_volatile_db_traverse.sh from going into recovery
during the traverse or at some other inconvenient time.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-21 11:50:30 +00:00
Martin Schwenke
bff1a3a548 ctdb-tests: Handle special cases first and return
All the other cases involve matching bits.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-21 11:50:30 +00:00
Martin Schwenke
bb59073515 ctdb-tests: Inline handling of recovered and notlmaster statuses
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-21 11:50:30 +00:00
Martin Schwenke
9b09a87326 ctdb-tests: Drop unused node statuses frozen/unfrozen
Silently drop unused local variable mpat.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-21 11:50:30 +00:00
Martin Schwenke
52227d1973 ctdb-tests: Reformat node_has_status()
Re-indent and drop non-POSIX left-parenthesis from case labels.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14085

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-21 11:50:30 +00:00
Martin Schwenke
e9f2e205ee ctdb-daemon: Make node inactive in the NODE_STOP control
Currently some of this is supported by a periodic check in the
recovery daemon's main_loop(), which notices the flag change, sets
recovery mode active and freezes databases.  If STOP_NODE returns
immediately then the associated recovery can complete and the node can
be continued before databases are actually frozen.

Instead, immediately do all of the things that make a node inactive.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087
RN: Stop "ctdb stop" from completing before freezing databases

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 20 08:32:27 UTC 2019 on sn-devel-184
2019-08-20 08:32:27 +00:00
Martin Schwenke
91ac4c13d8 ctdb-daemon: Drop unused function ctdb_local_node_got_banned()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-20 07:15:41 +00:00
Martin Schwenke
0f5f7b7cf4 ctdb-daemon: Switch banning code to use ctdb_node_become_inactive()
There's no reason to avoid immediately setting recovery mode to active
and initiating freeze of databases.

This effectively reverts the following commits:

  d8f3b490bb
  b4357a79d9

The latter is now implemented using a control, resulting in looser
coupling.

See also the following commit:

  f8141e91a6

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-20 07:15:41 +00:00
Martin Schwenke
a42bcaabb6 ctdb-daemon: Factor out new function ctdb_node_become_inactive()
This is a superset of ctdb_local_node_got_banned() so will replace
that function, and will also be used in the NODE_STOP control.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14087

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-20 07:15:41 +00:00
Martin Schwenke
73c850eda4 ctdb-tcp: Mark node as disconnected if incoming connection goes away
To make it easy to pass the node data to the upcall, the private data
for ctdb_tcp_read_cb() needs to be changed from tnode to node.

RN: Avoid marking a node as connected before it can receive packets
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

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 Aug 16 22:50:35 UTC 2019 on sn-devel-184
2019-08-16 22:50:35 +00:00
Martin Schwenke
8c98c10f24 ctdb-tcp: Only mark a node connected if both directions are up
Nodes are currently marked as up if the outgoing connection is
established.  However, if the incoming connection is not yet
established then this node could send a request where the replying
node can not queue its reply.  Wait until both directions are up
before marking a node as connected.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-16 21:30:35 +00:00
Martin Schwenke
7f4854d964 ctdb-tcp: Create outbound queue when the connection becomes writable
Since commit ddd97553f0
ctdb_queue_send() doesn't queue a packet if the connection isn't yet
established (i.e. when fd == -1).  So, don't bother creating the
outbound queue during initialisation but create it when the connection
becomes writable.

Now the presence of the queue indicates that the outbound connection
is up.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-16 21:30:35 +00:00
Martin Schwenke
d80d9edb4d ctdb-tcp: Use TALLOC_FREE()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-16 21:30:35 +00:00
Martin Schwenke
c68b6f96f2 ctdb-tcp: Move incoming fd and queue into struct ctdb_tcp_node
This makes it easy to track both incoming and outgoing connectivity
states.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-16 21:30:35 +00:00
Martin Schwenke
c06620169f ctdb-tcp: Rename fd -> out_fd
in_fd is coming soon.

Fix coding style violations in the affected and adjacent lines.
Modernise some debug macros and make them more consistent (e.g. drop
logging of errno when strerror(errno) is already logged.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-16 21:30:35 +00:00
Martin Schwenke
3acb8e9d1c ctdb-daemon: Add function ctdb_ip_to_node()
This is the core logic from ctdb_ip_to_pnn(), so re-implement that
that function using ctdb_ip_to_node().

Something similar (ctdb_ip_to_nodeid()) was recently removed in commit
010c1d77cd because it wasn't required.
Now there is a use case.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14084

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-16 21:30:35 +00:00
Martin Schwenke
6c9d1f855e ctdb-daemon: Avoid signed/unsigned comparison by casting
Compiling with -Wsign-compare complains:

 1047 |  &&  (call->call_id == CTDB_FETCH_WITH_HEADER_FUNC)) {
      |                     ^~

struct ctdb_call is a protocol element, so we can't simply change it.

Found by csbuild.

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 Aug 14 10:29:59 UTC 2019 on sn-devel-184
2019-08-14 10:29:59 +00:00
Martin Schwenke
4bdfbbd8d4 ctdb-daemon: Avoid signed/unsigned comparison by declaring as unsigned
Compiling with -Wsign-compare complains:

ctdb/server/ctdb_call.c:831:12: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
  831 |  if (count <= ctdb_db->statistics.hot_keys[0].count) {
      |            ^~

and

ctdb/server/ctdb_call.c:844:13: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
  844 |   if (count <= ctdb_db->statistics.hot_keys[i].count) {
      |             ^~

Found by cs-build.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-14 09:11:36 +00:00
Martin Schwenke
5a3d99dc7a ctdb-common: Return value of ctdb_queue_length() should be unsigned
Compiling with -Wsign-compare complains:

ctdb/server/ctdb_daemon.c: scope_hint: In function ‘daemon_queue_send’
ctdb/server/ctdb_daemon.c:259:40: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare]
...

The struct ctdb_queue member out_queue_length is actually uint32_t, so
just return that type.

Found by csbuild.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-14 09:11:36 +00:00
Martin Schwenke
f7f9f57d2e ctdb-tests: Use select_test_node() in ctdb setdebug simple test
There is no requirement for IP addresses here.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-14 09:11:36 +00:00
Martin Schwenke
3ea95ab4cb ctdb-tests: Add function select_test_node()
Should be used when public IP addresses are not assigned.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-14 09:11:36 +00:00
Martin Schwenke
a074dbf645 ctdb-tools: Fix usage for "ctdb cattdb"
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-14 09:11:36 +00:00
Martin Schwenke
695b3a965b ctdb-tests: Don't print summary on failure if -e option is specified
If there is a failure it will always be the last test run.  Don't
obscure this by following it with a summary.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-14 09:11:36 +00:00
Martin Schwenke
7c01bf3d37 ctdb-tests: Drop mention of non-existent -s option
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-14 09:11:35 +00:00
Martin Schwenke
b3b44ae532 ctdb-tests: Add -I <count> option for iterating tests
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-14 09:11:35 +00:00
Martin Schwenke
91e6fc209b ctdb-tests: Factor out main test loop into run_tests()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-14 09:11:35 +00:00
Martin Schwenke
da33fb27ab ctdb-tests: Add shellcheck test for some test scripts and includes
These files now pass, so we might as well keep them in good shape.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2019-08-14 09:11:35 +00:00