1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
Commit Graph

5271 Commits

Author SHA1 Message Date
Michael Adam
9d6f187b58 ctdb:vacuum: stop vacuuming when the first delete_list traverse fails.
This indirect caller of delete_marshall_traverse was missed
in fa4a81c86b
which lets failure of the second travers fail the vacuum run.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-07-23 15:11:15 +02:00
Amitay Isaacs
f87b7f664f ctdb-vacuum: Use existing function ctdb_marshall_finish
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 Jul 23 09:44:00 CEST 2014 on sn-devel-104
2014-07-23 09:44:00 +02:00
Amitay Isaacs
6edc4f23e9 ctdb-vacuum: Use ctdb_marshall_add to add a record to marshall buffer
This avoids duplicate code and extra talloc in ctdb_marshall_record.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-07-23 07:18:11 +02:00
Amitay Isaacs
42ba7a0a40 ctdb-util: Refactor record marshalling routines to avoid extra talloc
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-07-23 07:18:11 +02:00
Amitay Isaacs
64ea6e30ef ctdb-util: Refactor ctdb_marshall_record
Create new routines ctdb_marshall_record_size and ctdb_marshall_record_copy

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-07-23 07:18:11 +02:00
Amitay Isaacs
5eac230281 ctdb-util: Fix nonempty line endings
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-07-23 07:18:11 +02:00
Amitay Isaacs
fa4a81c86b ctdb-vacuum: If talloc_realloc fails, terminate traverse
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-07-23 07:18:11 +02:00
Amitay Isaacs
9a4a9ccda3 ctdb-vacuum: Fix talloc hierarchy in delete_marshall_traverse
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
2014-07-23 07:18:11 +02:00
Volker Lendecke
478ef9493f ctdb: Fix verbose_memory_names
If we have already partly written a packet, "data" and thus "pkt->data"
does not point to the start of the packet anymore. Assign "hdr" while
it still points at the start of the header.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Jul 22 06:09:50 CEST 2014 on sn-devel-104
2014-07-22 06:09:50 +02:00
Volker Lendecke
70c79f5140 ctdb: Avoid a talloc in ctdb_queue_send
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-07-22 03:42:13 +02:00
Martin Schwenke
705e4174c9 ctdb-recoverd: Gently abort recovery when election is underway
Sometimes the recovery daemon fails to get the recovery lock on one
node so that node is banned.  This seems to always happen during an
election.  The recovery is triggered because other nodes are found to
have recovery mode enabled.  They have recovery mode enabled because
an election has been forced.

The recovery daemon's main_loop() only does an initial check for an
election.  After that, a node can force an election and, in the
process, set itself to be the current winner.  In this situation,
verify_recmode() will always return MONITOR_RECOVERY_NEEDED so
do_recovery() is called.  If the previous recovery master hasn't
admitted defeat and released the recovery lock, then do_recovery()
will rightly fail.  However, it would be better if it failed a little
more gracefully, since this case is not that unusual.

Instead of trying to take the recovery lock, return early with an
error if there is an election in progress.  Note that the race is
still there but it is now much narrower.

There are probably more subtle ways of avoiding this issue, including
something like this in main_loop():

-	if (pnn != rec->recmaster) {
+	if (pnn != rec->recmaster || rec->election_timeout) {
 		return;
 	}

However, this check is done earlier so it leaves the race window open
a little wider.

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 21 06:57:07 CEST 2014 on sn-devel-104
2014-07-21 06:57:07 +02:00
Amitay Isaacs
208b2d88c4 ctdb-ltdb: Use tdb_null instead of zeroing TDB_DATA variable
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jul 14 16:01:31 CEST 2014 on sn-devel-104
2014-07-14 16:01:31 +02:00
Amitay Isaacs
55fbe364b9 ctdb-daemon: Support per-node robust mutex feature
To enable TDB mutex support, set tunable TDBMutexEnabled=1.

When databases are attached for the first time, attach flags must include
TDB_MUTEX_LOCKING and TDBMutexEnabled must set to enable mutex support.

However, when CTDB attaches databases internally for recovery, it will
enable mutex support if TDBMutexEnabled is set.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Wed Jul  9 06:45:17 CEST 2014 on sn-devel-104
2014-07-09 06:45:17 +02:00
Amitay Isaacs
2e7b0870ec ctdb-daemon: Enable robust mutexes only if TDB_MUTEX_LOCKING is defined
Runtime check for robust mutexes is performed just before opening local tdb.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-09 04:19:12 +02:00
Volker Lendecke
1627171792 ctdb-daemon: Allow flag TDB_MUTEX_LOCKING to pass into db_attach
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-09 04:19:12 +02:00
Amitay Isaacs
91be76dbe9 ctdb-daemon: Simplify code a bit
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-09 04:19:12 +02:00
Amitay Isaacs
1ed330f7cb ctdb-daemon: Use false instead of 0 for boolean arguments
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-09 04:19:12 +02:00
Amitay Isaacs
bf7f2b06e8 ctdb-tests: Do not run ip command if running against local daemons
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Tue Jul  8 12:48:06 CEST 2014 on sn-devel-104
2014-07-08 12:48:06 +02:00
Amitay Isaacs
34be43d201 ctdb-build: fix wscript formatting as per PEP8
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-07-08 10:17:54 +02:00
Amitay Isaacs
9163037923 ctdb-build: Create ctdb only ctags
CTDB does not use auto-generated files, there is no need to configure
to generate ctags.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-07-08 10:17:54 +02:00
Amitay Isaacs
34b4857231 ctdb-build: Replace os.system with samba_utils.RUN_COMMAND
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-07-08 10:17:54 +02:00
Amitay Isaacs
dd1f23dc68 ctdb-build: Check the return value of RUN_COMMAND
RUN_COMMAND does not raise exceptions if the command fails, but returns
non-zero status.  Ensure that make terminates with non-zero status if
RUN_COMMAND fails.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-07-08 10:17:54 +02:00
Amitay Isaacs
e118a36c4c ctdb-tests: Shutdown local daemons if the tests exit abnormally
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Pair-Programmed-With: Martin Schwenke <martin@meltin.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-07-08 10:17:54 +02:00
Amitay Isaacs
eccce073d0 ctdb-tests: Add a test for ctdb restoredb
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): Mon Jul  7 16:06:39 CEST 2014 on sn-devel-104
2014-07-07 16:06:39 +02:00
Amitay Isaacs
9c8c8a7b0b ctdb-tests: Check that ctdb wipedb cleans the database
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-07-07 13:29:50 +02:00
Amitay Isaacs
2855173dac ctdb-daemon: Do not thaw databases if recovery is active
This prevents ctdb tool from thawing databases prematurely in
thaw/wipedb/restoredb commands if recovery is active.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-07-07 13:29:50 +02:00
Amitay Isaacs
28a1b75886 ctdb-recoverd: Set recovery mode before freezing databases
Setting recovery mode to active is the only correct way to inform recovery
daemon to run database recovery.  Only freezing databases without setting
recovery mode should not trigger database recovery, as this mechanism
is used in tool to implement wipedb/restoredb commands.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-07-07 13:29:49 +02:00
Amitay Isaacs
72c6500ee4 ctdb-tools: There is no need for forcing a recovery
This effectively reverts commit 442953c540.
The correct way of telling recovery daemon to trigger a database recovery is
by setting recovery mode to active.  There is no need to freeze databases as
recovery master will do that across the cluster anyway.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-07-07 13:29:49 +02:00
Amitay Isaacs
e5cd81da77 Revert "It was possible for ->recovery_mode to get out of sync with the new three db priorities in such a way that"
This reverts commit 6578a97bd9.

This condition cannot happen since when recovery is triggered, all the
databases would get frozen and thawed in the order of priority.  The only
other place where databases get frozen are for implementation of ctdb
wipedb/restoredb commands.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-07-07 13:29:49 +02:00
Martin Schwenke
1be8564e55 ctdb-common: Use SCHED_RESET_ON_FORK when setting SCHED_FIFO
This makes the scheduler reset code a no-op.

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  7 13:28:25 CEST 2014 on sn-devel-104
2014-07-07 13:28:25 +02:00
Martin Schwenke
a283b9e43a ctdb-recoverd: Don't say "Election timed out"
That makes people think there's a problem (and report bugs) so say
something a bit less scary instead...

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-07-07 10:59:56 +02:00
Martin Schwenke
8bdb9b85cc ctdb-recoverd: Log a message when releasing the recovery lock
It is a non-trivial event and will make it easier to debug recovery
lock issues.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-07-07 10:59:56 +02:00
Martin Schwenke
61b1fdec2f ctdb-scripts: Support NFS on RHEL7 with systemd
Need to be able to recognise a RHEL system.  Still use "system" to
start and stop service, since that still works and yields the smallest
change.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-07-07 10:59:56 +02:00
Amitay Isaacs
331fb7fc64 ctdb-recoverd: No need to set ctdbd_pid again
This is unnecessary since ctdbd_pid is set very early in the code before
creating any other processes including recovery daemon.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>

Autobuild-User(master): Amitay Isaacs <amitay@samba.org>
Autobuild-Date(master): Sat Jul  5 09:20:27 CEST 2014 on sn-devel-104
2014-07-05 09:20:27 +02:00
Martin Schwenke
1677dd499c ctdb-daemon: Remove ctdbd_pid global variable
This duplicates ctdb->ctdbd_pid.

Thanks to Sumit Bose <sbose@redhat.com> for the suggestion.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-07-05 06:51:13 +02:00
Martin Schwenke
e454e5ac9c ctdb-daemon: Check PID in ctdb_remove_pidfile(), not unreliable flag
If something unexpectedly uses fork() then an exiting child will
remove the PID file while the main daemon is still running.  The real
test is whether the current process has the PID of the main CTDB
daemon, which is the process that calls setsid().

This could be done using getpgrp() instead.  At the moment the
eventscript handler harmlessly calls setpgid() - harmless because the
atexit() handlers are cleared upon exec().  However, it is possible
that process groups will be used more in future so it is probably
better to rely on the session ID.

Thanks to Sumit Bose <sbose@redhat.com> for the idea.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-07-05 06:51:13 +02:00
Martin Schwenke
c7b3be97d9 ctdb-daemon: Exit if setting the session ID fails
Currently ctdbd_wrapper depends on the session ID.  Very soon PID file
removal will too.  :-)

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-07-05 06:51:13 +02:00
Martin Schwenke
a7c5500765 ctdb-tests: Fix racy test for debugging hung scripts
Debugging can still be running when a monitor event times out and
scriptstatus output changes.

When debugging a hung script to a log file, write to a temporary file
and move the temporary file over the log file when done.  The test
then waits for the log file to appear.

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 Jul  3 08:19:23 CEST 2014 on sn-devel-104
2014-07-03 08:19:22 +02:00
Martin Schwenke
b0c191e5de ctdb-scripts: Always print footer when debugging hung script
There shouldn't be an early exit for the "init" event.  Just make the
"ctdb scriptstatus" call conditional.

While here, move the comment about only running a single instance to
be near locking code.  The comment is more useful there.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-07-03 05:55:13 +02:00
Amitay Isaacs
b2a74726ee ctdb-packaging: Update configure.rpm with minimum library versions
This makes configure command consistent with spec file.

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): Mon Jun 30 11:23:18 CEST 2014 on sn-devel-104
2014-06-30 11:23:18 +02:00
Amitay Isaacs
fefb3a718f ctdb-packaging: Minimum required tevent library is 0.9.16
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-30 09:06:12 +02:00
Amitay Isaacs
d097898020 ctdb-build: Instead of default test_wrap, install fixed test_wrap
tests/scripts/test_wrap script is updated based on the configured paths.
This should be installed instead of the stock version in the source.

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): Tue Jun 24 09:37:39 CEST 2014 on sn-devel-104
2014-06-24 09:37:39 +02:00
Amitay Isaacs
e9006db3eb ctdb-build: Fix sed expression to protect '\'
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-24 07:23:13 +02:00
Amitay Isaacs
a0d207001a ctdb-build: Use correct path variables for ctdb_run_tests.sh
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-24 07:23:13 +02:00
Amitay Isaacs
4f6d668cfa ctdb-build: Use CTDB_ETCDIR instead of ETCDIR/ctdb
This avoids hardcoding path components in source.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-24 07:23:13 +02:00
Amitay Isaacs
7793aa5617 ctdb-build: Use CTDB_RUNDIR instead of VARDIR/run/ctdb
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-24 07:23:13 +02:00
Amitay Isaacs
8cd48c6b1c ctdb-build: Add special target to get build version
This avoids the need to build a tarball to get version information.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-24 07:23:13 +02:00
Amitay Isaacs
113c5799d4 ctdb-build: Allow waf to build rpms without configure first
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-06-24 07:23:13 +02:00
Michael Adam
43d9670605 ctdb: update configure.rpm with builtin and bundled library arguments
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-06-20 23:38:10 +02:00
Michael Adam
fd4bf96378 ctdb:includes: add #ifdef guard for ZERO_STRUCT
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-06-20 23:38:10 +02:00