Add level to SST slow fetch log
This commit is contained in:
parent
730ab2ec48
commit
f3e962c43a
2 changed files with 10 additions and 9 deletions
|
@ -166,7 +166,8 @@
|
|||
{"PC015",
|
||||
{info, "File created"}},
|
||||
{"PC016",
|
||||
{info, "Slow fetch from SFT ~w of ~w microseconds with result ~w"}},
|
||||
{info, "Slow fetch from SFT ~w of ~w microseconds at level ~w "
|
||||
++ "with result ~w"}},
|
||||
{"PC017",
|
||||
{info, "Notified clerk of manifest change"}},
|
||||
{"PC018",
|
||||
|
|
|
@ -853,7 +853,7 @@ fetch_mem(Key, Hash, Manifest, L0Cache, L0Index) ->
|
|||
L0Check = leveled_pmem:check_levelzero(Key, Hash, PosList, L0Cache),
|
||||
case L0Check of
|
||||
{false, not_found} ->
|
||||
fetch(Key, Hash, Manifest, 0, fun timed_sst_get/3);
|
||||
fetch(Key, Hash, Manifest, 0, fun timed_sst_get/4);
|
||||
{true, KV} ->
|
||||
{KV, 0}
|
||||
end.
|
||||
|
@ -865,7 +865,7 @@ fetch(Key, Hash, Manifest, Level, FetchFun) ->
|
|||
false ->
|
||||
fetch(Key, Hash, Manifest, Level + 1, FetchFun);
|
||||
FP ->
|
||||
case FetchFun(FP, Key, Hash) of
|
||||
case FetchFun(FP, Key, Hash, Level) of
|
||||
not_present ->
|
||||
fetch(Key, Hash, Manifest, Level + 1, FetchFun);
|
||||
ObjectFound ->
|
||||
|
@ -873,21 +873,21 @@ fetch(Key, Hash, Manifest, Level, FetchFun) ->
|
|||
end
|
||||
end.
|
||||
|
||||
timed_sst_get(PID, Key, Hash) ->
|
||||
timed_sst_get(PID, Key, Hash, Level) ->
|
||||
SW = os:timestamp(),
|
||||
R = leveled_sst:sst_get(PID, Key, Hash),
|
||||
T0 = timer:now_diff(os:timestamp(), SW),
|
||||
log_slowfetch(T0, R, PID, ?SLOW_FETCH).
|
||||
log_slowfetch(T0, R, PID, Level, ?SLOW_FETCH).
|
||||
|
||||
log_slowfetch(T0, R, PID, FetchTolerance) ->
|
||||
log_slowfetch(T0, R, PID, Level, FetchTolerance) ->
|
||||
case {T0, R} of
|
||||
{T, R} when T < FetchTolerance ->
|
||||
R;
|
||||
{T, not_present} ->
|
||||
leveled_log:log("PC016", [PID, T, not_present]),
|
||||
leveled_log:log("PC016", [PID, T, Level, not_present]),
|
||||
not_present;
|
||||
{T, R} ->
|
||||
leveled_log:log("PC016", [PID, T, found]),
|
||||
leveled_log:log("PC016", [PID, T, Level, found]),
|
||||
R
|
||||
end.
|
||||
|
||||
|
@ -1498,7 +1498,7 @@ create_file_test() ->
|
|||
?assertMatch("hello", binary_to_term(Bin)).
|
||||
|
||||
slow_fetch_test() ->
|
||||
?assertMatch(not_present, log_slowfetch(2, not_present, "fake", 1)).
|
||||
?assertMatch(not_present, log_slowfetch(2, not_present, "fake", 0, 1)).
|
||||
|
||||
checkready(Pid) ->
|
||||
try
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue