From 66a61c945ed82fc6a63ae314d49a4ac11d6e6135 Mon Sep 17 00:00:00 2001 From: Shoeb Ahmed Tanjim <39959228+s-a-tanjim@users.noreply.github.com> Date: Tue, 27 Aug 2024 21:46:17 +0600 Subject: [PATCH] Increase LMDB Size limit for all the DB - Temporary fix (#5) --- src/keri/db/dbing.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/keri/db/dbing.py b/src/keri/db/dbing.py index bd2db031..62a2b40f 100644 --- a/src/keri/db/dbing.py +++ b/src/keri/db/dbing.py @@ -59,8 +59,11 @@ from hio.base import filing +from .. import help from ..help import helping +logger = help.ogler.getLogger() + ProemSize = 32 # does not include trailing separator MaxProem = int("f"*(ProemSize), 16) MaxON = int("f"*32, 16) # largest possible ordinal number, sequence or first seen @@ -68,6 +71,8 @@ SuffixSize = 32 # does not include trailing separator MaxSuffix = int("f"*(SuffixSize), 16) +KERIDBMapSizeKey = "KERI_DB_MAP_SIZE" + def dgKey(pre, dig): """ Returns bytes DB key from concatenation of '.' with qualified Base64 prefix @@ -381,6 +386,13 @@ def reopen(self, readonly=False, **kwa): # open lmdb major database instance # creates files data.mdb and lock.mdb in .dbDirPath + if (mapSize := os.getenv(KERIDBMapSizeKey)) is not None: + try: + self.MapSize = int(mapSize) + except ValueError: + logger.error("KERI_DB_MAP_SIZE must be an integer value >1!") + raise + 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