Store and Context: open the database with the nometasync flag
This mode maintains the coherency of the database in case of crash, but can drop the last commits. This is not a problem for us since every data is recoverable.
This commit is contained in:
parent
bfeff69794
commit
09bf4e4819
@ -66,7 +66,7 @@ let (>>=?) v f =
|
|||||||
|
|
||||||
let init ?mapsize path =
|
let init ?mapsize path =
|
||||||
if not (Sys.file_exists path) then Unix.mkdir path 0o755 ;
|
if not (Sys.file_exists path) then Unix.mkdir path 0o755 ;
|
||||||
match Lmdb.opendir ?mapsize ~flags:[NoTLS] path 0o644 with
|
match Lmdb.opendir ?mapsize ~flags:[NoTLS; NoMetaSync] path 0o644 with
|
||||||
| Ok dir -> return { dir ; parent = Lwt.new_key () }
|
| Ok dir -> return { dir ; parent = Lwt.new_key () }
|
||||||
| Error err -> failwith "%a" Lmdb.pp_error err
|
| Error err -> failwith "%a" Lmdb.pp_error err
|
||||||
|
|
||||||
|
3
vendors/irmin-lmdb/irmin_lmdb.ml
vendored
3
vendors/irmin-lmdb/irmin_lmdb.ml
vendored
@ -641,7 +641,8 @@ module Make
|
|||||||
let { root ; mapsize ; readonly } = config conf in
|
let { root ; mapsize ; readonly } = config conf in
|
||||||
let root = match root with None -> "irmin.ldb" | Some root -> root in
|
let root = match root with None -> "irmin.ldb" | Some root -> root in
|
||||||
if not (Sys.file_exists root) then Unix.mkdir root 0o755 ;
|
if not (Sys.file_exists root) then Unix.mkdir root 0o755 ;
|
||||||
let flags = Lmdb.NoRdAhead :: Lmdb.NoTLS :: if readonly then [ Lmdb.RdOnly ] else [] in
|
let flags = if readonly then [ Lmdb.RdOnly ] else [] in
|
||||||
|
let flags = Lmdb.NoMetaSync :: Lmdb.NoRdAhead :: Lmdb.NoTLS :: flags in
|
||||||
let file_flags = if readonly then 0o444 else 0o644 in
|
let file_flags = if readonly then 0o444 else 0o644 in
|
||||||
match Lmdb.opendir ~mapsize ~flags root file_flags with
|
match Lmdb.opendir ~mapsize ~flags root file_flags with
|
||||||
| Error err -> Lwt.fail_with (Lmdb.string_of_error err)
|
| Error err -> Lwt.fail_with (Lmdb.string_of_error err)
|
||||||
|
Loading…
Reference in New Issue
Block a user