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: Use a partition level map to look up pk index #3400

Merged
merged 5 commits into from
Feb 28, 2024

Conversation

evenyag
Copy link
Contributor

@evenyag evenyag commented Feb 27, 2024

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

This PR adds a partition level map to replace the shard level map to look up pk indices. This can improve pk index lookup performance as we don't need to iterate all shards to find the pk index.

  • Pk indices inside a dictionary builder can't be compared directly. We collect pk indices after we freeze a dictionary and then write them to the partition level map.
  • Now we evict the whole partition once we reach the dictionary memory limit so we can also drop the map on eviction.

This PR also fixes an issue that a key may be written to multiple shards if we find the key before finishing a shard builder.

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 27, 2024
@evenyag evenyag marked this pull request as ready for review February 27, 2024 14:50
Copy link

codecov bot commented Feb 27, 2024

Codecov Report

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

Project coverage is 84.54%. Comparing base (dbb1ce1) to head (67823cf).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3400      +/-   ##
==========================================
- Coverage   85.04%   84.54%   -0.50%     
==========================================
  Files         893      899       +6     
  Lines      147899   148520     +621     
==========================================
- Hits       125781   125567     -214     
- Misses      22118    22953     +835     

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
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 28, 2024
Merged via the queue into GreptimeTeam:main with commit b97f957 Feb 28, 2024
35 of 41 checks passed
@v0y4g3r v0y4g3r deleted the feat/part-hash branch February 28, 2024 03:27
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.

3 participants