metze/ctdb/wip.git
14 years agoDocument onnode "onnode any".
Martin Schwenke [Tue, 8 Sep 2009 05:19:24 +0000 (15:19 +1000)]
Document onnode "onnode any".

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoonnode: add "any" nodespec to select any node with running CTDB.
Martin Schwenke [Tue, 8 Sep 2009 05:10:20 +0000 (15:10 +1000)]
onnode: add "any" nodespec to select any node with running CTDB.

In testing and other situations (e.g. eventscripts) it is necessary to
select a node where a ctdb command can be run.  The whole idea here is
to avoid nodes where ctdbd is not running and where most ctdb commands
would fail.  This implements a standard way of doing this involving a
recursive onnode command.

There is still a small window for a race, where the selected node is
suddenly shutdown, but this is unavoidable.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoMerge commit 'origin/master'
Martin Schwenke [Mon, 7 Sep 2009 05:29:34 +0000 (15:29 +1000)]
Merge commit 'origin/master'

14 years agolower the loglevel for the info messages that a public ip is not hosted locally for...
Ronnie Sahlberg [Thu, 3 Sep 2009 18:09:30 +0000 (04:09 +1000)]
lower the loglevel for the info messages that a public ip is not hosted locally for takeip/releaseip

14 years ago new version 1.0.89
Ronnie Sahlberg [Thu, 3 Sep 2009 17:05:37 +0000 (03:05 +1000)]
 new version 1.0.89

14 years agomake it possible to have ctdb manage (start/stop/monitor) winbind without having...
Ronnie Sahlberg [Thu, 3 Sep 2009 16:59:24 +0000 (02:59 +1000)]
make it possible to have ctdb manage (start/stop/monitor) winbind without having samba

14 years agoMerge root@10.1.1.27:/shared/ctdb/ctdb-git
Ronnie Sahlberg [Thu, 3 Sep 2009 16:00:14 +0000 (02:00 +1000)]
Merge root@10.1.1.27:/shared/ctdb/ctdb-git

14 years agonew prototype banning code
Ronnie Sahlberg [Thu, 3 Sep 2009 16:20:39 +0000 (02:20 +1000)]
new prototype banning code

14 years agooverwrite the state file, dont append to it.
Ronnie Sahlberg [Tue, 1 Sep 2009 18:39:17 +0000 (04:39 +1000)]
overwrite the state file, dont append to it.
dont log errors is trying to delete a nonexisting state file

this eliminates some annoying log entries in the ctdb log

14 years agoredirect stderr to dev null since the rule might not exist when we try to uncondition...
Ronnie Sahlberg [Tue, 1 Sep 2009 17:12:27 +0000 (03:12 +1000)]
redirect stderr to dev null since the rule might not exist when we try to unconditionally delete it

14 years agoset broadcast addresses in the takeip event.
Michael Adam [Thu, 27 Aug 2009 20:09:42 +0000 (22:09 +0200)]
set broadcast addresses in the takeip event.

Michael

14 years agoremove a check for the reclock file we dont need
Ronnie Sahlberg [Thu, 27 Aug 2009 19:19:44 +0000 (05:19 +1000)]
remove a check for the reclock file we dont need

14 years agoTest suite: fix minor typo in complex/32_cifs_tickle.sh
Martin Schwenke [Thu, 27 Aug 2009 02:35:52 +0000 (12:35 +1000)]
Test suite: fix minor typo in complex/32_cifs_tickle.sh

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoMerge commit 'origin/master'
Martin Schwenke [Thu, 27 Aug 2009 02:33:43 +0000 (12:33 +1000)]
Merge commit 'origin/master'

14 years agoTest suite: Fix debug code for unexpectedly unhealthy cluster.
Martin Schwenke [Thu, 16 Jul 2009 04:04:06 +0000 (14:04 +1000)]
Test suite: Fix debug code for unexpectedly unhealthy cluster.

The debug code should run "ctdb status" on a cluster node, not on the
test client.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoskip any persistent databases ending in .bak
Ronnie Sahlberg [Tue, 18 Aug 2009 22:25:50 +0000 (08:25 +1000)]
skip any persistent databases ending in .bak

14 years agoMerge commit 'origin/master'
Martin Schwenke [Mon, 17 Aug 2009 03:08:42 +0000 (13:08 +1000)]
Merge commit 'origin/master'

14 years agonew version 1.0.88
Ronnie Sahlberg [Mon, 17 Aug 2009 01:04:40 +0000 (11:04 +1000)]
new version 1.0.88

14 years agoreduce the loglevel for the message that we switch to a different recmaster while...
Ronnie Sahlberg [Mon, 17 Aug 2009 00:56:12 +0000 (10:56 +1000)]
reduce the loglevel for the message that we switch to a different recmaster while waiting for ipreallocate to finish

14 years agoif no timeout at all is specified to the ctdb tool, neither using -T nor by setting...
Ronnie Sahlberg [Mon, 17 Aug 2009 00:54:45 +0000 (10:54 +1000)]
if no timeout at all is specified to the ctdb tool, neither using -T nor by setting CGTDB_TIMEOUT, then use 120 seconds as a default timepout before the ctdb command will exit with an error.

14 years agoTest suite: ctdb_persistent.c needs to use transactions.
Martin Schwenke [Fri, 14 Aug 2009 10:47:38 +0000 (20:47 +1000)]
Test suite: ctdb_persistent.c needs to use transactions.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agodocument enable/disablescript
Ronnie Sahlberg [Thu, 13 Aug 2009 03:02:00 +0000 (13:02 +1000)]
document enable/disablescript

14 years agoadd new controls to make it possible to enable/disable individual eventscripts
Ronnie Sahlberg [Thu, 13 Aug 2009 03:04:08 +0000 (13:04 +1000)]
add new controls to make it possible to enable/disable individual eventscripts

update scriptstatus output so it lists disabled scripts

14 years agoMerge commit 'origin/master'
Martin Schwenke [Tue, 11 Aug 2009 22:48:03 +0000 (08:48 +1000)]
Merge commit 'origin/master'

14 years agoMerge root@10.1.1.27:/shared/ctdb/ctdb-git
Ronnie Sahlberg [Sun, 9 Aug 2009 21:33:52 +0000 (07:33 +1000)]
Merge root@10.1.1.27:/shared/ctdb/ctdb-git

14 years agotests: fix the 52_ctdb_fetch.sh test.
Michael Adam [Thu, 30 Jul 2009 10:02:27 +0000 (12:02 +0200)]
tests: fix the 52_ctdb_fetch.sh test.

The parser for the output of the ctdb_fetch program
did not match the output that ctdb_fetch generates.
It seemed to rather come from the ctdb_bench test...

This patch adapts the parser to correctly interpret
the output of ctdb_fetch.

Michael

14 years agoclient: fix a debug message (misplaced newline).
Michael Adam [Sat, 11 Jul 2009 22:39:29 +0000 (00:39 +0200)]
client: fix a debug message (misplaced newline).

Michael

14 years agoclient:ctdb_control_send: remove duplicate setting of the reqid header.
Michael Adam [Wed, 15 Jul 2009 08:03:03 +0000 (10:03 +0200)]
client:ctdb_control_send: remove duplicate setting of the reqid header.

Michael

14 years agoctdbd: use ctdb_syslog_log() as debug_add function for syslog
Michael Adam [Tue, 21 Jul 2009 07:50:56 +0000 (09:50 +0200)]
ctdbd: use ctdb_syslog_log() as debug_add function for syslog

Michael

14 years agoctdbd: set debug_add hook to be able to use dump_data in the daemon.
Michael Adam [Tue, 21 Jul 2009 07:48:10 +0000 (09:48 +0200)]
ctdbd: set debug_add hook to be able to use dump_data in the daemon.

Michael

14 years agodebug: add debug_add and dump_data functions
Michael Adam [Tue, 21 Jul 2009 07:47:07 +0000 (09:47 +0200)]
debug: add debug_add and dump_data functions

Michael

14 years agotdb: don't alter tdb->flags in tdb_reopen_all()
Rusty Russell [Thu, 30 Jul 2009 02:22:39 +0000 (11:52 +0930)]
tdb: don't alter tdb->flags in tdb_reopen_all()

The flags are user-visible, via tdb_get_flags/add_flags/remove_flags.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agotdb: Reimplementation of Metze's "lib/tdb: if we know pwrite and pread are thread...
Rusty Russell [Thu, 30 Jul 2009 02:22:08 +0000 (11:52 +0930)]
tdb: Reimplementation of Metze's "lib/tdb: if we know pwrite and pread are thread/fork safe tdb_reopen_all() should be a noop".

This version just wraps the reopen code, so we still re-grab the lock and do
the normal sanity checks.

The reason we do this at all is to avoid global fd limits, see:
http://forums.fedoraforum.org/showthread.php?t=210393

Note also that this whole reopen concept is fundamentally racy: if the parent
goes away before the child calls tdb_reopen_all, the database can be left
without an active lock and another TDB_CLEAR_IF_FIRST opener will clear it.
A fork_with_tdbs() wrapper could use a pipe to solve this, but it's hardly
elegant (what if there are other independent things which have similar needs?).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agorealloc() has that horrible overloaded free semantic when size is 0: current code...
Rusty Russell [Thu, 30 Jul 2009 20:10:33 +0000 (13:10 -0700)]
realloc() has that horrible overloaded free semantic when size is 0: current code does a free of the old record in this case, then fail.

14 years agoIf the record is at the end of the database, pretending it has length 1 might take...
Rusty Russell [Thu, 30 Jul 2009 20:09:33 +0000 (13:09 -0700)]
If the record is at the end of the database, pretending it has length 1 might take us out-of-bounds. Only pretend to be length 1 for the malloc.

14 years agoPort from SAMBA tdb: commit 54a51839ea65aa788b18fce8de0ae4f9ba63e4e7 Author: Rusty...
Rusty Russell [Wed, 29 Jul 2009 05:23:03 +0000 (14:53 +0930)]
Port from SAMBA tdb: commit 54a51839ea65aa788b18fce8de0ae4f9ba63e4e7 Author: Rusty Russell <rusty@rustcorp.com.au> Date: Sat Jul 18 15:28:58 2009 +0930

Make tdb transaction lock recursive (samba version)

    This patch replaces 6ed27edbcd3ba1893636a8072c8d7a621437daf7 and
    1a416ff13ca7786f2e8d24c66addf00883e9cb12, which fixed the bug where traversals
    inside transactions would release the transaction lock early.

    This solution is more general, and solves the more minor symptom that nested
    traversals would also release the transaction lock early.  (It was also suggestd in
    Volker's comment in 6ed27ed).

    This patch also applies to ctdb, if the traverse.c part is removed (ctdb's tdb
    code never received the previous two fixes).

    Tested using the testsuite from ccan (adapted to the samba code).  Thanks to
    Michael Adam for feedback.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Michael Adam <obnox@samba.org>
commit 760104188d0d2ed96ec4a70138e6d0bf86d797ed
Author: Rusty Russell <rusty@rustcorp.com.au>
Date:   Tue Jul 21 16:23:35 2009 +0930

    tdb: fix locking error

    54a51839ea65aa788b18fce8de0ae4f9ba63e4e7 "Make tdb transaction lock
    recursive (samba version)" was broken: I "cleaned it up" and prevented
    it from ever unlocking.

    To see the problem:
        $ bin/tdbtorture -s 1248142523
        tdb_brlock failed (fd=3) at offset 8 rw_type=1 lck_type=14 len=1
        tdb_transaction_lock: failed to get transaction lock
        tdb_transaction_start failed: Resource deadlock avoided

    My testcase relied on the *count* being correct, which it was.  Fixing that
    now.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Michael Adam <obnox@samba.org>
14 years agoPort from SAMBA tdb: commit a6cc04a20089e8fbcce138c271961c37ddcd6c34 Author: Andrew...
Rusty Russell [Wed, 29 Jul 2009 05:21:34 +0000 (14:51 +0930)]
Port from SAMBA tdb: commit a6cc04a20089e8fbcce138c271961c37ddcd6c34 Author: Andrew Tridgell <tridge@samba.org> Date: Mon Jun 1 13:13:07 2009 +1000

overallocate all records by 25%

    This greatly reduces the fragmentation of databases where records
    tend to grow slowly by a small amount each time. The case where this
    is most seen is the ldb index records. Adding this overallocation
    reduced the size of the resulting database by more than 20x when
    running a test that adds 10k users.

14 years agoPort from SAMBA tdb: commit a386173fa1c7c5bcc11ea9260d84b6c52c154b3d Author: Andrew...
Rusty Russell [Wed, 29 Jul 2009 05:21:12 +0000 (14:51 +0930)]
Port from SAMBA tdb: commit a386173fa1c7c5bcc11ea9260d84b6c52c154b3d Author: Andrew Tridgell <tridge@samba.org> Date: Mon Jun 1 13:11:39 2009 +1000

auto-repack in transactions that expand the tdb

    The idea behind this is to recover from badly fragmented free
    lists. Choosing the point where the file expands is fairly arbitrary,
    but seems to work well.

14 years agoPort from SAMBA ctdb: commit 936d76802f98d04d9743b2ca8eeeaadd4362db51 Author: Andrew...
Rusty Russell [Wed, 29 Jul 2009 06:32:51 +0000 (16:02 +0930)]
Port from SAMBA ctdb: commit 936d76802f98d04d9743b2ca8eeeaadd4362db51 Author: Andrew Tridgell <tridge@samba.org> Date: Tue Dec 16 14:38:17 2008 +1100

imported the tdb_repack() code from CTDB

    The tdb_repack() function repacks a TDB so that it has a single
    freelist entry. The file doesn't shrink, but it does remove all
    freelist fragmentation. This code originated in the CTDB vacuuming
    code, but will now be used in ldb to cope with fragmentation from
    re-indexing

14 years agoPort from SAMBA tdb: commit 4b4fec65db4e202afa13b2d15867f4d8a54d154e Author: Andrew...
Rusty Russell [Wed, 29 Jul 2009 05:20:39 +0000 (14:50 +0930)]
Port from SAMBA tdb: commit 4b4fec65db4e202afa13b2d15867f4d8a54d154e Author: Andrew Tridgell <tridge@samba.org> Date: Thu May 28 16:08:28 2009 +1000

make TDB_NOSYNC affect all the fsync/msync calls in transactions

    During a transaction commit tdb normally uses fsync/msync calls to
    make it crash safe. This can be disabled using the TDB_NOSYNC flag,
    but it wasn't disabling all the code paths that caused a fsync/msync.

14 years agoPort from SAMBA tdb: commit a91bcbccf8a2243dac57cacec6fdfc9907580f69 Author: Jim...
Rusty Russell [Wed, 29 Jul 2009 05:19:57 +0000 (14:49 +0930)]
Port from SAMBA tdb: commit a91bcbccf8a2243dac57cacec6fdfc9907580f69 Author: Jim McDonough <jmcd@samba.org> Date: Thu May 21 16:26:26 2009 -0400

Detect tight loop in tdb_find()

14 years agoPort from SAMBA tdb: commit 42c0931441ef53a3f977e1334355fa83f05ac184 Author: Tim...
Rusty Russell [Wed, 29 Jul 2009 05:18:42 +0000 (14:48 +0930)]
Port from SAMBA tdb: commit 42c0931441ef53a3f977e1334355fa83f05ac184 Author: Tim Prouty <tprouty@samba.org> Date: Tue Mar 31 16:24:07 2009 -0700

tdb: Remove unused variable

14 years agoPort from SAMBA tdb:
Rusty Russell [Wed, 29 Jul 2009 05:17:29 +0000 (14:47 +0930)]
Port from SAMBA tdb:

commit b90863c0b7b860b006ac49c9396711ff351f777f
Author: Howard Chu <hyc@highlandsun.com>
Date:   Tue Mar 31 13:15:54 2009 +1100

    Add tdb_transaction_prepare_commit()

    Using tdb_transaction_prepare_commit() gives us 2-phase commits. This
    allows us to safely commit across multiple tdb databases at once, with
    reasonable transaction semantics

Signed-off-by: tridge@samba.org
14 years agoupdate STOP/CONTINUE to better handle when we stop the last node
Ronnie Sahlberg [Mon, 3 Aug 2009 02:51:55 +0000 (12:51 +1000)]
update STOP/CONTINUE to better handle when we stop the last node

14 years agoMerge commit 'origin/master'
Martin Schwenke [Fri, 31 Jul 2009 01:04:37 +0000 (11:04 +1000)]
Merge commit 'origin/master'

14 years agoTest suite: Retrieval NFS_TICKLE_SHARED_DIRECTORY more defensively.
Martin Schwenke [Thu, 30 Jul 2009 04:10:34 +0000 (14:10 +1000)]
Test suite: Retrieval NFS_TICKLE_SHARED_DIRECTORY more defensively.

In complex/31_nfs_tickle.sh we run sed against a file that might not
exist, causing potential garbage from stderr in the output.  Check
that the file exists before running sed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoTest suite: Better diagnostics for recent change to complex/31_nfs_tickle.sh.
Martin Schwenke [Thu, 30 Jul 2009 04:03:44 +0000 (14:03 +1000)]
Test suite: Better diagnostics for recent change to complex/31_nfs_tickle.sh.

Add a -v so we see the output of the command that tries to get the
value of NFS_TICKLE_SHARED_DIRECTORY.  That way we can tell if a value
was retrived OK or if we're using the default.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoTest suite: complex/31_nfs_tickle.sh should use NFS_TICKLE_SHARED_DIRECTORY.
Martin Schwenke [Thu, 30 Jul 2009 03:57:40 +0000 (13:57 +1000)]
Test suite: complex/31_nfs_tickle.sh should use NFS_TICKLE_SHARED_DIRECTORY.

Rather than hardcoding the location of the shared tickle directory,
attempt to use the value of NFS_TICKLE_SHARED_DIRECTORY from
/etc/sysconfig/nfs on node 0.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoTest suite: Ask CTDB about CIFS tickles registered for the actual test node.
Martin Schwenke [Thu, 30 Jul 2009 03:45:06 +0000 (13:45 +1000)]
Test suite: Ask CTDB about CIFS tickles registered for the actual test node.

This failed when node 0 had no public IPs because we would always run
"ctdb gettickles" on node.  We now ask node 0 for the tickles on the
test node.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoTest suite: Turn off strict host key checking in the SSH failover test.
Martin Schwenke [Thu, 30 Jul 2009 03:20:23 +0000 (13:20 +1000)]
Test suite: Turn off strict host key checking in the SSH failover test.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoMerge commit 'martins/master'
Ronnie Sahlberg [Thu, 30 Jul 2009 00:55:56 +0000 (10:55 +1000)]
Merge commit 'martins/master'

14 years agoTest suite: fix test file permissions in complex/44_failover_nfs_oneway.sh.
Martin Schwenke [Thu, 30 Jul 2009 00:47:36 +0000 (10:47 +1000)]
Test suite: fix test file permissions in complex/44_failover_nfs_oneway.sh.

Something, perhaps root_squash, causing permission denied on the test
file after we copy it over with scp.  This sets the initial
permissions to be friendly and adds -p to the scp command to maintain
those friendly permissions.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoTest suite: fix the test suite's generic event script.
Martin Schwenke [Wed, 29 Jul 2009 08:10:05 +0000 (18:10 +1000)]
Test suite: fix the test suite's generic event script.

Add a "stopped" case to log events and stop the event script from
failing with an unknown event.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoTest suite: Fixes for node state parsing plus new stop/continue tests.
Martin Schwenke [Wed, 29 Jul 2009 08:01:07 +0000 (18:01 +1000)]
Test suite: Fixes for node state parsing plus new stop/continue tests.

The parsing of "ctdb status -Y" output to determine various node
states was implemented very strictly.  Therefore, the parsing broke
due to the addition of the new "stopped" state to the output of "ctdb
status -Y".  This relaxes the parsing so that it should work for
versions prior to the introduction of the "stopped" state, as well as
future versions that add new states to the end of the list of bits in
output of "ctdb status -Y".

Similarly the check for cluster unhealthy (in _cluster_is_healthy())
now just checks for a single 1 in any bit in the "ctdb status -Y"
output, rather than checking for a particular number of 0s.

New tests
tests/simple/{41_ctdb_stop.sh,42_ctdb_continue.sh,43_stop_recmaster_yield.sh}
do rudimentary testing of the stop and continue functions.

Remove tests tests/simple/41_ctdb_ban.sh and
tests/simple/42_ctdb_unban.sh.  They were both unreliable.

tests/simple/21_ctdb_disablemonitor.sh now schedules a restart, since
one will be required.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agochange the defaults for repacking to repack once every 120 seconds and letting it...
Ronnie Sahlberg [Wed, 29 Jul 2009 03:31:12 +0000 (13:31 +1000)]
change the defaults for repacking to repack once every 120 seconds and letting it work for 30 second before timing out.

14 years agorepack limit tunable
Wolfgang Mueller-Friedt [Tue, 28 Jul 2009 20:09:28 +0000 (23:09 +0300)]
repack limit tunable

Signed-off-by: Wolfgang Mueller-Friedt <wolfmuel@de.ibm.com>
14 years agoremove repack from eventscript
Wolfgang Mueller-Friedt [Tue, 28 Jul 2009 14:49:41 +0000 (17:49 +0300)]
remove repack from eventscript

Signed-off-by: Wolfgang Mueller-Friedt <wolfmuel@de.ibm.com>
14 years agoadded event repacking
Wolfgang Mueller-Friedt [Tue, 28 Jul 2009 14:45:31 +0000 (17:45 +0300)]
added event repacking

Signed-off-by: Wolfgang Mueller-Friedt <wolfmuel@de.ibm.com>
14 years agovacuum event framework
Ronnie Sahlberg [Thu, 23 Jul 2009 06:03:39 +0000 (16:03 +1000)]
vacuum event framework

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Wolfgang Mueller-Friedt <wolfmuel@de.ibm.com>
14 years agoinitial part of new vacuuming patch.
Ronnie Sahlberg [Wed, 29 Jul 2009 03:25:43 +0000 (13:25 +1000)]
initial part of new vacuuming patch.

create some new fields for ctdb_db and tunables

14 years agoFrom Michael Adam:
Ronnie Sahlberg [Wed, 29 Jul 2009 01:18:02 +0000 (11:18 +1000)]
From Michael Adam:

Update the transaction test tool to the new api for transactions

14 years agoclient: refuse to do record_store() on a persistent tdb.
Michael Adam [Mon, 20 Jul 2009 14:34:56 +0000 (16:34 +0200)]
client: refuse to do record_store() on a persistent tdb.

Only allow stores wrapped in transactions on persistent dbs.

Michael

14 years agoctdbd: refuse PERSISTENT_STORE if transaction is running.
Michael Adam [Mon, 20 Jul 2009 14:33:53 +0000 (16:33 +0200)]
ctdbd: refuse PERSISTENT_STORE if transaction is running.

Michael

14 years agoFix persistent transaction commit race condition.
Michael Adam [Tue, 21 Jul 2009 09:30:38 +0000 (11:30 +0200)]
Fix persistent transaction commit race condition.

In ctdb_client.c:ctdb_transaction_commit(), after a failed
TRANS2_COMMIT control call (for instance due to the 1-second
being exceeded waiting for a busy node's reply), there is a
1-second gap between the transaction_cancel() and
replay_transaction() calls in which there is no lock on the
persistent db. And due to the lack of global state
indicating that a transaction is in progress in ctdbd, other nodes
may succeed to start transactions on the db in this gap and
even worse work on top of the possibly already pushed changes.
So the data diverges on the several nodes.

This change fixes this by introducing global state for a transaction
commit being active in the ctdb_db_context struct and in a db_id field
in the client so that a client keeps track of _which_ tdb it as
transaction commit running on. These data are set by ctdb upon
entering the trans2_commit control and they are cleared in the
trans2_error or trans2_finished controls. This makes it impossible
to start a nother transaction or migrate a record to a different
node while a transaction is active on a persistent tdb, including
the retry loop.

This approach is dead lock free and still allows recovery process
to be started in the retry-gap between cancel and replay.
Also note, that this solution does not require any change in the
client side.

This was debugged and developed together with
Stefan Metzmacher <metze@samba.org> - thanks!

Michael

14 years agoclient: set dmaster in ctdb_transaction_store() also when updating an existing record
Michael Adam [Thu, 16 Jul 2009 20:00:10 +0000 (22:00 +0200)]
client: set dmaster in ctdb_transaction_store() also when updating an existing record

Michael

14 years agoMerge commit 'origin/master'
Martin Schwenke [Wed, 29 Jul 2009 00:08:56 +0000 (10:08 +1000)]
Merge commit 'origin/master'

14 years agoWhen processing the stop node control reply in the client code we should
Ronnie Sahlberg [Tue, 28 Jul 2009 23:58:40 +0000 (09:58 +1000)]
When processing the stop node control reply in the client code we should
also check the returned status code in case the _stop() command failed
due to the eventscripts failing.

If this happens, make "ctdb stop" log an error to the console and try
the operation again.

14 years agoonnode: update tests for healthy and connected to cope with new stopped bit.
Martin Schwenke [Tue, 28 Jul 2009 06:00:11 +0000 (16:00 +1000)]
onnode: update tests for healthy and connected to cope with new stopped bit.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agodocument the two new commands setlmasterrole and setrecmasterrole
Ronnie Sahlberg [Tue, 28 Jul 2009 03:54:08 +0000 (13:54 +1000)]
document the two new commands setlmasterrole and setrecmasterrole

14 years agoadd two commands : setlmasterrole and setrecmasterrole to enable/disable these capabi...
Ronnie Sahlberg [Tue, 28 Jul 2009 03:45:13 +0000 (13:45 +1000)]
add two commands : setlmasterrole and setrecmasterrole to enable/disable these capabilities at runtime

14 years agoDocument the natgw flag and how this changes the output of "ctdb
Ronnie Sahlberg [Tue, 28 Jul 2009 00:02:39 +0000 (10:02 +1000)]
Document the natgw flag and how this changes the output of "ctdb
getcapabilities"

14 years agoupdate the natgw eventscript to set the NATGW capability when this feature is used
Ronnie Sahlberg [Tue, 28 Jul 2009 00:00:33 +0000 (10:00 +1000)]
update the natgw eventscript to set the NATGW capability when this feature is used
This does not modify any behaviour of the daemon itself other than showing this flag as ON in the ctdeb getcapabilities output

14 years agoadd a command "setnatgwstate {on|off}" that can be used to indicate if this node...
Ronnie Sahlberg [Mon, 27 Jul 2009 23:58:11 +0000 (09:58 +1000)]
add a command "setnatgwstate {on|off}" that can be used to indicate if this node is using natgw functionality or not.

14 years agodescribe how to activate NATGW without restarting the nodes on a running
Ronnie Sahlberg [Mon, 27 Jul 2009 23:27:00 +0000 (09:27 +1000)]
describe how to activate NATGW without restarting the nodes on a running
cluster

14 years ago new version 1.0.87
Ronnie Sahlberg [Fri, 17 Jul 2009 03:01:11 +0000 (13:01 +1000)]
 new version 1.0.87

14 years agoMerge commit 'martins/master'
Ronnie Sahlberg [Fri, 17 Jul 2009 02:45:08 +0000 (12:45 +1000)]
Merge commit 'martins/master'

14 years agodocument the new stopped event
Ronnie Sahlberg [Fri, 17 Jul 2009 02:30:05 +0000 (12:30 +1000)]
document the new stopped event

14 years agocreate a new event : stopped.
Ronnie Sahlberg [Fri, 17 Jul 2009 02:26:16 +0000 (12:26 +1000)]
create a new event : stopped.
This event is called when a node is stopped and is used by eventscripts that need to do certain cleanup and removal of configuration or ip addresses or routing ...

Note that a STOPPED node is considered "inactive" and as such will not be running the "recovered" event when the rest of the cluster has recovered.

14 years agoWhen we create new election data to send during elections, we must re-read the node...
Ronnie Sahlberg [Fri, 17 Jul 2009 01:37:03 +0000 (11:37 +1000)]
When we create new election data to send during elections, we must re-read the node flags from the main daemon to catch when the STOPPED flag is changed.

14 years agoupdate the eventscript to ensure that stopped nodes can not become the natgw master
Ronnie Sahlberg [Thu, 16 Jul 2009 23:45:05 +0000 (09:45 +1000)]
update the eventscript to ensure that stopped nodes can not become the natgw master
also verify that we actually do have a natgw master available if this is configured and make the node unhealthy if not.

14 years agoif all nodes are STOPPED, pick one of the STOPPED nodes as natgw master
Ronnie Sahlberg [Thu, 16 Jul 2009 23:36:22 +0000 (09:36 +1000)]
if all nodes are STOPPED, pick one of the STOPPED nodes as natgw master

14 years agoDo not allow STOPPED or DELETED nodes to become the NATGW master
Ronnie Sahlberg [Thu, 16 Jul 2009 23:29:58 +0000 (09:29 +1000)]
Do not allow STOPPED or DELETED nodes to become the NATGW master

14 years agoTest suite: Fix debug code for unexpectedly unhealthy cluster.
Martin Schwenke [Thu, 16 Jul 2009 04:04:06 +0000 (14:04 +1000)]
Test suite: Fix debug code for unexpectedly unhealthy cluster.

The debug code should run "ctdb status" on a cluster node, not on the
test client.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agostopped nodes can not win a recmaster election
Ronnie Sahlberg [Thu, 9 Jul 2009 04:44:03 +0000 (14:44 +1000)]
stopped nodes can not win a recmaster election

stopped nodes must yield the recmaster role

14 years agochange the infolevel when logging stop/continue commands
Ronnie Sahlberg [Thu, 9 Jul 2009 04:34:12 +0000 (14:34 +1000)]
change the infolevel when logging stop/continue commands

14 years agorecovery daemon needs to monitor when the local ctdb daemon is stopped and ensure...
Ronnie Sahlberg [Thu, 9 Jul 2009 04:19:32 +0000 (14:19 +1000)]
recovery daemon needs to monitor when the local ctdb daemon is stopped and ensure that the databases gets frozen and the node enters recovery mode

14 years agodocument the new commands ctdb stop/continue
Ronnie Sahlberg [Thu, 9 Jul 2009 03:07:15 +0000 (13:07 +1000)]
document the new commands ctdb stop/continue

14 years agodont let other nodes modify the STOPPED flag for the local process when pushing out...
Ronnie Sahlberg [Thu, 9 Jul 2009 03:20:14 +0000 (13:20 +1000)]
dont let other nodes modify the STOPPED flag for the local process when pushing out flags changes

14 years agoadd two new controls, CTOP_NODE and CONTINUE_NODE
Ronnie Sahlberg [Thu, 9 Jul 2009 02:22:46 +0000 (12:22 +1000)]
add two new controls, CTOP_NODE and CONTINUE_NODE
that are used to stop/continue a node instead of using modflags messages

14 years agomake it possible to start the daemon in STOPPED mode
Ronnie Sahlberg [Thu, 9 Jul 2009 01:57:20 +0000 (11:57 +1000)]
make it possible to start the daemon in STOPPED mode

14 years agoremove the header printed for the machinereadable output for natgwlist
Ronnie Sahlberg [Thu, 9 Jul 2009 01:43:37 +0000 (11:43 +1000)]
remove the header printed for the machinereadable output for natgwlist

14 years agoAdd a new node flag : STOPPED
Ronnie Sahlberg [Thu, 9 Jul 2009 01:38:18 +0000 (11:38 +1000)]
Add a new node flag : STOPPED
This node flag means the node is DISABLED and that all its public ip addresses
are failed over, but also that it has been removed from the VNNmap.

A STOPPED node should be in recovery mode active untill restarted using the continue command.

Adding two new commands "ctdb stop" "ctdb continue"

14 years agoMerge branch 'ronnie_merge'
Martin Schwenke [Wed, 8 Jul 2009 04:21:36 +0000 (14:21 +1000)]
Merge branch 'ronnie_merge'

14 years agoMerge commit 'origin/master' into ronnie_merge
Martin Schwenke [Wed, 8 Jul 2009 04:21:05 +0000 (14:21 +1000)]
Merge commit 'origin/master' into ronnie_merge

Conflicts:
config/ctdb.init

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoTest suite: new tests and code factoring.
Martin Schwenke [Wed, 8 Jul 2009 03:37:52 +0000 (13:37 +1000)]
Test suite: new tests and code factoring.

* 2 new tests for NFS failover.

* Factor repeated code from tests into new functions
  select_test_node_and_ips(), gratarp_sniff_start() and
  gratarp_sniff_wait_show().  Use these new functions in existing and
  new tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoTest suite: better debug info when the cluster is unexpectedly unhealthy.
Martin Schwenke [Mon, 6 Jul 2009 07:52:11 +0000 (17:52 +1000)]
Test suite: better debug info when the cluster is unexpectedly unhealthy.

cluster_is_healthy() is now run locally in tests and internally causes
_cluster_is_healthy() to be run on node 0.  When it detects that the
cluster is unhealthy and $ctdb_test_restart_scheduled is not true,
debug information is printed.  This replaces the previous use of
$CTDB_TEST_CLEANING_UP.

To avoid spurious debug on expected restarts, added scheduled
restarts to several tests.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoMake ctdbd restarts in tests more reliable.
Martin Schwenke [Mon, 6 Jul 2009 06:40:31 +0000 (16:40 +1000)]
Make ctdbd restarts in tests more reliable.

This works around potential race conditions in the init script where
the restart operation is not necessarily reliable.  It just wraps the
actual restart in a loop and tries for a successful restart up to 5
times.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoWhen testing make the time taken for some operations more obvious.
Martin Schwenke [Mon, 6 Jul 2009 06:39:08 +0000 (16:39 +1000)]
When testing make the time taken for some operations more obvious.

If wait_until() does not timeout, print the time taken for the command
to succeed.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoNew tests for different aspects of failover.
Martin Schwenke [Fri, 3 Jul 2009 10:55:02 +0000 (20:55 +1000)]
New tests for different aspects of failover.

3 separate tests:

* Check that gratuitous ARPs are received and take effect.

* Check that ping still works after failover.

* Check, via SSH, that the hostname changes after failover.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoUpdates to TCP tickle tests and supporting functions.
Martin Schwenke [Fri, 3 Jul 2009 10:44:55 +0000 (20:44 +1000)]
Updates to TCP tickle tests and supporting functions.

* Removed a race from tpcdump_start().  It seems impossible to tell
  when tcpdump is actually ready to capture packets.  So this function
  now generates some dummy ping packets and waits until it sees them
  in the output file.

* tcpdump_start() sets $tcpdump_filter.  This is the default filter
  for tcpdump_wait() and tcpdump_show(), but other filters may be
  passed to those functions.

* New functions tcptickle_sniff_start() and
  tcptickle_sniff_wait_show() handle capturing TCP tickle packets.
  These are used by complex/31_nfs_tickle.sh and
  complex/32_cifs_tickle.sh.

Signed-off-by: Martin Schwenke <martin@meltin.net>