1. 27 Apr, 2011 1 commit
    • Rusty Russell's avatar
      tdb2: don't start again when we coalesce a record. · 5c4a21ab
      Rusty Russell authored
      We currently start walking the free list again when we coalesce any record;
      this is overzealous, as we only care about the next record being blatted,
      or the record we currently consider "best".
      
      We can also opportunistically try to add the coalesced record into the
      new free list: if it fails, we go back to the old "mark record,
      unlock, re-lock" code.
      
      Before:
      $ time ./growtdb-bench 250000 10 > /dev/null && ls -l /tmp/growtdb.tdb && time ./tdbtorture -s 0 && ls -l torture.tdb && ./speed --transaction 2000000
      real	1m0.243s
      user	0m13.677s
      sys	0m4.336s
      -rw------- 1 rusty rusty 683302864 2011-04-27 21:03 /tmp/growtdb.tdb
      testing with 3 processes, 5000 loops, seed=0
      OK
      
      real	1m24.074s
      user	0m0.344s
      sys	0m0.468s
      -rw------- 1 rusty rusty 836040 2011-04-27 21:04 torture.tdb
      Adding 2000000 records:  1015 ns (110551992 bytes)
      Finding 2000000 records:  641 ns (110551992 bytes)
      Missing 2000000 records:  445 ns (110551992 bytes)
      Traversing 2000000 records:  439 ns (110551992 bytes)
      Deleting 2000000 records:  807 ns (199517112 bytes)
      Re-adding 2000000 records:  851 ns (199517112 bytes)
      Appending 2000000 records:  1301 ns (376542552 bytes)
      Churning 2000000 records:  2423 ns (553641304 bytes)
      
      After:
      $ time ./growtdb-bench 250000 10 > /dev/null && ls -l /tmp/growtdb.tdb && time ./tdbtorture -s 0 && ls -l torture.tdb && ./speed --transaction 2000000
      real	0m57.403s
      user	0m11.361s
      sys	0m4.056s
      -rw------- 1 rusty rusty 689536976 2011-04-27 21:10 /tmp/growtdb.tdb
      testing with 3 processes, 5000 loops, seed=0
      OK
      
      real	1m24.901s
      user	0m0.380s
      sys	0m0.512s
      -rw------- 1 rusty rusty 655368 2011-04-27 21:12 torture.tdb
      Adding 2000000 records:  941 ns (110551992 bytes)
      Finding 2000000 records:  603 ns (110551992 bytes)
      Missing 2000000 records:  428 ns (110551992 bytes)
      Traversing 2000000 records:  416 ns (110551992 bytes)
      Deleting 2000000 records:  741 ns (199517112 bytes)
      Re-adding 2000000 records:  819 ns (199517112 bytes)
      Appending 2000000 records:  1228 ns (376542552 bytes)
      Churning 2000000 records:  2042 ns (553641304 bytes)
      
      5c4a21ab
  2. 25 Mar, 2011 1 commit
  3. 27 Apr, 2011 1 commit
    • Rusty Russell's avatar
      tdb2: expand more slowly. · 48241893
      Rusty Russell authored
      We took the original expansion heuristic from TDB1, and they just
      fixed theirs, so copy that.
      
      Before:
      
      After:
      time ./growtdb-bench 250000 10 > /dev/null && ls -l /tmp/growtdb.tdb && time ./tdbtorture -s 0 && ls -l torture.tdb && ./speed --transaction 2000000
      growtdb-bench.c: In function ‘main’:
      growtdb-bench.c:74:8: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result
      growtdb-bench.c:108:9: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result
      
      real	1m0.243s
      user	0m13.677s
      sys	0m4.336s
      -rw------- 1 rusty rusty 683302864 2011-04-27 21:03 /tmp/growtdb.tdb
      testing with 3 processes, 5000 loops, seed=0
      OK
      
      real	1m24.074s
      user	0m0.344s
      sys	0m0.468s
      -rw------- 1 rusty rusty 836040 2011-04-27 21:04 torture.tdb
      Adding 2000000 records:  1015 ns (110551992 bytes)
      Finding 2000000 records:  641 ns (110551992 bytes)
      Missing 2000000 records:  445 ns (110551992 bytes)
      Traversing 2000000 records:  439 ns (110551992 bytes)
      Deleting 2000000 records:  807 ns (199517112 bytes)
      Re-adding 2000000 records:  851 ns (199517112 bytes)
      Appending 2000000 records:  1301 ns (376542552 bytes)
      Churning 2000000 records:  2423 ns (553641304 bytes)
      48241893
  4. 19 Apr, 2011 1 commit
  5. 21 Apr, 2011 1 commit
  6. 07 Apr, 2011 1 commit
    • Rusty Russell's avatar
      tdb2: allow transaction to nest. · 72e974b2
      Rusty Russell authored
      This is definitely a bad idea in general, but SAMBA uses nested transactions
      in many and varied ways (some of them probably reflect real bugs) and it's
      far easier to support them inside tdb2 with a flag.
      
      We already have part of the TDB1 infrastructure in place, so this patch
      just completes it and fixes one place where I'd messed it up.
      72e974b2
  7. 27 Apr, 2011 2 commits
    • Rusty Russell's avatar
      tdb2: allow multiple chain locks. · dc9da1e3
      Rusty Russell authored
      It's probably not a good idea, because it's a recipe for deadlocks if
      anyone else grabs any *other* two chainlocks, or the allrecord lock,
      but SAMBA definitely does it, so allow it as TDB1 does.
      dc9da1e3
    • Rusty Russell's avatar
      tdb2: TDB_ATTRIBUTE_STATS access via tdb_get_attribute. · 8cca0397
      Rusty Russell authored
      Now we have tdb_get_attribute, it makes sense to make that the method
      of accessing statistics.  That way they are always available, and it's
      probably cheaper doing the direct increment than even the unlikely()
      branch.
      8cca0397
  8. 07 Apr, 2011 4 commits
  9. 06 Apr, 2011 1 commit
  10. 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
  11. 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
  12. 07 Apr, 2011 3 commits
  13. 29 Mar, 2011 2 commits
  14. 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
  15. 28 Apr, 2011 4 commits
  16. 27 Apr, 2011 5 commits
  17. 19 Apr, 2011 2 commits
  18. 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
  19. 19 Apr, 2011 3 commits
  20. 02 Apr, 2011 4 commits