Skip to content
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

Revert "offload periodic work (#328)" #329

Merged
merged 1 commit into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions db/db_impl/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -773,17 +773,16 @@ void DBImpl::PrintStatistics() {
void DBImpl::StartPeriodicWorkScheduler() {
#ifndef ROCKSDB_LITE

bool disable_scheduler =
immutable_db_options_.disable_periodic_work_scheduler;
#ifndef NDEBUG
// It only used by test to disable scheduler
bool disable_scheduler = false;
TEST_SYNC_POINT_CALLBACK(
"DBImpl::StartPeriodicWorkScheduler:DisableScheduler",
&disable_scheduler);
#endif // !NDEBUG
if (disable_scheduler) {
return;
}
#endif // !NDEBUG

{
InstrumentedMutexLock l(&mutex_);
Expand Down
15 changes: 0 additions & 15 deletions db/db_impl/db_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1131,21 +1131,6 @@ class DBImpl : public DB {
// flush LOG out of application buffer
void FlushInfoLog();

Status DoPeriodicWork(PeriodicWorkType type) override {
switch (type) {
case PeriodicWorkType::kFlushInfoLog:
FlushInfoLog();
break;
case PeriodicWorkType::kDumpStats:
DumpStats();
break;
case PeriodicWorkType::kPersistStats:
PersistStats();
break;
}
return Status::OK();
}

// Interface to block and signal the DB in case of stalling writes by
// WriteBufferManager. Each DBImpl object contains ptr to WBMStallInterface.
// When DB needs to be blocked or signalled by WriteBufferManager,
Expand Down
9 changes: 0 additions & 9 deletions include/rocksdb/db.h
Original file line number Diff line number Diff line change
Expand Up @@ -1823,15 +1823,6 @@ class DB {
return Status::NotSupported("GetStatsHistory() is not implemented.");
}

enum PeriodicWorkType {
kFlushInfoLog = 0,
kDumpStats = 1,
kPersistStats = 2,
};
virtual Status DoPeriodicWork(PeriodicWorkType /*type*/) {
return Status::NotSupported("DoPeriodicWork() is not implemented.");
}

#ifndef ROCKSDB_LITE
// Make the secondary instance catch up with the primary by tailing and
// replaying the MANIFEST and WAL of the primary.
Expand Down
4 changes: 0 additions & 4 deletions include/rocksdb/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -829,10 +829,6 @@ struct DBOptions {
// NOT SUPPORTED ANYMORE -- this options is no longer used
bool skip_log_error_on_recovery = false;

// Disable periodic work scheduler. User should manually run periodic work
// with `DB::DoPeriodicWork()`. Default: false
bool disable_periodic_work_scheduler = false;

// if not zero, dump rocksdb.stats to LOG every stats_dump_period_sec
//
// Default: 600 (10 min)
Expand Down
11 changes: 1 addition & 10 deletions options/db_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,6 @@ static std::unordered_map<std::string, OptionTypeInfo>
OptionTypeInfo::Enum<CacheTier>(
offsetof(struct ImmutableDBOptions, lowest_used_cache_tier),
&cache_tier_string_map, OptionTypeFlags::kNone)},
{"disable_periodic_work_scheduler",
{offsetof(struct ImmutableDBOptions, disable_periodic_work_scheduler),
OptionType::kBoolean, OptionVerificationType::kNormal,
OptionTypeFlags::kNone}},
};

const std::string OptionsHelper::kDBOptionsName = "DBOptions";
Expand Down Expand Up @@ -745,8 +741,7 @@ ImmutableDBOptions::ImmutableDBOptions(const DBOptions& options)
db_host_id(options.db_host_id),
checksum_handoff_file_types(options.checksum_handoff_file_types),
lowest_used_cache_tier(options.lowest_used_cache_tier),
compaction_service(options.compaction_service),
disable_periodic_work_scheduler(options.disable_periodic_work_scheduler) {
compaction_service(options.compaction_service) {
stats = statistics.get();
fs = env->GetFileSystem();
if (env != nullptr) {
Expand Down Expand Up @@ -924,10 +919,6 @@ void ImmutableDBOptions::Dump(Logger* log) const {
allow_data_in_errors);
ROCKS_LOG_HEADER(log, " Options.db_host_id: %s",
db_host_id.c_str());
ROCKS_LOG_HEADER(log,
" "
"Options.disable_periodic_work_scheduler: %d",
disable_periodic_work_scheduler);
}

bool ImmutableDBOptions::IsWalDirSameAsDBPath() const {
Expand Down
1 change: 0 additions & 1 deletion options/db_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ struct ImmutableDBOptions {
Statistics* stats;
Logger* logger;
std::shared_ptr<CompactionService> compaction_service;
bool disable_periodic_work_scheduler;

bool IsWalDirSameAsDBPath() const;
bool IsWalDirSameAsDBPath(const std::string& path) const;
Expand Down
2 changes: 0 additions & 2 deletions options/options_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ DBOptions BuildDBOptions(const ImmutableDBOptions& immutable_db_options,
options.checksum_handoff_file_types =
immutable_db_options.checksum_handoff_file_types;
options.lowest_used_cache_tier = immutable_db_options.lowest_used_cache_tier;
options.disable_periodic_work_scheduler =
immutable_db_options.disable_periodic_work_scheduler;
return options;
}

Expand Down
3 changes: 1 addition & 2 deletions options/options_settable_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,7 @@ TEST_F(OptionsSettableTest, DBOptionsAllFieldsSettable) {
"bgerror_resume_retry_interval=1000000"
"db_host_id=hostname;"
"lowest_used_cache_tier=kNonVolatileBlockTier;"
"allow_data_in_errors=false;"
"disable_periodic_work_scheduler=false",
"allow_data_in_errors=false",
new_options));

ASSERT_EQ(unset_bytes_base, NumUnsetBytes(new_options_ptr, sizeof(DBOptions),
Expand Down