Skip to content

Commit

Permalink
Fix WRITE_STALL start_time (#12147)
Browse files Browse the repository at this point in the history
Summary:
`Delayed` is set true in two cases. One is when `delay` is specified. Other one is in the `while` loop - https://github.com/facebook/rocksdb/blob/cd21e4e69d76ec4ec3b080c8cdae016ac2309cc5/db/db_impl/db_impl_write.cc#L1876
However start_time is not initialized in second case, resulting in time_delayed = immutable_db_options_.clock->NowMicros() - 0(start_time);

Pull Request resolved: #12147

Test Plan: Existing CircleCI

Reviewed By: cbi42

Differential Revision: D52173481

Pulled By: akankshamahajan15

fbshipit-source-id: fb9183b24c191d287a1d715346467bee66190f98
  • Loading branch information
akankshamahajan15 authored and facebook-github-bot committed Dec 14, 2023
1 parent 5502f06 commit cd577f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion db/db_impl/db_impl_write.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1839,11 +1839,12 @@ Status DBImpl::DelayWrite(uint64_t num_bytes, WriteThread& write_thread,
delay = 0;
}
TEST_SYNC_POINT("DBImpl::DelayWrite:Start");
start_time = immutable_db_options_.clock->NowMicros();

if (delay > 0) {
if (write_options.no_slowdown) {
return Status::Incomplete("Write stall");
}
start_time = immutable_db_options_.clock->NowMicros();
TEST_SYNC_POINT("DBImpl::DelayWrite:Sleep");

// Notify write_thread about the stall so it can setup a barrier and
Expand Down
1 change: 1 addition & 0 deletions unreleased_history/bug_fixes/fix_stall_counter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a WRITE_STALL counter that was reporting wrong value in few cases.

0 comments on commit cd577f6

Please sign in to comment.