Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.3 to master #519

Merged
merged 22 commits into from
Apr 8, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4092945
Add bulk vnode start function to allow parallelism
engelsanchez Mar 18, 2013
f9b8bca
Merge pull request #511 from basho/eas-add-kv-vnode-parallel-init
engelsanchez Mar 21, 2013
58170cd
support for handling legacy sext encoding of 2i keys
engelsanchez Mar 7, 2013
bbf87af
Merge pull request #516 from basho/jrw-eas-2i-fix-keys-backport-squashed
engelsanchez Mar 21, 2013
2fd89b5
Change AAE to use incremental crypto:sha calculations
jtuple Mar 21, 2013
98aba59
Merge pull request #514 from basho/jdb-aae-incremental-sha-1.3
jtuple Mar 21, 2013
fd2e527
Re-use the stat calc funs in riak_core
russelldb Mar 21, 2013
5d3a080
Since stats now get repaired when an update fails, log as `warning`
russelldb Mar 22, 2013
893d752
Merge pull request #517 from basho/kv508-stats-warn
russelldb Mar 22, 2013
eb24ff9
Roll riak_kv version 1.3.1
jaredmorrow Mar 23, 2013
4fa5967
Merge branch '1.3'
russelldb Mar 26, 2013
1045e81
spell badarg correctly
beerriot Mar 27, 2013
8e7318d
Merge pull request #522 from branch 'bwf-badard' into 1.3
beerriot Mar 27, 2013
a03f2e9
Fix perf problems and bug in 2i reformat
engelsanchez Mar 29, 2013
371f480
Make multi backend work with batched 2i reformats
engelsanchez Mar 30, 2013
3e1ec43
Fix 2i reformat batch for multibackend
engelsanchez Apr 1, 2013
1bfaeae
Make reformat-indexes print default parameters
engelsanchez Apr 1, 2013
b50d1df
move querying of fixed index status to seperate backend function
jrwest Apr 1, 2013
06f9d1d
Merge pull request #525 from basho/jrw-2i-reformat-status-change
engelsanchez Apr 1, 2013
cf4c91e
Merge pull request #523 from basho/eas-perf-fixes-to-2i-reformat
engelsanchez Apr 1, 2013
aab11f4
Update bitcask dependency to 1.6.1
jaredmorrow Apr 2, 2013
2e0a4e4
Merge branch '1.3' into 1.3_to_master
engelsanchez Apr 5, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion src/hashtree.erl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -506,7 +506,27 @@ share_segment_store(State, #state{ref=Ref, path=Path}) ->
-spec hash(term()) -> binary(). -spec hash(term()) -> binary().
hash(X) -> hash(X) ->
%% erlang:phash2(X). %% erlang:phash2(X).
crypto:sha(term_to_binary(X)). sha(term_to_binary(X)).

sha(Bin) ->
Chunk = app_helper:get_env(riak_kv, anti_entropy_sha_chunk, 4096),
sha(Chunk, Bin).

sha(Chunk, Bin) ->
Ctx1 = crypto:sha_init(),
Ctx2 = sha(Chunk, Bin, Ctx1),
SHA = crypto:sha_final(Ctx2),
SHA.

sha(Chunk, Bin, Ctx) ->
case Bin of
<<Data:Chunk/binary, Rest/binary>> ->
Ctx2 = crypto:sha_update(Ctx, Data),
sha(Chunk, Rest, Ctx2);
Data ->
Ctx2 = crypto:sha_update(Ctx, Data),
Ctx2
end.


-spec update_levels(integer(), -spec update_levels(integer(),
[{integer(), [{integer(), binary()}]}], [{integer(), [{integer(), binary()}]}],
Expand Down Expand Up @@ -1026,6 +1046,19 @@ delta_test() ->
%%%=================================================================== %%%===================================================================


-ifdef(EQC). -ifdef(EQC).
sha_test_() ->
{timeout, 60,
fun() ->
?assert(eqc:quickcheck(eqc:testing_time(4, prop_sha())))
end
}.

prop_sha() ->
?FORALL(Size, choose(256, 1024*1024),
?FORALL(Chunk, choose(1, Size),
?FORALL(Bin, binary(Size),
sha(Chunk, Bin) =:= crypto:sha(Bin)))).

eqc_test_() -> eqc_test_() ->
{timeout, 5, {timeout, 5,
fun() -> fun() ->
Expand Down
2 changes: 1 addition & 1 deletion src/riak_kv.app.src
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{application, riak_kv, {application, riak_kv,
[ [
{description, "Riak Key/Value Store"}, {description, "Riak Key/Value Store"},
{vsn, "1.3.0"}, {vsn, "1.3.1"},
{applications, [ {applications, [
kernel, kernel,
stdlib, stdlib,
Expand Down
68 changes: 68 additions & 0 deletions src/riak_kv_console.erl
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
cluster_info/1, cluster_info/1,
down/1, down/1,
aae_status/1, aae_status/1,
reformat_indexes/1,
reload_code/1]). reload_code/1]).


%% Arrow is 24 chars wide %% Arrow is 24 chars wide
Expand Down Expand Up @@ -421,6 +422,73 @@ format_timestamp(_Now, undefined) ->
format_timestamp(Now, TS) -> format_timestamp(Now, TS) ->
riak_core_format:human_time_fmt("~.1f", timer:now_diff(Now, TS)). riak_core_format:human_time_fmt("~.1f", timer:now_diff(Now, TS)).


parse_int(IntStr) ->
try
list_to_integer(IntStr)
catch
error:badarg ->
undefined
end.

index_reformat_options([], Opts) ->
Defaults = [{concurrency, 2}, {batch_size, 100}],
AddIfAbsent =
fun({Name,Val}, Acc) ->
case lists:keymember(Name, 1, Acc) of
true ->
Acc;
false ->
[{Name, Val} | Acc]
end
end,
lists:foldl(AddIfAbsent, Opts, Defaults);
index_reformat_options(["--downgrade"], Opts) ->
[{downgrade, true} | Opts];
index_reformat_options(["--downgrade" | More], _Opts) ->
io:format("Invalid arguments after downgrade switch : ~p~n", [More]),
undefined;
index_reformat_options([IntStr | Rest], Opts) ->
HasConcurrency = lists:keymember(concurrency, 1, Opts),
HasBatchSize = lists:keymember(batch_size, 1, Opts),
case {parse_int(IntStr), HasConcurrency, HasBatchSize} of
{_, true, true} ->
io:format("Expected --downgrade instead of ~p~n", [IntStr]),
undefined;
{undefined, _, _ } ->
io:format("Expected integer parameter instead of ~p~n", [IntStr]),
undefined;
{IntVal, false, false} ->
index_reformat_options(Rest, [{concurrency, IntVal} | Opts]);
{IntVal, true, false} ->
index_reformat_options(Rest, [{batch_size, IntVal} | Opts])
end;
index_reformat_options(_, _) ->
undefined.

reformat_indexes(Args) ->
Opts = index_reformat_options(Args, []),
case Opts of
undefined ->
io:format("Expected options: <concurrency> <batch size> [--downgrade]~n"),
ok;
_ ->
start_index_reformat(Opts),
io:format("index reformat started with options ~p ~n", [Opts]),
io:format("check console.log for status information~n"),
ok
end.

start_index_reformat(Opts) ->
spawn(fun() -> run_index_reformat(Opts) end).

run_index_reformat(Opts) ->
try riak_kv_util:fix_incorrect_index_entries(Opts)
catch
Err:Reason ->
lager:error("index reformat crashed with error type ~p and reason: ~p",
[Err, Reason])
end.

%%%=================================================================== %%%===================================================================
%%% Private %%% Private
%%%=================================================================== %%%===================================================================
Expand Down
Loading