Skip to content

Commit

Permalink
Fix blob db crash during calculating write amp
Browse files Browse the repository at this point in the history
Summary:
On initial call to BlobDBImpl::WaStats() `all_periods_write_` would be empty, so it will crash when we call pop_front() at line 1627. Apparently it is mean to pop only when `all_periods_write_.size() > kWriteAmplificationStatsPeriods`.

The whole write amp calculation doesn't seems to be correct and it is not being exposed. Will work on it later.

Test Plan
Change kWriteAmplificationStatsPeriodMillisecs to 1000 (1 second) and run db_bench --use_blob_db for 5 minutes.
Closes facebook#2751

Differential Revision: D5648269

Pulled By: yiwu-arbug

fbshipit-source-id: b843d9a09bb5f9e1b713d101ec7b87e54b5115a4
  • Loading branch information
yiwu-arbug authored and facebook-github-bot committed Aug 17, 2017
1 parent 8f2598a commit 29877ec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion utilities/blob_db/blob_db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1615,12 +1615,13 @@ std::pair<bool, int64_t> BlobDBImpl::ReclaimOpenFiles(bool aborted) {
return std::make_pair(true, -1);
}

// TODO(yiwu): correct the stats and expose it.
std::pair<bool, int64_t> BlobDBImpl::WaStats(bool aborted) {
if (aborted) return std::make_pair(false, -1);

WriteLock wl(&mutex_);

if (all_periods_write_.size() < kWriteAmplificationStatsPeriods) {
if (all_periods_write_.size() >= kWriteAmplificationStatsPeriods) {
total_periods_write_ -= (*all_periods_write_.begin());
total_periods_ampl_ = (*all_periods_ampl_.begin());

Expand Down

0 comments on commit 29877ec

Please sign in to comment.