Hi, Timur. There two different cases: with MDB_WRITEMAP, and without it.
1) With MDB_WRITEMAP the mdb_mid2l_append() will be used. Internally mdb_mid2l_append() don't check for duplicated, but just append a given page number to the list. Therefore when database opens with MDB_WRITEMAP this bug leads to duplicates inside the dirty-list and then (seems) to database corruption. 2) Without MDB_WRITEMAP the mdb_mid2l_insert() will be used. Internally mdb_mid2l_insert() made insertion into a sorted list, so it checks for duplicates and returns -1 for such case. Therefore when database opens without MDB_WRITEMAP this bug leads only to assertion failure, or nothing if assertions checking was disabled. Regards, Leonid. 2017-10-19 19:11 GMT+03:00 <timur.kris...@gmail.com>: > On Thu, 2017-10-19 at 08:12 +0200, Hallvard Breien Furuseth wrote: >> On 18/10/17 22:44, timur.kris...@gmail.com wrote: >> > On Wed, 2017-10-18 at 20:08 +0300, Леонид Юрьев wrote: >> > > 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. >> >> No, Leo is right. Duplicates in the freelist give a broken DB. >> > > I didn't suggest duplicates. I suggested accepting -1 from insert() > which merely indicated that the page is already on the dirty list. I > does not make a duplicate. > > Or am I getting it wrong? > >> A cleaner fix is for freelist_save() to quit messing with loose >> pages and just reserve room for them, like it does for me_pghead. >> >> I've reported ITS#8756 <http://www.openldap.org/its/?findid=8756>. >> >> -- >> Hallvard