samba.git
13 years ago50.samba eventscript should stop/start services when they become (un)managed.
Martin Schwenke [Thu, 18 Nov 2010 00:04:52 +0000 (11:04 +1100)]
50.samba eventscript should stop/start services when they become (un)managed.

When the value of $CTDB_MANAGES_SAMBA or $CTDB_MANAGES_WINBIND (or
corresponding changes are made to $CTDB_MANAGED_VERSIONS), the
associated service should be started or stopped as necessary.

This add calls to ctdb_start_stop_service() to manage
starting/stopping samba and winbind.

An associated cleanup is made to the initial checks that one of
$CTDB_MANAGES_SAMBA or $CTDB_MANAGES_WINBIND is set, replacing them
with calls to is_ctdb_managed_service().

To handle the winbind cases ctdb_start_stop_service() and
is_ctdb_managed_service() are updated to take an optional service name
parameter.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit d98f175e8420d921a123ae9c0ce00945350b1537)

13 years agoadd a new support function ctdb_check_counter_equal()
Ronnie Sahlberg [Wed, 17 Nov 2010 02:50:56 +0000 (13:50 +1100)]
add a new support function ctdb_check_counter_equal()

update nfs to try to restart the service after 10 consecutive failures
and to flag the node unhealthy after 15

add similar function to mountd

(This used to be ctdb commit 1569a54bb82fc433895ed68f816cf48399ad9d40)

13 years agoEventscripts: make loadconfig() function hookable by the test suite.
Martin Schwenke [Tue, 31 Aug 2010 07:40:40 +0000 (17:40 +1000)]
Eventscripts: make loadconfig() function hookable by the test suite.

Rename loadconfig() to _loadconfig().  Add a new loadconfig() that
simply calls _loadconfig().

This makes it easy for the test suite to override loadconfig().

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 1d77a3adfff893b3c01b87f791e72c0d3148425c)

13 years agoMake a time comparison in 60.nfs eventscript more readable.
Martin Schwenke [Tue, 16 Nov 2010 08:42:31 +0000 (19:42 +1100)]
Make a time comparison in 60.nfs eventscript more readable.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 26077e6c8eb126584af587e7416154ea4858aea2)

13 years ago60.nfs only fails or warns after 10 consecutive nfsd/statd failures.
Martin Schwenke [Tue, 16 Nov 2010 08:31:18 +0000 (19:31 +1100)]
60.nfs only fails or warns after 10 consecutive nfsd/statd failures.

These failures are sometimes the result of slow restarts so we want to
avoid dirtying the logs or marking a node unhealthy because of them,
unless they are excessive.

For these 2 cases we use the existing fail counting code but hack a
temporary service_name in a subshell to allow separate fail counts.

We also update ctdb_check_rpc() so that it captures the error output
from rpcinfo and we add a message including the service name to the
beginning.  The error is printed to stdout but is also stored in
ctdb_check_rpc_out to allow it to be conditionally used by the caller.
This function also now returns non-zero rather than exiting on
failure.

Other direct rpcinfo calls are relaced by called to ctdb_check_rpc()
for consistency.

Option handling code for service restarts is cleaned up so that fits
in 80 columns.  A more informative restart messageis now used in all
cases, printing the exact command being used to start a service.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 79c25fe241cf5d8f92e23d3736823ebaf4e1769d)

13 years agoTest suite: fix typo in ctdb ping test grep pattern.
Martin Schwenke [Tue, 12 Oct 2010 00:10:38 +0000 (11:10 +1100)]
Test suite: fix typo in ctdb ping test grep pattern.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit ad18bfa398e582474afe25340368e39d4e74e3c6)

13 years agoTest suite: match changed output for ctdb ping to disconnected node.
Martin Schwenke [Wed, 6 Oct 2010 05:32:22 +0000 (16:32 +1100)]
Test suite: match changed output for ctdb ping to disconnected node.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit a9f5ae2a548e1096c086888adc886cb604d372fa)

13 years agoTest suite: make statistics test cope with changes to statistics output.
Martin Schwenke [Fri, 15 Oct 2010 04:09:08 +0000 (15:09 +1100)]
Test suite: make statistics test cope with changes to statistics output.

Signed-off-by: Martin Schwenke <martin@meltin.net>
(This used to be ctdb commit 9e88466a99b5245d5f0ebab553be8d2b9b9a58e2)

13 years agoinitialize the statistics to the current time, not start of epoch
Ronnie Sahlberg [Mon, 15 Nov 2010 05:30:44 +0000 (16:30 +1100)]
initialize the statistics to the current time, not start of epoch
this makes "ctdb statistics" show correct "start of starts collection"

(This used to be ctdb commit 7303058616fdb1d7f58cce2349c034e9f611275e)

13 years agoDont exit the update ip function if the old and new interfaces are the same
Ronnie Sahlberg [Wed, 10 Nov 2010 03:47:28 +0000 (14:47 +1100)]
Dont exit the update ip function if the old and new interfaces are the same
since if they are the same for whatever reason this triggers the system
to go into an infinite loop and is unrobust

The scriptds have been changed instead to be able to cope with this
situation for enhanced robustness

During takeover_run and when merging all ip allocations across the cluster
try to kepe track of when and which node currently hosts an ip address
so that we avoid extra ip failovers between nodes

(This used to be ctdb commit cf778b5aaf6356401e3985acccc7df9e08ab6930)

13 years agochange the takeover script timeout to 9 seconds from 5
Ronnie Sahlberg [Wed, 10 Nov 2010 03:46:45 +0000 (14:46 +1100)]
change the takeover script timeout to 9 seconds from 5

(This used to be ctdb commit cd09c3f8fd9700261f77779aee9cf71dbd4e441e)

13 years agoDont check remote ip allocation if public ip mgmt is disabled
Ronnie Sahlberg [Wed, 10 Nov 2010 03:46:05 +0000 (14:46 +1100)]
Dont check remote ip allocation if public ip mgmt is disabled

(This used to be ctdb commit 441ad00af842a8b7b5291de60d8ab08a064f5327)

13 years agothis stuff is just so fragile that it will enter infinite recovery and fail loops
Ronnie Sahlberg [Wed, 10 Nov 2010 03:45:43 +0000 (14:45 +1100)]
this stuff is just so fragile  that it will enter infinite recovery and fail loops
on any kind of tiny unexpected error

unconditionally try to remove ip addresses from both old and new interface
before trying to add it to the new interface to make it less
fragile

(This used to be ctdb commit 80acca2c91c9053c799365bae918db7ed8bdc56f)

13 years agodelete from old interface before adding to new interface
Ronnie Sahlberg [Wed, 10 Nov 2010 03:40:43 +0000 (14:40 +1100)]
delete from old interface before adding to new interface
this stops the script from failing with an error if
both interfaces are specified as the same, which otherwise breaks and leads to an infinite recovery loop

(This used to be ctdb commit 565de03a784ed441490f8cd0b137b5cec8716d55)

13 years agodelay loading the public ip address file until after we have started the transport...
Ronnie Sahlberg [Wed, 10 Nov 2010 01:59:25 +0000 (12:59 +1100)]
delay loading the public ip address file until after we have started the transport and discovered ouw own pnn number

(This used to be ctdb commit 1b57fc866fc836b5dbd3ef7b646e5a0f4280e81e)

13 years agowhen we load the public address file, at the same time check if we are already hosti...
Ronnie Sahlberg [Wed, 10 Nov 2010 01:11:11 +0000 (12:11 +1100)]
when we load the public address file,  at the same time check if we are already hosting the public address, if so, set ourselves up as the pnn for that address

(This used to be ctdb commit 0f2a2dac91a61be188c3578c8bb89d47cbf9a0f8)

13 years agodont check the public ip assignment or if even we are hosting them and shouldnt
Ronnie Sahlberg [Wed, 10 Nov 2010 01:06:05 +0000 (12:06 +1100)]
dont check the public ip assignment or if even we are hosting them and shouldnt
when public ips have been disabled

(This used to be ctdb commit 7d07a74dc7f907ac757d20626f68e257d7ba16be)

13 years agoAdd a new tunable : DisableIPFailover that when set to non 0
Ronnie Sahlberg [Tue, 9 Nov 2010 04:19:06 +0000 (15:19 +1100)]
Add a new tunable : DisableIPFailover that when set to non 0
will stopp any ip reallocations at all from happening.

(This used to be ctdb commit d8d37493478a26c5f1809a5f3df89ffd6e149281)

13 years agochange the default for how long to waqit before dropping all ips to 120 seconds
Ronnie Sahlberg [Tue, 9 Nov 2010 01:59:05 +0000 (12:59 +1100)]
change the default for how long to waqit before dropping all ips to 120 seconds

(This used to be ctdb commit e5f03346133157734b4759d43c3ab8203028d5c2)

13 years agodont delete all ips from the system during the initial "init" event
Ronnie Sahlberg [Tue, 9 Nov 2010 01:56:02 +0000 (12:56 +1100)]
dont delete all ips from the system during the initial "init" event
leave any ips as they are and let the recovery daemon remove them as required

(This used to be ctdb commit 8ab311719857847b4cf327507b0af1793551e73c)

13 years agowhen creating/adding a public ip, set the initial interface to be the first interface...
Ronnie Sahlberg [Tue, 9 Nov 2010 01:55:20 +0000 (12:55 +1100)]
when creating/adding a public ip, set the initial interface to be the first interface specified

(This used to be ctdb commit 4308935ba48ac7a29e7523315acf580019715f0f)

13 years agoBoth nfs and nfslock scripts can fail under redhat in very rare situations.
Ronnie Sahlberg [Thu, 28 Oct 2010 02:43:57 +0000 (13:43 +1100)]
Both nfs and nfslock scripts can fail under redhat in very rare situations.
Ctdb can also be configured to ignore checking for knfsd and if it is alive.
In that situation, no attempt will be made to restart nfs, and sicne nfs is not running,  lockd can not be restarted either.

To workaround this, everytime we try to restart the lockmanager, also try to restart nfsd

(This used to be ctdb commit 953dbfbddad656a64e30a6aca115cb1479d11573)

13 years agoduring shutdown there is a window after we have stopped TCP and disconnected from...
Ronnie Sahlberg [Thu, 28 Oct 2010 02:38:34 +0000 (13:38 +1100)]
during shutdown there is a window after we have stopped TCP and disconnected from all other nodes but before we have stopped all processing.

During this window we may still hit asynchronous events that will fail because we can not send/receive packets from other nodes.

These messages are logged as ... Transport is DOWN. To help indicate that they are benign messages related to the process of shutting down.

These messages spam the syslog during normal shutdown, so this patch will drop the loglevel of these messages to DEBUG, so that they will not appear in or spam the syslog.

(This used to be ctdb commit 8275d265d2ae19b765e30ecf18f6b6319b6e6453)

13 years agoWhen shuttind down, we always unconditionally try to remove the natgw address
Ronnie Sahlberg [Thu, 28 Oct 2010 02:36:24 +0000 (13:36 +1100)]
When shuttind down, we always unconditionally try to remove the natgw address
even if we are not currently the natgw master.
This adds extra reliability in case we have stopped previously without removing it proper,
but does add spam messages to syslog everytime we shutdowm.

Remove these spam messages from pulluting the syslog upon normal shutdown

(This used to be ctdb commit cd84da6f247ee46bbab8318298d1cd3cfc87aba9)

13 years agoRedirect the output from 00.ctdb pfetch to stdout.
Ronnie Sahlberg [Thu, 28 Oct 2010 02:34:33 +0000 (13:34 +1100)]
Redirect the output from 00.ctdb pfetch to stdout.
Normally, the config.tdb database would not exist, so we do not need
to spam syslog with a "config.tdb does not exist" message every time we start ctdb

(This used to be ctdb commit 5792809b72e534161c5ca9ef5c9897abcb3b899c)

13 years agoDrop the loglevel of the "reqid wrap" developer debug message to DEBUG
Ronnie Sahlberg [Thu, 28 Oct 2010 02:32:29 +0000 (13:32 +1100)]
Drop the loglevel of the "reqid wrap" developer debug message to DEBUG
so that we dont spam the logs with this normal benign message.

(This used to be ctdb commit dc57df549854e329b453ef14cff5cd352632ef73)

13 years agoAdd support to create TDB databases using the new jenkins hash.
Ronnie Sahlberg [Mon, 25 Oct 2010 00:31:12 +0000 (11:31 +1100)]
Add support to create TDB databases using the new jenkins hash.

SRVID for the control to attach to a database is used to pass
tdb flags from samba to ctdb when samba attached to a database.
This has been used earlier for TDB_NOSYNC flag.

Add TDB_INCOMPATIBLE_HASH as a supported tdb flag to store in the
SRVID field when attaching to a database.

This allows samba to control if ctdb should create databases using the
new jenkins hash, or using the old hash.
This only affects new databases when they are initially created.
Existing databases remain using the old hash when attached to.

(This used to be ctdb commit e0eda175ac979828b376e8a6779b4608af52eb32)

13 years agonew version 1.10
Ronnie Sahlberg [Thu, 21 Oct 2010 00:12:30 +0000 (11:12 +1100)]
new version 1.10

(This used to be ctdb commit 401ad5bb3c4d2f34e34c4b61649c77391ac2f791)

13 years agoweb: fix link to tdb README
Stefan Metzmacher [Mon, 10 May 2010 07:20:13 +0000 (09:20 +0200)]
web: fix link to tdb README

metze

(This used to be ctdb commit 70e92ccc4e0afb8c166d40d09ccad1cdc145892c)

13 years agodoc: regenerate docs
Stefan Metzmacher [Tue, 14 Sep 2010 14:28:27 +0000 (16:28 +0200)]
doc: regenerate docs

metze

(This used to be ctdb commit 4cb12fa01749aabd5ad6c73defba8a0204b54978)

13 years agodoc/ctdb.1: fix "ctdb restore <filename> [<dbname>]" cmdline
Stefan Metzmacher [Tue, 14 Sep 2010 13:14:29 +0000 (15:14 +0200)]
doc/ctdb.1: fix "ctdb restore <filename> [<dbname>]" cmdline

metze

(This used to be ctdb commit ad4619f1eb1c7c8881fd6e65cdce3b9ed15ce0dd)

13 years agodoc/ctdb.1: document "persistent" flag for "ctdb atttach"
Stefan Metzmacher [Tue, 14 Sep 2010 13:05:42 +0000 (15:05 +0200)]
doc/ctdb.1: document "persistent" flag for "ctdb atttach"

metze

(This used to be ctdb commit 6f41dd35bda6de0501fa48a75148bb818ffdceed)

13 years agotools/ctdb: allow "ctdb pfetch" only on persistent databases
Stefan Metzmacher [Tue, 14 Sep 2010 14:21:27 +0000 (16:21 +0200)]
tools/ctdb: allow "ctdb pfetch" only on persistent databases

metze

(This used to be ctdb commit 63ad4a7fe7bd7c9597a4f5573e87f66e5234eb48)

13 years agotools/ctdb: add 'persistent' flag to "ctdb attach"
Stefan Metzmacher [Tue, 14 Sep 2010 12:49:42 +0000 (14:49 +0200)]
tools/ctdb: add 'persistent' flag to "ctdb attach"

metze

(This used to be ctdb commit 7a5790de22e8370b2812414aa1adef8201e8b269)

13 years agotools/ctdb: let "ctdb catdb" pass the persistent flag to ctdb_attach()
Stefan Metzmacher [Tue, 14 Sep 2010 12:45:16 +0000 (14:45 +0200)]
tools/ctdb: let "ctdb catdb" pass the persistent flag to ctdb_attach()

metze

(This used to be ctdb commit 4ec99c1eeab529865ac790ef554f3b099a14faf1)

13 years agoevents.d/11.routing: handle "updateip" event
Stefan Metzmacher [Tue, 19 Oct 2010 17:21:23 +0000 (19:21 +0200)]
events.d/11.routing: handle "updateip" event

metze

(This used to be ctdb commit 034635418c7e5274d6bdf4cccc7a10e3b631e2d4)

13 years agoIf tdb_open() fails when trying to open the vacuuming database,
Ronnie Sahlberg [Wed, 13 Oct 2010 22:49:23 +0000 (09:49 +1100)]
If tdb_open() fails when trying to open the vacuuming database,
print errno so we get some idea of why this failed.

(This used to be ctdb commit 3695462ade497356d1b86c6fd1bc1765f1d11e57)

13 years agotry to restart NFS LOCKD if it failed to start
Ronnie Sahlberg [Wed, 13 Oct 2010 21:12:41 +0000 (08:12 +1100)]
try to restart NFS LOCKD if it failed to start

(This used to be ctdb commit 2913cc93a9a172caf9e0d6675cfa4de4cc957b13)

13 years agoRemove a debug message "Timed out waiting ..."
Ronnie Sahlberg [Tue, 12 Oct 2010 22:21:09 +0000 (09:21 +1100)]
Remove a debug message "Timed out waiting ..."
from the ctdb command.

This is a debugging message and is normal tro tigger on a busy system.
It should not be logged as ERROR.

(This used to be ctdb commit 9ddf89e01f1845eec1712d75fb811240e8bb0e37)

13 years agoMake sure the statd directory exist before trying to access the
Ronnie Sahlberg [Mon, 11 Oct 2010 21:02:18 +0000 (08:02 +1100)]
Make sure the statd directory exist before trying to access the
"update trigger" file.

CQ 1020344

(This used to be ctdb commit 171f98f6f7ce7d01f47c44043ad599702711b12d)

13 years agomove extracting the config from config.tdb for public addresses
Ronnie Sahlberg [Mon, 11 Oct 2010 15:49:11 +0000 (02:49 +1100)]
move extracting the config from config.tdb for public addresses
into its own function

(This used to be ctdb commit 2d478a39ed8303b0371112d61630660d12b7db2c)

13 years agoUpdate latency countes to show min/max and average
Ronnie Sahlberg [Mon, 11 Oct 2010 04:11:18 +0000 (15:11 +1100)]
Update latency countes to show min/max and average

(This used to be ctdb commit 1919e949af4641ffe919123e44b02fb87c13ab9f)

13 years agoUpdate the default hash size to be 100001 instead of 10000
Ronnie Sahlberg [Sun, 10 Oct 2010 20:09:18 +0000 (07:09 +1100)]
Update the default hash size to be 100001 instead of 10000
This can sometimes improve performance for environments where very many
files are touched in rapid succession

(This used to be ctdb commit 15455a13863105a87d2cae9f06eed7435898c30b)

13 years agoRevert "change the hash function to use the much better Jenkins hash"
Ronnie Sahlberg [Sun, 10 Oct 2010 20:05:41 +0000 (07:05 +1100)]
Revert "change the hash function to use the much better Jenkins hash"

This reverts commit f7e91ae905cd61249028e15f2cb509ea69f10b9e.

This may require a change to the ctdb protocol, or a mechanism
to negotiate/verify that we dont run with different hash fucntions
across the cluster.

Reverting the change until we decide how to solve this in the master
version.

(This used to be ctdb commit 2a2a7a201c90462295544ca23c8a3e215f140622)

13 years agodont stop checking interfaces after the first bond device
Ronnie Sahlberg [Fri, 8 Oct 2010 23:54:12 +0000 (10:54 +1100)]
dont stop checking interfaces after the first bond device
continue the loop to process all other interfaces too

(This used to be ctdb commit 500ade4e6a58ea786a665f6be7cf30f43c882570)

13 years agoSpotted by rusty.
Ronnie Sahlberg [Fri, 8 Oct 2010 04:51:44 +0000 (15:51 +1100)]
Spotted by rusty.

Add a missing $
so we delete $_ip   and not _ip

(This used to be ctdb commit e9d04c5f419eaa0338a3beefba32c52be00242a8)

13 years agochange the hash function to use the much better Jenkins hash
Ronnie Sahlberg [Fri, 8 Oct 2010 02:14:14 +0000 (13:14 +1100)]
change the hash function to use the much better Jenkins hash
from the tdb library

cq S1020233

(This used to be ctdb commit f7e91ae905cd61249028e15f2cb509ea69f10b9e)

13 years agoMerge commit 'rusty/tdb-update'
Ronnie Sahlberg [Fri, 8 Oct 2010 01:49:08 +0000 (12:49 +1100)]
Merge commit 'rusty/tdb-update'

(This used to be ctdb commit 23510bf858c06a3710d1cc741d32bad3675fd97e)

13 years agoidtree: fix right shift of signed ints, crash on large ids on AIX
Rusty Russell [Tue, 5 Oct 2010 02:36:19 +0000 (13:06 +1030)]
idtree: fix right shift of signed ints, crash on large ids on AIX

Right-shifting signed integers in undefined; indeed it seems that on
AIX with their compiler, doing a 30-bit shift on (INT_MAX-200) gives
0, not 1 as we might expect.

The obvious fix is to make id and oid unsigned: l (level count) is also
logically unsigned.

(Note: Samba doesn't generally get to ids > 1 billion, but ctdb does)

Reported-by: Chris Cowan <cc@us.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-User: Rusty Russell <rusty@samba.org>
Autobuild-Date: Wed Oct  6 08:31:09 UTC 2010 on sn-devel-104

(This used to be ctdb commit 90b7e79446f06990f82c0128b2581e15497094fe)

13 years agoget rid of the "ctdb setflags" command since
Ronnie Sahlberg [Thu, 7 Oct 2010 05:18:27 +0000 (16:18 +1100)]
get rid of the "ctdb setflags" command since
1, we dont need it
2, it uses the ugly "modify flags" control that should die

(This used to be ctdb commit 25f96db966230e90291eee57841c9faaae33713b)

13 years agoidtree: fix right shift of signed ints, crash on large ids on AIX
Rusty Russell [Tue, 5 Oct 2010 02:36:19 +0000 (13:06 +1030)]
idtree: fix right shift of signed ints, crash on large ids on AIX

Right-shifting signed integers in undefined; indeed it seems that on
AIX with their compiler, doing a 30-bit shift on (INT_MAX-200) gives
0, not 1 as we might expect.

The obvious fix is to make id and oid unsigned: l (level count) is also
logically unsigned.

(Note: Samba doesn't generally get to ids > 1 billion, but ctdb does)

Reported-by: Chris Cowan <cc@us.ibm.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Autobuild-User: Rusty Russell <rusty@samba.org>
Autobuild-Date: Wed Oct  6 08:31:09 UTC 2010 on sn-devel-104

(This used to be ctdb commit 53d49df2d4519c35b270c30660e2504af2a5ed5c)

13 years agopytdb: Add __version__ attribute.
Jelmer Vernooij [Mon, 4 Oct 2010 11:17:25 +0000 (13:17 +0200)]
pytdb: Add __version__ attribute.

(This used to be ctdb commit 2b81314eb94d31f4efadd2a3dcf2f6e176338d3f)

13 years agopytdb: Include Python.h first to prevent warning.
Jelmer Vernooij [Sat, 2 Oct 2010 21:40:19 +0000 (23:40 +0200)]
pytdb: Include Python.h first to prevent warning.

(This used to be ctdb commit 247dacde0d0de1358cc2c27d08914be605272023)

13 years agopytdb: Check errors after PyObject_New() calls
Kirill Smelkov [Sat, 2 Oct 2010 13:43:50 +0000 (17:43 +0400)]
pytdb: Check errors after PyObject_New() calls

The call could fail with e.g. MemoryError, and we'll dereference NULL
pointer without checking.

Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
(This used to be ctdb commit 09369aa86e233a58ed131fa5b7584b6c86527d40)

13 years agopytdb: Add support for tdb_repack()
Kirill Smelkov [Sat, 2 Oct 2010 13:43:46 +0000 (17:43 +0400)]
pytdb: Add support for tdb_repack()

Cc: 597386@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
(This used to be ctdb commit ce84abcc6be31554da73920280e6bfc5b63b1464)

13 years agopytdb: Add TDB_INCOMPATIBLE_HASH open flag
Kirill Smelkov [Sat, 2 Oct 2010 13:43:40 +0000 (17:43 +0400)]
pytdb: Add TDB_INCOMPATIBLE_HASH open flag

In 2dcf76 Rusty added TDB_INCOMPATIBLE_HASH open flag which selects
Jenkins lookup3 hash for new databases.

Expose this flag to python users too.

Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
(This used to be ctdb commit 07880810941850e81442b888cd70d810d3f80fc3)

13 years agotdb: fix non-WAF build, commit 1.2.6 ABI file.
Rusty Russell [Mon, 27 Sep 2010 01:36:51 +0000 (11:06 +0930)]
tdb: fix non-WAF build, commit 1.2.6 ABI file.

Sorry Jeremy.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(This used to be ctdb commit 7db9838cb5af0d334efbbcb96bfa51d19b35941a)

13 years agotdb: TDB_INCOMPATIBLE_HASH, to allow safe changing of default hash.
Rusty Russell [Fri, 24 Sep 2010 06:15:11 +0000 (15:45 +0930)]
tdb: TDB_INCOMPATIBLE_HASH, to allow safe changing of default hash.

This flag to tdb_open/tdb_open_ex effects creation of a new database:
1) Uses the Jenkins lookup3 hash instead of the old gdbm hash if none is
   specified,
2) Places a non-zero field in header->rwlocks, so older versions of TDB will
   refuse to open it.

This means that the caller (ie Samba) can set this flag to safely
change the hash function.  Versions of TDB from this one on will either
use the correct hash or refuse to open (if a different hash is specified).
Older TDB versions will see the nonzero rwlocks field and refuse to open
it under any conditions.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(This used to be ctdb commit dd86b24ae5307fe09d4ae22b7070d747013a2b07)

13 years agotdb: automatically identify Jenkins hash tdbs
Rusty Russell [Fri, 24 Sep 2010 06:09:43 +0000 (15:39 +0930)]
tdb: automatically identify Jenkins hash tdbs

If the caller to tdb_open_ex() doesn't specify a hash, and tdb_old_hash
doesn't match, try tdb_jenkins_hash.

This was Metze's idea: it makes life simpler, especially with the upcoming
TDB_INCOMPATIBLE_HASH flag.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(This used to be ctdb commit 3f7ed2b46cb304d553d3f7bd34554d695b8ccc52)

13 years agotdb: add Bob Jenkins lookup3 hash as helper hash.
Rusty Russell [Fri, 24 Sep 2010 06:04:06 +0000 (15:34 +0930)]
tdb: add Bob Jenkins lookup3 hash as helper hash.

This is a better hash than the default: shipping it with tdb makes it easy
for callers to use it as the hash by passing it to tdb_open_ex().

This version taken from CCAN and modified, which took it from
http://www.burtleburtle.net/bob/c/lookup3.c.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(This used to be ctdb commit 58c9d90c758aa7c062d84ab97f62947190526356)

13 years agotdb: add restore
Volker Lendecke [Sat, 18 Sep 2010 06:56:10 +0000 (10:56 +0400)]
tdb: add restore

Based on an idea by Simon McVittie, largely rewritten

(This used to be ctdb commit 7cda5507f90d7598d745a1acfc66c2afa73cd4b5)

13 years agolib/tdb: fix c++ build warning in tdb_header_hash().
Günther Deschner [Mon, 20 Sep 2010 23:01:51 +0000 (16:01 -0700)]
lib/tdb: fix c++ build warning in tdb_header_hash().

Guenther

(This used to be ctdb commit e34e639c214b010ff18140b769a8c9245c92006f)

13 years agopytdb: Make filename argument optional.
Jelmer Vernooij [Sun, 19 Sep 2010 17:42:29 +0000 (10:42 -0700)]
pytdb: Make filename argument optional.

(This used to be ctdb commit 3cc73c51caff51e0cba688aefd6f37e632c0e8d4)

13 years agopytdb: Add support for tdb_freelist_size()
Kirill Smelkov [Sun, 19 Sep 2010 09:53:29 +0000 (13:53 +0400)]
pytdb: Add support for tdb_freelist_size()

Cc: 597386@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
(This used to be ctdb commit dcdd83e6d6786f0857acdf9aa04bca74a7ccf14d)

13 years agopytdb: Add support for tdb_transaction_prepare_commit()
Kirill Smelkov [Sun, 19 Sep 2010 09:53:32 +0000 (13:53 +0400)]
pytdb: Add support for tdb_transaction_prepare_commit()

Cc: 597386@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
(This used to be ctdb commit fd16bcc1434841d84fdf78f80163c97c0b52b3fe)

13 years agopytdb: Add support for tdb_enable_seqnum, tdb_get_seqnum and tdb_increment_seqnum_non...
Kirill Smelkov [Sun, 19 Sep 2010 16:34:33 +0000 (09:34 -0700)]
pytdb: Add support for tdb_enable_seqnum, tdb_get_seqnum and tdb_increment_seqnum_nonblock

Cc: 597386@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
(This used to be ctdb commit 1778fd02eec6e64737167c46173c0c76c85cc4d9)

13 years agopytdb: Update open flags to match those for tdb_open() in tdb.h
Kirill Smelkov [Sun, 19 Sep 2010 09:53:19 +0000 (13:53 +0400)]
pytdb: Update open flags to match those for tdb_open() in tdb.h

Namely TDB_NOSYNC, TDB_SEQNUM, TDB_VOLATILE, TDB_ALLOW_NESTING and
TDB_DISALLOW_NESTING were missing.

Cc: 597386@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
(This used to be ctdb commit d0c28ff1fedd27a99a7550fcc74e18cb1f536986)

13 years agopytdb: Fix repr segfault for internal db
Kirill Smelkov [Sun, 19 Sep 2010 09:53:21 +0000 (13:53 +0400)]
pytdb: Fix repr segfault for internal db

The problem was tdb->name is NULL for TDB_INTERNAL databases, and
so it was crashing ...

    #0  0xb76944f3 in strlen () from /lib/i686/cmov/libc.so.6
    #1  0x0809862b in PyString_FromFormatV (format=0xb72b6a26 "Tdb('%s')", vargs=0xbfc26a94 "")
        at ../Objects/stringobject.c:211
    #2  0x08098888 in PyString_FromFormat (format=0xb72b6a26 "Tdb('%s')") at ../Objects/stringobject.c:358
    #3  0xb72b65f2 in tdb_object_repr (self=0xb759e060) at ./pytdb.c:439

Cc: 597089@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
(This used to be ctdb commit 3ff413baf04ce28eb54a80141250ae1284b2a521)

13 years agopytdb: Add support for tdb_add_flags() & tdb_remove_flags()
Kirill Smelkov [Sun, 19 Sep 2010 09:53:20 +0000 (13:53 +0400)]
pytdb: Add support for tdb_add_flags() & tdb_remove_flags()

Note, unlike tdb_open where flags is `int', tdb_{add,remove}_flags want
flags as `unsigned', so instead of "i" I used "I" in PyArg_ParseTuple.

Cc: 597386@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
(This used to be ctdb commit 7389f8a8a634c2fe0f068831326d92e6bfa0d046)

13 years agotdb: added TDB_NO_FSYNC env variable
Andrew Tridgell [Thu, 16 Sep 2010 10:06:44 +0000 (20:06 +1000)]
tdb: added TDB_NO_FSYNC env variable

this might help reduce test times and load on test machines

(This used to be ctdb commit 5c4240c364c52073ca64fddf2aa2c1593db0093b)

13 years agotdb: increment version to 1.2.4
Rusty Russell [Thu, 7 Oct 2010 04:37:22 +0000 (15:07 +1030)]
tdb: increment version to 1.2.4

(This used to be ctdb commit f1c06608245ec34493c330d891e04c250ad64b20)

13 years agotdb: put example hashes into header, so we notice incorrect hash_fn.
Rusty Russell [Mon, 13 Sep 2010 10:35:59 +0000 (20:05 +0930)]
tdb: put example hashes into header, so we notice incorrect hash_fn.

This is Stefan Metzmacher <metze@samba.org>'s patch with minor changes:
1) Use the TDB_MAGIC constant so both hashes aren't of strings.
2) Check the hash in tdb_check (paranoia, really).
3) Additional check in the (unlikely!) case where both examples hash to 0.
4) Cosmetic changes to var names and complaint message.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(This used to be ctdb commit 63c582c99128c3623e270e8425966cab7744fb2f)

13 years agotdb: fix tdb_check() on other-endian tdbs.
Rusty Russell [Mon, 13 Sep 2010 10:29:18 +0000 (19:59 +0930)]
tdb: fix tdb_check() on other-endian tdbs.

We must not endian-convert the magic string, just the rest.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(This used to be ctdb commit 525390863ad39acea08ceb88531dc59d118fcad4)

13 years agotdb: fix tdb_check() on read-only TDBs to actually work.
Rusty Russell [Mon, 13 Sep 2010 10:28:23 +0000 (19:58 +0930)]
tdb: fix tdb_check() on read-only TDBs to actually work.

Commit bc1c82ea137 "Fix tdb_check() to work with read-only tdb databases."
claimed to do this, but tdb_lockall_read() fails on read-only databases.

Also make sure we can still do tdb_check() inside a transaction (weird,
but we previously allowed it so don't break the API).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(This used to be ctdb commit 2558eb250011893d09dbeaedaffeefa0e397142f)

13 years agotdb: make check more robust against recovery failures.
Rusty Russell [Mon, 13 Sep 2010 10:25:26 +0000 (19:55 +0930)]
tdb: make check more robust against recovery failures.

We can end up with dead areas when we die during transaction commit;
tdb_check() fails on such a (valid) database.

This is particularly noticable now we no longer truncate on recovery;
if the recovery area was at the end of the file we used to remove it
that way.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(This used to be ctdb commit b4162a95ff9ae28cda8d9c76c51c9480104517a7)

13 years agoDont log a normal vacuuming message about a missing record and using default vacuumin...
Ronnie Sahlberg [Thu, 7 Oct 2010 03:39:07 +0000 (14:39 +1100)]
Dont log a normal vacuuming message about a missing record and using default vacuuming intervals as an error.

This is normal for a new system until the vacuuming has been initialized.

(This used to be ctdb commit ffd5fdd23b1cb07078759a78cd1d884f92aa4851)

13 years agowhen printing machinereadable statistics only print the header with the fieldnames...
Ronnie Sahlberg [Thu, 30 Sep 2010 05:07:30 +0000 (15:07 +1000)]
when printing machinereadable statistics only print the header with the fieldnames once

(This used to be ctdb commit 70c8d429d7c13cbbd08184ff8f0aa506de5adccc)

13 years agoadd a machinereadable version of ctdb stats/statistics
Ronnie Sahlberg [Thu, 30 Sep 2010 04:59:59 +0000 (14:59 +1000)]
add a machinereadable version of ctdb stats/statistics

(This used to be ctdb commit 3a033156c48d821d48fd18f12c3b0ac14bbddc93)

13 years agoCreate a tunable for how often to collect rolling statistics and initialize it to...
Ronnie Sahlberg [Thu, 30 Sep 2010 04:39:54 +0000 (14:39 +1000)]
Create a tunable for how often to collect rolling statistics and initialize it to 1 second

(This used to be ctdb commit cb8c779bb5d9862abbe08919aa181a1a1b2bef18)

13 years agoAdd rolling statistics that are collected across 10 second intervals.
Ronnie Sahlberg [Wed, 29 Sep 2010 02:13:05 +0000 (12:13 +1000)]
Add rolling statistics that are collected across 10 second intervals.

Add a new command "ctdb stats [num]" that prints the [num] most recent statistics intervals collected.

(This used to be ctdb commit e6e16fcd5a45ebd3739a8160c8fb5f44494edb9e)

13 years agoAdd a new statistics structure to keep the current running statistics
Ronnie Sahlberg [Wed, 29 Sep 2010 00:58:18 +0000 (10:58 +1000)]
Add a new statistics structure to keep the current running statistics

(This used to be ctdb commit 09e5a2fb47c312f71f455cdbf8d9cabcca1041a4)

13 years agoCreate macros to update the statistics counters and use these macros
Ronnie Sahlberg [Wed, 29 Sep 2010 00:38:41 +0000 (10:38 +1000)]
Create macros to update the statistics counters and use these macros
everywhere instead of manipulating the coutenrs directly.

(This used to be ctdb commit 2e648df890e5713bc575965d87937827b068d0d7)

13 years agoAdd back monitoring for time skips, forward as well as backward.
Ronnie Sahlberg [Mon, 27 Sep 2010 22:58:03 +0000 (08:58 +1000)]
Add back monitoring for time skips, forward as well as backward.
This serviceability tool was lost during the migration from the old eventsystem to the tevent system.

(This used to be ctdb commit b4c00b4ac30ec215629f44f802ce9660abcd7a48)

13 years agoupdate/improve the log message related to rerecovery timeouts
Ronnie Sahlberg [Mon, 27 Sep 2010 22:46:12 +0000 (08:46 +1000)]
update/improve the log message related to rerecovery timeouts

(This used to be ctdb commit 8b4d1df3abcae03cf7a339d8390c816682a43019)

13 years agoset up a handler to catch and log debug messages from the tevent layer
Ronnie Sahlberg [Wed, 22 Sep 2010 00:59:01 +0000 (10:59 +1000)]
set up a handler to catch and log debug messages from the tevent layer

(This used to be ctdb commit fdb4c02f595fa207310a9a48da3fefd653fa9e4b)

13 years agoadda GETPUBLICIPS control to libctdb and use this in the test example
Ronnie Sahlberg [Wed, 15 Sep 2010 04:56:57 +0000 (14:56 +1000)]
adda GETPUBLICIPS control to libctdb and use this in the test example

enhance the test example to show the new releaseip/takeip messages

(This used to be ctdb commit 21cc57883e6c02b0e037211b26d1d866d5d7f03d)

13 years agoserver/banning: also release all ips if we're banning ourself
Stefan Metzmacher [Tue, 31 Aug 2010 07:28:34 +0000 (09:28 +0200)]
server/banning: also release all ips if we're banning ourself

metze

(This used to be ctdb commit c386f2c62f06f1c60047b7d4b1ec7a9eec11873c)

13 years agoserver/recoverd: if we can't get the recovery lock, ban ourself
Stefan Metzmacher [Mon, 30 Aug 2010 16:25:28 +0000 (18:25 +0200)]
server/recoverd: if we can't get the recovery lock, ban ourself

metze

(This used to be ctdb commit 80b8889267339b870868841ff077e850bc5b52e2)

13 years agoserver/recoverd: do takeover_run after verifying the reclock file
Stefan Metzmacher [Tue, 31 Aug 2010 06:42:32 +0000 (08:42 +0200)]
server/recoverd: do takeover_run after verifying the reclock file

metze

(This used to be ctdb commit 93df096773c89f21f77b3bcf9aa90bf28881b852)

13 years agoserver/monitor: ask for a takeoverrun after propagating our new flags
Stefan Metzmacher [Tue, 24 Aug 2010 07:22:49 +0000 (09:22 +0200)]
server/monitor: ask for a takeoverrun after propagating our new flags

metze

(This used to be ctdb commit 942f44123350d4d0c4ad7f3fcd5ff2d0d175739b)

13 years agoadd a new serverid to send a message everytime an ip address is taken on the local...
Ronnie Sahlberg [Mon, 13 Sep 2010 05:42:00 +0000 (15:42 +1000)]
add a new serverid to send a message everytime an ip address is taken on the local node

(This used to be ctdb commit 1261f3d9702800a4e59550c881350daf479f00ef)

13 years agoUpdate the comment for the range reserved for SAMBA and
Ronnie Sahlberg [Mon, 13 Sep 2010 05:08:36 +0000 (15:08 +1000)]
Update the comment for the range reserved for SAMBA and
define a new symbol to represent this range similarly to NFSD and ISCSID

Keep the old symbol name to be backward compatible with software using
these headers.

(This used to be ctdb commit 2ce34e50d057ba95249117a581658a5ad7e8eb60)

13 years agodefine and reserve a range of ctdb message ports for use by nfs and iscsi servers
Ronnie Sahlberg [Mon, 13 Sep 2010 05:06:43 +0000 (15:06 +1000)]
define and reserve a range of ctdb message ports for use by nfs and iscsi servers

(This used to be ctdb commit 84a44ac8ee74dd7af15e378c6cafbedb95feec60)

13 years agoAdd two new server types to the server_id structure.
Ronnie Sahlberg [Mon, 13 Sep 2010 05:01:47 +0000 (15:01 +1000)]
Add two new server types to the server_id structure.
NFSD and ISCSID for now.

(This used to be ctdb commit 4cd4bab68f0ba0305a585a2aabcb6871cdb11d96)

13 years agoImplement a new function GETNODEMAP in libctdb.
Ronnie Sahlberg [Mon, 13 Sep 2010 04:28:11 +0000 (14:28 +1000)]
Implement a new function GETNODEMAP in libctdb.
This function returns a pointer to a nodemap structure.

The returned structure must later be freed by calling ctdb_free_nodemap().

Move the definition of ctdb_sock_addr from ctdb_client.h to ctdb_protocol.h

Move the definition of the node flags, ctdb_node_and_flags and ctdb_node_map from ctdb_private.h to ctdb_protocol.h

Add both sync and async example for ctdb_getnodemap to the test application libctdb/tst.c

(This used to be ctdb commit 31c10eb2b337fd7d8a97a1f9e69b0e7570fec71d)

13 years agoremove an unused variable
Ronnie Sahlberg [Mon, 13 Sep 2010 03:12:41 +0000 (13:12 +1000)]
remove an unused variable

(This used to be ctdb commit e07fdbaf12bbe84370bc47a1979fe198a06a6cc8)

13 years agoDont try to read the nodemap from the daemon for "ctdb listnodes"
Ronnie Sahlberg [Wed, 8 Sep 2010 21:35:10 +0000 (07:35 +1000)]
Dont try to read the nodemap from the daemon for "ctdb listnodes"

Always read it from the /etc/ctdb/nodes file

(This used to be ctdb commit a0fdb25bb2cac177cdc32b938fa08fd665aa873e)

13 years agoChange how NATGW is configured to allow special nodes that do not have
Ronnie Sahlberg [Tue, 7 Sep 2010 23:16:42 +0000 (09:16 +1000)]
Change how NATGW is configured to allow special nodes that do not have
network connectivity outside of the cluster to still be able to
participate in a natgw group.
These nodes can not become natgw master since they lack external network
connectivity.

These nodes are configured just the same way as for any other node with
NATGW, with the following two exceptions :
* we do NOT set CTDB_NATGW_PUBLIC_IFACE at all on these nodes.
  since these ndoes lack external network we should not check the interface
  for link.
* we must set CTDB_NATGW_SLAVE_ONLY=yes to flag that this is a node that
  can not become natgw master.

(This used to be ctdb commit ab7b00a37e55beffc074be95b55d8a5c7cb9eef2)

13 years agoDont store temporary runtime data in $CTDB_BASE/state
Ronnie Sahlberg [Fri, 3 Sep 2010 02:35:25 +0000 (12:35 +1000)]
Dont store temporary runtime data in $CTDB_BASE/state
since that will usually be /etc/ctdb/state and storing this under /etc is just
wrong.

Add a new variable CTDB_VARDIR that defaults to /var/ctdb and store the data there instead.

(This used to be ctdb commit 516423c25afa9861d9988096efa8a4a2b12b31b1)

13 years agoWhen memory allocations for recovery fails,
Ronnie Sahlberg [Fri, 3 Sep 2010 01:58:27 +0000 (11:58 +1000)]
When memory allocations for recovery fails,
dont dereference a null pointer while trying to print the log message for the failure.

also shutdown ctdb with ctdb_fatal()

(This used to be ctdb commit f8642d0438c6bbb34a72c25d6a904b626e247410)