GC manifest files when numbers skipped

Otherwise list of old files perpetually grows
This commit is contained in:
Martin Sumner 2019-05-23 10:16:15 +01:00
parent 9efd973cb4
commit e360b97cfb
2 changed files with 16 additions and 0 deletions

View file

@ -208,6 +208,13 @@ save_manifest(Manifest, RootPath) ->
% delete the previous one straight away. Retain until enough have been
% kept to make the probability of all being independently corrupted
% through separate events negligible
ok = remove_manifest(RootPath, GC_SQN),
% Sometimes we skip a SQN, so to GC all may need to clear up previous
% as well
ok = remove_manifest(RootPath, GC_SQN - 1).
-spec remove_manifest(string(), integer()) -> ok.
remove_manifest(RootPath, GC_SQN) ->
LFP = filepath(RootPath, GC_SQN, current_manifest),
ok =
case filelib:is_file(LFP) of
@ -217,6 +224,7 @@ save_manifest(Manifest, RootPath) ->
ok
end.
-spec replace_manifest_entry(manifest(), integer(), integer(),
list()|manifest_entry(),
list()|manifest_entry()) -> manifest().