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"}},
|
{info, "Empty file ~s to be cleared"}},
|
||||||
{"PC015",
|
{"PC015",
|
||||||
{info, "File created"}},
|
{info, "File created"}},
|
||||||
|
{"PC016",
|
||||||
|
{info, "Slow fetch from SFT ~w of ~w microseconds with result ~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 "
|
||||||
|
@ -243,7 +245,8 @@
|
||||||
{error, "Segment filter failed due to CRC check ~w did not match ~w"}},
|
{error, "Segment filter failed due to CRC check ~w did not match ~w"}},
|
||||||
{"SFT13",
|
{"SFT13",
|
||||||
{error, "Segment filter failed due to ~s"}},
|
{error, "Segment filter failed due to ~s"}},
|
||||||
|
{"SFT14",
|
||||||
|
{info, "Range fetch from SFT PID ~w"}},
|
||||||
|
|
||||||
{"CDB01",
|
{"CDB01",
|
||||||
{info, "Opening file for writing with filename ~s"}},
|
{info, "Opening file for writing with filename ~s"}},
|
||||||
|
|
|
@ -202,6 +202,7 @@
|
||||||
-define(PROMPT_WAIT_ONL0, 5).
|
-define(PROMPT_WAIT_ONL0, 5).
|
||||||
-define(WORKQUEUE_BACKLOG_TOLERANCE, 4).
|
-define(WORKQUEUE_BACKLOG_TOLERANCE, 4).
|
||||||
-define(COIN_SIDECOUNT, 5).
|
-define(COIN_SIDECOUNT, 5).
|
||||||
|
-define(SLOW_FETCH, 10000).
|
||||||
|
|
||||||
-record(state, {manifest = [] :: list(),
|
-record(state, {manifest = [] :: list(),
|
||||||
manifest_sqn = 0 :: integer(),
|
manifest_sqn = 0 :: integer(),
|
||||||
|
@ -736,7 +737,7 @@ fetch_mem(Key, Hash, Manifest, L0Cache, none) ->
|
||||||
L0Check = leveled_pmem:check_levelzero(Key, Hash, L0Cache),
|
L0Check = leveled_pmem:check_levelzero(Key, Hash, L0Cache),
|
||||||
case L0Check of
|
case L0Check of
|
||||||
{false, not_found} ->
|
{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} ->
|
{true, KV} ->
|
||||||
KV
|
KV
|
||||||
end;
|
end;
|
||||||
|
@ -745,7 +746,7 @@ fetch_mem(Key, Hash, Manifest, L0Cache, L0Index) ->
|
||||||
true ->
|
true ->
|
||||||
fetch_mem(Key, Hash, Manifest, L0Cache, none);
|
fetch_mem(Key, Hash, Manifest, L0Cache, none);
|
||||||
false ->
|
false ->
|
||||||
fetch(Key, Hash, Manifest, 0, fun leveled_sft:sft_get/3)
|
fetch(Key, Hash, Manifest, 0, fun timed_sft_get/3)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
fetch(_Key, _Hash, _Manifest, ?MAX_LEVELS + 1, _FetchFun) ->
|
fetch(_Key, _Hash, _Manifest, ?MAX_LEVELS + 1, _FetchFun) ->
|
||||||
|
@ -774,6 +775,21 @@ fetch(Key, Hash, Manifest, Level, FetchFun) ->
|
||||||
end
|
end
|
||||||
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) ->
|
compare_to_sqn(Obj, SQN) ->
|
||||||
case Obj of
|
case Obj of
|
||||||
|
|
|
@ -1100,7 +1100,9 @@ maybe_expand_pointer([H|Tail]) ->
|
||||||
case H of
|
case H of
|
||||||
{next, SFTPid, StartKey} ->
|
{next, SFTPid, StartKey} ->
|
||||||
%% io:format("Scanning further on PID ~w ~w~n", [SFTPid, StartKey]),
|
%% io:format("Scanning further on PID ~w ~w~n", [SFTPid, StartKey]),
|
||||||
|
SW = os:timestamp(),
|
||||||
Acc = sft_getkvrange(SFTPid, StartKey, all, ?MERGE_SCANWIDTH),
|
Acc = sft_getkvrange(SFTPid, StartKey, all, ?MERGE_SCANWIDTH),
|
||||||
|
leveled_log:log_timer("SFT14", [SFTPid], SW),
|
||||||
lists:append(Acc, Tail);
|
lists:append(Acc, Tail);
|
||||||
_ ->
|
_ ->
|
||||||
[H|Tail]
|
[H|Tail]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue