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

415 Commits

Author SHA1 Message Date
Amitay Isaacs
10dbeddab5 ctdb-protocol: Return required buffer size in push functions
If the buffer size provided is not sufficient, then return the required
buffer length.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-05-03 04:43:20 +02:00
Amitay Isaacs
f288ce8428 ctdb-client: Drop unnecessary discard_const
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-05-03 04:43:20 +02:00
Amitay Isaacs
bf9b0b992a ctdb-protocol: Drop buffer allocation from protocol push functions
This means that the packet allocation will happen just before push
functions are called.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-05-03 04:43:20 +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
b970a5304c ctdb-client: Set control opcode in reply for one-way controls
Some controls are fire-and-forget (CTDB_CTRL_FLAG_NOREPLY).  Since there
is no reply received, the opcode in the ctdb_reply_control structure
never gets set.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-04-23 23:55:15 +02:00
Amitay Isaacs
2e2dfae98c ctdb-client: Remove client functions related to server_id
These functions were used in the transaction code.  These controls did
not use server_id structure defined in samba, so samba would not use them.
Instead check if the process exists for conflicting g_lock entry.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-04-23 23:55:14 +02:00
Martin Schwenke
f0a83d865c ctdb-client: Drop killtcp client functions
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-04-01 04:42:12 +02:00
Amitay Isaacs
338e0dccd9 ctdb-client: Add client API functions for new controls
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:15 +01:00
Amitay Isaacs
67799c73af ctdb-client: Add client API for sending message to multiple nodes
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2016-03-25 03:26:14 +01:00
Amitay Isaacs
ad5b9c3df2 ctdb-client: Increase the timeout for TRANS3_COMMIT control
On a busy system, TRANS3_COMMIT control can take upto or longer than
3 seconds.  On timeout, there are few possible outcomes.

1. The transaction has completed on all nodes and TRANS3_COMMIT control
   has returned.  In such a case, there is no problem.

2. The transaction has completed on the local node, but TRANS3_COMMIT
   control is still active.  In such a case, ctdb_transaction_commit()
   can return successfully.  If this is being called from ctdb, then
   ctdb will exit.  This will cause ctdb daemon to trigger recovery
   since the client exited while transaction is active.  This will cause
   unnecessary recovery.

3. Database recovery was started and ctdb_transaction_commit() will
   retry till the recovery completes the transaction.

Increasing the timeout to 30 seconds will avoid the spurious database
recoveries when TRANS3_COMMIT control takes longer to finish.

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): Fri Mar 11 19:59:53 CET 2016 on sn-devel-144
2016-03-11 19:59:53 +01:00
Martin Schwenke
00f7d18304 ctdb: Drop unnecessary defines of TEVENT_DEPRECATED
These have been scattered around the code so that
tevent_loop_allow_nesting() can be called.  However, only the main
daemon and some tests currently use nested event loops.
TEVENT_DEPRECATED is already defined in the places where it is needed.

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): Fri Feb 26 07:11:29 CET 2016 on sn-devel-144
2016-02-26 07:11:29 +01: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
fbd3fd343b ctdb-client: Remove TALLOC_CTX argument from sync functions
There is no allocated memory returned from these functions.

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
d23c5a6c2f ctdb-client: Add async version of set/remove message handler functions
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
1f2c990372 ctdb-client: Add sync API for waiting for recovery
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
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
69113fa02e ctdb-client: Add new API for ctdb_client_wait_timeout()
This is similar to ctdb_client_wait() with additional timeout argument.

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
e8d4b5d583 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
Martin Schwenke
f71f198a4a ctdb-client: Drop support for updating NAT gateway capability
This is no longer used.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2016-01-27 15:28:17 +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
5d5d88e0bb ctdb-client: Do not delete reqid explicitly
The reqid will be deleted when the client control state is freed.

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
8ca76adaea ctdb-client: Add a disconnect callback for ctdb client
This allows the client code to optionally clean up and/or re-connect to
CTDB daemon when it the daemon goes away.  If no disconnect callback is
registered and CTDB daemon goes away, then the client will terminate.

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
555237f2a8 ctdb-client: Close ctdb socket connection when client context goes away
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
Martin Schwenke
7fb3d286d2 ctdb-client: Only get capabilities from active nodes
This is used by the recovery daemon to validate the current recovery
master.  Don't risk being unable to elect a new master if the current
master is inactive but unresponsive.

Note that this client call is currently not used by any other callers.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>

Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Sun Dec 13 03:17:10 CET 2015 on sn-devel-104
2015-12-13 03:17:10 +01:00
Amitay Isaacs
2bad37db98 ctdb-include: Make client header self contained
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-11-25 10:16:19 +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
848da80152 ctdb-daemon: Move switch_from_server_to_client() to ctdb_daemon.c
This function can only called from ctdb daemon.

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
Mathieu Parent
c315fce17e Fix various spelling errors
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Nov  6 13:43:45 CET 2015 on sn-devel-104
2015-11-06 13:43:45 +01:00
Amitay Isaacs
38d92788d6 ctdb-include: Use new protocol definitions
This gets rid of the duplicate definitions from ctdb_protocol.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
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
b8b737c77a ctdb-client: Rename g_lock datatypes as per new protocol.h
struct server_id => ctdb_server_id
enum g_lock_type => ctdb_g_lock_type
struct g_lock_rec => ctdb_g_lock
struct g_lock_recs => ctdb_g_lock_list

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
44e611ddcf ctdb-daemon: Rename struct ctdb_control_get_ifaces to ctdb_iface_list_old
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
ecfaef5031 ctdb-daemon: Rename struct ctdb_control_public_ip_info to ctdb_public_ip_info_old
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
c4e9d616ae ctdb-daemon: Rename struct ctdb_control_iface_info to ctdb_iface
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
1278a5a4ed ctdb-daemon: Rename struct ctdb_control_set_tunable to ctdb_tunable_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
64d8bb626b ctdb-daemon: Rename struct ctdb_control_pulldb to ctdb_pulldb
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
f8c2dc3220 ctdb-daemon: Rename struct ctdb_control_gratious_arp to ctdb_addr_info_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
357bc60947 ctdb-daemon: Rename struct ctdb_control_ip_iface to ctdb_addr_info_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
cb0be4126f ctdb-daemon: Rename struct ctdb_tunable to ctdb_tunable_list
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
ca481354c0 ctdb-daemon: Rename struct ctdb_control_tcp_tickle_list to ctdb_tickle_list_old
Also remove unnecessary struct ctdb_tcp_wire_array.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
d4de4527b0 ctdb-daemon: Rename struct ctdb_ban_time to ctdb_ban_state
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
92a6ac18ae ctdb-daemon: Rename struct ctdb_tcp_connection to ctdb_connection
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
699ee0df94 ctdb-daemon: Rename struct ctdb_server_id_list to ctdb_client_id_list_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
d858c210a7 ctdb-daemon: Rename struct ctdb_server_id to ctdb_client_id
This is to avoid clash with samba structure server_id.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
645cd43200 ctdb-daemon: Rename struct ctdb_dbid_map to ctdb_dbid_map_old
Match struct ctdb_dbid as per protocol/protocol.h

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:15 +01:00
Amitay Isaacs
75572bd2a3 ctdb-daemon: Rename struct ctdb_db_statistics to ctdb_db_statistics_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
b45bc4ce4b ctdb-daemon: Rename struct ctdb_statistics_wire to ctdb_statistics_list_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
b99436e425 ctdb-daemon: Rename struct ctdb_rec_data to ctdb_rec_data_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
04eaa077aa ctdb-daemon: Rename struct ctdb_all_public_ips to ctdb_public_ip_list_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
afc5d8a442 ctdb-daemon: Rename struct ctdb_node_map to ctdb_node_map_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
1c828b4ed6 ctdb-daemon: Rename struct ctdb_reply_control to ctdb_reply_control_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
e1fed53e2a ctdb-daemon: Rename struct ctdb_req_control to ctdb_req_control_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
acf858defb ctdb-daemon: Rename struct ctdb_req_message to ctdb_req_message_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
277c21f0cd ctdb-daemon: Rename struct ctdb_reply_call to ctdb_reply_call_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
e0c42c5698 ctdb-daemon: Rename struct ctdb_req_call to ctdb_req_call_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:14 +01:00
Amitay Isaacs
f55889d2c9 ctdb-daemon: Rename enum ctdb_eventscript_call to ctdb_event
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:13 +01:00
Amitay Isaacs
e7c9e50916 ctdb-daemon: Rename struct ctdb_scripts_wire to ctdb_script_list_old
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-11-04 00:47:13 +01:00
Amitay Isaacs
4647787773 ctdb-daemon: Separate prototypes for common client/server functions
This groups function prototypes for common client/server functions in
common/common.h and removes them from ctdb_private.h.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-30 02:00:27 +01:00
Amitay Isaacs
01c6c90e98 ctdb-daemon: Remove dependency on includes.h
Instead of includes.h, include the required header files explicitly.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-30 02:00:27 +01:00
Amitay Isaacs
2fdb332fad ctdb-daemon: Stop using tevent compatibility definitions
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-30 02:00:27 +01:00
Amitay Isaacs
b900adc55c ctdb-daemon: Separate prototypes for system specific functions
This groups function prototypes for system specific functions in
common/system.h and removes them from ctdb_private.h.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-30 02:00:27 +01:00
Amitay Isaacs
b04c48d2f5 ctdb-client: Add client API for new database controls
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-07 14:53:29 +02: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
Amitay Isaacs
b25c1135a7 ctdb-daemon: Use reqid abstraction
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-07 14:53:28 +02:00
Amitay Isaacs
9d75bf3a9f ctdb-daemon: formatting fix
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-07 14:53:28 +02:00
Amitay Isaacs
62f1e2579a ctdb-daemon: Replace ctdb_message with srvid abstraction
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-07 14:53:28 +02:00
Amitay Isaacs
6672deea13 ctdb-daemon: formatting fix
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-07 14:53:28 +02:00
Amitay Isaacs
ba56d852cb ctdb-daemon: Remove ctdb from traverse_callback
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-10-07 14:53:28 +02:00
Martin Schwenke
bce6a386d3 ctdb-daemon: Drop struct ctdb_control_killtcp
Just use ctdb_tcp_connection.  It is the same.  There are no external
users.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Volker Lendecke <vl@samba.org>
2015-09-07 07:01:13 +02:00
Amitay Isaacs
1286b02e24 ctdb-client: Return the correct status sent from the daemon
If a control fails and error message is set, the returned status of the
control is always set to -1 ignoring the status passed by the daemon.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-07-29 10:33:29 +02:00
Amitay Isaacs
37e1502f68 ctdb-daemon: Remove control CTDB_CONTROL_SET_CALL
This has not been used for a long time.

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): Fri Jul 10 23:41:18 CEST 2015 on sn-devel-104
2015-07-10 23:41:18 +02:00
Amitay Isaacs
9aa90482f8 ctdb-daemon: Fix valgrind invalid read error in db_statistics control
==20761== Invalid read of size 8
  ==20761==    at 0x11BE30: ctdb_ctrl_dbstatistics (ctdb_client.c:1286)
  ==20761==    by 0x12BA89: control_dbstatistics (ctdb.c:713)
  ==20761==    by 0x1312E0: main (ctdb.c:6543)
  ==20761==  Address 0x713b0d0 is 0 bytes after a block of size 560 alloc'd
  ==20761==    at 0x4C27A2E: malloc (vg_replace_malloc.c:270)
  ==20761==    by 0x5CB0954: _talloc_memdup (talloc.c:615)
  ==20761==    by 0x11395C: ctdb_control_recv (ctdb_client.c:1146)
  ==20761==    by 0x11BDD7: ctdb_ctrl_dbstatistics (ctdb_client.c:1265)
  ==20761==    by 0x12BA89: control_dbstatistics (ctdb.c:713)
  ==20761==    by 0x1312E0: main (ctdb.c:6543)

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2015-07-10 20:36:24 +02:00
Amitay Isaacs
9b6865475e ctdb-daemon: Remove obsolete IPv4 only controls
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
2015-05-12 01:32:11 +02:00
Martin Schwenke
7a42bcaeae ctdb-client: Add API for retrieving and checking capabilities
ctdb_get_capabilities() gets capabilities from all connected nodes
into an array.  ctdb_get_node_capabilities() gets capabilities for a
particular node from array.  ctdb_node_has_capabilities() returns true
if given node has all of the given capabilities.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-05-10 03:22:13 +02:00
Volker Lendecke
b8ac9853b0 ctdb: Fix the O3 developer build
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
2015-04-21 19:37:16 +02:00
Martin Schwenke
81e526965c ctdb-daemon: New control CTDB_CONTROL_GET_NODES_FILE
This is like CTDB_CONTROL_GET_NODEMAP but it loads from the nodes file
instead of the daemon.

Also new client function ctdb_ctrl_getnodesfile()

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-03-23 12:23:12 +01:00
Martin Schwenke
54f0c39e5a ctdb-client: Return a value of 1 when setting obsolete tunable variable
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2015-02-18 05:34:06 +01:00
Volker Lendecke
975b9b0304 ctdb: server_id_get->server_id_fetch
server_id_get with the next patch will be a global parsing function.
I've decided to rename this here in ctdb, as it's only a static function
in ctdb_client.c and apparently not intended for wider use. Please speak
up if you don't like this :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2015-02-13 23:32:07 +01:00
Amitay Isaacs
e0bf5dd456 ctdb-daemon: Use correct tdb flags when enabling robust mutex support
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11000

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2014-12-19 13:15:12 +01:00
Amitay Isaacs
a54db687ac ctdb: Rename CTDB_VERSION to CTDB_PROTOCOL
CTDB_VERSION really is the ctdb protocol version.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-10-28 05:42:05 +01:00
Amitay Isaacs
0d5ecaa2e3 ctdb: Rename ctdb socket variable from CTDB_PATH to CTDB_SOCKET
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-10-28 05:42:04 +01:00
Martin Schwenke
acf26089f1 ctdb-util: Rename db_wrap to tdb_wrap and make it a build subsystem
This makes it consistent with Samba, to ease transition.

Update unit test code to link to with tdb_wrap instead of including
db_wrap.c.

There are some potential whitespace fixes in this commit that have
been ignored.  CTDB's lib/tdb_wrap will be deleted after the
transition to Samba's lib/tdb_wrap, so there's no point polishing it
too much.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-09-10 01:36:15 +02:00
Martin Schwenke
b831829ced ctdb-client: Rename static function server_id_equal()
Otherwise it conflicts with the same function provided by Samba's
lib/util.  Using the Samba one drags in too many dependencies, so
rename the CTDB version to avoid a declaration clash when CTDB starts
including samba_util.h.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-09-10 01:36:15 +02:00
Amitay Isaacs
55fbe364b9 ctdb-daemon: Support per-node robust mutex feature
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
2014-07-09 06:45:17 +02:00
Martin Schwenke
1677dd499c ctdb-daemon: Remove ctdbd_pid global variable
This duplicates ctdb->ctdbd_pid.

Thanks to Sumit Bose <sbose@redhat.com> for the suggestion.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
2014-07-05 06:51:13 +02:00
Amitay Isaacs
db0a1df25c ctdb-client: Talloc tdb_wrap off ctdb_db_context
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
2014-04-23 14:49:07 +02:00
Amitay Isaacs
ce18b3b00b ctdb-client: Add client code to detach a database
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-04-14 03:52:39 +02:00
Amitay Isaacs
78015320b6 ctdb-client: ctdb_fetch_lock should check for readonly delegations
When readonly delegations were added, ctdb_fetch_lock code should have
been modified to include the check for readonly flags.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
2014-03-28 05:55:13 +01:00
Amitay Isaacs
8dc416c069 ctdb-client: Treat empty __db_sequence_number__ record as 0
This fixes the issue of transaction commit failing due to an empty
__db_sequence_number__ record in persistent database left by previous
cancelled transaction.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-11-27 18:46:16 +01:00
Amitay Isaacs
c72e745511 ctdb-client: Coverity fixes
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Michael Adam <obnox@samba.org>
2013-11-19 17:13:04 +01:00
Amitay Isaacs
537d4abc11 client: Make g_lock_lock() wait till lock is obtained
This makes the behaviour of g_lock_lock() similar to that implemented in
Samba.  Now ctdb_transaction_start() will return NULL only when there are
failures and not when another transaction is active.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 59489019ad15a5ad6b0f295e742fc9832745a842)
2013-11-07 16:08:17 +11:00
Martin Schwenke
19a911bf1a client: Fix a format string argument compiler warning
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit f3413fb8b90c4d9f0c2c2a69825c66d080117193)
2013-10-22 14:34:03 +11:00
Amitay Isaacs
d0f99926e4 client: Remove old persistent transaction code
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 41bdbcfd72092cdd25da87e60689c087bca97933)
2013-10-04 15:47:11 +10:00
Amitay Isaacs
c5ec04f24e client: Reimplement persistent transaction code using TRANS3_COMMIT
Implementing persistent trasnaction code from Samba.

Persistent transaction code was reimplemented in Samba using g_lock.tdb
to hold transaction locks and using TRANS3_COMMIT control.

Implementation details:

1. When starting a transaction, create a record with "transaction-<dbid>"
   as key and store current server_id in the structure.

2. If a record already exists, some other client has already started a
   transaction.  Verify that the process corresponding to server_id stored
   in the record really exists or it's a stale record and overwrite it.

3. All modifications to the actual persistent database are stored in a
   marshal buffer.

4. When transaction is committed, read the sequence number of the
   persistent database and increment it.  Sequence number record is also
   stored in the marshal buffer.

5. Send the changed records (marshal buffer) in TRANS3_COMMIT control
   to all the active nodes.

6. If all controls succeed, verify that the sequence number has been
   incremented.  Commit is successful.  If any of the controls fail,
   abort the transaction.

7. In case sequence number has not yet been incremented, then database
   recovery has been triggered.  So repeat from step 5.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 4e0f1971792c9431d8d51dc57d54ecc9e4576dd5)
2013-10-04 15:46:15 +10:00
Amitay Isaacs
1203e82d9b client: Add functions to parse g_lock.tdb records
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 40589ae5259880431f358250c1f0d07bcaa21d1f)
2013-10-04 15:43:32 +10:00
Amitay Isaacs
0205d52657 client: Add functions to handle server_id structure
server_id records are stored in g_lock.tdb for persistent transactions.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 55f91ea4373c54ddb5faad87fa2826d86a4b6172)
2013-10-04 15:43:31 +10:00
Martin Schwenke
b527236efe client: Fix some format string compiler warnings
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 5619754343003016ede27014567dbb4701f97928)
2013-10-04 15:15:35 +10:00
Amitay Isaacs
4ca9b96114 client: Add ctdb_ctrl_getdbseqnum() function
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 8cb1fbbfe88327c9c7ab68e8eded586dff611e57)
2013-10-04 15:15:34 +10:00
Amitay Isaacs
5d47f28e15 client: Add ctdb_ctrl_getdbstatistics() function
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 1e7fca5cdc1d7205cf084e35aace1a5dc46ea294)
2013-10-04 15:15:34 +10:00
Amitay Isaacs
105afa543e client: Add ctdb_client_check_message_handlers() function
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit c9a9d14c91f203ce964a426a8a1e2c1715af2098)
2013-10-04 15:15:34 +10:00
Amitay Isaacs
151bb4b97d client: Remove extra whitespaces
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 962eb63c6d500e29a03ae087757d81be449888c6)
2013-10-04 15:15:34 +10:00
Martin Schwenke
fe7f66547b client: Remove unused function list_of_active_nodes_except_pnn()
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit d8a76cf79f07dfb5a93c6c9a13f16e3268c7dd57)
2013-09-11 15:35:03 +10:00
Amitay Isaacs
1467b666f2 Revert "LACOUNT: Add back lacount mechanism to defer migrating a fetched/read copy until after default of 20 consecutive requests from the same node"
This reverts commit 035c0d981bde8c0eee8b3f24ba8e2dc817e5b504.

This is a premature optimization.  Record can bounce between nodes
very quickly if it is a contended record.  There is no need to hold a
record on a node unnecessarily.  In case record contention becomes bad,
enabling sticky records on a database is a better idea.

Conflicts:
	include/ctdb_private.h
	server/ctdb_tunables.c

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit ac417b0003f0116f116834ad2ac51482d25cfa0d)
2013-08-22 14:08:52 +10:00
Amitay Isaacs
8f1e94dfa4 recoverd: Use TDB_INCOMPATIBLE_HASH when creating volatile databases
When creating missing databases either locally or remotely, recovery
master calls ctdb_ctrl_createdb().  Recovery master always passes 0
for tdb_flags.  For volatile databases, if TDB_INCOMPATIBLE_HASH is not
specified, then they will be attached without using jenkins hash causing
database corruption.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 2fc6b6403707a292d134140fc0b9145b454992c5)
2013-08-14 15:54:48 +10:00
Amitay Isaacs
de6b97ce4f Revert "recoverd: Use correct tdb flags when creating missing databases"
This reverts commit 10a057d8e15c8c18e540598a940d3548c731b0b4.

This approach would not work when creating local databases since currently
there is no control to receive TDB flags for remote databases.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit ca61eb776ab862bd269e45ee0f9f96e7e1e0e001)
2013-08-14 14:15:33 +10:00
Amitay Isaacs
f15e1a28a7 recoverd: Use correct tdb flags when creating missing databases
When creating missing databases either locally or remotely, make sure
to use the correct tdb flags from other nodes.  Without this, volatile
databases can get attached without TDB_INCOMPATIBLE_HASH flag.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 10a057d8e15c8c18e540598a940d3548c731b0b4)
2013-08-01 11:08:25 +10:00
Amitay Isaacs
e44c38dc45 client: Always use jenkins hash when attaching volatile databases
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 7e7e59c4047c78159387089eca65d90037bcf722)
2013-08-01 11:08:25 +10:00
Sumit Bose
1f96f42b73 Fix memory leak in ctdb_send_message()
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit da87395d29f5d11ecfedaf36b53fa060a9140bfd)
2013-07-11 15:16:55 +10:00
Sumit Bose
157f1cfefd Fixes for various issues found by Coverity
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 05bfdbbd0d4abdfbcf28e3930086723508b35952)
2013-07-11 15:16:55 +10:00
Amitay Isaacs
f9191c061a client: Exit with non-zero status when unix socket is closed
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 733fc909425860f6a02c205c2d8f34a731853922)
2013-06-25 17:48:23 +10:00
Mathieu Parent
d82b9ae410 build: Fix tdb.h path to enable building with system TDB library
(This used to be ctdb commit f8bf99de3a5f56be67aaa67ed836458b1cf73e86)
2013-06-14 16:45:27 +10:00
Martin Schwenke
28d608556d client: async_callback() sets result to -ETIME if a control times out
Otherwise there is no way of treating a timeout differently to a
general failure.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 40e34773b8063196457746ffe7a048eb87d96d61)
2013-05-24 16:04:56 +10:00
Martin Schwenke
140f0cfd3b ctdbd: Update the get_tunable code to return -EINVAL for unknown tunable
Otherwise callers can't tell the difference between some other failure
(e.g. memory allocation failure) and an unknown tunable.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 03fd90d41f9cd9b8c42dc6b8b8d46ae19101a544)
2013-05-24 16:04:50 +10:00
Martin Schwenke
77671b9ef5 ctdbd: New control CTDB_CONTROL_GET_RUNSTATE
Also new client function ctdb_ctrl_get_runstate().

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit dc4220e6f618cc688b3ca8e52bcb3eec6cb55bb1)
2013-05-24 14:08:07 +10:00
Michael Adam
885d6312fa client: fix ctdb_control() to be able to cope with CTDB_CTRL_FLAG_NOREPLY
This was apparently not used before in this context, and the bug hence
not detected. It becomes necessary when ctdb_local_schedule_for_deletion()
is called from a client ctdbd (the vacuuming child), hence needs to send
the SCHEDULE_FOR_DELETION control to its parent.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-By: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit e72a5e11845fe445baaee4730bb0bea8588ee9e3)
2013-04-24 18:46:22 +10:00
Amitay Isaacs
41f0252da2 client: Set the socket non-blocking only after connect succeeds
If the socket is set non-blocking before connect, then we should catch
EAGAIN errors and retry. Instead of adding a random number of retries,
better to wait for connect to succeed and then set the socket to
non-blocking.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 524ec206e6a5e8b11723f4d8d1251ed5d84063b0)
2013-04-05 13:21:41 +11:00
Amitay Isaacs
b1b3d64380 Revert "client: handle transient connection errors"
This reverts commit dc0c58547cd4b20a8e2cd21f3c8363f34fd03e75.

There is a simpler solution that retrying random number of times. Do not set
socket non-blocking till connect succeeds.

(This used to be ctdb commit 74acc2c568300ef42740cf11299a1b2507047f60)
2013-04-05 13:21:02 +11:00
Martin Schwenke
7f727e5d32 client: Refactor node listing functions to use list_of_nodes()
This reduces repetition.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit f505020a5720faa4ecc6414e0bfaa6b3c0e47291)
2013-02-20 14:44:38 +11:00
Martin Schwenke
dab2f6817d client: New generic node listing function list_of_nodes()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit a73bb56991b8c07ed0e9517ffcf0dc264be30487)
2013-02-20 14:44:38 +11:00
Martin Schwenke
75347b8668 util: ctdb_fork() closes all sockets opened by the main daemon
Do some other hosuekeeping including stopping tevent.

Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 212298279557a2833ef0f81809b4a5cdac72ca02)
2012-10-05 11:56:12 +10:00
Amitay Isaacs
7631830152 server: Replace BOOL datatype with bool, True/False with true/false
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 6e5cbe8fff71985e5a2fc16b7e9f2b868011ff5d)
2012-05-28 11:22:25 +10:00
Amitay Isaacs
4392591555 Remove explicit include of lib/tevent/tevent.h.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>

(This used to be ctdb commit 0681014ca5ed2a9b56f63fdace7f894beccf8a9a)
2012-04-13 17:28:14 +10:00
Ronnie Sahlberg
fa3a06246a STICKY: add prototype code to make records stick to a node to "calm" down if they are found to be very hot and accessed by a lot of clients.
This can improve performance and stop clients from having to chase a rapidly migrating/bouncing record

(This used to be ctdb commit d0d98f7e45e5084b81335b004d50bddc80cdc219)
2012-03-20 17:12:19 +11:00
Ronnie Sahlberg
e7e51ddb64 LACOUNT: Add back lacount mechanism to defer migrating a fetched/read copy until after default of 20 consecutive requests from the same node
This can improve performance slightly on certain workloads where smbds frequently read from the same record

(This used to be ctdb commit 035c0d981bde8c0eee8b3f24ba8e2dc817e5b504)
2012-03-20 12:26:22 +11:00
Ronnie Sahlberg
42e477b14e READONLY: only send a control to schedule fast-vacuuming from child context iff we have a connection open to the main daemon
there are some child processes where we do not create a connection to the main daemon (switch_from_server_to_client()) because it is expensive to set up and we normally might not need to talk to the daemon at all via a domainsocket.
but we might want to still call to ctdb_ltdb_store() from such chil processes.

(This used to be ctdb commit 9e372a08c40087e6b5335aa298e94d88273566a5)
2012-02-21 07:03:44 +11:00
Volker Lendecke
9ebc00637d Fix a cut&paste error
Signed-off-by: Michael Adam <obnox@samba.org>

(This used to be ctdb commit 488de939b78125ac38822760102e05298a5e70c5)
2012-01-18 12:25:38 +01:00
Michael Adam
6e42e03b57 fix zero-initialization of header in _ctdbd_allocate_pkt to the correct size
(This used to be ctdb commit 6c4d1b768ccade344a7462ecad7cf5cbbf3873d4)
2011-12-23 17:39:00 +01:00
Michael Adam
ad0de5494e traverse: fix traversing with empty records by adding a new (internal) control CTDB_CONTROL_TRAVERSE_START_EXT
By this, the original CTDB_CONTROL_TRAVERSE_START control that is
used by e.g. samba's smbstatus, is not changed, so that samba
continues working without code change.

The  CTDB_CONTROL_TRAVERSE_START currently just adds the "withemptyrecords"
flag to the state and processon on as CTDB_CONTROL_TRAVERSE_START_EXT.

(This used to be ctdb commit 8281bb210858ed04992eacea7f6d02261e0fc1b1)
2011-12-03 02:15:30 +01:00
Michael Adam
31d62794fe ctdb: add an option --print-recordflags to trigger printing record flags in catdb and dumpdbbackup
This changes the default behaviour to not print record flags.

(This used to be ctdb commit 2d2ce07c51055d9400b22cd3c1fd682597cb921c)
2011-11-29 13:43:35 +01:00
Michael Adam
e6923904e8 ctdb: add an option --print-hash to enable printing of record hashes when dumping dbs
(This used to be ctdb commit efc033c28ade97f9884794256d59a4553e052d5f)
2011-11-29 13:43:34 +01:00
Michael Adam
86cd78efee ctdb: add an option --print-lmaster to enable printing of lmaster in "ctdb catdb"
(This used to be ctdb commit 326f88ef622620cb9e0569c4497bc0e86124beaa)
2011-11-29 13:43:33 +01:00
Michael Adam
dc98c12ac9 ctdb: add an option --print-datasize to only print datasize instead of dumping data in db dumps
Used in catdb, cattdb and dumpdbbackup.

(This used to be ctdb commit dd866116041e71cbf91e7fd91edcc9501634051d)
2011-11-29 13:43:32 +01:00
Michael Adam
1fcc7651f4 ctdb: add an option --print-emptyrecords to enable printing of empty records in dumping databases
this option is used with the commands catdb, cattdb and dumpdbbackup.

(This used to be ctdb commit 6ec68a2e667f66d2b194fe48cb75229a2777842e)
2011-11-29 10:30:24 +01:00
Michael Adam
554d68df60 client: add version ctdb_traverse_ext() of ctdb_traverse() that can list empty records.
(This used to be ctdb commit 4ada4bfc4510886c5c7fcf49e09711b9d2dcb75d)
2011-11-29 10:30:24 +01:00
Michael Adam
1a31c84348 traverse: add a flag to enable transferring empty records in cluster wide traverse
This will be useful for also printing information about empty/deleted
records in "ctdb catdb", e.g. for debugging vacuuming issues.

(This used to be ctdb commit ddc5da3a0df7701934404192a0a0aa659a806acb)
2011-11-29 10:30:24 +01:00
Martin Schwenke
13653d47a2 Rename ctdb_ctrl_getscriptstatus() parameter to avoid shadowing a global
Rename parameter script_status to scripts to avoid shadowing a global
function with the same name in eventscript.c.

This is in the context of wanting to run CCAN-style tests where most
of the ctdbd code is just included in the test program.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 668358057c1e6b9bbad7209212f9135c5e6241a0)
2011-11-11 14:31:50 +11:00
Martin Schwenke
ccd79e10bc Rename ctdb_control_destructor() to ctdb_client_control_destructor()
This avoids a name clash with a slightly different function in
ctdb_control.c.

This is in the context of wanting to run CCAN-style tests where most
of the ctdbd code is just included in the test program.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 82f6108bfbc7e48ca88650297c6a1c6ede0e1c9c)
2011-11-11 14:31:50 +11:00
Martin Schwenke
f186dd90b6 Move some common functions to common/ctdb_ltdb.c
Move identical copies of ctdb_null_func(), ctdb_fetch_func(),
ctdb_fetch_with_header_func() from ctdb_client.c and
ctdb_ltdb_server.c to somewhere common.

This is in the context of wanting to run CCAN-style tests where most
of the ctdbd code is just included in the test program.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 126cb0d369b2b1aed63801dc4ba0554399e8b7e4)
2011-11-11 14:31:50 +11:00
Martin Schwenke
c1e8ea08e3 Clean up warnings: log some unchecked return codes from function calls
In a few places functions are called, the return code is assigned into
a variable but it is not checked.  This generates a compiler warning
like this:

  warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]

Instead we remove the warning by checking the return code variable and
log a warning at DEBUG level if the return code indicates an error.
The justification is that there may have been a future intent to check
the return code but it hasn't been important enough to follow-up.  If
it matters, it will be logged for easy debugging.

Signed-off-by: Martin Schwenke <martin@meltin.net>

(This used to be ctdb commit 1932466c76de2b184c2a257120768ab8c9d6c12a)
2011-11-09 15:20:07 +11:00
Ronnie Sahlberg
a9e77de9e4 ReadOnly: Dont update the record header from the calling client. While it is convenient since it avoids having to create a child process from the main dameon for writing the updated record it makes the cleitn more complex.
Remove the code in the example client code that writes the record to the local tdb.
Add code to the local ctdbd processing of replies to check if this reply contain a ro delegation and if so, spawn a child process to lock the tdb and then write the data.

(This used to be ctdb commit bf1d429227dc4f5818263cc39401d0a22663cdba)
2011-10-24 13:14:26 +11:00
Ronnie Sahlberg
8e4bfba75c ReadOnly: Rename the function ctdb_ltdb_fetch_readonly() to ctdb_ltdb_fetch_with_header() since this is what it actually does.
(This used to be ctdb commit 94a5ce4e08e7891f07dbfe4c822ca4be5ab10965)
2011-09-13 18:38:20 +10:00
Ronnie Sahlberg
0dc5584101 Merge branch 'master-readonly-records' into foo
Conflicts:

	Makefile.in
	tools/ctdb.c

(This used to be ctdb commit 0fedef0ffba4178126eee9544c5e2db52f5db893)
2011-09-12 09:34:34 +10:00
David Disseldorp
2f925f1e64 pmda: Attempt reconnects while ctdbd is unavailable
Attempt to reconnect to ctdbd on fetch while it is unreachable.

We must provide our own queue callback wrapper, as ctdb_client_read_cb()
exits on transport failure.

(This used to be ctdb commit 28df6fbf1273b8d095a2bc38dca6a6c35c5c31bd)
2011-09-06 14:01:18 +02:00
David Disseldorp
5296da5609 client: add timeout argument to ctdb_attach
Rather than using a fixed 2 second CTDB_CONTROL_GETDBPATH timeout.

(This used to be ctdb commit 9e178671560cb95121e11d718a76b05380ecd6c5)
2011-09-06 13:57:04 +02:00
Ronnie Sahlberg
206a3c0c66 ReadOnly: add a new control to activate readonly lock capability for a database.
let all databases default to not support this  until enabled through this control

(This used to be ctdb commit 908a07c42e5135a3ba30a625fc4f4e4916de197a)
2011-09-01 11:08:18 +10:00
Ronnie Sahlberg
894faf1bf8 ReadOnly: When the client wants a readwrite lock but the local node is the dmaster and also have delegations active we must send a CALL to the local daemon to trigger it to revoke the delegations
(This used to be ctdb commit 1b7d42c3425e39dd2a1c4460e8a01fb1ea4a513c)
2011-08-23 10:35:38 +10:00