summaryrefslogtreecommitdiffstats
path: root/ctdb/server
Commit message (Collapse)AuthorAgeFilesLines
* ctdb-daemon: Use statically allocated arrays for helper pathsMartin Schwenke2015-03-102-33/+19
| | | | | | | | The use of talloc with a static variable is somewhat confusing. Statically allocate an array and use ctdb_set_helper() instead. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-locking: Back-off from logging every 10 secondsAmitay Isaacs2015-03-051-4/+16
| | | | | | | | | | | | | | | | | | | If ctdb_lock_helper cannot get a lock within 10 seconds, ctdb daemon logs a message and invokes an external debug script. This is repeated every 10 seconds. In case of a contention or on a loaded system, there can be multiple ctdb_lock_helper processes waiting to get lock on record(s). For each lock request taking longer, ctdb daemon will flood the log every 10 seconds. Instead of logging aggressively every 10 seconds, relax logging to every 100s and 1000s if the elapsed time has exceeded 100s and 1000s respectively. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Thu Mar 5 12:06:44 CET 2015 on sn-devel-104
* ctdb-client: Return a value of 1 when setting obsolete tunable variableMartin Schwenke2015-02-181-0/+1
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Abort when daemon can take recovery lock during recoveryMartin Schwenke2015-02-131-2/+4
| | | | | | | | 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 13 09:48:15 CET 2015 on sn-devel-104
* ctdb-recoverd: Improve error messages on recovery lock coherence failMartin Schwenke2015-02-131-12/+14
| | | | | | | | | | | When the daemon is able to take the recovery lock during recovery we might as well guess that the cluster filesystem has a lock coherence problem and print a more useful message. This will be more helpful to those trying out cluster filesystems that don't have lock coherence or that are difficult to setup. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Don't release and re-take the recovery lockMartin Schwenke2015-02-131-20/+26
| | | | | | | | Just continue to hold it, otherwise a broken node might win an election and grab the lock. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Simplify ctdb_recovery_lock()Martin Schwenke2015-02-132-31/+21
| | | | | | | | | | | | | | Have it just silently take or fail to take the lock, except on an unexpected failure (where it should log an error). This means that when it is called we need to keep the old behaviour and explicitly release the lock. In do_recovery() the lock is released and a message is printed before attempting to take the lock. In the daemon sanity check the lock must be released in the error path if it is actually taken. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Remove check_recovery_lock()Martin Schwenke2015-02-131-179/+3
| | | | | | | | | This has not done anything useful since commit b9d8bb23af8abefb2d967e9b4e9d6e60c4a3b520. Instead, just check that the lock is held. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Improve logging when recovery lock file is changedMartin Schwenke2015-02-131-1/+5
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: New function ctdb_recovery_unlock()Martin Schwenke2015-02-132-19/+14
| | | | | | | | Unlock the recovery lock file. This way knowledge of the file descriptor isn't sprinkled throughout the code. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: New function ctdb_recovery_have_lock()Martin Schwenke2015-02-132-2/+7
| | | | | | | True if this recovery daemon holds the lock. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Log a warning when setting obsolete tunablesMartin Schwenke2015-02-131-0/+6
| | | | | Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Mark tunable VerifyRecoveryLock as obsoleteMartin Schwenke2015-02-134-20/+10
| | | | | | | | | | | | | | | It is pointless having a recovery lock but not sanity checking that it is working. Also, the logic that uses this tunable is confusing. In some places the recovery lock is released unnecessarily because the tunable isn't set. Simplify the logic by assuming that if a recovery lock is specified then it should be verified. Update documentation that references this tunable. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Fix SET_RECLOCK_FILE regressionMartin Schwenke2015-02-041-1/+2
| | | | | | | | | If the recovery lock file is unset then this dereferences a NULL pointer. The regression is due to commit 6f1ac7af0f87d85402d708231e45a69713bba026. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb: improve helpfulness of debug message when taking reclock failsMichael Adam2015-01-091-1/+5
| | | | | | | | | | Print out the errno if the fcntl call. Signed-off-by: Michael Adam <obnox@samba.org> Reviewed-by: Richard Sharpe <rsharpe@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Fri Jan 9 04:25:02 CET 2015 on sn-devel-104
* ctdb-daemon: Handle out-of-memory when setting recovery lock fileMartin Schwenke2015-01-091-8/+26
| | | | | | | | Log a message when the reclock file actually changes and avoid a memory allocation when it doesn't change. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-daemon: Use correct tdb flags when enabling robust mutex supportAmitay Isaacs2014-12-193-18/+44
| | | | | | | 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>
* ctdb/server: add format string checking to ctdb_tevent_logging()Stefan Metzmacher2014-12-171-1/+5
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-daemon: Trust vnn->interface for an IP when releasing itMartin Schwenke2014-12-051-24/+1
| | | | | | | | | | | | | | | | | | | | ctdb_sys_find_ifname() doesn't work for IPv6 addresses so don't use it. Trust the eventscript to do sanity checking on the interface. Current warnings are replaced with equivalents generated by the eventscript. The unlikely message: Public IP %s is hosted on interface %s but we have no VNN will be replaced by: WARNING: Public IP %s hosted on interface %s but VNN says __none__ which is clear enough. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-recoverd: Process all the records for vacuum fetch in a loopAmitay Isaacs2014-12-051-4/+1
| | | | | | | | | | | | | | Processing one migration request at a time is very slow and processing a batch of records can take longer than VacuumInterval. This causes subsequent vacuum fetch requests to be dropped. The dropped records can accumulate quickly and will cause the vacuum database traverse to be quite expensive. 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 Dec 5 17:06:58 CET 2014 on sn-devel-104
* ctdb-vacuum: Do not delete VACUUM MIGRATED records immediatelyAmitay Isaacs2014-12-051-0/+5
| | | | | | | | Such records should be processed by the local vacuuming daemon to ensure that all the remote copies have been deleted first. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-vacuum: Use non-blocking lock when traversing delete treeAmitay Isaacs2014-12-051-5/+1
| | | | | | | | This avoids vacuuming getting in the way of ctdb daemon to process record requests. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-vacuum: Use non-blocking lock when traversing delete queueAmitay Isaacs2014-12-051-5/+1
| | | | | | | | This avoids vacuuming getting in the way of ctdb daemon to process record requests. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-vacuum: Stagger vacuuming child processesAmitay Isaacs2014-12-051-0/+11
| | | | | | | | This prevents multiple child processes being forked at the same time for vacuuming TDBs. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-vacuum: Track time for vacuuming in database statisticsAmitay Isaacs2014-12-051-0/+1
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Improve error handling for running event scriptsAmitay Isaacs2014-11-142-19/+39
| | | | | | | | 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): Fri Nov 14 03:06:12 CET 2014 on sn-devel-104
* ctdb: Rename CTDB_VERSION to CTDB_PROTOCOLAmitay Isaacs2014-10-281-3/+3
| | | | | | | CTDB_VERSION really is the ctdb protocol version. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Michael Adam <obnox@samba.org>
* ctdb-logging: Add logging via UDP logging using RFC5424Martin Schwenke2014-10-281-3/+59
| | | | | | | | Some implementations may not understand RC3164 format messages on the UDP socket, so add support for RFC5424 message format. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-logging: Add logging via UDP to 127.0.0.1:514 to syslog backendMartin Schwenke2014-10-281-8/+64
| | | | | | | | | This has most of the advantages of the old logd with none of the complexity of the extra process. There are several good syslog implementations that can listen on the UDP port. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-logging: Add non-blocking Unix domain logging to syslog backendMartin Schwenke2014-10-281-1/+139
| | | | | | | Format messages as per RFC3164. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-logging: New option CTDB_LOGGING, remove CTDB_LOGFILE, CTDB_SYSLOGMartin Schwenke2014-10-284-30/+78
| | | | | | | | | | | | Remove --logfile and --syslog daemon options and replace with --logging. Modularise and clean up logging initialisation code. The initialisation API includes an app_name argument that is currently unused - this will be used in extensions to the syslog backend. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-logging: Replace logd code with a basic syslog(3) implementationMartin Schwenke2014-10-283-220/+8
| | | | | | | | | | | | | | It is much simpler for most cases to have a syslog backend that doesn't need a separate CTDB-specific logging daemon. This loses the lossy, non-blocking mode provided by logd. However, a corresponding feature with a completely different implemention (not requiring an extra daemon) will be re-added into the syslog backend. In an ideal world the new implementation would be added first but unfortunately that is hard to do because the logd code is hooked in at more than one place. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-logging: Simplify file logging timestamping with timeval_str_buf()Martin Schwenke2014-10-281-9/+7
| | | | | | | If nothing else, this is slightly more portable. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-logging: Separate out syslog and file logging backendsMartin Schwenke2014-10-283-285/+377
| | | | | | | | | This makes the code cleaner and allows the syslog backend to be easily modified without affecting other code. Also do some extra clean-up, including whitespace fixups. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-logging: Remove ctdb element from struct ctdb_log_stateMartin Schwenke2014-10-281-6/+2
| | | | | | | | This is set but otherwise not used. This allows the 1st argument to ctdb_set_logfile() to be generalised to a TALLOC_CTX. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-logging: Remove log member from struct ctdb_contextMartin Schwenke2014-10-281-12/+11
| | | | | | | | | This is only used by logging code and there is already a file-level variable for this. struct ctdb_context already contains too many things. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-logging: Rename ctdb_log_handler() to ctdb_child_log_handler()Martin Schwenke2014-10-281-4/+5
| | | | | | | Now it is obvious that it has something to do with child processes. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-logging: Remove debug levels DEBUG_ALERT and DEBUG_CRITMartin Schwenke2014-10-281-6/+0
| | | | | | | | | | | | | | Internally map them to DEBUG_ERR to limit code churn. This reduces the unwieldy number of debug levels used by CTDB. ALERT and CRIT aren't of much use as separate errors, since everything from ERR up should always be logged. In future just ERR can be used. This also improves compatibility with Samba's debug.c system priority mapping. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-logging: Remove DEBUG_EMERGMartin Schwenke2014-10-281-3/+0
| | | | | | | | | | It isn't used and shouldn't be. CTDB can't make the system unusable. Update associated test to ensure that EMERG isn't attempted. Actually test all remaining debug levels and modernise the test a bit. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-logging: Add missing newline when logging to fileMartin Schwenke2014-10-281-1/+1
| | | | | | | This got lost with the transition to the new Samba debug code. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
* ctdb-build: Rename define BINDIR to CTDB_HELPER_BINDIRMartin Schwenke2014-10-082-2/+2
| | | | | | | | This avoids a clash with Samba's BINDIR and also makes it easier to move the helpers to somewhere else (e.g. libexec) in the future. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* ctdb-logging: Update to use Samba style debug.h/debug.cMartin Schwenke2014-10-061-60/+17
| | | | | | | | | | | | | | | | | | | | | Samba's debug subsystem has changed a lot, so CTDB's logging needs to be rewritten to be compatible. The new debug.h/debug.c can't just be pulled in because it has some extra dependencies into Samba's lib/util. For now, to support the smallest possible patch, implement a minimal subset of Samba's debug.[ch] that just supports the DEBUG_CALLBACK logtype. Define a callback for each logging method. Check later to see if debug_extra (or similar) can somehow be implemented using debug classes. The timestamp on CTDB CLI tool and test program DEBUG() output goes away, so update the unit test code to cope. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-logging: Change LogLevel to DEBUGLEVELMartin Schwenke2014-10-063-6/+6
| | | | | | | For compatibility with current Samba debug.[ch]. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-logging: Remove log ringbufferMartin Schwenke2014-10-064-97/+3
| | | | | | | | | | | As far as we know, nobody uses this and it just complicates the logging subsystem. Remove all ringbuffer code and documentation. Update the local daemons startup code correspondingly. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Volker Lendecke <vl@samba.org>
* ctdb-daemon: Fix the usage for lock helperAmitay Isaacs2014-09-251-2/+2
| | | | | | | | 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): Thu Sep 25 17:16:31 CEST 2014 on sn-devel-104
* ctdb-recoverd: If obtaining recovery lock fails, try againAmitay Isaacs2014-09-251-0/+18
| | | | | | | | | | | When ctdb daemon starts up, it considers itself the recovery master and tries to do first recovery. However, it's possible that there is already a recovery master and the current node has not yet heard from it. So do not ban ourselves immediately if ctdb_recovery_lock() fails when doing first recovery. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-locking: Reset ttimer before doing an early returnAmitay Isaacs2014-09-251-0/+1
| | | | | | | | | | | When timer expires, timeout handler routine sets lock_ctx->ttimer to a newly created timer event. However, when a node is INACTIVE, timeout handler returns early with lock_ctx->ttimer set to the previous timer event. This timer event gets freed when the callback returns and lock_ctx->ttimer remains set to already freed timer event. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Decrement pending calls statistics when calls are deferredAmitay Isaacs2014-09-121-0/+3
| | | | | | | | Deferred calls should not be treated as pending calls since they are re-processed from the beginning. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-daemon: Make sure ctdb runs with real-time priorityAmitay Isaacs2014-09-122-2/+8
| | | | | Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
* ctdb-locking: Fork lock helper with vfork_with_logging()Martin Schwenke2014-09-122-41/+35
| | | | | | | | | | | | Otherwise errors printed by the lock helper get lost. lock_helper_args() no longer adds the program name to the list of arguments, since vfork_with_logging() does that. Update the lock helper to handle the extra log_fd parameter passed by vfork_with_logging() and send stdout/stderr there. Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>