Revert "Don't time fetches due to SQN checks"

This reverts commit fb490b9af7.
This commit is contained in:
Martin Sumner 2022-03-11 11:06:58 +00:00
parent 2e0b20a071
commit 5eae8e441f

View file

@ -1450,8 +1450,7 @@ roll_memory(State, true) ->
%% the result tuple includes the level at which the result was found. %% the result tuple includes the level at which the result was found.
timed_fetch_mem(Key, Hash, Manifest, L0Cache, L0Index, Timings) -> timed_fetch_mem(Key, Hash, Manifest, L0Cache, L0Index, Timings) ->
SW = os:timestamp(), SW = os:timestamp(),
{R, Level} = {R, Level} = fetch_mem(Key, Hash, Manifest, L0Cache, L0Index),
fetch_mem(Key, Hash, Manifest, L0Cache, L0Index, fun timed_sst_get/4),
UpdTimings = update_timings(SW, Timings, R, Level), UpdTimings = update_timings(SW, Timings, R, Level),
{R, UpdTimings}. {R, UpdTimings}.
@ -1463,10 +1462,10 @@ timed_fetch_mem(Key, Hash, Manifest, L0Cache, L0Index, Timings) ->
%% Fetch the result from the penciller, starting by looking in the memory, %% Fetch the result from the penciller, starting by looking in the memory,
%% and if it is not found looking down level by level through the LSM tree. %% and if it is not found looking down level by level through the LSM tree.
plain_fetch_mem(Key, Hash, Manifest, L0Cache, L0Index) -> plain_fetch_mem(Key, Hash, Manifest, L0Cache, L0Index) ->
R = fetch_mem(Key, Hash, Manifest, L0Cache, L0Index, fun sst_get/4), R = fetch_mem(Key, Hash, Manifest, L0Cache, L0Index),
element(1, R). element(1, R).
fetch_mem(Key, Hash, Manifest, L0Cache, L0Index, FetchFun) -> fetch_mem(Key, Hash, Manifest, L0Cache, L0Index) ->
PosList = PosList =
case L0Index of case L0Index of
none -> none ->
@ -1477,7 +1476,7 @@ fetch_mem(Key, Hash, Manifest, L0Cache, L0Index, FetchFun) ->
L0Check = leveled_pmem:check_levelzero(Key, Hash, PosList, L0Cache), L0Check = leveled_pmem:check_levelzero(Key, Hash, PosList, L0Cache),
case L0Check of case L0Check of
{false, not_found} -> {false, not_found} ->
fetch(Key, Hash, Manifest, 0, FetchFun); fetch(Key, Hash, Manifest, 0, fun timed_sst_get/4);
{true, KV} -> {true, KV} ->
{KV, memory} {KV, memory}
end. end.
@ -1516,9 +1515,6 @@ timed_sst_get(PID, Key, Hash, Level) ->
T0 = timer:now_diff(os:timestamp(), SW), T0 = timer:now_diff(os:timestamp(), SW),
log_slowfetch(T0, R, PID, Level, ?SLOW_FETCH). log_slowfetch(T0, R, PID, Level, ?SLOW_FETCH).
sst_get(PID, Key, Hash, Level) ->
leveled_sst:sst_get(PID, Key, Hash).
log_slowfetch(T0, R, PID, Level, FetchTolerance) -> log_slowfetch(T0, R, PID, Level, FetchTolerance) ->
case {T0, R} of case {T0, R} of
{T, R} when T < FetchTolerance -> {T, R} when T < FetchTolerance ->