1. 07 Apr, 2011 1 commit
    • Rusty Russell's avatar
      tdb2: TDB_ATTRIBUTE_FLOCK support · 7fe32184
      Rusty Russell authored
      This allows overriding of low-level locking functions.  This allows
      special effects such as non-blocking operations, and lock proxying.
      
      We rename some local lock vars to l to avoid -Wshadow warnings.
      7fe32184
  2. 06 Apr, 2011 1 commit
  3. 07 Apr, 2011 1 commit
    • Rusty Russell's avatar
      tdb2: open hook for implementing TDB_CLEAR_IF_FIRST · 0468e699
      Rusty Russell authored
      This allows the caller to implement clear-if-first semantics as per
      TDB1.  The flag was removed for good reasons: performance and
      unreliability, but SAMBA3 still uses it widely, so this allows them to
      reimplement it themselves.
      
      (There is no way to do it without help like this from tdb2, since it has
       to be done under the open lock).
      0468e699
  4. 10 May, 2011 1 commit
    • Rusty Russell's avatar
      tdb2: cleanups for tools/speed.c · 4ee7bd08
      Rusty Russell authored
      1) The logging function needs to append a \n.
      2) The transaction start code should be after the comment and print.
      3) We should run tdb_check to make sure the database is OK after each op.
      4ee7bd08
  5. 07 Apr, 2011 3 commits
  6. 29 Mar, 2011 2 commits
  7. 19 Apr, 2011 1 commit
    • Rusty Russell's avatar
      tdb2: fix tdb_summary reports · 63e80faf
      Rusty Russell authored
      1) Fix the bogus reporting of uncoalesced runs: there has to be more than 1
         free record to make a "run", and any other record interrups the run.
      2) Fix the bogus data count in the top line (which was number of records,
         not bytes).
      3) Remove the count of free buckets: it's now a constant.
      63e80faf
  8. 28 Apr, 2011 4 commits
  9. 27 Apr, 2011 5 commits
  10. 19 Apr, 2011 2 commits
  11. 06 Apr, 2011 1 commit
    • Rusty Russell's avatar
      typesafe_cb: simplify, preserve namespace. · b0fa019a
      Rusty Russell authored
      Get rid of many variants, which were just confusing for most people.
      Keep typesafe_cb(), typesafe_cb_preargs() and typesafe_cb_postarts(),
      and rework cast_if_type() into typesafe_cb_cast() so we stay in our
      namespace.
      
      I should have done this as soon as I discovered the limitation that
      the types have to be defined if I want const-taking callbacks.
      b0fa019a
  12. 19 Apr, 2011 3 commits
  13. 02 Apr, 2011 8 commits
  14. 28 Mar, 2011 4 commits
  15. 25 Mar, 2011 3 commits
    • Rusty Russell's avatar
      tdb2: speed up transaction code by making page size a constant. · b556ef1f
      Rusty Russell authored
      Turning getpagesize() into a constant 4096 really helps gcc optimize, and
      not just on 64 bit.
      
      Here are the results of running "tools/speed --transaction --no-sync 2000000":
      
      i386 with gcc 4.4.5:
      Before:
      	$ ./speed --transaction --no-sync 2000000
      	Adding 2000000 records:  1195 ns (93594224 bytes)
      	Finding 2000000 records:  719 ns (93594224 bytes)
      	Missing 2000000 records:  429 ns (93594224 bytes)
      	Traversing 2000000 records:  523 ns (93594224 bytes)
      	Deleting 2000000 records:  901 ns (93594224 bytes)
      	Re-adding 2000000 records:  1032 ns (93594224 bytes)
      	Appending 2000000 records:  1711 ns (182801232 bytes)
      	Churning 2000000 records:  3233 ns (182801232 bytes)
      
      After:
      	Adding 2000000 records:  868 ns (93594224 bytes)
      	Finding 2000000 records:  569 ns (93594224 bytes)
      	Missing 2000000 records:  369 ns (93594224 bytes)
      	Traversing 2000000 records:  406 ns (93594224 bytes)
      	Deleting 2000000 records:  674 ns (93594224 bytes)
      	Re-adding 2000000 records:  730 ns (93594224 bytes)
      	Appending 2000000 records:  1144 ns (182801232 bytes)
      	Churning 2000000 records:  2085 ns (182801232 bytes)
      
      Here's the effect (average of 10) on x8664 with gcc 4.1.2, with an earlier
      tree and 1000000:
      	Before:
      		Adding 830.1ns
      		Finding 428.3ns
      		Missing 250.3ns
      		Traversing 387.4ns
      		Deleting 588.8ns
      		Re-adding 737.2ns
      		Appending 1141.4ns
      		Churning 1792ns
      
      	After:
      		Adding 562.8ns
      		Finding 362.1ns
      		Missing 226.4ns
      		Traversing 276.5ns
      		Deleting 426.7ns
      		Re-adding 489.8ns
      		Appending 736.4ns
      		Churning 1112.7ns
      
      b556ef1f
    • Rusty Russell's avatar
      tdb2: fix traversal bug in free list lock_and_alloc() · 1444b09c
      Rusty Russell authored
      We keep looking even if the current best is exactly right.  This is
      really bad, because our smaller free lists hold exactly one size: with
      this bug we iterate to the end of the list before hitting the end and
      deciding we can use it after all.
      
      Before:
      	$ ./speed --transaction --no-sync 2000000
      	Adding 2000000 records:  1179 ns (93594224 bytes)
      	Finding 2000000 records:  694 ns (93594224 bytes)
      	Missing 2000000 records:  429 ns (93594224 bytes)
      	Traversing 2000000 records:  519 ns (93594224 bytes)
      	Deleting 2000000 records:  896 ns (93594224 bytes)
      	Re-adding 2000000 records:  1129 ns (93594224 bytes)
      	Appending 2000000 records:  1713 ns (182801232 bytes)
      	Churning 2000000 records:  32612 ns (182801232 bytes)
      
      After:
      	$ ./speed --transaction --no-sync 2000000
      	Adding 2000000 records:  1195 ns (93594224 bytes)
      	Finding 2000000 records:  719 ns (93594224 bytes)
      	Missing 2000000 records:  429 ns (93594224 bytes)
      	Traversing 2000000 records:  523 ns (93594224 bytes)
      	Deleting 2000000 records:  901 ns (93594224 bytes)
      	Re-adding 2000000 records:  1032 ns (93594224 bytes)
      	Appending 2000000 records:  1711 ns (182801232 bytes)
      	Churning 2000000 records:  3233 ns (182801232 bytes)
      1444b09c
    • Rusty Russell's avatar
      tdb2: add --summary and logging to tools/speed. · 4bde5a87
      Rusty Russell authored
      This helps us see where the problems are.
      4bde5a87