platform/upstream/lmdb.git
12 years agoassert cleanup
Howard Chu [Thu, 22 Sep 2011 00:21:48 +0000 (17:21 -0700)]
assert cleanup

12 years agotxn_abort/commit free all their cursors now.
Howard Chu [Wed, 21 Sep 2011 23:37:29 +0000 (16:37 -0700)]
txn_abort/commit free all their cursors now.

12 years agoOnly free malloc'd cursors
Howard Chu [Wed, 21 Sep 2011 23:06:52 +0000 (16:06 -0700)]
Only free malloc'd cursors

12 years agoTrack changes to all cursors.
Howard Chu [Wed, 21 Sep 2011 21:14:11 +0000 (14:14 -0700)]
Track changes to all cursors.

For any change to a page or node, update all other cursors pointing
at the same page (or node). Cursors are now stored in a linked list
off their owning transaction. Cursors are all closed when the transaction
ends. Cursors in parent transactions are updated when their child
transaction commits.

12 years agoAdd support for nested transactions.
Howard Chu [Tue, 20 Sep 2011 19:57:05 +0000 (12:57 -0700)]
Add support for nested transactions.

12 years agolibmdb IDL cleanup.
Hallvard Furuseth [Tue, 13 Sep 2011 07:39:28 +0000 (09:39 +0200)]
libmdb IDL cleanup.

Microoptimize IDL search.
Use RANGE_<FIRST/LAST> when IDL is known to be a range.

12 years agoAdditional fix for prev commit
Howard Chu [Mon, 19 Sep 2011 01:26:54 +0000 (18:26 -0700)]
Additional fix for prev commit

12 years agoMake sure 2 subpages fit in one real page
Howard Chu [Mon, 19 Sep 2011 01:13:23 +0000 (18:13 -0700)]
Make sure 2 subpages fit in one real page

12 years agoFix last delete from a subpage
Howard Chu [Mon, 19 Sep 2011 00:07:47 +0000 (17:07 -0700)]
Fix last delete from a subpage

12 years agoFix 09006ccec7928c9cf53bca6abe741e8d4d466c98
Howard Chu [Sun, 18 Sep 2011 23:39:18 +0000 (16:39 -0700)]
Fix 09006ccec7928c9cf53bca6abe741e8d4d466c98

Check for stale DBs was in the wrong place.

12 years agoFix mdb_drop() if not deleting the DB record
Howard Chu [Sun, 18 Sep 2011 21:18:27 +0000 (14:18 -0700)]
Fix mdb_drop() if not deleting the DB record

12 years agoFix typo, minor cleanup
Howard Chu [Sun, 18 Sep 2011 20:28:08 +0000 (13:28 -0700)]
Fix typo, minor cleanup

12 years agoAdd mdb_drop() for deleting a DB
Howard Chu [Sun, 18 Sep 2011 19:37:02 +0000 (12:37 -0700)]
Add mdb_drop() for deleting a DB

Allow MIDLs to grow arbitrarily, to allow unlimited number of
pages to be freed in one txn.

12 years agoAPI change, consistency check
Howard Chu [Sun, 18 Sep 2011 17:38:08 +0000 (10:38 -0700)]
API change, consistency check

mdb_close() takes an env, not a txn.
Also, add check for stale DB records (in case some other process
wrote to the DB last).

12 years agoNew sorted-dup subpage support
Howard Chu [Fri, 16 Sep 2011 23:51:32 +0000 (16:51 -0700)]
New sorted-dup subpage support

Instead of converting directly to a subDB when the first duplicate
item is seen for a key, convert to a subpage instead. Allow the
subpage to grow up to the overflow limit, then convert to a subDB.
This saves a significant amount of space in a typical slapd index
database.

Currently we don't convert back to the smaller form if items are
later deleted. Probably could do that with some hysteresis, e.g.,
convert back from subDB to subpage when the size drops below
(overflow limit/2). Maybe later.

12 years agoUse FNV-1A hash to generate unique mutex names
Howard Chu [Thu, 15 Sep 2011 17:36:15 +0000 (10:36 -0700)]
Use FNV-1A hash to generate unique mutex names

For Windows and MacOSX

12 years agoDoc tweak - txn flags
Howard Chu [Thu, 15 Sep 2011 03:33:09 +0000 (20:33 -0700)]
Doc tweak - txn flags

12 years agoMacOSX semaphore names are limited to 31 chars
Howard Chu [Thu, 15 Sep 2011 03:30:26 +0000 (20:30 -0700)]
MacOSX semaphore names are limited to 31 chars

Including the terminating NUL. Good job documenting that, guys.

12 years agoAdd MacOSX support
Howard Chu [Wed, 14 Sep 2011 18:31:27 +0000 (11:31 -0700)]
Add MacOSX support

mmap() with FIXEDMAP fails, otherwise things work.

12 years agoMinor doc cleanup
Howard Chu [Wed, 14 Sep 2011 08:46:08 +0000 (01:46 -0700)]
Minor doc cleanup

12 years agoMore docs
Howard Chu [Wed, 14 Sep 2011 08:08:01 +0000 (01:08 -0700)]
More docs

12 years agoNamespace cleanup
Howard Chu [Wed, 14 Sep 2011 06:36:41 +0000 (23:36 -0700)]
Namespace cleanup

12 years agoTweak search_node inner loop to avoid LEAF2 checks
Howard Chu [Tue, 13 Sep 2011 20:34:22 +0000 (13:34 -0700)]
Tweak search_node inner loop to avoid LEAF2 checks

12 years agocursor_set/search_node tweaks, use intcmp when possible
Howard Chu [Tue, 13 Sep 2011 18:25:17 +0000 (11:25 -0700)]
cursor_set/search_node tweaks, use intcmp when possible

12 years agoMinor tweaks, update relfunc behavior
Howard Chu [Mon, 12 Sep 2011 08:11:56 +0000 (01:11 -0700)]
Minor tweaks, update relfunc behavior

12 years agoMore cursor_init cleanup
Howard Chu [Mon, 12 Sep 2011 06:57:17 +0000 (23:57 -0700)]
More cursor_init cleanup

12 years agoOne more sub-cursor fix
Howard Chu [Mon, 12 Sep 2011 06:13:36 +0000 (23:13 -0700)]
One more sub-cursor fix

12 years agoMerge branch 'mdb.master' of ssh://git-master.openldap.org/~git/git/openldap into...
Howard Chu [Mon, 12 Sep 2011 05:23:35 +0000 (22:23 -0700)]
Merge branch 'mdb.master' of ssh://git-openldap.org/~git/git/openldap into mdb.master

12 years agoFix 2e3bc39fa94f21d692d8e94183f57aef9122c487
Howard Chu [Mon, 12 Sep 2011 03:54:32 +0000 (20:54 -0700)]
Fix 2e3bc39fa94f21d692d8e94183f57aef9122c487

Various mistakes when converting from previous data structures.
Add a few more debug asserts/sanity checks.
Split all "if (foo) return" constructs to separate lines to allow
easier breakpoint setting.

Add mtest6 for checking mdb_split() behavior. This needs to be
expanded to check rebalance/merge cases too.

12 years agoFix mdb debug formats
Hallvard Furuseth [Sun, 11 Sep 2011 11:00:52 +0000 (13:00 +0200)]
Fix mdb debug formats

12 years agoRestore missing LAZY_LOCKS semicolon.
Hallvard Furuseth [Sun, 11 Sep 2011 09:08:40 +0000 (11:08 +0200)]
Restore missing LAZY_LOCKS semicolon.

Lost in C90 compat commit c5dad7a6d0eb1b3597beda18b38fe92820df0d30.

12 years agomdb integer type cleanup: Use MDB_dbi consistently.
Hallvard Furuseth [Sat, 10 Sep 2011 08:11:56 +0000 (10:11 +0200)]
mdb integer type cleanup: Use MDB_dbi consistently.

This changes the prototype of mdb_env_set_maxdbs().

12 years agoDrop ULONG in favor of size_t.
Hallvard Furuseth [Sat, 10 Sep 2011 18:01:07 +0000 (20:01 +0200)]
Drop ULONG in favor of size_t.

12 years agoAdd mdb.c:txnid_t for readability.
Hallvard Furuseth [Sat, 10 Sep 2011 08:11:56 +0000 (10:11 +0200)]
Add mdb.c:txnid_t for readability.

Maybe later we'll test txnid wraparound with it defined to ushort.

12 years agomdb type cleanup: Consistent reader count types.
Hallvard Furuseth [Sat, 10 Sep 2011 08:11:56 +0000 (10:11 +0200)]
mdb type cleanup: Consistent reader count types.

Use unsigned int for reader counts/max limits, that's the smallest
change.  Don't need uint32_t when mdb_env_set_maxreaders() takes less.
Change prototypes of mdb_env_set_maxreaders,mdb_env_get_maxreaders().
Check the mdb_env_set_maxreaders() argument.

12 years agoexplain mdl_midl_sort() istack size
Hallvard Furuseth [Sat, 10 Sep 2011 08:11:55 +0000 (10:11 +0200)]
explain mdl_midl_sort() istack size

12 years agoFix memn(r)cmp of key sizes > INT_MAX. Simplify.
Hallvard Furuseth [Sat, 10 Sep 2011 08:11:55 +0000 (10:11 +0200)]
Fix memn(r)cmp of key sizes > INT_MAX.  Simplify.

12 years agoCheck some mdb integer type assumptions
Hallvard Furuseth [Sat, 10 Sep 2011 08:11:55 +0000 (10:11 +0200)]
Check some mdb integer type assumptions

12 years agoPut MDB_node.<mn_lo,mn_hi> in host byte order.
Hallvard Furuseth [Sat, 10 Sep 2011 08:11:55 +0000 (10:11 +0200)]
Put MDB_node.<mn_lo,mn_hi> in host byte order.

12 years agoC90 compatibility cleanup in mdb.
Hallvard Furuseth [Sat, 10 Sep 2011 08:11:55 +0000 (10:11 +0200)]
C90 compatibility cleanup in mdb.

Fix void* pointer arithmetic in cintcmp().
Fix invalid ';'s in declarations after possibly-empty macros.

12 years agoCleanup mdb macros.
Hallvard Furuseth [Sat, 10 Sep 2011 08:11:55 +0000 (10:11 +0200)]
Cleanup mdb macros.

Parenthesize.  Rename GetPageSize -> GET_PAGESIZE since it does not
behave like a function (it has a non-pointer output argument).

12 years agolibmdb/.gitignore += test[45], Doxygen output
Hallvard Furuseth [Sat, 10 Sep 2011 08:11:55 +0000 (10:11 +0200)]
libmdb/.gitignore += test[45], Doxygen output

12 years agoIf put(NOOVERWRITE) exists, return existing data
Howard Chu [Sat, 10 Sep 2011 04:43:22 +0000 (21:43 -0700)]
If put(NOOVERWRITE) exists, return existing data

12 years agoMinor typos, additional clarification
Howard Chu [Fri, 9 Sep 2011 10:52:12 +0000 (03:52 -0700)]
Minor typos, additional clarification

12 years agoPartial revert, fix MDB_page definition
Howard Chu [Fri, 9 Sep 2011 03:18:29 +0000 (20:18 -0700)]
Partial revert, fix MDB_page definition

12 years agoMore docs
Howard Chu [Fri, 9 Sep 2011 00:13:51 +0000 (17:13 -0700)]
More docs

12 years agoMore docs
Howard Chu [Thu, 8 Sep 2011 20:11:33 +0000 (13:11 -0700)]
More docs

12 years agoSpeedup cintcmp
Howard Chu [Thu, 8 Sep 2011 20:10:17 +0000 (13:10 -0700)]
Speedup cintcmp

Now that we know we're always 2-byte aligned...

12 years agoFix previous commit
Howard Chu [Thu, 8 Sep 2011 17:08:21 +0000 (10:08 -0700)]
Fix previous commit

12 years agoMerge branch 'mdb.cursor' into mdb.master
Howard Chu [Thu, 8 Sep 2011 06:57:50 +0000 (23:57 -0700)]
Merge branch 'mdb.cursor' into mdb.master

12 years agoForgot to commit this
Howard Chu [Thu, 8 Sep 2011 06:10:19 +0000 (23:10 -0700)]
Forgot to commit this

12 years agoForgot to commit this
Howard Chu [Thu, 8 Sep 2011 06:10:19 +0000 (23:10 -0700)]
Forgot to commit this

12 years agoFurther cursor-based restructuring
Howard Chu [Wed, 7 Sep 2011 09:04:40 +0000 (02:04 -0700)]
Further cursor-based restructuring

Get rid of all of the redundant MDB_*page structs and other cruft.

12 years agoCleanup unused code
Howard Chu [Wed, 7 Sep 2011 06:37:37 +0000 (23:37 -0700)]
Cleanup unused code

12 years agoFix mdb_move_node again
Howard Chu [Wed, 7 Sep 2011 06:16:45 +0000 (23:16 -0700)]
Fix mdb_move_node again

12 years agoFix search_node, add cintcmp
Howard Chu [Tue, 6 Sep 2011 22:22:53 +0000 (15:22 -0700)]
Fix search_node, add cintcmp

12 years agoGuarantee nodes are 2-byte aligned
Howard Chu [Tue, 6 Sep 2011 19:54:09 +0000 (12:54 -0700)]
Guarantee nodes are 2-byte aligned

Also fix xcursor_init1 md_dirty flag
Also another mdb_cmp refactoring fix

12 years agoChange MDB_node to depend on 2-byte alignment
Howard Chu [Tue, 6 Sep 2011 12:17:24 +0000 (05:17 -0700)]
Change MDB_node to depend on 2-byte alignment

12 years agoFix for mdb_cmp refactoring
Howard Chu [Mon, 5 Sep 2011 23:54:39 +0000 (16:54 -0700)]
Fix for mdb_cmp refactoring

12 years agoMinor cleanup
Howard Chu [Mon, 5 Sep 2011 21:22:46 +0000 (14:22 -0700)]
Minor cleanup

12 years agoUse mdb_midl_append/sort instead of _insert
Howard Chu [Mon, 5 Sep 2011 09:36:24 +0000 (02:36 -0700)]
Use mdb_midl_append/sort instead of _insert

12 years agomdb_cmp refactoring
Howard Chu [Mon, 5 Sep 2011 07:46:32 +0000 (00:46 -0700)]
mdb_cmp refactoring

12 years agoCursor stuff working, no major perf gain
Howard Chu [Mon, 5 Sep 2011 01:34:03 +0000 (18:34 -0700)]
Cursor stuff working, no major perf gain

12 years agoCursors in-progress, broken
Howard Chu [Sun, 4 Sep 2011 18:59:32 +0000 (11:59 -0700)]
Cursors in-progress, broken

12 years agoUse cursor->mc_flags
Howard Chu [Sun, 4 Sep 2011 03:42:46 +0000 (20:42 -0700)]
Use cursor->mc_flags

12 years agoBegin reimplementing basic ops as cursor ops
Howard Chu [Sun, 4 Sep 2011 00:24:39 +0000 (17:24 -0700)]
Begin reimplementing basic ops as cursor ops

12 years agoAdd MDB_{FIRST,LAST}_DUP for cursor_get
Howard Chu [Sat, 3 Sep 2011 22:19:24 +0000 (15:19 -0700)]
Add MDB_{FIRST,LAST}_DUP for cursor_get

12 years agoFix mdb_split, fix MDB_GET_BOTH
Howard Chu [Sun, 4 Sep 2011 03:11:07 +0000 (20:11 -0700)]
Fix mdb_split, fix MDB_GET_BOTH

12 years agoCleanup midl, start documenting internals
Howard Chu [Fri, 2 Sep 2011 10:09:05 +0000 (03:09 -0700)]
Cleanup midl, start documenting internals

12 years agoTweak docs
Howard Chu [Fri, 2 Sep 2011 08:09:11 +0000 (01:09 -0700)]
Tweak docs

12 years agoUgly-as-sin initial Windows port
Howard Chu [Thu, 1 Sep 2011 10:38:48 +0000 (03:38 -0700)]
Ugly-as-sin initial Windows port

12 years agoAPI cleanup, doxygen docs for public API
Howard Chu [Wed, 31 Aug 2011 11:58:40 +0000 (04:58 -0700)]
API cleanup, doxygen docs for public API

12 years agoCleanup, fix freelist alloc
Howard Chu [Mon, 29 Aug 2011 23:55:41 +0000 (16:55 -0700)]
Cleanup, fix freelist alloc

Don't allow new pages for free list to come from the free list.
Otherwise a nasty data self-reference occurs that is too much
trouble to unwind.

12 years agoTweak locks, fix race conditions
Howard Chu [Mon, 29 Aug 2011 10:45:13 +0000 (03:45 -0700)]
Tweak locks, fix race conditions

12 years agoReduce excessive memcpy in mdb_split
Howard Chu [Sun, 28 Aug 2011 00:32:24 +0000 (17:32 -0700)]
Reduce excessive memcpy in mdb_split

12 years agoFix mdb_split, tweak split_indx if space is tight
Howard Chu [Sat, 27 Aug 2011 23:53:58 +0000 (16:53 -0700)]
Fix mdb_split, tweak split_indx if space is tight

12 years agoFix update of big data items
Howard Chu [Fri, 26 Aug 2011 20:37:02 +0000 (13:37 -0700)]
Fix update of big data items

12 years agoFix free page reclaim and dbs table update
Howard Chu [Fri, 26 Aug 2011 07:01:16 +0000 (00:01 -0700)]
Fix free page reclaim and dbs table update

Can re-use free pages 1 txn earlier
Must update all dbs tables on txn commit

12 years agoMore debug, fix MDB_DEL_DUP
Howard Chu [Fri, 26 Aug 2011 02:45:08 +0000 (19:45 -0700)]
More debug, fix MDB_DEL_DUP

12 years agoMore debug output
Howard Chu [Thu, 25 Aug 2011 09:08:56 +0000 (02:08 -0700)]
More debug output

12 years agoAdd txn_reset / txn_renew
Howard Chu [Wed, 24 Aug 2011 08:45:42 +0000 (01:45 -0700)]
Add txn_reset / txn_renew

12 years agoFirst cut at DUPFIXED support
Howard Chu [Mon, 22 Aug 2011 00:49:54 +0000 (17:49 -0700)]
First cut at DUPFIXED support

Also in cursor_set, check the current page (if already set from
before) before starting over again from the root.

12 years agoSet MINKEYS to 2
Howard Chu [Sat, 20 Aug 2011 00:20:56 +0000 (17:20 -0700)]
Set MINKEYS to 2

For better space utilization

12 years agoKeep re-using dpages instead of freeing them
Howard Chu [Fri, 19 Aug 2011 23:43:57 +0000 (16:43 -0700)]
Keep re-using dpages instead of freeing them

12 years agoAvoid cast-away-const for errstr[]
Hallvard B Furuseth [Fri, 19 Aug 2011 06:45:57 +0000 (08:45 +0200)]
Avoid cast-away-const for errstr[]

12 years agoWrap O_DSYNC in MDB_DSYNC.
Hallvard B Furuseth [Fri, 19 Aug 2011 18:35:25 +0000 (20:35 +0200)]
Wrap O_DSYNC in MDB_DSYNC.

If O_DSYNC is not defined, that may be due to poor compiler options.
We could fall back to the less efficient O_SYNC, but it seems better
to let the user learn of the problem and give better compiler options.

12 years agoSimplify: Replace IDL*_CMP() with CMP()
Hallvard B Furuseth [Fri, 19 Aug 2011 15:27:06 +0000 (17:27 +0200)]
Simplify: Replace IDL*_CMP() with CMP()

12 years agoMacro cleanup: Parenthesize, simplify, remove a ;
Hallvard B Furuseth [Fri, 19 Aug 2011 19:56:10 +0000 (21:56 +0200)]
Macro cleanup: Parenthesize, simplify, remove a ;

12 years agoDrop gcc extension ,##__VA_ARGS__. Add DPUTS().
Hallvard B Furuseth [Fri, 19 Aug 2011 18:18:18 +0000 (20:18 +0200)]
Drop gcc extension ,##__VA_ARGS__.  Add DPUTS().

C99 says DPRINTF(fmt, ...) must get at least 2 args.  Using DPUTS for 1 arg.

12 years agoFix cursor_set for dups
Howard Chu [Fri, 19 Aug 2011 20:57:36 +0000 (13:57 -0700)]
Fix cursor_set for dups

Also make sure dups are counted in md_entries

12 years agoSorted dups fix
Howard Chu [Fri, 19 Aug 2011 20:10:51 +0000 (13:10 -0700)]
Sorted dups fix

Write the first datum normally. Convert to a sub-db if
additional items for the same key are written.

12 years agoDon't alloc in cursor_push/pop
Howard Chu [Fri, 19 Aug 2011 07:14:16 +0000 (00:14 -0700)]
Don't alloc in cursor_push/pop

12 years agoFix multi-page commits
Howard Chu [Fri, 19 Aug 2011 06:09:17 +0000 (23:09 -0700)]
Fix multi-page commits

12 years agoFix overflow page read
Howard Chu [Fri, 19 Aug 2011 04:58:22 +0000 (21:58 -0700)]
Fix overflow page read

12 years agoSub-DB init/dirty fixes
Howard Chu [Fri, 19 Aug 2011 03:28:02 +0000 (20:28 -0700)]
Sub-DB init/dirty fixes

12 years agoFix dupsort fetch
Howard Chu [Fri, 19 Aug 2011 02:30:54 +0000 (19:30 -0700)]
Fix dupsort fetch

12 years agoMore txn/cursor cleanup
Howard Chu [Fri, 19 Aug 2011 02:22:24 +0000 (19:22 -0700)]
More txn/cursor cleanup

12 years agoUpdate DB tables on commit even if no dirty pages
Howard Chu [Fri, 19 Aug 2011 00:38:39 +0000 (17:38 -0700)]
Update DB tables on commit even if no dirty pages

12 years agoAdd mdb_strerror(), mdb_env_set_flags()
Howard Chu [Tue, 16 Aug 2011 23:47:15 +0000 (16:47 -0700)]
Add mdb_strerror(), mdb_env_set_flags()

12 years agoallow silent commit of read-only TXNs
Howard Chu [Tue, 16 Aug 2011 21:23:44 +0000 (14:23 -0700)]
allow silent commit of read-only TXNs