Skip to content
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.

garbage collection #54

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

garbage collection #54

wants to merge 1 commit into from

Conversation

barkanido
Copy link

@barkanido barkanido commented Jun 1, 2021

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 (Support command "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.

@evoxmusic
Copy link
Contributor

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

@barkanido
Copy link
Author

@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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants