metze/ctdb/wip.git
13 years agoconfig: wrap iptables in flock to avoid concurrancy.
Rusty Russell [Mon, 12 Jul 2010 05:41:42 +0000 (15:11 +0930)]
config: wrap iptables in flock to avoid concurrancy.

When doing a releaseip event, we do them in parallel for all the separate
IPs.  This creates a problem for iptables, which isn't reentrant, giving
the strange message:
iptables encountered unknown error "18446744073709551615" while initializing table "filter"

The worst possible symptom of this is that releaseip won't remove the rule
which prevents us listening to clients during releaseip, and the node will be
healthy but non-responsive.

The simple workaround is to flock-wrap iptables.  Better would be to rework
the code so we didn't need to use iptables in these paths.

CQ:S1018353
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agoctdb: fix crash on "ctdb scriptstatus --events=releaseip"
Rusty Russell [Mon, 12 Jul 2010 06:38:37 +0000 (16:08 +0930)]
ctdb: fix crash on "ctdb scriptstatus --events=releaseip"

Martin accidentally typed this instead of "ctdb scriptstatus releaseip"
and it crashes.

CQ:S1018859
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agoversion: generate RPM version from git
Rusty Russell [Fri, 2 Jul 2010 03:21:08 +0000 (13:21 +1000)]
version: generate RPM version from git

This unifies our RPM version handling, based on tags.
1) Tags are of form ctdb-<version>.
2) The first <version> starts with .1.
3) Devel versions end with .0.<patchnum>.<checksum>.devel to reliably
   identify them.

This means that devel versions will correctly supersede releases and earlier
devels, but new releases will correctly supersede older devel RPMs.

Making a new release is as simple as creating a new git tag.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agoReport client for queue errors.
Rusty Russell [Thu, 1 Jul 2010 13:08:49 +0000 (23:08 +1000)]
Report client for queue errors.

We've been seeing "Invalid packet of length 0" errors, but we don't know
what is sending them.  Add a name for each queue, and print nread.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agotdb: improve logging
Rusty Russell [Thu, 1 Jul 2010 08:33:18 +0000 (18:33 +1000)]
tdb: improve logging

When tdb throws an error, we didn't report the name of the tdb; we should.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agoctdb_freeze: extend db priority hack to cover serverid.tdb deadlock.
Rusty Russell [Thu, 1 Jul 2010 11:46:55 +0000 (21:46 +1000)]
ctdb_freeze: extend db priority hack to cover serverid.tdb deadlock.

We discovered that recent smbd locks the serverid tdb while
holding a lock on another tdb (locking.tdb):
  7: POSIX  ADVISORY  WRITE smbd-2224318 locking.tdb.0 10600 10600
  22: -> POSIX  ADVISORY  READ  smbd-2224318 serverid.tdb.0 26580 26580

The result is a deadlock against the ctdb_freeze code called for
recovery.  We extend the "notify" workaround to this case, too.

BZ:65158
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agospeed startup: with --sloppy-start, cut initial election timeout to 1/2 second.
Rusty Russell [Tue, 22 Jun 2010 13:25:20 +0000 (22:55 +0930)]
speed startup: with --sloppy-start, cut initial election timeout to 1/2 second.

Seconds between ctdbd first log message and node healthy:
BEFORE: 4.03
AFTER: 2.02

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agospeed startup: add --sloppy-start.
Rusty Russell [Tue, 22 Jun 2010 13:22:34 +0000 (22:52 +0930)]
speed startup: add --sloppy-start.

The extra recovery interval wait was introduced in 821333afb458 but no
explanation was provided in that message.  Nonetheless, if starting
the entire cluster for the first time, it should be safe to skip this.

We use the commandline arg --sloppy-start which should discourage
people from using it outside testing.

Seconds between ctdbd first log message and node healthy:
BEFORE: 16.10
AFTER: 4.03

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agospeed startup: run startup immediately after recovery finished.
Rusty Russell [Tue, 22 Jun 2010 13:20:45 +0000 (22:50 +0930)]
speed startup: run startup immediately after recovery finished.

Seconds between ctdbd first log message and node healthy:
BEFORE: 17.08
AFTER: 16.10

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agospeed startup: don't wait a full recovery interval if we've already waited
Rusty Russell [Tue, 22 Jun 2010 13:20:35 +0000 (22:50 +0930)]
speed startup: don't wait a full recovery interval if we've already waited

We currently sleep for one second, whether or not we've already slept.
Change this to sleep for the remainder of the second, if at all.

Seconds between ctdbd first log message and node healthy:
BEFORE: 18.09
AFTER: 17.08

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agospeed startup: immediately run first monitor event after startup.
Rusty Russell [Tue, 22 Jun 2010 13:20:07 +0000 (22:50 +0930)]
speed startup: immediately run first monitor event after startup.

Once we've done a startup, we need to run a monitor event successfully
to be marked as healthy.  Rather than wait the usual 5 seconds, run it
immediately (which will then reset next_interval to 5 seconds).

Seconds between ctdbd first log message and node healthy:
BEFORE: 23.58
AFTER: 18.09

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agospeed startup: alter recovery loop
Rusty Russell [Tue, 22 Jun 2010 13:20:23 +0000 (22:50 +0930)]
speed startup: alter recovery loop

We do a recovery on startup.  But the code does:
   Sleep for ctdb->tunable.recover_interval.
   Check for recovery.

We want to do it in the other order.  This is best done by extracting
the loop into a separate "main_loop" function.

Seconds between ctdbd first log message and node healthy:
BEFORE: 24.09
AFTER: 23.58

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agoWrap the IDR early, but not too early.
Ronnie Sahlberg [Thu, 10 Jun 2010 04:30:38 +0000 (14:30 +1000)]
Wrap the IDR early, but not too early.

We dont want it to wrap almost immediately so that basically all "ctdb ..."
commands log the "Reqid wrap" warning.

13 years agoMerge commit 'rusty/idtree'
Ronnie sahlberg [Thu, 10 Jun 2010 03:33:14 +0000 (13:33 +1000)]
Merge commit 'rusty/idtree'

13 years agoDelay reusing ids to make protocol more robust
Rusty Russell [Wed, 9 Jun 2010 23:28:55 +0000 (08:58 +0930)]
Delay reusing ids to make protocol more robust

Ronnie and I tracked down a bug which seems to be caused by a node
running so slowly that we timed out the request and reused the request
id before it responded.

The result was that we unlocked the wrong record, leading to the
following:

ctdbd: tdb_unlock: count is 0
ctdbd: tdb_chainunlock failed
smbd[1630912]: [2010/06/08 15:32:28.251716,  0] lib/util_sock.c:1491(get_peer_addr_internal)
ctdbd: Could not find idr:43
ctdbd: server/ctdb_call.c:492 reqid 43 not found

This exact problem is now detected, but in general we want to delay
id reuse as long as possible to make our system more robust.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agoidtree: fix handling of large ids (eg INT_MAX)
Rusty Russell [Wed, 9 Jun 2010 23:25:56 +0000 (08:55 +0930)]
idtree: fix handling of large ids (eg INT_MAX)

Since idtree assigns sequentially, it rarely reaches high numbers.
But such numbers can be forced with idr_get_new_above(), and that
reveals two bugs:
1) Crash in sub_remove() caused by pa array being too short.
2) Shift by more than 32 in _idr_find(), which is undefined, causing
   the "outside the current tree" optimization to misfire and return NULL.

Signed-off-by: Rusty Russell <rusty@rustorp.com.au>
13 years agofix a debug message
Ronnie Sahlberg [Wed, 9 Jun 2010 06:22:01 +0000 (16:22 +1000)]
fix a debug message

13 years agoidr can timeout and wrap/be reused quite quickly.
Ronnie Sahlberg [Wed, 9 Jun 2010 06:12:36 +0000 (16:12 +1000)]
idr can timeout and wrap/be reused quite quickly.

If a noremote node hangs for an extended period, it is possible
that we might have a DMASTER request in flight for record A to that node.
Eventually we will reuse the idr, and may reuse it for a DMASTER request to a different node for a different record B.

If while the request for B is in flight,  the first tnode un-hangs and responds back
we would receive a dmaster reply for the wrong record.

This would cause a record to become perpetually locked, since inside the daemon we would tdb_chainlock(dmaster_reply->pdu->key)   but once the migration would complete we would chainunlock   idr->state->call->key

Adding code to verify that when we receive a dmaster reply packet that it does in fact match the exact same key that the state variable we have for the idr in flight.

13 years agoWe can not be holding a chainlock at this stage, so the tdb_chainunlock() call is...
Ronnie Sahlberg [Wed, 9 Jun 2010 05:12:26 +0000 (15:12 +1000)]
We can not be holding a chainlock at this stage, so the tdb_chainunlock() call is bogus

( a child process might be holding the lock, but not the main daemon)

13 years agoadd extra logging for failed ctdb_ltdb_unlock() for a few more places
Ronnie Sahlberg [Wed, 9 Jun 2010 04:31:05 +0000 (14:31 +1000)]
add extra logging for failed ctdb_ltdb_unlock() for a few more places
it is called from

13 years agoadd additional logging when tdb_chainunlock() fails
Ronnie Sahlberg [Wed, 9 Jun 2010 04:17:35 +0000 (14:17 +1000)]
add additional logging when tdb_chainunlock() fails
so we can see where it was called from when it fails

13 years agoprint the db name qwhen a chainunlock fails too
Ronnie Sahlberg [Wed, 9 Jun 2010 03:54:10 +0000 (13:54 +1000)]
print the db name qwhen a chainunlock fails too

13 years agowhen tdb_chainunlock() fails, print the tdb error that occured
Ronnie Sahlberg [Wed, 9 Jun 2010 03:52:22 +0000 (13:52 +1000)]
when tdb_chainunlock() fails, print the tdb error that occured

13 years agoSome "ctdb ..." commands can be run without having the main daemon running.
Ronnie Sahlberg [Tue, 8 Jun 2010 23:17:35 +0000 (09:17 +1000)]
Some "ctdb ..." commands can be run without having the main daemon running.

In that case, when the main daemon is not running
the ctdb context will be initialized to NULL, since we can not connect.

Move the calls to read the ctdb socketname and connecting via libctdb to
only happen when we are executing a "ctdb ..." command that requires that we talk to the actual daemon.
Otherwise we will get an ugly SEGV for the "ctdb ..." commandline tool
when trying to run a command that is supposed to work also when the daemon is down.

13 years agolibctdb: connect TDB logging to our logging
Rusty Russell [Tue, 8 Jun 2010 08:39:42 +0000 (18:09 +0930)]
libctdb: connect TDB logging to our logging

A simple connector function, made a bit more complex because TDB adds
a '\n' and we don't.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agolibctdb: always check header hasn't changed on local tdb
Rusty Russell [Tue, 8 Jun 2010 08:40:36 +0000 (18:10 +0930)]
libctdb: always check header hasn't changed on local tdb

The code on which this is based could alter the header: a normal client
can't.  If we use this differently later we can change this.  For the
moment it's a nice extra check.

We optimize out the record write altogether when the record hasn't
changed, rather than just suppressing the seqnum update.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agolibctdb: more bool conversion, and accompany lock by ctdb_db in API
Rusty Russell [Tue, 8 Jun 2010 07:41:40 +0000 (17:11 +0930)]
libctdb: more bool conversion, and accompany lock by ctdb_db in API

I missed some int->bool conversions previously, particularly the
return of ctdb_writerecord().

By always handing functions ctdb_connection or ctdb_db, we keep it
consistent with the rest of the API and can do extra lock consistency
checks.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agolibctdb: clarify logging levels
Rusty Russell [Tue, 8 Jun 2010 07:23:17 +0000 (16:53 +0930)]
libctdb: clarify logging levels

Now we have more messages, it seems to make sense to document their usage
and make them consistent.

In particular, LOG_CRIT for internal libctdb problems, LOG_ALERT for
API misuse.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agolibctdb: use magic to detect free/invalid locks
Rusty Russell [Tue, 8 Jun 2010 07:22:23 +0000 (16:52 +0930)]
libctdb: use magic to detect free/invalid locks

Rather than using a binary, we use a magic value for locking.  We also
split out the "dont have the lock yet" from the "do have the lock"
paths for clarity and extra checking.

This should detect a superset of the previous case, even if they free
(and reuse) the lock memory.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agoAdditional log messages when tdb databases can no longer be chainlocked or chainunlocked
Ronnie Sahlberg [Tue, 8 Jun 2010 02:09:19 +0000 (12:09 +1000)]
Additional log messages when tdb databases can no longer be chainlocked or chainunlocked

BZ64688

13 years agoIn ctdb_writerecord()
Ronnie Sahlberg [Sat, 5 Jun 2010 05:43:01 +0000 (15:43 +1000)]
In ctdb_writerecord()
Verify that the lock is still held and refuse the write otherwise.

We have to guarantee that we dont write to an unlocked record.

If we write to a record after it has been released, the record may have
already migrated off the node, in which case we get a DMASTER split brain for this record. (These application bugs are incredibly hard to track down)

13 years agoSplit ctdb_release_lock() into a function to release the locvk and another function...
Ronnie Sahlberg [Sat, 5 Jun 2010 05:38:11 +0000 (15:38 +1000)]
Split ctdb_release_lock() into a function to release the locvk and another function to free the data structures.
This allows us to keep the datastructure valid after the lock has been released by the application and we can trap and warn when the application is accessing the lock after it has been released. I.e. application bugs.

13 years agoupdate "ctdb pnn" to use the new return value for _recv() where
Ronnie Sahlberg [Sat, 5 Jun 2010 04:38:01 +0000 (14:38 +1000)]
update "ctdb pnn" to use the new return value for _recv() where
bool false means failure and true means success.

13 years agoMust initialize ctdb->locks or else bad things happen
Ronnie Sahlberg [Sat, 5 Jun 2010 04:27:46 +0000 (14:27 +1000)]
Must initialize ctdb->locks or else bad things happen

13 years agoUpdate the ctdb tool to use the new signature for ctdb_connect()
Ronnie Sahlberg [Sat, 5 Jun 2010 04:21:42 +0000 (14:21 +1000)]
Update the ctdb tool to use the new signature for ctdb_connect()

13 years agolibctdb: documentation
Rusty Russell [Fri, 4 Jun 2010 11:00:08 +0000 (20:30 +0930)]
libctdb: documentation

Full documentation for all the functions.

This looks longer than it is, because it sorts them into async and
sync parts, and also renames some formal parameters.

Added TODO to libctdb directory to track our plans.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agolibctdb: use values from ctdb_protocol.h, don't re-declare
Rusty Russell [Fri, 4 Jun 2010 10:52:03 +0000 (20:22 +0930)]
libctdb: use values from ctdb_protocol.h, don't re-declare

We're best off including ctdb_protocol.h to get these, even if we
document the important ones in ctdb.h.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agolibctdb: use bool in API
Rusty Russell [Fri, 4 Jun 2010 10:49:25 +0000 (20:19 +0930)]
libctdb: use bool in API

Return bool instead of -1/0; that's what the young kids are doing
these days!

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agolibctdb: track lock for each ctdb_db, complain if they hold too long.
Rusty Russell [Fri, 4 Jun 2010 10:11:42 +0000 (19:41 +0930)]
libctdb: track lock for each ctdb_db, complain if they hold too long.

In particular, this stops them grabbing two (with wrappers so we can
enhance this logic once we support threads), and warns them if they
re-enter ctdb_service() holding a lock (you are not supposed to block!).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agopatch libctdb-use-logging.patch
Rusty Russell [Fri, 4 Jun 2010 10:57:06 +0000 (20:27 +0930)]
patch libctdb-use-logging.patch

13 years agolibctdb: add logging infrastructure
Rusty Russell [Fri, 4 Jun 2010 10:57:03 +0000 (20:27 +0930)]
libctdb: add logging infrastructure

This is based on Ronnie's work, merged with mine.  That means
errors are all my fault.

Differences from Ronnie's:
1) use syslog's LOG_ levels directly.
2) typesafe arg to log function, and use it (eg stderr) in helper function.
3) store fn in ctdb context, and expose ctdb_log_level directly thru API.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agolibctdb: add ctdb arg to more functions.
Rusty Russell [Fri, 4 Jun 2010 07:24:08 +0000 (16:54 +0930)]
libctdb: add ctdb arg to more functions.

This is going to help for logging, since we want it there.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agoReadrecordlock changes:
Ronnie Sahlberg [Fri, 4 Jun 2010 04:47:06 +0000 (14:47 +1000)]
Readrecordlock changes:

Make the use of ctdb_release_lock() mandatory from the callback.

Split ctdb_release_lock() in two, release the tdb lock in the
ctdb_release_lock() function and move the freeing of the lock structure to ctdb_free_lock() which is private to libctdb.

When the callback returns, verify that the callback has actually released the lock and warn (FIXME) if not.

Update ctdb_writerecord to warn and fail (FIXME) if writing while the lock is not held.

13 years agoremove the global rrl_cb_called from the libctdb example
Ronnie Sahlberg [Fri, 4 Jun 2010 04:20:17 +0000 (14:20 +1000)]
remove the global rrl_cb_called from the libctdb example
and psss it through the callback via private_data.

add a comment that the callback may sometimes have already been invoked
when the ctdb_readrecordlock_async() call returns
and that the application can use *private_data IF the application
needs to know if the callback has already triggered or not.

13 years agolibctdb: change callback for ctdb_readrecordlock.
Rusty Russell [Fri, 4 Jun 2010 04:03:08 +0000 (13:33 +0930)]
libctdb: change callback for ctdb_readrecordlock.

After discussion with Ronnie, we decided to revisit this interface.  We use
the name ctdb_readrecordlock_async, as it is *not* always a send, and we
use a specific callback to avoid the "fake request" creation on the fast
path.

The request itself is never exposed: this means it can't be cancelled,
but we can revisit that later if need be.

This makes both use and implementation simpler.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agolibctdb: fix wrong argument being handed to callback on attachdb fail
Rusty Russell [Fri, 4 Jun 2010 04:04:06 +0000 (13:34 +0930)]
libctdb: fix wrong argument being handed to callback on attachdb fail

When attachdb failed, we were handing the db, not the user-supplied
arg to the callback.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agoWhen we say "current time of statistics" in the "ctdb statistics" output,
Ronnie Sahlberg [Wed, 2 Jun 2010 07:06:14 +0000 (17:06 +1000)]
When we say "current time of statistics" in the "ctdb statistics" output,
print the current time and not the start time

13 years agoctdb_req_control contains 4 padding bytes. Create an explicit pad variable here and...
Ronnie Sahlberg [Wed, 2 Jun 2010 06:49:05 +0000 (16:49 +1000)]
ctdb_req_control contains 4 padding bytes. Create an explicit pad variable here and set it to 0 when creating a control to keep valgrind happy.

PDUs are padded to 8 byte boundary. If padding is used, memset it to 0
to keep valgrind happy.

13 years agoAdd the offsetof macro to libctdb
Ronnie Sahlberg [Wed, 2 Jun 2010 05:13:32 +0000 (15:13 +1000)]
Add the offsetof macro to libctdb

change all calls to new_ctdb_request() to use the offset macro to calculate the correct size (instead of allocating one byte too many and hoping the alignment padding saves us.)

13 years agoMake the call to free the request explicit in the callback
Ronnie Sahlberg [Wed, 2 Jun 2010 03:49:34 +0000 (13:49 +1000)]
Make the call to free the request explicit in the callback
instead of implicit

13 years agoAutomatically free the request once the callback has returned.
Ronnie Sahlberg [Wed, 2 Jun 2010 03:42:03 +0000 (13:42 +1000)]
Automatically free the request once the callback has returned.

13 years agoAdd a variable for start/current time to ctdb statistics
Ronnie Sahlberg [Wed, 2 Jun 2010 03:13:09 +0000 (13:13 +1000)]
Add a variable for start/current time to ctdb statistics
and print the time startistics was taken and for how long the statistics have been collected to the "ctdb statistics" output.

13 years agolink ctdb with libctdb and connect to the daemon both the old way and by using libctdb
Ronnie Sahlberg [Wed, 2 Jun 2010 00:37:00 +0000 (10:37 +1000)]
link ctdb with libctdb and connect to the daemon both the old way and by using libctdb

update the function "control_pnn()" to use libctdb to ask the daemon for the pnn

13 years agoadd a sync wrapper for the getpnn control
Ronnie Sahlberg [Wed, 2 Jun 2010 00:36:19 +0000 (10:36 +1000)]
add a sync wrapper for the getpnn control

13 years agoadd a function to read the current socketname from the ctdb structure
Ronnie Sahlberg [Wed, 2 Jun 2010 00:25:31 +0000 (10:25 +1000)]
add a function to read the current socketname from the ctdb structure

13 years agorename ctdb_remove_message_handler to ctdb_client_remove_message_handler
Ronnie Sahlberg [Wed, 2 Jun 2010 00:05:58 +0000 (10:05 +1000)]
rename ctdb_remove_message_handler to ctdb_client_remove_message_handler
to avoid conflict with the function of the same name in libctdb

13 years agorename ctdb_message_fn_t to ctdb_msg_fn_t to avoid a conflict with the type of the...
Ronnie Sahlberg [Wed, 2 Jun 2010 00:00:58 +0000 (10:00 +1000)]
rename ctdb_message_fn_t to ctdb_msg_fn_t to avoid a conflict with the type of the same name used in libctdb

13 years agorename ctdb_set_message_handler to ctdb_client_set_message_handler
Ronnie Sahlberg [Tue, 1 Jun 2010 23:51:47 +0000 (09:51 +1000)]
rename ctdb_set_message_handler to ctdb_client_set_message_handler
to avoid a colission with the function of the same name in libctdb

13 years agorename ctdb_send_message to ctdb_client_send_message to resolve colission with the...
Ronnie Sahlberg [Tue, 1 Jun 2010 23:45:21 +0000 (09:45 +1000)]
rename ctdb_send_message to ctdb_client_send_message to resolve colission with the function of the same name in libctdb

13 years agoDont link with libctdb
Ronnie Sahlberg [Tue, 1 Jun 2010 23:43:16 +0000 (09:43 +1000)]
Dont link with libctdb

This makes it easier to ensure we catch all places
when we rename old api functions due to colissions with
functions in libctdb

13 years agoUpdate the tst.c example application for libctdb to
Ronnie Sahlberg [Tue, 1 Jun 2010 23:24:17 +0000 (09:24 +1000)]
Update the tst.c example application for libctdb to
use the headers from /usr/include
and add a comment about how to compile it

13 years agorename ccan/typesafe_cb.h to ctdb_typesafe_cb.h and
Ronnie Sahlberg [Tue, 1 Jun 2010 23:18:48 +0000 (09:18 +1000)]
rename ccan/typesafe_cb.h to ctdb_typesafe_cb.h and
add this file to the install/rpm

13 years agoWhen adding an ip at runtime, it might not yet have an iface assigned to it, so ensur...
Ronnie Sahlberg [Tue, 1 Jun 2010 06:22:48 +0000 (16:22 +1000)]
When adding an ip at runtime, it might not yet have an iface assigned to it, so ensure that the next takover_ip call will fall through to accept the ip and add it.

13 years agoDont check linkstatus for loopback. This interface never has
Ronnie Sahlberg [Tue, 1 Jun 2010 04:51:09 +0000 (14:51 +1000)]
Dont check linkstatus for loopback. This interface never has
issues with the physical layer

13 years agoPrevent clients from connecting to the natgw address.
Ronnie Sahlberg [Tue, 1 Jun 2010 02:43:32 +0000 (12:43 +1000)]
Prevent clients from connecting to the natgw address.
This address is dedicated for outgoing connections.

BZ62613

13 years agoadd a gplv3 boilerplate to the example application for libctdb
Ronnie Sahlberg [Wed, 26 May 2010 03:55:19 +0000 (13:55 +1000)]
add a gplv3 boilerplate to the example application for libctdb

13 years agocheck if vnn is a valid pointer before dereferencing it
Ronnie Sahlberg [Wed, 26 May 2010 03:43:28 +0000 (13:43 +1000)]
check if vnn is a valid pointer before dereferencing it

based on rustys patch for bz62783

13 years agomove the header files and libctdb.a out into a separate ctdb-devel rpm
Ronnie Sahlberg [Wed, 26 May 2010 00:01:37 +0000 (10:01 +1000)]
move the header files and libctdb.a out into a separate ctdb-devel rpm

13 years agomake install to install libctdb.a
Ronnie Sahlberg [Tue, 25 May 2010 23:01:26 +0000 (09:01 +1000)]
make install to install libctdb.a

13 years agomake sure we build libctdb for "make all"
Ronnie Sahlberg [Tue, 25 May 2010 22:56:46 +0000 (08:56 +1000)]
make sure we build libctdb for "make all"

13 years agoMerge commit 'rusty/libctdb2'
Ronnie Sahlberg [Tue, 25 May 2010 02:48:49 +0000 (12:48 +1000)]
Merge commit 'rusty/libctdb2'

13 years agonew version 1.9
Ronnie Sahlberg [Tue, 25 May 2010 02:47:15 +0000 (12:47 +1000)]
new version 1.9

13 years agoAdd monitoring of quorum and make the node UNHEALTHY when quarum is lost
Ronnie Sahlberg [Mon, 24 May 2010 02:33:47 +0000 (12:33 +1000)]
Add monitoring of quorum and make the node UNHEALTHY when quarum is lost

13 years agoin 62.cnfs, lines in /etc/exports can have hte exports quoted,
Ronnie Sahlberg [Sun, 23 May 2010 23:51:52 +0000 (09:51 +1000)]
in 62.cnfs, lines in /etc/exports can have hte exports quoted,
so strip off any initial " on the exports line

13 years agoIt was possible for ->recovery_mode to get out of sync with the new three db prioriti...
Ronnie Sahlberg [Fri, 21 May 2010 04:25:47 +0000 (14:25 +1000)]
It was possible for ->recovery_mode to get out of sync with the new three db priorities in such a way that
->recovery_mode was set to normal   but database priorities leven2 or 3 was still set to frozen.

causing the recovery daemon to fail to detect that a recovery was needed to recover access to the database.

BZ63951

13 years agolibctdb: tweak interface for readrecordlock
Rusty Russell [Mon, 24 May 2010 04:22:17 +0000 (13:52 +0930)]
libctdb: tweak interface for readrecordlock

Previously we could hang in poll with the callback pending (since we
fake it): explicitly call it immediately.

Note: I experienced corruption using DLIST_ADD_END (ctdb->pnn was blatted
when adding to the message_handler list).  I switched them all to DLIST_ADD,
but maybe I'm using it wrong?

13 years agolibctdb: uniform callbacks, _recv functions to pull out data.
Rusty Russell [Mon, 24 May 2010 03:47:36 +0000 (13:17 +0930)]
libctdb: uniform callbacks, _recv functions to pull out data.

This is a bit tricky for those cases where we need to do multiple or
zero I/Os (eg. attachdb and readrecordlock), but works well for the
simple cases.

13 years agopatch libctdb-single-callback.patch
Rusty Russell [Fri, 21 May 2010 02:43:10 +0000 (12:13 +0930)]
patch libctdb-single-callback.patch

13 years agotst.c: update to Ronnie's latest
Rusty Russell [Thu, 20 May 2010 06:46:04 +0000 (16:16 +0930)]
tst.c: update to Ronnie's latest

This provides a slightly more comprehensive test of the library.

13 years agolibctdb: Ronnie's build changes, so we actually build libctdb with make.
Rusty Russell [Thu, 20 May 2010 06:27:40 +0000 (15:57 +0930)]
libctdb: Ronnie's build changes, so we actually build libctdb with make.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agolibctdb: first cut, supports getrecmaster only
Rusty Russell [Fri, 21 May 2010 02:37:41 +0000 (12:07 +0930)]
libctdb: first cut, supports getrecmaster only

This is a completely standalone library using only ctdb_protocol.h.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Header from folded patch 'libctdb-message-handling.patch':

libctdb: add message handling to libctdb.

Now clients can send and receive ctdb messages.

13 years agolibctdb: API changes from Ronnie's version
Rusty Russell [Thu, 20 May 2010 06:37:30 +0000 (16:07 +0930)]
libctdb: API changes from Ronnie's version

These simplifications mostly came up due to the implementation.

o Rename ctdb_context to ctdb_connection.
   We already have a ctdb_context internally in ctdbd; don't confuse them!
o Rename ctdb_handle to struct ctdb_request.
   From the user POV it's a request, and it's also useful internally to
   avoid implicit cast to/from void *.
o Rename ctdb_db_context to ctdb_db.
o Introduce ctdb_lock.
   This provides an explicit "lock object" you get from readrecordlock
   and have to hand to those functions which need you to hold a lock.
o status args are "int" not int32_t.
   Should this be a bool?
o Remove last traces on generic callback.
   Without semi-sync API, this doesn't help anything and loses type safety.
o Remove the semi-async API.
   We can add this later, but I think a sync and async API is enough for
   our poor users for the moment :)
o Registering a message handler also takes a callback.
   This way you can tell if it failed.  Not sure if this is overkill, but it's
   consistent.
o ctdb_service() takes an revents arg
   Strictly not necessary for a nonblocking fd, but nice to know if a
   read or write is possible.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agolibctdb: ctdb.h and tst.c from Ronnie
Rusty Russell [Thu, 20 May 2010 06:31:28 +0000 (16:01 +0930)]
libctdb: ctdb.h and tst.c from Ronnie

This imports ctdb.h and tst.c from Ronnie's work: it's a separate commit
for now to make the changes obvious.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agolibctdb: reorganize headers: remove ctdb.h, add ctdb_client.h and ctdb_protocol.h
Rusty Russell [Thu, 20 May 2010 05:48:30 +0000 (15:18 +0930)]
libctdb: reorganize headers: remove ctdb.h, add ctdb_client.h and ctdb_protocol.h

ctdb_client.h is the existing internal client interface (which was mainly
in ctdb.h), and ctdb_protocol.h is the information needed for the wire
protocol only.

ctdb.h will be the new, shiny, libctdb API.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agoIn control_ipreallocate() we wait at most 5 tries before aborting the command
Ronnie Sahlberg [Thu, 20 May 2010 02:35:57 +0000 (12:35 +1000)]
In control_ipreallocate() we wait at most 5 tries before aborting the command
and returning an error.
This might not be sufficient if there are several recoveries in a row.

Instead loop as long as it takes for the recovery master to finish the recoveries and re
spond to the ipreallocate call.

Increase the log level of the error message when the recovery master was busy and could
not perform the ipreallocation promptly

BZ61783

13 years agodocument how to restore a backup into a different database
Ronnie sahlberg [Thu, 20 May 2010 01:44:18 +0000 (11:44 +1000)]
document how to restore a backup into a different database

13 years agoEnhance the "ctdb restoredb" command so you can restore a backup into a different...
Ronnie Sahlberg [Thu, 20 May 2010 01:26:37 +0000 (11:26 +1000)]
Enhance the "ctdb restoredb" command so you can restore a backup into a different database.

13 years agoMerge commit 'obnox/master-rebase'
Ronnie sahlberg [Tue, 11 May 2010 09:44:11 +0000 (19:44 +1000)]
Merge commit 'obnox/master-rebase'

13 years agofunctions: when checking for a directory also check whether it can be accessed.
Michael Adam [Fri, 26 Mar 2010 15:40:00 +0000 (16:40 +0100)]
functions: when checking for a directory also check whether it can be accessed.

Thanks to "waKKu" on irc for this improvement.

Michael

13 years agotests:ctdb_bench: make send_start_messages() static - eliminates compile warning
Michael Adam [Mon, 15 Mar 2010 15:35:39 +0000 (16:35 +0100)]
tests:ctdb_bench: make send_start_messages() static - eliminates compile warning

Michael

13 years agotests: eliminate a floating point exception by requiring -n option to ctdb_bench
Michael Adam [Mon, 15 Mar 2010 15:34:43 +0000 (16:34 +0100)]
tests: eliminate a floating point exception by requiring -n option to ctdb_bench

Michael

13 years agoAdd the number of performed recoveries to the "ctdb statistics" output.
Ronnie Sahlberg [Mon, 10 May 2010 23:28:59 +0000 (09:28 +1000)]
Add the number of performed recoveries to the "ctdb statistics" output.

13 years agoctdb: use full range of IDR
Rusty Russell [Sat, 8 May 2010 12:54:11 +0000 (22:24 +0930)]
ctdb: use full range of IDR

This resolves a problem with huge numbers of requests which could overflow
16 bits.  Fortunately, the IDR should scale reasonably well, so we can simply
hold all the requests.

Although noone checks for failure, I added a constant for that.

BZ: 60540
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
13 years agowhen performing a recovery,
Ronnie Sahlberg [Wed, 5 May 2010 23:33:08 +0000 (09:33 +1000)]
when performing a recovery,
ensure that all nodes use the same reclock file setting as the recovery master

13 years agoAdd a new eventscript 62.cnfs to integrate better with gpfs/cnfs
Ronnie Sahlberg [Tue, 4 May 2010 03:56:55 +0000 (13:56 +1000)]
Add a new eventscript 62.cnfs to integrate better with gpfs/cnfs

13 years agoMerge commit 'rusty/signal-fix'
Ronnie sahlberg [Mon, 3 May 2010 05:57:41 +0000 (15:57 +1000)]
Merge commit 'rusty/signal-fix'

13 years ago Dont check ip assignment across the cluster while ip-verification
Ronnie Sahlberg [Mon, 3 May 2010 05:52:02 +0000 (15:52 +1000)]
Dont check ip assignment across the cluster while ip-verification
    checks are disabled

13 years agoThe recent change to the recovery daemon to keep track of and
Ronnie Sahlberg [Wed, 28 Apr 2010 05:43:11 +0000 (15:43 +1000)]
The recent change to the recovery daemon to keep track of and
verify that all nodes agree on the most recent ip address assignments
broke "ctdb moveip ..." since that call would never trigger
a full takeover run and thus would immediately trigger an inconsistency.

Add a new message to the recovery daemon where we can tell the recovery daemon to update its assignments.

BZ62782

13 years agoMake create_merged_ip_list() a static function since
Ronnie Sahlberg [Wed, 28 Apr 2010 04:47:37 +0000 (14:47 +1000)]
Make create_merged_ip_list() a static function since
it is not called from outside of ctdb_takeover.c

13 years agoIn the log message when we have found an inconsistent ip address allocation,
Ronnie Sahlberg [Wed, 28 Apr 2010 04:44:53 +0000 (14:44 +1000)]
In the log message when we have found an inconsistent ip address allocation,
add extra log information about what the inconsistency is.