Improve logging of merge activity and slow GETs
Look into speculation that collisions between fetch_rnage and fetch may be an issue
This commit is contained in:
parent
f3e16dcd10
commit
be775127e8
3 changed files with 24 additions and 3 deletions
|
@ -142,6 +142,8 @@
|
|||
{info, "Empty file ~s to be cleared"}},
|
||||
{"PC015",
|
||||
{info, "File created"}},
|
||||
{"PC016",
|
||||
{info, "Slow fetch from SFT ~w of ~w microseconds with result ~w"}},
|
||||
|
||||
{"I0001",
|
||||
{info, "Unexpected failure to fetch value for Key=~w SQN=~w "
|
||||
|
@ -243,7 +245,8 @@
|
|||
{error, "Segment filter failed due to CRC check ~w did not match ~w"}},
|
||||
{"SFT13",
|
||||
{error, "Segment filter failed due to ~s"}},
|
||||
|
||||
{"SFT14",
|
||||
{info, "Range fetch from SFT PID ~w"}},
|
||||
|
||||
{"CDB01",
|
||||
{info, "Opening file for writing with filename ~s"}},
|
||||
|
|
|
@ -202,6 +202,7 @@
|
|||
-define(PROMPT_WAIT_ONL0, 5).
|
||||
-define(WORKQUEUE_BACKLOG_TOLERANCE, 4).
|
||||
-define(COIN_SIDECOUNT, 5).
|
||||
-define(SLOW_FETCH, 10000).
|
||||
|
||||
-record(state, {manifest = [] :: list(),
|
||||
manifest_sqn = 0 :: integer(),
|
||||
|
@ -736,7 +737,7 @@ fetch_mem(Key, Hash, Manifest, L0Cache, none) ->
|
|||
L0Check = leveled_pmem:check_levelzero(Key, Hash, L0Cache),
|
||||
case L0Check of
|
||||
{false, not_found} ->
|
||||
fetch(Key, Hash, Manifest, 0, fun leveled_sft:sft_get/3);
|
||||
fetch(Key, Hash, Manifest, 0, fun timed_sft_get/3);
|
||||
{true, KV} ->
|
||||
KV
|
||||
end;
|
||||
|
@ -745,7 +746,7 @@ fetch_mem(Key, Hash, Manifest, L0Cache, L0Index) ->
|
|||
true ->
|
||||
fetch_mem(Key, Hash, Manifest, L0Cache, none);
|
||||
false ->
|
||||
fetch(Key, Hash, Manifest, 0, fun leveled_sft:sft_get/3)
|
||||
fetch(Key, Hash, Manifest, 0, fun timed_sft_get/3)
|
||||
end.
|
||||
|
||||
fetch(_Key, _Hash, _Manifest, ?MAX_LEVELS + 1, _FetchFun) ->
|
||||
|
@ -774,6 +775,21 @@ fetch(Key, Hash, Manifest, Level, FetchFun) ->
|
|||
end
|
||||
end.
|
||||
|
||||
timed_sft_get(PID, Key, Hash) ->
|
||||
SW = os:timestamp(),
|
||||
R = leveled_sft:sft_get(PID, Key, Hash),
|
||||
T0 = timer:now_diff(os:timestamp(), SW),
|
||||
case {T0, R} of
|
||||
{T, R} when T < ?SLOW_FETCH ->
|
||||
R;
|
||||
{T, not_present} ->
|
||||
leveled_log:log("PC016", [PID, T, not_present]),
|
||||
not_present;
|
||||
{T, R} ->
|
||||
leveled_log:log("PC016", [PID, T, found]),
|
||||
R
|
||||
end.
|
||||
|
||||
|
||||
compare_to_sqn(Obj, SQN) ->
|
||||
case Obj of
|
||||
|
|
|
@ -1100,7 +1100,9 @@ maybe_expand_pointer([H|Tail]) ->
|
|||
case H of
|
||||
{next, SFTPid, StartKey} ->
|
||||
%% io:format("Scanning further on PID ~w ~w~n", [SFTPid, StartKey]),
|
||||
SW = os:timestamp(),
|
||||
Acc = sft_getkvrange(SFTPid, StartKey, all, ?MERGE_SCANWIDTH),
|
||||
leveled_log:log_timer("SFT14", [SFTPid], SW),
|
||||
lists:append(Acc, Tail);
|
||||
_ ->
|
||||
[H|Tail]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue