summaryrefslogtreecommitdiffstats
path: root/ctdb/server/ctdb_persistent.c
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-util: Rename db_wrap to tdb_wrap and make it a build subsystemMartin Schwenke2014-09-101-1/+1
| | | | | | | | | | | | | | | 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>
* ctdbd: Remove transaction code related to TRANS2 commitsAmitay Isaacs2013-10-041-310/+3
| | | | | | | | | This removes data types and structure elements related to TRANS2 persistent transaction code. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 22a253b7ccf1ff854cddf0b67969dc84d7d6a654)
* build: Fix tdb.h path to enable building with system TDB libraryMathieu Parent2013-06-141-1/+1
| | | | (This used to be ctdb commit f8bf99de3a5f56be67aaa67ed836458b1cf73e86)
* server:persistent: fix a debug message (copy'n'paste error)Michael Adam2013-03-121-2/+3
| | | | | | Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 87c89b7c2a14e2ee79a3efc7e8125842bc04bf23)
* server:persistent: fix a comment typo.Michael Adam2013-02-221-1/+1
| | | | | | Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 6455ce5e4980a63d56ed30f7059869c8356c12ea)
* 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)
* server: move the code for the update_record control to its own fileMichael Adam2012-02-211-309/+0
| | | | | | | It is very misleading in ctdb_persistent.c, since it is used for non-persistent dbs... (This used to be ctdb commit a956fa3a27106d0154a3fb46987d61c0a6b7c768)
* Revert "ReadOnly: We can not use ctdb_ltdb_store from a client/child context ↵Ronnie Sahlberg2012-02-211-23/+10
| | | | | | | | | | since" This reverts commit 11dee7f3f881494cf5089d6c69fd40e74f07e670. Try to solve this a different way so that ctdb_ltb_store() becomes safe to use also from child context (This used to be ctdb commit 5990fe65a9cc37933ceff15d4cb2ab3b3a0addb6)
* ReadOnly: We can not use ctdb_ltdb_store from a client/child context sinceRonnie Sahlberg2012-02-201-10/+23
| | | | | | | | it sometimes (for empty records) needs to be able to initiate traffic unde rhte daemon context. This should furhter updated later to allow the use also from non-daemon context. (This used to be ctdb commit 11dee7f3f881494cf5089d6c69fd40e74f07e670)
* DB Seqnum: must provide a ctdb_ltdb_header when calling ctdb_ltdb_fetch()Ronnie Sahlberg2011-11-301-1/+2
| | | | (This used to be ctdb commit 1fea9ef55a6a9d201ad1b49583451ac3e6b1c66d)
* persistent: add ctdb_persistent_finish_trans3_commits().Michael Adam2011-02-241-0/+34
| | | | | | | | This function walks all databases and checks for running trans3 commits. It sends replies to all of them (with error code) and ends them. To be called when a recovery finishes. (This used to be ctdb commit 70ba153b532528bdccea70c5ea28972257f384c1)
* persistent: add a client context to the persistent_stat and track the db_idMichael Adam2011-02-241-7/+24
| | | | | | | | | | | The db_id is tracked in the client context as an indication that a transaction commit is in progress. This is cleared in the persistent_state talloc destructor. This is in order to properly treat running trans3_commits if the client disconnects. (This used to be ctdb commit e886ff24f4e3e250944289db95916b948893d26c)
* persistent: reject trans3_control when a commit is already active.Michael Adam2011-02-241-0/+8
| | | | | | This should actually never happen. (This used to be ctdb commit f416e76838fe2adf629d4356d1cc87054b1af164)
* persistent: allocate the persistent state in the ctdb_db struct in trans3_commitMichael Adam2011-02-241-2/+14
| | | | | | | | | Make sure that ctdb_db->persistent_state is correctly NULL-ed when the state is freed. This way, we can use ctdb_db->persistent_state as an indication for whether a transaction commit is currently running. (This used to be ctdb commit 761cb235193564a0f337d0308f0a9e6de0ef2710)
* persistent: add a ctdb_db context to the ctdb_persistent_state struct.Michael Adam2011-02-241-0/+1
| | | | (This used to be ctdb commit a14917c983c3b9bbbf38f5ddeecdbbe5bde32364)
* persistent_callback: print "no error message given" instead of "(null)"Michael Adam2011-02-241-1/+1
| | | | (This used to be ctdb commit d871a38978219e004833608c11aae98fe47614b9)
* persistent: reduce indentation for the finishing moves in ↵Michael Adam2011-02-241-11/+15
| | | | | | ctdb_persistent_callback (This used to be ctdb commit 2c2d1646eb753ea9561f085bcb101153267b052b)
* persistent: if a node failed to update_record, trigger a recoveryMichael Adam2011-02-241-0/+11
| | | | | | | and stop processing of the update_record replies in order to let the recovery finish the trans3_commit control. (This used to be ctdb commit cab95570dc1eefb08abbac5ae411c29f699b51cc)
* persistent_store_timout: do not really time out the trans3_commit control in ↵Michael Adam2011-02-241-1/+7
| | | | | | | | | | | recovery If a recovery was started, then all further processing of the update_record controls sent by the trans3_commit control and timing them out is disabled. The recovery should trigger sending the reply for the update record control when finished. (This used to be ctdb commit 983c1ca2e18ecd60fca69bfe9e116125cc695857)
* persistent_callback: ignore the update-recordreturn code of remote node in ↵Michael Adam2011-02-241-0/+6
| | | | | | | | | | recovery If a recovery was started, then all further processing of the update_record controls sent by the trans3_commit control is disabled. The recovery should trigger sending the reply for the update record control when finished. (This used to be ctdb commit 12cf0619255b12230843cd8bb49cbfdea376ca2f)
* Add ctdb_fork(0 which will fork a child process and drop the real-timeRonnie Sahlberg2011-01-111-1/+1
| | | | | | | | | scheduler for the child. Use ctdb_fork() from callers where we dont want the child to be running at real-time privilege. (This used to be ctdb commit 58795a4c9e0624e20fa3e0023b65127053edd103)
* Update latency countes to show min/max and averageRonnie Sahlberg2010-10-111-1/+1
| | | | (This used to be ctdb commit 1919e949af4641ffe919123e44b02fb87c13ab9f)
* Create macros to update the statistics counters and use these macrosRonnie Sahlberg2010-09-291-9/+9
| | | | | | everywhere instead of manipulating the coutenrs directly. (This used to be ctdb commit 2e648df890e5713bc575965d87937827b068d0d7)
* Merge commit 'rusty/ports-from-1.0.112' into fooRonnie Sahlberg2010-08-191-0/+1
|\ | | | | | | (This used to be ctdb commit 13e58d92f5f1723e850a82ae030d0ca57e89b1ee)
| * logging: give a unique logging name to each forked child.Rusty Russell2010-08-181-0/+1
| | | | | | | | | | | | | | | | This means we can distinguish which child is logging, esp. via syslog where we have no pid. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 68b3761a0874429b90731741f0531f76dcfbb081)
* | event: Update events to latest Samba version 0.9.8Rusty Russell2010-08-181-2/+3
|/ | | | | | | | | | | | | In Samba this is now called "tevent", and while we use the backwards compatibility wrappers they don't offer EVENT_FD_AUTOCLOSE: that is now a separate tevent_fd_set_auto_close() function. This is based on Samba version 7f29f817fa939ef1bbb740584f09e76e2ecd5b06. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (This used to be ctdb commit 85e5e760cc91eb3157d3a88996ce474491646726)
* Drop the debug level for logging fd creation to DEBUG_DEBUGRonnie Sahlberg2010-02-041-1/+1
| | | | (This used to be ctdb commit eae1d4f9e52e73b4d8769868fffdafa590d03784)
* server: Use tdb_check to verify persistent tdbs on startupStefan Metzmacher2009-12-161-0/+12
| | | | | | | | | | | | | | | | | | | | Depending on --max-persistent-check-errors we allow ctdb to start with unhealthy persistent databases. The default is 0 which means to reject a startup with unhealthy dbs. The health of the persistent databases is checked after each recovery. Node monitoring and the "startup" is deferred until all persistent databases are healthy. Databases can become healthy automaticly by a completely HEALTHY node joining the cluster. Or by an administrator with "ctdb backupdb/restoredb" or "ctdb wipedb". metze (This used to be ctdb commit 15f133d5150ed1badb4fef7d644f10cd08a25cb5)
* Add a new control CTDB_GET_DB_SEQNUM - fetch a persistent db's sequence number.Michael Adam2009-12-121-0/+66
| | | | | | Michael (This used to be ctdb commit a7e3b5fac6b3f5d74473f26eb86c067b35647996)
* server: add a new control CTDB_CONTROL_TRANS3_COMMITMichael Adam2009-12-121-0/+85
| | | | | | | | | | | | | | | | | | This is a simplified version of the trans2 commit control: It just rolls out the marshall buffer to all active nodes. It is the main ctdbd part of the re-implementation of the persistent transactions. The client code is changed to take a global lock to start a transactions and store into the marshal buffer instead of writing to the local tdb under a local transaction. The old transaction implementation is going to be removed in a later commit. Michael (This used to be ctdb commit f66428f9d2013080a414404c1ba6117888352fd6)
* server:trans2_commit: move the check for active recovery down.Michael Adam2009-12-041-5/+5
| | | | | | | | | | | This needs to be done after the control-dispatcher: In the TRANS2_COMMIT control, the client->db_id needs to be set before bailing out, since otherwise the next TRANS2_COMMIT_RETRY will fail... Michael (This used to be ctdb commit 59faf3f923a5989b5ee94ef02a12827412775bae)
* server: fix debug message in trans2_commit (refusing persistent store during ↵Michael Adam2009-10-301-4/+5
| | | | | | | | | | | transaction) log the right db_id also log the client_id Michael (This used to be ctdb commit 48ac5c77698ab7a28d24629cc8a6985011c5d14d)
* server: uniformly log db and client ids as 8-digit hex numbers in trans2_commitMichael Adam2009-10-301-8/+9
| | | | | | Michael (This used to be ctdb commit 2febdd23f754a2d4699bed36b941442ab362a376)
* server: line-wrap a debug statement in trans2_commitMichael Adam2009-10-301-2/+4
| | | | | | Michael (This used to be ctdb commit 3be446434adb0f3095ac0ef4b7c4a6258780b863)
* server: output client_id in some debug messages in trans2_commitMichael Adam2009-10-301-5/+8
| | | | | | Michael (This used to be ctdb commit 11fefd02e6c9531ffb28b9e6acaf42ba39757d87)
* server: fix a debug message in trans2_commit - log the correct db_idMichael Adam2009-10-301-3/+3
| | | | | | Michael (This used to be ctdb commit ab9657b5a66d5665e6c5fd1bf8eb4074a3bffeec)
* server: extend a debug message in ctdb_control_trans2_error()Michael Adam2009-10-301-1/+3
| | | | | | Michael (This used to be ctdb commit 0fb9573d1c838b436ab9be83e197b68f35f94acb)
* server: add positive debug statements to trans2_commit and trans2_finishedMichael Adam2009-10-301-0/+11
| | | | | | | | When the operation completed / started successfully. Michael (This used to be ctdb commit 0df012d58eb83195ea0365be19e0566dbc394a66)
* server: trans2_active: don't report a transaction active on the node that ↵Michael Adam2009-10-301-0/+6
| | | | | | | | | | performs the transaction Otherwise a node can lock itself out, e.g. when a commit control times out... Michael (This used to be ctdb commit cb432e30351d5e5a41e98da3c7b1c2a4d400a3a2)
* Revert "update the "uptime" command to indicate the "time since last" is the ↵Ronnie Sahlberg2009-10-291-0/+20
| | | | | | | | time since the last recovery OR failover." This reverts commit 3b0d44497800a16400d05a30bdaf6e6c285d4b36. (This used to be ctdb commit cb36bbb5418290e8e5b770d2d836285b15da2a6f)
* update the "uptime" command to indicate the "time since last" is the time ↵Ronnie Sahlberg2009-10-291-20/+0
| | | | | | since the last recovery OR failover. (This used to be ctdb commit 3b0d44497800a16400d05a30bdaf6e6c285d4b36)
* server: add a new ctdb control CTDB_TRANS2_ACTIVEMichael Adam2009-10-291-0/+20
| | | | | | | | | | | | | This aske the daemon wheter a transaction is currently active on a given DB on that node. More precisely this asks for the transaction_active flag in the ctdb_db_context that is set in the CTDB_TRANS2_COMMIT control and cleared in the CTDB_TRANS2_ERROR or CTDB_TRANS2_FINISHED controls. This will be useful for fixing race conditions in the transaction code. Michael (This used to be ctdb commit 8d430ae6968dfe566614379436fc3c56003fcd88)
* In ctdb_ltdb_store(), add a missing transaction_cancel when local store failed.Michael Adam2009-10-211-1/+1
| | | | | | | | Spotted by Volker. Michael (This used to be ctdb commit 0a4d409baabf242a87c06293789d589c896b104c)
* add logging everytime we create a filedescriptor in the main ctdb daemonRonnie Sahlberg2009-10-151-0/+4
| | | | | | | | | so we can spot if there are leaks. plug two leaks for filedescriptors related to when sending ARP fail and one leak when we can not parse the local address during tcp connection establish (This used to be ctdb commit ddd089810a14efe4be6e1ff3eccaa604e4913c9e)
* ctdbd: refuse PERSISTENT_STORE if transaction is running.Michael Adam2009-07-291-0/+5
| | | | | | Michael (This used to be ctdb commit c07d6d90f7afd19213ad44624c3e2b9c85f4eea8)
* Fix persistent transaction commit race condition.Michael Adam2009-07-291-1/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In ctdb_client.c:ctdb_transaction_commit(), after a failed TRANS2_COMMIT control call (for instance due to the 1-second being exceeded waiting for a busy node's reply), there is a 1-second gap between the transaction_cancel() and replay_transaction() calls in which there is no lock on the persistent db. And due to the lack of global state indicating that a transaction is in progress in ctdbd, other nodes may succeed to start transactions on the db in this gap and even worse work on top of the possibly already pushed changes. So the data diverges on the several nodes. This change fixes this by introducing global state for a transaction commit being active in the ctdb_db_context struct and in a db_id field in the client so that a client keeps track of _which_ tdb it as transaction commit running on. These data are set by ctdb upon entering the trans2_commit control and they are cleared in the trans2_error or trans2_finished controls. This makes it impossible to start a nother transaction or migrate a record to a different node while a transaction is active on a persistent tdb, including the retry loop. This approach is dead lock free and still allows recovery process to be started in the retry-gap between cancel and replay. Also note, that this solution does not require any change in the client side. This was debugged and developed together with Stefan Metzmacher <metze@samba.org> - thanks! Michael (This used to be ctdb commit f88103516e5ad723062fb95fcb07a128f1069d69)
* add control and logging of very high latencies.Ronnie Sahlberg2008-10-301-1/+1
| | | | | | | log the type of operation and the database name for all latencies higher than a treshold (This used to be ctdb commit 1d581dcd507e8e13d7ae085ff4d6a9f3e2aaeba5)
* added a new control CTDB_CONTROL_TRANS2_COMMIT_RETRY so we can tell Andrew Tridgell2008-08-081-3/+9
| | | | | | | the difference between a initial commit attempt and a retry, which allows us to get the persistent updates counter right for retries (This used to be ctdb commit 7f29c50ccbc7789bfbc20bcb4b65758af9ebe6c5)
* return a more detailed error code from a trans2 commit errorAndrew Tridgell2008-08-081-2/+21
| | | | (This used to be ctdb commit 6915661a460cd589b441ac7cd8695f35c4e83113)
* fixed a looping error bug with the new transactions codeAndrew Tridgell2008-08-081-3/+11
| | | | (This used to be ctdb commit 0592ba2a4fbd1b3b7a6bd0780eadbd6d449baaad)