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

Re: mdb_drop in lmdb



Conrad Steenberg wrote:
[resending to the list, doesn't seem to have gotten through]

Hi there,

I'm in the process of creating a binding for lmdb for the Crack
language. So far everything works really well, except that I'm not sure
about the workings of mdb_drop() to clear all the items from a database.

Is there an example usage somewhere that I can look at?

The definitive example of how to use LMDB is OpenLDAP slapd back-mdb. mdb_drop is used in back-mdb/tools.c.

You can also take a look at the dict_lmdb.c driver in Postfix 2.11 for another example.

Basically for an already open db handle inside an MDB_env I do
_tmpTxn = mdb_txn_begin(_env, NULL, 0)
mdb_drop(_tmpTxn, _dbi, 0)
mdb_txn_commit(_tmpTxn)
mdb_reader_check(_env)

However, when the db is opened again with mdb_dbi_open() I sometimes get
MDB_BAD_RSLOT: Invalid reuse of reader locktable slot

That seems a bit odd, mdb_dbi_open() cannot return MDB_BAD_RSLOT.

I'm sure I'm missing a step somewhere! Any ideas?

Might help to see your actual code that causes this situation.

Thanks!
Conrad






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