sahlberg/ctdb.git
14 years agoAdd a variable CTDB_CHECK_SWAP_IS_NOT_USED="yes"
Ronnie Sahlberg [Thu, 11 Feb 2010 00:32:22 +0000 (11:32 +1100)]
Add a variable CTDB_CHECK_SWAP_IS_NOT_USED="yes"
to control whether or not to check if we are swapping, and produce
useful output into the logfile if we are.

For production systems with dedicated nas-heads we should never swap.
But for developer/test systems we often use smaller nondedicated systems where
we can no longer guarantee that we will not be using swap.

14 years agolower the loglevel for a debug message for redundant releases of public ips
Ronnie Sahlberg [Thu, 11 Feb 2010 00:19:08 +0000 (11:19 +1100)]
lower the loglevel for a debug message for redundant releases of public ips

14 years agoAdd a new variable : CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK
Ronnie Sahlberg [Thu, 11 Feb 2010 00:09:39 +0000 (11:09 +1100)]
Add a new variable : CTDB_NFS_SKIP_KNFSD_ALIVE_CHECK
when set to "yes" this will skip checking if knfsd has hung or not.

bz59626

14 years agoevent scripts: add logging for low memory conditions
Rusty Russell [Tue, 9 Feb 2010 02:16:35 +0000 (12:46 +1030)]
event scripts: add logging for low memory conditions

We should never enter swap; if we do, show the memory state of the machine and the process list.  This will help us diagnose what caused the condition before it's too late and the box starts OOM-killing processes.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
14 years agonew version 1.0.112-6
Ronnie Sahlberg [Mon, 8 Feb 2010 21:33:24 +0000 (08:33 +1100)]
new version 1.0.112-6

14 years agoctdb: migrate to new dlinklist.h from Samba tridge/112-patches
Andrew Tridgell [Sun, 7 Feb 2010 08:02:06 +0000 (19:02 +1100)]
ctdb: migrate to new dlinklist.h from Samba

14 years agofixed printing of high latency
Andrew Tridgell [Fri, 5 Feb 2010 06:11:29 +0000 (17:11 +1100)]
fixed printing of high latency

14 years agoctdb: when we fill the client packet queue we need to drop the client
Andrew Tridgell [Thu, 4 Feb 2010 03:36:14 +0000 (14:36 +1100)]
ctdb: when we fill the client packet queue we need to drop the client

We can't just drop packets to the list, as those packets could be part
of the core protocol the client is using. This happens (for example)
when Samba is doing a traverse. If we drop a traverse packet then
Samba hangs indefinately. We are better off dropping the ctdb socket
to Samba.

14 years agoctdb: move ctdb_io.c to use TLIST_*() macros
Andrew Tridgell [Thu, 4 Feb 2010 03:14:18 +0000 (14:14 +1100)]
ctdb: move ctdb_io.c to use TLIST_*() macros

This will make large packet queues much more efficient

14 years agoutil: added TLIST_*() macros
Andrew Tridgell [Thu, 4 Feb 2010 03:13:49 +0000 (14:13 +1100)]
util: added TLIST_*() macros

The TLIST_*() macros are like the DLIST_*() macros, but take both a
head and tail pointer for the list. This means that adding an element
to the end of the list is efficient (it doesn't need to walk the
list).

We should move all uses of the DLIST_*() macros which use
DLIST_ADD_END() to use the TLIST_*() macros instead.

14 years agoWe only queued up to 1000 packets per queue before we start dropping
Ronnie Sahlberg [Wed, 3 Feb 2010 22:54:06 +0000 (09:54 +1100)]
We only queued up to 1000 packets per queue before we start dropping
packets, to avoid the queue to grow excessively if smbd has blocked.

This could cause traverse packets to become discarded in case the main
smbd daemon does a traverse of a database while there is a recovery
(sending a erconfigured message to smbd, causing an avalanche of unlock
messages to be sent across the cluster.)

This avalance of messages could cause also the tranversal message to be
discarded  causing the main smbd process to hang indefinitely waiting
for the traversal message that will never arrive.

Bump the maximum queue length before starting to discard messages from
1000 to 1000000 and at the same time rework the queueing slightly so we
can append messages cheaply to the queue instead of walking the list
from head to tail every time.

14 years agoDrop the debug level for logging fd creation to DEBUG_DEBUG
Ronnie Sahlberg [Wed, 3 Feb 2010 19:37:41 +0000 (06:37 +1100)]
Drop the debug level for logging fd creation to DEBUG_DEBUG

14 years agoVersion 1.0.112-5
Ronnie Sahlberg [Mon, 1 Feb 2010 21:03:37 +0000 (08:03 +1100)]
Version 1.0.112-5

14 years agotdb: fix an early release of the global lock that can cause data corruption
Volker Lendecke [Fri, 29 Jan 2010 17:21:09 +0000 (18:21 +0100)]
tdb: fix an early release of the global lock that can cause data corruption

There was a bug in tdb where the

                tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0, 1);

(ending the transaction-"mutex") was done before the

                        /* remove the recovery marker */

This means that when a transaction is committed there is a window where another
opener of the file sees the transaction marker while the transaction committer
is still fully functional and working on it. This led to transaction being
rolled back by that second opener of the file while transaction_commit() gave
no error to the caller.

This patch moves the F_UNLCK to after the recovery marker was removed, closing
this window.

14 years agoversion 1.0.112-4
Ronnie Sahlberg [Thu, 21 Jan 2010 07:51:54 +0000 (18:51 +1100)]
version 1.0.112-4

14 years agoonnode: update algorithm for finding nodes file.
Martin Schwenke [Thu, 21 Jan 2010 02:40:03 +0000 (13:40 +1100)]
onnode: update algorithm for finding nodes file.

2 changes:

* If a relative nodes file is specified via -f or $CTDB_NODES_FILE but
  this file does not exist then try looking for the file in /etc/ctdb
  (or $CTDB_BASE if set).

* If a nodes file is specified via -f or $CTDB_NODES_FILE but this
  file does not exist (even when checked as per above) then do not
  fall back to /etc/ctdb/nodes ((or $CTDB_BASE if set).  The old
  behaviour was surprising and hid errors.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoonnode - respect $CTDB_BASE rather than hard-coding /etc/ctdb.
Martin Schwenke [Thu, 21 Jan 2010 02:16:18 +0000 (13:16 +1100)]
onnode - respect $CTDB_BASE rather than hard-coding /etc/ctdb.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoVersion 1.0.112-3
Ronnie Sahlberg [Wed, 20 Jan 2010 04:14:47 +0000 (15:14 +1100)]
Version 1.0.112-3

14 years agosource the nfs sysconfig file from the 61.nfstickles script
Ronnie Sahlberg [Tue, 19 Jan 2010 23:35:02 +0000 (10:35 +1100)]
source the nfs sysconfig file from the 61.nfstickles script

14 years agonew version 1.0.112-2
Ronnie Sahlberg [Wed, 13 Jan 2010 00:23:23 +0000 (11:23 +1100)]
new version 1.0.112-2

14 years agoMerge commit 'metze/master-for-ronnie'
Ronnie Sahlberg [Tue, 12 Jan 2010 20:01:40 +0000 (07:01 +1100)]
Merge commit 'metze/master-for-ronnie'

14 years agoserver: call event_add_fd at the end of ctdb_set_child_logging()
Stefan Metzmacher [Thu, 7 Jan 2010 12:29:09 +0000 (13:29 +0100)]
server: call event_add_fd at the end of ctdb_set_child_logging()

metze

14 years agoctdb_logging: simplify ctdb_fork_with_logging a lot and reduce the syscall usage
Stefan Metzmacher [Thu, 7 Jan 2010 12:47:46 +0000 (13:47 +0100)]
ctdb_logging: simplify ctdb_fork_with_logging a lot and reduce the syscall usage

metze

14 years agoNew version 1.0.112.
Martin Schwenke [Tue, 12 Jan 2010 10:07:45 +0000 (21:07 +1100)]
New version 1.0.112.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoRevert "Use wbinfo --ping-dc isntead of wbingo -p sicne this is a more reliable way...
Martin Schwenke [Tue, 12 Jan 2010 10:02:44 +0000 (21:02 +1100)]
Revert "Use wbinfo --ping-dc isntead of wbingo -p sicne this is a more reliable way to determine if winbindd is in a useful state."

This reverts commit 7c95e56ba871a4e0cb893a5cb5d821e7ff6e6dd6.

wbinfo --ping-dc is proving too unreliable.

14 years agoRevert "events/50.samba: only use wbinfo --ping-dc if available"
Martin Schwenke [Tue, 12 Jan 2010 10:02:11 +0000 (21:02 +1100)]
Revert "events/50.samba: only use wbinfo --ping-dc if available"

This reverts commit 7b73834ba3ac197cc8a3020c111f9bb2c567e70b.

wbinfo --ping-dc is proving too unreliable.

14 years agoMerge commit 'origin/master'
Martin Schwenke [Thu, 7 Jan 2010 01:46:26 +0000 (12:46 +1100)]
Merge commit 'origin/master'

14 years agoNew version 1.0.111 ctdb-1.0.111
Ronnie Sahlberg [Fri, 18 Dec 2009 04:16:04 +0000 (15:16 +1100)]
New version 1.0.111

14 years agoeventscript: fix bug when script is aborted ctdb-1.0.110
Rusty Russell [Fri, 18 Dec 2009 03:43:09 +0000 (14:13 +1030)]
eventscript: fix bug when script is aborted

Another corner case when we terminate running monitor scripts to run
something else: logging can flush the output and we write to a NULL
pointer.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
14 years agoeventscript: remove cb_status, fix uninitialized bug when monitoring aborted
Rusty Russell [Fri, 18 Dec 2009 03:24:40 +0000 (13:54 +1030)]
eventscript: remove cb_status, fix uninitialized bug when monitoring aborted

(Reapplied with merge after accidental revert)

Previously we updated cb_status a each script finished.  Since we're storing
the status anyway, we can calculate it by iterating the scripts array
itself, providing clear and uniform behavior on all code paths.

In particular, this fixes a longstanding bug when we abort monitor
scripts to run some other script: the cb_status was uninitialized.  In
this case, we need to hand *something* to the callback; 0 might make
us go healthy when we shouldn't.  So we use the last status (normally,
this will be the just-saved current status).

In addition, we make the case of failing the first fork for the script
and failing other script forks the same: the error is returned via the
callback and saved for viewing through 'ctdb scriptstatus'.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
14 years agoMerge commit 'origin/master'
Martin Schwenke [Fri, 18 Dec 2009 03:44:25 +0000 (14:44 +1100)]
Merge commit 'origin/master'

14 years agoTest suite: Add an optimisation in the getvar test.
Martin Schwenke [Fri, 18 Dec 2009 03:43:45 +0000 (14:43 +1100)]
Test suite: Add an optimisation in the getvar test.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoTest suite: allow settign of timeout triggers for all events not just monitor.
Martin Schwenke [Fri, 18 Dec 2009 03:42:58 +0000 (14:42 +1100)]
Test suite: allow settign of timeout triggers for all events not just monitor.

Signed-off-by: Martin Schwenke <martin@meltin.net>
14 years agoVersion 1.0.110
Ronnie Sahlberg [Fri, 18 Dec 2009 01:32:58 +0000 (12:32 +1100)]
Version 1.0.110

14 years agoeventscript: fix cleanup path when setting up script list
Rusty Russell [Fri, 18 Dec 2009 01:24:24 +0000 (11:54 +1030)]
eventscript: fix cleanup path when setting up script list

We shouldn't set ctdb->current_monitor until we set destructor: that's
what cleans it up.

Also, free state->scripts on no-scripts exit path: it's not a child of
state because we need it in the destructor.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
14 years agoserver: add set_close_on_exec() on more fds
Stefan Metzmacher [Thu, 17 Dec 2009 12:04:27 +0000 (13:04 +0100)]
server: add set_close_on_exec() on more fds

metze

14 years agoserver: fix fd leaks in the new logging code
Stefan Metzmacher [Thu, 17 Dec 2009 12:03:42 +0000 (13:03 +0100)]
server: fix fd leaks in the new logging code

metze

14 years agoversion 1.0.109 ctdb-1.0.109
Ronnie Sahlberg [Thu, 17 Dec 2009 04:49:01 +0000 (15:49 +1100)]
version 1.0.109

14 years agoeventscript: remove cb_status, fix uninitialized bug when monitoring aborted
Rusty Russell [Thu, 17 Dec 2009 04:08:15 +0000 (14:38 +1030)]
eventscript: remove cb_status, fix uninitialized bug when monitoring aborted

Previously we updated cb_status a each script finished.  Since we're storing
the status anyway, we can calculate it by iterating the scripts array
itself, providing clear and uniform behavior on all code paths.

In particular, this fixes a longstanding bug when we abort monitor
scripts to run some other script: the cb_status was uninitialized.  In
this case, we need to hand *something* to the callback; 0 might make
us go healthy when we shouldn't.  So we use the last status (normally,
this will be the just-saved current status).

In addition, we make the case of failing the first fork for the script
and failing other script forks the same: the error is returned via the
callback and saved for viewing through 'ctdb scriptstatus'.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
14 years agofix a conflict in the merge from rusty
Ronnie Sahlberg [Wed, 16 Dec 2009 21:18:04 +0000 (08:18 +1100)]
fix a conflict in the merge from rusty

Merge commit 'rusty/ctdb-no-setsched'

Conflicts:

server/ctdb_vacuum.c

14 years agoctdb: use mlockall, cautiously rusty/ctdb-no-setsched
Rusty Russell [Wed, 16 Dec 2009 10:27:20 +0000 (20:57 +1030)]
ctdb: use mlockall, cautiously

We don't want ctdb stalling due to paging; this can be far worse than
scheduling delays.  But if we simply do mlockall(MCL_FUTURE), it
increases the risk that mmap (ie. tdb open) or malloc will fail,
causing us to abort.

This patch is a compromise: we mlock all current pages (including
10k of future stack for expansion) and then relock when a client
asks us to open a TDB.  We warn, but don't exit, if it fails.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
14 years agoRemove RT priority, use niceness.
Rusty Russell [Wed, 16 Dec 2009 08:56:22 +0000 (19:26 +1030)]
Remove RT priority, use niceness.

1) It's buggy.  Code needs to be carefully written (ie. no busy
   loops) to handle running with it, and we fork and run scripts.[1]

2) It makes debugging harder.  If ctdbd loops (as has happened recently)
   it can be extremely hard to get in and see what's happening.  We've already
   seen the valgrind hacks.

3) We have seen recent scheduler problems.  Perhaps they are unrelated,
   but removing this very unusual setup is unlikely to hurt.

4) It doesn't make anything faster.  Under all but the most perverse of
   circumstances, 99% of the cpu gives the same performance as 100%, and
   we will always preempt normal processes anyway.

[1] I made this worse in 0fafdcb8d353 "eventscript: fork() a child for
    each script" by removing the switch_from_server_to_client() which
    restored it, but even that was only for monitor scripts.  Others were
    run with RT priority.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
14 years agoAdd --valgringing flag instead of --nosetsched
Rusty Russell [Wed, 16 Dec 2009 10:29:15 +0000 (20:59 +1030)]
Add --valgringing flag instead of --nosetsched

The do_setsched was being tested for whether to mmap tdbs: let's make it
explicit.  We can also happily move the kill-child eventscript hack under
this flag.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
14 years agofix conflict in merge from metze
Ronnie Sahlberg [Wed, 16 Dec 2009 07:34:40 +0000 (18:34 +1100)]
fix conflict in merge from metze

Merge commit 'metze/master-tdb-check'

Conflicts:

server/ctdb_vacuum.c

14 years agoctdb: pass TDB_DISALLOW_NESTING to all tdb_open/tdb_wrap_open calls
Stefan Metzmacher [Fri, 20 Nov 2009 20:17:59 +0000 (21:17 +0100)]
ctdb: pass TDB_DISALLOW_NESTING to all tdb_open/tdb_wrap_open calls

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agodoc: regenerate manpages metze/master-tdb-check
Stefan Metzmacher [Mon, 7 Dec 2009 12:02:59 +0000 (13:02 +0100)]
doc: regenerate manpages

metze

14 years agodoc: fix docbook warnings for ctdb.1 and onnode.1 manpages
Stefan Metzmacher [Tue, 8 Dec 2009 11:28:38 +0000 (12:28 +0100)]
doc: fix docbook warnings for ctdb.1 and onnode.1 manpages

metze

14 years agodoc/ctdb.1: update example "ctdb listvars" output
Stefan Metzmacher [Wed, 9 Dec 2009 10:29:52 +0000 (11:29 +0100)]
doc/ctdb.1: update example "ctdb listvars" output

metze

14 years agodoc/ctdb.1: make clear the database is specified by name for "ctdb backupdb"
Stefan Metzmacher [Tue, 8 Dec 2009 11:44:13 +0000 (12:44 +0100)]
doc/ctdb.1: make clear the database is specified by name for "ctdb backupdb"

metze

14 years agodoc/ctdb.1: document "ctdb getdbstatus <dbname>"
Stefan Metzmacher [Tue, 8 Dec 2009 11:43:33 +0000 (12:43 +0100)]
doc/ctdb.1: document "ctdb getdbstatus <dbname>"

metze

14 years agodoc/ctdb.1: add "See also" for ctdb getdbmap
Stefan Metzmacher [Mon, 7 Dec 2009 09:19:20 +0000 (10:19 +0100)]
doc/ctdb.1: add "See also" for ctdb getdbmap

metze

14 years agodoc/ctdb.1: document "ctdb dumpdbbackup <file>"
Stefan Metzmacher [Tue, 8 Dec 2009 11:08:27 +0000 (12:08 +0100)]
doc/ctdb.1: document "ctdb dumpdbbackup <file>"

metze

14 years agodoc/ctdb.1: document -Y output fot ctdb getdbmap
Stefan Metzmacher [Mon, 7 Dec 2009 09:18:39 +0000 (10:18 +0100)]
doc/ctdb.1: document -Y output fot ctdb getdbmap

metze

14 years agodoc/ctdb.1: document UNHEALTHY for "ctdb getdbmap"
Stefan Metzmacher [Mon, 7 Dec 2009 09:10:05 +0000 (10:10 +0100)]
doc/ctdb.1: document UNHEALTHY for "ctdb getdbmap"

metze

14 years agodoc/ctdb.1: document "ctdb wipedb"
Stefan Metzmacher [Mon, 7 Dec 2009 09:00:52 +0000 (10:00 +0100)]
doc/ctdb.1: document "ctdb wipedb"

metze

14 years agoconfig: add CTDB_MAX_PERSISTENT_CHECK_ERRORS option
Stefan Metzmacher [Mon, 7 Dec 2009 09:53:31 +0000 (10:53 +0100)]
config: add CTDB_MAX_PERSISTENT_CHECK_ERRORS option

metze

14 years agoconfig: try to use tdbtool <tdb> check instead of tdbdump for persistent db checks
Stefan Metzmacher [Mon, 7 Dec 2009 09:46:10 +0000 (10:46 +0100)]
config: try to use tdbtool <tdb> check instead of tdbdump for persistent db checks

metze

14 years agoctdb: print out some hints how to debug a "ctdb catdb" failure
Stefan Metzmacher [Mon, 7 Dec 2009 08:57:45 +0000 (09:57 +0100)]
ctdb: print out some hints how to debug a "ctdb catdb" failure

metze

14 years agoctdb: add machinereadable output fot "ctdb -Y getdbmap"
Stefan Metzmacher [Mon, 7 Dec 2009 08:23:02 +0000 (09:23 +0100)]
ctdb: add machinereadable output fot "ctdb -Y getdbmap"

metze

14 years agoctdb: disallow "ctdb backupdb" on unhealthy databases
Stefan Metzmacher [Mon, 7 Dec 2009 08:22:02 +0000 (09:22 +0100)]
ctdb: disallow "ctdb backupdb" on unhealthy databases

metze

14 years agoclient: add "ctdb dumpdbbackup <filename>"
Stefan Metzmacher [Fri, 4 Dec 2009 14:24:23 +0000 (15:24 +0100)]
client: add "ctdb dumpdbbackup <filename>"

metze

14 years agoclient: make ctdb_dumpdb_record() public
Stefan Metzmacher [Fri, 4 Dec 2009 14:23:56 +0000 (15:23 +0100)]
client: make ctdb_dumpdb_record() public

metze

14 years agotools/ctdb: let "ctdb restoredb" and "ctdb wipedb" mark the db as healthy on all
Stefan Metzmacher [Wed, 2 Dec 2009 11:58:03 +0000 (12:58 +0100)]
tools/ctdb: let "ctdb restoredb" and "ctdb wipedb" mark the db as healthy on all
nodes

metze

14 years agotools/ctdb: add "ctdb getdbstatus <dbname>"
Stefan Metzmacher [Wed, 2 Dec 2009 11:57:29 +0000 (12:57 +0100)]
tools/ctdb: add "ctdb getdbstatus <dbname>"

metze

14 years agotools/ctdb: display db health in "ctdb getdbmap"
Stefan Metzmacher [Wed, 2 Dec 2009 11:54:29 +0000 (12:54 +0100)]
tools/ctdb: display db health in "ctdb getdbmap"

metze

14 years agoclient: add ctdb_ctrl_getdbhealth()
Stefan Metzmacher [Wed, 2 Dec 2009 11:51:37 +0000 (12:51 +0100)]
client: add ctdb_ctrl_getdbhealth()

metze

14 years agoserver: add CTDB_CONTROL_DB_SET_HEALTHY and CTDB_CONTROL_DB_GET_HEALTH
Stefan Metzmacher [Wed, 2 Dec 2009 11:48:22 +0000 (12:48 +0100)]
server: add CTDB_CONTROL_DB_SET_HEALTHY and CTDB_CONTROL_DB_GET_HEALTH

metze

14 years agoserver: Use tdb_check to verify persistent tdbs on startup
Stefan Metzmacher [Mon, 7 Dec 2009 12:28:11 +0000 (13:28 +0100)]
server: Use tdb_check to verify persistent tdbs on startup

Depending on --max-persistent-check-errors we allow ctdb
to start with unhealthy persistent databases.

The default is 0 which means to reject a startup with
unhealthy dbs.

The health of the persistent databases is checked after each
recovery. Node monitoring and the "startup" is deferred
until all persistent databases are healthy.

Databases can become healthy automaticly by a completely
HEALTHY node joining the cluster. Or by an administrator
with "ctdb backupdb/restoredb" or "ctdb wipedb".

metze

14 years agoserver: move error handling to a 'fail' label in ctdb_control_transaction_commit()
Stefan Metzmacher [Mon, 7 Dec 2009 12:19:33 +0000 (13:19 +0100)]
server: move error handling to a 'fail' label in ctdb_control_transaction_commit()

metze

14 years agoserver/recovery: update flags on nodes before syncing dbs
Stefan Metzmacher [Fri, 27 Nov 2009 15:36:05 +0000 (16:36 +0100)]
server/recovery: update flags on nodes before syncing dbs

metze

14 years agoserver: open /var/ctdb/state/persistent_health.tdb.X on startup
Stefan Metzmacher [Sun, 29 Nov 2009 11:39:37 +0000 (12:39 +0100)]
server: open /var/ctdb/state/persistent_health.tdb.X on startup

This node internal tdb will store the HEALTH state of persistent
tdbs.

metze

14 years agoserver: create vactune.tdb.X with 0600 permissions
Stefan Metzmacher [Mon, 23 Nov 2009 14:39:19 +0000 (15:39 +0100)]
server: create vactune.tdb.X with 0600 permissions

metze

14 years agoserver: create vactun.tdb.X under /var/ctdb/state
Stefan Metzmacher [Mon, 23 Nov 2009 14:38:31 +0000 (15:38 +0100)]
server: create vactun.tdb.X under /var/ctdb/state

metze

14 years agoserver: create recdb.tdb.X in /var/ctdb/state/
Stefan Metzmacher [Mon, 23 Nov 2009 14:36:45 +0000 (15:36 +0100)]
server: create recdb.tdb.X in /var/ctdb/state/

metze

14 years agoserver: only do the mkdir() calls for db_directory* once at the start
Stefan Metzmacher [Sun, 29 Nov 2009 11:39:23 +0000 (12:39 +0100)]
server: only do the mkdir() calls for db_directory* once at the start

metze

14 years agoserver: add db_directory_state to ctdb_context
Stefan Metzmacher [Mon, 23 Nov 2009 13:38:03 +0000 (14:38 +0100)]
server: add db_directory_state to ctdb_context

metze

14 years agoserver: create tdbs with 0600 permissions in ctdb_local_attach()
Stefan Metzmacher [Mon, 23 Nov 2009 13:40:17 +0000 (14:40 +0100)]
server: create tdbs with 0600 permissions in ctdb_local_attach()

metze

14 years agoconfig: load 'ctdb' config before 'nfs' config in statd-callout
Stefan Metzmacher [Mon, 9 Nov 2009 14:06:59 +0000 (15:06 +0100)]
config: load 'ctdb' config before 'nfs' config in statd-callout

All other scripts do 'loadconfig ctdb' before any other 'loadconfig foo'
call. I think we should do the same in statd-callout.

Otherwise it's very confusing, if you have configured some Options
in /etc/sysconfig/ctdb, but /etc/ctdb/statd-callout doesn't notice
them.

metze

14 years agoctdb: pass TDB_DISALLOW_NESTING to all tdb_open/tdb_wrap_open calls metze/master-tdb
Stefan Metzmacher [Fri, 20 Nov 2009 20:17:59 +0000 (21:17 +0100)]
ctdb: pass TDB_DISALLOW_NESTING to all tdb_open/tdb_wrap_open calls

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agoFix release script with newer versins of git
Simo Sorce [Mon, 7 Dec 2009 14:25:03 +0000 (09:25 -0500)]
Fix release script with newer versins of git
(cherry picked from commit 4334092cbae28181ba0d1cf2ac026961f2192972)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agotdb tools: Mostly cosmetic adaptions
Matthias Dieter Wallnöfer [Fri, 16 Oct 2009 17:02:02 +0000 (19:02 +0200)]
tdb tools: Mostly cosmetic adaptions

Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from samba commit 9776cb03450d21da5d454e683bdba29793ba3f67)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agotdb: change version to 1.2.0 after adding TDB_*ALLOW_NESTING
Stefan Metzmacher [Thu, 19 Nov 2009 08:49:03 +0000 (09:49 +0100)]
tdb: change version to 1.2.0 after adding TDB_*ALLOW_NESTING

metze
(cherry picked from samba commit 5ca0a4bfd6fdbb515835682a12f715283b46cb3e)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agotdb: add TDB_DISALLOW_NESTING and make TDB_ALLOW_NESTING the default behavior
Stefan Metzmacher [Thu, 19 Nov 2009 08:34:05 +0000 (09:34 +0100)]
tdb: add TDB_DISALLOW_NESTING and make TDB_ALLOW_NESTING the default behavior

We need to keep TDB_ALLOW_NESTING as default behavior,
so that existing code continues to work.

However we may change the default together with a major version
number change in future.

metze
(cherry picked from samba commit 3b9f19ed919fef2e88b2f92ae541e07bc7379cd1)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agotdb: always set tdb->tracefd to -1 to be safe on goto fail
Stefan Metzmacher [Thu, 19 Nov 2009 08:38:48 +0000 (09:38 +0100)]
tdb: always set tdb->tracefd to -1 to be safe on goto fail

metze
(cherry picked from samba commit 85449b7bcc4bd7948bea38b5514a02357950a002)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agotdb: Fix a C++ warning (cherry picked from samba commit be88a126ea50ea7e41583f402013c...
Volker Lendecke [Fri, 6 Nov 2009 13:04:49 +0000 (14:04 +0100)]
tdb: Fix a C++ warning (cherry picked from samba commit be88a126ea50ea7e41583f402013c63234305e48)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agotdb: update README a bit
Kirill Smelkov [Wed, 21 Oct 2009 17:18:58 +0000 (21:18 +0400)]
tdb: update README a bit

While studying tdb, I've noticed a couple of mismatches between readme
and actual code:

- tdb_open_ex changed it's log_fn argument to log_ctx
- there is now no tdb_update(), which it seems was transformed into
  non-exported tdb_update_hash()

There were other mismatches, but I don't remember them now, sorry.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit 83de5c826313aa09c76131ae70550bd81b3521c5)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agotdb: add tests for double .close() in pytdb
Kirill Smelkov [Wed, 21 Oct 2009 17:18:57 +0000 (21:18 +0400)]
tdb: add tests for double .close() in pytdb

The reason I do it is that when using older python-tdb as shipped in
Debian Lenny, python interpreter crashes on this test:

    (gdb) bt
    #0  0xb7f8c424 in __kernel_vsyscall ()
    #1  0xb7df5640 in raise () from /lib/i686/cmov/libc.so.6
    #2  0xb7df7018 in abort () from /lib/i686/cmov/libc.so.6
    #3  0xb7e3234d in __libc_message () from /lib/i686/cmov/libc.so.6
    #4  0xb7e38624 in malloc_printerr () from /lib/i686/cmov/libc.so.6
    #5  0xb7e3a826 in free () from /lib/i686/cmov/libc.so.6
    #6  0xb7b39c84 in tdb_close () from /usr/lib/libtdb.so.1
    #7  0xb7b43e14 in ?? () from /var/lib/python-support/python2.5/_tdb.so
    #8  0x0a038d08 in ?? ()
    #9  0x00000000 in ?? ()

master's pytdb does not (we have a check for self->closed in obj_close()),
but still...

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit 71a21393dd1bb61bded82b1581ac6d5bd3b0153c)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agotdb: reset tdb->fd to -1 in tdb_close()
Kirill Smelkov [Wed, 21 Oct 2009 17:18:56 +0000 (21:18 +0400)]
tdb: reset tdb->fd to -1 in tdb_close()

So that erroneous double tdb_close() calls do not try to close() same
fd again. This is like SAFE_FREE() but for fd.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit b4424f8234a78a79fb2d71d46ca208b4f12e0f9e)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agotdb: fix typo in python's Tdb.get() docstring
Kirill Smelkov [Wed, 21 Oct 2009 17:18:55 +0000 (21:18 +0400)]
tdb: fix typo in python's Tdb.get() docstring

It's Tdb.get(), not Tdb.fetch().

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit cfed5f946de0992a594c189ee3c19cf98e59d380)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agotdb: detect tdb store of identical records and skip
Andrew Tridgell [Fri, 23 Oct 2009 11:45:03 +0000 (22:45 +1100)]
tdb: detect tdb store of identical records and skip

This can help with ldb where we rewrite the index records
(cherry picked from samba commit d4c0e8fdf063f88032c32de7ece60d502b322089)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agotdb: rename 'struct list_struct' into 'struct tdb_record'
Stefan Metzmacher [Fri, 23 Oct 2009 11:51:03 +0000 (13:51 +0200)]
tdb: rename 'struct list_struct' into 'struct tdb_record'

metze
(cherry picked from samba commit 3b62e250c066f44d0ab08a7db037b6b4f74a914b)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agolib/tdb: make tdbtool use tdb_check() for "check" command
Rusty Russell [Thu, 19 Nov 2009 21:15:59 +0000 (22:15 +0100)]
lib/tdb: make tdbtool use tdb_check() for "check" command

Also, set logging function so we get more informative messages.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit 094493115971cf3d5a3138ff10ebe02335824723)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agolib/tdb: add tdb_check()
Rusty Russell [Wed, 21 Oct 2009 13:40:34 +0000 (00:10 +1030)]
lib/tdb: add tdb_check()

ctdb wants a quick way to detect corrupt tdbs; particularly, tdbs with
loops in their hash chains.  tdb_check() provides this.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit 022b4d4aa6861c1e3e6d76484d92555221cb6d14)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agotdb: kill last bits from swig
Kirill Smelkov [Wed, 21 Oct 2009 17:18:54 +0000 (21:18 +0400)]
tdb: kill last bits from swig

We no longer use swig for pytdb, so there is no need for swig make
rules. Also pytdb.c header should be updated.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(cherry picked from samba commit ecbe5ebd8d1c44a478c613eb1cace0521142d0d3)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agolib/tdb: sync build files from samba master
Stefan Metzmacher [Thu, 19 Nov 2009 14:44:10 +0000 (15:44 +0100)]
lib/tdb: sync build files from samba master

metze

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agos3 build: Remove unused fstat check to fix a bunch of HAVE_FSTAT warnings (cherry...
Stefan Metzmacher [Thu, 19 Nov 2009 15:52:46 +0000 (16:52 +0100)]
s3 build: Remove unused fstat check to fix a bunch of HAVE_FSTAT warnings (cherry picked from samba commit 2c2545d45af9c7479bf032fff1263e102926a495)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agolib/tdb: include replace.h and system/filesys.h in pytdb.c
Stefan Metzmacher [Fri, 30 Jan 2009 18:38:59 +0000 (19:38 +0100)]
lib/tdb: include replace.h and system/filesys.h in pytdb.c

This fixes the build on Tru64.

metze
(cherry picked from samba commit 3718cf294ad1f3e00178cb34b2c914c9aecf2016)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agoAvoid using a utility header for Python replacements included in Samba, since this...
Stefan Metzmacher [Thu, 19 Nov 2009 15:50:50 +0000 (16:50 +0100)]
Avoid using a utility header for Python replacements included in Samba, since this will not be shipped with talloc/tdb/tevent/etc. (cherry picked from samba commit ba5d6e6d706ebf07640ee24d701255cbb4803525)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agos3/s4 build: Fix Py_RETURN_NONE to work with python versions < 2.4 (cherry picked...
Stefan Metzmacher [Thu, 19 Nov 2009 15:49:13 +0000 (16:49 +0100)]
s3/s4 build: Fix Py_RETURN_NONE to work with python versions < 2.4 (cherry picked from samba commit 61a23c5eea2203721a70a4ad41bfdc6cd1d6a2a7)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
14 years agopy: Properly increase the reference counter of Py_None. (cherry picked from samba...
Stefan Metzmacher [Thu, 19 Nov 2009 15:31:29 +0000 (16:31 +0100)]
py: Properly increase the reference counter of Py_None. (cherry picked from samba commit d2c70d24e12293d9b4272eb310a6a4c4582b2d92)

Signed-off-by: Stefan Metzmacher <metze@samba.org>