1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
Commit Graph

43 Commits

Author SHA1 Message Date
Amitay Isaacs
a878171cb4 ctdb-client: Initialize ctdb_ltdb_header completely for empty record
ctdb_ltdb_fetch() only fills in relevant portion of ctdb_ltdb_header
if the record does not exist.  This can result in uninitialized writes
to ctdb_rec_buffer.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-09-14 14:49:15 +02:00
Amitay Isaacs
3f5f61b903 ctdb-protocol: Fix marshalling for ctdb_g_lock_list
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-08-30 14:59:25 +02:00
Amitay Isaacs
adab372e56 ctdb-protocol: Fix marshalling for ctdb_rec_data
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-08-30 14:59:23 +02:00
Amitay Isaacs
25217a9bb5 ctdb-protocol: Fix marshalling for ctdb_ltdb_header
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-08-30 14:59:22 +02:00
Amitay Isaacs
006c1b6811 ctdb-client: Add db support for CTDB_DB_FLAGS_REPLICATED
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-06-29 10:34:27 +02:00
Amitay Isaacs
0ca3f5aef6 ctdb-client: Store db_flags instead of a boolean persistent flag
... and add accessors for CTDB_DB_FLAGS_PERSISTENT flag.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-06-29 10:34:27 +02:00
Amitay Isaacs
bcfa12c5b2 ctdb-protocol: Do not pass tdb open flags to DB attach controls
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 26 20:10:38 CEST 2017 on sn-devel-144
2017-06-26 20:10:38 +02:00
Amitay Isaacs
38d14fcf29 ctdb-client: Remove calaculation of tdb flags
... and there is no need to find out if mutexes are enabled.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-06-26 15:47:24 +02:00
Amitay Isaacs
17ca4af390 ctdb-client: Ask daemon for db open flags
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-06-26 15:47:24 +02:00
Amitay Isaacs
8e3ed87cac ctdb-client: Add async api for detaching a database
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-06-07 16:05:26 +02:00
Amitay Isaacs
da9e0195a8 ctdb-client: Refactor cluster-wide database traverse api
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>
2017-06-07 16:05:26 +02:00
Amitay Isaacs
6894158103 ctdb-client: Rename ctdb_db_travese to ctdb_db_traverse_local
This function only traverses the database on local node.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2017-06-07 16:05:26 +02:00
Amitay Isaacs
e80802103b ctdb-client: Simplify using tdb_storev
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
2016-10-27 23:53:12 +02:00
Amitay Isaacs
25eedf4695 ctdb-client: Simplify using a local variable
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
2016-10-27 23:53:12 +02:00
Amitay Isaacs
8aa00035fa ctdb-client: transaction_cancel must free transaction handle
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>
2016-08-08 08:17:34 +02:00
Amitay Isaacs
d9b6cd0236 ctdb-client: Expose ctdb_ltdb_fetch in client API
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-07-05 10:53:15 +02:00
Amitay Isaacs
a66063069e ctdb-client: Add debug messages to client db api
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-07-05 10:53:15 +02:00
Amitay Isaacs
1bd97e6d6f ctdb-client: Fix implementation of transaction cancel
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>
2016-07-05 10:53:15 +02:00
Amitay Isaacs
8310722922 ctdb-client: Add async version of transaction cancel
Transaction cancel should get rid of g_lock lock.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-07-05 10:53:15 +02:00
Amitay Isaacs
f1b6bdb619 ctdb-client: Fix implementation of transaction commit
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>
2016-07-05 10:53:14 +02:00
Amitay Isaacs
f721035d43 ctdb-client: Fix implementation of transaction start
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>
2016-07-05 10:53:14 +02:00
Amitay Isaacs
37f587de7a ctdb-client: During transaction commit fetch seqnum locally
This avoids extra controls to the server.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-07-05 10:53:14 +02:00
Amitay Isaacs
da03f5883e ctdb-client: Release the g_lock record once the update is done
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-07-05 10:53:14 +02:00
Amitay Isaacs
4ff8f60307 ctdb-client: Remove commented old g_lock implemention code
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-07-05 10:53:14 +02:00
Amitay Isaacs
b762d77169 ctdb-client: Release g_lock lock before retrying
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-07-05 10:53:14 +02:00
Amitay Isaacs
8b8e73a310 ctdb-client: Fix g_lock implementation
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>
2016-07-05 10:53:14 +02:00
Amitay Isaacs
3ed3d460b7 ctdb-client: If g_lock lock conflicts, try again sooner
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>
2016-07-05 10:53:14 +02:00
Amitay Isaacs
3888439971 ctdb-client: Factor out ctdb_client_get_server_id function
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-07-05 10:53:14 +02:00
Amitay Isaacs
f00319f0bc ctdb-client: Use async version of delete_record in g_lock unlock
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-07-05 10:53:14 +02:00
Amitay Isaacs
f0e331b704 ctdb-client: Fix implementation of delete_record
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>
2016-07-05 10:53:14 +02:00
Amitay Isaacs
5e2bd64cf2 ctdb-client: Add async version of delete_record
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-07-05 10:53:14 +02:00
Amitay Isaacs
5ce8ac85c7 ctdb-client: Fix ctdb_rec_buffer traversal routine
In commit 1ee7053180, 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>
2016-07-05 10:53:14 +02:00
Amitay Isaacs
5f72883e8a ctdb-client: Use correct TDB flags for opening database
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
2016-04-24 03:25:26 +02:00
Amitay Isaacs
d7f552cbbd ctdb-client: Add missing initialisation of calldata
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
2016-02-24 11:57:23 +01:00
Amitay Isaacs
64447653ed ctdb-client: Keep trying to migrate till record lock is obtained
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>
2016-02-24 08:44:38 +01:00
Amitay Isaacs
cf3a0aa410 ctdb-client: Drop TALLOC_CTX argument from ctdb_attach
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>
2016-02-24 08:44:37 +01:00
Amitay Isaacs
d8c28fc972 ctdb-client: Do not use sync functions in async computation
This leads to nested event loops.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-02-24 08:44:37 +01:00
Amitay Isaacs
d905179127 ctdb-client: Use ctdb_rec_buffer_init() to initialize ctdb_rec_buffer
... 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
2016-01-20 07:28:42 +01:00
Amitay Isaacs
a7d54bb2c1 ctdb-client: Add missing initialization for h->ev in transaction_start
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-01-20 04:19:11 +01:00
Amitay Isaacs
e59712b2c3 ctdb-client: Use ctdb_ltdb_header_extract()
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-01-20 04:19:11 +01:00
Amitay Isaacs
7258e1d9c9 ctdb-client: Replace ctdb_logging.h with common/logging.h
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-11-16 00:46:14 +01:00
Amitay Isaacs
8b84a82eab ctdb-protocol: Rename G_LOCK_READ/WRITE to CTDB_G_LOCK_READ/WRITE
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>
2015-11-04 00:47:16 +01:00
Amitay Isaacs
c6a50b97d4 ctdb-client: Add new client API implementation
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-07 14:53:29 +02:00