ccan
11 years agotdb: fix recovery reuse after crash (from SAMBA)
Rusty Russell [Mon, 22 Feb 2010 12:24:26 +0000 (22:54 +1030)]
tdb:  fix recovery reuse after crash (from SAMBA)

commit b37b452cb8c1f56b37b04abe7bffdede371ca361
Author: Rusty Russell <rusty@rustcorp.com.au>
Date:   Thu Feb 4 23:59:54 2010 +1030

    tdb: fix recovery reuse after crash

    If a process (or the machine) dies after just after writing the
    recovery head (pointing at the end of file), the recovery record will filled
    with 0x42.  This will not invoke a recovery on open, since rec.magic
    != TDB_RECOVERY_MAGIC.

    Unfortunately, the first transaction commit will happily reuse that
    area: tdb_recovery_allocate() doesn't check the magic.  The recovery
    record has length 0x42424242, and it writes that back into the
    now-valid-looking transaction header) for the next comer (which
    happens to be tdb_wipe_all in my tests).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: fix tdbtorture seed printing, plus remove CLEAR_IF_FIRST
Rusty Russell [Mon, 22 Feb 2010 12:19:57 +0000 (22:49 +1030)]
tdb: fix tdbtorture seed printing, plus remove CLEAR_IF_FIRST

With killing children, CLEAR_IF_FIRST can happen quite a bit.

11 years agotdb: cleanup: remove ltype argument from _tdb_transaction_cancel.
Rusty Russell [Mon, 22 Feb 2010 04:33:23 +0000 (15:03 +1030)]
tdb: cleanup: remove ltype argument from _tdb_transaction_cancel.

Now the transaction allrecord lock the standard one, and thus is cleaned
in tdb_release_extra_locks(), _tdb_transaction_cancel() doesn't need to
know what type it is.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: tdb_allrecord_lock/tdb_allrecord_unlock/tdb_allrecord_upgrade
Rusty Russell [Mon, 22 Feb 2010 04:02:13 +0000 (14:32 +1030)]
tdb: tdb_allrecord_lock/tdb_allrecord_unlock/tdb_allrecord_upgrade

Centralize locking of all chains of the tdb; rename _tdb_lockall to
tdb_allrecord_lock and _tdb_unlockall to tdb_allrecord_unlock, and
tdb_brlock_upgrade to tdb_allrecord_upgrade.

Then we use this in the transaction code.  Unfortunately, if the transaction
code records that it has grabbed the allrecord lock read-only, write locks
will fail, so we treat this upgradable lock as a write lock, and mark it
as upgradable using the otherwise-unused offset field.

One subtlety: now the transaction code is using the allrecord_lock, the
tdb_release_extra_locks() function drops it for us, so we no longer need
to do it manually in _tdb_transaction_cancel.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: cleanup: always grab allrecord lock to infinity.
Rusty Russell [Mon, 22 Feb 2010 03:57:13 +0000 (14:27 +1030)]
tdb: cleanup: always grab allrecord lock to infinity.

We were previously inconsistent with our "global" lock: the
transaction code grabbed it from FREELIST_TOP to end of file, and the
rest of the code grabbed it from FREELIST_TOP to end of the hash
chains.  Change it to always grab to end of file for simplicity.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: remove num_locks
Rusty Russell [Mon, 22 Feb 2010 03:54:44 +0000 (14:24 +1030)]
tdb: remove num_locks

This was redundant before this patch series: it mirrored num_lockrecs
exactly.  It still does.

Also, skip useless branch when locks == 1: unconditional assignment is
cheaper anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: use tdb_nest_lock() for seqnum lock.
Rusty Russell [Mon, 22 Feb 2010 03:48:32 +0000 (14:18 +1030)]
tdb: use tdb_nest_lock() for seqnum lock.

This is pure overhead, but it centralizes the locking.  Realloc (esp. as
most implementations are lazy) is fast compared to the fnctl anyway.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: use tdb_nest_lock() for active lock.
Rusty Russell [Mon, 22 Feb 2010 03:44:52 +0000 (14:14 +1030)]
tdb: use tdb_nest_lock() for active lock.

Rather than a boutique lock and a separate nest count, use our
newly-generic nested lock tracking for the active lock.

Note that the tdb_have_extra_locks() and tdb_release_extra_locks()
functions have to skip over this lock now it is tracked.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: use tdb_nest_lock() for open lock.
Rusty Russell [Mon, 22 Feb 2010 03:36:02 +0000 (14:06 +1030)]
tdb: use tdb_nest_lock() for open lock.

This never nests, so it's overkill, but it centralizes the locking into
lock.c and removes the ugly flag in the transaction code to track whether
we have the lock or not.

Note that we have a temporary hack so this places a real lock, despite
the fact that we are in a transaction.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: use tdb_nest_lock() for transaction lock.
Rusty Russell [Mon, 22 Feb 2010 03:04:49 +0000 (13:34 +1030)]
tdb: use tdb_nest_lock() for transaction lock.

Rather than a boutique lock and a separate nest count, use our
newly-generic nested lock tracking for the transaction lock.

Note that the tdb_have_extra_locks() and tdb_release_extra_locks()
functions have to skip over this lock now it is tracked.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: cleanup: find_nestlock() helper.
Rusty Russell [Mon, 22 Feb 2010 03:04:40 +0000 (13:34 +1030)]
tdb: cleanup: find_nestlock() helper.

Factor out two loops which find locks; we are going to introduce a couple
more so a helper makes sense.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: cleanup: tdb_release_extra_locks() helper
Rusty Russell [Mon, 22 Feb 2010 03:04:29 +0000 (13:34 +1030)]
tdb: cleanup: tdb_release_extra_locks() helper

Move locking intelligence back into lock.c.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: cleanup: tdb_have_extra_locks() helper
Rusty Russell [Mon, 22 Feb 2010 03:04:10 +0000 (13:34 +1030)]
tdb: cleanup: tdb_have_extra_locks() helper

In many places we check whether locks are held: add a helper to do this.

The _tdb_lockall() case has already checked for the allrecord lock, so
the extra work done by tdb_have_extra_locks() is merely redundant.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: don't suppress the transaction lock because of the allrecord lock.
Rusty Russell [Mon, 22 Feb 2010 03:03:53 +0000 (13:33 +1030)]
tdb: don't suppress the transaction lock because of the allrecord lock.

tdb_transaction_lock() and tdb_transaction_unlock() do nothing if we
hold the allrecord lock.  However, the two locks don't overlap, so
this is wrong.

This simplification makes the transaction lock a straight-forward nested
lock.

There are two callers for these functions:
1) The transaction code, which already makes sure the allrecord_lock
   isn't held.
2) The traverse code, which wants to stop transactions whether it has the
   allrecord lock or not.  There have been deadlocks here before, however
   this should not bring them back (I hope!)

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: cleanup: tdb_nest_lock/tdb_nest_unlock
Rusty Russell [Mon, 22 Feb 2010 03:03:27 +0000 (13:33 +1030)]
tdb: cleanup: tdb_nest_lock/tdb_nest_unlock

Because fcntl locks don't nest, we track them in the tdb->lockrecs array
and only place/release them when the count goes to 1/0.  We only do this
for record locks, so we simply place the list number (or -1 for the free
list) in the structure.

To generalize this:

1) Put the offset rather than list number in struct tdb_lock_type.
2) Rename _tdb_lock() to tdb_nest_lock, make it non-static and move the
   allrecord check out to the callers (except the mark case which doesn't
   care).
3) Rename _tdb_unlock() to tdb_nest_unlock(), make it non-static and
   move the allrecord out to the callers (except mark again).

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: cleanup: rename global_lock to allrecord_lock.
Rusty Russell [Mon, 22 Feb 2010 03:03:06 +0000 (13:33 +1030)]
tdb: cleanup: rename global_lock to allrecord_lock.

The word global is overloaded in tdb.  The global_lock inside struct
tdb_context is used to indicate we hold a lock across all the chains.

Rename it to allrecord_lock.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: cleanup: rename GLOBAL_LOCK to OPEN_LOCK.
Rusty Russell [Mon, 22 Feb 2010 02:59:36 +0000 (13:29 +1030)]
tdb: cleanup: rename GLOBAL_LOCK to OPEN_LOCK.

The word global is overloaded in tdb.  The GLOBAL_LOCK offset is used at
open time to serialize initialization (and by the transaction code to block
open).

Rename it to OPEN_LOCK.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
11 years agotdb: commit 9b987e3923f7e8714acec6a2929435b1e6016645 from SAMBA
Rusty Russell [Mon, 22 Feb 2010 02:51:24 +0000 (13:21 +1030)]
tdb: commit 9b987e3923f7e8714acec6a2929435b1e6016645 from SAMBA

Author: Volker Lendecke <vl@samba.org>
Date:   Tue Aug 12 22:31:52 2008 +0200

    Attempt to fix bug 5684

    With the ctdb checkin dde9f3f006 tdb optimized out write lock checks for
    write-enabled transaction. Sadly, this also removed the possibility to ever
    remove dead records left over from tdb_delete calls within a transaction.

    Tridge, please check this! Did dde9f3f006 have any reason beyond performance
    optimizations?

    Thanks,

    Volker
    (This used to be commit 3f884c4ae36f3260e63626bdd4989d9258ae6497)

11 years agotdb: port trivial differences across from SAMBA
Rusty Russell [Mon, 22 Feb 2010 02:50:43 +0000 (13:20 +1030)]
tdb: port trivial differences across from SAMBA
Whitespace and C++-compatibility mainly.

11 years agoFix Joey's report of rename failing across moint points.
Rusty Russell [Thu, 11 Feb 2010 01:09:08 +0000 (11:39 +1030)]
Fix Joey's report of rename failing across moint points.

11 years agotdb: use TDB_RECOVERY_INVALID_MAGIC rather than 0
Rusty Russell [Thu, 4 Feb 2010 12:38:44 +0000 (23:08 +1030)]
tdb: use TDB_RECOVERY_INVALID_MAGIC rather than 0

11 years agoAdd -k option to tdbtorture, run tdb_check at end.
Rusty Russell [Thu, 4 Feb 2010 03:59:50 +0000 (14:29 +1030)]
Add -k option to tdbtorture, run tdb_check at end.

This patch is made larger by moving the work out to a separate function: with -k, the parent can't run the ops itself but the children must do it.

11 years agoDon't use ~ in path, seems less reliable?
Rusty Russell [Thu, 4 Feb 2010 01:46:11 +0000 (12:16 +1030)]
Don't use ~ in path, seems less reliable?

11 years agotdb: new test for dying during a transaction.
Rusty Russell [Thu, 4 Feb 2010 01:45:12 +0000 (12:15 +1030)]
tdb: new test for dying during a transaction.

This demonstrates some serious failings, which get cleaned up in
following patches.

11 years agoccanlint: fix scoring, add score details to --verbose.
Rusty Russell [Tue, 2 Feb 2010 07:18:15 +0000 (17:48 +1030)]
ccanlint: fix scoring, add score details to --verbose.

11 years agoUse raw .o files rather than -lccan
Rusty Russell [Tue, 2 Feb 2010 02:30:50 +0000 (13:00 +1030)]
Use raw .o files rather than -lccan

11 years agoImport 898b5edfe757cb145960b8f3631029bfd5592119 from ctdb:
Rusty Russell [Tue, 2 Feb 2010 02:00:40 +0000 (12:30 +1030)]
Import 898b5edfe757cb145960b8f3631029bfd5592119 from ctdb:
Author: Volker Lendecke <vl@samba.org>  2010-01-30 03:51:09

    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.

11 years agoFix bug where we used old clear_if_first when doing I/O in open.
Rusty Russell [Tue, 2 Feb 2010 02:00:08 +0000 (12:30 +1030)]
Fix bug where we used old clear_if_first when doing I/O in open.
Add more logging.

11 years agoChange default behaviour: disallow nesting (safer).
Rusty Russell [Tue, 2 Feb 2010 01:38:41 +0000 (12:08 +1030)]
Change default behaviour: disallow nesting (safer).

Unlike the upstream, we don't have a stable ABI/API.

11 years agoImport c1c0ede32dc00ed619d1cf5fda40a9de43995f3a from ctdb:
Rusty Russell [Tue, 2 Feb 2010 01:37:15 +0000 (12:07 +1030)]
Import c1c0ede32dc00ed619d1cf5fda40a9de43995f3a from ctdb:
   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>
11 years agoImport 855391c1e37012b0d6c673a304bb8da8a1efcd72 from ctdb:
Rusty Russell [Tue, 2 Feb 2010 01:35:25 +0000 (12:05 +1030)]
Import 855391c1e37012b0d6c673a304bb8da8a1efcd72 from ctdb:
    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>
11 years agoImport f5c992bdaeb73ef726ff4728a9922721474cd6f5 from ctdb:
Rusty Russell [Tue, 2 Feb 2010 01:34:25 +0000 (12:04 +1030)]
Import f5c992bdaeb73ef726ff4728a9922721474cd6f5 from ctdb:

    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>
11 years agoImport 470750fa2e3cf987f10de48451b1ee13aab03907 from ctdb:
Rusty Russell [Tue, 2 Feb 2010 01:33:00 +0000 (12:03 +1030)]
Import 470750fa2e3cf987f10de48451b1ee13aab03907 from ctdb:
    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>
11 years agoImport 03b3682e3fa53c9f5fdf2c4beac8b5d030fd2630 from ctdb:
Rusty Russell [Tue, 2 Feb 2010 01:30:41 +0000 (12:00 +1030)]
Import 03b3682e3fa53c9f5fdf2c4beac8b5d030fd2630 from ctdb:

    tdb: rename 'struct list_struct' into 'struct tdb_record'

    metze
    (cherry picked from samba commit 3b62e250c066f44d0ab08a7db037b6b4f74a914b)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
11 years agoNew test: reveals race (found by Volker) when open occurs during transaction commit.
Rusty Russell [Tue, 2 Feb 2010 01:22:19 +0000 (11:52 +1030)]
New test: reveals race (found by Volker) when open occurs during transaction commit.

11 years agoccanlint: fix directory issues properly.
Rusty Russell [Mon, 1 Feb 2010 23:05:17 +0000 (09:35 +1030)]
ccanlint: fix directory issues properly.

11 years agoFix valgrind running with debugger.
Rusty Russell [Mon, 1 Feb 2010 23:02:55 +0000 (09:32 +1030)]
Fix valgrind running with debugger.

11 years agoFix config for browsing.
Rusty Russell [Sat, 23 Jan 2010 03:28:56 +0000 (13:58 +1030)]
Fix config for browsing.

11 years agoFix browser support.
Rusty Russell [Wed, 20 Jan 2010 02:07:49 +0000 (12:37 +1030)]
Fix browser support.

11 years agoMake manifest code do chdir into appropriate directory.
Rusty Russell [Tue, 19 Jan 2010 10:56:45 +0000 (21:26 +1030)]
Make manifest code do chdir into appropriate directory.

11 years agoNew test: run tests under valgrind.
Rusty Russell [Mon, 18 Jan 2010 01:26:09 +0000 (11:56 +1030)]
New test: run tests under valgrind.
(Also, remove bogus test dependency for hdr include check)

11 years agoJoey's btree module.
Rusty Russell [Sun, 17 Jan 2010 00:27:30 +0000 (10:57 +1030)]
Joey's btree module.

11 years agoMore --recursive fixes for manifest listing.
Rusty Russell [Wed, 13 Jan 2010 02:15:36 +0000 (12:45 +1030)]
More --recursive fixes for manifest listing.

11 years agoFix ccan.tar.bz2 tarball.
Rusty Russell [Wed, 13 Jan 2010 01:08:19 +0000 (11:38 +1030)]
Fix ccan.tar.bz2 tarball.

11 years agoFix tests: path change because they're now run under ccanlint (from their dir)
Rusty Russell [Wed, 6 Jan 2010 02:27:16 +0000 (12:57 +1030)]
Fix tests: path change because they're now run under ccanlint (from their dir)

11 years agoMakefile fixes: we now do dependencies properly for each ccan module.
Rusty Russell [Wed, 6 Jan 2010 02:08:06 +0000 (12:38 +1030)]
Makefile fixes: we now do dependencies properly for each ccan module.

11 years agoFix getting sub-depends.
Rusty Russell [Wed, 6 Jan 2010 02:07:55 +0000 (12:37 +1030)]
Fix getting sub-depends.

11 years agoMore header fixups: now it all compiles again.
Rusty Russell [Wed, 6 Jan 2010 02:07:20 +0000 (12:37 +1030)]
More header fixups: now it all compiles again.

11 years agoRemove old run-tests, clean up #includes to all be <ccan/...
Rusty Russell [Wed, 6 Jan 2010 00:23:58 +0000 (10:53 +1030)]
Remove old run-tests, clean up #includes to all be <ccan/...

11 years agoNew asort routine; unf. breaks under -Wmissing-prototypes etc :(
Rusty Russell [Sat, 21 Nov 2009 02:59:45 +0000 (13:29 +1030)]
New asort routine; unf. breaks under -Wmissing-prototypes etc :(

11 years agoNew talloc_set for auto-cleanup.
Rusty Russell [Sat, 21 Nov 2009 02:59:25 +0000 (13:29 +1030)]
New talloc_set for auto-cleanup.

11 years agoUpdate where browsing points.
Rusty Russell [Thu, 19 Nov 2009 23:31:29 +0000 (10:01 +1030)]
Update where browsing points.

11 years agoasearch: typesafe binary search.
Rusty Russell [Thu, 19 Nov 2009 13:26:33 +0000 (23:56 +1030)]
asearch: typesafe binary search.

11 years agoDon't print full fail results on normal check
Rusty Russell [Tue, 20 Oct 2009 04:05:25 +0000 (14:35 +1030)]
Don't print full fail results on normal check

11 years agotdb: add -t (always transactional) to tdbtorture
Rusty Russell [Mon, 19 Oct 2009 08:51:34 +0000 (19:21 +1030)]
tdb: add -t (always transactional) to tdbtorture

11 years agotdb: add logging to tdb_check for more verbose answers.
Rusty Russell [Mon, 19 Oct 2009 08:45:28 +0000 (19:15 +1030)]
tdb: add logging to tdb_check for more verbose answers.

11 years agotdb: use logging and tdb_check in tdbtool
Rusty Russell [Mon, 19 Oct 2009 08:44:50 +0000 (19:14 +1030)]
tdb: use logging and tdb_check in tdbtool

11 years agotdb: Add tdbtool to 'clean'
Rusty Russell [Mon, 19 Oct 2009 08:43:57 +0000 (19:13 +1030)]
tdb: Add tdbtool to 'clean'

11 years agoImport tdbtool from SAMBA (e440a2e11e78a562f97971c0dfe0cf3f694996ff)
Rusty Russell [Mon, 19 Oct 2009 04:40:27 +0000 (15:10 +1030)]
Import tdbtool from SAMBA (e440a2e11e78a562f97971c0dfe0cf3f694996ff)

11 years agotools/ccanlint: build tests are now compulsory
Rusty Russell [Wed, 7 Oct 2009 12:30:53 +0000 (23:00 +1030)]
tools/ccanlint: build tests are now compulsory
Offer to run debugger when test fails, with breakpoint.

11 years agoWeb updates.
Rusty Russell [Wed, 7 Oct 2009 12:28:14 +0000 (22:58 +1030)]
Web updates.

11 years agotdb: avoid checkfn on dead records, reorganize and comment code.
Rusty Russell [Wed, 7 Oct 2009 12:27:06 +0000 (22:57 +1030)]
tdb: avoid checkfn on dead records, reorganize and comment code.
Add test for non-mmap tdbs.

11 years agoccan/tdb: tdb_check() function.
Rusty Russell [Tue, 6 Oct 2009 09:14:58 +0000 (19:44 +1030)]
ccan/tdb: tdb_check() function.

11 years agosparse_bsearch: new module
Rusty Russell [Wed, 30 Sep 2009 03:18:11 +0000 (12:48 +0930)]
sparse_bsearch: new module

11 years agotypesafe_cb: more support for typesafe compare functions.
Rusty Russell [Wed, 30 Sep 2009 03:17:22 +0000 (12:47 +0930)]
typesafe_cb: more support for typesafe compare functions.

11 years agoFix documentation: actually, always evaluates to 0.
Rusty Russell [Wed, 30 Sep 2009 02:24:47 +0000 (11:54 +0930)]
Fix documentation: actually, always evaluates to 0.

11 years agotools: more build convenience work
Rusty Russell [Tue, 29 Sep 2009 03:41:15 +0000 (13:11 +0930)]
tools: more build convenience work

add EXCLUDES= with more obscure modules.
use ccanlint for "make check", finally.

11 years agotools: fix compile warning under Ubuntu
Rusty Russell [Tue, 29 Sep 2009 03:24:29 +0000 (12:54 +0930)]
tools: fix compile warning under Ubuntu

11 years agotdb: remove seqnum field from header
Rusty Russell [Tue, 29 Sep 2009 02:21:28 +0000 (11:51 +0930)]
tdb: remove seqnum field from header
Unused since " tdb: no longer need seqnum store hack as we can read after prepare."

11 years agoFix "make check": this is temporary until we use ccanlint for it.
Rusty Russell [Mon, 28 Sep 2009 04:20:25 +0000 (13:50 +0930)]
Fix "make check": this is temporary until we use ccanlint for it.

11 years agoMore test fixes.
Rusty Russell [Mon, 28 Sep 2009 03:46:35 +0000 (13:16 +0930)]
More test fixes.

11 years agotap: pass tests after ccanlint changes.
Rusty Russell [Fri, 25 Sep 2009 08:21:31 +0000 (17:51 +0930)]
tap: pass tests after ccanlint changes.

11 years agoNow we compile everything into the tmp dir.
Rusty Russell [Fri, 25 Sep 2009 08:21:06 +0000 (17:51 +0930)]
Now we compile everything into the tmp dir.

11 years agoccan_depends: Fix up after tools changes.
Rusty Russell [Fri, 25 Sep 2009 07:41:10 +0000 (17:11 +0930)]
ccan_depends: Fix up after tools changes.

11 years agoccanlint: only compile _info once; speeds tdb test from 18 to 16 seconds.
Rusty Russell [Fri, 25 Sep 2009 07:34:04 +0000 (17:04 +0930)]
ccanlint: only compile _info once; speeds tdb test from 18 to 16 seconds.

Generally clean up temp file handling.

11 years agoUse -O not -O3: reduces ccan/tdb test time from 24 to 18 seconds.
Rusty Russell [Fri, 25 Sep 2009 05:33:01 +0000 (15:03 +0930)]
Use -O not -O3: reduces ccan/tdb test time from 24 to 18 seconds.

11 years agoccanlint: don't use total_score to separate kinds of tests; we have subdirs
Rusty Russell [Fri, 25 Sep 2009 05:31:46 +0000 (15:01 +0930)]
ccanlint: don't use total_score to separate kinds of tests; we have subdirs

11 years agoccanlint: compile and run tests.
Rusty Russell [Fri, 25 Sep 2009 05:03:08 +0000 (14:33 +0930)]
ccanlint: compile and run tests.
This means we should skip building if there are no C files in module: running tests requires building the module, but not necessarily that it has any C files.

11 years agotdb: no longer need seqnum store hack as we can read after prepare.
Rusty Russell [Fri, 25 Sep 2009 04:58:48 +0000 (14:28 +0930)]
tdb: no longer need seqnum store hack as we can read after prepare.

11 years agotdb: allow reads after prepare commit
Rusty Russell [Fri, 25 Sep 2009 03:16:08 +0000 (12:46 +0930)]
tdb: allow reads after prepare commit
(Imported from SAMBA commit 46c99ec2a3781d53138245182345c6c2ddd9a258:
From: Andrew Tridgell <tridge@samba.org>
Date: Tue, 15 Sep 2009 14:04:22 -0700

We previously only allowed a commit to happen after a prepare
commit. It is in fact safe to allow reads between a prepare and a
commit, and the s4 replication code can make use of that, so allow it.

11 years agoBuild tests for ccan.
Rusty Russell [Sat, 12 Sep 2009 01:27:44 +0000 (10:57 +0930)]
Build tests for ccan.
More sophisticated skipping: skip dependencies when one fails as well.
Allow tests to change their total_score; only access it after running (other than to check it's non-zero).

11 years agoDon't run dependent tests if one fails.
Rusty Russell [Tue, 8 Sep 2009 11:51:18 +0000 (21:21 +0930)]
Don't run dependent tests if one fails.

11 years agoDependency checking (make sure .o files exist, prereq to building)
Rusty Russell [Tue, 8 Sep 2009 11:42:03 +0000 (21:12 +0930)]
Dependency checking (make sure .o files exist, prereq to building)

11 years agoFix grab_file on other than regular files.
Rusty Russell [Tue, 8 Sep 2009 10:59:37 +0000 (20:29 +0930)]
Fix grab_file on other than regular files.

11 years agoIdris' dependency work.
Rusty Russell [Tue, 8 Sep 2009 07:39:10 +0000 (17:09 +0930)]
Idris' dependency work.

11 years agotdb: fix ecode setting on nonblocking brlock
Rusty Russell [Wed, 19 Aug 2009 01:19:29 +0000 (10:49 +0930)]
tdb: fix ecode setting on nonblocking brlock

This bug was introduced in "Wean off TDB_ERRCODE.".

11 years agotdb: fix the unlock calls on the GLOBAL_LOCK from previous commit.
Rusty Russell [Wed, 19 Aug 2009 01:16:43 +0000 (10:46 +0930)]
tdb: fix the unlock calls on the GLOBAL_LOCK from previous commit.

Despite the name, they're simple byte locks, not whole-file.

11 years agotdb: benchmark target.
Rusty Russell [Tue, 18 Aug 2009 11:41:53 +0000 (21:11 +0930)]
tdb: benchmark target.

11 years agotdb: fix locking unlocking error introduced in cleanup
Rusty Russell [Tue, 18 Aug 2009 08:43:33 +0000 (18:13 +0930)]
tdb: fix locking unlocking error introduced in cleanup

11 years agotdb: locking cleanup
Rusty Russell [Tue, 18 Aug 2009 04:07:47 +0000 (13:37 +0930)]
tdb: locking cleanup

Explicitly split lock and unlock, for future replacement with user-supplied functions.
Use explicit flags enum for marking, blocking and probing.
Indicate upon unlock whether we had a read or write lock (POSIX doesn't care, but
wrappers might, and it's nice to be explicit).

11 years agoDon't rely on terrible dup2 trick, use proper infrastructure for external agent.
Rusty Russell [Tue, 18 Aug 2009 02:31:18 +0000 (12:01 +0930)]
Don't rely on terrible dup2 trick, use proper infrastructure for external agent.

11 years agoUse _ convention everywhere: lock.c uses it already.
Rusty Russell [Tue, 11 Aug 2009 11:59:38 +0000 (21:29 +0930)]
Use _ convention everywhere: lock.c uses it already.

11 years agoIncrease max size: I actually hit this with a large file.
Rusty Russell [Tue, 11 Aug 2009 11:58:51 +0000 (21:28 +0930)]
Increase max size: I actually hit this with a large file.

11 years agoFix multiply by three error, stat to get initial size.
Rusty Russell [Tue, 11 Aug 2009 11:57:57 +0000 (21:27 +0930)]
Fix multiply by three error, stat to get initial size.

11 years agoHandle pre-existing records, wipe_all and repack (ldb users.ldb trace)
Rusty Russell [Tue, 11 Aug 2009 10:56:04 +0000 (20:26 +0930)]
Handle pre-existing records, wipe_all and repack (ldb users.ldb trace)

11 years agoPort nested transaction allow from newer ctdb.
Rusty Russell [Tue, 11 Aug 2009 01:42:38 +0000 (11:12 +0930)]
Port nested transaction allow from newer ctdb.
ie.  f1c6f7dd47bb1081781c0a0d567a92bbbc0aa5d5 (Revert "add TDB_NO_NESTING...")
and  3e49e41c21eb8c53084aa8cc7fd3557bdd8eb7b6 (New attempt at TDB transaction nesting allow/disallow).

11 years agoDon't overwrite tdbs with different version numbers.
Rusty Russell [Wed, 5 Aug 2009 01:36:58 +0000 (11:06 +0930)]
Don't overwrite tdbs with different version numbers.
In future, this may happen, and we don't want to clobber them.

11 years agoMake TDB 32 bit clean (not just 31 bit) for systems with 64 bit file offsets.
Rusty Russell [Tue, 4 Aug 2009 06:14:16 +0000 (15:44 +0930)]
Make TDB 32 bit clean (not just 31 bit) for systems with 64 bit file offsets.

11 years agoNew test for endianness.
Rusty Russell [Tue, 4 Aug 2009 04:05:47 +0000 (13:35 +0930)]
New test for endianness.

11 years agoWean off TDB_ERRCODE.
Rusty Russell [Tue, 4 Aug 2009 03:52:28 +0000 (13:22 +0930)]
Wean off TDB_ERRCODE.
It was a regrettable hack to reduce line count in tdb; in fact it caused confusion as can be seen in this patch.
In particular, ecode now needs to be set before TDB_LOG.
Also, we should never set errno, as io.c was doing.