summaryrefslogtreecommitdiff
path: root/ctdb/client
Commit message (Collapse)AuthorAgeFilesLines
...
* ctdb-client: Add sync api for control DB_OPEN_FLAGSAmitay Isaacs2017-06-262-0/+34
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Drop tdb_flags argument to ctdb_attach()Amitay Isaacs2017-06-261-3/+2
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Stop sending tdb_flags with DB_ATTACH controlsAmitay Isaacs2017-06-261-1/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Refactor calculation of tdb open flags based on database typeAmitay Isaacs2017-06-261-29/+13
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb: Fix typosVolker Lendecke2017-06-211-2/+2
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* ctdb-client: Add correct control names to log messagesAmitay Isaacs2017-06-191-4/+4
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Document ctdb client APIAmitay Isaacs2017-06-071-40/+857
| | | | | | | | 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): Wed Jun 7 20:19:06 CEST 2017 on sn-devel-144
* ctdb-client: Move eventd API to a separate headerAmitay Isaacs2017-06-073-67/+93
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Move sync API to a separate headerAmitay Isaacs2017-06-076-501/+531
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Move ctdb_ctrl_modflags() to ctdb toolAmitay Isaacs2017-06-072-39/+0
| | | | | | | This function is only required by the tool. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Add async api for detaching a databaseAmitay Isaacs2017-06-072-11/+159
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Create sync wrappers for managing message handlersAmitay Isaacs2017-06-071-11/+33
| | | | | | | | This wraps the entire async computation for setting and removing message handlers instead of calling multiple sync calls. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Refactor cluster-wide database traverse apiAmitay Isaacs2017-06-072-0/+263
| | | | | | | | This implements the async version of the traverse code in the ctdb tool for catdb command. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Rename ctdb_db_travese to ctdb_db_traverse_localAmitay Isaacs2017-06-072-14/+16
| | | | | | | This function only traverses the database on local node. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* Correct "recived" typo.Chris Lamb2017-02-221-1/+1
| | | | | | Signed-off-by: Chris Lamb <chris@chris-lamb.co.uk> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
* ctdb-client: Add available-only option public IP fetchingMartin Schwenke2016-12-192-1/+3
| | | | | | | Update tool accordingly. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-client: Drop client code for eventscript controlsAmitay Isaacs2016-12-183-220/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Add client api for eventd communicationAmitay Isaacs2016-12-182-0/+663
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-logging: Drop enum debug_levelMartin Schwenke2016-12-052-4/+4
| | | | | | | We are switching to Samba-style integer debug levels. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-client: Simplify using tdb_storevAmitay Isaacs2016-10-271-13/+10
| | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-client: Simplify using a local variableAmitay Isaacs2016-10-271-7/+4
| | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-client: Print error message before next syscall to avoid losing errnoMartin Schwenke2016-08-171-1/+4
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=12157 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-client: Fix CID 1362725 Unchecked return value from libraryMartin Schwenke2016-08-171-1/+12
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=12157 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-client: transaction_cancel must free transaction handleAmitay Isaacs2016-08-081-0/+3
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=12122 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Drop client code for global transaction controlsAmitay Isaacs2016-07-282-106/+0
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Remove code to set/get_db_priority from new client codeAmitay Isaacs2016-07-252-72/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Remove client code for set/get_db_priorityAmitay Isaacs2016-07-251-53/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Remove ctdb_ctrl_freeze_priority() functionAmitay Isaacs2016-07-251-20/+4
| | | | | | | | ctdb_ctrl_freeze() now only needs to send a single control since there are no database priorities any more. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Mark ctdb_ctrl_freeze_priority staticAmitay Isaacs2016-07-251-3/+3
| | | | | | | It is not used outside ctdb_client.c Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Drop unused functions ctdb_ctrl_freeze_send/recvAmitay Isaacs2016-07-251-29/+0
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Reimplement ctdb_ctrl_freeze_priority() using ctdb_control()Amitay Isaacs2016-07-251-7/+12
| | | | | | | This makes it easier to drop unused async implementation of the same. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Remove function ctdb_ctrl_thaw() from new client APIAmitay Isaacs2016-07-252-34/+0
| | | | | | | This function is not used anywhere. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Remove functions ctdb_ctrl_thaw_priority() and ctdb_ctrl_thaw()Amitay Isaacs2016-07-251-25/+0
| | | | | | | These functions are not used anywhere. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Fix access after free errorMartin Schwenke2016-07-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | State is stolen onto tmp_ctx above so can't be referenced after tmp_ctx is freed. So, state->status has to be looked at earlier. Moving it immediately before the talloc_free(tmp_ctx) isn't sufficient because invoking the callback appears to cause a recursive call to ctdb_control_recv(), which also frees state. Referencing it at the top seems safe. ==23982== Invalid read of size 4 ==23982== at 0x4204AE: ctdb_control_recv (ctdb_client.c:1181) ==23982== by 0x420645: invoke_control_callback (ctdb_client.c:971) ==23982== by 0x5E675EC: tevent_common_loop_timer_delay (tevent_timed.c:341) ==23982== by 0x5E68639: epoll_event_loop_once (tevent_epoll.c:911) ==23982== by 0x5E66BD6: std_event_loop_once (tevent_standard.c:114) ==23982== by 0x5E622EC: _tevent_loop_once (tevent.c:533) ==23982== by 0x4255F7: ctdb_client_async_wait (ctdb_client.c:3385) ==23982== by 0x42578A: ctdb_client_async_control (ctdb_client.c:3442) ==23982== by 0x41B405: ctdb_get_nodes_files (ctdb.c:5488) ==23982== by 0x41B405: check_all_node_files_are_identical (ctdb.c:5530) ==23982== by 0x41B405: control_reload_nodes_file (ctdb.c:5673) ==23982== by 0x404DBA: main (ctdb.c:6008) ==23982== Address 0x7e98d9c is 108 bytes inside a block of size 168 free'd ==23982== at 0x4C2CDFB: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==23982== by 0x5652692: _tc_free_internal (talloc.c:1125) ==23982== by 0x5652692: _tc_free_children_internal (talloc.c:1570) ==23982== by 0x564B952: _tc_free_internal (talloc.c:1081) ==23982== by 0x564B952: _talloc_free_internal (talloc.c:1151) ==23982== by 0x564B952: _talloc_free (talloc.c:1693) ==23982== by 0x4204C9: ctdb_control_recv (ctdb_client.c:1182) ==23982== by 0x4207AA: async_callback (ctdb_client.c:3350) ==23982== by 0x4204AD: ctdb_control_recv (ctdb_client.c:1179) ==23982== by 0x420645: invoke_control_callback (ctdb_client.c:971) ==23982== by 0x5E675EC: tevent_common_loop_timer_delay (tevent_timed.c:341) ==23982== by 0x5E68639: epoll_event_loop_once (tevent_epoll.c:911) ==23982== by 0x5E66BD6: std_event_loop_once (tevent_standard.c:114) ==23982== by 0x5E622EC: _tevent_loop_once (tevent.c:533) ==23982== by 0x4255F7: ctdb_client_async_wait (ctdb_client.c:3385) ==23982== Block was alloc'd at ==23982== at 0x4C2BBCF: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==23982== by 0x564DBEC: __talloc_with_prefix (talloc.c:675) ==23982== by 0x564DBEC: __talloc (talloc.c:716) ==23982== by 0x564DBEC: _talloc_named_const (talloc.c:873) ==23982== by 0x564DBEC: _talloc_zero (talloc.c:2318) ==23982== by 0x42017F: ctdb_control_send (ctdb_client.c:1086) ==23982== by 0x425746: ctdb_client_async_control (ctdb_client.c:3431) ==23982== by 0x41B405: ctdb_get_nodes_files (ctdb.c:5488) ==23982== by 0x41B405: check_all_node_files_are_identical (ctdb.c:5530) ==23982== by 0x41B405: control_reload_nodes_file (ctdb.c:5673) ==23982== by 0x404DBA: main (ctdb.c:6008) ==23982== Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* ctdb-client: Fix incorrect variable referenceMartin Schwenke2016-07-201-1/+1
| | | | | | | | | The point of this code is almost certainly to return non-zero when state->errormsg is set. So, return state->status if non-zero, -1 otherwise. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* 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>