Using > TicTac AAE Fold:
Repair Keys

Performs a read-repair on the Riak objects that meet the filter parameters.

See the TicTac AAE aae_folds documentation for configuration, tuning and troubleshootings help.

Occasionally, you want to perform a read-repair on a number of keys quickly an efficiently. Previously, you had to do a find_keys call followed by a read request on each key. This was inefficient as all the data had to be sent over the network to the client. Now, you can have Riak perform a read-repair without sending the data to the client.

Use the repair_keys_range function to remove these objects.

The repair_keys_range function

Run this using riak attach.

The format for the function is:

riak_client:aae_fold({
    repair_keys_range,
    bucket_filter,
    key_range_filter,
    modified_filter,
    all
    }, Client).

Please see the list of available filters below.

For the function repair_keys_range, only non-negative interger of seconds since 1970-01-01 00:00:00 works for modified_filter in this version. This is fixed in a later version.

For example, the following snippet will perform a read-repair on all Riak objects with the filters:

  • in the bucket “dogs” of bucket type “animals”
  • whose keys are between “A” and “N”
  • which were modified in 2022
riak_client:aae_fold({
    repair_keys_range,
    {<<"animals">>,<<"dogs">>},
    {<<"A">>,<<"N">>},
    {date,1640995200,1672531200},
    all
    }, Client).

The response

The response will look something like this:

{ok,{[],0,all,128}}

This indicates that:

  • ok: the read repair request finished successfully
  • []: the remaining items, which should be an empty list
  • 0: the number of keys repairs, in this case none
  • all: a constant
  • 128: the size of each batch of read repairs, which is 128

This indicates that the keys found meeting the filter parameters and were read-repaired.

Available filters

These filters are detailed in the Filters documentation and can be used to limit the keys considered for reaping or counting.

These filters will reduce the keys to be searched:

These filters will reduce the number of keys considered for reaping or counting: