summaryrefslogtreecommitdiff
path: root/ctdb/client/client_db.c
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-client: transaction_cancel must free transaction handleAmitay Isaacs2016-08-101-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> (cherry picked from commit 8aa00035faeb307c061dc20e62a0ace7f2a1413b)
* ctdb-client: Expose ctdb_ltdb_fetch in client APIAmitay Isaacs2016-07-051-3/+3
| | | | | 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-051-0/+73
| | | | | | | 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-051-57/+74
| | | | | | | | | | | | | 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-051-7/+3
| | | | | 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-051-0/+102
| | | | | 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: Use correct TDB flags for opening databaseAmitay Isaacs2016-04-241-7/+8
| | | | | | | | | | | | Persistent: TDB_DEFAULT Volatile: TDB_NOSYNC | TDB_INCOMPATIBLE_HASH | TDB_CLEAR_IF_FIRST | TDB_MUTEX_LOCKING (if TDBMutexEnabled is set) 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): Sun Apr 24 03:25:27 CEST 2016 on sn-devel-144
* ctdb-client: Add missing initialisation of calldataAmitay Isaacs2016-02-241-0/+1
| | | | | | | | 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 Feb 24 11:57:23 CET 2016 on sn-devel-144
* ctdb-client: Keep trying to migrate till record lock is obtainedAmitay Isaacs2016-02-241-1/+3
| | | | | | | | | If a record is not on a local node, then it is migrated from remote node. However, before the client can get a lock on the record, it's possible for the record to get migrated away. In that case, repeat migration. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Drop TALLOC_CTX argument from ctdb_attachAmitay Isaacs2016-02-241-1/+10
| | | | | | | | The database context returned is allocated off the client and is not allocated from user-supplied TALLOC_CTX. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Do not use sync functions in async computationAmitay Isaacs2016-02-241-21/+71
| | | | | | | This leads to nested event loops. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Use ctdb_rec_buffer_init() to initialize ctdb_rec_bufferAmitay Isaacs2016-01-201-1/+1
| | | | | | | | | | ... instead of talloc_zero(). This sets the db_id correctly. 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 Jan 20 07:28:42 CET 2016 on sn-devel-144
* ctdb-client: Add missing initialization for h->ev in transaction_startAmitay Isaacs2016-01-201-0/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Use ctdb_ltdb_header_extract()Amitay Isaacs2016-01-201-7/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Replace ctdb_logging.h with common/logging.hAmitay Isaacs2015-11-161-1/+2
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-protocol: Rename G_LOCK_READ/WRITE to CTDB_G_LOCK_READ/WRITEAmitay Isaacs2015-11-041-2/+2
| | | | | | | to avoid clash with definitions from source3/include/g_lock.h. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: Add new client API implementationAmitay Isaacs2015-10-071-0/+2137
Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>