ctdb.git
10 years agotests: Fix calling of ctdb tool from test master
Amitay Isaacs [Thu, 7 Nov 2013 05:01:49 +0000 (16:01 +1100)]
tests: Fix calling of ctdb tool from test

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoRevert "tests: If transaction_start fails, try again"
Amitay Isaacs [Thu, 7 Nov 2013 04:54:28 +0000 (15:54 +1100)]
Revert "tests: If transaction_start fails, try again"

This reverts commit ed7d999214ee009e480c26410a04fa105028cb8e.

This is not necessary since ctdb_transaction_start() now will return NULL
only when there is a failure and not when another transaction is currently
active.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoclient: Make g_lock_lock() wait till lock is obtained
Amitay Isaacs [Thu, 7 Nov 2013 04:54:20 +0000 (15:54 +1100)]
client: Make g_lock_lock() wait till lock is obtained

This makes the behaviour of g_lock_lock() similar to that implemented in
Samba.  Now ctdb_transaction_start() will return NULL only when there are
failures and not when another transaction is active.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoeventscript: Fix link creation failure if the link already exist but the target path...
Srikrishan Malik [Thu, 31 Oct 2013 06:24:58 +0000 (11:54 +0530)]
eventscript: Fix link creation failure if the link already exist but the target path is missing

Signed-off-by: Srikrishan Malik <srimalik@in.ibm.com>
10 years agodoc: Update NEWS ctdb-2.5
Martin Schwenke [Wed, 16 Oct 2013 00:46:54 +0000 (11:46 +1100)]
doc: Update NEWS

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

10 years agoweb: Add links to new manpages
Amitay Isaacs [Wed, 30 Oct 2013 02:22:21 +0000 (13:22 +1100)]
web: Add links to new manpages

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agodoc: Major updates to manual pages
Martin Schwenke [Mon, 23 Sep 2013 06:26:16 +0000 (16:26 +1000)]
doc: Major updates to manual pages

This includes new manpages for ctdb.7, ctdb.conf.5 and ctdb-tunables.7.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

10 years agotunables: Remove obsolete tunables
Amitay Isaacs [Wed, 30 Oct 2013 01:37:15 +0000 (12:37 +1100)]
tunables: Remove obsolete tunables

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agorecoverd: Rebalancing should be done regardless tunable
Martin Schwenke [Wed, 30 Oct 2013 01:17:37 +0000 (12:17 +1100)]
recoverd: Rebalancing should be done regardless tunable

Rebalance target nodes should be set even if a deferred rebalance is
not configured.  The user can explicitly cause a takeover run.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agorecoverd: Improve an error message in the election code
Martin Schwenke [Wed, 30 Oct 2013 00:32:28 +0000 (11:32 +1100)]
recoverd: Improve an error message in the election code

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoRevert "if a new node enters the cluster, that node will already be frozen at start"
Martin Schwenke [Tue, 29 Oct 2013 05:38:42 +0000 (16:38 +1100)]
Revert "if a new node enters the cluster, that node will already be frozen at start"

This is unnecessary due to 03e2e436db5cfd29a56d13f5d2101e42389bfc94.
Furthermore, if a node doesn't force an election but wins it then it
can fail to record that it is the new recovery master.  This can lead
to a reverse split brain where there is no recovery master.

This reverts commit c5035657606283d2e35bea40992505e84ca8e7be.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

Conflicts:
server/ctdb_recoverd.c

10 years agoctdbd: When a node is connected, log at DEBUG NOTICE not DEBUG_INFO
Martin Schwenke [Tue, 29 Oct 2013 03:05:41 +0000 (14:05 +1100)]
ctdbd: When a node is connected, log at DEBUG NOTICE not DEBUG_INFO

This is important enough that we should see it when the log level is
DEBUG_NOTICE.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agotests/complex: Remove CTDB_NFS_SKIP_SHARE_CHECK test
Martin Schwenke [Mon, 28 Oct 2013 05:20:44 +0000 (16:20 +1100)]
tests/complex: Remove CTDB_NFS_SKIP_SHARE_CHECK test

This is a needlessly complex way of testing the same thing as the
eventscripts unit tests 60.nfs.monitor.161.sh and
60.nfs.monitor.162.sh.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agotests/complex: Remove CTDB_SAMBA_SKIP_SHARE_CHECK test
Martin Schwenke [Mon, 28 Oct 2013 05:14:40 +0000 (16:14 +1100)]
tests/complex: Remove CTDB_SAMBA_SKIP_SHARE_CHECK test

This is adequately covered by eventscripts unit tests
50.samba.monitor.105.sh and 50.samba.monitor.106.sh.

This test is broken if CTDB_SAMBA_CHECK_PORTS is not specified in the
CTDB configuration.  Fixing it is hard and involves adding a more
complex stub for testparm.  We already have that in the eventscript
unit tests above.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoeventscripts: Rewrite the smb.conf cache file handling
Martin Schwenke [Mon, 28 Oct 2013 05:00:54 +0000 (16:00 +1100)]
eventscripts: Rewrite the smb.conf cache file handling

The background update is never guaranteed to complete before the cache
is used, so don't bother trying it at the beginning.  Instead, put a
timeout on a foreground update.

If the foreground update fails:

* If there's no available cache file then die.

* If there is a previous cache file then use it and log a warning.

* Do a background update at the end of the monitor event.

Also remove commas in the "smb ports" list before use, since (newer?)
testparm seem to insert commas into the default value.  Update the
associated test to add a comma.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

10 years agotools/ctdb: Fix documentation string for ban command
Martin Schwenke [Fri, 25 Oct 2013 05:25:25 +0000 (16:25 +1100)]
tools/ctdb: Fix documentation string for ban command

Ban time of 0 is not supported.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoRevert "recoverd: Disable takeover runs on other nodes for 5 minutes"
Martin Schwenke [Thu, 24 Oct 2013 00:13:16 +0000 (11:13 +1100)]
Revert "recoverd: Disable takeover runs on other nodes for 5 minutes"

5 minutes is too long to leave the cluster in limbo if the recovery
daemon dies during a takeover run, even though this is quite unlikely.
We need a new recover master to be able to do takeover runs fairly
quickly.

This reverts commit 71080676bb4acbd0d9b595a30cf7fe6dddbf426f.

10 years agotools/onnode: Fix healthy/ok node handling
Martin Schwenke [Thu, 24 Oct 2013 03:15:53 +0000 (14:15 +1100)]
tools/onnode: Fix healthy/ok node handling

This bit-rotted a long time ago when the "ThisNode" column was added
to "ctdb -Y status" output.  The fake "ctdb -Y status" output in the
test was never updated to reflect this change.

Instead of making sure that all columns are "0", just check that
they're not "1".  This implicitly ignores "Y" and "N" in this
"ThisNode" column without having to do anything else clever.

Also update associated tests.  The main "ctdb ok" test had a duplicate
opening line for a here document, which was tickled by this change.

This fixes samba bz#8122.

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

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agodaemon: Change the default recovery method for persistent databases
Amitay Isaacs [Mon, 28 Oct 2013 07:49:51 +0000 (18:49 +1100)]
daemon: Change the default recovery method for persistent databases

Use sequence numbers to do recovery for persistent databases instead of
RSNs.  This fixes the problem of registry corruption during recovery.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agopackaging: Create runtime directories for CTDB
Amitay Isaacs [Wed, 23 Oct 2013 04:37:41 +0000 (15:37 +1100)]
packaging: Create runtime directories for CTDB

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoinitscript: Update systemd configuration to put PID file in /run/ctdb
Martin Schwenke [Wed, 23 Oct 2013 00:28:26 +0000 (11:28 +1100)]
initscript: Update systemd configuration to put PID file in /run/ctdb

Elsewhere we're moving the socket to /var/run/ctdb.  We might end up
with PID files and sockets for other daemons later, so let's call the
directory "ctdb" instead of "ctdbd".

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agobuild: Move the default CTDB socket from /tmp to /var/run/ctdb
Amitay Isaacs [Thu, 3 Oct 2013 05:19:05 +0000 (15:19 +1000)]
build: Move the default CTDB socket from /tmp to /var/run/ctdb

Use /var/run/ctdb/ctdbd.socket because there might be other daemons
that need sockets in the future.

The local daemons test code to create a link for the default
convenience socket has to be removed because the link can't be created
as a regular user in the new location.  This should be OK since all
calls to the ctdb tool in the test code should be wrapped in onnode.
When debugging tests, a developer will have to set CTDB_SOCKET by
hand.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Pair-programmed-with: Martin Schwenke <martin@meltin.net>

10 years agopackaging: Move ctdb/ directory from /var to /var/lib
Amitay Isaacs [Thu, 3 Oct 2013 05:47:30 +0000 (15:47 +1000)]
packaging: Move ctdb/ directory from /var to /var/lib

Introduce CTDB_VARDIR variable that points to /var/lib/ctdb by default.
This makes CTDB_VARDIR consistent across C code and scripts.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdbd: Simplify database directory setting logic
Martin Schwenke [Mon, 21 Oct 2013 08:36:36 +0000 (19:36 +1100)]
ctdbd: Simplify database directory setting logic

No need to check if the options are set.  The options are always set
via static defaults.

No need to talloc_strdup() the values via wrapper functions.  The
options aren't going away.  Remove now unused ctdb_set_tdb_dir() and
similar functions.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

10 years agoctdbd: Remove duplicate database directory setting logic
Martin Schwenke [Mon, 21 Oct 2013 08:36:36 +0000 (19:36 +1100)]
ctdbd: Remove duplicate database directory setting logic

Defaults for ctdb->db_directory and similar variables are currently
set in 2 places.

Change this to set them in only 1 place and make the directories at
initialisation time instead of waiting until later.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

10 years agocommon: New function ctdb_mkdir_p_or_die()
Martin Schwenke [Mon, 21 Oct 2013 08:29:39 +0000 (19:29 +1100)]
common: New function ctdb_mkdir_p_or_die()

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agocommon: New function mkdir_p()
Martin Schwenke [Mon, 21 Oct 2013 08:08:52 +0000 (19:08 +1100)]
common: New function mkdir_p()

Behaves like mkdir -p.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

10 years agotcp: Create socket lock in /var/run/ctdb instead of /tmp
Amitay Isaacs [Thu, 3 Oct 2013 05:13:41 +0000 (15:13 +1000)]
tcp: Create socket lock in /var/run/ctdb instead of /tmp

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Pair-programmed-with: Martin Schwenke <martin@meltin.net>

10 years agodoc/examples: Add CTDB configuration examples
Amitay Isaacs [Thu, 24 Oct 2013 03:26:12 +0000 (14:26 +1100)]
doc/examples: Add CTDB configuration examples

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoAdd missing $remote_fs LSB dependency
Mathieu Parent [Thu, 29 Aug 2013 06:20:05 +0000 (08:20 +0200)]
Add missing $remote_fs LSB dependency

10 years agoImproved check_ctdb
Mathieu Parent [Thu, 29 Aug 2013 05:42:12 +0000 (07:42 +0200)]
Improved check_ctdb

- increase verbosity with "-v"
- concat error messages (if there are several)
- handle 255 return code as warning (as it is the return code when any of the node is missing)
- read /etc/ctdb/nodes remotely (ctdb_check can be run on a non-ctdb host)

10 years agoAdd missing events.d/99.timeout
Mathieu Parent [Thu, 15 Aug 2013 18:23:57 +0000 (20:23 +0200)]
Add missing events.d/99.timeout

10 years agoeventscripts: Instead of listing all tunables, query EventScriptTimeout
Amitay Isaacs [Thu, 24 Oct 2013 03:37:41 +0000 (14:37 +1100)]
eventscripts: Instead of listing all tunables, query EventScriptTimeout

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdb_client.h: fix build on AIX by removing C++-style comments
Michael Adam [Tue, 22 Oct 2013 22:46:34 +0000 (00:46 +0200)]
ctdb_client.h: fix build on AIX by removing C++-style comments

Reported by John P Janosik <jpjanosi@us.ibm.com>

Signed-off-by: Michael Adam <obnox@samba.org>
10 years agoctdbd: Pass the public address file location in ctdb context
Martin Schwenke [Mon, 21 Oct 2013 08:52:01 +0000 (19:52 +1100)]
ctdbd: Pass the public address file location in ctdb context

No need to pass it as an extra argument to ctdb_start_daemon.

Also ensure options.public_address_list gets a nice static default.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoctdbd: Debug locks by default with override from enviroment variable
Martin Schwenke [Tue, 1 Oct 2013 05:13:29 +0000 (15:13 +1000)]
ctdbd: Debug locks by default with override from enviroment variable

Default is debug_locks.sh, relative to CTDB_BASE.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoctdbd: Default for event_script_dir should use CTDB_BASE
Martin Schwenke [Tue, 15 Oct 2013 03:10:58 +0000 (14:10 +1100)]
ctdbd: Default for event_script_dir should use CTDB_BASE

Also get rid of ctdb_set_event_script_dir().  It creates an
unnecessary copy of something that will be around for the lifetime of
the process.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoctdbd: Add nodes_file member to struct ctdb_context
Martin Schwenke [Mon, 21 Oct 2013 08:33:10 +0000 (19:33 +1100)]
ctdbd: Add nodes_file member to struct ctdb_context

This allows ctdb_load_nodes_file() to move to ctdb_server.c and
ctdb_set_nlist() to become static.

Setting ctdb->nodes_file needs to be done early, before the nodes file
is loaded.  It is now set from CTDB_BASE instead ETCDIR, so setting
CTDB_BASE also needs to be done earlier.

Unhack ctdbd_test.c - it no longer needs to define
ctdb_load_nodes_file().

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

10 years agotools/ctdb: CTDB_BASE is the default location of configuration files
Martin Schwenke [Mon, 21 Oct 2013 08:43:47 +0000 (19:43 +1100)]
tools/ctdb: CTDB_BASE is the default location of configuration files

Ensure that environment variable CTDB_BASE is set.

Update defaults for nodes and natgw_nodes to use CTDB_BASE.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

10 years agoctdbd: Don't check CTDB_BASE before setting it, just don't override
Martin Schwenke [Tue, 15 Oct 2013 03:02:31 +0000 (14:02 +1100)]
ctdbd: Don't check CTDB_BASE before setting it, just don't override

That's what the 3rd argument to setenv(3) is for...  :-)

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agotests/integration: Pass --valgrinding option when running under valgrind
Martin Schwenke [Tue, 22 Oct 2013 04:36:30 +0000 (15:36 +1100)]
tests/integration: Pass --valgrinding option when running under valgrind

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoctdbd: Fix some errors in the popt configuration
Martin Schwenke [Mon, 21 Oct 2013 08:42:32 +0000 (19:42 +1100)]
ctdbd: Fix some errors in the popt configuration

That 4th argument isn't a default or similar, so consistently make it 0.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

10 years agoinitscript: New configuration variable CTDB_DBDIR_STATE
Martin Schwenke [Fri, 18 Oct 2013 05:43:26 +0000 (16:43 +1100)]
initscript: New configuration variable CTDB_DBDIR_STATE

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoscripts: Make detect_init_style() more readable
Martin Schwenke [Fri, 18 Oct 2013 02:24:03 +0000 (13:24 +1100)]
scripts: Make detect_init_style() more readable

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoeventscripts: Rework the iSCSI eventscript
Martin Schwenke [Thu, 17 Oct 2013 05:44:24 +0000 (16:44 +1100)]
eventscripts: Rework the iSCSI eventscript

* It should run on "ipreallocated" instead of "recovered"
* Variable name NODE -> ip since that's what it is
* Simplify some logic

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoeventscripts: Don't update static routes on "recovered" event
Martin Schwenke [Thu, 17 Oct 2013 05:20:18 +0000 (16:20 +1100)]
eventscripts: Don't update static routes on "recovered" event

Routes only need to be updated when IPs have moved.  IP takeover runs
will generate "ipreallocated", which is enough.  "recovered" always
follows "ipreallocated" anyway, so avoid the redundancy.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoeventscripts: NAT gateway script doesn't need to handle "recovered" event
Martin Schwenke [Thu, 17 Oct 2013 05:17:26 +0000 (16:17 +1100)]
eventscripts: NAT gateway script doesn't need to handle "recovered" event

Any time a node changes flags in any significant way there will be a
takeover run, which will generate an "ipreallocated" event.  The
"recovered" event always happens straight after a takeover run so we
update the NAT gateway twice.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoeventscripts: Delete placeholder "recovered" and "shutdown" events
Martin Schwenke [Thu, 17 Oct 2013 05:14:14 +0000 (16:14 +1100)]
eventscripts: Delete placeholder "recovered" and "shutdown" events

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoeventscripts: Clean up comment at the top of 00.ctdb
Martin Schwenke [Thu, 17 Oct 2013 05:13:21 +0000 (16:13 +1100)]
eventscripts: Clean up comment at the top of 00.ctdb

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoeventscripts: Remove reconfigure check from samba and winbind eventscripts
Martin Schwenke [Thu, 17 Oct 2013 05:00:39 +0000 (16:00 +1100)]
eventscripts: Remove reconfigure check from samba and winbind eventscripts

There is no reconfigure code for these scripts so no need to check for
reconfiguration.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoeventscripts: Remove reconfigure code from httpd eventscript
Martin Schwenke [Thu, 17 Oct 2013 04:58:25 +0000 (15:58 +1100)]
eventscripts: Remove reconfigure code from httpd eventscript

Nothing ever (or has ever) set the "needs reconfigure" flag, so this
code is unnecessary.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoeventscripts: Fold ctdb_check_tcp_ports_ctdb() into ctdb_check_tcp_ports()
Martin Schwenke [Thu, 17 Oct 2013 04:23:35 +0000 (15:23 +1100)]
eventscripts: Fold ctdb_check_tcp_ports_ctdb() into ctdb_check_tcp_ports()

A generic framework is no longer needed now that the "ctdb" checker is
the only one left.  Simplify the code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoeventscripts: Remove TCP port checks other than the built-in CTDB one
Martin Schwenke [Thu, 17 Oct 2013 00:02:54 +0000 (11:02 +1100)]
eventscripts: Remove TCP port checks other than the built-in CTDB one

"ctdb checktcpport" is no longer experimental so the other checkers
are no longer required.

Remove tests related to the removed checkers.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoscripts: Remove setting of PATH from functions file
Martin Schwenke [Wed, 16 Oct 2013 23:52:00 +0000 (10:52 +1100)]
scripts: Remove setting of PATH from functions file

The current setting is inconsistent with settings on most systems,
putting /bin before /sbin.  Use of /usr/local/bin, which may be
required on some systems, is also overridden.  This can make it
difficult to do interactive debugging of script problems.

Rely on the system PATH instead.

If system-specific changes need to be made then this can be done in a
configuration file.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agotests/eventscripts: Run scripts under sh by default
Martin Schwenke [Wed, 16 Oct 2013 23:39:09 +0000 (10:39 +1100)]
tests/eventscripts: Run scripts under sh by default

Some scripts are disabled by default so are no executable.  Explicitly
running them under sh allows them to be run without having to mess
around and make them executable or similar.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agotests/eventscripts: New tests for 20.multipathd
Martin Schwenke [Tue, 15 Oct 2013 05:44:45 +0000 (16:44 +1100)]
tests/eventscripts: New tests for 20.multipathd

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoeventscripts: Clean up 20.multipathd
Martin Schwenke [Tue, 15 Oct 2013 05:42:45 +0000 (16:42 +1100)]
eventscripts: Clean up 20.multipathd

Reduce the complexity, including the depth of background processes.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoeventscripts: NAT gateway script should export CTDB_NATGW_NODES
Martin Schwenke [Tue, 15 Oct 2013 01:00:13 +0000 (12:00 +1100)]
eventscripts: NAT gateway script should export CTDB_NATGW_NODES

Otherwise calls to "ctdb natgwlist" will not behave as expected if a
non-standard file is used, since that command will use the default
file location.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoscripts: Simplify script_log() to just look at CTDB_SYSLOG variable
Martin Schwenke [Tue, 15 Oct 2013 00:57:28 +0000 (11:57 +1100)]
scripts: Simplify script_log() to just look at CTDB_SYSLOG variable

The old logic was actually wrong.  If CTDB_LOGFILE is unset then a
default is used, not syslog.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoscripts: Remove support for CTDB_OPTIONS configuration variable
Martin Schwenke [Tue, 15 Oct 2013 00:54:58 +0000 (11:54 +1100)]
scripts: Remove support for CTDB_OPTIONS configuration variable

Allowing people to put random options in CTDB_OPTIONS complicates some
logic (particularly around use of syslog).  If we're going to have
variables for options then let's make sure we have a variable for each
option and make people use them.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoscripts: Remove unused configuration variable CTDB_MANAGES_SCP
Martin Schwenke [Tue, 15 Oct 2013 00:31:12 +0000 (11:31 +1100)]
scripts: Remove unused configuration variable CTDB_MANAGES_SCP

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoeventscripts: Deprecate NFS_SERVER_MODE, use CTDB_NFS_SERVER_MODE instead
Martin Schwenke [Tue, 15 Oct 2013 00:29:23 +0000 (11:29 +1100)]
eventscripts: Deprecate NFS_SERVER_MODE, use CTDB_NFS_SERVER_MODE instead

All CTDB configuration variables should start with CTDB_.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agorecoverd: Remove function reload_nodes_file()
Martin Schwenke [Mon, 14 Oct 2013 02:54:39 +0000 (13:54 +1100)]
recoverd: Remove function reload_nodes_file()

It is a 1 line wrapper around ctdb_load_nodes_file(), so use that
instead.  We need less code...  :-)

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoRevert "null out the pointer before we reload the nodes file"
Martin Schwenke [Mon, 14 Oct 2013 01:50:08 +0000 (12:50 +1100)]
Revert "null out the pointer before we reload the nodes file"

This reverts commit 4b0f32047e8bece0a052bdbe2209afe91b7e8ce3.

This is not necessary.  It just causes a memory leak.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoclient: Fix a format string argument compiler warning
Martin Schwenke [Fri, 11 Oct 2013 04:53:40 +0000 (15:53 +1100)]
client: Fix a format string argument compiler warning

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agorecoverd: Ignore failed flag updates on inactive nodes
Amitay Isaacs [Fri, 27 Sep 2013 08:02:39 +0000 (18:02 +1000)]
recoverd: Ignore failed flag updates on inactive nodes

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Pair-programmed-with: Martin Schwenke <martin@meltin.net>

10 years agocommon/util: Use AIX specific code for setting high priority for CTDB daemon
Amitay Isaacs [Thu, 26 Sep 2013 08:47:27 +0000 (18:47 +1000)]
common/util: Use AIX specific code for setting high priority for CTDB daemon

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agogit: Ignore generated documentation files
Martin Schwenke [Fri, 11 Oct 2013 04:09:11 +0000 (15:09 +1100)]
git: Ignore generated documentation files

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agotests: When running local tests with run_tests.sh, use fixed TEST_VAR_DIR
Martin Schwenke [Fri, 11 Oct 2013 04:05:54 +0000 (15:05 +1100)]
tests: When running local tests with run_tests.sh, use fixed TEST_VAR_DIR

Otherwise we end up with lots of useless temporary directories.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoeventscripts: Fix comment - CTDB_TCP_PORT_CHECKS -> CTDB_TCP_PORT_CHECKERS
Martin Schwenke [Thu, 26 Sep 2013 10:58:50 +0000 (20:58 +1000)]
eventscripts: Fix comment - CTDB_TCP_PORT_CHECKS -> CTDB_TCP_PORT_CHECKERS

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agotests/integration: Tweak ctdbd startup options
Martin Schwenke [Mon, 23 Sep 2013 06:24:46 +0000 (16:24 +1000)]
tests/integration: Tweak ctdbd startup options

* --public-interface is not needed

* Add --sloppy-start to speed up restarts

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agorecoverd: Fix the VNN lmaster consistency check
Martin Schwenke [Thu, 26 Sep 2013 03:11:04 +0000 (13:11 +1000)]
recoverd: Fix the VNN lmaster consistency check

It does cope with node that don't have the lmaster capability.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

10 years agotests: If transaction_start fails, try again
Amitay Isaacs [Tue, 1 Oct 2013 01:54:35 +0000 (11:54 +1000)]
tests: If transaction_start fails, try again

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agotests: Make sure test exits with zero status on successful completion
Amitay Isaacs [Tue, 1 Oct 2013 01:53:57 +0000 (11:53 +1000)]
tests: Make sure test exits with zero status on successful completion

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agotests: Re-enable transaction test code
Amitay Isaacs [Fri, 27 Sep 2013 01:26:27 +0000 (11:26 +1000)]
tests: Re-enable transaction test code

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agotools/ctdb: Remove setdbseqnum command
Amitay Isaacs [Tue, 24 Sep 2013 03:10:31 +0000 (13:10 +1000)]
tools/ctdb: Remove setdbseqnum command

This command was added to test persistent database recovery with sequence
numbers.  With the new persistent transaction code, sequence numbers get
updated automatically, so there is no need for this command.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agotests: No need to set sequence number when modifying persistent database
Amitay Isaacs [Tue, 24 Sep 2013 03:08:48 +0000 (13:08 +1000)]
tests: No need to set sequence number when modifying persistent database

With the new persistent transaction code, sequence numbers will be
automatically updated whenever a record is updated.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoclient: Remove old persistent transaction code
Amitay Isaacs [Wed, 25 Sep 2013 09:16:53 +0000 (19:16 +1000)]
client: Remove old persistent transaction code

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoclient: Reimplement persistent transaction code using TRANS3_COMMIT
Amitay Isaacs [Mon, 23 Sep 2013 08:30:04 +0000 (18:30 +1000)]
client: Reimplement persistent transaction code using TRANS3_COMMIT

Implementing persistent trasnaction code from Samba.

Persistent transaction code was reimplemented in Samba using g_lock.tdb
to hold transaction locks and using TRANS3_COMMIT control.

Implementation details:

1. When starting a transaction, create a record with "transaction-<dbid>"
   as key and store current server_id in the structure.

2. If a record already exists, some other client has already started a
   transaction.  Verify that the process corresponding to server_id stored
   in the record really exists or it's a stale record and overwrite it.

3. All modifications to the actual persistent database are stored in a
   marshal buffer.

4. When transaction is committed, read the sequence number of the
   persistent database and increment it.  Sequence number record is also
   stored in the marshal buffer.

5. Send the changed records (marshal buffer) in TRANS3_COMMIT control
   to all the active nodes.

6. If all controls succeed, verify that the sequence number has been
   incremented.  Commit is successful.  If any of the controls fail,
   abort the transaction.

7. In case sequence number has not yet been incremented, then database
   recovery has been triggered.  So repeat from step 5.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoclient: Add functions to parse g_lock.tdb records
Amitay Isaacs [Fri, 4 Oct 2013 05:38:04 +0000 (15:38 +1000)]
client: Add functions to parse g_lock.tdb records

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoclient: Add functions to handle server_id structure
Amitay Isaacs [Fri, 4 Oct 2013 05:37:24 +0000 (15:37 +1000)]
client: Add functions to handle server_id structure

server_id records are stored in g_lock.tdb for persistent transactions.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdbd: Remove transaction code related to TRANS2 commits
Amitay Isaacs [Thu, 12 Sep 2013 06:43:43 +0000 (16:43 +1000)]
ctdbd: Remove transaction code related to TRANS2 commits

This removes data types and structure elements related to TRANS2
persistent transaction code.

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdbd: Deprecate TRANS2 commit controls
Amitay Isaacs [Thu, 12 Sep 2013 06:27:39 +0000 (16:27 +1000)]
ctdbd: Deprecate TRANS2 commit controls

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoctdbd: Create a utility function to log error for "not implemented" controls
Amitay Isaacs [Thu, 12 Sep 2013 06:36:09 +0000 (16:36 +1000)]
ctdbd: Create a utility function to log error for "not implemented" controls

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoinclude: Remove unused set_dmaster structure
Amitay Isaacs [Thu, 12 Sep 2013 06:35:17 +0000 (16:35 +1000)]
include: Remove unused set_dmaster structure

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agotests/tool: Remove references in libctdb in file and function names
Martin Schwenke [Wed, 18 Sep 2013 04:27:03 +0000 (14:27 +1000)]
tests/tool: Remove references in libctdb in file and function names

Main changes are:

  libctdb_test.c -> ctdb_test_stubs.c
  ctdb_tool_libctdb.c -> ctdb_functest.c

ctdb_tool_stubby.c is gone, replaced with existing ctdb_test.c.

Functions starting with "libctdb_test_" now start with
"ctdb_test_stubs_".

Signed-off-by: Martin Schwenke <martin@meltin.net>
Pair-programmed-with: Amitay Isaacs <amitay@gmail.com>

10 years agotests/tool: Rework test programs so they no longer expect libctdb
Martin Schwenke [Wed, 18 Sep 2013 04:01:00 +0000 (14:01 +1000)]
tests/tool: Rework test programs so they no longer expect libctdb

Instead, override controls using preprocessor magic.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agotests/tool: Fix some comment typos
Martin Schwenke [Wed, 18 Sep 2013 03:43:53 +0000 (13:43 +1000)]
tests/tool: Fix some comment typos

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agotools/ctdb: Stop return value from being clobbered in control_lvsmaster()
Martin Schwenke [Wed, 18 Sep 2013 03:40:52 +0000 (13:40 +1000)]
tools/ctdb: Stop return value from being clobbered in control_lvsmaster()

ret is initialised too early and is clobbered by the call to
ctdb_ctrl_getcapabilities().  Initialising it later means that the
function returns -1 when no LVS master is found.

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agoclient: Fix some format string compiler warnings
Martin Schwenke [Wed, 18 Sep 2013 03:40:10 +0000 (13:40 +1000)]
client: Fix some format string compiler warnings

Signed-off-by: Martin Schwenke <martin@meltin.net>
10 years agocommon: Fix setting of debug level in the client code
Amitay Isaacs [Fri, 30 Aug 2013 13:38:15 +0000 (23:38 +1000)]
common: Fix setting of debug level in the client code

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agolibctdb: Remove incomplete libctdb
Amitay Isaacs [Sun, 25 Aug 2013 11:44:59 +0000 (21:44 +1000)]
libctdb: Remove incomplete libctdb

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agotools/ctdb: Pass memory context for returning nodes in parse_nodestring
Amitay Isaacs [Tue, 27 Aug 2013 04:46:08 +0000 (14:46 +1000)]
tools/ctdb: Pass memory context for returning nodes in parse_nodestring

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agotests: Do not use libctdb code in tests
Amitay Isaacs [Sun, 25 Aug 2013 11:43:29 +0000 (21:43 +1000)]
tests: Do not use libctdb code in tests

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agotools/ctdb: Do not use libctdb for commandline tool
Amitay Isaacs [Thu, 29 Aug 2013 07:22:38 +0000 (17:22 +1000)]
tools/ctdb: Do not use libctdb for commandline tool

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoclient: Add ctdb_ctrl_getdbseqnum() function
Amitay Isaacs [Fri, 23 Aug 2013 06:52:24 +0000 (16:52 +1000)]
client: Add ctdb_ctrl_getdbseqnum() function

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoclient: Add ctdb_ctrl_getdbstatistics() function
Amitay Isaacs [Fri, 23 Aug 2013 06:52:02 +0000 (16:52 +1000)]
client: Add ctdb_ctrl_getdbstatistics() function

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoclient: Add ctdb_client_check_message_handlers() function
Amitay Isaacs [Fri, 23 Aug 2013 06:51:26 +0000 (16:51 +1000)]
client: Add ctdb_client_check_message_handlers() function

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agoclient: Remove extra whitespaces
Amitay Isaacs [Fri, 23 Aug 2013 06:49:46 +0000 (16:49 +1000)]
client: Remove extra whitespaces

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
10 years agotests: Remove unused test program ctdb_fetch_lock_once
Amitay Isaacs [Fri, 23 Aug 2013 07:21:24 +0000 (17:21 +1000)]
tests: Remove unused test program ctdb_fetch_lock_once

Signed-off-by: Amitay Isaacs <amitay@gmail.com>