|
73 | 73 | get_index_eq/4, get_index_range/5, get_index_eq/5, get_index_range/6, |
74 | 74 | aae_merge_root/2, aae_merge_branches/3, |
75 | 75 | 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, |
77 | 78 | aae_find_keys/5, aae_find_tombs/5, aae_reap_tombs/6, aae_erase_keys/6, |
78 | 79 | aae_list_buckets/1, aae_list_buckets/2, |
79 | 80 | aae_object_stats/4, |
@@ -1637,6 +1638,47 @@ aae_range_replkeys(Pid, BucketType, KeyRange, ModifiedRange, QueueName) -> |
1637 | 1638 | queuename = QN}, |
1638 | 1639 | Timeout}). |
1639 | 1640 |
|
| 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}). |
1640 | 1682 |
|
1641 | 1683 | %% @doc aae_find_keys folds over the tictacaae store to get |
1642 | 1684 | %% operational information. `Rhc' is the client. `Bucket' is the |
@@ -2739,6 +2781,11 @@ process_response(#request{msg = #rpbaaefoldreplkeysreq{}}, |
2739 | 2781 | State) -> |
2740 | 2782 | true = <<"dispatched_count">> == DispatchCount#rpbkeyscount.tag, |
2741 | 2783 | {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}; |
2742 | 2789 | process_response(#request{msg = #rpbaaefoldobjectstatsreq{}}, |
2743 | 2790 | #rpbaaefoldkeycountresp{keys_count = KeysCount}, |
2744 | 2791 | State) -> |
|
0 commit comments