Using > TicTac AAE Fold:
Erase Keys
Erases keys that meet the filter parameters.
See the TicTac AAE aae_folds
documentation for configuration, tuning and troubleshootings help.
This function allows you to delete many keys in a single pass based on the supplied filters. The Riak keys will be converted to Riak tombstones after which the normal Riak reaping functions take over. Manual dev ops intervention using this function is required.
Use the erase_keys
function to delete these keys.
The erase_keys
function
Run this using riak attach
.
This function has three available operational methods that are selected via the method
value. The local
method for deleting keys is detailed below. The general format for the function is:
riak_client:aae_fold({
erase_keys,
bucket_filter,
key_range_filter,
segment_filter
modified_filter,
method
}, Client).
Please see the list of available filters below.
method
sThere are two other method
s, count
and job
:
count
is used to count the keys that would have been deleted (see Count Objects 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
Deletes keys that meet the filter parameters so that they can then be reaped. Returns the number of keys deleted by calling this function.
riak_client:aae_fold({
erase_keys,
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 delete keys 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({
erase_keys,
{<<"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 keys were found meeting the filter parameters and were deleted by Riak. Remember that a deleted Riak key is really converted to a Riak tombstone object, and will be actually removed from the backend at a later point based on your delete_mode
setting.
Available filters
These filters are detailed in the Filters documentation and can be used to limit the keys considered for deleting.
These filters will reduce the keys to be searched:
These filters will reduce the number of keys considered for deleting: