0

In LMDB, if you overwrite a previous entry in the same transaction, it seems that the previous entry's space is not released until the data is committed. In my application, I encountered a case where LMDB ran out of space because a particular entry was overwritten so many times, so I just increased the database size to get around this problem.

Is there a way to free unused space in LMDB to prevent this situation from happening?

user1428945
  • 339
  • 1
  • 13

1 Answers1

0

There is no compaction mechanism in lmdb. If there are active readers when a writer is performing modifications on entries, these entries are copied to new pages in order to preserve consistent reads. When readers are done, old entries pages are returned to free pages, available to next modifications. So to limit storage over consumption, one has to perform multiple small writes without active readers.

Setop
  • 2,262
  • 13
  • 28