Using > TicTac AAE Fold:
Reap Tombstones

Reaps the Riak tombstone objects that meet the filter parameters.

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

Unreaped Riak tombstones are Riak objects that have been deleted, but have not been removed from the backend. Riak tracks this through tombstones. If automatic reaping is turned off (for example, by setting delete_mode = keep), then a large number of deleted objects can accumulate that Riak will never automatically remove. Manual dev ops intervention using this function is required.

Use the reap_tombs function to remove these objects.

The reap_tombs function

Run this using riak attach.

This function has three available operational methods that are selected via the method value. The local method for reaping tombstones is detailed below. The general format for the function is:

riak_client:aae_fold({
    reap_tombs,
    bucket_filter,
    key_range_filter,
    segment_filter
    modified_filter,
    method
    }, Client).

Please see the list of available filters below.

Other methods

There are two other methods, count and job:

  • count is used to count the tombstones (see Count Tombstones for more information).
  • job is used internally by TicTac AAE. Do not use it unless you know what you are doing.

How to get the value for Client is detailed in The Riak Client.

The local method

Marks tombstones for reaping that meet the filter parameters. Returns the number of tombstones marked by calling this function.

riak_client:aae_fold({
    reap_tombs,
    bucket_filter,
    key_range_filter,
    segment_filter
    modified_filter,
    local
    }, Client).

Please see the list of available filters below.

For example, the following snippet will mark for reaping all tombstones with the filters:

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

The response for the local method

The response will look something like this:

{ok,5}

This indicates that 5 tombstones were found meeting the filter parameters and were marked to be reaped.

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: