[py-lmdb] Re: set_mapsize

  • From: David Wilson <dw@xxxxxxxx>
  • To: py-lmdb@xxxxxxxxxxxxx
  • Date: Fri, 28 Aug 2015 21:15:09 +0000

Hi KP,

AFAIK your only option is to catch lmdb.MapResizedError in each process
and respond to it by e.g. doubling the map size, before restarting
whatever operation caused it.

This was previously only available via Environment.__init__ because as
you can see, it's a fiddly process to resize the map at runtime.
Responding to MapResizedError isn't even the difficult part in the case of
threads, since calling set_mapsize() requires that no transactions are
active in the current process, which is a pain in the ass to ensure when
there are multiple threads.

There's a few more ideas in this bug
https://github.com/dw/py-lmdb/issues/97#issuecomment-130018935 and the
linked DIGITS bug.


David

On Fri, Aug 28, 2015 at 04:32:55PM -0400, KP wrote:

I just found the new 'set_mapsize'...very handy! Much better than my open /
close :)

Is there any chance of that one day being multi-process capable? Currently it
fails if another process has the DB open. I can try to do in the python code,
but was just curious if that was something that was being discussed elsewhere.

Other related posts: