summaryrefslogtreecommitdiffstats
path: root/ctdb/client
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-client: Talloc tdb_wrap off ctdb_db_contextAmitay Isaacs2014-04-231-1/+2
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-client: Add client code to detach a databaseAmitay Isaacs2014-04-141-0/+19
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-client: ctdb_fetch_lock should check for readonly delegationsAmitay Isaacs2014-03-281-0/+15
| | | | | | | | 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>
* ctdb-client: Treat empty __db_sequence_number__ record as 0Amitay Isaacs2013-11-271-0/+5
| | | | | | | | | 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>
* ctdb-client: Coverity fixesAmitay Isaacs2013-11-191-1/+4
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* client: Make g_lock_lock() wait till lock is obtainedAmitay Isaacs2013-11-071-1/+11
| | | | | | | | | | 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)
* client: Fix a format string argument compiler warningMartin Schwenke2013-10-221-1/+1
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit f3413fb8b90c4d9f0c2c2a69825c66d080117193)
* client: Remove old persistent transaction codeAmitay Isaacs2013-10-041-445/+0
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 41bdbcfd72092cdd25da87e60689c087bca97933)
* client: Reimplement persistent transaction code using TRANS3_COMMITAmitay Isaacs2013-10-041-0/+290
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* client: Add functions to parse g_lock.tdb recordsAmitay Isaacs2013-10-041-0/+198
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 40589ae5259880431f358250c1f0d07bcaa21d1f)
* client: Add functions to handle server_id structureAmitay Isaacs2013-10-041-0/+66
| | | | | | | | 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)
* client: Fix some format string compiler warningsMartin Schwenke2013-10-041-2/+4
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 5619754343003016ede27014567dbb4701f97928)
* client: Add ctdb_ctrl_getdbseqnum() functionAmitay Isaacs2013-10-041-0/+34
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 8cb1fbbfe88327c9c7ab68e8eded586dff611e57)
* client: Add ctdb_ctrl_getdbstatistics() functionAmitay Isaacs2013-10-041-0/+54
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 1e7fca5cdc1d7205cf084e35aace1a5dc46ea294)
* client: Add ctdb_client_check_message_handlers() functionAmitay Isaacs2013-10-041-0/+35
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit c9a9d14c91f203ce964a426a8a1e2c1715af2098)
* client: Remove extra whitespacesAmitay Isaacs2013-10-041-3/+2
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 962eb63c6d500e29a03ae087757d81be449888c6)
* client: Remove unused function list_of_active_nodes_except_pnn()Martin Schwenke2013-09-111-8/+0
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit d8a76cf79f07dfb5a93c6c9a13f16e3268c7dd57)
* Revert "LACOUNT: Add back lacount mechanism to defer migrating a ↵Amitay Isaacs2013-08-221-11/+3
| | | | | | | | | | | | | | | | | | | 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)
* recoverd: Use TDB_INCOMPATIBLE_HASH when creating volatile databasesAmitay Isaacs2013-08-141-1/+7
| | | | | | | | | | | | 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)
* Revert "recoverd: Use correct tdb flags when creating missing databases"Amitay Isaacs2013-08-141-7/+5
| | | | | | | | | | | 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)
* recoverd: Use correct tdb flags when creating missing databasesAmitay Isaacs2013-08-011-5/+7
| | | | | | | | | | 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)
* client: Always use jenkins hash when attaching volatile databasesAmitay Isaacs2013-08-011-0/+8
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 7e7e59c4047c78159387089eca65d90037bcf722)
* Fix memory leak in ctdb_send_message()Sumit Bose2013-07-111-5/+1
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit da87395d29f5d11ecfedaf36b53fa060a9140bfd)
* Fixes for various issues found by CoveritySumit Bose2013-07-111-1/+1
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 05bfdbbd0d4abdfbcf28e3930086723508b35952)
* client: Exit with non-zero status when unix socket is closedAmitay Isaacs2013-06-251-2/+2
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 733fc909425860f6a02c205c2d8f34a731853922)
* build: Fix tdb.h path to enable building with system TDB libraryMathieu Parent2013-06-141-1/+1
| | | | (This used to be ctdb commit f8bf99de3a5f56be67aaa67ed836458b1cf73e86)
* client: async_callback() sets result to -ETIME if a control times outMartin Schwenke2013-05-241-0/+5
| | | | | | | | | | 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)
* ctdbd: Update the get_tunable code to return -EINVAL for unknown tunableMartin Schwenke2013-05-241-1/+1
| | | | | | | | | 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)
* ctdbd: New control CTDB_CONTROL_GET_RUNSTATEMartin Schwenke2013-05-241-0/+30
| | | | | | | | Also new client function ctdb_ctrl_get_runstate(). Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit dc4220e6f618cc688b3ca8e52bcb3eec6cb55bb1)
* client: fix ctdb_control() to be able to cope with CTDB_CTRL_FLAG_NOREPLYMichael Adam2013-04-241-0/+11
| | | | | | | | | | | | | | | 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)
* client: Set the socket non-blocking only after connect succeedsAmitay Isaacs2013-04-051-3/+3
| | | | | | | | | | | 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)
* Revert "client: handle transient connection errors"Amitay Isaacs2013-04-051-30/+5
| | | | | | | | | 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)
* client: Refactor node listing functions to use list_of_nodes()Martin Schwenke2013-02-201-81/+5
| | | | | | | | | 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)
* client: New generic node listing function list_of_nodes()Martin Schwenke2013-02-201-0/+38
| | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit a73bb56991b8c07ed0e9517ffcf0dc264be30487)
* util: ctdb_fork() closes all sockets opened by the main daemonMartin Schwenke2012-10-051-18/+6
| | | | | | | | | 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)
* server: Replace BOOL datatype with bool, True/False with true/falseAmitay Isaacs2012-05-281-4/+4
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 6e5cbe8fff71985e5a2fc16b7e9f2b868011ff5d)
* Remove explicit include of lib/tevent/tevent.h.Amitay Isaacs2012-04-131-1/+0
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 0681014ca5ed2a9b56f63fdace7f894beccf8a9a)
* STICKY: add prototype code to make records stick to a node to "calm" down if ↵Ronnie Sahlberg2012-03-201-0/+38
| | | | | | | | 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)
* LACOUNT: Add back lacount mechanism to defer migrating a fetched/read copy ↵Ronnie Sahlberg2012-03-201-3/+11
| | | | | | | | 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)
* READONLY: only send a control to schedule fast-vacuuming from child context ↵Ronnie Sahlberg2012-02-211-1/+3
| | | | | | | | | 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)
* Fix a cut&paste errorVolker Lendecke2012-01-181-1/+1
| | | | | | Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 488de939b78125ac38822760102e05298a5e70c5)
* fix zero-initialization of header in _ctdbd_allocate_pkt to the correct sizeMichael Adam2011-12-231-2/+1
| | | | (This used to be ctdb commit 6c4d1b768ccade344a7462ecad7cf5cbbf3873d4)
* traverse: fix traversing with empty records by adding a new (internal) ↵Michael Adam2011-12-031-2/+2
| | | | | | | | | | | | | 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)
* ctdb: add an option --print-recordflags to trigger printing record flags in ↵Michael Adam2011-11-291-9/+11
| | | | | | | | catdb and dumpdbbackup This changes the default behaviour to not print record flags. (This used to be ctdb commit 2d2ce07c51055d9400b22cd3c1fd682597cb921c)
* ctdb: add an option --print-hash to enable printing of record hashes when ↵Michael Adam2011-11-291-0/+4
| | | | | | dumping dbs (This used to be ctdb commit efc033c28ade97f9884794256d59a4553e052d5f)
* ctdb: add an option --print-lmaster to enable printing of lmaster in "ctdb ↵Michael Adam2011-11-291-0/+5
| | | | | | catdb" (This used to be ctdb commit 326f88ef622620cb9e0569c4497bc0e86124beaa)
* ctdb: add an option --print-datasize to only print datasize instead of ↵Michael Adam2011-11-291-7/+11
| | | | | | | | dumping data in db dumps Used in catdb, cattdb and dumpdbbackup. (This used to be ctdb commit dd866116041e71cbf91e7fd91edcc9501634051d)
* ctdb: add an option --print-emptyrecords to enable printing of empty records ↵Michael Adam2011-11-291-3/+6
| | | | | | | | in dumping databases this option is used with the commands catdb, cattdb and dumpdbbackup. (This used to be ctdb commit 6ec68a2e667f66d2b194fe48cb75229a2777842e)
* client: add version ctdb_traverse_ext() of ctdb_traverse() that can list ↵Michael Adam2011-11-291-7/+28
| | | | | | empty records. (This used to be ctdb commit 4ada4bfc4510886c5c7fcf49e09711b9d2dcb75d)
* traverse: add a flag to enable transferring empty records in cluster wide ↵Michael Adam2011-11-291-0/+1
| | | | | | | | | 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)