Hi Leonid,
- 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.
- 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.
Yes, that's exactly what I said. That simply allowing -1 would fix the problem for the non-writemap case, because then there is no duplicate. Right?
- Timur