amitay/ctdb.git
11 years agoNew version 1.2.51 ctdb-1.2.51
Amitay Isaacs [Tue, 2 Oct 2012 02:45:10 +0000 (12:45 +1000)]
New version 1.2.51

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
11 years agoLogging: Map TEVENT_DEBUG_FATAL to DEBUG_CRIT
Martin Schwenke [Thu, 27 Sep 2012 23:39:12 +0000 (09:39 +1000)]
Logging: Map TEVENT_DEBUG_FATAL to DEBUG_CRIT

This is currently mapped to DEBUG_EMERG.  CTDB really has no business
logging anything at EMERG level since the whole system is not about to
abort or catch fire.  EMERG causes the message to appear on the
console and on every terminal.  That's a bit overzealous!

There would be very few situations where logs are being filtered at
level below ERROR, so CRIT should certainly suffice.

The trigger for this was curious messages saying "No event for <n>
seconds!" logged in a user's terminal.

Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>
Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts: "recovered" event should not fail on NATGW failure
Martin Schwenke [Wed, 26 Sep 2012 04:37:49 +0000 (14:37 +1000)]
Eventscripts: "recovered" event should not fail on NATGW failure

The recovery process has no protection against the "recovered" event
failing, so this can cause a recovery loop.

Instead of failing the "recovered" event, add a "monitor" event and
fail that instead.  In this case the failure semantics are well
defined.

A separate patch should ban nodes if the "recovered" event fails for
an unknown reason.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoNew version 1.2.50 ctdb-1.2.50
Amitay Isaacs [Wed, 12 Sep 2012 05:02:30 +0000 (15:02 +1000)]
New version 1.2.50

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
11 years agocommon: Debug ctdb_addr_to_str() using new function ctdb_external_trace()
Martin Schwenke [Thu, 6 Sep 2012 10:22:38 +0000 (20:22 +1000)]
common: Debug ctdb_addr_to_str() using new function ctdb_external_trace()

We've seen this function report "Unknown family, 0" and then CTDB
disappeared without a trace.  If we can reproduce it then this might
help us to debug it.

The idea is that you do something like the following in /etc/sysconfig/ctdb:

  export CTDB_EXTERNAL_TRACE="/etc/ctdb/config/gcore_trace.sh"

When we hit this error than we call out to gcore to get a core file so
we can do forensics.  This might block CTDB for a few seconds.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoNew version 1.2.49 ctdb-1.2.49
Martin Schwenke [Tue, 21 Aug 2012 04:35:35 +0000 (14:35 +1000)]
New version 1.2.49

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoInitscript: Kill any existing ctdbd processes if the ping succeeds
Martin Schwenke [Tue, 21 Aug 2012 04:28:37 +0000 (14:28 +1000)]
Initscript: Kill any existing ctdbd processes if the ping succeeds

Initialising a new ctdbd will destroy the Unix domain socket so
existing processes will be useless anyway.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agologging: Close unix socket /tmp/ctdb.socket in syslogd process
Amitay Isaacs [Tue, 14 Aug 2012 05:42:12 +0000 (15:42 +1000)]
logging: Close unix socket /tmp/ctdb.socket in syslogd process

Since the unix socket is opened before syslogd process is forked, syslogd
process also keeps listening to it.  If main ctdbd process dies and has any
child processes that are blocked waiting for locks, these child processes
keep connecting to unix socket and thus syslogd cannot exit.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
11 years agoNew version 1.2.48 ctdb-1.2.48
Martin Schwenke [Thu, 9 Aug 2012 09:47:08 +0000 (19:47 +1000)]
New version 1.2.48

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts: new functions set_proc() and get_proc().
Martin Schwenke [Tue, 28 Jun 2011 04:54:33 +0000 (14:54 +1000)]
Eventscripts: new functions set_proc() and get_proc().

These provide a thin layer around writing and reading files in /proc.
They can be easily replaced by stubs for unit testing.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoNew version 1.2.47 ctdb-1.2.47
Amitay Isaacs [Thu, 9 Aug 2012 06:57:15 +0000 (16:57 +1000)]
New version 1.2.47

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
11 years agoEventscripts: Add "reconfigure" pseudo-event for policy routing
Martin Schwenke [Fri, 3 Aug 2012 00:54:30 +0000 (10:54 +1000)]
Eventscripts: Add "reconfigure" pseudo-event for policy routing

This rebuilds all policy routes and can be used if the configuration
changes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoNew version 1.2.46 ctdb-1.2.46
Martin Schwenke [Tue, 24 Jul 2012 01:26:32 +0000 (11:26 +1000)]
New version 1.2.46

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts: Default route on NAT gateway should have a metric of 10
Martin Schwenke [Fri, 20 Jul 2012 06:43:39 +0000 (16:43 +1000)]
Eventscripts: Default route on NAT gateway should have a metric of 10

At the moment routes from 11.routing can fail to be added because they
conflict with the default route added by 11.natgw.

NAT gateway is meant to be a last resort, so routes from 11.routing
should override it.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoNew version 1.2.45 ctdb-1.2.45
Martin Schwenke [Thu, 12 Jul 2012 04:03:58 +0000 (14:03 +1000)]
New version 1.2.45

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoWhen we find an ip we shouldnt host, just release it
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

11 years agoWhen we release an ip, get the interface name from the kernel
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)

11 years agoAdd new command to find which interface is located on
Ronnie Sahlberg [Wed, 20 Jun 2012 03:32:02 +0000 (13:32 +1000)]
Add new command to find which interface is located on

11 years agoNew version 1.2.44
Ronnie Sahlberg [Fri, 29 Jun 2012 02:31:13 +0000 (12:31 +1000)]
New version 1.2.44

11 years agoeventscripts: 13.per_ip_routing - flock should have a timeout
Martin Schwenke [Thu, 21 Jun 2012 04:18:35 +0000 (14:18 +1000)]
eventscripts: 13.per_ip_routing - flock should have a timeout

... and flock failure should be fatal.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoeventscripts: 13.per_ip_routing - readability improvement
Martin Schwenke [Thu, 21 Jun 2012 04:17:06 +0000 (14:17 +1000)]
eventscripts: 13.per_ip_routing - readability improvement

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoeventscripts: 13.per_ip_routing should remove bogus routes on ipreallocated
Martin Schwenke [Fri, 15 Jun 2012 07:22:02 +0000 (17:22 +1000)]
eventscripts: 13.per_ip_routing should remove bogus routes on ipreallocated

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoeventscripts: Print a warning on failure to delete a routing rule
Martin Schwenke [Wed, 13 Jun 2012 03:49:49 +0000 (13:49 +1000)]
eventscripts: Print a warning on failure to delete a routing rule

del_routing_for_ip() currently fails silently, which could hide real
errors.

In add_routing_for_ip() we don't want to see any error when calling
del_routing_for_ip(), since we don't expect the rule to be there.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts: fix basename -> dirname typo
Martin Schwenke [Tue, 24 Apr 2012 07:17:07 +0000 (17:17 +1000)]
Eventscripts: fix basename -> dirname typo

I fixed one of these previously but didn't notice this one...  :-(

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts - Fix typo in 13.per_ip_routing support for __auto_link_local__
Martin Schwenke [Wed, 18 Apr 2012 06:49:48 +0000 (16:49 +1000)]
Eventscripts - Fix typo in 13.per_ip_routing support for __auto_link_local__

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts - make 13.per_ip_routing fail gracefully if config is missing
Martin Schwenke [Tue, 20 Mar 2012 05:23:24 +0000 (16:23 +1100)]
Eventscripts - make 13.per_ip_routing fail gracefully if config is missing

Currently it spews out random messages about the file being missing.

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts - make 13.per_ip_routing try harder to find public_addresses
Martin Schwenke [Tue, 20 Mar 2012 05:21:09 +0000 (16:21 +1100)]
Eventscripts - make 13.per_ip_routing try harder to find public_addresses

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts - use set_proc() rather than accessing /proc directly
Martin Schwenke [Tue, 20 Mar 2012 05:20:10 +0000 (16:20 +1100)]
Eventscripts - use set_proc() rather than accessing /proc directly

Signed-off-by: Martin Schwenke <martin@meltin.net>
11 years agoEventscripts - 13.per_ip_routing should use dirname not basename for mkdir
Martin Schwenke [Tue, 20 Mar 2012 05:18:49 +0000 (16:18 +1100)]
Eventscripts - 13.per_ip_routing should use dirname not basename for mkdir

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoNew version 1.2.43
Ronnie Sahlberg [Wed, 28 Mar 2012 23:10:04 +0000 (10:10 +1100)]
New version 1.2.43

12 years agoAdd CTDB_CONTROL_CHECK_SRVID
Volker Lendecke [Mon, 31 Oct 2011 12:29:13 +0000 (13:29 +0100)]
Add CTDB_CONTROL_CHECK_SRVID

12 years agonew version 1.2.42
Ronnie Sahlberg [Mon, 12 Mar 2012 02:05:07 +0000 (13:05 +1100)]
new version 1.2.42

12 years agoReadOnly: Only restrict the readonly sanity/paranoia check that only allows
Ronnie Sahlberg [Mon, 12 Mar 2012 02:03:19 +0000 (13:03 +1100)]
ReadOnly: Only restrict the readonly sanity/paranoia check that only allows
UPDATE_RECORD to create a record to only apply to normal databases, not
persistent databases or else the net registry command breaks
and other persistent database creation/updates .

S1035666

12 years agonew version 1.2.41
Ronnie Sahlberg [Tue, 6 Mar 2012 05:03:18 +0000 (16:03 +1100)]
new version 1.2.41

12 years agoEventscripts - new function ctdb_check_args()
Martin Schwenke [Tue, 23 Aug 2011 06:32:34 +0000 (16:32 +1000)]
Eventscripts - new function ctdb_check_args()

Pass this "$@" to do common eventscript argument checking.

For regular use putting this in 00.ctdb would be enough.  However, for
developer testing it can be useful to call this in other eventscripts.
For example, 10.interfaces and 13.per_ip_routing currently check these
by hand.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscript functions - remove functions only used by 13.per_ip_routing
Martin Schwenke [Tue, 6 Mar 2012 00:21:41 +0000 (11:21 +1100)]
Eventscript functions - remove functions only used by 13.per_ip_routing

The relevant functions are now in that script.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoEventscripts - redesign and rewrite 13.per_ip_routing
Martin Schwenke [Thu, 1 Mar 2012 04:23:53 +0000 (15:23 +1100)]
Eventscripts - redesign and rewrite 13.per_ip_routing

The current version is quite difficult to read.  This one is hopefully
clearer.

Major changes:

* The configuration file has a more forgiving syntax.  Items can be
  separated by arbitrary whitespace.

* Mappings between IP addresses and table IDs are no longer stored in
  files in a state directory.  Instead they are stored in
  /etc/iproute2/rt_tables as mappings between table IDs and labels, as
  allowed by the ip command.  The current structure of the labels is
  ctdb.<source-ip>.  This means that once the labels are setup the
  routing tables can be referenced by just knowing the source IP.  As
  with the old state directory, mappings in this file owned by CTDB
  are deleted when CTDB shuts down.

* There are no release or re-add scripts.

  - Release scripts are not necessary as an optimisation because of
    the previous improvement (i.e. use of rt_tables).  No lookup is
    necessary to delete rules or flush tables.

  - Re-add scripts are no longer used.  Routes can still go missing
    when removal of a primary IP from an interfaces (or similar)
    causes removal of all other addresses (i.e. secondaries) and also
    all associated routes.  However, any missing routes are now
    re-added in the "ipreallocated" event.  This happens shortly after
    takeip/releaseip/updateip and means that the routes will only be
    re-added once.  The window for missing routes is slightly bigger
    but is not expected to be significant.

* The magic "__auto_link_local__" configuration value no longer causes
  a dynamic configuration file to be maintained in a state directory.
  The link local configuration is now generated when needed from the
  public_addresses file.  This greatly simplifies the code.  This
  approach is slightly less efficient but should not be significant.

The above changes mean that, apart from maintaining mappings in the
rt_tables file, there are no state files kept anymore.

Some utility functions only used by this script have been rewritten
and moved into this script.  They will be removed from the functions
file by a future commit.

The route re-add code will also be removed from interface_modify.sh by
a future commit.  It is currently harmless.

Signed-off-by: Martin Schwenke <martin@meltin.net>
12 years agoreadonly, dont allow any kind of fast vacuum for ro delegated records
Ronnie Sahlberg [Mon, 5 Mar 2012 23:51:00 +0000 (10:51 +1100)]
readonly, dont allow any kind of fast vacuum for ro delegated records

12 years agoRevert "READONLY: readonly fetch collapse. Make sure we only keep one single readonly...
Ronnie Sahlberg [Fri, 2 Mar 2012 03:48:15 +0000 (14:48 +1100)]
Revert "READONLY: readonly fetch collapse. Make sure we only keep one single readonly fetch for a record in flight at a time."

This reverts commit 9bde066f6eb46124168e5686fc41a323e67401e8.

12 years agoSTATISTICS: add total counts for number of delegations and number of revokes
Ronnie Sahlberg [Wed, 8 Feb 2012 02:42:30 +0000 (13:42 +1100)]
STATISTICS: add total counts for number of delegations and number of revokes

Everytime we give a delegation to another node we count this as one delegation.
If the same record is delegated to several nodes we count one for each node.

Everytime a record has all its delegations revoked we count this as one revoke.

12 years agoREADONLY: readonly fetch collapse. Make sure we only keep one single readonly fetch...
Ronnie Sahlberg [Fri, 2 Mar 2012 03:12:37 +0000 (14:12 +1100)]
READONLY: readonly fetch collapse. Make sure we only keep one single readonly fetch for a record in flight at a time.

12 years agoREADONLY: only send a control to schedule fast-vacuuming from child context iff we...
Ronnie Sahlberg [Thu, 1 Mar 2012 23:52:00 +0000 (10:52 +1100)]
READONLY: only send a control to schedule fast-vacuuming from child context 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.

12 years agoREADONLY: when updating a remote node to revoke a delegation, make sure
Ronnie Sahlberg [Thu, 1 Mar 2012 22:43:39 +0000 (09:43 +1100)]
READONLY: when updating a remote node to revoke a delegation, make sure
we dont create thje record if it doesnt exist

12 years agoREADONLY: allow specifying the db name for setdbreadonly instead of just the hash
Ronnie Sahlberg [Sun, 12 Feb 2012 23:27:59 +0000 (10:27 +1100)]
READONLY:  allow specifying the db name for setdbreadonly instead of just the hash

12 years agoNiceify the readonlyrecord API. Dont force clients to be exposed to the fetch_with_he...
Ronnie Sahlberg [Thu, 1 Mar 2012 22:04:39 +0000 (09:04 +1100)]
Niceify the readonlyrecord API. Dont force clients to be exposed to the fetch_with_header function

We dont strictly need to force clients to use CTDB_FETCH_WITH_HEADER instead of CTDB_FETCH when they ask for readonly records.
Have ctdbd internally remap this internally to FETCH_WITH_HEADER and map the reply back to CTDB_FETCH_FUNC or CTDB_FETCH_WITH_HEADER_FUNC based on what the client initially asked for.

This removes the need for the client to know about the CTDB_FETCH_WITH_HEADER_FUNC function and simplifies the client code.
Clients that do not care what the header after the request is can just continue using the old CTDB_FETCH_FUNC call and ctdbd will do all the difficult stuff.

12 years agoREADONLY: skip vacuuming or deleting records with readonly delegations.
Ronnie Sahlberg [Thu, 1 Mar 2012 21:53:16 +0000 (08:53 +1100)]
READONLY: skip vacuuming or deleting records with readonly delegations.
these records are hot. wait until they have been revoked before we recall them.

12 years agoVacuuming: change default timeout to 120 seconds
Ronnie Sahlberg [Wed, 29 Feb 2012 01:25:41 +0000 (12:25 +1100)]
Vacuuming: change default timeout to 120 seconds

S1035431

12 years agoAdd a tunable variable to control how long we defer after a ctdb addip until we force...
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

12 years agoWhen adding ips to nodes, set up a deferred rebalance for the whole node to trigger...
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

12 years agoMake KILLTCP structure a child of VNN so that it is freed at the same time
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

12 years agomake tdb valgrind-happy
Ronnie Sahlberg [Wed, 22 Feb 2012 06:43:04 +0000 (17:43 +1100)]
make tdb valgrind-happy

12 years agoEventscripts: remove the horrible horrible circular reference between state and callb...
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.

12 years agoReadOnly: Do not force all normal database to READONLY.
Ronnie Sahlberg [Mon, 20 Feb 2012 01:12:56 +0000 (12:12 +1100)]
ReadOnly: Do not force all normal database to READONLY.
Leave ro disabled by default and activate later by explicit calls to ctdb setdbreadonly

12 years agoNew version 1.2.40 ctdb-1.2.40
Ronnie Sahlberg [Sun, 5 Feb 2012 22:22:37 +0000 (09:22 +1100)]
New version 1.2.40

12 years agoReadOnly: update the loop test tool to print number of fetches per second
Ronnie Sahlberg [Tue, 31 Jan 2012 22:32:02 +0000 (09:32 +1100)]
ReadOnly: update the loop test tool to print number of fetches per second

12 years agolibctdb: dont allow ctdb_writerecord() for readonly records
Ronnie Sahlberg [Fri, 28 Oct 2011 02:38:32 +0000 (13:38 +1100)]
libctdb: dont allow ctdb_writerecord() for readonly records

12 years agoReadOnly: If record does not exist, upgrade to write-lock
Ronnie Sahlberg [Fri, 28 Oct 2011 01:41:27 +0000 (12:41 +1100)]
ReadOnly: If record does not exist, upgrade to write-lock

If we attempt a readonly lock request for a record that do not exist (yet)
in the local TDB, then upgrade the request to ask for a write lock and force a
request for migrate the record onto the local node.
This allows the "only request record on second local request for known contended records"
heuristics to try to avoid creating readonly delegations unless we have good reason to
assume it is a contended record.

12 years agoReadOnly: add readonly record lock requests to libctdb
Ronnie Sahlberg [Tue, 31 Jan 2012 23:26:41 +0000 (10:26 +1100)]
ReadOnly: add readonly record lock requests to libctdb

Initial readonly record support in libctdb.
New records are not yet created by the library but extising records will be
This needs a bit more tests before we can drop the "old style" implementatio
code in client/ctdb_client.c

12 years agoReadOnly: fix bug writing incorrect amount of data in delegated record
Ronnie Sahlberg [Fri, 28 Oct 2011 00:44:19 +0000 (11:44 +1100)]
ReadOnly: fix bug writing incorrect amount of data in delegated record

Fix bug when ctdbd updates the local copy of a delegated record to write the correct
amount of data to the record.

12 years agoReadOnly DOCS: update the docs for readonly delegations to remove the passage that...
Ronnie Sahlberg [Mon, 24 Oct 2011 02:19:30 +0000 (13:19 +1100)]
ReadOnly DOCS: update the docs for readonly delegations to remove the passage that records are written/updated by the client

12 years agoReadOnly: Dont update the record header from the calling client. While it is convenie...
Ronnie Sahlberg [Mon, 24 Oct 2011 02:14:26 +0000 (13:14 +1100)]
ReadOnly: Dont update the record header from the calling client. While it is convenient since it avoids having to create a child process from the main dameon for writing the updated record it makes the cleitn more complex.

Remove the code in the example client code that writes the record to the local tdb.
Add code to the local ctdbd processing of replies to check if this reply contain a ro delegation and if so, spawn a child process to lock the tdb and then write the data.

12 years agoReadOnly: revokechild_active is a list, not a context.
Ronnie Sahlberg [Tue, 13 Sep 2011 08:47:18 +0000 (18:47 +1000)]
ReadOnly: revokechild_active is a list, not a context.

Dont reset the pointer to NULL after deleting the first entry, loop deleting one entry
at a time until they are all gone or we will leak some memory and possibly a process.

12 years agofix some compiler warnings for the test tools
Ronnie Sahlberg [Tue, 13 Sep 2011 08:41:34 +0000 (18:41 +1000)]
fix some compiler warnings for the test tools

12 years agoReadOnly: Rename the function ctdb_ltdb_fetch_readonly() to ctdb_ltdb_fetch_with_head...
Ronnie Sahlberg [Tue, 13 Sep 2011 08:38:20 +0000 (18:38 +1000)]
ReadOnly: Rename the function ctdb_ltdb_fetch_readonly() to ctdb_ltdb_fetch_with_header() since this is what it actually does.

12 years agoReadOnly: update the documentation about readonly locks
Ronnie Sahlberg [Thu, 1 Sep 2011 01:40:51 +0000 (11:40 +1000)]
ReadOnly: update the documentation about readonly locks

12 years agoReadOnly: add a new control to activate readonly lock capability for a database.
Ronnie Sahlberg [Thu, 1 Sep 2011 01:08:18 +0000 (11:08 +1000)]
ReadOnly: add a new control to activate readonly lock capability for a database.
let all databases default to not support this  until enabled through this control

12 years agoReadOnly: add a readonly flag to the getdbmap control and show the readonly setting...
Ronnie Sahlberg [Thu, 1 Sep 2011 00:28:15 +0000 (10:28 +1000)]
ReadOnly: add a readonly flag to the getdbmap control and show the readonly setting in ctdb getdbmap output

12 years agoReadOnly: Change the ctdb_db structure to keep a uint8_t for flags instead of a boole...
Ronnie Sahlberg [Thu, 1 Sep 2011 00:21:55 +0000 (10:21 +1000)]
ReadOnly: Change the ctdb_db structure to keep a uint8_t for flags instead of a boolean for
the persistent flag.
This is the same size as the original boolean but allows ut to add additional flags for the database

12 years agoReadOnly: Check the readonly flag instead of whether the tdb pointer is NULL or not
Ronnie Sahlberg [Tue, 23 Aug 2011 00:41:52 +0000 (10:41 +1000)]
ReadOnly: Check the readonly flag instead of whether the tdb pointer is NULL or not

12 years agoReadOnly: add description of readonly records
Ronnie Sahlberg [Tue, 23 Aug 2011 00:37:20 +0000 (10:37 +1000)]
ReadOnly: add description of readonly records

12 years agoReadOnly: clear out the tracking record once a revoke is completed
Ronnie Sahlberg [Wed, 17 Aug 2011 06:14:57 +0000 (16:14 +1000)]
ReadOnly: clear out the tracking record once a revoke is completed

12 years agoReadOnly: When the client wants a readwrite lock but the local node is the dmaster...
Ronnie Sahlberg [Thu, 21 Jul 2011 05:59:37 +0000 (15:59 +1000)]
ReadOnly: When the client wants a readwrite lock but the local node is the dmaster and also have delegations active we must send a CALL to the local daemon to trigger it to revoke the delegations

12 years agoReadOnly: Change the update_record test tool to use the new fetchlock routine that...
Ronnie Sahlberg [Thu, 21 Jul 2011 05:58:56 +0000 (15:58 +1000)]
ReadOnly: Change the update_record test tool to use the new fetchlock routine that can do either normal or readonly fetchlock

12 years agoReadOnly: Add a test tool that requests a readonly delegation in a loop
Ronnie Sahlberg [Wed, 20 Jul 2011 05:47:15 +0000 (15:47 +1000)]
ReadOnly: Add a test tool that requests a readonly delegation in a loop

12 years agoReadOnly: Add a test tool to fetch a record, requesting a readonly delegation and...
Ronnie Sahlberg [Wed, 20 Jul 2011 05:43:55 +0000 (15:43 +1000)]
ReadOnly: Add a test tool to fetch a record, requesting a readonly delegation and lock the record once

12 years agoReadOnly: Add clientside code to fetch readonly records
Ronnie Sahlberg [Wed, 20 Jul 2011 05:37:37 +0000 (15:37 +1000)]
ReadOnly: Add clientside code to fetch readonly records

12 years agoReadOnly: Add a ctdb_ltdb_fetch_readonly() helper function
Ronnie Sahlberg [Wed, 20 Jul 2011 05:31:44 +0000 (15:31 +1000)]
ReadOnly: Add a ctdb_ltdb_fetch_readonly() helper function

12 years agoReadOnly: Add handlign of readonly requests readwrite requests, delegations and revok...
Ronnie Sahlberg [Wed, 20 Jul 2011 05:17:29 +0000 (15:17 +1000)]
ReadOnly: Add handlign of readonly requests readwrite requests, delegations and revoking of delegation to the processing loop for CALL requests coming in from a local client via domain socket

12 years agoReadOnly: Add processing for ReadOnly delegation requests and revoke requests to...
Ronnie Sahlberg [Wed, 20 Jul 2011 05:13:47 +0000 (15:13 +1000)]
ReadOnly: Add processing for ReadOnly delegation requests and revoke requests to the processing loop for CALL packets we receive from different nodes.

This implements the ReadOnly and ReadWrite request processing, delegation and revoking of delegations for all requests coming in across the network from a remote node.

12 years agoReadOnly: Once recovery has finished, make sure to free all revoke child processes...
Ronnie Sahlberg [Wed, 20 Jul 2011 04:25:29 +0000 (14:25 +1000)]
ReadOnly: Once recovery has finished, make sure to free all revoke child processes and trigger the destructors for all deferred calls to re-queue the original packets to the input packet processing function

12 years agoReadOnly: When releasing all deferred calls that blocked during revoke of all previou...
Ronnie Sahlberg [Wed, 20 Jul 2011 04:23:05 +0000 (14:23 +1000)]
ReadOnly: When releasing all deferred calls that blocked during revoke of all previous delegations, add a 1 second grace/delay for any new readonly delegation requests so that the read-write fetch-lock porcess has a chance to make progress

12 years agoReadOnly: Add a new flag to call request packet to indicate that the client wants...
Ronnie Sahlberg [Wed, 20 Jul 2011 04:21:04 +0000 (14:21 +1000)]
ReadOnly: Add a new flag to call request packet to indicate that the client wants a readonly delegation

12 years agoReadOnly: Add a function to start a revoke of all delegations for a record.
Ronnie Sahlberg [Tue, 23 Aug 2011 00:27:31 +0000 (10:27 +1000)]
ReadOnly: Add a function to start a revoke of all delegations for a record.
This triggers a child process to be created to perform the actual potentially blocking calls that are required.

12 years agoReadOnly: Add functions to register CALLs to a context used to handle deferal of...
Ronnie Sahlberg [Wed, 20 Jul 2011 03:49:17 +0000 (13:49 +1000)]
ReadOnly: Add functions to register CALLs to a context used to handle deferal of processing of CALL commands.
Once the contexts are freed, the deferred calls are re-issued to the input packet processing functions again.
This is needed when/if a CALL can not currently be processed by the main engine due to the record being locked down for revoking of all delegations.

The data is passed through several layers of callbacks, and finally a timed event callback to ensure that the processing of the packet will be restarted again at the topmost eventloop, avoinding event loop nesting.

12 years agoReadOnly: Add an extra flag to ctdb_call_local to specify whether we want to write...
Ronnie Sahlberg [Wed, 20 Jul 2011 03:30:12 +0000 (13:30 +1000)]
ReadOnly: Add an extra flag to ctdb_call_local to specify whether we want to write the record and header back to the tdb (for example we do when performing dmaster migrations)

12 years agoReadOnly: After recovering all databases, make sure to clear out the tracking databas...
Ronnie Sahlberg [Wed, 20 Jul 2011 03:20:32 +0000 (13:20 +1000)]
ReadOnly: After recovering all databases, make sure to clear out the tracking database used to track delegations and revoke. This is because the recovery will implicitely result in a revoke of all delegations.

12 years agoReadOnly: Add "readonly" flag to the ctdb_db_context to indicate if this database...
Ronnie Sahlberg [Wed, 20 Jul 2011 03:15:48 +0000 (13:15 +1000)]
ReadOnly: Add "readonly" flag to the ctdb_db_context to indicate if this database supports readonly operations or not. Add a private lock-less tdb file to the ctdb_db_context to use for tracking delegarions for records

Assume all databases will support readonly mode for now and se thte flag for all databases. At later stage we will add support to control on a per database level whether delegations will be supported or not.

12 years agoReadOnly: After performing a recovery, clear out all flags related to readonly delega...
Ronnie Sahlberg [Wed, 20 Jul 2011 03:08:21 +0000 (13:08 +1000)]
ReadOnly: After performing a recovery, clear out all flags related to readonly delegations and revoke

12 years agoReadOnly: Add a new command 'ctdb cattdb'. This fucntion differs from 'ctdb catdb...
Ronnie Sahlberg [Wed, 20 Jul 2011 02:30:33 +0000 (12:30 +1000)]
ReadOnly: Add a new command 'ctdb cattdb'. This fucntion differs from 'ctdb catdb' in that 'cattdb' will always traverse the local tdb file only, while 'catdb' does a cluster traverse.

Since some record flags may differ between nodes in the cluster when read only delegations are in use, cattdb is needed when you need to know the exact flag settings on the current node itself.

12 years agoReadOnly: Add printing of the record flags when we are traversing a database to print...
Ronnie Sahlberg [Wed, 20 Jul 2011 02:21:33 +0000 (12:21 +1000)]
ReadOnly: Add printing of the record flags when we are traversing a database to print its content.

12 years agoReadOnly: Add 4 new record flags to handle read only delegation and revoking of deleg...
Ronnie Sahlberg [Wed, 20 Jul 2011 02:17:27 +0000 (12:17 +1000)]
ReadOnly: Add 4 new record flags to handle read only delegation and revoking of delegations

12 years agoReadOnly: add a new test tool that does a fetchlock on a record, then bunps the RSN...
Ronnie Sahlberg [Wed, 20 Jul 2011 02:13:53 +0000 (12:13 +1000)]
ReadOnly: add a new test tool that does a fetchlock on a record, then bunps the RSN by 10 and writes the new content to the record as sprintf("%d", rsn)

12 years agoReadOnly: Add clientside functions to send the UPDATE_RECORD control
Ronnie Sahlberg [Wed, 20 Jul 2011 02:06:37 +0000 (12:06 +1000)]
ReadOnly: Add clientside functions to send the UPDATE_RECORD control

12 years agoReadOnly: Add test tool to validate the functions to manipulate and enumerate the...
Ronnie Sahlberg [Wed, 20 Jul 2011 01:50:14 +0000 (11:50 +1000)]
ReadOnly: Add test tool to validate the functions to manipulate and enumerate the bitmap of nodes to where we have readonly delegations

12 years agoReadOnly: Add helper functions to manipulate a TDB_DATA as a bitmap for nodes that...
Ronnie Sahlberg [Wed, 20 Jul 2011 01:39:50 +0000 (11:39 +1000)]
ReadOnly: Add helper functions to manipulate a TDB_DATA as a bitmap for nodes that we are tracking as having a readonly delegation

12 years agoReadOnly records: Add a new RPC function FETCH_WITH_HEADER.
Ronnie Sahlberg [Wed, 20 Jul 2011 01:27:05 +0000 (11:27 +1000)]
ReadOnly records: Add a new RPC function FETCH_WITH_HEADER.
This function differs from the old FETCH in that this function will also fetch the record header and not just the record data

12 years agoLCP IP allocation algorithm - try harder to find a candidate source node
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>
12 years agoLCP IP allocation algorithm - new function lcp2_failback_candidate()
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>
12 years agoNew version : 1.2.39
Ronnie Sahlberg [Thu, 17 Nov 2011 02:36:00 +0000 (13:36 +1100)]
New version : 1.2.39

12 years agoEventscripts: Add special -ECANCELED status for monitor events that are cancelled
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