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

Reimplement GC in move-rocks by added CF index #902

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mzabaluev
Copy link
Collaborator

@mzabaluev mzabaluev commented Nov 26, 2024

Fixes: #879 #880 #881

Summary

  • Categories: protocol-units.

Resolve the problem of GC not being implemented for the key format that ended up being merged, by introducing a time-sorted index CF named "transaction_timeline". The entries are added with each transaction, but are only collected by GC passes when their time window passes.

Changelog

  • move-rocks: Fix garbage collection so that it actually works.

Testing

test_rocksdb_gc passes in the move-rocks crate.

Resolve the problem of GC not being implemented for the key format
that ended up being merged, by introducing a time-sorted index CF
named "transaction_timeline". The entries are added with each
transaction, but are only collected by GC passes when their time
window passes.
@mzabaluev mzabaluev linked an issue Nov 26, 2024 that may be closed by this pull request
@mzabaluev mzabaluev changed the title fix(move-rocks): reimplement GC by added CF index Reimplement GC in move-rocks by added CF index Nov 26, 2024
@mzabaluev mzabaluev linked an issue Nov 27, 2024 that may be closed by this pull request
@mzabaluev mzabaluev marked this pull request as ready for review November 27, 2024 16:06
protocol-units/mempool/move-rocks/src/lib.rs Show resolved Hide resolved
protocol-units/mempool/move-rocks/src/lib.rs Show resolved Hide resolved
while let Some(res) = iter.next() {
let (timeline_key, key) = res?;

batch.delete_cf(&timeline_cf_handle, &timeline_key);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two things w.r.t. to this implementation and testing that would be nice to haves:

  1. I think we might want to fuzz a fair few of these tests--particularly the GC.
  2. I think we would benefit from using domain-specific types for GC timestamps. I was looking at the usage here and in the other garbage collected containers we have, and it's quite easy to mix up the timestamps with something else.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds reasonable. As we need custom formatting here, perhaps a newtype defined in the library and implementing Display to format into {:032} would be appropriate.

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