Commit Graph

74 Commits

Author SHA1 Message Date
Hallvard Furuseth
061fe51e8c lmdb: ITS#7377 Catch mdb_put() to blocked/read-only txns.
...early enough that txn state is left unchanged.

Change-Id: Ia475660f339f7b741eaaa126978f8419a19b67a0
2015-08-04 13:57:14 +03:00
Hallvard Furuseth
d6b3c6f710 lmdb: ITS#7377 Always notice env error on txn startup.
Move the check to the end of txn startup.  Catches env
breakage which happens while the new txn waits for a lock.

Change-Id: I074d411cd5339b5e6caa2691078ea07b0d49828e
2015-08-04 13:57:14 +03:00
Hallvard Furuseth
11999c8c02 lmdb: Cleanup, Drop !mt_dbxs hack, use MDB_TXN_FINISHED.
Change-Id: I23beaaf931c938ee9f3886ca1928ecbcd2fbe5ba
2015-08-04 13:57:14 +03:00
Hallvard Furuseth
342d56977f lmdb: Catch most uses of finished/parent txns.
* Add MDB_TXN_FINISHED, MDB_TXN_HAS_CHILD, MDB_TXN_BLOCKED.
* Clear mt_numdbs in writers, for TXN_DBI_EXIST() to catch.
  We already do in readers.

Change-Id: I4f714c0789188dfab4ce22b7d9d3a75d8b62ef6b
2015-08-04 13:57:14 +03:00
Hallvard Furuseth
e3c8fa8eba lmdb: Move code into mdb_txn_end(). Was mdb_txn_reset0.
Side effects:
* Clean txn up a bit even before freeing it.
* Tweak DEBUG output at txn end. Add DEBUG after commit(writer).

Change-Id: Ia9905257893923bb14cdf33b60b6387af3121f81
2015-08-04 13:57:14 +03:00
Hallvard Furuseth
23af429b3f lmdb: ITS#8200 Fix mdb_midl_shrink() usage, return void.
Change-Id: I506a170d434178d43f01b3e9597c4a03b3b3e7a7
2015-08-04 13:57:14 +03:00
Hallvard Furuseth
862cfc30c4 lmdb: Simpler mdb_node_add().
Change-Id: I5b1f851a098aeb4b5adcd7ed55150a055cd63102
2015-08-04 13:57:14 +03:00
Hallvard Furuseth
be27186f76 lmdb: ITS#8181 Verify that records are/aren't DBs.
Except we don't catch the user passing F_SUBDATA to
mdb_cursor_<put/del>, like an internal LMDB call.

Change-Id: I5ebce36694045279702c74490a5a634217d4f95d
2015-08-04 13:57:13 +03:00
Howard Chu
91a6b6de57 lmdb: ITS#8190 fix cursor EOF bug.
Change-Id: I97556bc521e1d4d4ea9f3e43c14a8a2fe62b8231
2015-08-04 13:57:13 +03:00
Hallvard Furuseth
96fb8eec8a lmdb: More ESECT declarations.
Change-Id: Iaed5c6e35b1bd6e59caf8d1f52b265ec4852c84a
2015-08-04 13:57:13 +03:00
Hallvard Furuseth
57b263693c lmdb: Add DB_USRVALID, to avoid 'dbi == FREE_DBI' tests.
Change-Id: Ic44ce41fd2fff1abb4cd24821ece07ef30254565
2015-08-04 13:57:13 +03:00
Hallvard Furuseth
4cb5d637d4 lmdb: Simpler flag/DBI checks and MDB_DEBUG.
Change-Id: I37a00fcc23f2060538ab4378f204ae0efcdb59ea
2015-08-04 13:57:13 +03:00
Hallvard Furuseth
9e52d29fd8 lmdb: Simpler mdb_drop().
MDB_DBI_CHANGED(,MAIN_DBI) is never true.

Change-Id: I0d12b9965d8251908ec41d1febc6b5c354a93a01
2015-08-04 13:57:13 +03:00
Hallvard Furuseth
6524dbf3a1 lmdb: Simpler mdb_node_shrink().
Change-Id: If0e4153e69c4f858ee45471c4888ec2024253b50
2015-08-04 13:57:13 +03:00
Hallvard Furuseth
a6fa632a54 lmdb: Simpler mdb_txn_commit().
mt_env is always set.
Commit(mt_child) resets mt_child, so parent need not.

Change-Id: Ib8af816a964a4b70fa6fa622b3d9dd463e9460b3
2015-08-04 13:57:13 +03:00
Hallvard Furuseth
82213d732c lmdb: cleanup mdb_txn_begin().
Change-Id: Ia28e255a0497d02f7d87ca301d5be8a60886d4e1
2015-08-04 13:57:13 +03:00
Hallvard Furuseth
b3a3dc4c6b lmdb: Omit scanning DUPSORT sub-DB leaves in mdb_drop0().
Change-Id: Icc670a81210a9160e6cb90b9442994c008f599bd
2015-08-04 13:57:13 +03:00
Hallvard Furuseth
b13d850bd7 lmdb: Use mdb_cmp_int_a/mdb_cmp_long() for FREE_DBI.
Change-Id: Id66356b27e9d257fbf5bc8ce1111845be8683d62
2015-08-04 13:57:13 +03:00
Hallvard Furuseth
84b6ecb9a8 lmdb: Hide internal flags in mdb_env_get_flags().
Change-Id: I9ff2888a61a53fb0c7471de980ec7b97c59c6096
2015-08-04 13:57:13 +03:00
Leo Yuriev
295beda00c lmdb: fix ABI compatibility with original liblmdb.so
Change-Id: I770a49b7a506f3f2a21ea3af36fd07c16a32dc30
2015-06-04 19:12:14 +03:00
Hallvard Furuseth
f71cb6d69e lmdb: ITS#8156 Fix MDB_MAXKEYSIZE doc.
Change-Id: Ia9dae2e68f28dcb715ac34226b358212317199c2
2015-06-01 15:38:18 +03:00
Hallvard Furuseth
55ae3dfa8b lmdb: ITS#8157 mdb_txn_renew0(): init after error checks.
Change-Id: I9ea344b98cb8c99a25ba7087abefbfe62b3417a0
2015-05-28 16:00:27 +03:00
Hallvard Furuseth
bb7b923fdd lmdb: Set/clear mp_pad, md_pad (MDB_DUPFIXED data size).
mdb_xcursor_init1(): md_pad is only used when MDB_DUPFIXED.
mdb_page_split():    Copy mp_pad too. Used by mdb_page_list().

Change-Id: Ia35cba3a367c04929a34a5879abc968202086e89
2015-05-21 21:40:39 +03:00
Hallvard Furuseth
476c5b02ea lmdb: ITS#8117 Fix MDB_INTEGERDUP keysize doc.
Change-Id: I7cf7c456f35fe9c5449a37ad9130864617197726
2015-05-21 21:40:39 +03:00
Leo Yuriev
104312d15e lmdb: update mdb_chk for checkpoints, minor cosmetics.
This is 9/9 for https://github.com/ReOpen/ReOpenLDAP/issues/1
and https://github.com/ReOpen/ReOpenLDAP/issues/2

Change-Id: I05f59313b4346c08bcd63d62e6c48a5f53c47852
2015-05-21 21:40:39 +03:00
Leo Yuriev
21705fd9a2 lmdb: seek to steady meta-page on db-open.
This is 7/9 for https://github.com/ReOpen/ReOpenLDAP/issues/1
and https://github.com/ReOpen/ReOpenLDAP/issues/2

Change-Id: If59a6bfc7c6198e6b1e85f4bdc5b534ecff03123
2015-05-21 21:40:39 +03:00
Leo Yuriev
633f2a10ad lmdb: forces a steady checkpoint if OOM occurred
because of reclaiming stops on a weak ones.

This is 6/9 for https://github.com/ReOpen/ReOpenLDAP/issues/1
and https://github.com/ReOpen/ReOpenLDAP/issues/2

Change-Id: I91d8a3dfaf06e1917326d8f73c4a65565cde0b47
2015-05-21 21:40:39 +03:00
Leo Yuriev
312135169f lmdb: weak/steady for meta-pages.
This is 5/9 for https://github.com/ReOpen/ReOpenLDAP/issues/1
and https://github.com/ReOpen/ReOpenLDAP/issues/2

Change-Id: Ica2dbe0bfd6ba58c00de161e2cd50594ee39c44d
2015-05-21 21:40:39 +03:00
Leo Yuriev
a283d782f6 lmdb: bigbang for sync-to-disk path and related.
This is 4/9 for https://github.com/ReOpen/ReOpenLDAP/issues/1
and https://github.com/ReOpen/ReOpenLDAP/issues/2

Here a lot of changes:
 - deleted a secondary DSYNC-mode file descriptor;
 - deleted a pointers to meta-pages and toggle-selection of ones;
 - removed MDB_FDATASYNC_WORKS/FDATASYNC_MAYBE_BROKEN stuff;
 - reworked use of fdatasync/fsync for safety without performance degradation;
 - txn-to-meta updating moved info mdb_txn_commit();
 - removed mdb_env_write_meta();
 - rewrited mdb_env_sync0() for clarify;

Change-Id: I985464baa3cf486a2ceccf2c9dcb7a7fea698c46
2015-05-21 21:40:24 +03:00
Leo Yuriev
1c37139b2a lmdb: drops no-lock operation mode (now MDB_NOLOCK is UNSUPPORTED).
This is 3/9 for https://github.com/ReOpen/ReOpenLDAP/issues/1
and https://github.com/ReOpen/ReOpenLDAP/issues/2

Change-Id: I7cd5d90c41424d6635accbb10c5801adeb1087e9
2015-05-21 20:23:12 +03:00
Leo Yuriev
eec1ccaa77 lmdb: drops support for non-POSIX.
This is 2/9 for https://github.com/ReOpen/ReOpenLDAP/issues/1
and https://github.com/ReOpen/ReOpenLDAP/issues/2

Change-Id: I7ab3d5416381c9477edba4ce9db2f3fdc58a2d3d
2015-05-21 18:43:00 +03:00
Leo Yuriev
c5db4043ee lmdb: prepare to bigbang (separated minor changes).
This is 1/9 for https://github.com/ReOpen/ReOpenLDAP/issues/1
and https://github.com/ReOpen/ReOpenLDAP/issues/2

Change-Id: I3ba943b2e4597f3e796376a5a54851aa411b1aa1
2015-05-21 18:05:00 +03:00
Leo Yuriev
548d9d4b03 lmdb: bugfix, OOM-handler couldn't help if LIFO-reclaiming disabled.
This is fixes https://github.com/ReOpen/ReOpenLDAP/issues/28

Change-Id: Ifc33e1202ae38f0a4fa0cb9d572394a4dac7ec6c
2015-05-15 01:31:22 +03:00
Leo Yuriev
bd05dd24ab lmdb: fix mdb_chk for case MainDB's records isn't a sub-db.
Change-Id: I3a4ae1f50972fde6edab828b58199dde9b84550c
2015-05-09 01:00:27 +03:00
Leo Yuriev
f2703156f0 lmdb: mdb: b-tree walk, page-map check in mdb_chk.
Change-Id: I6678b4d891c8fbfbc49ed600212f4ade39e25282
2015-05-08 15:49:33 +03:00
Leo Yuriev
23720958b6 lmdb: mdb_chk tool (initial).
Change-Id: I7d31e0fb45ab56cf8d6df56939e5b3ded6b8e3e5
2015-05-08 03:47:17 +03:00
Leo Yuriev
4a04e59dba lmdb: refork debug.
Change-Id: I47d3e300b47fcba5600644ff28c68a900640c39c
2015-05-08 03:45:30 +03:00
Howard Chu
0ac9ba6472 lmdb: ITS#8117 better fix.
LY: This is not required for ReOpenLDAP, because it
is not such issues related to int/long in cmp/dcmp.
But let be more close to origin's sources.

Origin: Don't change mc_dbx because we would need
to undo the change if the txn aborts. Make the fix
(for get) match existing code for put.

Change-Id: I36f7ff99b4adf821cace5af6b0b84f5210eb454d
2015-05-07 17:15:14 +03:00
Leo Yuriev
59d6560fc3 lmdb: cleanup Windows support.
Change-Id: I7bc7f3e997eeea4c5678a97e2faf10525ba7eee6
2015-05-04 03:48:22 +03:00
Leo Yuriev
f97cc739cb lmdb: ITS#8117 - reworks of comparison for MDB_INTEGERKEY and MDB_INTEGERDUP.
Change-Id: Icd24589c7a139c4395de1e7c40f16d2c7ea54cf7
2015-05-01 06:50:04 +03:00
Howard Chu
d4bddde7aa lmdb: ITS#8109 fix mdb_cursor_del0 on empty DB.
Change-Id: Idba0acfd64b597f2bc5cb847ca99fe4560eed875
2015-04-24 22:39:21 +03:00
Hallvard Furuseth
8103d0b458 lmdb: Clear error from previous txn on renew.
Change-Id: I45e608d4d1ad3ffa3ad20e8a6b579708f25c3966
2015-04-19 23:44:07 +03:00
Leo Yuriev
38789b6c0a lmdb: refine sync/async writes of meta-pages.
Change-Id: If309023214e60f349762d337f98ee6fd515faa31
2015-04-18 17:18:50 +03:00
Howard Chu
347c1d6dfb lmdb: ITS#8106 retry writes on EINTR.
Change-Id: Ib422f62f6e1fc81cd773ca600524a53f8f16629e
2015-04-18 16:44:17 +03:00
Howard Chu
d0b4943352 lmdb: ITS#8062 - fix rebalance, also handle subcursors.
(Probably fixes the ITS, definitely fixes a bug) when collapsing
the root page, fixups of other cursors was incomplete.
2015-04-16 13:38:42 +03:00
Hallvard Furuseth
5ac6404059 lmdb: Cleanup MDB_env.me_txn0.
More fallout from 4d02c741b120786df1b87ee9ed49c1d3f9bc7522.

Change-Id: I3bbd913c7da3e45f00f1d40c0aac6e7bf5f48c69
2015-04-09 13:25:02 +03:00
Hallvard Furuseth
dba429d608 lmdb: Fix per-txn MDB_NOMETASYNC, MDB_NOSYNC.
Fallout from 4d02c741b120786df1b87ee9ed49c1d3f9bc7522. The flags
were ignored: mdb_txn_renew0/begin cleared and/or did not set them.

Change-Id: Ic7dab1e9a4cf3754e05a3c3df6a10e0efa48af5c
2015-04-09 13:23:59 +03:00
Hallvard Furuseth
c4097ec898 lmdb: Renumber MDB_TXN_* flags, simplify flag code.
Change-Id: I91b0836a84ce80049dbe0829dfc3101fae94c7c9
2015-04-09 13:22:49 +03:00
Hallvard Furuseth
5daf811dcb lmdb: Clear error from previous txn in mdb_txn_renew().
Change-Id: I72b55bfd91c87e4608fbf50f3c70951952855f8f
2015-04-09 13:22:16 +03:00
Leo Yuriev
4a1574c998 all: refine #defines that controls memory checking.
LDAP_DISABLE_MEMORY_CHECK removed, LDAP_MEMORY_DEBUG is used instead.
LDAP_MEMORY_DEBUG_ASSERT replaced with LDAP_MEMORY_ASSERT.

Change-Id: I0f43b9ae10b76c1af39f2c52b34b4ab804521e78
2015-03-26 01:04:14 +03:00