Correct botched manifest entry removal
This commit is contained in:
parent
5076187545
commit
14ebf94e56
2 changed files with 8 additions and 8 deletions
|
@ -154,7 +154,7 @@
|
||||||
{"PC011",
|
{"PC011",
|
||||||
{info, "Merge completed with MSN=~w to Level=~w and FileCounter=~w"}},
|
{info, "Merge completed with MSN=~w to Level=~w and FileCounter=~w"}},
|
||||||
{"PC012",
|
{"PC012",
|
||||||
{debug, "File to be created as part of MSN=~w Filename=~s "
|
{info, "File to be created as part of MSN=~w Filename=~s "
|
||||||
++ "IsBasement=~w"}},
|
++ "IsBasement=~w"}},
|
||||||
{"PC013",
|
{"PC013",
|
||||||
{warn, "Merge resulted in empty file ~s"}},
|
{warn, "Merge resulted in empty file ~s"}},
|
||||||
|
@ -167,7 +167,7 @@
|
||||||
{"PC018",
|
{"PC018",
|
||||||
{info, "Saved manifest file"}},
|
{info, "Saved manifest file"}},
|
||||||
{"PC019",
|
{"PC019",
|
||||||
{info, "After ~s level ~w is ~w"}},
|
{debug, "After ~s level ~w is ~w"}},
|
||||||
|
|
||||||
{"I0001",
|
{"I0001",
|
||||||
{info, "Unexpected failure to fetch value for Key=~w SQN=~w "
|
{info, "Unexpected failure to fetch value for Key=~w SQN=~w "
|
||||||
|
|
|
@ -332,18 +332,18 @@ add_entry(_LevelIdx, Level, Entry) ->
|
||||||
remove_entry(_LevelIdx, Level, Entries) when is_list(Entries) ->
|
remove_entry(_LevelIdx, Level, Entries) when is_list(Entries) ->
|
||||||
% We're assuming we're removing a sorted sublist
|
% We're assuming we're removing a sorted sublist
|
||||||
RemLength = length(Entries),
|
RemLength = length(Entries),
|
||||||
RemStart = lists:nth(1, Entries),
|
[RemStart|_Tail] = Entries,
|
||||||
remove_section(Level, RemStart#manifest_entry.start_key, RemLength - 1);
|
remove_section(Level, RemStart#manifest_entry.start_key, RemLength);
|
||||||
remove_entry(_LevelIdx, Level, Entry) ->
|
remove_entry(_LevelIdx, Level, Entry) ->
|
||||||
remove_section(Level, Entry#manifest_entry.start_key, 0).
|
remove_section(Level, Entry#manifest_entry.start_key, 1).
|
||||||
|
|
||||||
remove_section(Level, StartKey, Length) ->
|
remove_section(Level, SectionStartKey, SectionLength) ->
|
||||||
PredFun =
|
PredFun =
|
||||||
fun(E) ->
|
fun(E) ->
|
||||||
E#manifest_entry.start_key < StartKey
|
E#manifest_entry.start_key < SectionStartKey
|
||||||
end,
|
end,
|
||||||
{Pre, Rest} = lists:splitwith(PredFun, Level),
|
{Pre, Rest} = lists:splitwith(PredFun, Level),
|
||||||
Post = lists:nthtail(length(Rest) - Length, Rest),
|
Post = lists:nthtail(SectionLength, Rest),
|
||||||
Pre ++ Post.
|
Pre ++ Post.
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue