2015-09-13 18:59:55 +00:00
|
|
|
%% -------------------------------------------------------------------
|
|
|
|
%%
|
|
|
|
%% Copyright (c) 2015 Basho Technologies, Inc.
|
|
|
|
%%
|
|
|
|
%% 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.
|
|
|
|
%%
|
|
|
|
%%-------------------------------------------------------------------
|
2016-10-31 20:51:48 +00:00
|
|
|
-module(yz_solrq_helper_intercepts).
|
2015-09-13 18:59:55 +00:00
|
|
|
-compile(export_all).
|
|
|
|
|
|
|
|
-include("intercept.hrl").
|
|
|
|
|
2016-10-31 20:51:48 +00:00
|
|
|
-define(M, yz_solrq_helper_orig).
|
2015-09-13 18:59:55 +00:00
|
|
|
|
2016-11-03 00:11:09 +00:00
|
|
|
handle_get_ops_for_no_sibling_deletes(LI, P, Obj) ->
|
2015-09-13 18:59:55 +00:00
|
|
|
Lookup = ets:lookup(intercepts_tab, del_put),
|
|
|
|
case Lookup of
|
2016-11-03 00:11:09 +00:00
|
|
|
[] -> original_get_ops_for_no_sibling_deletes(LI, P, Obj);
|
2015-09-13 18:59:55 +00:00
|
|
|
_ ->
|
2015-10-06 13:54:02 +00:00
|
|
|
case proplists:get_value(del_put, Lookup) of
|
|
|
|
0 ->
|
2015-09-13 18:59:55 +00:00
|
|
|
error_logger:info_msg(
|
2016-10-31 20:51:48 +00:00
|
|
|
"Delete operation intercepted for BKey ~p",
|
|
|
|
[{riak_object:bucket(Obj), riak_object:key(Obj)}]),
|
2015-09-13 18:59:55 +00:00
|
|
|
ets:update_counter(intercepts_tab, del_put, 1),
|
|
|
|
[];
|
|
|
|
_ ->
|
2016-11-03 00:11:09 +00:00
|
|
|
original_get_ops_for_no_sibling_deletes(LI, P, Obj)
|
2015-09-13 18:59:55 +00:00
|
|
|
end
|
|
|
|
end.
|
|
|
|
|
2016-11-03 00:11:09 +00:00
|
|
|
original_get_ops_for_no_sibling_deletes(LI, P, Obj) ->
|
2015-09-13 18:59:55 +00:00
|
|
|
error_logger:info_msg(
|
2016-10-31 20:51:48 +00:00
|
|
|
"Delete operation original for BKey ~p",
|
|
|
|
[{riak_object:bucket(Obj), riak_object:key(Obj)}]),
|
2016-11-03 00:11:09 +00:00
|
|
|
?M:get_ops_for_no_sibling_deletes_orig(LI, P, Obj).
|