Skip to content

Commit 72c4112

Browse files
committed
Merge branch '2.0' into develop
2 parents e74ed2b + eb4919c commit 72c4112

File tree

4 files changed

+61
-6
lines changed

4 files changed

+61
-6
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
-module(yz_solr_intercepts).
2+
-compile(export_all).
3+
4+
slow_cores() ->
5+
timer:sleep(6000),
6+
{ok, []}.

riak_test/yz_handoff_blocking.erl

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
%% @doc Verify yokozuna cannot block kv handoff forever
2+
-module(yz_handoff_blocking).
3+
-compile(export_all).
4+
-include_lib("eunit/include/eunit.hrl").
5+
-define(FMT(S, Args), lists:flatten(io_lib:format(S, Args))).
6+
-define(INDEX, <<"handoff_blocking">>).
7+
-define(CFG,
8+
[{riak_core,
9+
[
10+
{ring_creation_size, 16}
11+
]},
12+
{yokozuna,
13+
[
14+
{enabled, true}
15+
]}
16+
]).
17+
18+
confirm() ->
19+
[Node, Node2] = Cluster = rt:deploy_nodes(2, ?CFG),
20+
21+
%% create an index on one node and populate it with some data
22+
yz_rt:create_index(Node, ?INDEX),
23+
ok = yz_rt:wait_for_index([Node], ?INDEX),
24+
ok = yz_rt:set_bucket_type_index(Node, ?INDEX),
25+
ConnInfo = yz_rt:connection_info([Node]),
26+
{Host, Port} = yz_rt:riak_http(proplists:get_value(Node, ConnInfo)),
27+
URL = ?FMT("http://~s:~s/types/~s/buckets/~s/keys/~s",
28+
[Host, integer_to_list(Port), ?INDEX, <<"bucket">>, <<"key">>]),
29+
Headers = [{"content-type", "text/plain"}],
30+
Body = <<"yokozuna">>,
31+
{ok, "204", _, _} = ibrowse:send_req(URL, Headers, put, Body, []),
32+
33+
%% load and install the intercept
34+
rt_intercept:load_code(Node2, [filename:join([rt_config:get(yz_dir), "riak_test", "intercepts", "*.erl"])]),
35+
rt_intercept:add(Node2, {yz_solr, [{{cores,0}, slow_cores}]}),
36+
37+
%% join a node
38+
rt:join_cluster(Cluster),
39+
ok = rt:wait_until_no_pending_changes(Cluster),
40+
41+
pass.

src/yz_kv.erl

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,22 @@ get_index({Bucket, _}) ->
149149
should_handoff({_Reason, {_Partition, TargetNode}}) ->
150150
case ?YZ_ENABLED andalso is_service_up(?YZ_SVC_NAME, TargetNode) of
151151
true ->
152-
case is_metadata_consistent(TargetNode) andalso
153-
has_indexes(TargetNode) of
154-
true ->
152+
Consistent = is_metadata_consistent(TargetNode),
153+
HasIndexes = has_indexes(TargetNode),
154+
case {Consistent, HasIndexes} of
155+
{true, true} ->
155156
true;
156-
false ->
157+
{false, false} ->
157158
?INFO("waiting for bucket types prefix and indexes to agree between ~p and ~p",
158159
[node(), TargetNode]),
160+
false;
161+
{false, _} ->
162+
?INFO("waiting for bucket types prefix to agree between ~p and ~p",
163+
[node(), TargetNode]),
164+
false;
165+
{_, false} ->
166+
?INFO("waiting for indexes to agree between ~p and ~p",
167+
[node(), TargetNode]),
159168
false
160169
end;
161170
false ->

tools/build-solr.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#>
99
#> Example:
1010
#>
11-
#> ./build-solr.sh --patch-dir ~/yokozuna/solr-patches /tmp/build-solr solr-4.6.1-yz http://www.motorlogy.com/apache/lucene/solr/4.6.1/solr-4.6.1-src.tgz | tee build-solr.out
11+
#> ./build-solr.sh --patch-dir ~/yokozuna/solr-patches /tmp/build-solr solr-4.7.0-yz http://archive.apache.org/dist/lucene/solr/4.7.0/solr-4.7.0-src.tgz | tee build-solr.out
1212

1313
set -e
1414

@@ -145,4 +145,3 @@ tar zcvf $NAME.tgz \
145145
--exclude=example/etc/solrtest.keystore \
146146
$NAME
147147
mv $NAME solr
148-

0 commit comments

Comments
 (0)