1623 Commits

Author SHA1 Message Date
Leonid Yuriev
ee22ffb878 mdbx-tools: using walked pages count while output statistics if traversal enabled. 2021-01-25 21:35:59 +03:00
Leonid Yuriev
a9cb6a6a90 mdbx: minor fix ASAN controls. 2021-01-25 21:35:59 +03:00
Leonid Yuriev
95ae324580 mdbx: fix reclaimed-list allocation during nested txn start.
Change-Id: Ia70e01ed69a001249ce14b4930452a469d04b824
2021-01-24 00:49:46 +03:00
Leonid Yuriev
4ae2a107bf mdbx: add MDBX_opt_loose_limit runtime option.
More for https://github.com/erthink/libmdbx/issues/128

Change-Id: I298bf1eef24575df72615ee07e93f5073405e8e0
2021-01-22 23:52:03 +03:00
Leonid Yuriev
dc34041600 mdbx: alter defaults for MDBX_opt_rp_augment_limit and MDBX_opt_txn_dp_limit runtime options.
Change-Id: I08cdbfb18089a3fed4b32d931ca4423027a9939f
2021-01-22 23:16:21 +03:00
Leonid Yuriev
b1a2892038 mdbx: fix minor Coverity warnings.
Change-Id: I0c5d23a36120b8d697887462a6ae86d66a435c3d
2021-01-22 20:13:31 +03:00
Leonid Yuriev
b82d1d5063 mdbx: add MDBX_opt_spill_parent4child_denominator runtime option.
More for https://github.com/erthink/libmdbx/issues/128

Change-Id: If1549c3855eb59c107eb115e6dbca515e81644f9
2021-01-22 18:18:52 +03:00
Leonid Yuriev
56aaad03bc mdbx: add MDBX_opt_spill_max_denominator and MDBX_opt_spill_min_denominator runtime options.
More for https://github.com/erthink/libmdbx/issues/128

Change-Id: I6b1b00e30ac11e9c2e3d3d3a29cc73079b41d539
2021-01-22 17:25:44 +03:00
Leonid Yuriev
e0d4eaf819 mdbx: minor refine mdbx_txn_merge(). 2021-01-21 22:45:34 +03:00
Leonid Yuriev
1d58ad6d9b mdbx: fix Valgrind/ASAN controls.
Change-Id: Idf526cbdb8ce8e43600efebbd1d12a8306a58184
2021-01-21 22:45:28 +03:00
Leonid Yuriev
58e4eda1c6 mdbx: fix spilled page list memleak.
Change-Id: I8b3b3664711943b0809be7bcc6580aafd4e4c286
2021-01-21 22:45:28 +03:00
Leonid Yuriev
d26ae6875b mdbx: fix assertion to avoid false-positive UB detection by CLANG/LLVM.
Assume this resolve https://github.com/erthink/libmdbx/issues/153

Change-Id: I02ceba1063a338b6dedf17629b51b3466358b0b8
2021-01-21 22:45:28 +03:00
Leonid Yuriev
afe93137fc mdbx: fix minor assertions.
Change-Id: Ib3e2dcb2cb419f41717351b2ac2264ffed906014
2021-01-21 22:45:28 +03:00
Leonid Yuriev
bed14e60c2 mdbx-cmake: add -fsanitize-undefined-trap-on-error to compile flags and ENABLE_UBSAN to config.h.
Change-Id: Ic18c0d59ccf32f9783a44de456893fbc8a0a7d32
2021-01-21 22:45:23 +03:00
Leonid Yuriev
730b9ea3fd mdbx: add MDBX_PNL_ASCENDING build option and dependency for MDBX_DATA_MAGIC.
Change-Id: I55283240b1dbbbc093927be5eaa5d42b87294f72
2021-01-20 23:31:14 +03:00
Leonid Yuriev
6bd0277020 mdbx: minor fix mdbx_cursor_close().
Avoids reference to txn which could be already freed.

Change-Id: I4e1fadd9786ced1533bb8468d30e013455601228
2021-01-20 09:55:11 +03:00
Leonid Yuriev
7d09de489d mdbx: fix minor MSVC warnings.
Change-Id: I633b8847698dca25b6c395216744e157f6fb240d
2021-01-20 09:55:11 +03:00
Leonid Yuriev
0d09c2cda9 mdbx: avoid overflow for dirty & leftover space inside mdbx_txn_info().
Change-Id: I36f4d62881e68f1bfe0d11fde2e849cdf1408ed2
2021-01-20 02:07:44 +03:00
Leonid Yuriev
42670aa64a mdbx: fix MSVC warnings aroung size_t and unsigned conversion.
Change-Id: I32bd3ee4fe02ac62cc121f33b2f84bf63c81cb75
2021-01-20 01:39:21 +03:00
Leonid Yuriev
6d7daf6401 mdbx: fix audit for complex nested txn cases.
Change-Id: I2419cbe0e8d3167e77ac99f397b97edb22717833
2021-01-19 23:53:16 +03:00
Leonid Yuriev
f28da7c9e3 mdbx: rework spilling, page-lists, commit & abort for nested transactions, etc (squashed).
Change-Id: I09e4744586342aeae4efcfb71f41a3248ee47758
2021-01-19 23:53:16 +03:00
Leonid Yuriev
7bae2a7cd2 mdbx: provide MDBX_ENABLE_REFUND build option.
Change-Id: I0e4c94a22f3b0957176431709604a7595f85252a
2021-01-19 23:53:16 +03:00
Leonid Yuriev
7183f62e13 mdbx: rework DBI_DIRTY and MDBX_TXN_DIRTY propagation.
Change-Id: Ief12ee320ce7c7142632bd1142d847aac314db0b
2021-01-19 23:53:16 +03:00
Leonid Yuriev
4afc30c79f mdbx: rework mdbx_page_alloc().
Change-Id: I5c6e2ef23abf79096dd699f9dfbecf97bfc4fe37
2021-01-19 23:53:16 +03:00
Leonid Yuriev
c6a8f0f9af mdbx-tools: minor refine mdbx_chk error output.
Change-Id: I4692a46c3e007fa2910ef67ec7fe21c7285e92eb
2021-01-19 23:53:16 +03:00
Leonid Yuriev
966d7027a3 mdbx: minor fix bad_page() debug output.
Change-Id: I14531fdceaad054ad8c45bf9042fee73de1f9a36
2021-01-19 23:53:16 +03:00
Leonid Yuriev
dfc92d9f96 mdbx: minor fix mdbx_page_new() debug output.
Change-Id: If60f972cc3271ca91feea923fb4f4be48d488b22
2021-01-19 23:53:16 +03:00
Leonid Yuriev
ac0f4e14a8 mdbx: minor fix mdbx_page_new() debug output.
Change-Id: I2f386ec6276cab404607b5c3a79d8028d73dad62
2021-01-19 23:53:16 +03:00
Leonid Yuriev
ca597f4314 mdbx: fix mdbx_page_flush() for possibility of memleack.
Change-Id: Ieab0c98fcd1020d49cce73234125ceb11a8f0b64
2021-01-19 23:53:16 +03:00
Leonid Yuriev
c1fef9b51d mdbx: fix mdbx_update_gc() for retired page list change case.
Change-Id: Ic454262edcda8881182a15d6a521b90990e5551d
2021-01-19 23:53:16 +03:00
Leonid Yuriev
b8bb4b4cc4 mdbx: fix propagation child txn DBI-state to parent.
Change-Id: I7d92fa99131a937af1a1a75b38af57bc6787ab37
2021-01-19 23:53:16 +03:00
Leonid Yuriev
4425fb0b83 mdbx: minor refine flags-reset inside mdbx_page_flush().
This produces little bit less code for most architectures.

Change-Id: I0440ec7b465ae2f12a8b09b0226f2c42bc52f7de
2021-01-19 23:53:16 +03:00
Leonid Yuriev
5bb254e629 mdbx: allow fastpath-commit for pure nested txns with parent-spilled pages.
Change-Id: I471fd5e057c323e3701158761631e0a9999bf54a
2021-01-19 23:53:16 +03:00
Leonid Yuriev
8fce97dca9 mdbx: fix mdbx_cursors_eot().
Change-Id: I6021ff019f25110db96f9ef351d31a1f48b76c18
2021-01-19 23:53:16 +03:00
Leonid Yuriev
f6ff075335 mdbx: rework/speedup spill-pages list.
Change-Id: I97e63f8d4c82ae682e898e9b04edceb0b01d82a5
2021-01-19 23:53:16 +03:00
Leonid Yuriev
d64b81c673 mdbx: remove senseless assertions from mdbx_refund_loose().
Change-Id: I028ae6bafb9358b61287fc0201c246baf160ca03
2021-01-19 23:53:16 +03:00
Leonid Yuriev
0ab263b329 mdbx: purge deleted spilled pagenums on refund.
Change-Id: I325fbad82cbecb71c35dd1edd1a2abccb8108541
2021-01-19 23:53:16 +03:00
Leonid Yuriev
7bf147d8c2 mdbx: fix assertion inside mdbx_txn_commit_ex() for nested spilled txn.
Change-Id: I54b37ea1b9591bdec9d8bd16d0f57280a1f9ee77
2021-01-19 23:53:16 +03:00
Leonid Yuriev
6ef7b2f588 mdbx: fix assertion inside mdbx_txn_begin_ex() for nested txn with spilled parent.
Change-Id: Ie1f3cd3df6beb296a7bbdc72b39c1c4cb9105083
2021-01-19 23:53:16 +03:00
Leonid Yuriev
f0d79df9b9 mdbx: fix mdbx_page_flush().
Change-Id: I467c2367f2e99ae50996d0859ae22f70c9649a2d
2021-01-19 23:53:16 +03:00
Leonid Yuriev
05958a708e mdbx: fix minor/potential mem-page leak inside mdbx_page_unspill().
Change-Id: I4398a4d81eda494e4de9d62d81e3936c6357b744
2021-01-19 23:53:16 +03:00
Leonid Yuriev
21fbc36311 mdbx: minor refine mdbx_page_retire().
Change-Id: I29d20ed47f56e17dde8c9417bfa1ec95302c1966
2021-01-19 23:53:16 +03:00
Leonid Yuriev
cea29fe485 mdbx: fix assertion inside mdbx_page_retire().
Change-Id: I5d8f92b9fde1c961252757ea508403b5f51e7646
2021-01-19 23:53:16 +03:00
Leonid Yuriev
fe386a66df mdbx: minor refine mdbx_page_unspill().
Change-Id: I20bbd4c502a2258b945996fa1cf761eab7f88a80
2021-01-19 23:53:16 +03:00
Leonid Yuriev
92527a5206 mdbx: rename mdbx_page_spill to mdbx_cursor_spill().
Change-Id: I71628951d29ea39055b920a76521a19cb10ac8da
2021-01-19 23:53:16 +03:00
Leonid Yuriev
266bb70b7d mdbx: add debug to mdbx_kill_page().
Change-Id: Ifbb3164989a19d8ea48288b4eda1a8bcf31790ff
2021-01-19 23:53:16 +03:00
Leonid Yuriev
56758372cf mdbx: drop unused mdbx_audit().
Change-Id: I6d31c6ad83c058892319da6bbf38506b3f55085f
2021-01-19 23:53:16 +03:00
Leonid Yuriev
1314b29557 mdbx: add const for bsearch functions.
Change-Id: Ie63eafa145bc8a63ae56b2693aaaf69bd21893aa
2021-01-19 23:53:16 +03:00
Leonid Yuriev
ef7814c018 mdbx: clean zero item of DPL-list.
Change-Id: I7c60f3996783d97cee7cf2f0f9a7b856f4272641
2021-01-19 23:53:16 +03:00
Leonid Yuriev
d50fff8410 mdbx: minor refine mdbx_page_check().
Change-Id: I325c20fe042635a0641cc24f5661408f3476139b
2021-01-19 23:53:16 +03:00
Leonid Yuriev
44089b03df mdbx: minor refine mdbx_page_get().
Change-Id: Ie0ca17883ed88e4d9addf8b90061d25a80d77022
2021-01-19 23:53:16 +03:00
Leonid Yuriev
a906569c58 mdbx: merge branch 'master' into devel-rebase.
Change-Id: I96d944f283029b9c60e45683ee66b4564273b407
2021-01-19 23:51:52 +03:00
Leonid Yuriev
b98895b8c7 mdbx: fix unaligned access to bootid on the meta-pages.
Assume this fixes https://github.com/erthink/libmdbx/issues/153

Change-Id: I062c1bd99795a7b875d1cf60658790c1071a6775
2021-01-18 14:27:58 +03:00
Leonid Yuriev
e766df658c mdbx-backport: avoid 4-byte aligned (i.e. unaligned) access to 64-bit integers.
Historically, the page header provides 4-byte data alignment.
Therefore, unfortunately, the meta page data is also aligned on a 4-byte boundary, but contains 64-bit values.

This commit eliminates potentially unsafe access (SPARC, MIPS, etc) to these 64-bit values aligned on a 4-byte boundary.
Thus, a build with the `-fsanitize=undefined` now passes the tests both with CLANG 11 and GCC 10.

Change-Id: Ie441103e53ed96fd40507d8c0be0689e3fee69f5
2021-01-18 14:08:49 +03:00
Leonid Yuriev
082df3a573 mdbx: refine MDBX_opt_* descriptions and defaults.
Change-Id: I99ddf530d5683b755bc8bab1ea1098b0cc00b181
2020-12-17 22:03:14 +03:00
Leonid Yuriev
697fce7ebc mdbx: rename MDBX_END_PURE_COMMIT (cosmetics).
Change-Id: Ia3bdeca5989c841c0dc969e22981044fb334bf32
2020-12-17 22:03:14 +03:00
Leonid Yuriev
70e76bcb4d mdbx: merge branch 'master' into devel.
Change-Id: Idc8838922081cbc8ebe6c564555e4d304b529588
2020-12-17 21:52:35 +03:00
Leonid Yuriev
d77af0bc1f mdbx: more checks against the use renewed (re-created or re-opened) DBI-handles.
More for https://github.com/erthink/libmdbx/issues/146

Change-Id: I09e40598aca18e7ebd9798dc3be8675de3f8d976
2020-12-17 10:36:05 +03:00
Leonid Yuriev
735da5fedd mdbx: auto-shrink env's DBI table.
Change-Id: I9f423dab41863119a4491491e0ecd0a4aee42a82
2020-12-17 01:57:06 +03:00
Leonid Yuriev
cda64ca663 mdbx: rework open/import/export of DBI-handles for robustness
Resolve https://github.com/erthink/libmdbx/issues/146

Change-Id: Idd18dc0d038eeba47668983ecf4ff46eabd16de5
2020-12-17 01:57:02 +03:00
Leonid Yuriev
166ed1c7d4 mdbx: refine prev commit (avoids SIGSEGV but assertion failure).
More related to https://github.com/erthink/libmdbx/issues/146

Change-Id: Ie5277a8cc56421d20a7c9aad83724991b2efdc2d
2020-12-15 15:43:19 +03:00
Leonid Yuriev
3758e7697e mdbx: more checks inside mdbx_cursor_close().
Related to https://github.com/erthink/libmdbx/issues/146

Change-Id: I7b90a0e515aa6320b0e89ec52fe01bc0be126071
2020-12-15 15:07:42 +03:00
Leonid Yuriev
315ef41455 mdbx: use MDBX_PGL_LIMIT for DPL as a soft-limit and options.dp_limit as spilling-pressure to avoid false-positive MDBX_TXN_FULL.
Change-Id: I0caae71d044cefa2f36286c2ae9fe14e356a6b51
2020-12-06 14:42:13 +03:00
Leonid Yuriev
c1210d7c73 mdbx: refine mdbx_page_alloc() to avoid MDBX_TXN_FULL.
More for https://github.com/erthink/libmdbx/issues/123

Change-Id: I527b7e9507f4c2aa565f1567924cfb1c477966dd
2020-12-06 14:39:19 +03:00
Leonid Yuriev
a4df0acb00 mdbx: more logging for FD < STDERR_FILENO.
More for https://github.com/erthink/libmdbx/issues/144

Change-Id: I8dcd3cab8a39b16a1836c88ec92b30d6b0de8b51
2020-12-06 14:35:38 +03:00
Leonid Yuriev
c4944a58d5 mdbx: avoid spelling errors (cosmetics).
Change-Id: Ibf14e003ba740ba757b5403e92fd220e68930ce4
2020-12-05 22:51:45 +03:00
Leonid Yuriev
d116e7235a mdbx-posix: safeguard for DB corruption in case FD <= STDERR_FILENO.
Resolve https://github.com/erthink/libmdbx/issues/144

Change-Id: Ic3467338d494b021fa0d1863c8227976d0a2bcd5
2020-12-05 22:51:45 +03:00
Leonid Yuriev
3e7459b428 mdbx-windows: fix mdbx_realloc() for nullptr and MDBX_AVOID_CRT=ON.
Change-Id: I129221186d65254da5b1d84747e5c59d53864b70
2020-12-05 09:45:03 +03:00
Leonid Yuriev
338de2e1fb mdbx: refine mdbx_page_spill().
More for https://github.com/erthink/libmdbx/issues/132.

Change-Id: I40788c13b54453c17d5e5dae6c3d2f93226f8e00
2020-12-04 15:38:26 +03:00
Leonid Yuriev
12ee5e6cac mdbx: minor refine mdbx_page_flush().
More for https://github.com/erthink/libmdbx/issues/132.

Change-Id: I703e1359d859b8901fcbdf57211f7805cd6d5ff1
2020-12-04 15:38:26 +03:00
Leonid Yuriev
262e4981db mdbx: refactor mdbx_pages_xkeep().
More for https://github.com/erthink/libmdbx/issues/132.

Change-Id: Ie81b5c9efafa06e61d6d983769ff1f11a0e59a1e
2020-12-04 15:38:15 +03:00
Leonid Yuriev
df8260e29a mdbx: add mdbx_pnl_purge_odd().
More for https://github.com/erthink/libmdbx/issues/132.

Change-Id: I1926ee48785f30b82e827a8e1e69be1e7a0a209f
2020-12-04 15:38:15 +03:00
Leonid Yuriev
87c765c7be mdbx: fix/check lower border for dirty-pages list's limits/options.
More for https://github.com/erthink/libmdbx/issues/128.

Change-Id: Ie9dccee5cf90d26968db04f4f6d9afa3018fcf0e
2020-12-04 15:38:15 +03:00
Leonid Yuriev
0b02e080c4 mdbx: use pnl_xmerge() to merge spill-pages lists.
More for https://github.com/erthink/libmdbx/issues/132.

Change-Id: I1f84a2be1fa5da6cf0e2783ff56f7a4c20782a7f
2020-12-04 15:38:15 +03:00
Leonid Yuriev
d9bd306da3 mdbx-load: add -p option (purge subDB).
Change-Id: I678950c99c8b4aea1add4ce548c9b4fe4ab8bfe6
2020-12-03 21:52:22 +03:00
Leonid Yuriev
90309ec0bf mdbx: merge branch 'master' into devel.
Change-Id: Ib1d07cf6eb2e4c76b3be969b28bf2317cb326835
2020-12-03 18:42:10 +03:00
Leonid Yuriev
eb31b765a5 mdbx-tools: use MDBX_SAFE_NOSYNC | MDBX_ACCEDE inside mdbx_load.
Change-Id: Id5a3a447d6b80b96a97ec76c258825583546d791
2020-12-03 17:58:21 +03:00
Leonid Yuriev
76716c23b0 mdbx: add MDBX_opt_txn_dp_initial & MDBX_opt_txn_dp_limit.
More for https://github.com/erthink/libmdbx/issues/128

Change-Id: I4be3c7476e9ce16ed4f27691d0df653552930e3c
2020-12-03 17:17:30 +03:00
Leonid Yuriev
84235c7903 mdbx: drop unnecessary MDBX_HUGE_TRANSACTIONS option.
Change-Id: I86116c2bada268d6e0a5c97deff808aaffe3e599
2020-12-03 17:17:28 +03:00
Leonid Yuriev
c5061f9289 mdbx: dynamic dirty-page-list size.
Resolve	https://github.com/erthink/libmdbx/issues/123

Change-Id: I5d9b2d8c2259132617fd2b226b9d9a6790fcad88
2020-12-03 17:17:07 +03:00
Leonid Yuriev
6a5cec1f87 mdbx: refine mdbx_dpl_search().
Change-Id: I8acc87d9c2f306c981ad42cc859d32b7cfd7330e
2020-12-03 10:25:36 +03:00
Leonid Yuriev
d8d89cca7d mdbx: refactor dirty-page-list (preparation to rework).
Change-Id: Ib52bb52f73ef1d31f55838d879de081fc0a140c2
2020-12-03 10:25:36 +03:00
Leonid Yuriev
7210f994fb mdbx-windows: fix mdbx_realloc() for nullptr and MDBX_AVOID_CRT=ON.
Change-Id: I129221186d65254da5b1d84747e5c59d53864b70
2020-12-03 10:25:24 +03:00
Leonid Yuriev
a987301204 mdbx++: refine abort/commit.
More for https://github.com/erthink/libmdbx/pull/143

Change-Id: I07de4c43d039f904495f0f4caf586d8764174dcf
2020-12-03 09:32:25 +03:00
sasgas
5c693ccd96 mdbx++: fix missing null assignment.
Resolves https://github.com/erthink/libmdbx/pull/143

Change-Id: Ifb88cebe2f07297a2f6cf70e31ae6abe61a0c0b2
2020-12-03 09:17:36 +03:00
Leonid Yuriev
5636dbf12b mdbx: add mdbx_dpl_alloc() & mdbx_dpl_free().
Change-Id: I0f05ff02d4a45d02faa1076cbb1a2a8e17b7e2b9
2020-12-02 20:07:59 +03:00
Leonid Yuriev
c530c83337 mdbx: drop me_dirtylist field.
Change-Id: I93ee802c1b6ef5c6a2443e19754e1a20dbe0aea9
2020-12-02 20:07:59 +03:00
Leonid Yuriev
0b62453f6d mdbx: introduce MDBX_PGL_LIMIT.
Change-Id: Ifab1156ec22fb0908284298393f52c09c0731829
2020-12-02 20:07:59 +03:00
Leonid Yuriev
4cd08f0ef9 mdbx: add MDBX_opt_rp_augment_limit.
More for https://github.com/erthink/libmdbx/issues/128

Change-Id: I94f3350b72ad11d0b586aaef1574f7654223bc40
2020-12-02 20:07:55 +03:00
Leonid Yuriev
461ba000e3 mdbx: add MDBX_opt_dp_reserve_limit.
More for https://github.com/erthink/libmdbx/issues/128

Change-Id: I620b6dcd833fcff19680770974f32431ab91c0ab
2020-12-02 12:42:16 +03:00
Leonid Yuriev
42019e0b8d mdbx: add dp_reserve_limit with 1024 default.
More for  More for https://github.com/erthink/libmdbx/issues/128

Change-Id: Ia92b1aea58640f183202495e3f6e2d531057afd2
2020-12-02 12:42:16 +03:00
Leonid Yuriev
8f60050991 mdbx: initial support for set/get_options.
Initial for https://github.com/erthink/libmdbx/issues/128

Change-Id: I540784c8b54d7443748e3c95f89a7390b818c811
2020-12-02 12:42:13 +03:00
Leonid Yuriev
a8ed534cd3 mdbx: avoid 4-byte aligned (i.e. unaligned) access to 64-bit integers.
Historically, the page header provides 4-byte data alignment.
Therefore, unfortunately, the meta page data is also aligned on a 4-byte boundary, but contains 64-bit values.

This commit eliminates potentially unsafe access (SPARC, MIPS, etc) to these 64-bit values aligned on a 4-byte boundary.
Thus, a build with the `-fsanitize=undefined` now passes the tests both with CLANG 11 and GCC 10.

Change-Id: Ie441103e53ed96fd40507d8c0be0689e3fee69f5
2020-12-01 20:23:23 +03:00
Leonid Yuriev
adcb052915 mdbx: fix minor MSVC warnings. 2020-11-29 06:04:55 +03:00
Leonid Yuriev
2dab009e76 mdbx-windows: handling EXCEPTION_POSSIBLE_DEADLOCK.
Change-Id: If42c7833e9c4e02fef25634e69c0bd2e926686c1
2020-11-29 05:49:15 +03:00
Leonid Yuriev
6d2914c99b mdbx: minor/insignificant fix checking mdbx_rdt_lock() result for cases mutex-recovery after EOWNERDEAD.
Change-Id: Ia5e13ea0d72afc97f7d678832a765a192dfacdff
2020-11-25 17:55:29 +03:00
Leonid Yuriev
2a740d3807 mdbx-windows: fix ERROR_NOT_SUPPORTED while opening UNC pathnames.
Resolve https://github.com/miranda-ng/miranda-ng/issues/2627

Change-Id: Iec06554dfcb9e0db215662d93fb5824cfe9ac7ef
2020-11-24 15:53:14 +03:00
Leonid Yuriev
23fd4444b5 mdbx-windows: remap whole section for mmap-resize if NtExtendSection() not available (Wine).
Some workaround for https://github.com/miranda-ng/miranda-ng/issues/1209

Change-Id: I8ce3cb0fb8bdc9bd36a05ab53343efbe4080d1f3
2020-11-23 10:47:07 +03:00
Leonid Yuriev
ddee04d991 mdbx: set DXB/LCK files position outside of a data.
Set the position in files outside of the data to avoid corruption
due to erroneous use of file descriptors in the application code.

Change-Id: I8750f6e726edaddee254885756d5f91576a6bcb1
2020-11-23 09:25:24 +03:00
Leonid Yuriev
f76bf72021 mdbx-windows: retry resize-mmap always with reservation (less chance to failure).
Change-Id: I472651f6906b88ba674868e0cd6c81318bfc255b
2020-11-20 11:52:44 +03:00
Leonid Yuriev
537e3d18ae mdbx: minor clarify mmap-resize logging.
Change-Id: Ibb6e4b8ee84d03a22ad0e0d1b437989739d43bb9
2020-11-20 10:38:04 +03:00
Leonid Yuriev
1bbf20bf39 mdbx: refine multi-thread flipping of buffers during env-copy.
Change-Id: Id132c1af0e1131da70ab1b35bce9f6a6548edbe3
2020-11-19 11:59:42 +03:00
Leonid Yuriev
9054b25441 mdbx: fix fast completion of nested txn for case ones was open present DBIs.
Change-Id: I87d28d1da5f72cc7ad77f8dd3f9a181f7eaa0024
2020-11-19 09:26:33 +03:00
Leonid Yuriev
862cfb9a3b mdbx-windows: refine WSL1 detection.
Try to fix https://github.com/snej/nimdbx/issues/1

Change-Id: Iec1c77c82ced8095e3f4e03a27a58e0bba3df76b
2020-11-18 22:38:26 +03:00
Leonid Yuriev
26767a5e06 mdbx: relax big-page size checking for compatibility.
i.e. allow an overflow page be larger than required by placed data.
2020-11-18 03:42:05 +03:00
Leonid Yuriev
96c2a56aa1 mdbx: use MDBX_SET_LOWERBOUND in mdbx_get_equal_or_great().
Change-Id: I5dd72fe82bd15938afc60cbc0f92e23c00f0d344
2020-11-17 08:13:46 +03:00
Leonid Yuriev
5e02e7fb56 mdbx: add MDBX_SET_LOWERBOUND for mdbx_cursor_get().
Change-Id: I3638fdd10be8dfe128c43b465e9ca71f89175b3e
2020-11-17 08:13:46 +03:00
Leonid Yuriev
9ea6922a2f mdbx: minor simplify mdbx_cursor_set().
Change-Id: I034f396368024af21e8ee741c13a28c9bc277121
2020-11-17 07:59:51 +03:00
Leonid Yuriev
56a52b0b01 mdbx: merge branch 'fix-131' (early part) into devel.
Change-Id: I0df5ffa9f06da1196a60d5a7c68fed59b7027e4c
2020-11-16 07:07:53 +03:00
Leonid Yuriev
149b3d09e6 mdbx: don't export DBIs from nested txn.
Change-Id: I8c354ac7f889debe2fcf830263cb060253887652
2020-11-16 07:07:39 +03:00
Leonid Yuriev
1c925a0f2e mdbx: minor fix/avoid assertion inside mdbx_cursor_set().
Change-Id: I2cc38da698765b3eaa2bb575e16505d5d9438431
2020-11-16 07:07:39 +03:00
Leonid Yuriev
0c3deac9db mdbx: fix cursors-EOF after search.
Change-Id: Ie578611b64cca8dbcc00f958510143e8d1dc262a
2020-11-16 07:07:39 +03:00
Leonid Yuriev
21bbba82fb mdbx: minor fix cursor_on_first/last for empty sub-db.
Change-Id: I68c2e1bd28e62c9512bf8ef711fe21573e3450b9
2020-11-16 07:07:39 +03:00
Leonid Yuriev
4ea2bea22e mdbx: fix save/restore/commit cursors for nested txn.
Change-Id: Ibaf356bbc631ca2e41058787bd3e4aaaa8bc085a
2020-11-16 07:07:38 +03:00
Leonid Yuriev
e328c1f829 mdbx: refactor/move mdbx_cursor_count().
Change-Id: I5487342013dfc3a9cf12d9081471ace0c37de23d
2020-11-16 07:07:38 +03:00
Leonid Yuriev
ca115dd6a4 mdbx: refactor/rename/refine tw.cursors internals.
Change-Id: Ie46d15f52a9d7365b52534a630754a31d3005a69
2020-11-16 07:07:38 +03:00
Leonid Yuriev
9a2dbb845c mdbx: refactor/refine cursor next/prev.
Change-Id: I0bfe0fed62e137e933027ba90cec23dbf1a6310b
2020-11-16 07:07:38 +03:00
Leonid Yuriev
5f09ec73c9 mdbx: return MDBX_ENODATA instead of MDBX_EINVAL for non-positioned/EOF cursor and MDBX_GET_CURRENT.
Change-Id: I2adf76f8f662e77e5a6aa077344fab6b430975c4
2020-11-16 07:07:38 +03:00
Leonid Yuriev
c55f99073b mdbx: fix MDBX_NEXT for EOF case.
Change-Id: I84c033a24d2215a4867affab5b148bf6ba5d57dc
2020-11-16 07:07:38 +03:00
Leonid Yuriev
b1446b7752 mdbx: minor fix/distinction MDBX_EBADSIGN and MDBX_EINVAL errors for cursors.
Change-Id: I6d72638a69ff0f793156fe5e0e7ca5531a97c7cf
2020-11-16 07:07:38 +03:00
Leonid Yuriev
b6f0070f85 mdbx: add mdbx_cursor_copy().
Change-Id: I476f1230beec6a550897bef236745530154c1079
2020-11-16 07:07:38 +03:00
Leonid Yuriev
2489e0ba6e mdbx: refactor/rename cursor_copy_internal().
Change-Id: I334e68d3d424ef15cafcaafd23d61f80611fce01
2020-11-16 07:07:38 +03:00
Leonid Yuriev
459e769844 mdbx: engage cursor tracking for all merge/rebalance operations.
Assume this resolves https://github.com/erthink/libmdbx/issues/131.

Change-Id: I5111618a34d91d083b81245ac959b744a86c4495
2020-11-16 07:07:27 +03:00
Leonid Yuriev
37a1d546b7 mdbx: minor refine mdbx_rebalance().
Change-Id: I10a6a208b173bdee1d325aa7b2624de879814647
2020-11-16 06:28:11 +03:00
Leonid Yuriev
b209e91ad4 mdbx: zeroed mc_top while tracking nested cursors.
This avoids scanning dummy cursors during tracking.

Change-Id: Id4edc665010215b4a946f9438475691f1387313c
2020-11-16 05:48:44 +03:00
Leonid Yuriev
0c78da99b0 mdbx: add cursor_is_tracked() and assertions.
Change-Id: I83db1a714597b134aa30e4ca7019bb7f541a2428
2020-11-16 05:48:23 +03:00
Leonid Yuriev
10681a53ae mdbx: cleanup/refine GC-flags inside mdbx_page_alloc().
Change-Id: Ie81c703815a7b3fbe59ad9b406811d5ed2913d02
2020-11-16 05:43:53 +03:00
Leonid Yuriev
06691aeafc mdbx-load: fix/preserve DB geometry without the mapsize header item.
More for https://github.com/erthink/libmdbx/issues/136.

Change-Id: I385869f2894ebe83b00b4e5b7ac4cacaabaf25d9
2020-11-16 00:53:34 +03:00
Leonid Yuriev
462df477b0 mdbx-load: cosmetic fix missed space.
Change-Id: Ifb9deb7c31d2d191b621280b6afd63fad9d436a3
2020-11-15 07:57:46 +03:00
Leonid Yuriev
74e495569e mdbx-load: fix DBI-error without -s name option.
Related to https://github.com/erthink/libmdbx/issues/136

Change-Id: I1e634456867f92dc1488a826eabf65ab28e64c1b
2020-11-15 07:57:15 +03:00
Leonid Yuriev
3ed58c281a mdbx-load: fix hang at EOF in the 'plain text' (i.e. no headers) mode.
Related to https://github.com/erthink/libmdbx/issues/136

Change-Id: I6ac9762bc5ac6aaf8b947b2e4abb0b4ff6a14444
2020-11-15 07:54:09 +03:00
Leonid Yuriev
21d2af9e90 mdbx: merge branch 'c++' into devel.
Change-Id: Ibd7f6c323aaf4f681a2c2dd442d36f4a9459d400
2020-11-01 00:39:19 +03:00
Leonid Yuriev
4cb8067dce mdbx++: always provide implementation for mdbx::path == std::string.
Change-Id: I8ef5c1531dc378b4141637ec4ddae3bbc67f1570
2020-10-31 23:24:05 +03:00
Leonid Yuriev
586e25c48c mdbx++: add operator<<(ostream, pair_result).
Change-Id: I44cc28f7f4f7d65225239d62f5bb8a15a8de16a8
2020-10-31 23:23:46 +03:00
Leonid Yuriev
e3f32ec6b4 mdbx++: refine operator<<(ostream, pair).
Change-Id: I0f42c17a241cf4e2ed6ae8f18e84a13ba5500a3b
2020-10-31 23:23:30 +03:00
Leonid Yuriev
4e198915f2 mdbx++: fix slice::is_printable().
Change-Id: I7f572f8e2179313e3cd312a58e46d445b920ba3e
2020-10-31 23:22:31 +03:00
Leonid Yuriev
5ad167410c mdbx: fix handling MDBX_GET_BOTH_RANGE.
Partially revert 77e84ccca8d634db087fc710b1c4aea69ee5a6a6 and 7522246ccdb3c1b0928aa3e0f593133db0fadae5.

Resolves https://github.com/erthink/libmdbx/issues/130

Change-Id: Ib9f49a3e6a108a0d914ccde7ccb4dc0ef6056ff7
2020-10-31 20:54:53 +03:00
Leonid Yuriev
70241e25db mdbx: don't limit reclaimed-pglist if DB full.
More for 55d190bad9723fd9766466005b1a14e70779fc89 and https://github.com/erthink/libmdbx/issues/123

Change-Id: Iecd19fe8f159d29a1434d03f43f0b277f2d6ab86
2020-10-30 19:22:37 +03:00
Leonid Yuriev
d9ceb84445 mdbx-tools: use mdbx_cursor_bind() inside the mdbx_load.
Change-Id: I632841817331dfd493125c95350ec79e26147171
2020-10-30 17:44:51 +03:00
Leonid Yuriev
0f64d0ee95 mdbx: update internal MDBX_NO_ROOT. 2020-10-30 17:44:51 +03:00
Leonid Yuriev
d5658c496f mdbx: fix mp_txnid check for spilled pages.
This is OMG stupid bug.

Тем не менее, ошибка не была замечена по трём причинам:
- some TODOs should be resolved, like [this](faddc71eac/src/core.c (4014)) and some others;
- test cases should be extended to triggering the page spilling threshold;
- mdbx_env_set_option() should be provide to tunning such threshold(s) (https://github.com/erthink/libmdbx/issues/128).

Resolves https://github.com/erthink/libmdbx/issues/126

Change-Id: If76336620aa83e6916e3aeaa838e0b6e68c34fd7
2020-10-30 17:44:31 +03:00
Leonid Yuriev
16c900b0a1 mdbx: fix assertion inside mdbx_cursor_del0().
Change-Id: I87ad3777215bee8a2b19f53ec92299db89431fa4
2020-10-29 00:55:42 +03:00
Leonid Yuriev
105947b50c mdbx: minor refine internals comments/docs.
Change-Id: Ie1dd2233259948b4906e66fb191832dbc6526c47
2020-10-29 00:55:12 +03:00
Leonid Yuriev
faddc71eac mdbx-tools: cleanup/refine mdbx_dump & mdbx_load. 2020-10-27 01:08:01 +03:00
Leonid Yuriev
3fd079262c mdbx: fix extra-rare MDBX_KEY_EXIST during mdbx_commit().
The MDX_KEYEXISTS error could occur inside mdbx_update_gc() in the extremely rare case:

- no GC records was reclaimed before mdbx_txn_commit() called;

- there were few loose pages during the transaction;

- some reader prohibit reclaiming, therefore mdbx_page_alloc(MDBX_ALLOC_GC),
  which called for obtain present GC-record's Id, returns MDBX_NOTFOUND;

- immediately then the reader completes its transaction and unlocks reclaiming;

- mdbx_update_gc() decide that no reclaimable GC entries,
  i.e. no GC-entries with ID < find_oldest(),
  and it is safe to use find_oldest() - 1 to store loose page list;

- but find_oldest() actually returns new/larger ID than expected,
  So KEYEXISTS will returned if using this ID.

Change-Id: I9726217d6b5983f1e31a211c0eeb3edc8ff94282
2020-10-26 14:37:16 +03:00
Leonid Yuriev
1804b78406 mdbx-debug: alter begin/end debug-includes.
Change-Id: I024e992f6864befa1a6cfbf2dd696c19095d3cdf
2020-10-26 14:36:59 +03:00
Leonid Yuriev
77e84ccca8 mdbx: refine mdbx_cursor_set() around the exact-flag.
Change-Id: Ifbad6bb4a3a4eabaf85c7986f9566705d53c45b9
2020-10-26 03:52:07 +03:00
Leonid Yuriev
7522246ccd mdbx: fix intenals for mdbx_get_equal_or_great().
Change-Id: I7b44df14c6f9ede4844d53e28c1b34d84fc664fa
2020-10-26 00:42:21 +03:00
Leonid Yuriev
005517539b mdbx: adds SIGPIPE suppression inside the env_copy-thread.
Change-Id: Ib7d22b8db7435b396bd997b65ae1d6d5d3431ba9
2020-10-23 03:22:22 +03:00
Leonid Yuriev
fed14c8f4c mdbx: minor tweak mdbx_pages_xkeep().
Change-Id: I6df699aeb49640b0365918c33cff05dcbcef2b71
2020-10-23 03:18:00 +03:00
Leonid Yuriev
55d190bad9 mdbx: avoid MDBX_TXN_FULL while searching for a large multi-page region.
Resolves https://github.com/erthink/libmdbx/issues/123
but with TODO:
 - provide a user-configurable threshold instead of currently hard-coded default (MDBX_PNL_MAX/2).

Change-Id: Ia7bfd5f8d36e027444d234e3c3aabe4832313466
2020-10-22 18:04:02 +03:00
Leonid Yuriev
8a7caec54a mdbx: cleanup deletion internals.
Change-Id: Ibcc5e02d5274c4eac5d6f269bc2b029f6b30c5ab
2020-10-22 16:28:44 +03:00
Leonid Yuriev
b0928219c3 mdbx: fast completion pure nested transactions.
Change-Id: I467cc0f2f3e781bf23bf8c45eb021987ae7c123b
2020-10-21 02:24:39 +03:00
Leonid Yuriev
daf37363b4 mdbx: fix cursor state after delete current entry.
The fix affect enough of code sections,
so there is a chance that some more changes will be required.

Resolves https://github.com/erthink/libmdbx/issues/121
Related to https://github.com/ledgerwatch/turbo-geth/issues/1147

Change-Id: I45b7637516de410923a0d723dbda8d818662ba15
2020-10-21 02:24:33 +03:00
Leonid Yuriev
b964b2abf5 mdbx: more spelling.
Change-Id: I45e42c1d8ef51f910b8e41279b92e54a6b2ce772
2020-10-21 01:00:48 +03:00
Leonid Yuriev
7001d971e1 mdbx: clarify/refine mdbx_flush_iov().
Change-Id: Ib9462efdbf97e42b1e80bf130f8150072102d9ed
2020-10-21 01:00:48 +03:00
Leonid Yuriev
f73a8a8680 mdbx: add latency gathering for commit stages.
Change-Id: If68ceb6e69e5e565ce9de0fd9a80424b6da280c5
2020-10-21 01:00:48 +03:00
Leonid Yuriev
7cf92b66cf mdbx: add LIBMDBX_INLINE_API (both inline and non-inline of some API functions).
Change-Id: I00c2b6d3d2a0467080791ea0c1c2242742a20c78
2020-10-17 01:00:36 +03:00
Leonid Yuriev
38485c9f30 mdbx: minor refine cursor_sibling().
Change-Id: I2c92ef2c3081dfa0a9bdcd47de0f912a9927519e
2020-10-16 18:57:07 +03:00
Leonid Yuriev
112ce742f5 mdbx: refine update_gc().
Change-Id: I877cdf2efb623c61dc810ec1cebb985fe925a120
2020-10-12 00:09:06 +03:00
Leonid Yuriev
62da4db09a mdbx: fix/refine the use of C11 atomics.
Change-Id: I5d925d4625b06296fd82f4b35ee36be682e7b2d3
2020-10-11 18:54:07 +03:00
Leonid Yuriev
041a4c0aa5 mdbx: make enabling of read-ahead strategy more aggressive.
Change-Id: I7765c1a1ac27db86ce9676846ec5a723860dc934
2020-10-11 01:14:30 +03:00
Leonid Yuriev
071ad525c8 mdbx: refine handle_env_pathname() for direct pathname of data-file inside sudir-mode.
Change-Id: I5b7e7c7ea5c17e00c344fedb5c96f8d94fc04fc8
2020-10-11 00:14:53 +03:00
Leonid Yuriev
1d71c677f6 mdbx++: add env::remove() method.
Change-Id: If0396d38738df88d054eb8fb752c7bd3afbd8487
2020-10-10 18:31:15 +03:00
Leonid Yuriev
0627d902dd mdbx: add mdbx_env_delete().
Resolves https://github.com/erthink/libmdbx/issues/119
Related to https://github.com/Kerollmops/heed/issues/58

Change-Id: Iec5bf5978e45bb6843f3ed8dd06ea4d34f2895cb
2020-10-10 00:58:53 +03:00
Leonid Yuriev
cd0c727880 mdbx: internally split-out mdbx_handle_env_pathname().
Change-Id: Ibe387662d737d4d1e274ac0e126053872be503f9
2020-10-10 00:52:41 +03:00
Leonid Yuriev
9bf7d53dc2 mdbx: MAX_MAPSIZE32 value has been reduced to 0x7f000000.
Change-Id: Ia45dd56621cd92441a45b8e80420a124cd111fdc
2020-10-10 00:52:41 +03:00
Leonid Yuriev
7ba13d8e72 mdbx: add internal bits/flags table.
Change-Id: Ia9d0e9f678b51d8ffd1830998e9cd5d04c749974
2020-10-10 00:52:41 +03:00
Leonid Yuriev
c139eacb2d mdbx-chk: avoid use GetTickCount64() for Windows 2000/XP.
Change-Id: Ibad5c5ec0590cd3776283237de2cb83126785726
2020-10-08 01:50:18 +03:00
Leonid Yuriev
9b64b95bbc mdbx-windows: fix mdbx_RegGetValue() for Windows 2000/XP.
Change-Id: I436a254300fcba8dbf75ea7568c2bf0c963fe060
2020-10-08 01:50:18 +03:00
George Hazan
e8fecd1eec mdbx: fix opening DB on a network shares (pass MDBX_EXCLUSIVE from env).
Change-Id: Ic5c68033ba81043ac7800f99aae364bf082c868f
2020-10-08 01:50:18 +03:00
Leonid Yuriev
0f3b82f661 mdbx: minor refine WITH_CURSOR_TRACKING macro.
Change-Id: I61a4782ae76aed624fe37f7dde2b0ef7eb5dfb64
2020-10-08 01:50:18 +03:00
Leonid Yuriev
b274fdd142 mdbx: clarify page-merge strategy.
Change-Id: I1bb843ab6bdfcd53deae6d219a5b164bd3a79fd3
2020-10-08 01:49:56 +03:00
Leonid Yuriev
f5ce471ebb mdbx: fix minor copy&paste typo.
Change-Id: I5a1be230d0ca92123006e709aaaf78496918c91a
2020-10-07 12:18:28 +03:00
Leonid Yuriev
fe65c122d2 mdbx: fix pthread_yield() for non-GLIBC.
Change-Id: I080e37a42b62e524896dea8747e9f23e2fcd584f
2020-10-06 00:28:12 +03:00
Leonid Yuriev
8d4e7994c0 mdbx-load: fix minor false-positive GCC warning.
Change-Id: Ie75c793712d050e8d3da76a4d0a8df9b81dc5275
2020-10-05 19:15:18 +03:00
Leonid Yuriev
70b615e8d4 mdbx: don't use yield instruction on ARM if unsupported.
Change-Id: I0b01d783fe4336b089f4b051fb61c203b5879aa5
2020-10-05 19:15:07 +03:00
Leonid Yuriev
280ed17ea2 mdbx: fix obsolete __noreturn.
Change-Id: Ic78843d6f16de2a409c16ceecc7acb2ed8aa3e68
2020-10-05 19:14:20 +03:00
Leonid Yuriev
fc965c57ac mdbx: fix merge_sync_flags() to preserve MDBX_UTTERLY_NOSYNC.
Change-Id: I59dbd1ef8ac1747dd20565ff444e4feb5d0e0e71
2020-09-30 04:01:36 +03:00
Leonid Yuriev
f6850f5367 mdbx: Support for user-settable cursor context.
Change-Id: I9bd60c432924e39020b2d3af3280f13c44d6cd91
2020-09-29 21:15:25 +03:00
Leonid Yuriev
72e136b9da mdbx-doc: fix/refine README & Doxygen docs.
Change-Id: I79cfb44f84fbf0f118b0d209af1ef62bb9dae72a
2020-09-29 21:15:25 +03:00
Leonid Yuriev
c8a0951566 mdbx: rework API and Docs around Handle-Slow-Readers (no algorithmic changes).
Change-Id: I5b76a8400ce6f5f241f8e4a7f53d746fe39f8e1e
2020-09-29 21:15:25 +03:00
Leonid Yuriev
6294e1710a mdbx: support for user-settable transaction context.
Change-Id: Ib4a345628e2c1ca2f95ac7615ea53d94911e5198
2020-09-29 20:59:55 +03:00
Leonid Yuriev
10c50aaf2e mdbx-cmake: minor refine MDBX_BUILD_TARGET/MDBX_BUILD_TYPE, etc.
Change-Id: I34f99c50ced56b310576743c56422a1e1992c03b
2020-09-29 20:59:55 +03:00
Leonid Yuriev
5374d06d92 mdbx: fix minor MSVC warning.
Change-Id: Ie3c9fa7ba21cd88f7a0c08a1529542ba394fe9c8
2020-09-29 20:59:55 +03:00
Leonid Yuriev
2a0c9d83e0 mdbx-load: refine usage-help for -n option.
Change-Id: I4af2ea041bca323f8647601f49610f93a8f97d38
2020-09-28 15:48:21 +03:00
Leonid Yuriev
c0cc531b50 mdbx-doc: minor refine man-pages for -n utils option.
Change-Id: Ie81145fc1ec70f66e6c7be7332b2106d6636dc6b
2020-09-28 15:48:21 +03:00
Leonid Yuriev
92bc728f39 mdbx: update warnings/errors for old version GCC/CLANG/MSVC/GLIBC.
Change-Id: I355316f6c8d96eae4bd5d9743f0b6e50caddcbcd
2020-09-27 17:01:59 +03:00
Leonid Yuriev
1e3f633665 mdbx: fix build with uclibc.
Change-Id: I907fecd84b335a84d5f1dcaa44ac489c4dfb1907
2020-09-27 17:01:59 +03:00
Leonid Yuriev
5627521f16 mdbx++: more spelling.
Change-Id: I3f33e695fb918c6a57c39047bba54a72ecb9bc5b
2020-09-27 17:01:59 +03:00
Leonid Yuriev
5d582b1b3a mdbx-chk: refine output (bootid, steady/weak, kv-kind).
Change-Id: Ia2474f7bb9a25adf761a561d0704362dca930796
2020-09-27 17:01:58 +03:00
Leonid Yuriev
6eaa838e3e mdbx: clarify logging for MDBX_WANNA_RECOVERY in case sync-needed in rdonly-mode.
Change-Id: I7032cfbce857e2acfb93de383272a4f41ab6a7fb
2020-09-27 17:01:58 +03:00
Leonid Yuriev
12339d4e7c mdbx: rename bootid' fields to be neutral for endianess.
Change-Id: I7d52d3c2c93dcc6e886d336885070eb1aee1c284
2020-09-26 02:23:09 +03:00
Leonid Yuriev
12652852bd mdbx-doc: update man-pages.
Change-Id: Ia9caf0082c32cf95526cc1080507c61f9269c9dc
2020-09-25 02:10:55 +03:00
Leonid Yuriev
af331a9e7c mdbx-tools: fix getopt's messages for windows.
Thank to Andrey Sporaw for the reporting.

Change-Id: I7531427c48b1a2f5483e2f04175cded2d34062a8
2020-09-25 01:53:43 +03:00
Leonid Yuriev
75a4463811 mdbx: minor misc cosmetics & refines.
Change-Id: I84b70aeded047ab3786a57c864dbc89364969afa
2020-09-25 01:21:45 +03:00
Leonid Yuriev
860aa017db mdbx: Merge branch 'master' into devel.
Change-Id: Ic130cd181097332aa2f49019d75403e18d8cba0d
2020-09-25 01:14:57 +03:00
Josh Soref
448728f584 mdbx: a lot of spelling (squashed).
Many Thanks to Josh Soref for these fixes.
https://github.com/jsoref

Resolves https://github.com/erthink/libmdbx/pull/118.

Change-Id: I4e09347da5c9d7a77cdd918a3b15284371440076
2020-09-25 01:01:25 +03:00
Leonid Yuriev
4eab5b238a mdbx-chk: support for turn to a specified meta-page.
Change-Id: I9d088681e7bd66a2f8b5917067c4f847733d17ac
2020-09-23 10:05:38 +03:00
Leonid Yuriev
58708f7162 mdbx: add mdbx_env_turn_for_recovery().
Change-Id: Ic02a5adf9ad398ae5b499e8808157e41ec42457e
2020-09-23 10:05:38 +03:00
Leonid Yuriev
9b5097fe9d mdbx: add paranoid checks for txnid overflow.
Change-Id: I0036a080d40a0da9ffc55ff838d91799ff0ceadb
2020-09-23 10:05:38 +03:00
Leonid Yuriev
c67a611313 mdbx-chk: refine output basic info of sub-databases.
Change-Id: Ia51b753990eb7a552dab016aab352b37c62ce4c3
2020-09-23 10:05:37 +03:00
Leonid Yuriev
7762e6e836 mdbx-chk: show last modification of each sub-database.
Change-Id: Ib424d17371adaef543a10b4f1d8a456cd6466046
2020-09-23 10:05:37 +03:00
Leonid Yuriev
d4b16c981d mdbx: fix minor Coverity warning.
Change-Id: Id92d85a7032a20a4b06d87878e32d8997b6558e3
2020-09-23 10:05:37 +03:00
Leonid Yuriev
45909eca61 mdbx-chk: fix minor typo.
Change-Id: Ib120f7af827463dd93af352fc8b4ce6af1926b75
2020-09-23 10:05:37 +03:00
Leonid Yuriev
7fe4fccda8 mdbx: acquire exclusive lock for the destination file during mdbx_env_copy().
Change-Id: Ic75796025dd2a649840b96b1f71aecac9360d010
2020-09-23 10:05:37 +03:00
Leonid Yuriev
24c0749eb8 mdbx: rework/refine mdbx_mresize() for POSIX and MAP_FIXED_NOREPLACE (Linux 4.17).
Change-Id: I2e531b5e3e009b2a18ae1901fc7e2e6e4df667cd
2020-09-22 04:07:43 +03:00
Leonid Yuriev
a7a8631bc3 mdbx: allow sync_file_range() to fail for Valgrind/QEMU cases.
Change-Id: I9aa77d1debfbd0cb18e940946533e4ed758d08e8
2020-09-21 17:18:07 +03:00
Leonid Yuriev
c01750be2e mdbx: provide MDBX_USE_SYNCFILERANGE option.
Change-Id: Icf1f27d6203653b4e2f2180a59a65e958c4d5e2e
2020-09-21 17:18:07 +03:00
Leonid Yuriev
a2e2e5c8a0 mdbx: allow sendfile() and copy_file_range() to fail for Valgrind/QEMU cases.
Change-Id: I37ee8d652d91a8d2106c782beceaacb13e9f667f
2020-09-21 03:29:38 +03:00
Leonid Yuriev
25e3968199 mdbx: provide MDBX_USE_SENDFILE and MDBX_USE_SENDFILE options.
Change-Id: Icd9a6487ae6e398276a9e720926ff24de5897c1a
2020-09-20 20:16:26 +03:00
Leonid Yuriev
765a18ed59 mdbx_chk: support for checking using specified meta-page.
Change-Id: Iadb930154acb966f03aa1dec9cc7cbdc76779f05
2020-09-19 02:55:19 +03:00
Leonid Yuriev
d9daf2944d mdbx: add env_open_for_recovery() (squashed).
Change-Id: I0151b21610def433745c33d1f6e0b66ce655d1a9
2020-09-19 01:48:24 +03:00
Leonid Yuriev
b321f67ed2 mdbx: Merge branch 'master' into devel.
Change-Id: I4f180753fe52b54f37f4fd12af2ba1b3ca541726
2020-09-19 01:47:12 +03:00
Leonid Yuriev
73647a5e46 mdbx: fix/refine mdbx_walk_tree() for working with invalid/corrupted DB.
Change-Id: I2594b785f675319027ff129d12683c4392e6e2f4
2020-09-19 01:44:21 +03:00
Leonid Yuriev
6a99303ec1 mdbx: fix mdbx_strerror() for MDBX_BUSY error.
Change-Id: Iea02f1daa3f52a9b737366e9af3c7def748ab523
2020-09-18 23:57:35 +03:00
Leonid Yuriev
e762442917 mdbx: don't resize mapping beyond used part of DB for read-only txn.
This allow reading extra large DB when used part is acceptable for current platform, i.e. reading DB >4G on a 32-bit platform.
2020-09-18 15:02:36 +03:00
Leonid Yuriev
488a272f8b mdbx: more for opening large DB from 32-bit env.
- return `MDBX_TOO_LARGE` only when used part of DB is too large for current platform;
- auto lowering both of `mm_geo.lower` and `mm_geo.upper` if the used part of DB is acceptable for current platform;

Change-Id: If67109ebb96063451c50f279c473ed38355a098a
2020-09-18 13:34:34 +03:00
Burak Arslan
efe400264f
mdbx: minor fix msvc build (#117). 2020-09-15 20:03:42 +03:00
Leonid Yuriev
10b170c6cd mdbx: add mdbx_cursor_create() and mdbx_cursor_bind().
Change-Id: I223de3cca7865d58f17a59ab27ec6be730e04a90
2020-09-15 02:05:25 +03:00
Leonid Yuriev
234d65dc9d mdbx++: update copyright & license note.
Change-Id: If6aac3dec6d05247aec5af956385066619685c35
2020-09-14 21:19:56 +03:00
Leonid Yuriev
cacc4aa829 mdbx++: changes after codereview-1 (part 2 of 2).
Change-Id: I8e1ca134bb8c5d447895f116247dfd12fa6871f0
2020-09-14 21:19:56 +03:00
Leonid Yuriev
04b0d258ff mdbx++: changes after codereview-1 (part 1 of 2).
Change-Id: If58c4281ce29f95fd566bc615082963a9500c381
2020-09-14 17:18:20 +03:00
Leonid Yuriev
da151e52a7 mdbx++: hide/move trouble_location to unused section.
Change-Id: If0cb1ae18e164819f916ff6fc1b5e6e487f50368
2020-09-14 02:23:19 +03:00
Leonid Yuriev
17d9ed31f9 mdbx: support for building by GCC 4.8
Change-Id: I4ad5c5be60233ae68936e0cbca1a0f01ec786bad
2020-09-13 21:22:41 +03:00
Leonid Yuriev
6c70a7fe11 mdbx++: enables C++ API for amalgamated source code.
Change-Id: Ie73f32ee6b9a565eee69fa7267798a0fd67db4b0
2020-09-13 21:22:41 +03:00
Leonid Yuriev
cd4caeb03d mdbx: add mdbx_panic() to C API.
Change-Id: I009a7889311b57ae2210822a8087889f900919f8
2020-09-10 15:37:59 +03:00
Leonid Yuriev
58bcfb006e mdbx: add mdbx_printf_args() macro.
Change-Id: I7fca72f8cc912d8644ecf149b755c78fb3cc7e23
2020-09-10 15:35:43 +03:00
Leonid Yuriev
50c25f479d mdbx++: more Doxygen descriptions and refinement.
Change-Id: Iec4cfa220f140c0fcc858f51283af2f9c4dd7a65
2020-09-10 01:15:35 +03:00
Leonid Yuriev
9249297d31 mdbx: fix MSVC compiler version requirements.
Change-Id: Iabf7ab571ca887bd7995ae6293d3c70bb85a947b
2020-09-07 12:38:08 +03:00
Leonid Yuriev
538d2e4d62 mdbx: skip update meta-geo in read-only mode.
Change-Id: I1c9610920ad87dc8110e8d03038ef385220000c8
2020-09-07 12:38:08 +03:00
Leonid Yuriev
81f82ae7b3 mdbx++: added partial doxygen descriptions and refined some methods.
Change-Id: I98bd4cb6e296970abbd40ffa049eff6051f30135
2020-09-07 03:10:25 +03:00
Leonid Yuriev
2bcd2e510e mdbx: Merge branch 'devel' into c++.
Change-Id: Iedfe7e7ae21d08628c24b4dd5a788bc43cced2f5
2020-09-05 13:48:40 +03:00
Leonid Yuriev
ab9f47a5fe mdbx: fix MSVC compiler version requirements.
Change-Id: Iabf7ab571ca887bd7995ae6293d3c70bb85a947b
2020-09-05 12:16:00 +03:00
Leonid Yuriev
54ccb92444 mdbx: skip update meta-geo in read-only mode.
Change-Id: I1c9610920ad87dc8110e8d03038ef385220000c8
2020-09-05 11:57:34 +03:00
Leonid Yuriev
c24e566591 mdbx: alter notice/warning/verbose level of some log-messages.
Change-Id: I08c3f5cf6489095f04c8becc4818d34b8db61422
2020-09-05 11:48:29 +03:00
Leonid Yuriev
6d7ec5a257 mdbx: enable non-debug logging in non-debug builds.
Change-Id: I295de5ef6369a55500b023abc3dcb26f5071c2da
2020-09-05 01:57:02 +03:00
Leonid Yuriev
b1877d08ae mdbx: rework mdbx_chk & tree-traversal.
Change-Id: Idc131539426fe0cbb97a105cff2d0a12b1496bfe
2020-09-05 01:57:02 +03:00
Leonid Yuriev
9a5df2b284 mdbx: refine errors returning from get_page().
Change-Id: I2da37d3b35679f345324d6dd97d2a3f634449b56
2020-09-05 01:57:02 +03:00
Leonid Yuriev
6867c13bd1 mdbx: more runtime checks/errors instead of assertions.
Change-Id: I843f28b7faeb23f986154dd92a0e2b50d66a1dde
2020-09-05 01:57:02 +03:00
Leonid Yuriev
a758e32f91 mdbx: remove assertions from page_check().
Change-Id: Ic157e7fc43d9c3a84e530d0001409ff2a5c1f818
2020-09-05 01:57:02 +03:00
Leonid Yuriev
6e339fc849 mdbx: add bad_page().
Change-Id: I5233e4a701ee11fd59d7083576f40f7df3068ddd
2020-09-05 01:57:02 +03:00
Leonid Yuriev
f0de3ff098 mdbx: continued page-check.
Change-Id: Id4aa37284a12f49e359a6c9391d2fd5b6acb2ad0
2020-09-05 01:57:02 +03:00
Leonid Yuriev
d6645f84f2 mdbx: more error logging.
Change-Id: I3757e587514450634b5d3ebf8721c9ed4ac182f1
2020-09-05 01:57:02 +03:00
Leonid Yuriev
cd6aa4a708 mdbx: parent-page-txnid checking.
Change-Id: I6d37326c4ff2aa32587704b971bd650d9221b06f
2020-09-05 01:57:02 +03:00
Leonid Yuriev
cd4f732a87 mdbx: drop internal unused fields.
Change-Id: I634d3e0695f300df79129a15da752a23b277a0ce
2020-09-05 00:55:00 +03:00
Leonid Yuriev
b095ad872c mdbx: add MDBX_ALLDUPS & MDBX_UPSERT, rework handling of others.
Change-Id: I27d437540d883935d78242e4fc7e28951ab9f496
2020-09-05 00:26:06 +03:00
Leonid Yuriev
0671114bbb mdbx++: Add support for C++17 polymorphic allocators.
Change-Id: I76054829551c247a4d8f81288fc47db47ead0288
2020-09-05 00:26:06 +03:00
Leonid Yuriev
5ec0f5b299 mdbx: refine mdbx_replace_ex().
We can skip update only when a data exactly the same,
but user's md_dcmp() may returns zero even data is NOT matches byte-to-byte.
So to skip update the cmp_len fast() should be used instead of md_dcmp().

Change-Id: I6ad0f7cfc6a18722b46e565deef3a544ddf9968a
2020-09-05 00:26:06 +03:00
Leonid Yuriev
33b1cf2931 mdbx++: Initial C++ API (some extra methods are not implemented).
Change-Id: I0478d0c94dcd12b52916e87815e5731817407c3c
2020-09-05 00:26:06 +03:00