aboutsummaryrefslogtreecommitdiffstats
path: root/lib/backend/storage/LMDB.ml
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/backend/storage/LMDB.ml6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/backend/storage/LMDB.ml b/lib/backend/storage/LMDB.ml
index 17dda3f..fd6cc8e 100644
--- a/lib/backend/storage/LMDB.ml
+++ b/lib/backend/storage/LMDB.ml
@@ -43,6 +43,9 @@ module C = struct
let mdb_env_close = foreign "mdb_env_close" (ptr mdb_env @-> returning void)
+ let mdb_env_set_mapsize =
+ foreign "mdb_env_set_mapsize" (ptr mdb_env @-> size_t @-> returning mdb_result)
+
let mdb_dbi_open =
foreign "mdb_dbi_open"
(ptr mdb_txn @-> ptr char @-> uint @-> ptr mdb_dbi @-> returning mdb_result)
@@ -139,6 +142,8 @@ type connection = {env: C.mdb_env_ptr; dbi: C.mdb_dbi}
type transaction = {tx: C.mdb_txn_ptr; dbi: C.mdb_dbi; mutable active: bool}
type address = Label of string | Hash of Concepts.Hash.hash
+let mapsize = 1 lsl 30
+
let parse (c : Concepts.Configuration.term) =
let open Concepts.Configuration in
let open Utilities.Result in
@@ -166,6 +171,7 @@ let connect (c : Concepts.Configuration.term) =
let* () = ensure_directory path (directory_mode mode) in
begin
let* env = C.mdb_env_create' () in
+ let* () = C.mdb_env_set_mapsize env (Unsigned.Size_t.of_int mapsize) in
(* NOTLS ties readers to transactions rather than threads, so one
thread can hold several read transactions (nested cursors). *)
match C.mdb_env_open env path C.Flags.mdb_notls (PosixTypes.Mode.of_int mode) with