Commit graph

1226 commits

Author SHA1 Message Date
moneromooo-monero
4efa54e5f3 ITS#8857 document mdb_cursor_del does not invalidate the cursor 2020-10-10 13:20:57 +01:00
Howard Chu
0612992edf ITS#8908 DOC: GET_MULTIPLE etc don't return the key
Unnecessary since these are DUPs, the key will always be the same
2020-10-10 13:20:47 +01:00
Howard Chu
279cc7b836 ITS#8891 fix M$ WINAPI typedefs 2020-10-10 13:20:33 +01:00
Howard Chu
b65765443a ITS#8756 remove loose pg from dirty list in freelist_save 2020-10-10 13:19:04 +01:00
Howard Chu
bfe439cd52 ITS#8844 use getpid() in mdb_env_close0() 2020-10-10 13:17:18 +01:00
Howard Chu
8218d06717 ITS#8831 move flag init into readhdr
Avoid stomping on flags from 1st readhr invocation
2020-10-10 13:16:34 +01:00
Quanah Gibson-Mount
5a5e056f22 Happy New Year 2020-10-10 13:15:18 +01:00
Howard Chu
d52328b75d ITS#8819 can't use fakepage mp_ptrs directly 2020-10-10 13:12:59 +01:00
Howard Chu
bdfb167105 ITS#8324 More for Win32 NTDLL junk
Use GetProcAddress at runtime, avoid buildtime NTDLL link issues
2020-10-10 13:12:46 +01:00
Howard Chu
ec3e4ed9d8 Add mdb_drop tool 2020-10-10 13:12:34 +01:00
Howard Chu
4d747ff2f9 ITS#8760 fix regression in 0.9.19 2020-10-10 13:10:58 +01:00
Howard Chu
cf3588baae Add -a append option to mdb_load
To allow reloading of custom-sorted DBs from mdb_dump
2020-10-10 13:10:34 +01:00
Quanah Gibson-Mount
d9ef7ace69 ITS#8612 Fix Solaris builds with liblmdb
This patch fixes liblmdb builds on Solaris and derivatives by defining
_POSIX_PTHREAD_SEMANTICS
2020-10-10 13:10:14 +01:00
Hallvard Furuseth
b9488faae4 Tweak ITS#8722 fix: Use XCURSOR_REFRESH()
This checks XCURSOR_INITED() and fixes the mn_flags check.
2020-10-10 13:09:49 +01:00
Hallvard Furuseth
5601781247 XCURSOR_REFRESH() fixups/cleanup
* Check NUMKEYS(), similar to f34b61f947
  "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).
2020-10-10 13:09:39 +01:00
Howard Chu
2b397001a8 ITS#8728 fix MDB_VL32 freeing overflow page 2020-10-10 13:09:09 +01:00
Howard Chu
0e91bde589 ITS#8722 fix FIRST_DUP/LAST_DUP cursor bounds check 2020-10-10 13:06:28 +01:00
Howard Chu
05d5a9d3f6 Doc tweaks
Note about DB names being C strings
2020-10-10 13:06:19 +01:00
Howard Chu
27c8cee72d Add mdb_cursor_is_db()
Return 1 if the cursor is pointing to a named DB record
2020-10-10 13:06:09 +01:00
Howard Chu
e4cf950264 mdb_dbi_open tweak
Always save the terminating NUL of the incoming DB name
Stop using the old mdb_open/mdb_close function names
 .. should consider renaming mdb_stat/mdb_drop to mdb_dbi_... too.
2020-10-10 13:05:55 +01:00
Howard Chu
3585a1eb97 ITS#8704 Fix PREVMETA, rename to PREVSNAPSHOT
and enforce exclusive access to environment. Also fix txn_begin/pick_meta
to use correct meta page, and reset the flag after successful commit.
2020-10-10 13:04:50 +01:00
Hallvard Furuseth
16839f9893 Unref ovpages when deleting them 2020-10-10 13:04:37 +01:00
Hallvard Furuseth
73d75c6215 Drop always-false MDB_WRITEMAP test when IS_DIRTY_NW() 2020-10-10 13:04:26 +01:00
Howard Chu
789c71c4c9 ITS#8704 Add MDB_PREVMETA support to tools 2020-10-10 13:04:09 +01:00
Howard Chu
d12ebb655a ITS#8704 Add PREVMETA to envflags() 2020-10-10 13:03:58 +01:00
moneromooo-monero
0158f67c14 ITS#8704 add MDB_PREVMETA flag to mdb_env_open
used to open the previous meta page, in case the latest one
is corrupted

From https://github.com/LMDB/lmdb/pull/12
2020-10-10 13:03:36 +01:00
Hallvard Furuseth
b4ddec0bb4 Expose MDB_ENCRYPT flag 2020-10-10 13:03:21 +01:00
Hallvard Furuseth
6e1f74856d Rename mdb_env_getflags->envflags, clarify options
The old name resembled existing function mdb_env_get_flags().
2020-10-10 13:03:01 +01:00
Hallvard Furuseth
8b31a4a62b mdb_page_get() can ignore the toplevel spill list
...when we search dirty list before instead of after spill list.
2020-10-10 13:02:52 +01:00
Hallvard Furuseth
d6cf476169 Drop mdb_page_get() arg 'level', it's always NULL 2020-10-10 13:01:46 +01:00
Hallvard Furuseth
61b5b6270d Doc fixes 2020-10-10 13:00:52 +01:00
Hallvard Furuseth
24f437df86 Less hungry mdb_pages_xkeep()
Skip pages that are dirty only in an ancestor txn
2020-10-10 13:00:42 +01:00
Hallvard Furuseth
972917449d Keep MC_OVPG() == NULL when not MDB_REMAPPING()
Needed since 418ea8b94e14567ba2be9f9772f38f563a0d7e9c introduced
option MDB_REMAP_CHUNKS.
2020-10-10 13:00:27 +01:00
Howard Chu
499866aba7 ITS#8699 more for cursor_del ITS#8622
Set C_DEL flag on reinit'd subcursor
2020-10-10 13:00:16 +01:00
Howard Chu
81984ab228 Fix 418ea8b94e SEGV on spilled ovpg
Don't spill an ovpg that is referenced in a cursor
2020-10-10 13:00:01 +01:00
Hallvard Furuseth
adfa8f758a Drop P_DIRTY, and MDB_WRITEMAP dirty/spill lists
mt_workid = mt_txnid when WRITEMAP, so dirty pages == "spilled"
pages and mdb_page_flush() does nothing.
2020-10-10 12:59:16 +01:00
Hallvard Furuseth
f1db84d332 mp_txnid = page state, avoids searching dirty_list
In nested txns, check mp_txnid to see which txn dirtied the page.
This change will also let us remove the P_DIRTY flag, and keep
some flags in (dirty page).mp_txnid if we should need it.
2020-10-10 12:59:04 +01:00
Hallvard Furuseth
c83434e178 Demo - move P_DIRTY to P_ADM_FLAGS, page_dirty()
...to have something substantial to test P_ADM_FLAGS with,
at least until we drop the P_DIRTY flag.
2020-10-10 12:58:49 +01:00
Hallvard Furuseth
0a99df54af Divide page flags in P_ADM_FLAGS and the rest
P_ADM_FLAGS flags are tied to the page, even through page_loose-alloc.
OTOH mdb_page_split() should only duplicate the relevant flags.

This is just the code for the feature, P_ADM_FLAGS is 0 for now.
We'll need it for P_HIDESPILL later.
2020-10-10 12:58:38 +01:00
Hallvard Furuseth
3b55853fe0 Drop unnecessary searches in the spill lists
Check with IS_MUTABLE() if an MDB_page is spilled, instead of
searching spill lists.  When unspilling, skip parent spill lists.
2020-10-10 12:58:25 +01:00
Hallvard Furuseth
34461da97b Skip unnecessary mdb_page_get()s when spilling
Do not bring in pages merely to see if they should be skipped.
2020-10-10 12:58:11 +01:00
Hallvard Furuseth
6dd5a4d7f6 Protect freelist at end of mdb_freelist_save() 2020-10-10 12:57:59 +01:00
Hallvard Furuseth
12ee1a2d71 Use mdb_page_loose() more 2020-10-10 12:57:46 +01:00
Hallvard Furuseth
0e17ba43a8 Verify final loose_count in mdb_txn_commit()
Mismatch may indicate that pages leaked or got used twice
in the same snapshot.
2020-10-10 12:57:36 +01:00
Hallvard Furuseth
4b7e430303 mdb_page_touch: Always set MDB_TXN_ERROR on error 2020-10-10 12:57:23 +01:00
Hallvard Furuseth
9e3603eb9d Fix mdb_enctest()
Accept a partial ovpage.  I.e. decryption of the beginning
should not depend on the data at the end.
Make the key and IV less regular. (Divisor 67 has period>64.)
2020-10-10 12:57:10 +01:00
Hallvard Furuseth
214aff2359 Move misplaced OVERFLOW_NOTYET code
...so it would set pgno,txnid in the MDB_dovpage, not the actual ovpage
2020-10-10 12:56:52 +01:00
Hallvard Furuseth
74928f6a3b Fix broken mdb_page_get(ovpage) optimization 2020-10-10 12:56:41 +01:00
Hallvard Furuseth
ca8e48d994 Fix last commit - sizeof(pgno_t) and C90 compat 2020-10-10 12:56:25 +01:00
Howard Chu
757378fc1d Scaled back on overflow page work
Still keeping page header at top of overflow page for now
2020-10-10 12:56:11 +01:00