Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GC old tombstones #17

Open
dgrnbrg opened this issue Dec 24, 2013 · 3 comments
Open

GC old tombstones #17

dgrnbrg opened this issue Dec 24, 2013 · 3 comments

Comments

@dgrnbrg
Copy link
Contributor

dgrnbrg commented Dec 24, 2013

We can safely delete tombstone entries when they are the oldest value known. This process can become a part of merging. During this time, it can also clean up the running keydir.

@dgrnbrg
Copy link
Contributor Author

dgrnbrg commented Jan 29, 2014

To clean up the running keydir, we can use (.remove chm k v), which is a conditional remove that would let us specify to remove only the GCed value, not a newer one.

@dgrnbrg
Copy link
Contributor Author

dgrnbrg commented Feb 4, 2014

We can implement this by making merge be 2 operations: small merge and big merge

  • Small merge chooses the target files for the merge and copies all relevant keydir entries to new files, then deletes the old files in any order
  • Big merge chooses all files up to certain id for the merge, and only copies non-tombstone keydir entries to new files, then deletes the old files from earliest id to latest

We will do small merges whenever the fragmentation threshold gets high enough. We can do big merges whenever the number of expired keys grows big or the size in memory of expired keys grows big. We can attach another field to KDEs which is :expired? so that we can track expired key count efficiently when merging.

@dgrnbrg
Copy link
Contributor Author

dgrnbrg commented Feb 4, 2014

It turns out that the way bitcask handles this is by marking each fully copied file with the setuid after all the data is copied out of it. Then, it periodically sweeps those files with the setuid bit set.

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

No branches or pull requests

1 participant