From d1fc3a48ff50f85ff5e3098edb3c0774d110af23 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Sat, 3 Dec 2016 14:50:16 +0100 Subject: Open permdb read-only in merge_backup and merge_dist. --- tools/merge_backup.py | 3 ++- tools/merge_dist.py | 3 ++- tools/mergetools.py | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/merge_backup.py b/tools/merge_backup.py index cadcec7..d1b6d93 100755 --- a/tools/merge_backup.py +++ b/tools/merge_backup.py @@ -144,7 +144,8 @@ def merge_backup(args, config, localconfig, secondaries): failures = 0 paths = localconfig["paths"] mergedb = paths["mergedb"] - chainsdb = perm(localconfig.get("dbbackend", "filedb"), mergedb + "/chains") + chainsdb = perm(localconfig.get("dbbackend", "filedb"), mergedb + "/chains", + write_enabled=False) logorderfile = mergedb + "/logorder" currentsizefile = mergedb + "/fetched" statusfile = mergedb + "/merge_backup.status" diff --git a/tools/merge_dist.py b/tools/merge_dist.py index d81f0a1..f1bdaf9 100755 --- a/tools/merge_dist.py +++ b/tools/merge_dist.py @@ -218,7 +218,8 @@ def main(): args, config, localconfig = parse_args() paths = localconfig["paths"] mergedb = paths["mergedb"] - chainsdb = perm(localconfig.get("dbbackend", "filedb"), mergedb + "/chains") + chainsdb = perm(localconfig.get("dbbackend", "filedb"), mergedb + "/chains", + write_enabled=False) lockfile = mergedb + "/.merge_dist.lock" loginit(args, "merge_dist.log") diff --git a/tools/mergetools.py b/tools/mergetools.py index 1ff3fa5..2713b23 100644 --- a/tools/mergetools.py +++ b/tools/mergetools.py @@ -453,11 +453,11 @@ def parse_args(): return (args, config, localconfig) -def perm(dbtype, path): +def perm(dbtype, path, write_enabled=True): if dbtype == "filedb": return FileDB(path) elif dbtype == "permdb": - return PermDB(path) + return PermDB(path, write_enabled=write_enabled) assert False def waitforfile(path): @@ -524,8 +524,8 @@ class FileDB: pass class PermDB: - def __init__(self, path): - self.permdbobj = permdb.alloc(path) + def __init__(self, path, write_enabled=True): + self.permdbobj = permdb.alloc(path, write_enabled) def get(self, key): return permdb.getvalue(self.permdbobj, key) def add(self, key, value): -- cgit v1.1