-
Notifications
You must be signed in to change notification settings - Fork 90
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
Support recycling log files #224
Conversation
As the title shows, this commit do the following things: >* Implement `[Recycle Log Files]` structure for recycling expired log files. >* Supplement necessary UTs on `[Recycle Log Files]`. Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
Here, we modify the testing cases in `bench_falloc` to simulate several different calling of `fallocate`, to generate the comparision result of performance among these callings. Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
…alloc.rs` As the title shows, the bug of condition judgement is fixed. Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
This commit mainly focused on: 1. Supplement extra necessary UTs for `RecycleFileCollection` in `pipe.rs`; 2. Tidy the codes on `RecycleFileCollection`; 3. Correct the misleading guides in `README.md`; Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
/cc @tabokie , thanks for reviewing it. |
Codecov Report
@@ Coverage Diff @@
## master #224 +/- ##
==========================================
+ Coverage 96.71% 97.06% +0.35%
==========================================
Files 30 30
Lines 9577 10447 +870
==========================================
+ Hits 9262 10140 +878
+ Misses 315 307 -8
Continue to review full report at Codecov.
|
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
…leCollection` This commit contains: >* Simplify the configuration on the capcaity of `RecycleFileCollection`, which would be automatically updated by the formula -- `purge_threshold` / `targe_file_size` - `active file count`. >* Tidy the codes and annotations in `pipe.rs`. Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
…leCollection` This commit contains: >* Simplify the configuration on the capcaity of `RecycleFileCollection`, which would be automatically updated by the formula -- `purge_threshold` / `targe_file_size` - `active file count`. >* Tidy the codes and annotations in `pipe.rs`. Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
…into recycle_logs
As the title shown, this commit is mainly responsible for simplifying the implementation of `FileCollection`, capable for recycling obsolete or stale log files for the future reusing. Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
…..&LogFileContext)` Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
/cc @tabokie , please take comments on it for reviewing. Thanks. |
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
1. Preparations for recyclingFor making comparisons on diff --git a/stress/src/main.rs b/stress/src/main.rs
index 78f3f76..4712ab2 100644
--- a/stress/src/main.rs
+++ b/stress/src/main.rs
@@ -604,6 +604,20 @@ fn main() {
let wb = Arc::new(WrittenBytesHook::new());
let engine = Arc::new(Engine::open_with_listeners(config, vec![wb.clone()]).unwrap());
+ if opts.reuse_data {
+ println!("======= Before `bench`, try to purge files for recycling stale files as many as possible. =======");
+ match engine.purge_expired_files() {
+ Ok(regions) => {
+ for region in regions.into_iter() {
+ let first = engine.first_index(region).unwrap_or(0);
+ let last = engine.last_index(region).unwrap_or(0);
+ let compact_to =
+ last - ((last - first + 1) as f64 * args.force_compact_factor) as u64 + 1;
+ engine.compact_to(region, compact_to);
+ }
+ }
+ Err(e) => println!("purge error {:?}", e),
+ }
+ println!("======= Before `bench`, all expired files are purged. =======");
+ } Here, as u can see, 2. Conclusions based on benchmark resultsWith the comparison,
3. ReferenceThere are several assistant materials for proving that this feature makes sense. 3.1 Code paths that this feature makes senseHow can we prove this feature truely make sense with the above modification on ======= Before `bench`, try to purge files for recycling stale files as many as possible. =======
Rewrite LogQueue::Append for purging expired files.
compact queue: LogQueue::Append with rewrite_watermark: 253, compact_watermark: 206.
[PurgeTo]Do purge_to on queue: 0, expect_seq: 281, min_seq: 267.
[After purging]First purged file_seq: 187, truely deleted file count: 0, recycled file count: 80, remained file count on disk: 95
======= Before `bench`, all expired files are purged. ======= 3.2 Benchmarks3.2.1 Env and settingsBrief introduction of the testing
And with default settings in 3.2.2 ResultsThe benchmark result could be reviewed with the following result:
And visualized comparison results can be reviewed with the following charts:
Here, more detailed benchmark results on
|
In this commit, there changes have been introduced: >* Remove unnecessary annotations. >* Remove inappropriate method `rename` of trait `FileSystem`. >* Simplify the design of FileCollection with capability of recycling log files. Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
/cc @tabokie please take a final review, thanks |
As the title shows, this commit make the strategy of computing `purge` more readable. And, it also includes: * Supplement extra necessary annotations. * Refine the implementation of `get_signature` to make its strategy clear and reable. * Remove unncessary annotations. Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ut on fetch_active_file
has been supplemented in this commit.
/cc @tabokie thanks.
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
…into recycle_logs
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
…y stale V1 files. Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
…to`. Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have found a few bugs along the way, it really worries my whether you have added sufficient tests for them. (E.g. the bug in purge_to
is still not covered). Moving forward, if there's a review comment that points out a specific issue that isn't covered, please first add a test to reproduce it, then fix the issue.
…w funcs. Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
Thanks for your suggestions. Bugs in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there.
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
Signed-off-by: Lucasliang <nkcs_lykx@hotmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
As the title shows, this commit makes the relevant implementation for supporting
[Recycle Log Files]
, for closing #214. This commit mainly contains: