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

feat: Add freeze and fork method to the memtable #3374

Merged
merged 13 commits into from Feb 24, 2024

Conversation

evenyag
Copy link
Contributor

@evenyag evenyag commented Feb 24, 2024

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

This PR changes some APIs of the memtable

  • Renames mark_immutable() to freeze(). freeze() turns a mutable memtable into an immutable memtable and this operation is fallible.
  • Adds a fork() method to create a new mutable memtable from an immutable memtable.
    • It allows the new memtable to reuse some data in the old memtable
  • The iter() method is fallible.

Now the region instead of the memtable builder generates the memtable id. So the memtable builder needs to take a memtable id to build a new memtable.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR does not require documentation updates.

Refer to a related PR or issue link (optional)

@github-actions github-actions bot added the docs-not-required This change does not impact docs. label Feb 24, 2024
@evenyag evenyag marked this pull request as ready for review February 24, 2024 11:56
Copy link
Collaborator

@fengjiachun fengjiachun left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

codecov bot commented Feb 24, 2024

Codecov Report

Attention: Patch coverage is 67.94872% with 25 lines in your changes are missing coverage. Please review.

Project coverage is 85.20%. Comparing base (1df64f2) to head (9f64bbe).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3374      +/-   ##
==========================================
- Coverage   85.59%   85.20%   -0.39%     
==========================================
  Files         892      892              
  Lines      146564   146596      +32     
==========================================
- Hits       125448   124912     -536     
- Misses      21116    21684     +568     

Copy link
Contributor

@v0y4g3r v0y4g3r left a comment

Choose a reason for hiding this comment

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

LGTM

@v0y4g3r v0y4g3r added this pull request to the merge queue Feb 24, 2024
Merged via the queue into GreptimeTeam:main with commit abbfd23 Feb 24, 2024
24 of 29 checks passed
@v0y4g3r v0y4g3r deleted the feat/freeze-fork-memtable branch February 24, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants