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

Re: LMDB: file size increase (due to new free pages) even though write transaction does not add/update items



> On Apr 3, 2016, at 8:35 PM, Howard Chu <hyc@symas.com> wrote:
> 
> Argyrios Kyrtzidis wrote:
>> Hi,
>> 
>> Thank you for making LMDB available.
>> 
>> I’m using LMDB on OSX (without MDB_WRITEMAP, so the database file size is relative to the stored data, not the max mapsize).
>> I’ve noticed that write transactions that have a large number of ‘attempted’ updates, but that do not actually make any updates due to MDB_NOOVERWRITE / MDB_NODUPDATA, cause an increase in the database file size, which mdb_stat attributes to an increased number of free pages.
>> This is with latest master of the github mirror.
>> 
>> I’m wondering if you have any hints on what I may be doing wrong ? I’d like if possible to avoid the database size increasing if the write pass did not make any updates.
> 
> Call mdb_txn_abort() instead of mdb_txn_commit() when you encounter KEYEXIST errors.

Thanks for the tip! I’d need to keep track of more information across the various database updates but it is doable.

Do you think there is a missed opportunity for reusing existing free pages ? I’d expect that it would not consistently increase the number of free pages, if there are free pages available.

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