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

hide more file writing details from engine #269

Merged
merged 9 commits into from
Sep 6, 2022

Conversation

tabokie
Copy link
Member

@tabokie tabokie commented Sep 2, 2022

This is a preparing work for #258.

Changes:

  • Move fsync to file handle instead of writer, so that we can call it concurrently in the future. In doing so, we have to remove the sync offset tracking and deprecate bytes_per_sync support
  • Move prepare_write into pipe_log. Introduce a trait ReactiveBytes for this purpose.
  • Rotate the file during write instead of doing it every write group, the timing is also delayed to the next write after exceeding limit (instead of the write that exceeds the limit).
  • Differentiate two types of I/O errors: unrecoverable error from fsync, and retriable error from pwrite. Only bubble error for the latter case, panic early for unrecoverable ones.
  • Also refactor the purge code, fix two cases where force-compact is not triggered

@tabokie
Copy link
Member Author

tabokie commented Sep 2, 2022

/cc @LykxSassinator

@codecov
Copy link

codecov bot commented Sep 2, 2022

Codecov Report

Base: 97.65% // Head: 97.66% // Increases project coverage by +0.01% 🎉

Coverage data is based on head (3e15000) compared to base (9751c6d).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #269      +/-   ##
==========================================
+ Coverage   97.65%   97.66%   +0.01%     
==========================================
  Files          30       30              
  Lines       10645    10633      -12     
==========================================
- Hits        10395    10385      -10     
+ Misses        250      248       -2     
Impacted Files Coverage Δ
src/env/mod.rs 100.00% <ø> (ø)
src/env/obfuscated.rs 95.65% <ø> (-0.19%) ⬇️
src/config.rs 96.66% <100.00%> (-0.03%) ⬇️
src/engine.rs 97.90% <100.00%> (-0.01%) ⬇️
src/env/default.rs 92.26% <100.00%> (-0.13%) ⬇️
src/file_pipe_log/log_file.rs 100.00% <100.00%> (ø)
src/file_pipe_log/pipe.rs 99.49% <100.00%> (+0.49%) ⬆️
src/log_batch.rs 97.97% <100.00%> (+<0.01%) ⬆️
src/memtable.rs 99.16% <100.00%> (-0.01%) ⬇️
src/pipe_log.rs 93.93% <100.00%> (+0.28%) ⬆️
... and 6 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor

@LykxSassinator LykxSassinator left a comment

Choose a reason for hiding this comment

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

Rest is LGTM

@@ -401,15 +413,11 @@ impl<F: FileSystem> SinglePipe<F> {
Ok(handle)
}

fn maybe_sync(&self, force: bool) -> Result<()> {
fn sync(&self) -> Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

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

In current implementation of sync, it still gets the mutex for avoiding concurrent racing at the beginning.

According to #258 , will it be refactored to support concurrent accessing in later work ? i.e. replace mutex with Rwlock ? or add an extra F::Handle in SinglePipe, making it be called concurrently ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

@tabokie tabokie requested a review from Connor1996 September 5, 2022 03:45
Signed-off-by: tabokie <[email protected]>
Signed-off-by: tabokie <[email protected]>
@tabokie
Copy link
Member Author

tabokie commented Sep 6, 2022

Ping @Connor1996 , this one is blocking #261

Copy link
Member

@Connor1996 Connor1996 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants