Skip to content

Commit

Permalink
Remove unused API base_background_compactions (#9462)
Browse files Browse the repository at this point in the history
Summary:
The API is deprecated long time ago. Clean up the codebase by
removing it.

Pull Request resolved: facebook/rocksdb#9462

Test Plan: CI, fake release: D33835220

Reviewed By: riversand963

Differential Revision: D33835103

Pulled By: jay-zhuang

fbshipit-source-id: 6d2dc12c8e7fdbe2700865a3e61f0e3f78bd8184
  • Loading branch information
jay-zhuang authored and facebook-github-bot committed Jan 28, 2022
1 parent dd203ed commit 22321e1
Show file tree
Hide file tree
Showing 17 changed files with 5 additions and 184 deletions.
2 changes: 2 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* Remove deprecated option DBOption::table_cache_remove_scan_count_limit.
* Remove deprecated API AdvancedColumnFamilyOptions::soft_rate_limit.
* Remove deprecated API AdvancedColumnFamilyOptions::hard_rate_limit.
* Remove deprecated API DBOption::base_background_compactions.
* Remove deprecated API DBOptions::purge_redundant_kvs_while_flush.

### Behavior Changes
* Disallow the combination of DBOptions.use_direct_io_for_flush_and_compaction == true and DBOptions.writable_file_max_buffer_size == 0. This combination can cause WritableFileWriter::Append() to loop forever, and it does not make much sense in direct IO.
Expand Down
9 changes: 0 additions & 9 deletions db/c.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3225,15 +3225,6 @@ int rocksdb_options_get_max_background_compactions(rocksdb_options_t* opt) {
return opt->rep.max_background_compactions;
}

void rocksdb_options_set_base_background_compactions(rocksdb_options_t* opt,
int n) {
opt->rep.base_background_compactions = n;
}

int rocksdb_options_get_base_background_compactions(rocksdb_options_t* opt) {
return opt->rep.base_background_compactions;
}

void rocksdb_options_set_max_background_flushes(rocksdb_options_t* opt, int n) {
opt->rep.max_background_flushes = n;
}
Expand Down
9 changes: 0 additions & 9 deletions db/c_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ int main(int argc, char** argv) {
rocksdb_options_set_write_buffer_size(options, 100000);
rocksdb_options_set_paranoid_checks(options, 1);
rocksdb_options_set_max_open_files(options, 10);
rocksdb_options_set_base_background_compactions(options, 1);

table_options = rocksdb_block_based_options_create();
rocksdb_block_based_options_set_block_cache(table_options, cache);
Expand Down Expand Up @@ -1613,9 +1612,6 @@ int main(int argc, char** argv) {
rocksdb_options_set_max_background_compactions(o, 3);
CheckCondition(3 == rocksdb_options_get_max_background_compactions(o));

rocksdb_options_set_base_background_compactions(o, 4);
CheckCondition(4 == rocksdb_options_get_base_background_compactions(o));

rocksdb_options_set_max_background_flushes(o, 5);
CheckCondition(5 == rocksdb_options_get_max_background_flushes(o));

Expand Down Expand Up @@ -1845,7 +1841,6 @@ int main(int argc, char** argv) {
CheckCondition(123456 == rocksdb_options_get_max_subcompactions(copy));
CheckCondition(2 == rocksdb_options_get_max_background_jobs(copy));
CheckCondition(3 == rocksdb_options_get_max_background_compactions(copy));
CheckCondition(4 == rocksdb_options_get_base_background_compactions(copy));
CheckCondition(5 == rocksdb_options_get_max_background_flushes(copy));
CheckCondition(6 == rocksdb_options_get_max_log_file_size(copy));
CheckCondition(7 == rocksdb_options_get_log_file_time_to_roll(copy));
Expand Down Expand Up @@ -2051,10 +2046,6 @@ int main(int argc, char** argv) {
CheckCondition(13 == rocksdb_options_get_max_background_compactions(copy));
CheckCondition(3 == rocksdb_options_get_max_background_compactions(o));

rocksdb_options_set_base_background_compactions(copy, 14);
CheckCondition(14 == rocksdb_options_get_base_background_compactions(copy));
CheckCondition(4 == rocksdb_options_get_base_background_compactions(o));

rocksdb_options_set_max_background_flushes(copy, 15);
CheckCondition(15 == rocksdb_options_get_max_background_flushes(copy));
CheckCondition(5 == rocksdb_options_get_max_background_flushes(o));
Expand Down
4 changes: 0 additions & 4 deletions include/rocksdb/c.h
Original file line number Diff line number Diff line change
Expand Up @@ -1170,10 +1170,6 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_background_compactions(
rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API int rocksdb_options_get_max_background_compactions(
rocksdb_options_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_base_background_compactions(
rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API int rocksdb_options_get_base_background_compactions(
rocksdb_options_t*);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_background_flushes(
rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API int rocksdb_options_get_max_background_flushes(
Expand Down
6 changes: 0 additions & 6 deletions include/rocksdb/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -657,12 +657,6 @@ struct DBOptions {
// Dynamically changeable through SetDBOptions() API.
int max_background_jobs = 2;

// NOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the
// value of max_background_jobs. This option is ignored.
//
// Dynamically changeable through SetDBOptions() API.
int base_background_compactions = -1;

// DEPRECATED: RocksDB automatically decides this based on the
// value of max_background_jobs. For backwards compatibility we will set
// `max_background_jobs = max_background_compactions + max_background_flushes`
Expand Down
44 changes: 0 additions & 44 deletions java/rocksjni/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -665,28 +665,6 @@ void Java_org_rocksdb_Options_setDeleteObsoleteFilesPeriodMicros(
->delete_obsolete_files_period_micros = static_cast<int64_t>(micros);
}

/*
* Class: org_rocksdb_Options
* Method: setBaseBackgroundCompactions
* Signature: (JI)V
*/
void Java_org_rocksdb_Options_setBaseBackgroundCompactions(
JNIEnv*, jobject, jlong jhandle, jint max) {
reinterpret_cast<ROCKSDB_NAMESPACE::Options*>(jhandle)
->base_background_compactions = static_cast<int>(max);
}

/*
* Class: org_rocksdb_Options
* Method: baseBackgroundCompactions
* Signature: (J)I
*/
jint Java_org_rocksdb_Options_baseBackgroundCompactions(
JNIEnv*, jobject, jlong jhandle) {
return reinterpret_cast<ROCKSDB_NAMESPACE::Options*>(jhandle)
->base_background_compactions;
}

/*
* Class: org_rocksdb_Options
* Method: maxBackgroundCompactions
Expand Down Expand Up @@ -6188,28 +6166,6 @@ jlong Java_org_rocksdb_DBOptions_deleteObsoleteFilesPeriodMicros(
->delete_obsolete_files_period_micros;
}

/*
* Class: org_rocksdb_DBOptions
* Method: setBaseBackgroundCompactions
* Signature: (JI)V
*/
void Java_org_rocksdb_DBOptions_setBaseBackgroundCompactions(
JNIEnv*, jobject, jlong jhandle, jint max) {
reinterpret_cast<ROCKSDB_NAMESPACE::DBOptions*>(jhandle)
->base_background_compactions = static_cast<int>(max);
}

/*
* Class: org_rocksdb_DBOptions
* Method: baseBackgroundCompactions
* Signature: (J)I
*/
jint Java_org_rocksdb_DBOptions_baseBackgroundCompactions(
JNIEnv*, jobject, jlong jhandle) {
return reinterpret_cast<ROCKSDB_NAMESPACE::DBOptions*>(jhandle)
->base_background_compactions;
}

/*
* Class: org_rocksdb_DBOptions
* Method: setMaxBackgroundCompactions
Expand Down
17 changes: 0 additions & 17 deletions java/src/main/java/org/rocksdb/DBOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -403,20 +403,6 @@ public int maxBackgroundJobs() {
return maxBackgroundJobs(nativeHandle_);
}

@Override
@Deprecated
public void setBaseBackgroundCompactions(
final int baseBackgroundCompactions) {
assert(isOwningHandle());
setBaseBackgroundCompactions(nativeHandle_, baseBackgroundCompactions);
}

@Override
public int baseBackgroundCompactions() {
assert(isOwningHandle());
return baseBackgroundCompactions(nativeHandle_);
}

@Override
@Deprecated
public DBOptions setMaxBackgroundCompactions(
Expand Down Expand Up @@ -1342,9 +1328,6 @@ private native void dbPaths(final long handle, final String[] paths,
private native void setDeleteObsoleteFilesPeriodMicros(
long handle, long micros);
private native long deleteObsoleteFilesPeriodMicros(long handle);
private native void setBaseBackgroundCompactions(long handle,
int baseBackgroundCompactions);
private native int baseBackgroundCompactions(long handle);
private native void setMaxBackgroundCompactions(
long handle, int maxBackgroundCompactions);
private native int maxBackgroundCompactions(long handle);
Expand Down
14 changes: 0 additions & 14 deletions java/src/main/java/org/rocksdb/MutableDBOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ private interface MutableDBOptionKey extends MutableOptionKey {}

public enum DBOption implements MutableDBOptionKey {
max_background_jobs(ValueType.INT),
base_background_compactions(ValueType.INT),
max_background_compactions(ValueType.INT),
avoid_flush_during_shutdown(ValueType.BOOLEAN),
writable_file_max_buffer_size(ValueType.LONG),
Expand Down Expand Up @@ -133,19 +132,6 @@ public int maxBackgroundJobs() {
return getInt(DBOption.max_background_jobs);
}

@Override
@Deprecated
public void setBaseBackgroundCompactions(
final int baseBackgroundCompactions) {
setInt(DBOption.base_background_compactions,
baseBackgroundCompactions);
}

@Override
public int baseBackgroundCompactions() {
return getInt(DBOption.base_background_compactions);
}

@Override
@Deprecated
public MutableDBOptionsBuilder setMaxBackgroundCompactions(
Expand Down
28 changes: 0 additions & 28 deletions java/src/main/java/org/rocksdb/MutableDBOptionsInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,6 @@ public interface MutableDBOptionsInterface<T extends MutableDBOptionsInterface<T
*/
int maxBackgroundJobs();

/**
* NOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the
* value of max_background_jobs. This option is ignored.
*
* Suggested number of concurrent background compaction jobs, submitted to
* the default LOW priority thread pool.
* Default: -1
*
* @param baseBackgroundCompactions Suggested number of background compaction
* jobs
*
* @deprecated Use {@link #setMaxBackgroundJobs(int)}
*/
@Deprecated
void setBaseBackgroundCompactions(int baseBackgroundCompactions);

/**
* NOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the
* value of max_background_jobs. This option is ignored.
*
* Suggested number of concurrent background compaction jobs, submitted to
* the default LOW priority thread pool.
* Default: -1
*
* @return Suggested number of background compaction jobs
*/
int baseBackgroundCompactions();

/**
* NOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the
* value of max_background_jobs. For backwards compatibility we will set
Expand Down
17 changes: 0 additions & 17 deletions java/src/main/java/org/rocksdb/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -485,20 +485,6 @@ public Statistics statistics() {
}
}

@Override
@Deprecated
public void setBaseBackgroundCompactions(
final int baseBackgroundCompactions) {
assert(isOwningHandle());
setBaseBackgroundCompactions(nativeHandle_, baseBackgroundCompactions);
}

@Override
public int baseBackgroundCompactions() {
assert(isOwningHandle());
return baseBackgroundCompactions(nativeHandle_);
}

@Override
@Deprecated
public Options setMaxBackgroundCompactions(
Expand Down Expand Up @@ -2158,9 +2144,6 @@ private native void dbPaths(final long handle, final String[] paths,
private native void setDeleteObsoleteFilesPeriodMicros(
long handle, long micros);
private native long deleteObsoleteFilesPeriodMicros(long handle);
private native void setBaseBackgroundCompactions(long handle,
int baseBackgroundCompactions);
private native int baseBackgroundCompactions(long handle);
private native void setMaxBackgroundCompactions(
long handle, int maxBackgroundCompactions);
private native int maxBackgroundCompactions(long handle);
Expand Down
13 changes: 0 additions & 13 deletions java/src/test/java/org/rocksdb/DBOptionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ public void copyConstructor() {
DBOptions copyOpts = new DBOptions(origOpts);
assertThat(origOpts.createIfMissing()).isEqualTo(copyOpts.createIfMissing());
assertThat(origOpts.allow2pc()).isEqualTo(copyOpts.allow2pc());
assertThat(origOpts.baseBackgroundCompactions()).isEqualTo(
copyOpts.baseBackgroundCompactions());
}

@Test
Expand Down Expand Up @@ -218,17 +216,6 @@ public void deleteObsoleteFilesPeriodMicros() {
}
}

@SuppressWarnings("deprecated")
@Test
public void baseBackgroundCompactions() {
try (final DBOptions opt = new DBOptions()) {
final int intValue = rand.nextInt();
opt.setBaseBackgroundCompactions(intValue);
assertThat(opt.baseBackgroundCompactions()).
isEqualTo(intValue);
}
}

@SuppressWarnings("deprecated")
@Test
public void maxBackgroundCompactions() {
Expand Down
11 changes: 0 additions & 11 deletions java/src/test/java/org/rocksdb/OptionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -430,17 +430,6 @@ public void deleteObsoleteFilesPeriodMicros() {
}
}

@SuppressWarnings("deprecated")
@Test
public void baseBackgroundCompactions() {
try (final Options opt = new Options()) {
final int intValue = rand.nextInt();
opt.setBaseBackgroundCompactions(intValue);
assertThat(opt.baseBackgroundCompactions()).
isEqualTo(intValue);
}
}

@SuppressWarnings("deprecated")
@Test
public void maxBackgroundCompactions() {
Expand Down
9 changes: 3 additions & 6 deletions options/db_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ static std::unordered_map<std::string, OptionTypeInfo>
{"allow_os_buffer",
{0, OptionType::kBoolean, OptionVerificationType::kDeprecated,
OptionTypeFlags::kMutable}},
{"base_background_compactions",
{0, OptionType::kInt, OptionVerificationType::kDeprecated,
OptionTypeFlags::kMutable}},
{"max_background_jobs",
{offsetof(struct MutableDBOptions, max_background_jobs),
OptionType::kInt, OptionVerificationType::kNormal,
Expand All @@ -66,10 +69,6 @@ static std::unordered_map<std::string, OptionTypeInfo>
{offsetof(struct MutableDBOptions, max_background_compactions),
OptionType::kInt, OptionVerificationType::kNormal,
OptionTypeFlags::kMutable}},
{"base_background_compactions",
{offsetof(struct MutableDBOptions, base_background_compactions),
OptionType::kInt, OptionVerificationType::kNormal,
OptionTypeFlags::kMutable}},
{"max_subcompactions",
{offsetof(struct MutableDBOptions, max_subcompactions),
OptionType::kUInt32T, OptionVerificationType::kNormal,
Expand Down Expand Up @@ -962,7 +961,6 @@ const std::string& ImmutableDBOptions::GetWalDir(

MutableDBOptions::MutableDBOptions()
: max_background_jobs(2),
base_background_compactions(-1),
max_background_compactions(-1),
max_subcompactions(0),
avoid_flush_during_shutdown(false),
Expand All @@ -982,7 +980,6 @@ MutableDBOptions::MutableDBOptions()

MutableDBOptions::MutableDBOptions(const DBOptions& options)
: max_background_jobs(options.max_background_jobs),
base_background_compactions(options.base_background_compactions),
max_background_compactions(options.max_background_compactions),
max_subcompactions(options.max_subcompactions),
avoid_flush_during_shutdown(options.avoid_flush_during_shutdown),
Expand Down
1 change: 0 additions & 1 deletion options/db_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ struct MutableDBOptions {
void Dump(Logger* log) const;

int max_background_jobs;
int base_background_compactions;
int max_background_compactions;
uint32_t max_subcompactions;
bool avoid_flush_during_shutdown;
Expand Down
2 changes: 0 additions & 2 deletions options/options_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ DBOptions BuildDBOptions(const ImmutableDBOptions& immutable_db_options,
options.delete_obsolete_files_period_micros =
mutable_db_options.delete_obsolete_files_period_micros;
options.max_background_jobs = mutable_db_options.max_background_jobs;
options.base_background_compactions =
mutable_db_options.base_background_compactions;
options.max_background_compactions =
mutable_db_options.max_background_compactions;
options.bytes_per_sync = mutable_db_options.bytes_per_sync;
Expand Down
1 change: 0 additions & 1 deletion options/options_settable_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ TEST_F(OptionsSettableTest, DBOptionsAllFieldsSettable) {
"max_open_files=72;"
"max_file_opening_threads=35;"
"max_background_jobs=8;"
"base_background_compactions=3;"
"max_background_compactions=33;"
"use_fsync=true;"
"use_adaptive_mutex=false;"
Expand Down
2 changes: 0 additions & 2 deletions tools/db_bench_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,6 @@ DEFINE_int32(max_background_compactions,
"The maximum number of concurrent background compactions"
" that can occur in parallel.");

DEFINE_int32(base_background_compactions, -1, "DEPRECATED");

DEFINE_uint64(subcompactions, 1,
"Maximum number of subcompactions to divide L0-L1 compactions "
"into.");
Expand Down

0 comments on commit 22321e1

Please sign in to comment.