312 Commits

Author SHA1 Message Date
Leonid Yuriev
b5479260ea mdbx: backport - avoid FreeDB corruption due deep recursive rebalance from freelist_save().
Change-Id: I65b0b62c3e787802c0150c74826f181a8f6d7902
2019-06-22 21:00:53 +03:00
Howard Chu
629e587882 mdbx: import - tweak mdb_page_split (ITS#8969).
Bump up number of keys for which we use fine-grained splitpoint search

Change-Id: I9830e143f5f5aaa4c2170a304ebc89cf67b7f3bc
2019-02-03 13:00:46 +03:00
Leonid Yuriev
d23a3f3bc4 mdbx: drop inherited broken audit.
Internal self-audit (inherited from LMDB) is invalid and useless
for sub-db and dupsort cases.
2018-09-21 16:35:40 +03:00
Leonid Yuriev
b1620bbe47 mdbx: backport - prevent DB corruption due rebalance bugs.
Won't fix https://github.com/leo-yuriev/libmdbx/issues/38 in the 'stable/0.0' branch,
but add checks to prevent DB corruption.
2018-09-21 16:35:40 +03:00
Leo Yuriev
5bb92a4277 mdbx: add fallthrough for modern gcc.
Change-Id: I948adc0e534dd9ba42b7d64e8105870cc77f82e6
2018-06-21 20:09:27 +03:00
Leo Yuriev
7eb1b36309 mdbx: minor fixup comments and warnings. 2018-05-04 17:26:04 +03:00
Leo Yuriev
0c4b39bd11 mdbx: fix wrong freeDB search.
Avoid search freeDB while tree is updating.
Bug was inherited from LMDB.
https://github.com/leo-yuriev/libmdbx/issues/31
2018-05-04 17:22:59 +03:00
Howard Chu
2bccc85ff8 mdbx: backport - can't use fakepage mp_ptrs directly (ITS#8819). 2018-05-04 17:15:43 +03:00
Howard Chu
df08b5144c mdbx: backport - fix regression in 0.9.19 (ITS#8760). 2018-05-04 17:14:14 +03:00
Hallvard Furuseth
9baca673ac mdbx: backport - XCURSOR_REFRESH() fixups/cleanup.
* Check NUMKEYS(), similar to f34b61f9471d1c03fe0517b9d817c50c920e378a
  "ITS#8722 fix FIRST_DUP/LAST_DUP cursor bounds check".
* Move XCURSOR_INITED() into XCURSOR_REFRESH().  This adds a check in
  mdb_cursor_put, below /* converted, write the original data first */.
* Factor mc_ki[] out to XCURSOR_REFRESH().
* Replace an mc_pg[] with mp which is equal (mdb_cursor_del0).

* This checks XCURSOR_INITED() and fixes the mn_flags check.
2018-05-04 17:12:42 +03:00
Howard Chu
70042069eb mdbx: backport - fix FIRST_DUP/LAST_DUP cursor bounds check (ITS#8722). 2018-05-04 16:57:30 +03:00
Leo Yuriev
ecbc0b9c12 mdbx: update links after move the repo.
Change-Id: Ib9d0bbc02f628ee5df673f419cd6152785e19573
2017-08-12 10:48:50 +03:00
Howard Chu
a783325a6d mdbx: backport - ITS#8699 more for cursor_del ITS#8622.
Set C_DEL flag on reinit'd subcursor

Change-Id: I8ad1c10afd481f61b8e521d02c4d2de3be5089d7
2017-08-02 15:31:31 +03:00
Leo Yuriev
f55c30f286 mdbx: backport - don't madvise(MADV_REMOVE).
Avoid lost changes and corruption in case a collision
between mdbx_env_open() in one process and write-txn with
next-pgno updates in an another process.

Change-Id: I890db9251edbd77ac0ace10bed10a24517d709ec
2017-07-26 13:14:23 +03:00
Leo Yuriev
d5a0fe539f mdbx: Merge branch 'nexenta' (preparation to stable stage). 2017-07-04 08:55:48 +03:00
Leo Yuriev
ef941b2587 mdbx: fix crash on twice txn-end (backport from devel). 2017-05-25 20:42:18 +03:00
Leo Yuriev
baf0fad11d mdbx: fix snap-state bug (backport).
Change-Id: Ia0f2e028193d223b3a25e76d83cb22b9bc9546e6
2017-04-27 01:50:19 +03:00
Leo Yuriev
bb205df001 mdbx: more for compatibility (musl).
One more for https://github.com/ReOpen/ReOpenLDAP/issues/123
2017-03-29 14:33:58 +03:00
Leo Yuriev
4507c1c6bb mdbx: more yields as workaround for pthreads bug.
Backport 719ecd55cf1d0ea7d6771248b3936f056bc49a47 from https://github.com/ReOpen/ReOpenLDAP

Change-Id: I6bead57782a29fca5352055db6afee02ad1ee38b
2017-03-24 01:19:28 +03:00
Howard Chu
36bc576036 mdbx: backport - ITS#8622 fix xcursor after cursor_del.
Re-fix 6b1df0e4c7fadd21d1233d7157229b2d89ccaa04 from ITS#8406

Change-Id: Ied16e11c06fc3ce626ee4885d153aff98e5f8802
2017-03-24 00:56:22 +03:00
Leo Yuriev
c0c4742dba mdbx: Merge branch 'master' into 'nexenta' branch.
Change-Id: Iade70bae46bc4ea4baac36b3ed86434519959274
2017-03-16 15:23:15 +03:00
Leo Yuriev
1708025651 mdbx: don't close/lost DBI-handles on ro-txn renew/reset.
More for d0383e5aeeb29fc07b568a0d4b5287d539be5d0d

Also this is related to:
 - https://github.com/ReOpen/ReOpenLDAP/issues/119 (its6794 regression test may fail)
 - https://github.com/ReOpen/ReOpenLDAP/issues/92 (rare test060-mt-hot failures)
2017-02-16 14:23:32 +03:00
Leo Yuriev
41576e553c mdbx: fix cursor-untrack bug.
Fix segfault possibility,
during closing the cursor after a write-txn.
2017-02-16 14:23:32 +03:00
Leo Yuriev
f75fa27fe6 mdbx: don't close DBI-handles from R/O txn_abort().
This is related to:
 - https://github.com/ReOpen/ReOpenLDAP/issues/119 (its6794 regression test may fail)
 - https://github.com/ReOpen/ReOpenLDAP/issues/92 (rare test060-mt-hot failures)
2017-02-15 21:09:05 +03:00
Leo Yuriev
cf8ef06ebc mdbx: 'unlikely' for DB_STALE. 2017-02-15 20:04:20 +03:00
Leo Yuriev
6f600845f3 mdbx: more for robustness free/reuse of cursors.
Change-Id: I6c4056bc47aea28d39701713f97694a4ebe9b582
2017-02-09 11:47:35 +03:00
Leo Yuriev
16fe998f7c mdbx: fix losing a zero-length value of sorted-dups (for libfpta). 2017-02-07 20:57:06 +03:00
Leo Yuriev
4681620e66 mdbx: don't ignore data arg in mdb_del() for libfpta. 2017-02-02 13:15:16 +03:00
Leo Yuriev
18654ccf22 mdbx: fix MDB_CURRENT for MDB_DUPSORT in mdbx_cursor_put() for libfpta. 2017-01-31 19:16:16 +03:00
Leo Yuriev
d3518bf75b mdbx: fix LEAF2-pages handling in mdb_cursor_count(). 2017-01-31 19:16:16 +03:00
Leo Yuriev
7bf9d381ee mdbx: minor simplify mdb_del0(). 2017-01-31 19:16:16 +03:00
Leo Yuriev
61e1efeb85 mdbx: add mdbx_dbi_open_ex() for libfpta. 2017-01-31 02:52:59 +03:00
Leo Yuriev
55c43291c6 mdbx: undef NDEBUG when MDB_DEBUG != 0. 2017-01-30 20:17:33 +03:00
Leo Yuriev
cc6e1c5119 mdbx: fix MDB_CURRENT for mdb_cursor_put() with MDB_DUPSORT. 2017-01-24 20:51:23 +03:00
Leo Yuriev
6aa60c61c5 mdbx: allows cursors to be free/reuse explicitly, regardless of transaction wr/ro type. 2017-01-24 20:21:51 +03:00
Leo Yuriev
8b045ab626 mdbx: MDBX_EMULTIVAL errcode for libfpta. 2017-01-24 19:10:35 +03:00
Leo Yuriev
5bb931f7c4 mdbx: fix xflags inside mdb_cursor_put().
Fix xflags preparation bug from 2956095c6ded72d22e10e6d1cad4a5410ea52994
2017-01-18 19:05:48 +03:00
Leo Yuriev
14b466bd2d mdbx: fix cursor EOF tricks.
LY: Don't touch cursor's C_EOF flag in functions
    that don't moves the cursor.

HYC: Further fix f8ce8a82717ddefdc912fa47c07f1bdee2a3336b
     Fully revert the change to GET_MULTIPLE

Change-Id: Ia8e6dc0af04e5c7b2fd1a2fc9632ccfecc01819a
2017-01-18 17:48:32 +03:00
Howard Chu
460eb64a6f mdbx: backport - Tweak cursor_next C_EOF check.
Squash of relevant commits.

HYC: Allow C_EOF flag to be stale.

LY: Fixed parenthesis arrors.

Change-Id: I5a26498763358a08f98481cacf582c881d59393d
2017-01-13 00:50:15 +03:00
Leo Yuriev
97e1d9b685 mdbx: fix mdb_cursor_last (ITS#8557).
This is a port of http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=commit;h=d84dee516fa4cca41b5234e95c2105eb4737dfb3

HYC: Optimize mdb_page_search_root(PS_LAST) when cursor is already
     near last position, ignoring C_EOF flag for now.

LY: Fixed C_EOF check. Don't ignore it, otherwise in some cases
    we got a "MDB_PAGE_NOTFOUND", instead of just "MDB_NOTFOUND".

Change-Id: I2edbf6b64403abfa830a2fcb84162125634a85d0
2017-01-13 00:50:07 +03:00
Leo Yuriev
f8a14d7d54 mdbx: Merge branch 'positive' into 'devel' branch. 2017-01-08 14:27:31 +03:00
Leo Yuriev
9c02fad4cd mdbx: support glibc < 2.18 for TLS cleanup on thread termination.
One more for https://github.com/ReOpen/ReOpenLDAP/issues/48
against https://sourceware.org/bugzilla/show_bug.cgi?id=21031
and https://sourceware.org/bugzilla/show_bug.cgi?id=21032

It is impossible to completely fix this issue for glibc prior to 2.18,
in such case this fix just minimizes the probability of a crash.

Change-Id: If2317275928e8f6d96c2682df99989da03aedaaa
2017-01-07 21:14:47 +03:00
Leo Yuriev
02de457f3c mdbx: more rework TLS cleanup on thread termination.
One more re-fix https://github.com/ReOpen/ReOpenLDAP/issues/48
Here is only part of the work for glibc >= 2.18

--

Unfortunately, the two bugs related to pthread_key_delete()
are present in all glibc versions:

1) The race condition between pthread_key_delete() and thread's
finalization path, from where a TSD-destructors are called.
Therefore some TSD-destructor(s) could be executed after that
the pthread_key_delete() was competed.

2) ld.so infrastructure does not tracks a TDS-destructors.
Therefore a lib.so could be unloaded while corresponding a
TSD-destructor(s) were even not completed or still were not called.

Change-Id: I47eba97df57fd4c7a5bf3a8f9f12d72ba898cae5
2017-01-06 18:39:03 +03:00
Leo Yuriev
ee4d5bb5d2 mdbx: rework TLS cleanup on thread termination.
Re-fix https://github.com/ReOpen/ReOpenLDAP/issues/48

Change-Id: Ie47d2ede0f47b382a30ab6a27546f249f56cf4f6
2017-01-04 00:09:50 +03:00
Leo Yuriev
855c60a554 mdbx: remote extra LNs (cosmetics).
Change-Id: I3ea352c9d088367756543f8313d6598de3b80bf0
2017-01-03 16:45:23 +03:00
Leo Yuriev
5b160be128 mdbx: assert_fail() when INDXSIZE(key) > nodemax.
Change-Id: I2fadc68a3e682dd3d8b3b8b5f48ed096e9a92288
2017-01-03 16:11:19 +03:00
Leo Yuriev
ddb3c32258 mdbx: HNY 2017!
Change-Id: Ie80fc1dc407ec45c828aa3b1bdc42933741a863a
2017-01-01 14:56:00 +03:00
Leo Yuriev
dbc57d3eaf mdbx: fix cursor_count() for libfpta. 2016-12-23 15:35:42 +03:00
Leo Yuriev
68cac36832 mdbx: Merge branch 'devel' into 'pt' branch. 2016-12-23 05:03:27 +03:00
Hallvard Furuseth
5bed0413f3 mdbx: backport - More MDB_node doc.
Change-Id: I2a4d2596af8d2c551d891b567e4d3366b2d6ad8c
2016-12-23 04:47:38 +03:00