729 Commits

Author SHA1 Message Date
Leonid Yuriev
657d37c9e3 mdbx: add MDBX_OSX_SPEED_OR_DURABILITY build-time #define for MacOS. 2019-08-20 02:48:30 +03:00
Leonid Yuriev
ccbf3a2bcf mdbx: rework mdbx_filesync(). 2019-08-20 00:56:06 +03:00
Leonid Yuriev
261f697d8c mdbx: skip msync(MS_ASYNC) on Linux > 2.6.19.
Change-Id: Ic1f631ef856a09cf62353c2b0092b0341ecf4fa2
2019-08-19 21:31:23 +03:00
Leonid Yuriev
226cb3ac90 mdbx: use F_FULLFSYNC on MacOS. 2019-08-19 20:41:02 +03:00
Leonid Yuriev
91088af935 mdbx: initial OSX support. 2019-08-13 02:10:03 +03:00
Leonid Yuriev
7960f67ea6 mdbx-chk: "backed-pages > file-pages" isn't error in the non-exclusive or read-only modes. 2019-08-12 15:44:15 +03:00
Leonid Yuriev
bceace7a09 mdbx: clarify shrink/grow-related internals. 2019-08-12 15:44:15 +03:00
Leonid Yuriev
5244c1a9c2 mdbx-chk: "backed-pages less filesize" isn't an error on Windows.
Change-Id: Iea212a469225b0617221cdf292352eb1f896b4c6
2019-08-12 12:23:02 +03:00
Leonid Yuriev
cfaed9d761 mdbx-chk: don't use internal mdbx_filesize().
Change-Id: I539b92f345ba7884629b702b2568ca805466be3a
2019-08-12 11:40:58 +03:00
Leonid Yuriev
5b09105a6d mdbx-chk: check filesize/backed-pages/alloc-pages.
Change-Id: I231e461d81d3157441f67d2c28470283eb68920a
2019-08-12 02:55:53 +03:00
Leonid Yuriev
bc3d1a84cc mdbx-chk: use mdbx_env_stat2() and mdbx_env_stat2() to avoid races.
Change-Id: Ib956c19bec0b8bf9999cf1e97b8b630f119a0906
2019-08-12 02:55:53 +03:00
Leonid Yuriev
17407c9ecc mdbx: add mdbx_env_info2(txn) and mdbx_env_stat2(txn).
Change-Id: Ifd128185a084c9dc61da140eeeaaf4b6022d3537
2019-08-12 02:55:53 +03:00
Leonid Yuriev
d6a2f98ef5 mdbx: more env-signature checks.
Change-Id: I0155821e9b03731f755e43640d8dc9e5c12acf62
2019-08-11 22:54:06 +03:00
Leonid Yuriev
a6449f36f6 mdbx-chk: more for false-positive 'wrong idl entry' fix.
Change-Id: I66e42a98c8f4a5c58e12adb666984fed8a70bece
2019-08-11 21:41:01 +03:00
Leonid Yuriev
69f831af0b mdbx: refine lck-posix implementation. 2019-08-11 19:13:29 +03:00
Leonid Yuriev
036144eed4 mdbx-chk: fix false-positive 'wrong idl entry' error(s).
Исторически mdbx_env_info() получает информацию вне контекста
транзакции. Поэтому транзакция чтения, внутри которой проверяются записи
GC, может быть не последней. При этом в более новых транзакциях
последние страницы могут быть возвращены в пул нераспределенных с
уменьшением номера последней выделенной страницы. Тогда в проверяемом
снимке в записях GC могут быть номера страниц больше, чем возвращает
mdbx_env_info() в поле mi_last_pgno, что трактовалось в mdbx_chk как
ошибка.

Change-Id: I51ae102603e1eda77d6b6d511e2094410ab8c2c2
2019-08-11 16:49:15 +03:00
Leonid Yuriev
8917fb30bf mdbx: make lck-wait ops breakable for linux/posix.
Change-Id: Ieb113f3c01bceced99b122988f93331d5619c2be
2019-08-11 12:22:41 +03:00
Leonid Yuriev
bf0e0382fc mdbx: use O_DIRECT for db-copy.
Change-Id: Ib17fcdc2eba3382ed841a1e5e0a4f69f88c2491d
2019-08-11 01:14:52 +03:00
Leonid Yuriev
bdc77df921 mdbx: fix race-with-close for lck-posix.
Change-Id: Ie601ebbec8cc47d26935e12a57abe991aec1cb41
2019-08-11 00:07:21 +03:00
Leonid Yuriev
673f867e3c mdbx: minor refine Linux lck-implementation.
Change-Id: Ib95398f8d86eb94fc55b506066f78eda4a29f4a8
2019-08-10 23:25:17 +03:00
Leonid Yuriev
c6369e68a3 mdbx: draft support for non-Linux POSIX-platforms (FreeBSD, MacOS, etc).
Change-Id: Iaee2dc31b134fe92fc67508d011835a60f3723e6
2019-08-10 23:24:31 +03:00
Leonid Yuriev
ce64c5aa37 mdbx: use OFD (open file) locks on Linux.
Change-Id: Id9718da28d4e367b0ff10976d2afaaf3d18122fb
2019-08-10 12:53:16 +03:00
Leonid Yuriev
a008b0b16f mdbx: description of lck-implementation for Linux.
Change-Id: I8fe5f49a19e5cc61198ecd96dfe479d0e17c10a5
2019-08-09 21:36:02 +03:00
Leonid Yuriev
1798904cf4 mdbx: description of internal lck API.
Change-Id: Ic677ba62ca566409a44234a1c0d8b0b41158fe86
2019-08-09 21:34:19 +03:00
Leonid Yuriev
663f3f3c58 mdbx: conditionally use cacheflush() for linux < 2.6.11
Change-Id: Id34c67797e14f709f767bf1b687319cd2dfef874
2019-07-22 00:19:15 +03:00
Leonid Yuriev
a6bad26e1d mdbx: rename/clarify flush_noncoherent_cpu_writeback().
Change-Id: I05a5df8d2a283159f449fc1e68a14d0a1861a714
2019-07-21 22:52:21 +03:00
Leonid Yuriev
f39044124e mdbx: clarify/rework invalidate_mmap_noncoherent_cache() for MIPS.
Change-Id: I70c279c2ba67191c7cb93cd8875082eb9c8e58b7
2019-07-21 22:52:16 +03:00
Leonid Yuriev
0b8ac37450 mdbx: reduces number of getpid() calls for checking PID against fork().
PID check could be ommited:
 - on Linux when madvise(MADV_DONTFORK) is available. i.e. after the fork()
    mapped pages will not be available for child process.
 - in Windows where fork() not available.

Change-Id: I4dd6bcb209cfc816ae3ec43825ea913d2249663c
2019-07-16 11:52:10 +03:00
Leonid Yuriev
4adb1ab2d8 mdbx: portability - rename lck-posix.c to lck-linux.c
Change-Id: I0ecee2b1a5d8e664eb795e5f5df2fa2d3cb73c83
2019-07-15 00:29:46 +03:00
Leonid Yuriev
2544a621e7 mdbx: portability - support for non-_GNU_SOURCE mode.
Change-Id: I9988d0ea8a9ddc06c799c65c4b2728bd17ff77e7
2019-07-14 15:13:43 +03:00
Leonid Yuriev
41f00485fd mdbx: portability - allows operation without mremap().
Change-Id: I7fed42d51259e582e9dbc401c78f7f829a80f71c
2019-07-14 15:11:59 +03:00
Leonid Yuriev
97e4f66d16 mdbx: portability - support for musl libc.
Change-Id: Ida8a3bd9da896bc6c00bef931ddf3dce65bef8eb
2019-07-14 15:08:10 +03:00
Leonid Yuriev
cf7160bda2 mdbx: portability - don't include malloc.h on BSD.
Change-Id: I67f580c073bfe52fbd2e4ff599354e6d0f597e95
2019-07-14 15:08:02 +03:00
Leonid Yuriev
097b274aa4 mdbx: portability - use C11 aligned_alloc().
Change-Id: I61819614ce355c8a2597c9b26997458b3d16081c
2019-07-14 15:07:54 +03:00
Leonid Yuriev
8f7ea1844b mddx: portability - compatibility with BSD-style __assert().
Change-Id: Ic18f2de8a23597c62fab07041aeb62960e82c37a
2019-07-14 15:07:47 +03:00
Leonid Yuriev
b3286bad16 mdbx: portability - fix __dll_hidden/__hidden typo.
Change-Id: Iccd225d8c77eafdccc7f021809c26843974153e4
2019-07-14 15:07:16 +03:00
Leonid Yuriev
3ac2af61aa mdbx: cleanup msvc-compat feature test defs.
Change-Id: I2c61bcecedc32beb3b0d70180da9e52cb7e6c9eb
2019-07-13 12:07:14 +03:00
Leonid Yuriev
eefbb7f063 mdbx: remove extra prep_backlog_data() inside update_gc().
Change-Id: Ic6250159c5abe03ed0705c7a432c5eb5b17b790e
2019-07-09 15:58:48 +03:00
Leonid Yuriev
4ecf78163d mdbx: fix/refine mdbx_find_largest().
Change-Id: Ib40ca0014da18793be0bdae5133806304ad42819
2019-07-09 03:27:23 +03:00
Leonid Yuriev
53563e75bb mdbx: fix DB-shrinking race with copy-asis & readers.
Change-Id: I1e05616de03d814850a1c8ad20e83941b2d1c911
2019-07-09 00:41:04 +03:00
Leonid Yuriev
bd5078347b mdbx: refine backlog preparation inside update_gc().
Change-Id: Ib18842c2922afba794d6ab69337580bcea29bfe6
2019-07-09 00:41:04 +03:00
Leonid Yuriev
06f16464aa mdbx-test: adds more jitter while DB opening.
Change-Id: Ic0f03f4fbe064ea00f719baa11b28cc24aafcb5b
2019-07-07 21:21:54 +03:00
Leonid Yuriev
1f89c494ff mdbx: refines OFF_T_MAX if it is not defined.
Change-Id: Ic453140e01725493cad0c98e73244c747d5f490e
2019-07-07 20:04:39 +03:00
Leonid Yuriev
8606803344 mdbx: adds paranoid mvcc-checks into read transactions.
Change-Id: I7f0f05010306b02b3b1ab8478217de70ffd211a0
2019-07-07 19:51:06 +03:00
Leonid Yuriev
41de36e93d mdbx: avoids infinite copy_file_range-loop when file is unexpectedly truncated.
Change-Id: I5a542a49fa4ac9ced8ca60266a084d52d3618804
2019-07-07 18:42:14 +03:00
Leonid Yuriev
7e1e142104 mdbx-chk: fix/refine error handling for sub-DBs.
Change-Id: I42460793bbe47815add1b3f61f3746f671a749d9
2019-07-07 01:47:10 +03:00
Leonid Yuriev
e2f37908b9 mdbx: fix/refine error handling while DB-pages walking.
Change-Id: If910e96cc7c30577531aab24b5a9573e5fe9126d
2019-07-06 21:25:11 +03:00
Leonid Yuriev
40112ebd62 mdbx: engage copy_file_range() for env_copy_as_is.
Change-Id: I7ea17914d80500ffa70451b80920d726f0e9c2f8
2019-07-01 18:37:36 +03:00
Leonid Yuriev
6960c45e59 mdbx: avoids EFAULT "Bad address" while copy-as-is if DB is swapped-out from RAM.
Change-Id: I711efc1c54a04745bd561bc5e1db5e6f6d8b7115
2019-07-01 17:55:58 +03:00
Leonid Yuriev
2e60256978 mdbx: drop EPIPE/SIGPIPE handling (since pipes are disallowed).
Change-Id: I56d4539333edea93cc1a2c3606cf959c82b98b19
2019-07-01 16:39:18 +03:00
Leonid Yuriev
38110579ba mdbx: drops mdbx_write(), using mdbx_pwrite() instead of.
Change-Id: Iff3de2d5ef3fa2e92607d46b96d4526e464e593b
2019-07-01 16:39:18 +03:00
Leonid Yuriev
5b88fe819c mdbx: fix pwrite() for WRITE_MAX.
Change-Id: If4924d20c1e267c2d3a190c860b89fc2fda0d517
2019-06-24 02:14:50 +03:00
Leonid Yuriev
cf004dddbc mdbx: use single cursor instance inside mdbx_env_walk().
Change-Id: I72cade64468a42fd27ebb4955d71ecbbabe64987
2019-06-24 02:14:50 +03:00
Leonid Yuriev
728f98d3de mdbx-check: refine leaf-pages info (cosmetics).
Change-Id: I0fdb467f1c1d51bfcdcef5edfe99c8e9ad66037e
2019-06-23 14:26:11 +03:00
Leonid Yuriev
bbf8ef0a4b mdbx-chk: fix space-usage statistics info.
Change-Id: I0cbbbc481f2e6dc37b29f6603ec1ead43b5d1864
2019-06-23 14:07:13 +03:00
Leonid Yuriev
05cf301774 mdbx: bump version to v0.3.0
Change-Id: Ic09361eda834c75d4fdb37dcbe5e8edbf0317f9b
2019-06-22 22:23:25 +03:00
Leonid Yuriev
47beba1782 mdbx: more 'unlikely'.
Change-Id: I472e4a922590cd4680a48416611cfd894fa120db
2019-06-22 22:23:17 +03:00
Leonid Yuriev
e3f8dc5501 mdbx: rework RECLAIMING inside update_gc().
Change-Id: I9cf592476780bfdb346472baa12497d68a3d5aad
2019-06-22 22:23:17 +03:00
Leonid Yuriev
be0ec1d38d mdbx: fix GC corruption due deep recursive rebalance from update_gc().
Change-Id: I810250deb25cd625e737000282b434e3158ef8cc
2019-06-22 02:00:47 +03:00
Leonid Yuriev
eecec74e21 mdbx: more unlikely (minor).
Change-Id: Id6139473b3e6a7c3f099acc64db3180448294d0a
2019-06-21 02:11:28 +03:00
Leonid Yuriev
52bc4a7f41 mdbx-check: minor refine to avoid deeply recursion.
Change-Id: I67f83a232ef47899f43c242b7e6295de4d7ec909
2019-06-20 21:08:31 +03:00
Leonid Yuriev
49d0e872a1 mdbx: iterate & check before recursion inside mdbx_env_pgwalk().
Change-Id: I27058a33f6dece0c3f206283a42ff74e5727417f
2019-06-20 21:04:47 +03:00
Leonid Yuriev
c91cc85c1f mdbx-chk: log sub-DBs when verbose > 0 (cosmetic).
Change-Id: Ie73c0773929b51eb11fb02afe18bb01b59fb2612
2019-06-20 10:12:26 +03:00
Leonid Yuriev
cd75c4f081 mdbx-chk: avoid continuing to check bad records.
Change-Id: I03b9d425c8413d6cacc1b67ed4a8253a10a9d603
2019-06-20 00:52:00 +03:00
Leonid Yuriev
2bea60a1a4 mdbx-chk: avoid infinite loop/recursion while checking corrupted DB.
Change-Id: I3edb053e4baedced8ce8e8cfa25f9851eaca35d1
2019-06-19 15:08:50 +03:00
Leonid Yuriev
c05702eacf mdbx: add MDBX_PGWALK-tags and refine pgwalk internals.
Change-Id: I1f4eb79463dc6eec3d94d43baab0b28ceefa8c03
2019-06-19 15:05:10 +03:00
Leonid Yuriev
ce0e5d67f5 mdbx-tools: avoid output NaN from mdbx_chk for empty tables.
Change-Id: Ie1ff87da3a5e5e124eac1dafd7d5b456f8bde6e3
2019-06-10 13:28:31 +03:00
Leonid Yuriev
b443477869 mdbx: workaround for Coverity Scan.
Change-Id: I0e2d22bbbd38ac7978fb8879219ded79a5be1b0a
2019-05-28 21:19:54 +03:00
Leonid Yuriev
870c2a6f9c mdbx: symmetrical/invariant mdbx_estimate_range() for MDBX_EPSILON order.
Change-Id: Ida7e07d6429576c457bcd4d877a3c38c88dc2771
2019-05-26 00:59:35 +03:00
Leonid Yuriev
e26b7501eb mdbx: add MDBX_EPSILON support for mdbx_estimate_range().
Change-Id: I2d89a9f20bfa16c8f35a4381709bc54f86f0ff67
2019-05-25 19:10:38 +03:00
Leonid Yuriev
b4002a8484 libmdbx: fix TAGRET typo (minor).
Change-Id: Iffafbed7fdad3492aeb51f17caf8109a5b3e35c0
2019-05-02 16:46:05 +03:00
Leonid Yuriev
6e3725457d mdbx: fix minor comment typo.
Change-Id: I56a465e820a49d13c49fb3bd05add970b0eebb14
2019-03-14 00:13:13 +03:00
Leo Yuriev
73f8839a97 mdbx: minor refine/clarify estimation internals. 2019-03-06 16:45:49 +03:00
Leo Yuriev
501eb8c6ad mdbx: more __hot/__cold attributes for functions. 2019-03-06 16:45:01 +03:00
Leo Yuriev
ee899a21ed mdbx: treat pagesize == 0/INTPTR_MAX as aliases for MIN_PAGESIZE/MAX_PAGESIZE. 2019-03-05 17:55:33 +03:00
Leo Yuriev
3535e7a6d6 mdbx: returns as-is (i.e. negative) the estimation results for an inverted ranges. 2019-03-05 15:50:45 +03:00
Leonid Yuriev
8ddfd1f34a mdbx: adds functions for distance/move/range estimation (initial).
Change-Id: If59eccf7311123ab6384c4b93f9b1fed5a0a10d1
2019-03-05 02:57:15 +03:00
Leo Yuriev
7d383350e8 mdbx: workaround for musl-libc __assert_fail() prototype bug. 2019-03-04 14:41:50 +03:00
Leo Yuriev
9ffd17d58b mdbx: refine mdbx_filesync() to avoid hide fdatasync() error. 2019-03-04 13:53:05 +03:00
Leo Yuriev
9f410597df mdbx: checking only _POSIX_SYNCHRONIZED_IO for fdatasync (musl). 2019-03-04 13:39:33 +03:00
Leo Yuriev
cca2c91058 mdbx: don't check __GLIBC_PREREQ/_BSD_SOURCE/_XOPEN_SOURCE for use fsync (musl). 2019-03-04 13:34:38 +03:00
Leo Yuriev
46b551e386 mdbx: add in-source definition for _POSIX_C_SOURCE and _XOPEN_SOURCE (musl). 2019-03-04 13:33:27 +03:00
Leonid Yuriev
14ae9fb2a1 mdbx: env_set_geometry() treat zero-values also as defaults.
Change-Id: If8c6f7d7bbeffe71ae4e28f27184103dd1da257b
2019-03-02 14:26:09 +03:00
Leonid Yuriev
01797cf1bc mdbx: env_open() consider zero mode_t as open-existing flag.
Change-Id: I6f9dbf2059822afaba4c3de8f4ce380613a7dc36
2019-03-02 13:31:08 +03:00
Leonid Yuriev
7617cce0c6 mdbx-tools: fix Coverity warning (paranoia).
Change-Id: I3ff33a9eb2c58fe601566fd4101f9c95d76d29de
2019-02-27 23:26:15 +03:00
Leo Yuriev
44a067283a mdbx: fix comment typo (minor). 2019-02-12 13:39:16 +03:00
Leonid Yuriev
49fa9b9c35 mdbx: fix handling MDBX_APPENDDUP mode.
Change-Id: I36de2a8dcab5126dab3857a7840ab3904a1d19c8
2019-02-04 01:41:11 +03:00
Leonid Yuriev
0639f54280 mdbx-test: add 'append' testcase.
Change-Id: I71620ea1a019e16b8e3d84a81dcc042961eae5b5
2019-02-04 01:41:11 +03:00
Leonid Yuriev
73bef80347 mdbx-check: add checking for complete duplicates.
Change-Id: I8308b725418ef69188eeadfc656dead4ce9cee27
2019-02-04 01:32:15 +03:00
Leonid Yuriev
460751bc01 mdbx-chk: add '-i' option for custom comparators.
Change-Id: Ie3d7fdb3c3a881a484d351ca9a3160eb467b43b9
2019-02-04 01:32:15 +03:00
Leo Yuriev
309955be75 mdbx-load: add '-a' option for loading dumps of custom-sorted DBs.
Based on http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=commitdiff;h=aa77c832b8e6fc696078017f550d119cdfc0f232

Change-Id: If7de71c8f6ffc29d4316c6074995fab38f2c1b4b

+load

Change-Id: Iff6cbca2514840ee290f801e3b273edf160913b4
2019-02-04 00:06:39 +03:00
Leo Yuriev
9ba8434c1d mdbx: fix __ANDROID__ typo.
Thank to Howard Chu <hyc@openldap.org>.

Change-Id: Ibcbe2e4790a5df5758d9fd6c621793ea42a94682
2019-02-03 17:53:00 +03:00
Howard Chu
bfffaa66b8 mdbx: import - tweak mdb_page_split (ITS#8969).
Bump up number of keys for which we use fine-grained splitpoint search

Change-Id: Icca2e1953cbcd6898b790f657636c2195b397790
2019-02-03 13:07:17 +03:00
Leo Yuriev
9cc9116df3 mdbx: 2019 HNY.
Change-Id: Iec6b7affedef0ea89fad917eb17af7e8201a7482
2019-02-03 12:28:01 +03:00
Leonid Yuriev
08508d34b3 mdbx: MDBX_BAD_DBI instead of MDBX_NOTFOUND in case table was dropped.
Change-Id: I2894a5721d2be2bb982e7c7a607c6a0413f7e3ca
2019-01-27 00:17:57 +03:00
Leonid Yuriev
5fd05db6ea mdbx: minor fix/refine mdbx_txn_straggler() for r/w-txn.
Change-Id: Id44a1db414de457d74a3e1d9d5c96064a7278080
2019-01-17 23:14:25 +03:00
Leonid Yuriev
4708e0cf79 mdbx-winfdows: fix returning negative value on failure.
Change-Id: Iaf5fb1f0cbcc3c14e2d3edf1f57538ecc0dfdf00
2019-01-17 23:10:04 +03:00
Leonid Yuriev
624968b74c mdbx-windows: use SetFileInformationByHandle() when available.
Change-Id: I27d9d4271d4328947ad68cdf30af61a31978b4f9
2018-12-28 13:53:57 +03:00
Leonid Yuriev
f778f4a795 mdbx: add MDBX_SAFE4QEMU option for testing under QEMU.
Change-Id: Ide674e0125e2746f73a7ba44828316a60633e887
2018-11-26 19:08:30 +03:00
Leo Yuriev
f55e1ec5cc mdbx-windows: more safety/robustness for DB shriking. 2018-11-22 17:50:49 +03:00