RedisLess icon indicating copy to clipboard operation
RedisLess copied to clipboard

garbage collection

Open barkanido opened this issue 3 years ago • 2 comments

still WIP

  1. This PR strives to change the API of Storage to be more user-friendly. Specifically, read+hread to be read-only (taking &self instead of &mut self). This is to clear the ground to compose them with other commands. Specifically, COPY (#25) needs to call both read and write on the Storage and cannot have multiple mutable references.
  2. there are 2 parts for this PR.
  • first, read commands merely marks the values with expired TTL with a "tombstone" in an atomic, immutable way. this relaxes the &mut self requirement
  • second, --- not implemented yet--- a GC worker is spawned. This thread should work the same as original Redis GC algorithm works see here.

Note about the 2nd stage. One could argue that deleting keys in a lazy fashion is not enough as it could lead to memory bloat and rightly so! However, A GC thread is needed anyway since expired keys need to be evicted even if they are not visited.

barkanido avatar Jun 01 '21 07:06 barkanido

Hi @barkanido, is it still WIP? Did you manage to make it works?

evoxmusic avatar Jul 27 '21 20:07 evoxmusic

@evoxmusic this is still WIP. I wanted your comments on this design, and if we all agree, then some help in progressing with the GC implementation itself

barkanido avatar Jul 28 '21 06:07 barkanido