forked from basho/riak_kv
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote branch 'upstream/master'
Conflicts: src/riak_kv_pb_socket.erl
- Loading branch information
Showing
32 changed files
with
1,471 additions
and
384 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
e716ebd150ff8698a89a1ae28bc868385a164497 riak_kv-0.13.0rc1 | ||
04f5cfd0b8ca7c195e67658367afa5625c186218 riak_kv-0.13.0rc2 | ||
a5e0a7b843b52fe846b8006543d1484b548b9a18 riak_kv-0.13.0rc3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
%% ------------------------------------------------------------------- | ||
%% | ||
%% lk: Helper functions for list keys | ||
%% | ||
%% Copyright (c) 2007-2010 Basho Technologies, Inc. All Rights Reserved. | ||
%% | ||
%% This file is provided to you under the Apache License, | ||
%% Version 2.0 (the "License"); you may not use this file | ||
%% except in compliance with the License. You may obtain | ||
%% a copy of the License at | ||
%% | ||
%% http://www.apache.org/licenses/LICENSE-2.0 | ||
%% | ||
%% Unless required by applicable law or agreed to in writing, | ||
%% software distributed under the License is distributed on an | ||
%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
%% KIND, either express or implied. See the License for the | ||
%% specific language governing permissions and limitations | ||
%% under the License. | ||
%% | ||
%% ------------------------------------------------------------------- | ||
-module(lk). | ||
|
||
-export([fsm/1, pn/1]). | ||
|
||
fsm(Bucket) -> | ||
ReqId = random:uniform(10000), | ||
Start = erlang:now(), | ||
riak_kv_keys_fsm:start(ReqId, Bucket, 60000, plain, 0.0001, self()), | ||
{ok, Count} = gather_fsm_results(ReqId, 0), | ||
io:format("~n"), | ||
End = erlang:now(), | ||
Ms = erlang:round(timer:now_diff(End, Start) / 1000), | ||
io:format("Found ~p keys in ~pms.~n", [Count, Ms]). | ||
|
||
pn(Bucket) -> | ||
ReqId = random:uniform(10000), | ||
{ok, Ring} = riak_core_ring_manager:get_my_ring(), | ||
{ok, Bloom} = ebloom:new(10000000,0.0001,ReqId), | ||
BucketProps = riak_core_bucket:get_bucket(Bucket, Ring), | ||
N = proplists:get_value(n_val,BucketProps), | ||
PLS = lists:flatten(riak_core_ring:all_preflists(Ring,N)), | ||
Nodes = [node()|nodes()], | ||
Start = erlang:now(), | ||
start_listers(Nodes, ReqId, Bucket, PLS), | ||
{ok, Count} = gather_pn_results(ReqId, Bloom, length(Nodes), 0), | ||
End = erlang:now(), | ||
Ms = erlang:round(timer:now_diff(End, Start) / 1000), | ||
io:format("Found ~p keys in ~pms.~n", [Count, Ms]). | ||
|
||
gather_fsm_results(ReqId, Count) -> | ||
receive | ||
{ReqId, {keys, Keys}} -> | ||
io:format("."), | ||
gather_fsm_results(ReqId, Count + length(Keys)); | ||
{ReqId, done} -> | ||
{ok, Count} | ||
after 120000 -> | ||
{error, timeout} | ||
end. | ||
|
||
start_listers([], _ReqId, _Bucket, _VNodes) -> | ||
ok; | ||
start_listers([H|T], ReqId, Bucket, VNodes) -> | ||
riak_kv_keylister_master:start_keylist(H, ReqId, self(), Bucket, VNodes, 60000), | ||
start_listers(T, ReqId, Bucket, VNodes). | ||
|
||
gather_pn_results(_, BF, 0, Count) -> | ||
ebloom:clear(BF), | ||
{ok, Count}; | ||
gather_pn_results(ReqId, BF, NodeCount, Count) -> | ||
%%io:format("NodeCount: ~p, key count: ~p~n", [NodeCount, Count]), | ||
receive | ||
{ReqId, {kl, Keys0}} -> | ||
F = fun(Key, Acc) -> | ||
case ebloom:contains(BF, Key) of | ||
false -> | ||
ebloom:insert(BF, Key), | ||
[Key|Acc]; | ||
true -> | ||
Acc | ||
end end, | ||
Keys = lists:foldl(F, [], Keys0), | ||
gather_pn_results(ReqId, BF, NodeCount, Count + length(Keys)); | ||
{ReqId, done} -> | ||
gather_pn_results(ReqId, BF, NodeCount - 1, Count) | ||
after 10000 -> | ||
{error, timeout} | ||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.