platform/upstream/lmdb.git
12 years agoClean up MAP_FAILED handling in mdb.
Hallvard Furuseth [Fri, 9 Mar 2012 18:06:04 +0000 (19:06 +0100)]
Clean up MAP_FAILED handling in mdb.

Delay (MDB_txninfo*) cast to after comparing mmap() with MAP_FAILED.
Otherwise, if MAP_FAILED = (void*)-1 but MDB_txninfo requires stricter
alignment, the compiler could assume the result is never MAP_FAILED.

Also store NULL in env->(me_map, me_txns) after mmap failure.

12 years agoITS#7191 Align dirty MDB pages on the stack
Hallvard Furuseth [Fri, 9 Mar 2012 17:45:39 +0000 (18:45 +0100)]
ITS#7191 Align dirty MDB pages on the stack

12 years agoITS#7191 more alignment tweaks
Howard Chu [Fri, 9 Mar 2012 05:28:24 +0000 (21:28 -0800)]
ITS#7191 more alignment tweaks

Revealed when gcc optimization is enabled

12 years agoFix typo in 7bc62c512824c0d54cc6885ea876c2764510eca2
Howard Chu [Wed, 7 Mar 2012 06:55:53 +0000 (22:55 -0800)]
Fix typo in 7bc62c512824c0d54cc6885ea876c2764510eca2

12 years agoITS#7190 fix merging of branch pages in deletes
Howard Chu [Wed, 7 Mar 2012 06:12:21 +0000 (22:12 -0800)]
ITS#7190 fix merging of branch pages in deletes

12 years agoFix libmdb comments
Hallvard Furuseth [Sun, 25 Sep 2011 21:36:49 +0000 (23:36 +0200)]
Fix libmdb comments

12 years agoRemove development file libmdb/make.sh
Hallvard Furuseth [Sat, 3 Mar 2012 08:52:33 +0000 (09:52 +0100)]
Remove development file libmdb/make.sh

12 years agoITS#7191 Fix mdb_xcursor_init1() unaligned access
Hallvard Furuseth [Sat, 3 Mar 2012 08:49:20 +0000 (09:49 +0100)]
ITS#7191 Fix mdb_xcursor_init1() unaligned access

12 years agoITS#7196 use IOV_MAX if it's defined and small
Howard Chu [Sat, 3 Mar 2012 01:26:49 +0000 (17:26 -0800)]
ITS#7196 use IOV_MAX if it's defined and small

12 years agoITS#7160 get BYTE_ORDER def for HPUX (and Solaris)
Howard Chu [Tue, 21 Feb 2012 19:52:01 +0000 (11:52 -0800)]
ITS#7160 get BYTE_ORDER def for HPUX (and Solaris)

12 years agoFix typo in e8e57be42107a877f604d0c4e67115ef37681a1b
Howard Chu [Sun, 22 Jan 2012 01:31:23 +0000 (17:31 -0800)]
Fix typo in e8e57be42107a877f604d0c4e67115ef37681a1b

12 years agoAdd valgrind support with -DUSE_VALGRIND
Howard Chu [Sat, 21 Jan 2012 16:22:59 +0000 (08:22 -0800)]
Add valgrind support with -DUSE_VALGRIND

Track allocations and invalid accesses to freed tmp pages.

12 years agotxn_commit must abort txn before returning errors
Howard Chu [Sat, 21 Jan 2012 16:20:43 +0000 (08:20 -0800)]
txn_commit must abort txn before returning errors

Fix for failure when committing a txn that is a child of
some parent txn.

12 years agoITS#7121 fix page splits when newindx == 0
Howard Chu [Sat, 21 Jan 2012 16:18:37 +0000 (08:18 -0800)]
ITS#7121 fix page splits when newindx == 0

12 years agoITS#7126 fix cursor tracking code
Howard Chu [Sat, 21 Jan 2012 16:12:56 +0000 (08:12 -0800)]
ITS#7126 fix cursor tracking code

Don't compare cursors that aren't deep enough to match the
current cursor.

12 years agoHappy New Year!
Howard Chu [Sat, 21 Jan 2012 16:07:56 +0000 (08:07 -0800)]
Happy New Year!

12 years agoITS#7121 fix page splits when data+key size is too large
Howard Chu [Wed, 4 Jan 2012 23:25:18 +0000 (15:25 -0800)]
ITS#7121 fix page splits when data+key size is too large

12 years agoHappy New Year!
Kurt Zeilenga [Sun, 1 Jan 2012 15:07:45 +0000 (07:07 -0800)]
Happy New Year!

12 years agoAdd $(SOLIBS) macro for shared lib dependencies
Howard Chu [Fri, 18 Nov 2011 23:43:55 +0000 (15:43 -0800)]
Add $(SOLIBS) macro for shared lib dependencies

12 years agoMore s/DEBUG/MDB_DEBUG/
Howard Chu [Tue, 15 Nov 2011 19:23:00 +0000 (11:23 -0800)]
More s/DEBUG/MDB_DEBUG/

12 years agoAlignment fixes for debug msgs
Howard Chu [Tue, 15 Nov 2011 00:21:59 +0000 (16:21 -0800)]
Alignment fixes for debug msgs

12 years agos/DEBUG/MDB_DEBUG/
Howard Chu [Mon, 14 Nov 2011 22:40:43 +0000 (14:40 -0800)]
s/DEBUG/MDB_DEBUG/

12 years agoAdd MDB_FDATASYNC to allow override to fsync if needed.
Howard Chu [Fri, 11 Nov 2011 20:49:11 +0000 (12:49 -0800)]
Add MDB_FDATASYNC to allow override to fsync if needed.

12 years agoUse <inttypes.h> instead of <stdint.h>
Howard Chu [Fri, 11 Nov 2011 18:59:27 +0000 (10:59 -0800)]
Use <inttypes.h> instead of <stdint.h>

13 years agoFix size check
Howard Chu [Thu, 10 Nov 2011 20:41:34 +0000 (12:41 -0800)]
Fix size check

13 years agoMore Solaris warning cleanup
Howard Chu [Wed, 9 Nov 2011 23:32:37 +0000 (15:32 -0800)]
More Solaris warning cleanup

13 years agoMore pgno alignment tweaks
Howard Chu [Wed, 9 Nov 2011 08:36:50 +0000 (00:36 -0800)]
More pgno alignment tweaks

13 years agoAdd dummy DKEY define
Howard Chu [Wed, 9 Nov 2011 04:05:29 +0000 (20:05 -0800)]
Add dummy DKEY define

13 years agoAdd Solaris byte-order detection
Howard Chu [Wed, 9 Nov 2011 03:04:39 +0000 (19:04 -0800)]
Add Solaris byte-order detection

13 years agoFix mdb_drop return
Howard Chu [Wed, 9 Nov 2011 00:45:45 +0000 (16:45 -0800)]
Fix mdb_drop return

13 years agoAndroid/ARM portability
Howard Chu [Sat, 15 Oct 2011 05:03:46 +0000 (22:03 -0700)]
Android/ARM portability

2-byte alignment isn't good enough for subpages

13 years agoFix page_split with MDB_RESERVE
Howard Chu [Fri, 7 Oct 2011 01:53:07 +0000 (18:53 -0700)]
Fix page_split with MDB_RESERVE

13 years agoFix subcursor initialization
Howard Chu [Thu, 6 Oct 2011 23:11:25 +0000 (16:11 -0700)]
Fix subcursor initialization

13 years agoDon't use Append mode when splits are caused by sub-page inserts
Howard Chu [Tue, 4 Oct 2011 01:02:17 +0000 (18:02 -0700)]
Don't use Append mode when splits are caused by sub-page inserts

Sub-pages need room to grow...

13 years agoFix freelist bug on page split
Howard Chu [Mon, 3 Oct 2011 19:40:53 +0000 (12:40 -0700)]
Fix freelist bug on page split

NULL out env->pghead before writing it, so that its pages can't be used
to satisfy the write.

13 years agoAdd rudimentary MDB_MULTIPLE support for puts
Howard Chu [Mon, 3 Oct 2011 18:25:31 +0000 (11:25 -0700)]
Add rudimentary MDB_MULTIPLE support for puts

Only for DUPFIXED DBs. Still could do better.

13 years agoAdd MDB_APPEND to avoid splitting full pages
Howard Chu [Mon, 3 Oct 2011 04:27:07 +0000 (21:27 -0700)]
Add MDB_APPEND to avoid splitting full pages

13 years agoFix 6e05ca17e988754ae90fde1921765ba130bb90b2
Howard Chu [Mon, 3 Oct 2011 02:52:12 +0000 (19:52 -0700)]
Fix 6e05ca17e988754ae90fde1921765ba130bb90b2

Missed a MDB_RESERVE case

13 years agoAdd mdb_cursor_txn() and mdb_cursor_dbi() for querying the cursor
Howard Chu [Mon, 3 Oct 2011 02:27:31 +0000 (19:27 -0700)]
Add mdb_cursor_txn() and mdb_cursor_dbi() for querying the cursor

13 years agoAdd MDB_RESERVE mode
Howard Chu [Sun, 2 Oct 2011 17:02:30 +0000 (10:02 -0700)]
Add MDB_RESERVE mode

When putting a record, just make space for the data, don't copy it.
(Not compatible with MDB_DUPSORT, since the actual data is needed
to determine the insert location.)

13 years agoTweak cursor adjustment code
Howard Chu [Sat, 1 Oct 2011 05:15:05 +0000 (22:15 -0700)]
Tweak cursor adjustment code

Skip the original cursor that made the change

13 years agoMake sure mdb_open actually got a sub-db record
Howard Chu [Fri, 30 Sep 2011 04:07:07 +0000 (21:07 -0700)]
Make sure mdb_open actually got a sub-db record

13 years agoDoc for the MDB_NOSUBDIR env option
Howard Chu [Fri, 23 Sep 2011 04:46:12 +0000 (21:46 -0700)]
Doc for the MDB_NOSUBDIR env option

13 years agoAdd MDB_NOSUBDIR option
Howard Chu [Fri, 23 Sep 2011 01:05:06 +0000 (18:05 -0700)]
Add MDB_NOSUBDIR option

Create the data file using exactly the given pathname, and
the lock file using a suffix on the data file name.

13 years agoReader table notes
Howard Chu [Thu, 22 Sep 2011 11:34:40 +0000 (04:34 -0700)]
Reader table notes

13 years agoassert cleanup
Howard Chu [Thu, 22 Sep 2011 00:21:48 +0000 (17:21 -0700)]
assert cleanup

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

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

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

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

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

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

13 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

13 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

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

13 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

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

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

13 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).

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

13 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

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

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

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

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

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

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

13 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

13 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

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

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

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

13 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

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

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

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

13 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().

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

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

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

13 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

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

13 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

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

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

13 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).

13 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

13 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

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

13 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

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

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

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

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

13 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

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

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

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

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

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