Modified the CRDT test to account for changes we have made in Yokozuna.

This change requires a change to the intercept code, as we refactored the delete operations in Yokozuna to avoid deleteByQuery, and hence has different touch points in Yokozuna that need to be intercepted.
This commit is contained in:
Fred Dushin 2016-10-31 16:51:48 -04:00
parent d7875212e9
commit 226c8bc12f
2 changed files with 22 additions and 16 deletions

View File

@ -17,30 +17,32 @@
%% under the License.
%%
%%-------------------------------------------------------------------
-module(yz_kv_intercepts).
-module(yz_solrq_helper_intercepts).
-compile(export_all).
-include("intercept.hrl").
-define(M, yz_kv_orig).
-define(M, yz_solrq_helper_orig).
handle_delete_operation(BProps, Obj, Docs, BKey, LP) ->
handle_get_ops_for_crdt_deletes(LI, P, Obj) ->
Lookup = ets:lookup(intercepts_tab, del_put),
case Lookup of
[] -> original_delete_op(BProps, Obj, Docs, BKey, LP);
[] -> original_get_ops_for_crdt_deletes(LI, P, Obj);
_ ->
case proplists:get_value(del_put, Lookup) of
0 ->
error_logger:info_msg(
"Delete operation intercepted for BKey ~p", [BKey]),
"Delete operation intercepted for BKey ~p",
[{riak_object:bucket(Obj), riak_object:key(Obj)}]),
ets:update_counter(intercepts_tab, del_put, 1),
[];
_ ->
original_delete_op(BProps, Obj, Docs, BKey, LP)
original_get_ops_for_crdt_deletes(LI, P, Obj)
end
end.
original_delete_op(BProps, Obj, Docs, BKey, LP) ->
original_get_ops_for_crdt_deletes(LI, P, Obj) ->
error_logger:info_msg(
"Delete operation original for BKey ~p | ~p", [BKey, Docs]),
?M:delete_operation_orig(BProps, Obj, Docs, BKey, LP).
"Delete operation original for BKey ~p",
[{riak_object:bucket(Obj), riak_object:key(Obj)}]),
?M:get_ops_for_crdt_deletes_orig(LI, P, Obj).

View File

@ -56,7 +56,7 @@ confirm() ->
end),
lager:info("Test setting the register of a map twice to different values."
"\nThe # of results should still be 1"),
" (The # of results should still be 1)"),
test_repeat_sets(Pid, Nodes, ?BUCKET, ?INDEX, ?KEY),
ok = rt:wait_until(fun() -> validate_test_repeat_set(Pid, ?INDEX)
end),
@ -256,8 +256,8 @@ test_and_validate_delete_aae(Pid, Cluster, Bucket, Index) ->
[make_intercepts_tab(ANode) || ANode <- Cluster],
[rt_intercept:add(ANode, {yz_kv, [{{delete_operation, 5},
handle_delete_operation}]})
[rt_intercept:add(ANode, {yz_solrq_helper, [{{get_ops_for_crdt_deletes, 3},
handle_get_ops_for_crdt_deletes}]})
|| ANode <- Cluster],
[true = rpc:call(ANode, ets, insert, [intercepts_tab, {del_put, 0}]) ||
ANode <- Cluster],
@ -551,10 +551,14 @@ search_and_validate_found(Pid, Index, Search, ExpectedCount) ->
?assertEqual(ExpectedCount, F),
true
catch Err:Reason ->
lager:info("Waiting for CRDT search results to"
" converge. Error was ~p.",
[{Err, Reason}]),
false
lager:info(
"Waiting for CRDT search results to converge."
" Index: ~p"
" Search: ~p"
" Error: ~p",
[Index, Search, {Err, Reason}]
),
false
end
end).