Using > TicTac AAE Fold:
Count Tombstones

Counts 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 count 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 count method for counting 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, local and job:

  • local is used to actually reap the tombstones (see Reap 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 count method

Returns a count of tombstones that meet the filter parameters. Does NOT reap the tombstones.

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

Please see the list of available filters below.

For example, the following snippet will count 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,1640995200,1643673600},
    count
    }, Client).

The response for the count method

The response will look something like this:

{ok,5}

This indicates that 5 tombstones were found meeting the filter parameters.

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: