Skip to content

Commit e812164

Browse files
authored
Merge pull request #403 from basho/mas-i1793-repairkeysrange
Mas i1793 repairkeysrange
2 parents d58c1e6 + 82b557e commit e812164

File tree

2 files changed

+49
-2
lines changed

2 files changed

+49
-2
lines changed

rebar.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
]}.
1818

1919
{deps, [
20-
{riak_pb, {git, "https://github.com/basho/riak_pb", {tag, "3.0.7"}}}
20+
{riak_pb, {git, "https://github.com/basho/riak_pb", {branch, "develop-3.0"}}}
2121
]}.
2222

2323
{edoc_opts, [

src/riakc_pb_socket.erl

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@
7373
get_index_eq/4, get_index_range/5, get_index_eq/5, get_index_range/6,
7474
aae_merge_root/2, aae_merge_branches/3,
7575
aae_fetch_clocks/3, aae_fetch_clocks/4,
76-
aae_range_tree/7, aae_range_clocks/5, aae_range_replkeys/5,
76+
aae_range_tree/7, aae_range_clocks/5,
77+
aae_range_replkeys/5, aae_range_repairkeys/4,
7778
aae_find_keys/5, aae_find_tombs/5, aae_reap_tombs/6, aae_erase_keys/6,
7879
aae_list_buckets/1, aae_list_buckets/2,
7980
aae_object_stats/4,
@@ -1637,6 +1638,47 @@ aae_range_replkeys(Pid, BucketType, KeyRange, ModifiedRange, QueueName) ->
16371638
queuename = QN},
16381639
Timeout}).
16391640

1641+
%% @doc aae_range_repairkeys
1642+
%% Fold over a range of keys and in batches prompt read repair of each key
1643+
%% by fetching the key
1644+
-spec aae_range_repairkeys(pid(), riakc_obj:bucket(),
1645+
key_range(), modified_range()) ->
1646+
{ok, non_neg_integer()} |
1647+
{error, any()}.
1648+
aae_range_repairkeys(Pid, BucketType, KeyRange, ModifiedRange) ->
1649+
Timeout = default_timeout(aaefold_timeout),
1650+
{KR, SK, EK} =
1651+
case KeyRange of
1652+
all ->
1653+
{false, undefined, undefined};
1654+
{SK0, EK0} ->
1655+
{true, SK0, EK0}
1656+
end,
1657+
{MR, MRLow, MRHigh} =
1658+
case ModifiedRange of
1659+
all ->
1660+
{false, undefined, undefined};
1661+
{MRL, MRH} ->
1662+
{true, MRL, MRH}
1663+
end,
1664+
{T, B} =
1665+
case BucketType of
1666+
B0 when is_binary(B0) ->
1667+
{undefined, B0};
1668+
{T0, B0} ->
1669+
{T0, B0}
1670+
end,
1671+
call_infinity(Pid,
1672+
{req,
1673+
#rpbaaefoldrepairkeysreq{type = T,
1674+
bucket = B,
1675+
key_range = KR,
1676+
start_key = SK,
1677+
end_key = EK,
1678+
modified_range = MR,
1679+
last_mod_start = MRLow,
1680+
last_mod_end = MRHigh},
1681+
Timeout}).
16401682

16411683
%% @doc aae_find_keys folds over the tictacaae store to get
16421684
%% operational information. `Rhc' is the client. `Bucket' is the
@@ -2739,6 +2781,11 @@ process_response(#request{msg = #rpbaaefoldreplkeysreq{}},
27392781
State) ->
27402782
true = <<"dispatched_count">> == DispatchCount#rpbkeyscount.tag,
27412783
{reply, {ok, DispatchCount#rpbkeyscount.count}, State};
2784+
process_response(#request{msg = #rpbaaefoldrepairkeysreq{}},
2785+
#rpbaaefoldkeycountresp{keys_count = [DispatchCount]},
2786+
State) ->
2787+
true = <<"dispatched_count">> == DispatchCount#rpbkeyscount.tag,
2788+
{reply, {ok, DispatchCount#rpbkeyscount.count}, State};
27422789
process_response(#request{msg = #rpbaaefoldobjectstatsreq{}},
27432790
#rpbaaefoldkeycountresp{keys_count = KeysCount},
27442791
State) ->

0 commit comments

Comments
 (0)