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

Re: LMDB: issue with mdb_cursor_del



On Wed, 2017-10-18 at 20:08 +0300, Леонид Юрьев wrote:
> 2017-10-18 19:40 GMT+03:00  <timur.kristof@gmail.com>:
> > Maybe mdb_page_dirty could be allowed to simply accept -1 as a
> > return
> > value from insert() and that could fix it? Since the page is
> > already
> > listed in the txn's dirty list, it shouldn't really matter. Or am I
> > misunderstanding the consequences of this?
> 
> Sure this will not create problems when working without MDB_WRITEMAP.
> But in MDB_WRITEMAP mode duplicates in the dirty-list seems may leads
> some side affects.
> Therefore in MDBX I had planned to completely rewrite
> freelist_save().

I think simply accepting -1 would fix this problem for everyone but
users of MDB_WRITEMAP in which case it doesn't affect the outcome
because a different function is called: mdb_mid2l_append which cannot
return -1.

So, I'd suggest this for mdb_page_dirty:
- mdb_tassert(txn, rc == 0);
+ mdb_tassert(txn, rc == 0 || rc == -1);

At least until a more proper solution is found.
Would that work?

Cheers,
Timur