[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: LMDB: MDB_MAP_FULL doesn't allow deletions
Hi Howard,
Thanks for your response. I tried using mdb_stat() previously, but I wasn't getting useful information. For instance, when testing a mini-DB (64K, 16 pages I believe), I had something like 1 branch page, 2 leaf pages and 0 overflow pages when I started getting MDB_MAP_FULL. My data is an 11 byte struct with an 8 byte key FWIW, so I'm not blasting the DB with big records, either.
It could just be that such mini DBs aren't going to be accurately statted, but it seemed like that method wasn't going to be reliable. Did I overlook something?
Thanks
Jeremy
Am 11.06.2013 um 19:32 schrieb Howard Chu <hyc@symas.com>:
> 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/