GC manifest files when numbers skipped
Otherwise list of old files perpetually grows
This commit is contained in:
parent
9efd973cb4
commit
e360b97cfb
2 changed files with 16 additions and 0 deletions
|
@ -208,6 +208,13 @@ save_manifest(Manifest, RootPath) ->
|
||||||
% delete the previous one straight away. Retain until enough have been
|
% delete the previous one straight away. Retain until enough have been
|
||||||
% kept to make the probability of all being independently corrupted
|
% kept to make the probability of all being independently corrupted
|
||||||
% through separate events negligible
|
% 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),
|
LFP = filepath(RootPath, GC_SQN, current_manifest),
|
||||||
ok =
|
ok =
|
||||||
case filelib:is_file(LFP) of
|
case filelib:is_file(LFP) of
|
||||||
|
@ -217,6 +224,7 @@ save_manifest(Manifest, RootPath) ->
|
||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
||||||
-spec replace_manifest_entry(manifest(), integer(), integer(),
|
-spec replace_manifest_entry(manifest(), integer(), integer(),
|
||||||
list()|manifest_entry(),
|
list()|manifest_entry(),
|
||||||
list()|manifest_entry()) -> manifest().
|
list()|manifest_entry()) -> manifest().
|
||||||
|
|
|
@ -618,6 +618,14 @@ load_and_count(JournalSize, BookiesMemSize, PencillerMemSize) ->
|
||||||
{ok, Bookie2} = leveled_bookie:book_start(StartOpts1),
|
{ok, Bookie2} = leveled_bookie:book_start(StartOpts1),
|
||||||
{_, 300000} = testutil:check_bucket_stats(Bookie2, "Bucket"),
|
{_, 300000} = testutil:check_bucket_stats(Bookie2, "Bucket"),
|
||||||
ok = leveled_bookie:book_close(Bookie2),
|
ok = leveled_bookie:book_close(Bookie2),
|
||||||
|
ManifestFP =
|
||||||
|
leveled_pmanifest:filepath(filename:join(RootPath, ?LEDGER_FP),
|
||||||
|
manifest),
|
||||||
|
IsManifest = fun(FN) -> filename:extension(FN) == ".man" end,
|
||||||
|
{ok, RawManList} = file:list_dir(ManifestFP),
|
||||||
|
ManList = lists:filter(IsManifest, RawManList),
|
||||||
|
io:format("Length of manifest file list ~w~n", [length(ManList)]),
|
||||||
|
true = length(ManList) =< 5,
|
||||||
testutil:reset_filestructure().
|
testutil:reset_filestructure().
|
||||||
|
|
||||||
load_and_count_withdelete(_Config) ->
|
load_and_count_withdelete(_Config) ->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue