diff --git a/src/keri/db/basing.py b/src/keri/db/basing.py index d4263fc91..090b357d4 100644 --- a/src/keri/db/basing.py +++ b/src/keri/db/basing.py @@ -494,6 +494,9 @@ def reopenDB(db, clear=False, **kwa): db.close(clear=clear) +KERIBaserMapSizeKey = "KERI_BASER_MAP_SIZE" + + class Baser(dbing.LMDBer): """ Baser sets up named sub databases with Keri Event Logs within main database @@ -773,6 +776,9 @@ def __init__(self, headDirPath=None, reopen=False, **kwa): self._kevers = dbdict() self._kevers.db = self # assign db for read through cache of kevers + if (mapSize := os.getenv(KERIBaserMapSizeKey)) is not None: + self.MapSize = int(mapSize) + super(Baser, self).__init__(headDirPath=headDirPath, reopen=reopen, **kwa) @property diff --git a/src/keri/db/dbing.py b/src/keri/db/dbing.py index d3831e214..bd2db031f 100644 --- a/src/keri/db/dbing.py +++ b/src/keri/db/dbing.py @@ -306,6 +306,7 @@ class LMDBer(filing.Filer): TempSuffix = "_test" Perm = stat.S_ISVTX | stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR # 0o1700==960 MaxNamedDBs = 96 + MapSize = 104857600 def __init__(self, readonly=False, **kwa): @@ -380,7 +381,7 @@ def reopen(self, readonly=False, **kwa): # open lmdb major database instance # creates files data.mdb and lock.mdb in .dbDirPath - self.env = lmdb.open(self.path, max_dbs=self.MaxNamedDBs, map_size=104857600, + self.env = lmdb.open(self.path, max_dbs=self.MaxNamedDBs, map_size=self.MapSize, mode=self.perm, readonly=self.readonly) self.opened = True if opened and self.env else False return self.opened