Skip to content

Commit

Permalink
address more comments
Browse files Browse the repository at this point in the history
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
  • Loading branch information
sticnarf committed Jun 24, 2022
1 parent 89c7712 commit d98b568
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@

* Unconditionally tolerate `fallocate` failures as a fix to its portability issue. Errors other than `EOPNOTSUPP` will still emit a warning.

### New Features

* Add `PerfContext` which records detailed time breakdown of the write process to thread-local storage.

### Public API Changes

* Add `is_empty` to `Engine` API.
* Add metadata deletion capability to `FileSystem` trait. Users can implement `exists_metadata` and `delete_metadata` to clean up obsolete metadata from older versions of Raft Engine.
* Add `PerfContext` which records detailed time breakdown of the write process to thread-local storage.

## [0.2.0] - 2022-05-25

Expand Down
3 changes: 2 additions & 1 deletion src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,9 @@ where
let entered_time = writer.entered_time.unwrap();
ENGINE_WRITE_PREPROCESS_DURATION_HISTOGRAM
.observe(entered_time.saturating_duration_since(start).as_secs_f64());
perf_context.write_leader_wait_duration +=
perf_context.write_wait_duration +=
entered_time.saturating_duration_since(before_enter);
debug_assert_eq!(writer.perf_context_diff.write_wait_duration, Duration::ZERO);
perf_context += &writer.perf_context_diff;
set_perf_context(perf_context);
writer.finish()?
Expand Down
6 changes: 3 additions & 3 deletions src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ pub struct PerfContext {
/// Time spent encoding and compressing log entries.
pub log_populating_duration: Duration,

/// Time spent waiting for becoming the write leader.
pub write_leader_wait_duration: Duration,
/// Time spent waiting for the write group to form and get processed.
pub write_wait_duration: Duration,

/// Time spent writing the logs to files.
pub log_write_duration: Duration,
Expand All @@ -65,7 +65,7 @@ pub struct PerfContext {
impl AddAssign<&'_ PerfContext> for PerfContext {
fn add_assign(&mut self, rhs: &PerfContext) {
self.log_populating_duration += rhs.log_populating_duration;
self.write_leader_wait_duration += rhs.write_leader_wait_duration;
self.write_wait_duration += rhs.write_wait_duration;
self.log_write_duration += rhs.log_write_duration;
self.log_rotate_duration += rhs.log_rotate_duration;
self.log_sync_duration += rhs.log_sync_duration;
Expand Down

0 comments on commit d98b568

Please sign in to comment.