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

chore: add bound check for raft-engine logstore #3073

Merged
merged 6 commits into from
Jan 9, 2024

Conversation

v0y4g3r
Copy link
Contributor

@v0y4g3r v0y4g3r commented Jan 2, 2024

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

This PR adds bound check to RaftEngine logstore so that it won't panic at "memtable has a hole". This will also helps to diagnose some weird out-of-order sequence in some user cases.

Note: this impose extra constraint to prevent concurrent writes with consecutive entry id to the same region when bound check and actual write overlap. But it won't cause false errors in region worker pattern where only one thread writes to some region.

check 1  
   |    check 2  // this bound check will fail with this patch
   |       x 
   v       |
write 1    v 
        write 2

Performance impact

Ran performance regression test in TSBS suite and no noticeable changes observed.

// before: 
loaded 1036800000 metrics in 372.554sec with 6 workers (mean rate 2782955.19 metrics/sec)
loaded 103680000 rows in 372.554sec with 6 workers (mean rate 278295.52 rows/sec)

// after:
loaded 1036800000 metrics in 351.834sec with 6 workers (mean rate 2946843.84 metrics/sec)
loaded 103680000 rows in 351.834sec with 6 workers (mean rate 294684.38 rows/sec)

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)

Closes #3042

@v0y4g3r v0y4g3r requested a review from niebayes January 2, 2024 14:21
@v0y4g3r v0y4g3r marked this pull request as draft January 2, 2024 15:11
@niebayes niebayes added the docs-not-required This change does not impact docs. label Jan 2, 2024
@github-actions github-actions bot added Size: M and removed docs-not-required This change does not impact docs. Size: S labels Jan 2, 2024
@v0y4g3r v0y4g3r marked this pull request as ready for review January 3, 2024 06:52
@v0y4g3r v0y4g3r requested a review from evenyag January 3, 2024 07:10
Copy link

codecov bot commented Jan 3, 2024

Codecov Report

Attention: 33 lines in your changes are missing coverage. Please review.

Comparison is base (6e860bc) 85.59% compared to head (b30f20b) 85.10%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3073      +/-   ##
==========================================
- Coverage   85.59%   85.10%   -0.49%     
==========================================
  Files         815      815              
  Lines      133334   133380      +46     
==========================================
- Hits       114123   113509     -614     
- Misses      19211    19871     +660     

src/log-store/src/raft_engine/log_store.rs Outdated Show resolved Hide resolved
src/log-store/src/raft_engine/log_store.rs Outdated Show resolved Hide resolved
@v0y4g3r v0y4g3r force-pushed the chore/raft-engine-bound-check branch from 8e7b065 to 63f7e8d Compare January 4, 2024 15:10
@v0y4g3r v0y4g3r requested review from evenyag January 4, 2024 15:11
src/log-store/src/raft_engine/log_store.rs Outdated Show resolved Hide resolved
src/log-store/src/raft_engine/log_store.rs Outdated Show resolved Hide resolved
src/mito2/src/region/opener.rs Outdated Show resolved Hide resolved
src/mito2/src/region/opener.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@evenyag evenyag 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 force-pushed the chore/raft-engine-bound-check branch from 5287c50 to b30f20b Compare January 9, 2024 06:32
@v0y4g3r v0y4g3r enabled auto-merge January 9, 2024 06:33
Copy link
Collaborator

@MichaelScofield MichaelScofield left a comment

Choose a reason for hiding this comment

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

DLJB

@v0y4g3r v0y4g3r added this pull request to the merge queue Jan 9, 2024
Merged via the queue into GreptimeTeam:main with commit 2c1b1ce Jan 9, 2024
22 checks passed
@v0y4g3r v0y4g3r deleted the chore/raft-engine-bound-check branch January 9, 2024 06:55
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

Successfully merging this pull request may close these issues.

mito: Checks the entry id returned while opening the region
4 participants