Fix broken SST cache
This commit is contained in:
parent
d28e5d639c
commit
b6ae0e1af5
2 changed files with 14 additions and 5 deletions
|
@ -433,7 +433,7 @@ sst_timing({N, SSTTimerD}, SW, TimerType) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
sst_keylist() ->
|
sst_keylist() ->
|
||||||
[summary_bloom, slot_cache, slot_bloom, slot_fetch].
|
[slot_cache, slot_bloom, slot_fetch].
|
||||||
|
|
||||||
|
|
||||||
get_timing(undefined, SW, TimerType) ->
|
get_timing(undefined, SW, TimerType) ->
|
||||||
|
|
|
@ -303,12 +303,12 @@ reader({get_kv, LedgerKey, Hash}, _From, State) ->
|
||||||
case {Result, Stage} of
|
case {Result, Stage} of
|
||||||
{not_present, _} ->
|
{not_present, _} ->
|
||||||
{reply, Result, reader, UpdState#state{sst_timings = UpdTimings}};
|
{reply, Result, reader, UpdState#state{sst_timings = UpdTimings}};
|
||||||
{KV, slot_lookup_hit} ->
|
{_KV, slot_cache} ->
|
||||||
|
{reply, Result, reader, UpdState#state{sst_timings = UpdTimings}};
|
||||||
|
{KV, _} ->
|
||||||
UpdCache = array:set(SlotID - 1, KV, State#state.lastfetch_cache),
|
UpdCache = array:set(SlotID - 1, KV, State#state.lastfetch_cache),
|
||||||
{reply, Result, reader, UpdState#state{lastfetch_cache = UpdCache,
|
{reply, Result, reader, UpdState#state{lastfetch_cache = UpdCache,
|
||||||
sst_timings = UpdTimings}};
|
sst_timings = UpdTimings}}
|
||||||
_ ->
|
|
||||||
{reply, Result, reader, UpdState#state{sst_timings = UpdTimings}}
|
|
||||||
end;
|
end;
|
||||||
reader({get_kvrange, StartKey, EndKey, ScanWidth}, _From, State) ->
|
reader({get_kvrange, StartKey, EndKey, ScanWidth}, _From, State) ->
|
||||||
{reply,
|
{reply,
|
||||||
|
@ -1477,6 +1477,15 @@ simple_persisted_test() ->
|
||||||
1,
|
1,
|
||||||
KVList1,
|
KVList1,
|
||||||
length(KVList1)),
|
length(KVList1)),
|
||||||
|
SW0 = os:timestamp(),
|
||||||
|
lists:foreach(fun({K, V}) ->
|
||||||
|
?assertMatch({K, V}, sst_get(Pid, K))
|
||||||
|
end,
|
||||||
|
KVList1),
|
||||||
|
io:format(user,
|
||||||
|
"Checking for ~w keys (once) in file with cache hit took ~w "
|
||||||
|
++ "microseconds~n",
|
||||||
|
[length(KVList1), timer:now_diff(os:timestamp(), SW0)]),
|
||||||
SW1 = os:timestamp(),
|
SW1 = os:timestamp(),
|
||||||
lists:foreach(fun({K, V}) ->
|
lists:foreach(fun({K, V}) ->
|
||||||
?assertMatch({K, V}, sst_get(Pid, K)),
|
?assertMatch({K, V}, sst_get(Pid, K)),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue