Howard Chu
84acc0e803
ITS#7219 fixup keysize in previous commit
2012-04-04 05:44:53 -07:00
Howard Chu
0f10814494
ITS#7219 fix for odd-aligned keys in mdb_update_key()
2012-04-03 12:24:27 -07:00
Howard Chu
91bab157f6
ITS#7210 fix leak of overflow pages in freelist
2012-03-30 06:36:02 -07:00
Howard Chu
f53beeabee
Partial revert of prev commit
...
Sub-DBs were correct before
2012-03-28 10:44:18 -07:00
Howard Chu
ac0b18911b
Fix entry counts in cursor_put
...
when replacing an existing item
2012-03-28 10:34:35 -07:00
Howard Chu
0952cfdf84
Fix uninit'd xcursor index
2012-03-28 09:33:06 -07:00
Howard Chu
5c16c8842b
Add mfree utility to show the freelist
2012-03-28 09:20:18 -07:00
Howard Chu
04f488e7a0
ITS#7210 additional freelist fixes
...
Also allow read access to freelist in mdb_cursor_open
2012-03-28 09:18:00 -07:00
Howard Chu
b92af0760b
ITS#7210 partial fix
...
Allow pages from free list to be used when growing the free list.
(Yes, this is self-referential...)
2012-03-27 06:44:28 -07:00
Howard Chu
8a4981d8aa
ITS#7213 fix page_split with MDB_APPEND
...
don't skip the cursor adjust checks
2012-03-26 06:58:16 -07:00
Howard Chu
25e8e82c5f
Update overflow page count when freeing overflow page
2012-03-20 17:14:59 -07:00
Hallvard Furuseth
c7da506dd2
Fix MDB_txninfo.mt2 padding on Windows/Apple
2012-03-09 19:30:34 +01:00
Hallvard Furuseth
c7fe1f466e
Tweak mdb comment with conflicting spec of 'ID'
2012-03-09 19:25:44 +01:00
Hallvard Furuseth
5c182fbedf
Fix valgrind call after malloc failure in mdb.
...
Also line up the code logic a bit.
2012-03-09 19:22:31 +01:00
Hallvard Furuseth
d3b9939e71
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.
2012-03-09 19:06:04 +01:00
Hallvard Furuseth
2baadabdff
ITS#7191 Align dirty MDB pages on the stack
2012-03-09 18:45:39 +01:00
Howard Chu
15f3e650da
ITS#7191 more alignment tweaks
...
Revealed when gcc optimization is enabled
2012-03-08 21:28:24 -08:00
Howard Chu
2ccf0d58b2
Fix typo in 7bc62c5128
2012-03-06 22:55:53 -08:00
Howard Chu
7bc62c5128
ITS#7190 fix merging of branch pages in deletes
2012-03-06 22:12:21 -08:00
Hallvard Furuseth
d50d57ed63
Fix libmdb comments
2012-03-03 09:58:05 +01:00
Hallvard Furuseth
e1b88d93ac
Remove development file libmdb/make.sh
2012-03-03 09:52:33 +01:00
Hallvard Furuseth
d8b4598085
ITS#7191 Fix mdb_xcursor_init1() unaligned access
2012-03-03 09:49:20 +01:00
Howard Chu
1b07b48c1a
ITS#7196 use IOV_MAX if it's defined and small
2012-03-02 17:26:49 -08:00
Howard Chu
b23bb7a0b1
ITS#7160 get BYTE_ORDER def for HPUX (and Solaris)
2012-02-21 11:52:01 -08:00
Howard Chu
953796759e
Fix typo in e8e57be421
2012-01-21 17:31:23 -08:00
Howard Chu
e8e57be421
Add valgrind support with -DUSE_VALGRIND
...
Track allocations and invalid accesses to freed tmp pages.
2012-01-21 08:22:59 -08:00
Howard Chu
3d6b924c25
txn_commit must abort txn before returning errors
...
Fix for failure when committing a txn that is a child of
some parent txn.
2012-01-21 08:20:43 -08:00
Howard Chu
1c8de1883c
ITS#7121 fix page splits when newindx == 0
2012-01-21 08:18:37 -08:00
Howard Chu
b9cbcb0588
ITS#7126 fix cursor tracking code
...
Don't compare cursors that aren't deep enough to match the
current cursor.
2012-01-21 08:12:56 -08:00
Howard Chu
713bf092b6
Happy New Year!
2012-01-21 08:09:16 -08:00
Howard Chu
a17f8e7326
ITS#7121 fix page splits when data+key size is too large
2012-01-21 08:09:16 -08:00
Kurt Zeilenga
81afbb2fca
Happy New Year!
2012-01-21 08:07:21 -08:00
Howard Chu
95a72ac82a
Add $(SOLIBS) macro for shared lib dependencies
2011-11-18 15:43:55 -08:00
Howard Chu
dd9c56f0fb
More s/DEBUG/MDB_DEBUG/
2011-11-15 11:23:00 -08:00
Howard Chu
575691ca8a
Alignment fixes for debug msgs
2011-11-14 16:21:59 -08:00
Howard Chu
51c1ba6818
s/DEBUG/MDB_DEBUG/
2011-11-14 14:40:43 -08:00
Howard Chu
29de655bc4
Add MDB_FDATASYNC to allow override to fsync if needed.
2011-11-11 12:49:11 -08:00
Howard Chu
291c0ce2db
Use <inttypes.h> instead of <stdint.h>
2011-11-11 10:59:27 -08:00
Howard Chu
8763c41e30
Fix size check
2011-11-10 12:41:34 -08:00
Howard Chu
04b522cc72
More Solaris warning cleanup
2011-11-09 15:32:37 -08:00
Howard Chu
68143e4532
More pgno alignment tweaks
2011-11-09 00:36:50 -08:00
Howard Chu
690792c170
Add dummy DKEY define
2011-11-08 20:05:29 -08:00
Howard Chu
cc7a89cd67
Add Solaris byte-order detection
2011-11-08 19:04:39 -08:00
Howard Chu
f0c9d77326
Fix mdb_drop return
2011-11-08 16:45:45 -08:00
Howard Chu
a103a64434
Android/ARM portability
...
2-byte alignment isn't good enough for subpages
2011-10-14 22:03:46 -07:00
Howard Chu
331bf92df5
Fix page_split with MDB_RESERVE
2011-10-06 18:53:07 -07:00
Howard Chu
19e4df476d
Fix subcursor initialization
2011-10-06 16:12:52 -07:00
Howard Chu
934a19553c
Don't use Append mode when splits are caused by sub-page inserts
...
Sub-pages need room to grow...
2011-10-03 18:02:17 -07:00
Howard Chu
ea0d07ffa3
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.
2011-10-03 12:40:53 -07:00
Howard Chu
85bfb3c1d1
Add rudimentary MDB_MULTIPLE support for puts
...
Only for DUPFIXED DBs. Still could do better.
2011-10-03 11:28:14 -07:00
Howard Chu
fa3c2945f5
Add MDB_APPEND to avoid splitting full pages
2011-10-02 21:27:07 -07:00
Howard Chu
163514e470
Fix 6e05ca17e9
...
Missed a MDB_RESERVE case
2011-10-02 19:52:12 -07:00
Howard Chu
28b8aaeb96
Add mdb_cursor_txn() and mdb_cursor_dbi() for querying the cursor
2011-10-02 19:28:33 -07:00
Howard Chu
6e05ca17e9
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.)
2011-10-02 10:02:30 -07:00
Howard Chu
fe11433619
Tweak cursor adjustment code
...
Skip the original cursor that made the change
2011-09-30 22:15:05 -07:00
Howard Chu
19d1e72bbc
Make sure mdb_open actually got a sub-db record
2011-09-29 21:07:07 -07:00
Howard Chu
fa0d64242b
Doc for the MDB_NOSUBDIR env option
2011-09-22 21:46:12 -07:00
Howard Chu
7a40080dd1
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.
2011-09-22 18:05:06 -07:00
Howard Chu
54eb76cc7a
Reader table notes
2011-09-22 04:34:40 -07:00
Howard Chu
4bcaabecf5
assert cleanup
2011-09-21 17:21:48 -07:00
Howard Chu
619e671f1c
txn_abort/commit free all their cursors now.
2011-09-21 16:37:29 -07:00
Howard Chu
9bcc51ef5d
Only free malloc'd cursors
2011-09-21 16:06:52 -07:00
Howard Chu
b9d13a29e6
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.
2011-09-21 15:55:27 -07:00
Howard Chu
c4d5e6e786
Add support for nested transactions.
2011-09-21 12:58:43 -07:00
Hallvard Furuseth
8fa10ae668
libmdb IDL cleanup.
...
Microoptimize IDL search.
Use RANGE_<FIRST/LAST> when IDL is known to be a range.
2011-09-19 10:27:49 +02:00
Howard Chu
02abfb91ba
Additional fix for prev commit
2011-09-18 18:26:54 -07:00
Howard Chu
4272e7de4f
Make sure 2 subpages fit in one real page
2011-09-18 18:13:23 -07:00
Howard Chu
237fabda64
Fix last delete from a subpage
2011-09-18 17:07:47 -07:00
Howard Chu
0ab841598f
Fix 09006ccec7
...
Check for stale DBs was in the wrong place.
2011-09-18 16:39:18 -07:00
Howard Chu
2c70d0430a
Fix mdb_drop() if not deleting the DB record
2011-09-18 14:22:27 -07:00
Howard Chu
77b1017b85
Fix typo, minor cleanup
2011-09-18 14:12:49 -07:00
Howard Chu
57b5fbea49
Add mdb_drop() for deleting a DB
...
Allow MIDLs to grow arbitrarily, to allow unlimited number of
pages to be freed in one txn.
2011-09-18 12:37:02 -07:00
Howard Chu
09006ccec7
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).
2011-09-18 10:48:12 -07:00
Howard Chu
b7057eb61e
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.
2011-09-17 03:33:07 -07:00
Howard Chu
0a28548131
Use FNV-1A hash to generate unique mutex names
...
For Windows and MacOSX
2011-09-15 10:36:15 -07:00
Howard Chu
2c033676ea
Doc tweak - txn flags
2011-09-14 20:33:09 -07:00
Howard Chu
5b7c983a66
MacOSX semaphore names are limited to 31 chars
...
Including the terminating NUL. Good job documenting that, guys.
2011-09-14 20:30:26 -07:00
Howard Chu
0533f80364
Add MacOSX support
...
mmap() with FIXEDMAP fails, otherwise things work.
2011-09-14 11:31:27 -07:00
Howard Chu
e222506b88
Minor doc cleanup
2011-09-14 01:46:08 -07:00
Howard Chu
9e3e7cefd8
More docs
2011-09-14 01:08:01 -07:00
Howard Chu
71a665aa9d
Namespace cleanup
2011-09-13 23:36:41 -07:00
Howard Chu
56fe0d4f1a
Tweak search_node inner loop to avoid LEAF2 checks
2011-09-13 13:42:02 -07:00
Howard Chu
70c79df1df
cursor_set/search_node tweaks, use intcmp when possible
2011-09-13 13:41:40 -07:00
Howard Chu
dc83777ab9
Minor tweaks, update relfunc behavior
2011-09-12 01:15:22 -07:00
Howard Chu
25529a4c36
More cursor_init cleanup
2011-09-11 23:57:17 -07:00
Howard Chu
8acb755034
One more sub-cursor fix
2011-09-11 23:13:36 -07:00
Howard Chu
92a63ff790
Merge branch 'mdb.master' of ssh://git-master.openldap.org/~git/git/openldap into mdb.master
2011-09-11 22:23:35 -07:00
Howard Chu
3501248548
Fix 2e3bc39fa9
...
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.
2011-09-11 22:17:10 -07:00
Hallvard Furuseth
946b38f471
Fix mdb debug formats
2011-09-11 19:29:24 +02:00
Hallvard Furuseth
ed0fc55fd3
Restore missing LAZY_LOCKS semicolon.
...
Lost in C90 compat commit c5dad7a6d0
.
2011-09-11 19:29:24 +02:00
Hallvard Furuseth
90ed553301
mdb integer type cleanup: Use MDB_dbi consistently.
...
This changes the prototype of mdb_env_set_maxdbs().
2011-09-11 19:29:24 +02:00
Hallvard Furuseth
b56be64d2e
Drop ULONG in favor of size_t.
2011-09-10 22:49:34 +02:00
Hallvard Furuseth
b1cfff4aeb
Add mdb.c:txnid_t for readability.
...
Maybe later we'll test txnid wraparound with it defined to ushort.
2011-09-10 22:49:34 +02:00
Hallvard Furuseth
bf9d722bec
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.
2011-09-10 22:49:34 +02:00
Hallvard Furuseth
5f68293475
explain mdl_midl_sort() istack size
2011-09-10 22:49:34 +02:00
Hallvard Furuseth
2d1f3b7ed3
Fix memn(r)cmp of key sizes > INT_MAX. Simplify.
2011-09-10 22:49:34 +02:00
Hallvard Furuseth
69e53cf700
Check some mdb integer type assumptions
2011-09-10 22:49:34 +02:00
Hallvard Furuseth
88da18cccf
Put MDB_node.<mn_lo,mn_hi> in host byte order.
2011-09-10 22:49:20 +02:00
Hallvard Furuseth
c5dad7a6d0
C90 compatibility cleanup in mdb.
...
Fix void* pointer arithmetic in cintcmp().
Fix invalid ';'s in declarations after possibly-empty macros.
2011-09-10 15:39:02 +02:00
Hallvard Furuseth
3dc8fa491a
Cleanup mdb macros.
...
Parenthesize. Rename GetPageSize -> GET_PAGESIZE since it does not
behave like a function (it has a non-pointer output argument).
2011-09-10 10:11:55 +02:00
Hallvard Furuseth
ec2d82f79a
libmdb/.gitignore += test[45], Doxygen output
2011-09-10 10:11:55 +02:00
Howard Chu
acdc248f57
If put(NOOVERWRITE) exists, return existing data
2011-09-09 22:28:07 -07:00
Howard Chu
a7edb95e64
Minor typos, additional clarification
2011-09-09 03:52:12 -07:00
Howard Chu
0c487538cf
Partial revert, fix MDB_page definition
2011-09-08 20:18:29 -07:00
Howard Chu
9ac8638d9d
More docs
2011-09-08 17:13:51 -07:00
Howard Chu
bed3123b82
More docs
2011-09-08 14:34:21 -07:00
Howard Chu
1b69295a48
Speedup cintcmp
...
Now that we know we're always 2-byte aligned...
2011-09-08 13:10:17 -07:00
Howard Chu
dac3fae3b5
Fix previous commit
2011-09-08 10:08:21 -07:00
Howard Chu
8678fef597
Forgot to commit this
2011-09-07 23:11:14 -07:00
Howard Chu
2e3bc39fa9
Further cursor-based restructuring
...
Get rid of all of the redundant MDB_*page structs and other cruft.
2011-09-07 23:09:45 -07:00
Howard Chu
976a150973
Cleanup unused code
2011-09-06 23:37:37 -07:00
Howard Chu
1f8c3369b9
Fix mdb_move_node again
2011-09-06 23:16:45 -07:00
Howard Chu
f9c8796d0b
Fix search_node, add cintcmp
2011-09-06 15:22:53 -07:00
Howard Chu
5e6a864513
Guarantee nodes are 2-byte aligned
...
Also fix xcursor_init1 md_dirty flag
Also another mdb_cmp refactoring fix
2011-09-06 13:50:51 -07:00
Howard Chu
293df78b2b
Change MDB_node to depend on 2-byte alignment
2011-09-06 05:17:24 -07:00
Howard Chu
807841b1aa
Fix for mdb_cmp refactoring
2011-09-05 16:54:39 -07:00
Howard Chu
963c421a97
Minor cleanup
2011-09-05 14:22:46 -07:00
Howard Chu
2cde97ae94
Use mdb_midl_append/sort instead of _insert
2011-09-05 02:36:24 -07:00
Howard Chu
70a4f6f29d
mdb_cmp refactoring
2011-09-05 00:46:32 -07:00
Howard Chu
7bb14a2e79
Cursor stuff working, no major perf gain
2011-09-04 21:33:57 -07:00
Howard Chu
1843fe0b53
Cursors in-progress, broken
2011-09-04 21:33:57 -07:00
Howard Chu
8d89a53165
Use cursor->mc_flags
2011-09-04 21:33:57 -07:00
Howard Chu
7f46832ec5
Begin reimplementing basic ops as cursor ops
2011-09-04 21:33:57 -07:00
Howard Chu
f6edbd7793
Add MDB_{FIRST,LAST}_DUP for cursor_get
2011-09-04 21:33:57 -07:00
Howard Chu
9d821c26c3
Fix mdb_split, fix MDB_GET_BOTH
2011-09-03 20:11:07 -07:00
Howard Chu
e91dae3ed5
Cleanup midl, start documenting internals
2011-09-03 14:27:07 -07:00
Howard Chu
b30d0266e7
Tweak docs
2011-09-02 01:09:11 -07:00
Howard Chu
30736a0ff5
Ugly-as-sin initial Windows port
2011-09-01 16:31:10 -07:00
Howard Chu
2510bea718
API cleanup, doxygen docs for public API
2011-09-01 16:31:10 -07:00
Howard Chu
0f459dd773
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.
2011-09-01 16:31:10 -07:00
Howard Chu
f7aa0d5e4a
Tweak locks, fix race conditions
2011-09-01 16:31:10 -07:00
Howard Chu
d27a7754f3
Reduce excessive memcpy in mdb_split
2011-09-01 16:31:10 -07:00
Howard Chu
027e1daa10
Fix mdb_split, tweak split_indx if space is tight
2011-09-01 16:31:10 -07:00
Howard Chu
01b9fc59fb
Fix update of big data items
2011-09-01 16:31:10 -07:00
Howard Chu
13c663f666
Fix free page reclaim and dbs table update
...
Can re-use free pages 1 txn earlier
Must update all dbs tables on txn commit
2011-09-01 16:31:10 -07:00
Howard Chu
94718fab00
More debug, fix MDB_DEL_DUP
2011-09-01 16:31:10 -07:00
Howard Chu
ee69051a7c
More debug output
2011-09-01 16:31:10 -07:00
Howard Chu
d54eb7dd81
Add txn_reset / txn_renew
2011-09-01 16:31:10 -07:00
Howard Chu
590c728044
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.
2011-09-01 16:31:10 -07:00
Howard Chu
720c4b0a3d
Set MINKEYS to 2
...
For better space utilization
2011-09-01 16:31:10 -07:00
Howard Chu
66a647e55d
Keep re-using dpages instead of freeing them
2011-09-01 16:31:10 -07:00
Hallvard B Furuseth
ca496bd357
Avoid cast-away-const for errstr[]
2011-09-01 16:31:10 -07:00
Hallvard B Furuseth
5b3b522313
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.
2011-09-01 16:31:10 -07:00
Hallvard B Furuseth
cb7c955220
Simplify: Replace IDL*_CMP() with CMP()
2011-09-01 16:31:10 -07:00
Hallvard B Furuseth
3029bb694d
Macro cleanup: Parenthesize, simplify, remove a ;
2011-09-01 16:31:10 -07:00
Hallvard B Furuseth
a1b4144b80
Drop gcc extension ,##__VA_ARGS__. Add DPUTS().
...
C99 says DPRINTF(fmt, ...) must get at least 2 args. Using DPUTS for 1 arg.
2011-09-01 16:31:10 -07:00
Howard Chu
8f77043372
Fix cursor_set for dups
...
Also make sure dups are counted in md_entries
2011-09-01 16:31:10 -07:00
Howard Chu
edf9d8e51b
Sorted dups fix
...
Write the first datum normally. Convert to a sub-db if
additional items for the same key are written.
2011-09-01 16:31:10 -07:00
Howard Chu
e15d4d16b6
Don't alloc in cursor_push/pop
2011-09-01 16:31:10 -07:00
Howard Chu
1ceae5c2c0
Fix multi-page commits
2011-09-01 16:31:10 -07:00