Skip to content

Commit

Permalink
Compaction limiter miscs (#4795)
Browse files Browse the repository at this point in the history
Summary:
1. Remove unused API SubtractCompactionTask().
2. Assert outstanding tasks drop to zero in ConcurrentTaskLimiterImpl destructor.
3. Remove GetOutstandingTask() check from manual compaction test, as TEST_WaitForCompact() doesn't synced with 'delete prepicked_compaction' in DBImpl::BGWorkCompaction(), which may make the test flaky.
Pull Request resolved: #4795

Differential Revision: D13542183

Pulled By: siying

fbshipit-source-id: 5eb2a47e62efe4126937149aa0df6e243ebefc33
  • Loading branch information
burtonli authored and facebook-github-bot committed Dec 26, 2018
1 parent b1288cd commit 46e3209
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
5 changes: 2 additions & 3 deletions db/db_compaction_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4053,7 +4053,7 @@ TEST_F(DBCompactionTest, CompactionLimiter) {
dbfull()->TEST_WaitForFlushMemTable(handles_[cf]);
}

dbfull()->TEST_WaitForCompact();
ASSERT_OK(dbfull()->TEST_WaitForCompact());

// Max outstanding compact tasks reached limit
for (auto& ls : limiter_settings) {
Expand All @@ -4076,8 +4076,7 @@ TEST_F(DBCompactionTest, CompactionLimiter) {
ASSERT_EQ(1, NumTableFilesAtLevel(0, cf_test));

Compact(cf_test, Key(0), Key(keyIndex));
dbfull()->TEST_WaitForCompact();
ASSERT_EQ(0, unique_limiter->GetOutstandingTask());
ASSERT_OK(dbfull()->TEST_WaitForCompact());
}

INSTANTIATE_TEST_CASE_P(DBCompactionTestWithParam, DBCompactionTestWithParam,
Expand Down
3 changes: 0 additions & 3 deletions db/db_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1114,9 +1114,6 @@ class DBImpl : public DB {
// Schedule background tasks
void StartTimedTasks();

void SubtractCompactionTask(const std::string& device_name,
LogBuffer* log_buffer);

void PrintStatistics();

// dump rocksdb.stats to LOG
Expand Down
1 change: 1 addition & 0 deletions util/concurrent_task_limiter_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ConcurrentTaskLimiterImpl::ConcurrentTaskLimiterImpl(
}

ConcurrentTaskLimiterImpl::~ConcurrentTaskLimiterImpl() {
assert(outstanding_tasks_ == 0);
}

const std::string& ConcurrentTaskLimiterImpl::GetName() const {
Expand Down

0 comments on commit 46e3209

Please sign in to comment.