summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* vacuum: move variable into scope of use in ctdb_process_delete_list()Michael Adam2013-04-241-1/+1
| | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-By: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 4640979b526b6dac69a6a0555bfce75fe0206dac)
* vacuum: simplify ctdb_process_delete_list(): reduce indentationMichael Adam2013-04-241-113/+114
| | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-By: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit f3e6e7f8ef22bd70dd2f101d818e2e5ab5ed3cd8)
* vacuum: add DEBUG to skip conditions in delete_record_traverse()Michael Adam2013-04-241-5/+25
| | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-By: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 817c77a3d0a3546bf46389cec5f6b54778dd1693)
* vacuum: break line for RO-flags check in delete_record_traverse() for ↵Michael Adam2013-04-241-1/+5
| | | | | | | | | readability Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-By: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 3f7e35ff0db740cdcb6d27c43a59bb6ca6066efb)
* 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)
* ctdbd: Set num_clients statistic from ctdb->num_clientsAmitay Isaacs2013-04-222-3/+4
| | | | | | | | | | | | | | | | This fixes the problem of "ctdb statisticsreset" clearing the number of clients even when there are active clients. Values returned in statistics for frozen, recovering, memory_used are based on the current state of CTDB and are not maintained as statistics. This should include num_clients as well. Currently ctdb->num_clients is unused. So use that to track the number of clients and fill in statistics field only when requested. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit dc4ca816630ed44b419108da53421331243fb8c7)
* ctdbd: Log PID file creation and removal at NOTICE levelMartin Schwenke2013-04-221-3/+3
| | | | | | | | | Unexpected removal of this file can have serious consequences, so it is best if this is logged at the default level. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit bfed6a8d1771db3401d12b819204736c33acb312)
* scripts: Ensure even external scripts get tagged in logs as "ctdbd"Martin Schwenke2013-04-223-5/+5
| | | | | | | | | Our practice is to search logs for "ctdbd:". We want to make sure we find everything. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 5940a2494e9e43a83f2bca098bd04dfc1a8f2e93)
* eventscripts: Ensure directories are createdMartin Schwenke2013-04-221-0/+6
| | | | | | | | | | | | Previous commits stopped the top level of the script from creating certain directories but some functions assume that required directories exist. Create those directories instead. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 0076cfc4666e5a96eb2c8affb59585b090840e00)
* scripts: Clean up update_tickles() and handling of associated directoryMartin Schwenke2013-04-191-5/+2
| | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 700cf95a1f29b4b88460a00a55d57a9e397011e0)
* scripts: Use $CTDB_SCRIPT_DEBUGLEVEL instead of something more complexMartin Schwenke2013-04-196-64/+6
| | | | | | | | | | | | | | | | | | | The current logic is horrible and creates an unnecessary file. Let's make the script debug level independent of ctddb's debug level. * Have debug() use $CTDB_SCRIPT_DEBUGLEVEL directly * Remove ctdb_set_current_debuglevel() * Remove the "getdebug" command from ctdb stub in eventscript unit tests * Update relevant eventscript unit tests to use $CTDB_SCRIPT_DEBUGLEVEL Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 85efa446c7f5c5af1c3a960001aa777775ae562f)
* scripts: Ensure service command is in $PATH in ctdb-crash-cleanup.shMartin Schwenke2013-04-191-5/+5
| | | | | | | | | Move the use of the service command below inclusion of functions file, which sets $PATH. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit d254d03f69cbdc3e473202b759af6e1392cbb59c)
* initscript: Remove duplicate setting of $ctdbdMartin Schwenke2013-04-181-2/+0
| | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit e7a4b7e35a1e4b826846e2494a3803abb57065ee)
* util: Removed unused declaration of ctdbd_start()Martin Schwenke2013-04-181-1/+0
| | | | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 1e989894764e4cd1d551c44784d91cb295cd790d)
* include: Move ctdb_start_daemon() from ctdb_client.h to ctdb_private.hMartin Schwenke2013-04-182-1/+3
| | | | | | | | | | It really is internal. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit abb64f62efaa70df4b87c030b96300eafd98e6a3)
* scripts: ctdb-crash-cleanup.sh uses initscript to see if ctdbd is runningMartin Schwenke2013-04-181-1/+1
| | | | | | | | | | | "ctdb ping" can time out. How many times should we try? Instead, depend on the initscript to implement something sane. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 90cb337e5ccf397b69a64298559a428ff508f196)
* initscript: Use a PID file to implement the "status" optionMartin Schwenke2013-04-181-30/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using "ctdb ping" and "ctdb status" is fraught with danger. These commands can timeout when ctdbd is running, leading callers to believe that ctdbd is not running. Timeouts could be increased but we would still have to handle potential timeouts. Everything else in the world implements the "status" option by checking if the relevant process is running. This change makes CTDB do the same thing and uses standard distro functions. This change is backward compatible in sense that a missing /var/run/ctdb/ directory means that we don't do a PID file check but just depend on the distro's checking method. Therefore, if CTDB was started with an older version of this script then "service ctdb status" will still work. This script does not support changing the value of CTDB_VALGRIND between calls. If you start with CTDB_VALGRIND=yes then you need to check status with the same setting. CTDB_VALGRIND is a debug variable, so this is acceptable. This also adds sourcing of /lib/lsb/init-functions to make the Debian function status_of_proc() available. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 687e2eace4f48400cf5029914f62b6ddabb85378)
* ctdbd: Add --pidfile optionMartin Schwenke2013-04-183-1/+37
| | | | | | | | | | Default is not to create a pid file. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 996e74d3db0c50f91b320af8ab7c43ea6b1136af)
* util: ctdb_fork() should call ctdb_set_child_info()Martin Schwenke2013-04-181-0/+2
| | | | | | | | | | | For now we pass NULL as the child name. Later we'll give ctdb_fork() and friends an extra argument and pass that through. Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit ba8866d40125bab06391a17d48ff06a4a9f9da89)
* util: New functions ctdb_set_child_info() and ctdb_is_child_process()Martin Schwenke2013-04-182-0/+24
| | | | | | | | | Must be called by all child processes. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 59b019a97aad9a731f9080ea5be14d0dbdfe03d6)
* tests: add a comment to recovery db corruption testMichael Adam2013-04-171-0/+7
| | | | | | | | | The comment explains that we use "ctdb stop" and "ctdb continue" but we should use "ctdb setcrecmasterrole off". Signed-off-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 06ac62f890299021220214327f1b611c3cf00145)
* tests: Add a test for subsequent recoveries corrupting databasesAmitay Isaacs2013-04-171-0/+126
| | | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit b1577a11d548479ff1a05702d106af9465921ad4)
* tests: Support waiting for "recovered" state in testsAmitay Isaacs2013-04-171-1/+4
| | | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 2438f3a4944f7adbcae4cc1b9d5452714244afe7)
* ctdb_call: don't bump the rsn in ctdb_become_dmaster() any moreMichael Adam2013-04-171-1/+1
| | | | | | | | | | This is now done in ctdb_ltdb_store_server(), so this extra bump can be spared. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-By: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit cad3107b12e8392f786f9a758ee38cf3a3d58538)
* Fix a severe recovery bug that can lead to data corruption for SMB clients.Michael Adam2013-04-171-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Recovery can under certain circumstances lead to old record copies resurrecting: Recovery selects the newest record copy purely by RSN. At the end of the recovery, the recovery master is the dmaster for all records in all (non-persistent) databases. And the other nodes locally hold the complete copy of the databases. The bug is that the recovery process does not increment the RSN on the recovery master at the end of the recovery. Now clients acting directly on the Recovery master will directly change a record's content on the recmaster without migration and hence without RSN bump. So a subsequent recovery can not tell that the recmaster's copy is newer than the copies on the other nodes, since their RSN is the same. Hence, if the recmaster is not node 0 (or more precisely not the active node with the lowest node number), the recovery will choose copies from nodes with lower number and stick to these. Here is how to reproduce: - assume we have a cluster with at least 2 nodes - ensure that the recmaster is not node 0 (maybe ensure with "onnode 0 ctdb setrecmasterrole off") say recmaster is node 1 - choose a new database name, say "test1.tdb" (make sure it is not yet attached as persistent) - choose a key name, say "key1" - all clustere nodes should ok and no recovery running - now do the following on node 1: 1. dbwrap_tool test1.tdb store key1 uint32 1 2. dbwrap_tool test1.tdb fetch key1 uint32 ==> 1 3. ctdb recover 4. dbwrap_tool test1.tdb store key1 uint32 2 5. dbwrap_tool test1.tdb fetch key1 uint32 ==> 2 4. ctdb recover 7. dbwrap_tool test1.tdb fetch key1 uint32 ==> 1 ==> BUG This is a very severe bug, since when applied to Samba's locking.tdb database, it means that for SMB clients on clustered Samba there is the potential for locking out oneself from previously opened files or even worse, data corruption: Case 1: locking out - client on recmaster opens file - recovery propagates open file handle (entry in locking.tdb) to other nodes - client closes file - client opens the same file - recovery resurrects old copy of open file record in locking.tdb from lower node - client closes file but fails to delete entry in locking.tdb - client tries to open same file again but fails, since the old record locks it out (since the client is still connected) Case 2: data corruption - clien1 on recmaster opens file - recovery propagates open file info to other nodes - client1 closes the file and disconnects - client2 opens the same file - recovery resurrects old copy of locking.tdb record, where client2 has no entry, but client1 has. - but client2 believes it still has a handle - client3 opens the file and succees without conflicting with client2 (the detached entry for client1 is discarded because the server does not exist any more). => both client2 and client3 believe they have exclusive access to the file and writing creates data corruption Fix: When storing a record on the dmaster, bump its RSN. The ctdb_ltdb_store_server() is the central function for storing a record to a local tdb from the ctdbd server context. So this is also the place where the RSN of the record to be stored should be incremented, when storing on the dmaster. For the case of the record migration, this is currently done in ctdb_become_dmaster() in ctdb_call.c, but there are other places such as in recovery, where we should bump the RSN, but currently don't do it. So moving the RSN incrementation into ctdb_ltdb_store_server fixes the recovery-record-resurrection bug. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-By: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit feb1d40b21a160737aead22e398f3c34ff3be8de)
* logging: fix comment typoMichael Adam2013-04-171-1/+1
| | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 4c0cbfbe8b19f2e6fe17093b52c734bec63dd8b7)
* ctdbd: unimplement the unused SET_DMASTER controlMichael Adam2013-04-174-56/+4
| | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 2e92deef5221ee651028ef87138b3113f1fece91)
* recoverd: remove bogus comment "qqq" from "add prototype new banning code"Michael Adam2013-04-171-1/+0
| | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 9f01b8db72780acf2f88f1392bc0a796dd4c6176)
* build: silence building of porting_testMichael Adam2013-04-171-1/+1
| | | | | | | Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit e96acf19b4d1e0f951ab92b88869a01ff06398be)
* traverse: Ensure backward compatibility for CTDB_CONTROL_TRAVERSE_ALLAmitay Isaacs2013-04-171-12/+31
| | | | | | | | | | This makes sure that CTDB_CONTROL TRAVERSE_ALL is compatible with older versions of CTDB (i.e. 1.2.39 and 1.2.40 branches). Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 5808f0778b39b79ab7a5c7f53ad27947131386ec)
* traverse: Add CTDB_CONTROL_TRAVERSE_ALL_EXT to support withemptyrecordsAmitay Isaacs2013-04-174-0/+63
| | | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit e691df43d20871468142c8fb83f7c7303c4ec307)
* tests: Fix typo in variable nameAmitay Isaacs2013-04-151-1/+1
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 043e18a8324ccb2c8ddd7b323ebedb5b0de1298d)
* tools/ltdbtool: Fix handling of -e optionAmitay Isaacs2013-04-081-3/+6
| | | | | | | | Also, include description of -e option in usage. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 35264e42ade4676468cf7713fa339c784e932953)
* recoverd/takeover: Use IP->node mapping info from nodes hosting that IPAmitay Isaacs2013-04-081-1/+7
| | | | | | | | | | When collating IP information for IP layout, only trust the nodes that are hosting an IP, to have correct information about that IP. Ignore what all the other nodes think. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 1c7adbccc69ac276d2b957ad16c3802fdb8868ca)
* statd-callout: Make sure statd callout script always runs as rootAmitay Isaacs2013-04-084-1/+10
| | | | | | | | | | | In RHEL 6+, rpc.statd runs as "rpcuser" instead of root as on RHEL 5. This prevents CTDB tool commands talking to daemon since "rpcuser" cannot access CTDB socket. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Pair-Programmed-With: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit fe8c4880b371492a38554868d4ca10918c54e412)
* client: Set the socket non-blocking only after connect succeedsAmitay Isaacs2013-04-052-6/+6
| | | | | | | | | | | 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)
* common/messaging: Use the jenkins hash in ctdb_messageVolker Lendecke2013-04-051-1/+3
| | | | | | This give a better hash distribution (This used to be ctdb commit f7f8bde2376f8180a0dca6d7b8d7d2a4a12f4bd8)
* common/messaging: use tdb_parse_record in message_list_db_fetchVolker Lendecke2013-04-051-11/+17
| | | | | | This avoids malloc/free in a hot code path. (This used to be ctdb commit c137531fae8f7f6392746ce1b9ac6f219775fc29)
* common/messaging: Abstract db related operations inside db functionsAmitay Isaacs2013-04-051-57/+39
| | | | | | | | | This simplifies the use of message indexdb API and abstracts tdb related code inside the API. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit bf7296ce9b98563bcb8426cd035dbeab6d884f59)
* common/messaging: Don't forget to free the result returned by tdb_fetch()Amitay Isaacs2013-04-051-0/+6
| | | | | | | | This fixes a memory leak in the messaging code. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 20be1f991dd75c2333c9ec9db226432a819f57ba)
* common/messaging: Free message list header if all message handlers are freedAmitay Isaacs2013-04-051-3/+3
| | | | | | | | | | This makes sure that even if the srvids are not deregistered, the header structure is freed when the last message handler has been freed as a result of client going away. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 4e1ec7412866f2d31c41de1bec0fbf788c03051b)
* build: Fix for tevent autoconf checkSumit Bose2013-03-271-1/+1
| | | | | | The list of include files is the 4th argument of AC_CHECK_DECLS. (This used to be ctdb commit 85b777196289646ca37e06ebbf1f7a684d0aabc5)
* util: Add hex_decode_talloc() to decode hex string into a binary blobAmitay Isaacs2013-03-252-0/+17
| | | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 307416afda707b687f5e89e8438e45c154a4c806)
* logging: Do not ignore stdout/stderr from the exec'd childrenAmitay Isaacs2013-03-251-5/+0
| | | | | | | | | | To log debugging information from child processes that are started with vfork and exec, do not set close_on_exec on STDOUT and STDERR for that process. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 08c53ee609b80f87450a7a1d7dd24fbcdf5ab7bc)
* 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)
* fix a typoVolker Lendecke2013-03-121-1/+1
| | | | | | Reviewed-by: Michael Adam <obnox@samba.org> (This used to be ctdb commit 98abd344342a011a8599411deae79f94abc09541)
* common/io: For scheduling immediate events use tevent_schedule_immediateAmitay Isaacs2013-03-061-11/+15
| | | | | | | | | | tevent_schedule_immediate() is much more efficient at handling events that need to be processed immediately rather than creating timed events with timeval_zero(). Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 11734be353a1e246163eda631d35dfe55d1d6fb1)
* ctdbd: Add an index db for message list for faster searchesAmitay Isaacs2013-03-063-23/+203
| | | | | | | | | | | When CTDB is busy with lots of smbd, CTDB was spending too much time in daemon_check_srvids() which searches a list of srvids in the registered message handlers. Using a hash based index significantly improves the performance of search in a linked list. Signed-off-by: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 3e09f25d419635f6dd679b48fa65370f7860be7d)
* tools/ctdb: delip no longer fails if IP can not be movedMartin Schwenke2013-02-271-76/+83
| | | | | | | | | | | | Moving the IP is an optimisation so should not cause failure. Refactor and simplify the retry-move-IP into new function try_moveip(). Signed-off-by: Martin Schwenke <martin@meltin.net> Pair-programmed-with: Amitay Isaacs <amitay@gmail.com> (This used to be ctdb commit 5402f85dde045576cbaf64e01c68e28ed52204e8)