From 47a638cf4166dd3be929d8572fef171ce09d428b Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Mon, 28 Nov 2016 00:34:41 +0100 Subject: If any backup process failed, try again. Try again without waiting for an update of the fetched file, which won't happen in the tests (but probably will happen in real life, masking this bug). --- tools/merge_backup.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/merge_backup.py b/tools/merge_backup.py index 56b5b57..12ff99d 100755 --- a/tools/merge_backup.py +++ b/tools/merge_backup.py @@ -155,6 +155,7 @@ def update_backupfile(mergedb, nodename, tree_size, root_hash): write_file(backuppath, backupdata) def merge_backup(args, config, localconfig, secondaries): + failures = 0 paths = localconfig["paths"] mergedb = paths["mergedb"] chainsdb = perm(localconfig.get("dbbackend", "filedb"), mergedb + "/chains") @@ -200,6 +201,7 @@ def merge_backup(args, config, localconfig, secondaries): update_backupfile(mergedb, nodename, tree_size, root_hash) else: logging.warning("%s failure: %d", nodename, p.exitcode) + failures += 1 del procs[p] if not procs: break @@ -207,7 +209,7 @@ def merge_backup(args, config, localconfig, secondaries): if args.timing: logging.debug("timing: merge_backup: %s", timing["deltatimes"]) - return 0 + return failures def main(): """ @@ -247,12 +249,14 @@ def main(): fetched_statinfo = waitforfile(fetched_path) retval = 0 while True: - retval = merge_backup(args, config, localconfig, nodes) - if retval or not args.mergeinterval: + failures = merge_backup(args, config, localconfig, nodes) + if not args.mergeinterval: break fetched_statinfo_old = fetched_statinfo while fetched_statinfo == fetched_statinfo_old: sleep(max(3, args.mergeinterval / 10)) + if failures > 0: + break fetched_statinfo = stat(fetched_path) return retval -- cgit v1.1