Martin Schwenke [Wed, 8 May 2013 03:06:12 +0000 (13:06 +1000)]
New version 1.2.39-9
Signed-off-by: Martin Schwenke <martin@meltin.net>
Amitay Isaacs [Wed, 5 Dec 2012 00:38:42 +0000 (11:38 +1100)]
scripts: Add helper script to log locking information using /proc/locks
This finds any processes locking tdb databases used by CTDB and logs
stack trace for each process.
Includes this fix from 1.2.40 branch:
scripts: Fix the variable name for sed expressions
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit
0e99ca1cdf28a7043554afb78bd439f727ab4f95)
(cherry picked from commit
9fbd13ea7d3da5e297827e7763f336f484262f47)
Amitay Isaacs [Wed, 5 Dec 2012 00:37:26 +0000 (11:37 +1100)]
daemon: Run an external script if freeze locks were not obtained during recovery
If the freeze child is already created in ctdb_start_freeze(), then it indicates
that the child process has not yet obtained the locks. This may be because
another process has locked the databases and has not yet released the locks.
In this case, invoke a helper script defined by environmental variable
CTDB_DEBUG_LOCKS, to log information about locks.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit
e80b2c15bf8c8fb5c3793acfebbe09d3cdd617b7)
Martin Schwenke [Thu, 17 May 2012 00:17:51 +0000 (10:17 +1000)]
ctdbd: Backport use of external script to debug hung eventscript
This is a cherry-pick from
6e68797af67bee36f2bad045f94806e7e98f27e9,
combined with several recent fixes:
8507303b525d20c74e8ec4e7c4f5f275945cd3b6
scripts: debug-hung-script.sh doesn't need functions/loadconfig
501461cc3e132d4adee9e91b5d4513a26bae2846
ctdbd: Remove debug_hung_script_ctx
0581f9a84e58764d194f4e04064c2c5b393c348b
ctdbd: Remove command-line option --debug-hung-script
3400b2ed34b6eb9496eb55f1aab6f89d2952060d
ctdbd: Complain loudly if CTDB_DEBUG_HUNG_SCRIPT script isn't executable
9b0d56b16775aa16f33bdfdf831256e085fa3339
ctdbd: Don't use a fixed length buffer for the hung script command
Signed-off-by: Martin Schwenke <martin@meltin.net>
Cherry-pick-from:
b86270fae7fd9f8a7a718e15d8c7436a918f28c4
Ronnie Sahlberg [Wed, 20 Jun 2012 05:10:05 +0000 (15:10 +1000)]
When we find an ip we shouldnt host, just release it
Dont call a full blown clusterwide ipreallocation, just release it locally
(cherry picked from commit
9a806dec8687e2ec08a308853b61af6aed5e5d1e)
Conflicts:
server/ctdb_recoverd.c
Ronnie Sahlberg [Wed, 20 Jun 2012 00:08:11 +0000 (10:08 +1000)]
When we release an ip, get the interface name from the kernel
instead of using the interface where ctdb thinks the ip is hosted at.
The difference is that this now allows us to handle cases where we want to release an ip but ctdbd does not know which interface the ip is assigned on.
(user has used 'ip addr add...' and manually assigned an ip to the wrong interface)
(cherry picked from commit
c6bf22ba5c01001b7febed73dd16a03bd3fd2bed)
Conflicts:
server/ctdb_takeover.c
Ronnie Sahlberg [Wed, 20 Jun 2012 03:32:02 +0000 (13:32 +1000)]
Add new command to find which interface is located on
(cherry picked from commit
f07376309e70f5ccdb7de8453caacc71b451ab48)
Conflicts:
common/system_common.c
include/ctdb_private.h
tools/ctdb.c
Martin Schwenke [Wed, 20 Feb 2013 04:53:17 +0000 (15:53 +1100)]
New version 1.2.39-8
Signed-off-by: Martin Schwenke <martin@meltin.net>
Martin Schwenke [Mon, 18 Feb 2013 05:32:14 +0000 (16:32 +1100)]
recoverd: Do not send "ipreallocated" event to stopped nodes
Stopped nodes will reject "ipreallocated" because they are in
recovery, so they will eventually be banned.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Martin Schwenke [Tue, 19 Feb 2013 03:29:06 +0000 (14:29 +1100)]
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>
Cherry-pick-from:
a73bb56991b8c07ed0e9517ffcf0dc264be30487
Amitay Isaacs [Fri, 30 Nov 2012 03:16:21 +0000 (14:16 +1100)]
New version 1.2.39-7
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Amitay Isaacs [Tue, 23 Oct 2012 05:23:12 +0000 (16:23 +1100)]
recoverd: Track the nodes that fail takeover run and set culprit count
If any of the nodes fail takeover run (either due to timeout or failure
to complete within takeover_timeout interval) from main loop, recovery
master will give up trying takeover run with following message:
"Unable to setup public takeover addresses. Try again later"
And as a side-effect the monitoring is disabled on all the nodes. Before
ctdb_takeover_run() is called from main loop, monitoring get disabled via
startrecovery event. Since ctdb_takeover_run() fails, it never runs
recovered event and monitoring does not get re-enabled.
In main_loop, ctdb_takeover_run() is called with a takeover_fail_callback.
This callback will get called if any of the nodes fail in handling
takeip/releaseip/ipreallocated events in ctdb_takeover_run().
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Cherry-pick-from:
cbe68821180e04988edf186dcf6d042edcab81de
Conflicts:
server/ctdb_recoverd.c
Amitay Isaacs [Tue, 23 Oct 2012 04:06:33 +0000 (15:06 +1100)]
daemon: Do not ignore timed out monitor events
If an eventscript times out for monitor event, it is considered successful
and the remaining eventscripts are not run. This can make a node prematurely
healthy, cause healthy node to fail over IPs to this node and this node will
not be able to host those IPs. Thus causing loss of access and in case of NAT-GW
configuration, loss of a default route.
Cherry-pick-from:
5205d545e8d8c72d73b9d5fd148df6de30392fc8
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Amitay Isaacs [Thu, 25 Oct 2012 01:09:07 +0000 (12:09 +1100)]
New version 1.2.39-5
(Re-creating the tags for releases not tagged in git)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Amitay Isaacs [Thu, 25 Oct 2012 01:08:13 +0000 (12:08 +1100)]
Revert "When adding ips to nodes, set up a deferred rebalance for the whole node to trigger after 60 seconds in case the normal ipreallocated is not sufficient to trigger rebalance."
This reverts commit
abd73b5494906c915c3379852524495957a1bf50.
Amitay Isaacs [Thu, 25 Oct 2012 01:07:54 +0000 (12:07 +1100)]
Revert "Add a tunable variable to control how long we defer after a ctdb addip until we force a rebalance and try to failback addresses onto this node"
This reverts commit
e86e0e8547593eb8ea2d5c65892de81eac694783.
Amitay Isaacs [Thu, 25 Oct 2012 00:57:14 +0000 (11:57 +1100)]
New version 1.2.39-4
(Re-creating the tags for releases not tagged in git)
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Ronnie Sahlberg [Wed, 29 Feb 2012 01:25:41 +0000 (12:25 +1100)]
Vacuuming: change default timeout to 120 seconds
S1035431
Ronnie Sahlberg [Mon, 27 Feb 2012 21:44:06 +0000 (08:44 +1100)]
new version 1.2.39-3
Ronnie Sahlberg [Mon, 27 Feb 2012 19:44:08 +0000 (06:44 +1100)]
Add a tunable variable to control how long we defer after a ctdb addip until we force a rebalance and try to failback addresses onto this node
Ronnie Sahlberg [Mon, 27 Feb 2012 08:16:08 +0000 (19:16 +1100)]
When adding ips to nodes, set up a deferred rebalance for the whole node to trigger after 60 seconds in case the normal ipreallocated is not sufficient to trigger rebalance.
S1035306
Ronnie Sahlberg [Sun, 26 Feb 2012 20:18:19 +0000 (07:18 +1100)]
Make KILLTCP structure a child of VNN so that it is freed at the same time
the referenced VNN structure is.
Also, remove the circular reference between the two objects KIPPCTP and VNN
Ronnie Sahlberg [Wed, 22 Feb 2012 06:38:12 +0000 (17:38 +1100)]
Eventscripts: remove the horrible horrible circular reference between state and callback since these two structures do not even share the same parent talloc context.
Instead, tie them together via referencing a permanent linked list hung off the ctdb structure.
Ronnie Sahlberg [Tue, 14 Feb 2012 01:21:09 +0000 (12:21 +1100)]
New version 1.2.39-2
This version contains one single change:
Fix ip reallocation for LCP2 where it sometimes resulted
in poor balancing of the addresses across the nodes.
S1032414
Martin Schwenke [Tue, 1 Nov 2011 09:52:57 +0000 (20:52 +1100)]
LCP IP allocation algorithm - try harder to find a candidate source node
There's a bug in LCP2. Selecting the node with the highest imbalance
doesn't always work. Some nodes can have a high imbalance metric
because they have a lot of IPs. However, these nodes can be part of a
group that is perfectly balanced. Nodes in another group with less
IPs might actually be imbalanced.
Instead of just trying the source node with the highest imbalance this
tries them in descending order of imbalance until it finds one where
an IP can be moved to another node.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Martin Schwenke [Tue, 1 Nov 2011 08:49:38 +0000 (19:49 +1100)]
LCP IP allocation algorithm - new function lcp2_failback_candidate()
There's a bug in LCP2. Selecting the node with the highest imbalance
doesn't always work. Some nodes can have a high imbalance metric
because they have a lot of IPs. However, these nodes can be part of a
group that is perfectly balanced. Nodes in another group with less
IPs might actually be imbalanced.
Factor out the code from lcp2_failback() that actually takes a node
and decides which address should be moved to which node.
This is the first step in fixing the above bug.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Ronnie Sahlberg [Thu, 17 Nov 2011 02:36:00 +0000 (13:36 +1100)]
New version : 1.2.39
Ronnie Sahlberg [Thu, 17 Nov 2011 02:34:29 +0000 (13:34 +1100)]
Eventscripts: Add special -ECANCELED status for monitor events that are cancelled
When a monitor event is canceled by a higher priority script, make sure we return
status -ECANCELED to the callback in ctdB_monitor.c
Also treat -ECANCELED as a simple "try monitor event again" and skip modifying any HEALTHY/UNHEALTHY flags when this happens
Ronnie Sahlberg [Mon, 17 Oct 2011 04:27:41 +0000 (15:27 +1100)]
new version 1.2.38
Martin Schwenke [Fri, 14 Oct 2011 06:29:35 +0000 (17:29 +1100)]
Eventscripts: Work around 50.samba autostop failure
This hack is shameful but the eventscript really needs to be split to
avoid this type of rubbish - 1 service per eventscript!
There are a few ways of hacking the conditions and this doesn't seem
much worse than any of the others...
This works... but on autostart will still restart the service that
isn't being autostarted. That's a separate bug.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Ronnie Sahlberg [Mon, 17 Oct 2011 01:11:54 +0000 (12:11 +1100)]
S1031575
When performing addip we dont allow "gratious failvoer" which can, due to timing, and depending on which order the "ctdb addip ..." is called on the nodes lead to imperfect balancing of the ip addresses when addigng several at the same time.
This patch makes sure that once the ip address is added to a node, any node, this ip address is released from the node currently hosting the address and there will possibly be a failover after a short while while performing the rebalance of the ip address.
This means that when performing "ctdb addip ..." and adding it to a new node, this could affect/disrupt the i/o on this address to the node currently hosting the address, but
it will mean we do get a more even distribution after the assignment.
This is based on the assumption that it will be more common to "add completely new ip to a set of nodes" rather than "add an ip address that is already in service to a brand new node"
Ronnie Sahlberg [Thu, 13 Oct 2011 06:16:46 +0000 (17:16 +1100)]
new version 1.2.37
Martin Schwenke [Fri, 7 Oct 2011 04:00:42 +0000 (15:00 +1100)]
Make ctdb_diagnostics more resilient to uncontactable nodes.
Current behaviour is for onnode to timeout (for about 20s) for each
attempted ssh to a down node. With 40 or 50 invocations of onnode
this takes a long time.
2 changes to work around this:
* If EXTRA_SSH_OPTS (which is passed to ssh by onnode) does not
contains a ConnectTimeout= setting then add a setting for a 5 second
timeout.
* Filter the nodes before starting any diagnosis, taking out any "bad
nodes" that are uncontactable via onnode.
In the nodes summary at the beginning of the output, print
information about any "bad nodes".
Signed-off-by: Martin Schwenke <martin@meltin.net>
Ronnie Sahlberg [Thu, 22 Sep 2011 05:16:06 +0000 (15:16 +1000)]
New version 1.2.36
Ronnie Sahlberg [Thu, 22 Sep 2011 05:13:26 +0000 (15:13 +1000)]
One of the entry points to release an ip reset the pnn field before invoking the eventscript.
this triggered a check for "only run the eventscript if we host the address" to trigger and shortcir=cuit calling the eventscript.
An effect of this would be that 'ctdb delip' would remove the ip from ctdb, but fail to delete it from the interface.
S1028798
Ronnie Sahlberg [Thu, 8 Sep 2011 05:05:56 +0000 (15:05 +1000)]
new version 1.2.35
Ronnie Sahlberg [Wed, 7 Sep 2011 23:28:33 +0000 (09:28 +1000)]
Drop loglevel for a tevent message from FATAL to ERROR
CQ S1028400
Michael Adam [Fri, 2 Sep 2011 14:42:10 +0000 (16:42 +0200)]
Add a tunable "AllowClientDBAttach" with default value 1.
When set to 0, clients will not be able to attach to databases
via the db_attach control. This might can be useful for maintenance
where ctdb should be kept running but clients should not be able
to modify databases.
Ronnie Sahlberg [Fri, 26 Aug 2011 06:25:21 +0000 (16:25 +1000)]
New version 1.2.34
Ronnie Sahlberg [Fri, 26 Aug 2011 00:03:47 +0000 (10:03 +1000)]
Sometimes external services will activate Samba in ctdb without doing hte proper and correct
initialization and setup, which leads to the state directory never become created.
Workaround this configuration issue by always creating the direcotry for now
S1028573
Martin Schwenke [Fri, 19 Aug 2011 04:20:58 +0000 (14:20 +1000)]
Eventscripts - ctdb_check_tcp_ports() bug fix.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Martin Schwenke [Fri, 19 Aug 2011 03:55:55 +0000 (13:55 +1000)]
Eventscripts - fix debugging buglet in ctdb_check_tcp_ports_ctdb()
Signed-off-by: Martin Schwenke <martin@meltin.net>
Martin Schwenke [Wed, 17 Aug 2011 04:02:45 +0000 (14:02 +1000)]
Eventscripts - new default TCP port checker using "ctdb checktcpport"
New function ctdb_check_tcp_ports_ctdb(). This should be fast... and
is now the default checker. If it fails in an unexpected way we fall
back to the nmap and netstat checkers.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Martin Schwenke [Wed, 17 Aug 2011 02:12:20 +0000 (12:12 +1000)]
Eventscripts - generalise TCP port checking plus new nmap-based checker
Split the netstat-specific parts of ctdb_check_tcp_ports() into new
function ctdb_check_tcp_ports_netstat().
Implement new ctdb_check_tcp_ports_nmap() function that uses
"nmap -PS" to check if the desired ports are listening.
ctdb_check_ctdb_ports() now uses new configuration variable
CTDB_TCP_PORT_CHECKERS to decide which port checkers to try. Default
value is currently "nmap netstat". If nmap is not found then this
will fall back to netstat. This indicates that either nmap should be
installed or the default value of CTDB_TCP_PORT_CHECKERS should be
changed (in a configuration file) to avoid trying to use nmap.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Ronnie Sahlberg [Wed, 17 Aug 2011 00:16:35 +0000 (10:16 +1000)]
Add a new command 'ctdb checktcpport <port>'
that tries to bind to the specified port on INADDR_ANY.
This can be used for testing if a service is listening to that port or not.
Errors are printed to stdout and the returned status code is either 0 : if we managed to bind to the port (in which case the service is NOT listening on that bort) or the value of errno that stopped us from binding to a port.
errno for EADDRINUSE is 98 so a script using this command should check the status code against the value 98.
If this command returns 98 it means the service is listening to the specified port.
Ronnie Sahlberg [Wed, 17 Aug 2011 00:00:28 +0000 (10:00 +1000)]
Revert "Add new eventscript 40.fs_use that can be used to monitor file system use and flag a node unhealthy when they become full"
This reverts commit
b65efc69317756fe60479c0df58c874da3fde6db.
Ronnie Sahlberg [Tue, 16 Aug 2011 23:59:42 +0000 (09:59 +1000)]
dont use a too big persistence timeout value
Ronnie Sahlberg [Mon, 15 Aug 2011 00:27:49 +0000 (10:27 +1000)]
new version 1.2.33
Ronnie Sahlberg [Mon, 15 Aug 2011 00:23:50 +0000 (10:23 +1000)]
Change the default for ip failover to be LCP2 and not DeterministicIPs
Ronnie Sahlberg [Sun, 14 Aug 2011 03:50:12 +0000 (13:50 +1000)]
remove the nfs share check completely from the 1.2 branch
Ronnie Sahlberg [Thu, 11 Aug 2011 01:45:59 +0000 (11:45 +1000)]
When starting and stopping ctdb through the init-script, make sure we first clear all public ips bvefore we start the daemon, in case they are still hanging around since a previous kill -9 and also make sure we drop them after we have stopped the deamon when shutting down
CQ S1027550
Ronnie Sahlberg [Thu, 11 Aug 2011 00:09:52 +0000 (10:09 +1000)]
document the new check for file system use
Ronnie Sahlberg [Thu, 11 Aug 2011 00:00:53 +0000 (10:00 +1000)]
Add new eventscript 40.fs_use that can be used to monitor file system use and flag a node unhealthy when they become full
Ronnie Sahlberg [Wed, 10 Aug 2011 23:11:38 +0000 (09:11 +1000)]
make the persistent even longer for lvs to make people even happier
Ronnie Sahlberg [Wed, 10 Aug 2011 21:14:57 +0000 (07:14 +1000)]
increase the persistent timeout to make people happier
Ronnie Sahlberg [Wed, 10 Aug 2011 21:13:28 +0000 (07:13 +1000)]
check the shares if they are available before we decide to try to restart nfs
CQ S1027529
Martin Schwenke [Mon, 8 Aug 2011 03:13:59 +0000 (13:13 +1000)]
Eventscripts: New configuration variable CTDB_SERVICE_AUTOSTARTSTOP.
Some of the current auto-start/stop logic is broken, particularly for
Samba. Fixing it is non-trivial.
If $CTDB_SERVICE_AUTOSTARTSTOP is "yes" then auto-start/stop services
when told to newly manage or no longer manage them. This defaults to
"yes".
However, if using a canned configuration file that doesn't set
$CTDB_SERVICE_AUTOSTARTSTOP then this stops the auto-start-stop logic
from working. Therefore, this works around CQ S1026685 - on the
system in question another daemon controls service auto-start/stop and
CTDB just gets in the way.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Martin Schwenke [Fri, 5 Aug 2011 06:39:57 +0000 (16:39 +1000)]
Eventscripts - weaken TCP port check message if CTDB has just been started.
Sometimes smbd and other services can take a while to start,
especially when there is a lot of activity after ctdbd has just
started. The TCP port check can then pollute the logs with lots of
"ERROR" messages and possibly extra debug.
This creates a flag file when a service is started (but not restarted)
and this flag is removed the first time that TCP port checks succeed
for that service. When a port check fails and the flag file still
exists, a less extreme "INFO" message is printed rather than the usual
"ERROR" message. This means that until the node actually becomes
healthy we see more friendly messages.
The subtext is that we're hearing false positive reports "recreates"
of CQ S1024874 (samba stopped responding on port 445) quite often when
ctdbd is started. This reduces the chances of people reporting such
false recreates...
Signed-off-by: Martin Schwenke <martin@meltin.net>
David Disseldorp [Sun, 31 Jul 2011 01:14:54 +0000 (03:14 +0200)]
io: Make queue_io_read() safe for reentry
queue_io_read() may be reentered via the queue callback, recoverd is
particularly guilty of this.
queue_io_read() is not safe for reentry if more than one packet is
received and partial chunks follow - data read off the pipe on re-entry
is assumed to be the start-of-packet four byte length. This leads to a
wrongly aligned stream and the notorious "Invalid packet of length 0"
errors.
This change fixes queue_io_read() to be safe under reentry, only a
single packet is processed per call.
https://bugzilla.samba.org/show_bug.cgi?id=8319
Ronnie Sahlberg [Fri, 5 Aug 2011 00:03:34 +0000 (10:03 +1000)]
Remove a log message about setting linkstate for an unknown interface.
sometimes we do want to try to set the linkstate for interfaces that are not in use by public addresses right now (but posisbly by other mechanisms) and these messages just spam the logs
S1026357
Ronnie Sahlberg [Thu, 4 Aug 2011 03:49:02 +0000 (13:49 +1000)]
remove log message we dont need
S1026492
Ronnie Sahlberg [Thu, 4 Aug 2011 03:47:52 +0000 (13:47 +1000)]
remove a non-error logmessage about persistent databases being healthy, as expected
S1026492
Ronnie Sahlberg [Thu, 4 Aug 2011 03:46:12 +0000 (13:46 +1000)]
remove a log message we dont need about "allow clients to attach to databases"
S1026492
Ronnie Sahlberg [Thu, 4 Aug 2011 03:44:25 +0000 (13:44 +1000)]
Change the message when we start the daemon to "CTDB starting on node"
S1026492
Martin Schwenke [Mon, 1 Aug 2011 03:37:06 +0000 (13:37 +1000)]
Eventscripts - 10.interfaces should not check orphaned interfaces.
If the last IP address on an interfaces is removed then that
interfaces should no longer be checked by 10.interfaces. However,
"ctdb ifaces" still lists such interfaces so they are currently
checked.
The problem really needs to be addressed in ctdbd but a neat quick
eventscript fix will be minimally invasive...
This changes the code to use "ctdb -Y ip -v" instead of "ctdb -Y
ifaces". The former includes details of all public addresses and
associated interfaces, so when an address is removed there is no
output for it. This avoids orphaned interfaces from being listed.
The logic is also slightly improved so that $IFACES includes just a
(non-uniquified) list of interfaces, allowing an existing loop to be
removed.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Ronnie Sahlberg [Thu, 28 Jul 2011 22:57:51 +0000 (08:57 +1000)]
new version 1.2.32
Martin Schwenke [Thu, 28 Jul 2011 05:22:42 +0000 (15:22 +1000)]
Tests: Initial test code for LCP2 IP allocation algorithm.
Move struct ctdb_public_ip_list to ctdb_private.h and put some
definitions for some functions from ctdb_takeover.c there. This
allows those functions to be called from unit tests.
Add ctdb_takeover_tests.c and the Makefile support to build it.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Martin Schwenke [Thu, 28 Jul 2011 05:16:46 +0000 (15:16 +1000)]
IP allocation - add LCP2 algorithm.
The current non-deterministic IP allocation algorithm balances IPs
across the whole cluster. It does not consider different
interfaces/VLANs/subnets, so these different groups of IPs aren't
generally well balanced.
This adds the LCP2 algorithm for IP allocation and allows it to be
enabled by setting the "LCP2PublicIPs" tunable to 1.
The LCP2 algorithm calculates the imbalance of a node by totalling the
squares of the distances between each IP on the node. The IP distance
is defined as the length longest common prefix (LCP) of bits that is
found when comparing 2 IPs. The imbalance of a cluster is the maximum
imbalance for any node. At each step the algorithm selects an
allocation to the IP/node combination that results in the choosing the
allocation that best reduces the imbalance of the cluster.
The implementation splits out the IP allocation part of
ctdb_takeover_run() into new function ctdb_takeover_run_core(), and
then extracts out the basic IP assignment code into new functions
basic_allocate_unassigned() and basic_failback(). 3 new functions
lcp2_init(), lcp2_allocate_unassigned() and lcp2_failback() implement
the LCP2 algorithm, and are hooked into ctdb_takeover_run_core().
Signed-off-by: Martin Schwenke <martin@meltin.net>
Ronnie Sahlberg [Thu, 28 Jul 2011 22:41:35 +0000 (08:41 +1000)]
Update the delip command
Dont talloc_free(vnn) immediately but postphone it until later when
the eventscript callback has completed.
CQ S1026664
Rusty Russell [Mon, 25 Jul 2011 08:26:06 +0000 (17:56 +0930)]
eventscript: fix callback after free
ctdb_event_script_callback() takes a mem_ctx arg which it doesn't use, but
the implication is pretty clear, that when that mem_ctx is freed, the callback
shouldn't happen. Indeed, Ronnie reproduced a case where that callback
refers to freed memory, in the ip reallocation code under stress.
So attach the callback to the mem_ctx they give us, and remove it from the
script state structure when that's freed. It's a bit weird, but it works.
CQ: S1026179
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Ronnie Sahlberg [Mon, 11 Jul 2011 07:41:12 +0000 (17:41 +1000)]
new version 1.2.31
Martin Schwenke [Tue, 5 Jul 2011 01:32:06 +0000 (11:32 +1000)]
Eventscript functions: optimise ctdb_check_tcp_ports() and add debug.
ctdb_check_tcp_ports() runs "netstat -a -t -n" in a loop for each
port. There are 2 problems with this:
* Netstat is run on each loop iteration when it need only be run once.
* The -a option is used to list all connections but the function only
cares about the listening ports. There may be many thousands of
non-listening ports to grep through.
This changes ctdb_check_tcp_ports() to run netstat with the -l option
instead of the -a option. It also only runs netstat once before the
main loop.
When a port is found to not be listening the output of the netstat
command is now dumped to help with debugging.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Ronnie Sahlberg [Mon, 4 Jul 2011 20:29:00 +0000 (06:29 +1000)]
Add log output to wipedb and backupdb
CQ S1025379
Ronnie Sahlberg [Tue, 3 Aug 2010 03:34:27 +0000 (13:34 +1000)]
When trying to re-balance the ip assignment and shuffle ips from
nodes with many addresses to nodes with few addresses,
loop up to num_ips+5 times instead of only 5 times.
When we have very many public ips per node, we might need to loop more than
5 times or else we will exit without reaching optimal balance.
Ronnie Sahlberg [Tue, 28 Jun 2011 05:39:38 +0000 (15:39 +1000)]
change the name for the key for the record where we stoire the public address config from public-addresses... to public_addresses...
CQ1019030
Ronnie Sahlberg [Sat, 18 Jun 2011 00:47:25 +0000 (10:47 +1000)]
Remove a benign by annoying log message that will be logged after an interface that has been in use has later been removed and is no longer referenced by any public addresses.
CQ S1024495
Martin Schwenke [Mon, 23 May 2011 05:33:12 +0000 (15:33 +1000)]
onnode: fix natgwlist nodespec
This hasn't worked for a while if ever.
We treat this case specially because the output has 2 works on the 1st
line. We also handle the error case where /etc/ctdb_natgw_nodes
exists but none of the other $NATGW_* configuration is done.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Martin Schwenke [Mon, 23 May 2011 05:24:52 +0000 (15:24 +1000)]
onnode: fix get_nodes_with_status()
Setting IFS and looping though items with colons in them doesn't work.
Change this to read through the output line by line. The header line
needs to be thrown away by throwing away everything up to the 1st
newline.
Keep stderr from the "ctdb status" command, otherwise debugging is
impossible.
On error, append any output from ctdb to onnode's error message.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Martin Schwenke [Tue, 17 May 2011 04:26:55 +0000 (14:26 +1000)]
onnode: Remove an unnecessary comment.
The comment about $CTDB_NODES_SOCKETS is meaningless. The code ti
refers to works just find with $CTDB_NODES_SOCKETS.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Martin Schwenke [Tue, 17 May 2011 04:24:30 +0000 (14:24 +1000)]
onnode: Future-proof get_nodes_with_status().
The current code requires knowledge of the number of status bits
output by "ctdb status -Y".
This changes the code to be completely general.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Martin Schwenke [Tue, 17 May 2011 03:25:08 +0000 (13:25 +1000)]
onnode: Exit with error for unknown command-line flags.
Use of "local" was masking errors in command-line processing.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Martin Schwenke [Tue, 17 May 2011 03:20:51 +0000 (13:20 +1000)]
onnode: Be defensive when listing IPs of nodes with designated status.
The current version gives the last item left after stripping the known
fields. If an insufficent number of status fields is stripped then
this would return a residual status field value, which turned out to
be a valid IP address for localhost... so no error occurs.
This change means that the node number is stripped and any residual
status field value will stay appended, causing an error the first time
this command is tested.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Martin Schwenke [Tue, 17 May 2011 03:18:11 +0000 (13:18 +1000)]
onnode - Fix long standing bug in onnode healthy/ok/connected/con.
When the output of "ctdb status -Y" changed to add an extra status
column we didn't fix onnode.
This adds a match for the extra column.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Ronnie Sahlberg [Mon, 30 May 2011 04:41:12 +0000 (14:41 +1000)]
New version 1.2.30
Michael Adam [Wed, 4 May 2011 12:28:26 +0000 (14:28 +0200)]
packaging: add ltdbtool and its manpage to the RPM
Michael Adam [Wed, 4 May 2011 12:25:48 +0000 (14:25 +0200)]
install the ltdbtool manpage with "make install"
Michael Adam [Wed, 4 May 2011 11:44:59 +0000 (13:44 +0200)]
install ltdbtool with "make install"
Michael Adam [Wed, 4 May 2011 11:44:10 +0000 (13:44 +0200)]
build "ltdbtool" in "make all"
Gregor Beck [Wed, 4 May 2011 12:17:04 +0000 (14:17 +0200)]
ltdbtool: add manpage html + roff
Signed-off-by: Michael Adam <obnox@samba.org>
Gregor Beck [Wed, 4 May 2011 12:14:54 +0000 (14:14 +0200)]
ltdbtool: add manpage
Signed-off-by: Michael Adam <obnox@samba.org>
Gregor Beck [Thu, 14 Apr 2011 10:51:59 +0000 (12:51 +0200)]
add ltdbtool - a standalone ltdb tool
This this is a tool to handle (dump and convert) ctdb's local tdb
copies (ltdbs) without connecting to a ctdb daemon.
It can be used to
* dump the contents of a ltdb, printing
the ctdb record header information
* dump a non-clustered tdb database (like tdbdump)
* convert between an ltdb and a non-clustered tdb
(adding or removing ctdb headers)
* convert between 64 and 32 bit ltdbs
(the ctdb record headers differ by 4 bytes of padding)
usage: bin/ltdbtool dump [-p] [-s{0|32|64}] <idb>
bin/ltdbtool convert [-s{0|32|64}] [-o{0|32|64}] <idb> <odb>
Pair-Programmed-With: Michael Adam <obnox@samba.org>
Gregor Beck [Thu, 14 Apr 2011 10:55:57 +0000 (12:55 +0200)]
ctdb catdb: fix escaping of '"' and '\'
Signed-off-by: Michael Adam <obnox@samba.org>
Ronnie Sahlberg [Thu, 12 May 2011 00:24:46 +0000 (10:24 +1000)]
When using multiple VLANs, some funky stuff can sometimes happen when
adding/removing IP addresses causing routes might be dropped by the system.
The easiest workaround for this is to unconditionally try to reapply
all static routes for all interfaces once ipreallocation has finished,
not just adding them back on the affected interface.
This worksaround a funky issue in
CQ S1023538
Ronnie Sahlberg [Wed, 11 May 2011 09:50:09 +0000 (19:50 +1000)]
Remove all checking of GPFS from ctdb_diagnostics
CQ S1023524
Ronnie Sahlberg [Tue, 10 May 2011 00:51:37 +0000 (10:51 +1000)]
New version 1.2.29
Ronnie Sahlberg [Mon, 9 May 2011 22:25:27 +0000 (08:25 +1000)]
If samba fails to start for some reason, make this cause the startup event to fail too, so that ctdbd will re-try the startup event later.
Or else this will leave samba not running.
CQ S1023394
Ronnie Sahlberg [Mon, 9 May 2011 20:19:34 +0000 (06:19 +1000)]
Dont exit from checking interfaces once we have found one interface that is not
in use by public addresses. this can happen when we have removed existing interfaces/ip addresses and prevents us from verifying the status of other interfaces
Ronnie Sahlberg [Sun, 8 May 2011 20:35:33 +0000 (06:35 +1000)]
Remove logging of spam/errors from the 10.interfrace
script if/when we have for example NATGW configured but no public addresses defined on that interface
CQ S1023378
Ronnie Sahlberg [Wed, 4 May 2011 01:34:17 +0000 (11:34 +1000)]
Dont call the UPDATE event if both old and new interface is the same.
CQ S1018175
Ronnie Sahlberg [Tue, 3 May 2011 22:54:02 +0000 (08:54 +1000)]
Cleanup of logging messages/spamming
Reduce an infomational message about not performing ip reallocation
from NOTICE(the default) to INFO.
These messages are normal during startup or when stopped/banned when
we will be in recovery mode for a while.
Remove a messager in the loop waiting for initial startup to complete about
the generation being invalid. It is always invalid at this stage before we have
finished initial recovery.
Rate-limit the informational messages for CTDB_WAIT_UNTIL_RECOVERED
so that we only print them once per second for the first 60 seconds and after that only once per 10 minutes.
These messages are normal during startup, but we should not be logging them every second for cases where we will remain in recovery mode during startup for an extended period of time.
Such as if suspended or permabanned.
CQ S1023302