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
main
Jay Zhuang 3 years ago committed by Facebook GitHub Bot
parent dd203ed604
commit 22321e1027
  1. 2
      HISTORY.md
  2. 9
      db/c.cc
  3. 9
      db/c_test.c
  4. 4
      include/rocksdb/c.h
  5. 6
      include/rocksdb/options.h
  6. 44
      java/rocksjni/options.cc
  7. 17
      java/src/main/java/org/rocksdb/DBOptions.java
  8. 14
      java/src/main/java/org/rocksdb/MutableDBOptions.java
  9. 28
      java/src/main/java/org/rocksdb/MutableDBOptionsInterface.java
  10. 17
      java/src/main/java/org/rocksdb/Options.java
  11. 13
      java/src/test/java/org/rocksdb/DBOptionsTest.java
  12. 11
      java/src/test/java/org/rocksdb/OptionsTest.java
  13. 9
      options/db_options.cc
  14. 1
      options/db_options.h
  15. 2
      options/options_helper.cc
  16. 1
      options/options_settable_test.cc
  17. 2
      tools/db_bench_tool.cc

@ -13,6 +13,8 @@
* Remove deprecated option DBOption::table_cache_remove_scan_count_limit. * Remove deprecated option DBOption::table_cache_remove_scan_count_limit.
* Remove deprecated API AdvancedColumnFamilyOptions::soft_rate_limit. * Remove deprecated API AdvancedColumnFamilyOptions::soft_rate_limit.
* Remove deprecated API AdvancedColumnFamilyOptions::hard_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 ### 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. * 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.

@ -3225,15 +3225,6 @@ int rocksdb_options_get_max_background_compactions(rocksdb_options_t* opt) {
return opt->rep.max_background_compactions; 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) { void rocksdb_options_set_max_background_flushes(rocksdb_options_t* opt, int n) {
opt->rep.max_background_flushes = n; opt->rep.max_background_flushes = n;
} }

@ -490,7 +490,6 @@ int main(int argc, char** argv) {
rocksdb_options_set_write_buffer_size(options, 100000); rocksdb_options_set_write_buffer_size(options, 100000);
rocksdb_options_set_paranoid_checks(options, 1); rocksdb_options_set_paranoid_checks(options, 1);
rocksdb_options_set_max_open_files(options, 10); rocksdb_options_set_max_open_files(options, 10);
rocksdb_options_set_base_background_compactions(options, 1);
table_options = rocksdb_block_based_options_create(); table_options = rocksdb_block_based_options_create();
rocksdb_block_based_options_set_block_cache(table_options, cache); 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); rocksdb_options_set_max_background_compactions(o, 3);
CheckCondition(3 == rocksdb_options_get_max_background_compactions(o)); 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); rocksdb_options_set_max_background_flushes(o, 5);
CheckCondition(5 == rocksdb_options_get_max_background_flushes(o)); 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(123456 == rocksdb_options_get_max_subcompactions(copy));
CheckCondition(2 == rocksdb_options_get_max_background_jobs(copy)); CheckCondition(2 == rocksdb_options_get_max_background_jobs(copy));
CheckCondition(3 == rocksdb_options_get_max_background_compactions(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(5 == rocksdb_options_get_max_background_flushes(copy));
CheckCondition(6 == rocksdb_options_get_max_log_file_size(copy)); CheckCondition(6 == rocksdb_options_get_max_log_file_size(copy));
CheckCondition(7 == rocksdb_options_get_log_file_time_to_roll(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(13 == rocksdb_options_get_max_background_compactions(copy));
CheckCondition(3 == rocksdb_options_get_max_background_compactions(o)); 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); rocksdb_options_set_max_background_flushes(copy, 15);
CheckCondition(15 == rocksdb_options_get_max_background_flushes(copy)); CheckCondition(15 == rocksdb_options_get_max_background_flushes(copy));
CheckCondition(5 == rocksdb_options_get_max_background_flushes(o)); CheckCondition(5 == rocksdb_options_get_max_background_flushes(o));

@ -1170,10 +1170,6 @@ extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_background_compactions(
rocksdb_options_t*, int); rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API int rocksdb_options_get_max_background_compactions( extern ROCKSDB_LIBRARY_API int rocksdb_options_get_max_background_compactions(
rocksdb_options_t*); 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( extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_background_flushes(
rocksdb_options_t*, int); rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API int rocksdb_options_get_max_background_flushes( extern ROCKSDB_LIBRARY_API int rocksdb_options_get_max_background_flushes(

@ -657,12 +657,6 @@ struct DBOptions {
// Dynamically changeable through SetDBOptions() API. // Dynamically changeable through SetDBOptions() API.
int max_background_jobs = 2; 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 // DEPRECATED: RocksDB automatically decides this based on the
// value of max_background_jobs. For backwards compatibility we will set // value of max_background_jobs. For backwards compatibility we will set
// `max_background_jobs = max_background_compactions + max_background_flushes` // `max_background_jobs = max_background_compactions + max_background_flushes`

@ -665,28 +665,6 @@ void Java_org_rocksdb_Options_setDeleteObsoleteFilesPeriodMicros(
->delete_obsolete_files_period_micros = static_cast<int64_t>(micros); ->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 * Class: org_rocksdb_Options
* Method: maxBackgroundCompactions * Method: maxBackgroundCompactions
@ -6188,28 +6166,6 @@ jlong Java_org_rocksdb_DBOptions_deleteObsoleteFilesPeriodMicros(
->delete_obsolete_files_period_micros; ->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 * Class: org_rocksdb_DBOptions
* Method: setMaxBackgroundCompactions * Method: setMaxBackgroundCompactions

@ -403,20 +403,6 @@ public class DBOptions extends RocksObject
return maxBackgroundJobs(nativeHandle_); 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 @Override
@Deprecated @Deprecated
public DBOptions setMaxBackgroundCompactions( public DBOptions setMaxBackgroundCompactions(
@ -1342,9 +1328,6 @@ public class DBOptions extends RocksObject
private native void setDeleteObsoleteFilesPeriodMicros( private native void setDeleteObsoleteFilesPeriodMicros(
long handle, long micros); long handle, long micros);
private native long deleteObsoleteFilesPeriodMicros(long handle); private native long deleteObsoleteFilesPeriodMicros(long handle);
private native void setBaseBackgroundCompactions(long handle,
int baseBackgroundCompactions);
private native int baseBackgroundCompactions(long handle);
private native void setMaxBackgroundCompactions( private native void setMaxBackgroundCompactions(
long handle, int maxBackgroundCompactions); long handle, int maxBackgroundCompactions);
private native int maxBackgroundCompactions(long handle); private native int maxBackgroundCompactions(long handle);

@ -64,7 +64,6 @@ public class MutableDBOptions extends AbstractMutableOptions {
public enum DBOption implements MutableDBOptionKey { public enum DBOption implements MutableDBOptionKey {
max_background_jobs(ValueType.INT), max_background_jobs(ValueType.INT),
base_background_compactions(ValueType.INT),
max_background_compactions(ValueType.INT), max_background_compactions(ValueType.INT),
avoid_flush_during_shutdown(ValueType.BOOLEAN), avoid_flush_during_shutdown(ValueType.BOOLEAN),
writable_file_max_buffer_size(ValueType.LONG), writable_file_max_buffer_size(ValueType.LONG),
@ -133,19 +132,6 @@ public class MutableDBOptions extends AbstractMutableOptions {
return getInt(DBOption.max_background_jobs); 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 @Override
@Deprecated @Deprecated
public MutableDBOptionsBuilder setMaxBackgroundCompactions( public MutableDBOptionsBuilder setMaxBackgroundCompactions(

@ -21,34 +21,6 @@ public interface MutableDBOptionsInterface<T extends MutableDBOptionsInterface<T
*/ */
int maxBackgroundJobs(); 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 * NOT SUPPORTED ANYMORE: RocksDB automatically decides this based on the
* value of max_background_jobs. For backwards compatibility we will set * value of max_background_jobs. For backwards compatibility we will set

@ -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 @Override
@Deprecated @Deprecated
public Options setMaxBackgroundCompactions( public Options setMaxBackgroundCompactions(
@ -2158,9 +2144,6 @@ public class Options extends RocksObject
private native void setDeleteObsoleteFilesPeriodMicros( private native void setDeleteObsoleteFilesPeriodMicros(
long handle, long micros); long handle, long micros);
private native long deleteObsoleteFilesPeriodMicros(long handle); private native long deleteObsoleteFilesPeriodMicros(long handle);
private native void setBaseBackgroundCompactions(long handle,
int baseBackgroundCompactions);
private native int baseBackgroundCompactions(long handle);
private native void setMaxBackgroundCompactions( private native void setMaxBackgroundCompactions(
long handle, int maxBackgroundCompactions); long handle, int maxBackgroundCompactions);
private native int maxBackgroundCompactions(long handle); private native int maxBackgroundCompactions(long handle);

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

@ -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") @SuppressWarnings("deprecated")
@Test @Test
public void maxBackgroundCompactions() { public void maxBackgroundCompactions() {

@ -58,6 +58,9 @@ static std::unordered_map<std::string, OptionTypeInfo>
{"allow_os_buffer", {"allow_os_buffer",
{0, OptionType::kBoolean, OptionVerificationType::kDeprecated, {0, OptionType::kBoolean, OptionVerificationType::kDeprecated,
OptionTypeFlags::kMutable}}, OptionTypeFlags::kMutable}},
{"base_background_compactions",
{0, OptionType::kInt, OptionVerificationType::kDeprecated,
OptionTypeFlags::kMutable}},
{"max_background_jobs", {"max_background_jobs",
{offsetof(struct MutableDBOptions, max_background_jobs), {offsetof(struct MutableDBOptions, max_background_jobs),
OptionType::kInt, OptionVerificationType::kNormal, OptionType::kInt, OptionVerificationType::kNormal,
@ -66,10 +69,6 @@ static std::unordered_map<std::string, OptionTypeInfo>
{offsetof(struct MutableDBOptions, max_background_compactions), {offsetof(struct MutableDBOptions, max_background_compactions),
OptionType::kInt, OptionVerificationType::kNormal, OptionType::kInt, OptionVerificationType::kNormal,
OptionTypeFlags::kMutable}}, OptionTypeFlags::kMutable}},
{"base_background_compactions",
{offsetof(struct MutableDBOptions, base_background_compactions),
OptionType::kInt, OptionVerificationType::kNormal,
OptionTypeFlags::kMutable}},
{"max_subcompactions", {"max_subcompactions",
{offsetof(struct MutableDBOptions, max_subcompactions), {offsetof(struct MutableDBOptions, max_subcompactions),
OptionType::kUInt32T, OptionVerificationType::kNormal, OptionType::kUInt32T, OptionVerificationType::kNormal,
@ -962,7 +961,6 @@ const std::string& ImmutableDBOptions::GetWalDir(
MutableDBOptions::MutableDBOptions() MutableDBOptions::MutableDBOptions()
: max_background_jobs(2), : max_background_jobs(2),
base_background_compactions(-1),
max_background_compactions(-1), max_background_compactions(-1),
max_subcompactions(0), max_subcompactions(0),
avoid_flush_during_shutdown(false), avoid_flush_during_shutdown(false),
@ -982,7 +980,6 @@ MutableDBOptions::MutableDBOptions()
MutableDBOptions::MutableDBOptions(const DBOptions& options) MutableDBOptions::MutableDBOptions(const DBOptions& options)
: max_background_jobs(options.max_background_jobs), : max_background_jobs(options.max_background_jobs),
base_background_compactions(options.base_background_compactions),
max_background_compactions(options.max_background_compactions), max_background_compactions(options.max_background_compactions),
max_subcompactions(options.max_subcompactions), max_subcompactions(options.max_subcompactions),
avoid_flush_during_shutdown(options.avoid_flush_during_shutdown), avoid_flush_during_shutdown(options.avoid_flush_during_shutdown),

@ -122,7 +122,6 @@ struct MutableDBOptions {
void Dump(Logger* log) const; void Dump(Logger* log) const;
int max_background_jobs; int max_background_jobs;
int base_background_compactions;
int max_background_compactions; int max_background_compactions;
uint32_t max_subcompactions; uint32_t max_subcompactions;
bool avoid_flush_during_shutdown; bool avoid_flush_during_shutdown;

@ -87,8 +87,6 @@ DBOptions BuildDBOptions(const ImmutableDBOptions& immutable_db_options,
options.delete_obsolete_files_period_micros = options.delete_obsolete_files_period_micros =
mutable_db_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.max_background_jobs = mutable_db_options.max_background_jobs;
options.base_background_compactions =
mutable_db_options.base_background_compactions;
options.max_background_compactions = options.max_background_compactions =
mutable_db_options.max_background_compactions; mutable_db_options.max_background_compactions;
options.bytes_per_sync = mutable_db_options.bytes_per_sync; options.bytes_per_sync = mutable_db_options.bytes_per_sync;

@ -274,7 +274,6 @@ TEST_F(OptionsSettableTest, DBOptionsAllFieldsSettable) {
"max_open_files=72;" "max_open_files=72;"
"max_file_opening_threads=35;" "max_file_opening_threads=35;"
"max_background_jobs=8;" "max_background_jobs=8;"
"base_background_compactions=3;"
"max_background_compactions=33;" "max_background_compactions=33;"
"use_fsync=true;" "use_fsync=true;"
"use_adaptive_mutex=false;" "use_adaptive_mutex=false;"

@ -493,8 +493,6 @@ DEFINE_int32(max_background_compactions,
"The maximum number of concurrent background compactions" "The maximum number of concurrent background compactions"
" that can occur in parallel."); " that can occur in parallel.");
DEFINE_int32(base_background_compactions, -1, "DEPRECATED");
DEFINE_uint64(subcompactions, 1, DEFINE_uint64(subcompactions, 1,
"Maximum number of subcompactions to divide L0-L1 compactions " "Maximum number of subcompactions to divide L0-L1 compactions "
"into."); "into.");

Loading…
Cancel
Save