Remove unused API base_background_compactions (#9462)

Summary:
The API is deprecated long time ago. Clean up the codebase by
removing it.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/9462

Test Plan: CI, fake release: D33835220

Reviewed By: riversand963

Differential Revision: D33835103

Pulled By: jay-zhuang

fbshipit-source-id: 6d2dc12c8e7fdbe2700865a3e61f0e3f78bd8184
This commit is contained in:
Jay Zhuang 2022-01-27 21:03:38 -08:00 committed by Facebook GitHub Bot
parent dd203ed604
commit 22321e1027
17 changed files with 5 additions and 184 deletions

View File

@ -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.

View File

@ -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;
}

View File

@ -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);
@ -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));
@ -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));
@ -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));

View File

@ -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(

View File

@ -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`

View File

@ -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
@ -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

View File

@ -403,20 +403,6 @@ public class DBOptions extends RocksObject
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(
@ -1342,9 +1328,6 @@ public class DBOptions extends RocksObject
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);

View File

@ -64,7 +64,6 @@ public class MutableDBOptions extends AbstractMutableOptions {
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),
@ -133,19 +132,6 @@ public class MutableDBOptions extends AbstractMutableOptions {
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(

View File

@ -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

View File

@ -485,20 +485,6 @@ public class Options extends RocksObject
}
}
@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(
@ -2158,9 +2144,6 @@ public class Options extends RocksObject
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);

View File

@ -34,8 +34,6 @@ public class DBOptionsTest {
DBOptions copyOpts = new DBOptions(origOpts);
assertThat(origOpts.createIfMissing()).isEqualTo(copyOpts.createIfMissing());
assertThat(origOpts.allow2pc()).isEqualTo(copyOpts.allow2pc());
assertThat(origOpts.baseBackgroundCompactions()).isEqualTo(
copyOpts.baseBackgroundCompactions());
}
@Test
@ -218,17 +216,6 @@ public class DBOptionsTest {
}
}
@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() {

View File

@ -430,17 +430,6 @@ public class OptionsTest {
}
}
@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() {

View File

@ -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,
@ -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,
@ -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),
@ -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),

View File

@ -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;

View File

@ -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;

View File

@ -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;"

View File

@ -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.");