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

Re: LMDB: MDB_MAP_FULL doesn't allow deletions



Jeremy Bernstein wrote:
Although I didn't figure out a good way to do what I want, this is what I am
now doing:

if (MDB_MAP_FULL while putting) {
   abort txn, close the database
   reopen the database @ larger mapsize
   perform some pruning of dead records
   commit txn, close the database
   reopen the database @ old mapsize
   try to put again
}

At this point, the database is probably larger than the old mapsize. To handle
that, I make a copy  of the DB, kill the original, open a new database and
copy the records from the old DB to the  new one.

All of this is a lot more complicated and code-verbose than I want, but it
works and seems to be reliable.

Nevertheless, if there's an easier way, I'm all ears. Thanks for your
thoughts.

Use mdb_stat() before performing the _put(). If the total number of pages in use is large (whatever threshold you choose, e.g. 90%) then start pruning.

Look at the mdb_stat command's output to get an idea of what you're looking for.
--
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/