ccan
10 years agoalloc: first cut of tiny allocator (down to 2 bytes!)
Rusty Russell [Mon, 12 Jul 2010 13:52:30 +0000 (23:22 +0930)]
alloc: first cut of tiny allocator (down to 2 bytes!)

10 years agotypesafe_cb: fix fallout from API changes.
Rusty Russell [Tue, 15 Jun 2010 10:10:44 +0000 (19:40 +0930)]
typesafe_cb: fix fallout from API changes.

10 years agotypesafe_cb: expose _exact and _def variants.
Rusty Russell [Tue, 15 Jun 2010 10:02:55 +0000 (19:32 +0930)]
typesafe_cb: expose _exact and _def variants.

We can't allow NULL with the new variant (needed by talloc's set_destructor
for example), so document that and expose all three variants for different
uses.

10 years agotypesafe_cb: fix promotable types being incorrectly accepted by cast_if_type.
Rusty Russell [Fri, 11 Jun 2010 03:36:40 +0000 (13:06 +0930)]
typesafe_cb: fix promotable types being incorrectly accepted by cast_if_type.

cast_if_type() should not try to degrade the expression using 1?(test):0,
as that promotes bool to int, as well as degrading functions to function
pointers: it should be done by the callers.

In particular, this fixes sparse_bsearch.

10 years agoalloc: reduce page header further, go down to 64k minimum.
Rusty Russell [Wed, 9 Jun 2010 14:33:04 +0000 (00:03 +0930)]
alloc: reduce page header further, go down to 64k minimum.

This means we can't have more than 2^25 elements per page; that's
a maximum small page size of about 2^24 (with >8 objects per small page
we move to large pages), meaning a poolsize max of 4G.

We have a tighter limit at the moment anyway, but we should remove it
once we fix this.  In particular count all-zero and all-one words in
the used field (that's what we care about: full or empty) would give us
another factor of 64 (we only care about larger pool sizes on 64-bit
platforms).

We can also restore the larger number of pages and greater inter-page
spacing once we implement the alternative tiny allocator.

10 years agoalloc: make small_page_bits() function rather than large_page_bits()
Rusty Russell [Wed, 9 Jun 2010 14:22:54 +0000 (23:52 +0930)]
alloc: make small_page_bits() function rather than large_page_bits()

Turns out that now we use page numbers, this is more fundamental.

10 years agoalloc: use page numbers in lists to reduce overhead.
Rusty Russell [Wed, 9 Jun 2010 14:16:03 +0000 (23:46 +0930)]
alloc: use page numbers in lists to reduce overhead.

10 years agoalloc: implement alloc_visualize().
Rusty Russell [Wed, 9 Jun 2010 13:05:21 +0000 (22:35 +0930)]
alloc: implement alloc_visualize().

10 years agoalloc: fix page header size calculation bug, increase type safety.
Rusty Russell [Wed, 9 Jun 2010 13:04:44 +0000 (22:34 +0930)]
alloc: fix page header size calculation bug, increase type safety.

10 years agoidtree: add examples, particularly the low-id-reuse example.
Rusty Russell [Wed, 9 Jun 2010 06:44:48 +0000 (16:14 +0930)]
idtree: add examples, particularly the low-id-reuse example.

10 years agoalloc: first cut of new Tridge-inspired allocator
Rusty Russell [Tue, 8 Jun 2010 03:57:06 +0000 (13:27 +0930)]
alloc: first cut of new Tridge-inspired allocator

This version has limitations: pools must be at least 1MB, and allocations
are restricted to 1/1024 of the total pool size.

10 years agoccanlint: don't setpgid on running commands: we want ^C to work!
Rusty Russell [Mon, 7 Jun 2010 07:57:15 +0000 (17:27 +0930)]
ccanlint: don't setpgid on running commands: we want ^C to work!

10 years agoccanlint: Add -k option to keep results.
Rusty Russell [Mon, 7 Jun 2010 07:15:49 +0000 (16:45 +0930)]
ccanlint: Add -k option to keep results.

Particularly useful for building tests standalone.

10 years agoccanlint: make sure fullname is always full path name.
Rusty Russell [Mon, 7 Jun 2010 07:04:15 +0000 (16:34 +0930)]
ccanlint: make sure fullname is always full path name.

10 years agohashtable: fix traverse typesafety.
Rusty Russell [Mon, 7 Jun 2010 04:30:22 +0000 (14:00 +0930)]
hashtable: fix traverse typesafety.

10 years agotypesafe_cb: fix up (and test!) cast_if_any.
Rusty Russell [Mon, 7 Jun 2010 04:29:18 +0000 (13:59 +0930)]
typesafe_cb: fix up (and test!) cast_if_any.

10 years agotypesafe_cb: handle pointers to undefined struct types.
Rusty Russell [Mon, 24 May 2010 03:02:59 +0000 (12:32 +0930)]
typesafe_cb: handle pointers to undefined struct types.

To do this, we have to lose the ability for preargs and postargs to allow const and volatile argument signatures.

10 years agotypesafe_cb: show flaw in typesafe_cb with undefined structs.
Rusty Russell [Mon, 24 May 2010 01:17:13 +0000 (10:47 +0930)]
typesafe_cb: show flaw in typesafe_cb with undefined structs.

10 years agotypesafe_cb: fix !gcc case
Rusty Russell [Sun, 23 May 2010 11:02:53 +0000 (20:32 +0930)]
typesafe_cb: fix !gcc case

10 years agotypesafe_cb, hashtable: revise typesafe_cb arg order, neaten.
Rusty Russell [Sun, 23 May 2010 09:22:18 +0000 (18:52 +0930)]
typesafe_cb, hashtable: revise typesafe_cb arg order, neaten.
hashtable: make traverse callback typesafe.

10 years agoidtree: new module
Rusty Russell [Thu, 20 May 2010 12:30:32 +0000 (22:00 +0930)]
idtree: new module

10 years agolikely: new module
Rusty Russell [Tue, 11 May 2010 02:34:35 +0000 (12:04 +0930)]
likely: new module

10 years agoccanlint: put generated _info in correct directory.
Rusty Russell [Tue, 11 May 2010 02:01:08 +0000 (11:31 +0930)]
ccanlint: put generated _info in correct directory.

10 years agostr: add stringify()
Rusty Russell [Tue, 11 May 2010 00:53:40 +0000 (10:23 +0930)]
str: add stringify()

10 years agoMore web fixes.
Rusty Russell [Tue, 4 May 2010 07:37:32 +0000 (17:07 +0930)]
More web fixes.

10 years agotdb: fix backwards check on HAVE_PAGESIZE
Rusty Russell [Tue, 4 May 2010 07:36:40 +0000 (17:06 +0930)]
tdb: fix backwards check on HAVE_PAGESIZE

10 years agoHashtable routines.
Rusty Russell [Tue, 4 May 2010 02:21:10 +0000 (11:51 +0930)]
Hashtable routines.

10 years agotools: fastcheck adjust; 750ms works well for me.
Rusty Russell [Fri, 9 Apr 2010 06:24:02 +0000 (15:54 +0930)]
tools: fastcheck adjust; 750ms works well for me.

10 years agoccanlint: optimize the timeout case
Rusty Russell [Fri, 9 Apr 2010 04:42:53 +0000 (14:12 +0930)]
ccanlint: optimize the timeout case

This takes my "make fastcheck" from about 57 seconds to about 43 seconds.

10 years agoFix EXCLUDE logic for makefiles, add fastcheck
Rusty Russell [Fri, 9 Apr 2010 04:30:02 +0000 (14:00 +0930)]
Fix EXCLUDE logic for makefiles, add fastcheck

10 years agoccanlint: always catch timeouts, and force kill valgrind etc.
Rusty Russell [Fri, 9 Apr 2010 04:29:22 +0000 (13:59 +0930)]
ccanlint: always catch timeouts, and force kill valgrind etc.

10 years agoccanlint: timeout, and implement -t option for quicker tests.
Rusty Russell [Fri, 9 Apr 2010 03:51:26 +0000 (13:21 +0930)]
ccanlint: timeout, and implement -t option for quicker tests.

10 years agoUse bzr to determine what to upload
Rusty Russell [Fri, 9 Apr 2010 03:51:11 +0000 (13:21 +0930)]
Use bzr to determine what to upload

10 years agoccanlint: clean up test short descriptions
Rusty Russell [Fri, 9 Apr 2010 02:21:42 +0000 (11:51 +0930)]
ccanlint: clean up test short descriptions

10 years agoccanlint: cleanup listing code, make print in topo order.
Rusty Russell [Fri, 9 Apr 2010 02:12:10 +0000 (11:42 +0930)]
ccanlint: cleanup listing code, make print in topo order.

10 years agoFrom: Joseph Adams <joeyadams3.14159@gmail.com>
Rusty Russell [Fri, 9 Apr 2010 01:28:21 +0000 (10:58 +0930)]
From: Joseph Adams <joeyadams3.14159@gmail.com>

The ccanlint patch is rather intrusive.  First, it adds a new field to
all the ccanlint tests, "key".  key is a shorter, still unique
description of the test (e.g. "valgrind").  The names I chose as keys
for all the tests are somewhat arbitrary and often don't reflect the
name of the .c source file (because some of those names are just too
darn long).  Second, it adds two new options to ccanlint:

   -l: list tests ccanlint performs
   -x: exclude tests (e.g. -x trailing_whitespace,valgrind)

It also adds a consistency check making sure all tests have unique
keys and names.

The primary goal of the ccanlint patch was so I could exclude the
valgrind test, which takes a really long time for some modules (I
think btree takes the longest, at around 2 minutes).  I'm not sure I
did it 100% correctly, so you'll want to review it first.

10 years agoFrom: Joseph Adams <joeyadams3.14159@gmail.com>
Rusty Russell [Fri, 9 Apr 2010 01:24:31 +0000 (10:54 +0930)]
From: Joseph Adams <joeyadams3.14159@gmail.com>

The btree patch gives the btree module an intuitive frontend
(btree_insert, btree_remove, btree_lookup) and a built-in ordering
function for strings.  Together, these make it easy to use the btree
module as a dynamic string map.

10 years agoFrom: Joseph Adams <joeyadams3.14159@gmail.com>
Rusty Russell [Fri, 9 Apr 2010 01:23:35 +0000 (10:53 +0930)]
From: Joseph Adams <joeyadams3.14159@gmail.com>

The charset patch makes utf8_validate reject the invalid codepoints
U+FFFE and U+FFFF .  Hopefully it's fully UTF-8 compliant now.

10 years agoFix segfault due to relative paths (ccan_depends), and generate pages for ignored...
Rusty Russell [Wed, 31 Mar 2010 12:55:56 +0000 (23:25 +1030)]
Fix segfault due to relative paths (ccan_depends), and generate pages for ignored modules too.

10 years agoJoey's charset validation module.
Joseph Adams [Wed, 31 Mar 2010 12:43:16 +0000 (23:13 +1030)]
Joey's charset validation module.

10 years agoasort: fix gcc warning.
Rusty Russell [Wed, 24 Feb 2010 03:42:22 +0000 (14:12 +1030)]
asort: fix gcc warning.

10 years agotools: fix warnings from Ubuntu strict compiler.
Rusty Russell [Wed, 24 Feb 2010 03:39:06 +0000 (14:09 +1030)]
tools: fix warnings from Ubuntu strict compiler.

10 years agotdb: handle processes dying during transaction commit.
Rusty Russell [Wed, 24 Feb 2010 03:38:40 +0000 (14:08 +1030)]
tdb: handle processes dying during transaction commit.

tdb transactions were designed to be robust against the machine
powering off, but interestingly were never designed to handle the case
where an administrator kill -9's a process during commit.  Because
recovery is only done on tdb_open, processes with the tdb already
mapped will simply use it despite it being corrupt and needing
recovery.

The solution to this is to check for recovery every time we grab a
data lock: we could have gained the lock because a process just died.
This has no measurable cost: here is the time for tdbtorture -s 0 -n 1
-l 10000:

Before:
2.75 2.50 2.81 3.19 2.91 2.53 2.72 2.50 2.78 2.77 = Avg 2.75

After:
2.81 2.57 3.42 2.49 3.02 2.49 2.84 2.48 2.80 2.43 = Avg 2.74

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agotdb: cleanup: tdb_lock_list helper to cover tdb_lock and tdb_lock_nonblock
Rusty Russell [Wed, 24 Feb 2010 03:26:17 +0000 (13:56 +1030)]
tdb: cleanup: tdb_lock_list helper to cover tdb_lock and tdb_lock_nonblock

Reduce code duplication, and also gives us a central point for the next
patch which wants to cover all list locks.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agotdb: remove lock ops
Rusty Russell [Wed, 24 Feb 2010 03:24:31 +0000 (13:54 +1030)]
tdb: remove lock ops

Now the transaction code uses the standard allrecord lock, that stops
us from trying to grab any per-record locks anyway.  We don't need to
have special noop lock ops for transactions.

This is a nice simplification: if you see brlock, you know it's really
going to grab a lock.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 years agotdb: more testcase fixup.
Rusty Russell [Tue, 23 Feb 2010 22:47:41 +0000 (09:17 +1030)]
tdb: more testcase fixup.

10 years agotdb: suppress record write locks when allrecord lock is taken.
Rusty Russell [Tue, 23 Feb 2010 22:22:44 +0000 (08:52 +1030)]
tdb: suppress record write locks when allrecord lock is taken.

Records themselves get (read) locked by the traversal code against delete.
Interestingly, this locking isn't done when the allrecord lock has been
taken, though the allrecord lock until recently didn't cover the actual
records (it now goes to end of file).

The write record lock, grabbed by the delete code, is not suppressed by
the allrecord lock, which causes us to punch a hole in that lock when we
release the write record lock.  Make this consistent: *no* record locks
of any kind when the allrecord lock is taken.

10 years agotdb: new test, cleanup old tests by centralizing lock tracking.
Rusty Russell [Tue, 23 Feb 2010 21:50:06 +0000 (08:20 +1030)]
tdb: new test, cleanup old tests by centralizing lock tracking.

10 years agotdb: fix test to remove warning, and don't fail when tdb_check() barfs.
Rusty Russell [Mon, 22 Feb 2010 12:34:23 +0000 (23:04 +1030)]
tdb: fix test to remove warning, and don't fail when tdb_check() barfs.

10 years agotdb: don't reduce file size on transaction recovery.
Rusty Russell [Mon, 22 Feb 2010 12:33:36 +0000 (23:03 +1030)]
tdb: don't reduce file size on transaction recovery.

There's little point in ever shrinking the file, and it definitely breaks in the case where a process has died during a transaction commit and other processes have the tdb mapped.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
10 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>
10 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.

10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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>
10 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)

10 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.

10 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.

10 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

10 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.

10 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?

10 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.

10 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.

10 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

10 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.

10 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.

10 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.

10 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>
10 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>
10 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>
10 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>
10 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>
10 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.

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

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

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

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

10 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.

10 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)

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

10 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.

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

10 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)

10 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.

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

10 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.

10 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 :(