[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: LMDB: issue with mdb_cursor_del



On 16. okt. 2017 13:43, Леонид Юрьев wrote:
This is a bug (seems minor), I fixed it in the MDBX few days ago.
https://github.com/leo-yuriev/libmdbx/commit/9fd7056b4f02098914d813f38ba1ed2103c6b855#diff-185afae163fe87013315d2545a8b6055R3095

That's rather different from mdb.c.  mdb's page_touch() does not
mess with loose pages, for example.

Inside freelist_save() the mt_loose_pages could be merged into the mt_free_pgs.
http://www.openldap.org/devel/gitweb.cgi?p=openldap.git;a=blob;f=libraries/liblmdb/mdb.c;h=1bf81ed4c87901991b7cac885b0d8cbc4dd23436;hb=bb8502f08800a44a6b91a94d6478aa7101c4cc77#l3444

But at this point all loose_pages also still present in the mt_u.dirty_list.
On the next loop inside freelist_save() a one more page could be
requested, and page_alloc() could return a page which is already in
the mt_u.dirty_list.
In this case mdb_mid2l_insert() will return -1.

I don't understand you.  page_alloc doesn't call mdb_mid2l_insert()
for loose pages, since they are in dirty_list.

freelist_save() does mess with loose pages - are you saying it
is doing it incorrectly?  If so, that's what we need to fix.

--
Hallvard