summaryrefslogtreecommitdiff
path: root/ctdb
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-locking: Simplify ctdb_find_lock_context()Volker Lendecke2014-08-061-34/+33
| | | | | | | | | | I like early returns that avoid else branches :-) 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): Wed Aug 6 14:44:31 CEST 2014 on sn-devel-104
* ctdb-locking: TALLOC_FREE copes with NULLVolker Lendecke2014-08-061-3/+1
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-locking: Add per database queues for pending and active lock requestsAmitay Isaacs2014-08-042-32/+82
| | | | | | | | | | | | | | | | This avoids traversing a single pending queue which is quite expensive when there are lots of pending lock requests. This seems to happen quite a lot on a loaded cluster for notify_index.tdb. Adding per database queues avoids the need to traverse pending queue for that database if there are already the maximum number of active lock requests. 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 Aug 4 20:23:45 CEST 2014 on sn-devel-104
* ctdb-locking: Update a commentAmitay Isaacs2014-08-041-1/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Simplify check for locks on record or databaseAmitay Isaacs2014-08-041-3/+3
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Decrement pending statistics when lock is scheduledAmitay Isaacs2014-08-041-2/+2
| | | | | | | and not when the lock is obtained. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Update ctdb statistics for all lock typesAmitay Isaacs2014-08-041-1/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Add DB lock requests to head of the pending queueAmitay Isaacs2014-08-041-1/+8
| | | | | | | | This allows to schedule DB locks quickly without having to scan through the pending lock requests. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Remove unused variable lock_num_pendingAmitay Isaacs2014-08-042-5/+0
| | | | | | | | The number of pending locks displayed in ctdb statistics are stored in ctdb_statistics structure and not ctdb_context. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Increase number of lock processes per database to 200Amitay Isaacs2014-08-041-1/+1
| | | | | | | This was the original limit in the older versions of CTDB. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Add new tunable LockProcessesPerDBAmitay Isaacs2014-08-043-4/+3
| | | | | | | | This allows to change the maximum number of lock processes that can be active. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Allocate lock request soon after allocating lock contextAmitay Isaacs2014-08-041-6/+6
| | | | | | | This avoids extra work in case lock request allocation fails. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Remove unused function find_lock_context()Amitay Isaacs2014-08-041-53/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Schedule the next possible lock based on per-db limitAmitay Isaacs2014-08-041-15/+5
| | | | | | | | | This prevents searching through active lock requests for every pending lock request to check if the pending lock request can be scheduled or not. The locks are scheduled in strict first-in-first-out order. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Remove multiple lock requests per lock context (part 2)Amitay Isaacs2014-08-041-20/+12
| | | | | | | | Store only a single request instead of storing a queue in lock context. Lock request structure does not need to be a linked list any more. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Remove multiple lock requests per lock context (part 1)Amitay Isaacs2014-08-041-41/+29
| | | | | | | | | | | This was a bad idea and caused out of order scheduling of lock requests. The logic to append lock requests to existing lock context is already commented. Remove the commented code and there is no need to check if lock_ctx is NULL, since we are always creating a new one. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Remove unused structure membersAmitay Isaacs2014-08-041-3/+0
| | | | | | | | | block_child was used to keep track of a process which was created to debug why a lock process has blocked. That logic was replaced to execute an external debug script. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Fix the lock_type_str corresponding to LOCK_ALLDBAmitay Isaacs2014-08-041-1/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-eventscripts: Remove special case for virtio_netMartin Schwenke2014-07-311-5/+0
| | | | | | | | | | | | | | | | | | | The current check is incorrect in 2 ways: * Commit be71a84565e9e7532a77c175732b764d1f42c1cd contained a thinko that stops virtio_net interfaces from simply being marked up * virtio_net interfaces can actually be down virtio_net has supported ethtool since Linux 2.6.29, so just remove the special case. This means that testing CTDB on very old virtual machines is not supported. 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 31 13:08:47 CEST 2014 on sn-devel-104
* ctdb-eventscripts: Remove unused argument to natgw_ensure_master()Martin Schwenke2014-07-291-3/+1
| | | | | | | | | | This was used to limit damage in the "recovered" event. 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 Jul 29 10:03:16 CEST 2014 on sn-devel-104
* ctdb-tests: Add another LCP2 takeover testMartin Schwenke2014-07-291-0/+74
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-eventscripts: Remove NAT gateway "monitor" eventMartin Schwenke2014-07-295-10/+4
| | | | | | | | | | | | | | | | | | This event was introduced to handle misconfiguration. For example, where all nodes where configured as NAT gateway slaves. However, this event can fail when there are performance issues and capabilities can't be retrieved from a remote node. The problem is most likely with the remote node, so marking the local node UNHEALTHY is probably a mistake. Having a NAT gateway master node only matters in "ipreallocated", so leave it to do the checking. Given that a node will run "ipreallocated" as part of the first recovery, this should cause misconfigurations to be detected nice and early. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb:vacuum: stop vacuuming when the first delete_list traverse fails.Michael Adam2014-07-231-0/+1
| | | | | | | | | This indirect caller of delete_marshall_traverse was missed in fa4a81c86b6073b2563b090aa657d8e8b63c1276 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>
* ctdb-vacuum: Use existing function ctdb_marshall_finishAmitay Isaacs2014-07-232-11/+5
| | | | | | | | 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
* ctdb-vacuum: Use ctdb_marshall_add to add a record to marshall bufferAmitay Isaacs2014-07-231-28/+10
| | | | | | | 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>
* ctdb-util: Refactor record marshalling routines to avoid extra tallocAmitay Isaacs2014-07-231-20/+13
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-util: Refactor ctdb_marshall_recordAmitay Isaacs2014-07-231-14/+37
| | | | | | | 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>
* ctdb-util: Fix nonempty line endingsAmitay Isaacs2014-07-231-3/+3
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-vacuum: If talloc_realloc fails, terminate traverseAmitay Isaacs2014-07-231-1/+2
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-vacuum: Fix talloc hierarchy in delete_marshall_traverseAmitay Isaacs2014-07-231-1/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb: Fix verbose_memory_namesVolker Lendecke2014-07-221-1/+1
| | | | | | | | | | | | 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
* ctdb: Avoid a talloc in ctdb_queue_sendVolker Lendecke2014-07-221-3/+6
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Gently abort recovery when election is underwayMartin Schwenke2014-07-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* ctdb-ltdb: Use tdb_null instead of zeroing TDB_DATA variableAmitay Isaacs2014-07-141-4/+2
| | | | | | | | 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
* ctdb-daemon: Support per-node robust mutex featureAmitay Isaacs2014-07-094-1/+16
| | | | | | | | | | | | | | | | 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
* ctdb-daemon: Enable robust mutexes only if TDB_MUTEX_LOCKING is definedAmitay Isaacs2014-07-091-1/+11
| | | | | | | 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>
* ctdb-daemon: Allow flag TDB_MUTEX_LOCKING to pass into db_attachVolker Lendecke2014-07-091-5/+9
| | | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ctdb-daemon: Simplify code a bitAmitay Isaacs2014-07-091-1/+5
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ctdb-daemon: Use false instead of 0 for boolean argumentsAmitay Isaacs2014-07-091-1/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ctdb-tests: Do not run ip command if running against local daemonsAmitay Isaacs2014-07-081-3/+6
| | | | | | | | 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
* ctdb-build: fix wscript formatting as per PEP8Amitay Isaacs2014-07-081-14/+24
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-build: Create ctdb only ctagsAmitay Isaacs2014-07-082-2/+3
| | | | | | | | 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>
* ctdb-build: Replace os.system with samba_utils.RUN_COMMANDAmitay Isaacs2014-07-081-5/+20
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-build: Check the return value of RUN_COMMANDAmitay Isaacs2014-07-081-3/+12
| | | | | | | | | 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>
* ctdb-tests: Shutdown local daemons if the tests exit abnormallyAmitay Isaacs2014-07-081-6/+24
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Pair-Programmed-With: Martin Schwenke <martin@meltin.net> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ctdb-tests: Add a test for ctdb restoredbAmitay Isaacs2014-07-071-0/+118
| | | | | | | | 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
* ctdb-tests: Check that ctdb wipedb cleans the databaseAmitay Isaacs2014-07-071-0/+10
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Do not thaw databases if recovery is activeAmitay Isaacs2014-07-074-6/+14
| | | | | | | | 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>
* ctdb-recoverd: Set recovery mode before freezing databasesAmitay Isaacs2014-07-072-22/+22
| | | | | | | | | | 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>
* ctdb-tools: There is no need for forcing a recoveryAmitay Isaacs2014-07-071-13/+0
| | | | | | | | | | This effectively reverts commit 442953c540424ad0c64f4264b5ee27c45a3130e8. 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>