summaryrefslogtreecommitdiff
path: root/ctdb
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-scripts: Quote some variable expansionsMartin Schwenke2016-07-0617-70/+77
| | | | | | | | | | | | | This avoids relevant shellcheck warnings. This is most of the shellcheck low hanging fruit in the non-test code. Many of the other warnings produced by shellcheck are either false positives, are non-trivial to fix or a fix may result in worse code. 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 Jul 6 08:15:49 CEST 2016 on sn-devel-144
* ctdb-scripts: Fix incorrect variable referenceMartin Schwenke2016-07-061-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Use globs instead of ls to list filesMartin Schwenke2016-07-061-8/+7
| | | | | | | shellcheck reports that using ls is fragile. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Fix incorrect variable referenceMartin Schwenke2016-07-061-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Fix incorrect variable referenceMartin Schwenke2016-07-061-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Update script boilerplate to avoid shellcheck warningsMartin Schwenke2016-07-0623-47/+55
| | | | | | | | | | | | | * Assign the output of dirname to temporary variable to avoid word splitting when directory name contains whitespace * Drop export of CTDB_BASE to avoid masking broken return value - functions file does the export anyway * Quote path when including functions file Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Export CTDB_BASE in functions fileMartin Schwenke2016-07-061-0/+1
| | | | | | | | This avoids having to export it in every file that includes the functions file. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-scripts: Drop optional argument to nfs_check_services()Martin Schwenke2016-07-061-2/+2
| | | | | | | | | Added so that nfs_check_services() could be run against an arbirary directory. However, with the function moved to the event script, this isn't useful. CTDB_NFS_CHECKS_DIR can be used for testing instead. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-build: Exit if requested feature cannot be builtAmitay Isaacs2016-07-051-0/+2
| | | | | | | | 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 Jul 5 14:38:30 CEST 2016 on sn-devel-144
* ctdb-daemon: Log ctdb socket in the main daemonAmitay Isaacs2016-07-051-0/+2
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-pmda: CTDB client code does not require ctdb->methodsAmitay Isaacs2016-07-051-4/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Check if method is initialized before callingAmitay Isaacs2016-07-052-2/+2
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-ib: Include system/wait.h for signalAmitay Isaacs2016-07-051-0/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Expose ctdb_ltdb_fetch in client APIAmitay Isaacs2016-07-052-3/+7
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Add debug messages to client db apiAmitay Isaacs2016-07-051-12/+106
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Fix implementation of transaction cancelAmitay Isaacs2016-07-051-1/+27
| | | | | | | | Wrap async transaction cancel to unlock g_lock lock and free transaction handle. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Add async version of transaction cancelAmitay Isaacs2016-07-052-0/+81
| | | | | | | Transaction cancel should get rid of g_lock lock. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Fix implementation of transaction commitAmitay Isaacs2016-07-052-57/+75
| | | | | | | | | | | | | There is no need to explicitly check that recovery is not active before sending TRANS33_COMMIT control. Just try TRANS3_COMMIT control and if recovery occurs before the control is completed, the control will fail and it can be retried. Make sure g_lock lock is released after the transaction is complete. Also, add timeout to the client api. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Fix implementation of transaction startAmitay Isaacs2016-07-051-53/+2
| | | | | | | | | | | | | | | | | Since g_lock checks if the process exists in case of conflicting lock, there is no need to register srvid. Transaction start returns a transaction handle and transaction commit/cancel will free that handle. Since we cannot call async code in a talloc destructor, this avoids the use of talloc destructor for cancelling the transaction. If user frees the transaction handle instead of calling transaction cancel, it will leave stale g_lock lock. This stale g_lock lock will get cleaned up on next transaction attempt. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: During transaction commit fetch seqnum locallyAmitay Isaacs2016-07-051-74/+51
| | | | | | | This avoids extra controls to the server. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Release the g_lock record once the update is doneAmitay Isaacs2016-07-051-0/+3
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Remove commented old g_lock implemention codeAmitay Isaacs2016-07-051-77/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Release g_lock lock before retryingAmitay Isaacs2016-07-051-0/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Fix g_lock implementationAmitay Isaacs2016-07-051-21/+7
| | | | | | | | If a conflicting g_lock entry is found, check if the process exists. This matches Samba implementation. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: If g_lock lock conflicts, try again soonerAmitay Isaacs2016-07-051-1/+1
| | | | | | | | Instead of delaying for 1 second, try to get g_lock lock again after 1 milli-second. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Factor out ctdb_client_get_server_id functionAmitay Isaacs2016-07-053-7/+22
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Use async version of delete_record in g_lock unlockAmitay Isaacs2016-07-051-3/+33
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Fix implementation of delete_recordAmitay Isaacs2016-07-051-28/+14
| | | | | | | | In delete_record, sync call to ctdb_ctrl_schedule_for_deletion will cause nested event loops. Instead wrap the async version. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Add async version of delete_recordAmitay Isaacs2016-07-052-0/+108
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Fix ctdb_rec_buffer traversal routineAmitay Isaacs2016-07-051-6/+13
| | | | | | | | | In commit 1ee7053180057ea526870182b5619a206b4d103b, the ctdb_rec_buffer_traverse always passes NULL for header. So explicitly extract header from the data. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Add sync version of sending multiple messagesAmitay Isaacs2016-07-052-0/+35
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Improve log messageAmitay Isaacs2016-07-051-1/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-recoverd: Improve election win messagesAmitay Isaacs2016-07-051-2/+4
| | | | | | | | Logging that node has lost election is less useful than knowing which node has won the election. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-tests: Link to ctdb-ipalloc instead of using ctdbd_test.cMartin Schwenke2016-07-043-93/+19
| | | | | | | | | | Less code, quicker build time, smaller binary... 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 4 19:29:08 CEST 2016 on sn-devel-144
* ctdb-ipalloc: Drop implicit dependency on ctdb-commonMartin Schwenke2016-07-042-5/+13
| | | | | | | Use new functions from protocol API instead. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Allow takeover tests to be run under valgrindMartin Schwenke2016-07-041-1/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-tests: Drop use of CTDB context from takeover testMartin Schwenke2016-07-041-36/+20
| | | | | | | | The ipalloc code doesn't need a CTDB context so neither should the code that tests it. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ipalloc: IP allocation state is now an opaque structureMartin Schwenke2016-07-042-13/+15
| | | | | | | It is private to the IP allocation module. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ipalloc: ipalloc() returns public IP listMartin Schwenke2016-07-044-9/+6
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ipalloc: Move set_ipflags_internal() to ipallocMartin Schwenke2016-07-044-81/+87
| | | | | | | Rename it ipalloc_set_node_flags(). Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ipalloc: Switch set_ipflags_internal() to use a new-style node mapMartin Schwenke2016-07-042-16/+43
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ipalloc: Move ipalloc state initialisation to ipalloc.cMartin Schwenke2016-07-043-43/+52
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ipalloc: Pass extra data to IP allocation state initialisationMartin Schwenke2016-07-042-28/+37
| | | | | | | | No longer require CTDB context but pass in number of nodes, algorithm, no_ip_failback and force_rebalance_nodes. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ipalloc: Make no_ip_failback a booleanMartin Schwenke2016-07-045-5/+5
| | | | | | | No need to expose tunable values that far down. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ipalloc: Fix buggy short-circuit when no IPs are availableMartin Schwenke2016-07-041-0/+14
| | | | | | | | | | | | | | | | At the moment IP is short-circuited when there are no available IP addresses. However, if some IP addresses are already allocated then "no available IP addresses" means that all the addresses should (probably) be released. The current short-circuit means that no already hosted IP addresses will be released. The short-circuit exists to avoid lots of messages saying that all IP addresses can not be assigned at startup time. So, add a check to ipalloc_can_host_ips() so that it succeeds if IP addresses are already allocated to nodes. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ipalloc: New function ipalloc_can_host_ips()Martin Schwenke2016-07-043-10/+17
| | | | | | | Abstracts out code involving internals of IP allocation state. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ipalloc: Drop known public IPs from IP allocation stateMartin Schwenke2016-07-042-6/+6
| | | | | | | | This is never used in the allocation algorithms. It is only used when building the merged IP list. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ipalloc: Move create_merged_ip_list() into ipallocMartin Schwenke2016-07-043-97/+96
| | | | | | | | | How the existing IP layout is constructed and how the merged IP list is sorted are important aspects of the IP allocation algorithm. Construct the merged IP list when known and available IPs are assigned. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ipalloc: New function ipalloc_set_public_ips()Martin Schwenke2016-07-044-6/+27
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-ipalloc: Remove function ctdb_reload_remote_public_ips()Martin Schwenke2016-07-041-37/+17
| | | | | | | | Use ctdb_fetch_remote_public_ips() inline to fetch each list. Assign them into the IP allocation state separately. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>