mdb:mdb.git
4 years agoDoc tweak LMDB_0.9.10
Howard Chu [Tue, 12 Nov 2013 16:10:33 +0000 (08:10 -0800)]
Doc tweak

Measured perf cost of meminit was 7% worst case on an Intel Core2
system. YMMV.

4 years agoBump to 0.9.10
Howard Chu [Tue, 12 Nov 2013 04:15:54 +0000 (20:15 -0800)]
Bump to 0.9.10

4 years agoWindows/Win64/MSVC tweaks
Howard Chu [Tue, 12 Nov 2013 04:08:26 +0000 (20:08 -0800)]
Windows/Win64/MSVC tweaks

Silence warnings, fix broken MinGW64 definitions, etc.

4 years agoClarify WRITEMAP / NOMEMINIT
Howard Chu [Tue, 12 Nov 2013 00:35:17 +0000 (16:35 -0800)]
Clarify WRITEMAP / NOMEMINIT

4 years agoChange default mem init behavior
Howard Chu [Mon, 11 Nov 2013 23:09:32 +0000 (15:09 -0800)]
Change default mem init behavior

Init malloc'd memory by default, use #MDB_NOMEMINIT to disable.
Bump version to 0.9.10

4 years agoAdd MDB_CLEANMEM option.
Hallvard Furuseth [Thu, 7 Nov 2013 22:41:30 +0000 (23:41 +0100)]
Add MDB_CLEANMEM option.

Initialize unused portions of DB pages, for security or to silence
checkers like Purify and Valgrind. Like BDB configure --enable-umrw.

4 years agoFix MDB_MAXKEYSIZE doc: Account for MDB_DUPSORT.
Hallvard Furuseth [Thu, 7 Nov 2013 22:38:15 +0000 (23:38 +0100)]
Fix MDB_MAXKEYSIZE doc: Account for MDB_DUPSORT.

A node may need room for [key, subpage with 2 items] = 3 keys.

4 years agoITS#7713 Handle bigger OS page sizes
Hallvard Furuseth [Thu, 7 Nov 2013 22:38:15 +0000 (23:38 +0100)]
ITS#7713 Handle bigger OS page sizes

Use DB page size = min(32k, OS pagesize).  Previous limit was 8k
(MDB_MINKEYS*MDB_PAGESIZE).

Handle DB pagesize < OS pagesize. That's an I/O pessimization,
but transactions remain atomic: Only writing the MDB_meta must
be atomic, and it fits in one OS page.

Don't truncate desired subpage size: Asssign it to a size_t
(mv_size), not an uint16_t (mp_upper).

4 years agomdb_cursor_put(): Factor out code. Kill a label.
Hallvard Furuseth [Thu, 7 Nov 2013 22:38:15 +0000 (23:38 +0100)]
mdb_cursor_put(): Factor out code. Kill a label.

4 years agoFix prev commit, cursor depth comparison
Howard Chu [Thu, 7 Nov 2013 17:37:48 +0000 (09:37 -0800)]
Fix prev commit, cursor depth comparison

4 years agoFix cursor_del0 cursor fixup
Howard Chu [Thu, 7 Nov 2013 00:49:25 +0000 (16:49 -0800)]
Fix cursor_del0 cursor fixup

Skip cursors that aren't as deep as current cursor

4 years agoMore for #7589
Howard Chu [Tue, 5 Nov 2013 04:00:55 +0000 (20:00 -0800)]
More for #7589

4 years agoITS#7589 another mdb_page_split fix
Howard Chu [Fri, 1 Nov 2013 00:31:15 +0000 (17:31 -0700)]
ITS#7589 another mdb_page_split fix

Tweak split_indx check, go one slot further.

4 years agoITS#7736 fix regression in ITS#7733 patch
Howard Chu [Thu, 31 Oct 2013 23:01:04 +0000 (16:01 -0700)]
ITS#7736 fix regression in ITS#7733 patch

In d8eccb353b1be7f07e74149dde9a41bb199d74e8

4 years agoITS#7733 check cursor index before cursor_del
Howard Chu [Mon, 28 Oct 2013 14:25:54 +0000 (07:25 -0700)]
ITS#7733 check cursor index before cursor_del

4 years agoITS#7734 Add MDB_NORDAHEAD to CHANGELESS.
David Wilson [Mon, 28 Oct 2013 13:58:04 +0000 (06:58 -0700)]
ITS#7734 Add MDB_NORDAHEAD to CHANGELESS.

4 years agoBump to 0.9.9 LMDB_0.9.9
Howard Chu [Thu, 24 Oct 2013 22:57:17 +0000 (15:57 -0700)]
Bump to 0.9.9

4 years agoAdd mdb_env_get_fd()
Howard Chu [Mon, 21 Oct 2013 17:29:38 +0000 (10:29 -0700)]
Add mdb_env_get_fd()

Return the environment's filedescriptor. Useful when the caller
is doing their own locking.

5 years agoFix 01dfb2083dd690707a062cabb03801bfad1a6859
Howard Chu [Mon, 14 Oct 2013 16:47:26 +0000 (09:47 -0700)]
Fix 01dfb2083dd690707a062cabb03801bfad1a6859

USE_POSIX_SEM must define USE_HASH

5 years agoITS#7725 add MDB_NORDAHEAD flag for env_open
Howard Chu [Sat, 12 Oct 2013 23:20:04 +0000 (16:20 -0700)]
ITS#7725 add MDB_NORDAHEAD flag for env_open

5 years agoITS#7589 silence warnings
Howard Chu [Sat, 12 Oct 2013 20:40:28 +0000 (13:40 -0700)]
ITS#7589 silence warnings

5 years agoITS#7589 Fix typo in prev commit
Howard Chu [Sat, 12 Oct 2013 20:31:09 +0000 (13:31 -0700)]
ITS#7589 Fix typo in prev commit

5 years agoITS#7589 Cleanup unneeded vars in prev patch
Howard Chu [Sat, 12 Oct 2013 20:19:33 +0000 (13:19 -0700)]
ITS#7589 Cleanup unneeded vars in prev patch

5 years agoITS#7589 avoid wasting space in mdb_page_split
Howard Chu [Sat, 12 Oct 2013 16:34:40 +0000 (09:34 -0700)]
ITS#7589 avoid wasting space in mdb_page_split

Also, check the split point on branch pages as well as leaf pages.

5 years agoAdd MDB_USE_HASH
Howard Chu [Fri, 4 Oct 2013 17:22:14 +0000 (10:22 -0700)]
Add MDB_USE_HASH

There may be other uses for it besides semaphore names.

5 years agoITS#7722 fix page_merge for collapsing root
Howard Chu [Wed, 9 Oct 2013 09:24:45 +0000 (02:24 -0700)]
ITS#7722 fix page_merge for collapsing root

Other cursors being fixed up are not necessarily height 1.

5 years agoITS#7718 invalidate cursor when DB gets emptied
Howard Chu [Tue, 8 Oct 2013 11:43:58 +0000 (04:43 -0700)]
ITS#7718 invalidate cursor when DB gets emptied

5 years agoFix mdb_env_set_mapsize()
Howard Chu [Fri, 4 Oct 2013 09:55:34 +0000 (02:55 -0700)]
Fix mdb_env_set_mapsize()

Don't allow shrinking below minimum size for an already open env.

5 years agoITS#7715 always set filesize for WRITEMAP
Howard Chu [Fri, 4 Oct 2013 09:46:38 +0000 (02:46 -0700)]
ITS#7715 always set filesize for WRITEMAP

5 years agoAdd Caveat: Readers need write access. Whitespace.
Hallvard Furuseth [Thu, 3 Oct 2013 22:48:19 +0000 (00:48 +0200)]
Add Caveat: Readers need write access. Whitespace.

5 years agoMaintain MDB_cursor.mc_top
Hallvard Furuseth [Thu, 3 Oct 2013 21:59:25 +0000 (23:59 +0200)]
Maintain MDB_cursor.mc_top

5 years agomdb_cursor_sibling(): Fix error result
Hallvard Furuseth [Thu, 3 Oct 2013 21:59:25 +0000 (23:59 +0200)]
mdb_cursor_sibling(): Fix error result

5 years agomdb_node_add(): Plug page leak when MDB_PAGE_FULL.
Hallvard Furuseth [Thu, 3 Oct 2013 21:59:25 +0000 (23:59 +0200)]
mdb_node_add(): Plug page leak when MDB_PAGE_FULL.

Do not fail after mdb_page_new() succeeds.

5 years agoOptimize code holding reader mutex
Hallvard Furuseth [Thu, 3 Oct 2013 21:59:24 +0000 (23:59 +0200)]
Optimize code holding reader mutex

5 years agoSet MDB_xcursor DB_DIRTY, clear md_name.
Hallvard Furuseth [Thu, 3 Oct 2013 21:59:24 +0000 (23:59 +0200)]
Set MDB_xcursor DB_DIRTY, clear md_name.

Both were unused and md_name was unmaintained -- except
mdb_cursor_touch(xcursor) would abuse md_name as a key to
touch MAIN_DBI if it could somehow get passed ! DB_DIRTY.

5 years agoSet subDB DBI=parent DBI, fix MDB_DUPSORT delete.
Hallvard Furuseth [Thu, 3 Oct 2013 21:59:24 +0000 (23:59 +0200)]
Set subDB DBI=parent DBI, fix MDB_DUPSORT delete.

xcursor DBIs were parent DBI+1 for debugging. Instead output
-(parent DBI).  Fixes a crash in mdb_cursor_del0()'s xcursor
tracking, it forgot to subtract 1 for C_SUB cursors.

5 years agos/MDB_NORDLOCK/MDB_NOLOCK/
Howard Chu [Thu, 3 Oct 2013 17:26:44 +0000 (10:26 -0700)]
s/MDB_NORDLOCK/MDB_NOLOCK/

Leave all lock management to the caller.

5 years agoMore doc for MDB_NORDLOCK
Howard Chu [Wed, 2 Oct 2013 06:36:57 +0000 (23:36 -0700)]
More doc for MDB_NORDLOCK

5 years agoAdd MDB_NORDLOCK to omit all reader table usage
Howard Chu [Tue, 1 Oct 2013 20:16:38 +0000 (13:16 -0700)]
Add MDB_NORDLOCK to omit all reader table usage

Calling app wants to manage its own locking.

5 years agoDrop unneeded code.
Hallvard Furuseth [Mon, 23 Sep 2013 18:21:11 +0000 (20:21 +0200)]
Drop unneeded code.

MDB_txn.mt_toggle: Use (mt_txnid & 1) instead.
Drop error checks which will be repeated.
mdb_cursor_set(): Turn assert into if/return to match the above.
mdb_cursor_del(): 'flags' are now used as bitflags.

5 years agoClean up and simplify mdb_page_search().
Hallvard Furuseth [Mon, 23 Sep 2013 18:21:11 +0000 (20:21 +0200)]
Clean up and simplify mdb_page_search().

Only named DBs can have DB_STALE, and they do not use MDB_PS_MODIFY.
Replace magic key values with flags.  Drop duplicated comments at
mdb_page_search_root() vs. mdb_page_search(), and rephrase.

5 years agoTweak MDB_DEBUG output
Hallvard Furuseth [Mon, 23 Sep 2013 18:20:42 +0000 (20:20 +0200)]
Tweak MDB_DEBUG output

5 years agoRename SWAP() to avoid conflict with sqlightning.
Hallvard Furuseth [Mon, 23 Sep 2013 18:20:05 +0000 (20:20 +0200)]
Rename SWAP() to avoid conflict with sqlightning.

Happened since sqlightning #includes mdb.c, midl.c.

5 years agomdb_page_unspill(): Rename local vars.
Hallvard Furuseth [Mon, 23 Sep 2013 18:13:27 +0000 (20:13 +0200)]
mdb_page_unspill(): Rename local vars.

The names have caused bugs, "txn" was treated as
the current transaction.

5 years agoITS#7515 Fix mdb_page_unspill() in nested txn.
Hallvard Furuseth [Mon, 23 Sep 2013 18:13:27 +0000 (20:13 +0200)]
ITS#7515 Fix mdb_page_unspill() in nested txn.

Malloc a page in this txn, not in a parent.

5 years agoITS#7515 Fix mdb_txn_commit(nested txn with spills).
Hallvard Furuseth [Mon, 23 Sep 2013 18:13:27 +0000 (20:13 +0200)]
ITS#7515 Fix mdb_txn_commit(nested txn with spills).

Catch malloc error.
Fix hunt for dirty vs spilled pages: Don't leave x at a deleted pageno.
Cleanup: Factor out variables, squash pages already marked for deletion.

5 years agoITS#7515 Fix mt_dirty_room in nested txns.
Hallvard Furuseth [Mon, 23 Sep 2013 18:13:27 +0000 (20:13 +0200)]
ITS#7515 Fix mt_dirty_room in nested txns.

Fix description & code: Also ignore dirty pages hidden by
spilled pages, as they won't merge into our dirty_list.
Update it in mdb_page_flush() instead of mdb_page_spill().

5 years agoITS#7515 mdb_pages_xkeep(): Careful about xcursors.
Hallvard Furuseth [Mon, 23 Sep 2013 18:13:27 +0000 (20:13 +0200)]
ITS#7515 mdb_pages_xkeep(): Careful about xcursors.

Don't prod sub-pages or pages referring to uninitialized xcursors.

5 years agomdb_pages_xkeep(): Reformat, use common flag mask
Hallvard Furuseth [Mon, 23 Sep 2013 18:13:27 +0000 (20:13 +0200)]
mdb_pages_xkeep(): Reformat, use common flag mask

5 years agoUpdate MDB documentation and comments.
Hallvard Furuseth [Mon, 23 Sep 2013 18:09:47 +0000 (20:09 +0200)]
Update MDB documentation and comments.

5 years agoITS#7682 mdb_env_copy(): Avoid Linux O_DIRECT bug.
Hallvard Furuseth [Mon, 23 Sep 2013 18:07:29 +0000 (20:07 +0200)]
ITS#7682 mdb_env_copy(): Avoid Linux O_DIRECT bug.

Use fcntl() to set the flag.  Linux open(,O_DIRECT...) can create
the file even on failure, if the filesystem lacks O_DIRECT support.

5 years agoITS#7681 fix 18a07eb7c2dc33372455a6040984cd6b699b41a5
Howard Chu [Sun, 15 Sep 2013 20:08:29 +0000 (13:08 -0700)]
ITS#7681 fix 18a07eb7c2dc33372455a6040984cd6b699b41a5

Set rc=0 when taking the SET_RANGE branch

5 years agoITS#7701 fix mdb_rebalance
Howard Chu [Sat, 21 Sep 2013 21:37:11 +0000 (14:37 -0700)]
ITS#7701 fix mdb_rebalance

Must copy tmp cursor back to real cursor when merging into tmp cursor.

5 years agoRelease 0.9.8 LMDB_0.9.8
Howard Chu [Mon, 9 Sep 2013 15:29:46 +0000 (08:29 -0700)]
Release 0.9.8

5 years agoupdates
Howard Chu [Thu, 5 Sep 2013 23:23:49 +0000 (16:23 -0700)]
updates

5 years agoITS#7682 In mdb_env_copy retry open if O_DIRECT fails
Salvador Ortiz [Thu, 5 Sep 2013 22:36:52 +0000 (17:36 -0500)]
ITS#7682 In mdb_env_copy retry open if O_DIRECT fails

5 years agoMore for 5f6fa8c04204888c4ff7ac6be1868d81ff4410a8
Howard Chu [Thu, 5 Sep 2013 13:02:07 +0000 (06:02 -0700)]
More for 5f6fa8c04204888c4ff7ac6be1868d81ff4410a8

Reset delete flag in cursor_put().

5 years agoITS#7681 fix mdb_cursor_set behaviour for MDB_SET_RANGE
Claude Brisson [Thu, 5 Sep 2013 10:58:18 +0000 (12:58 +0200)]
ITS#7681 fix mdb_cursor_set behaviour for MDB_SET_RANGE

5 years agoRemember if last cursor op was a delete
Howard Chu [Tue, 3 Sep 2013 23:10:20 +0000 (16:10 -0700)]
Remember if last cursor op was a delete

If so, don't advance cursor on next NEXT. Also, init xcursor
on the next GET_CURRENT.

5 years agoAdd a changelog
Howard Chu [Thu, 29 Aug 2013 03:22:41 +0000 (20:22 -0700)]
Add a changelog

5 years agoBump version to 0.9.8
Howard Chu [Thu, 29 Aug 2013 02:17:25 +0000 (19:17 -0700)]
Bump version to 0.9.8

5 years agoAllow mdb_env_set_mapsize() on an open environment
Howard Chu [Thu, 29 Aug 2013 02:12:59 +0000 (19:12 -0700)]
Allow mdb_env_set_mapsize() on an open environment

The caller is responsible for making sure no transactions are
active in this process before resizing. This is slightly lighter
weight than doing a full env_close/env_open cycle.

5 years agoITS#7672 fix mdb_dbi_flags
Howard Chu [Tue, 27 Aug 2013 13:28:30 +0000 (06:28 -0700)]
ITS#7672 fix mdb_dbi_flags

Use a txn instead of env argument. Only return persistent flags.

5 years agomdb_page_unspill(): Fix dirty_room in nested txn
Hallvard Furuseth [Sun, 25 Aug 2013 21:59:58 +0000 (23:59 +0200)]
mdb_page_unspill(): Fix dirty_room in nested txn

5 years agoAnother take on spill_pgs and deletes
Howard Chu [Sat, 24 Aug 2013 19:37:45 +0000 (20:37 +0100)]
Another take on spill_pgs and deletes

5 years agoCleanup prev commit
Howard Chu [Sat, 24 Aug 2013 18:54:05 +0000 (11:54 -0700)]
Cleanup prev commit

5 years agoSpeedup deletion from spill_pgs
Howard Chu [Sat, 24 Aug 2013 18:48:37 +0000 (19:48 +0100)]
Speedup deletion from spill_pgs

5 years agoITS#7671 always return the key for a dup val
Howard Chu [Fri, 23 Aug 2013 14:36:07 +0000 (07:36 -0700)]
ITS#7671 always return the key for a dup val

5 years agoITS#7670 Tweak cursor_del0
Howard Chu [Fri, 23 Aug 2013 04:43:29 +0000 (21:43 -0700)]
ITS#7670 Tweak cursor_del0

Always leave cursor pointing at "next" node, if any.
Find next sibling if we're already at end of current page.

5 years agomdb_page_spill(): Fix nested txn mt_dirty_room
Hallvard Furuseth [Fri, 23 Aug 2013 05:39:04 +0000 (07:39 +0200)]
mdb_page_spill(): Fix nested txn mt_dirty_room

5 years agoSimplify last commits
Hallvard Furuseth [Fri, 23 Aug 2013 05:37:17 +0000 (07:37 +0200)]
Simplify last commits

5 years agoTweak prev commit
Howard Chu [Fri, 23 Aug 2013 04:29:53 +0000 (21:29 -0700)]
Tweak prev commit

If somehow "need" is larger than the list size, don't
try to fake out the dirty list.

5 years agoLess aggressive page_spill
Howard Chu [Fri, 23 Aug 2013 01:51:48 +0000 (18:51 -0700)]
Less aggressive page_spill

spilling all possible pages is a waste because the majority will be
needed again. Just do 1/8th of the dirty list instead.

5 years agoUpdate caveats now that mdb_reader_check exists
Howard Chu [Wed, 21 Aug 2013 00:37:53 +0000 (17:37 -0700)]
Update caveats now that mdb_reader_check exists

5 years agoSilence warnings LMDB_0.9.7
Howard Chu [Wed, 14 Aug 2013 16:57:25 +0000 (09:57 -0700)]
Silence warnings

5 years agoTweak ITS#7615 fix: Obey strict-aliasing rules.
Hallvard Furuseth [Wed, 14 Aug 2013 13:21:59 +0000 (15:21 +0200)]
Tweak ITS#7615 fix: Obey strict-aliasing rules.

Do not access a long long as an array of longs.

5 years agoITS#7664 better fix
Howard Chu [Tue, 13 Aug 2013 20:12:47 +0000 (13:12 -0700)]
ITS#7664 better fix

For RDONLY, don't get lockfile until we know datafile exists.
Also, don't try to create a new datafile for me_mfd if someone
deleted it after we got me_fd.

5 years agoRevert "ITS#7664 delete lockfile if there is no environment"
Howard Chu [Tue, 13 Aug 2013 20:05:32 +0000 (13:05 -0700)]
Revert "ITS#7664 delete lockfile if there is no environment"

This reverts commit 8725838409512e999d78ea7b60773ce2f94d588f.

5 years agoITS#7664 delete lockfile if there is no environment
Howard Chu [Tue, 13 Aug 2013 18:34:32 +0000 (11:34 -0700)]
ITS#7664 delete lockfile if there is no environment

5 years agoFix uninit'd mem ref in mdb_page_split
Howard Chu [Mon, 12 Aug 2013 19:43:42 +0000 (12:43 -0700)]
Fix uninit'd mem ref in mdb_page_split

Don't compare cursors beyond their depth. (detected by valgrind)

5 years agoTweak NODUPDATA flag check
Howard Chu [Mon, 12 Aug 2013 00:25:00 +0000 (17:25 -0700)]
Tweak NODUPDATA flag check

Should allow for the possibility of future flag combos.

5 years agoFix obscure MDB_MULTIPLE bug
Howard Chu [Mon, 12 Aug 2013 00:15:03 +0000 (17:15 -0700)]
Fix obscure MDB_MULTIPLE bug

If a key has a single existing value, and then a put (MDB_MULTIPLE)
is done where the first of the multiple values matches the existing
value, the put would return SUCCESS without writing any of the
values. Fixed to loop to the next value as intended.

5 years agoPoint to mdb.c for docs on macros in Makefile
Howard Chu [Sat, 10 Aug 2013 21:55:51 +0000 (14:55 -0700)]
Point to mdb.c for docs on macros in Makefile

5 years agoAvoid compiling debug args with C90 compilers.
Hallvard Furuseth [Sat, 10 Aug 2013 11:50:10 +0000 (13:50 +0200)]
Avoid compiling debug args with C90 compilers.

Use double DPRINTF() parenthesis, so varargs macros are not needed.
Parenthesize MDB_DEBUG, in case the user defines it as foo || bar.

5 years agoRefuse ops on bad txns
Hallvard Furuseth [Sat, 10 Aug 2013 11:23:30 +0000 (13:23 +0200)]
Refuse ops on bad txns

5 years agoReplace EINVALs with generalized MDB_INCOMPATIBLE.
Hallvard Furuseth [Sat, 10 Aug 2013 11:23:30 +0000 (13:23 +0200)]
Replace EINVALs with generalized MDB_INCOMPATIBLE.

Also check xcursor instead of DUPSORT, it's slightly briefer.

5 years agoITS#7656 fix install target
John Hewson [Sat, 10 Aug 2013 11:12:42 +0000 (04:12 -0700)]
ITS#7656 fix install target

5 years agoITS#7660 Add mdb_txn_env to API
Salvador Ortiz [Fri, 9 Aug 2013 16:03:28 +0000 (11:03 -0500)]
ITS#7660 Add mdb_txn_env to API

5 years agomdb_txn_commit(): Always commit if MDB_TXN_SPILLS.
Hallvard Furuseth [Sat, 10 Aug 2013 10:29:45 +0000 (12:29 +0200)]
mdb_txn_commit(): Always commit if MDB_TXN_SPILLS.

Checking dirty_list was insufficient after a spill
with no named databases and no positioned cursors.

5 years agoITS#7661 mdb_dbi_flags(): Allow main DBI
Salvador Ortiz [Sat, 10 Aug 2013 07:42:19 +0000 (09:42 +0200)]
ITS#7661 mdb_dbi_flags(): Allow main DBI

5 years agomdb_del must ignore data if db not opened with MDB_DUPSORT
Salvador Ortiz [Fri, 9 Aug 2013 15:08:53 +0000 (10:08 -0500)]
mdb_del must ignore data if db not opened with MDB_DUPSORT

5 years agoAdd mdb_env_get_maxkeysize()
Howard Chu [Fri, 9 Aug 2013 11:51:33 +0000 (04:51 -0700)]
Add mdb_env_get_maxkeysize()

5 years agoReplace unpredictable EINVAL error returns.
Hallvard Furuseth [Fri, 9 Aug 2013 11:05:14 +0000 (13:05 +0200)]
Replace unpredictable EINVAL error returns.

Return EINVAL only for simple programmer errors.

5 years agoRe-fix reader-pid code
Hallvard Furuseth [Fri, 9 Aug 2013 10:54:42 +0000 (12:54 +0200)]
Re-fix reader-pid code

5 years agomdb_cursorpages_mark: Mark current txn and no more.
Hallvard Furuseth [Thu, 8 Aug 2013 17:57:52 +0000 (19:57 +0200)]
mdb_cursorpages_mark: Mark current txn and no more.

Ignore parent txn cursors since it is the current txn's dirty_list
which will be flushed. But check the current txn also when clearing,
since cursors can have pages which are dirty in a parent.

Check !mc_xcursor instead of !MDB_DUPSORT.  Equivalent for valid
data, but a bit safer if the sub-DB flags are corrupt.

5 years agoFix mdb_ovpage_free() vs. spill.
Hallvard Furuseth [Thu, 8 Aug 2013 17:57:52 +0000 (19:57 +0200)]
Fix mdb_ovpage_free() vs. spill.

Ensure me_pghead has room before removing from spill/dirty list.
Don't return pages to me_pghead in nested txns, use mt_free_pgs.

5 years agoFix page spilling when MDB_WRITEMAP.
Hallvard Furuseth [Thu, 8 Aug 2013 17:57:51 +0000 (19:57 +0200)]
Fix page spilling when MDB_WRITEMAP.

mdb_page_spill(): Don't binary-search the unsorted dirty_list.
mdb_page_flush(): Don't overwrite unprocessed dirty_list items.

5 years agoSet MDB_TXN_ERROR when inconsistent txn state
Hallvard Furuseth [Thu, 8 Aug 2013 17:57:51 +0000 (19:57 +0200)]
Set MDB_TXN_ERROR when inconsistent txn state

5 years agoFactor out MDB_env.
Hallvard Furuseth [Thu, 8 Aug 2013 17:54:54 +0000 (19:54 +0200)]
Factor out MDB_env.

5 years agoMDB_LOCK_VERSION -> MDB_LOCK_FORMAT.
Hallvard Furuseth [Thu, 8 Aug 2013 17:43:04 +0000 (19:43 +0200)]
MDB_LOCK_VERSION -> MDB_LOCK_FORMAT.

Pid locking needs a different lockfile-version: MDB_env's with and
without pid locking must not coexist, they can sabotage each other.
Store MDB_LOCK_FORMAT = (version | "use locking" flag) instead.