diff options
author | Linus Nordberg <linus@nordu.net> | 2016-12-03 14:50:16 +0100 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2016-12-03 14:50:16 +0100 |
commit | d1fc3a48ff50f85ff5e3098edb3c0774d110af23 (patch) | |
tree | 5791f32b58a568e74c784a9804bae2fcee0e1dbc | |
parent | b13432988901f1419a04a0f2f4c411bdd3267999 (diff) |
Open permdb read-only in merge_backup and merge_dist.
-rwxr-xr-x | tools/merge_backup.py | 3 | ||||
-rwxr-xr-x | tools/merge_dist.py | 3 | ||||
-rw-r--r-- | 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): |