Dobatymo / lmdb-python-dbm

Python DBM style wrapper of LMDB
ISC License
26 stars 8 forks source link

Question: How does autogrow work? #5

Closed dineshbvadhia closed 11 months ago

dineshbvadhia commented 11 months ago

Hi. I'm trying to understand how autogrow works from the code below. Could you please explain? Thanks

except lmdb.MapFullError:
    if not self.autogrow:
        raise
    new_map_size = self.map_size * 2
    self.map_size = new_map_size
    logger.info(self.autogrow_msg, self.env.path(), new_map_size)
Dobatymo commented 11 months ago

Well the code should explain it. When the DB is full, the db size will be doubled. Assigning to map_size calls lmdb set_mapsize.

dineshbvadhia commented 11 months ago

Ah got it. Thanks