Reverse cleanup order to handle interruptions better

This commit is contained in:
Jim Paris 2013-04-10 18:38:41 -04:00
parent 640a680704
commit 372e977e4a

View File

@ -238,12 +238,15 @@ def main(argv = None):
timestamp_to_seconds(total)))
continue
printf(" removing data before %s\n", timestamp_to_human(remove_before))
if args.yes:
client.stream_remove(path, None, remove_before)
for ap in streams[path].also_clean_paths:
printf(" also removing from %s\n", ap)
# Clean in reverse order. Since we only use the primary stream and not
# the decimated streams to figure out which data to remove, removing
# the primary stream last means that we might recover more nicely if
# we are interrupted and restarted.
clean_paths = list(reversed(streams[path].also_clean_paths)) + [ path ]
for p in clean_paths:
printf(" removing from %s\n", p)
if args.yes:
client.stream_remove(ap, None, remove_before)
client.stream_remove(p, None, remove_before)
# All done
if not args.yes: