CDB changes to add timing log
Forgot to save before commit last time!
This commit is contained in:
parent
36a48c16e5
commit
319dc5f388
1 changed files with 19 additions and 8 deletions
|
@ -152,7 +152,10 @@ cdb_mput(Pid, KVList) ->
|
||||||
|
|
||||||
%% SampleSize can be an integer or the atom all
|
%% SampleSize can be an integer or the atom all
|
||||||
cdb_getpositions(Pid, SampleSize) ->
|
cdb_getpositions(Pid, SampleSize) ->
|
||||||
gen_fsm:sync_send_event(Pid, {get_positions, SampleSize}, infinity).
|
SW = os:timestamp(),
|
||||||
|
R = gen_fsm:sync_send_event(Pid, {get_positions, SampleSize}, infinity),
|
||||||
|
leveled_log:log_timer("CDB19", [SampleSize], SW),
|
||||||
|
R.
|
||||||
|
|
||||||
%% Info can be key_only, key_size (size being the size of the value) or
|
%% Info can be key_only, key_size (size being the size of the value) or
|
||||||
%% key_value_check (with the check part indicating if the CRC is correct for
|
%% key_value_check (with the check part indicating if the CRC is correct for
|
||||||
|
@ -886,20 +889,27 @@ scan_index_forsample(Handle, [CacheEntry|Tail], ScanFun, Acc, SampleSize) ->
|
||||||
|
|
||||||
scan_index_findlast(Handle, Position, Count, {LastPosition, TotalKeys}) ->
|
scan_index_findlast(Handle, Position, Count, {LastPosition, TotalKeys}) ->
|
||||||
{ok, _} = file:position(Handle, Position),
|
{ok, _} = file:position(Handle, Position),
|
||||||
MaxPos = lists:foldl(fun({_Hash, HPos}, MaxPos) -> max(HPos, MaxPos) end,
|
MaxPosFun = fun({_Hash, HPos}, MaxPos) -> max(HPos, MaxPos) end,
|
||||||
|
MaxPos = lists:foldl(MaxPosFun,
|
||||||
LastPosition,
|
LastPosition,
|
||||||
read_next_n_integerpairs(Handle, Count)),
|
read_next_n_integerpairs(Handle, Count)),
|
||||||
{MaxPos, TotalKeys + Count}.
|
{MaxPos, TotalKeys + Count}.
|
||||||
|
|
||||||
scan_index_returnpositions(Handle, Position, Count, PosList0) ->
|
scan_index_returnpositions(Handle, Position, Count, PosList0) ->
|
||||||
{ok, _} = file:position(Handle, Position),
|
{ok, _} = file:position(Handle, Position),
|
||||||
lists:foldl(fun({Hash, HPosition}, PosList) ->
|
AddPosFun =
|
||||||
|
fun({Hash, HPosition}, PosList) ->
|
||||||
case Hash of
|
case Hash of
|
||||||
0 -> PosList;
|
0 ->
|
||||||
_ -> PosList ++ [HPosition]
|
PosList;
|
||||||
end end,
|
_ ->
|
||||||
|
[HPosition|PosList]
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
PosList = lists:foldl(AddPosFun,
|
||||||
PosList0,
|
PosList0,
|
||||||
read_next_n_integerpairs(Handle, Count)).
|
read_next_n_integerpairs(Handle, Count)),
|
||||||
|
lists:reverse(PosList).
|
||||||
|
|
||||||
|
|
||||||
%% Take an active file and write the hash details necessary to close that
|
%% Take an active file and write the hash details necessary to close that
|
||||||
|
@ -1879,6 +1889,7 @@ get_keys_byposition_manykeys_test() ->
|
||||||
{ok, P2} = cdb_open_reader(F2, #cdb_options{binary_mode=false}),
|
{ok, P2} = cdb_open_reader(F2, #cdb_options{binary_mode=false}),
|
||||||
PositionList = cdb_getpositions(P2, all),
|
PositionList = cdb_getpositions(P2, all),
|
||||||
L1 = length(PositionList),
|
L1 = length(PositionList),
|
||||||
|
io:format("Length of all positions ~w~n", [L1]),
|
||||||
?assertMatch(KeyCount, L1),
|
?assertMatch(KeyCount, L1),
|
||||||
|
|
||||||
SampleList1 = cdb_getpositions(P2, 10),
|
SampleList1 = cdb_getpositions(P2, 10),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue