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

Re: (ITS#7825) LMDB: misleading error message

h.b.furuseth@usit.uio.no wrote:
> 5) Add field MDB_dbx.md_dbiseq = DBI usage sequence number,
> incremented when dbi_open creates (not reuses) a DBI and in
> dbi_close.  Copy it to a new malloced array txn->mt_dbiseqs[]
> in write txns, verify it in at least commit and drop.
> This means close()-open(same DB) will also be caught, which
> seems a good thing since with (4) it will work unreliably:
> Only if open() reuses the same DBI for the same DB.

This is now fixed in mdb.master, using basically this approach. There is a 
master array of DBI sequence numbers in the environment and another array in 
each write transaction. It is verified anywhere the dbx->md_name would get 
used. The sequence number is incremented in dbi_open and when a handle is closed.

Note - it is only checked in write txns, and only a few places (drop, commit, 
cursor_touch, page_search) ever check. There is a new error code MDB_BAD_DBI 
as well.

   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/