Skip to content

Instantly share code, notes, and snippets.

@rbotzer
Created February 16, 2020 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rbotzer/3a8f1a483cfaabc3086d8d0986f0b2dc to your computer and use it in GitHub Desktop.
Save rbotzer/3a8f1a483cfaabc3086d8d0986f0b2dc to your computer and use it in GitHub Desktop.
# Clear all the segments that expire before today from the user u1
print("Clean the stale segments for user u1")
if options.interactive:
pause()
ops = [
mh.map_remove_by_value_range(
"u",
[0, aerospike.null()],
[end_ttl, aerospike.null()],
aerospike.MAP_RETURN_COUNT,
False,
),
mh.map_size("u"),
]
_, _, b = client.operate_ordered(key, ops)
stale_segments, segments_left = b
print(
"User u1 had {} stale segments trimmed, with {} segments remaining".format(
stale_segments[1], segments_left[1]
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment