Skip to content

Commit

Permalink
Deprecate random access max buffer size references (#13278)
Browse files Browse the repository at this point in the history
Summary:
This option has been officially deprecated in 5.4.0. We're removing all the references to `random_access_max_buffer_size`, related rules and all the clients wrappers. As a part of this refactoring, we're also getting rid of the `options-1-false` (and consequently its' `multiple-conds-all-false` corresponding rule), as condition would not make much sense anymore without the bounding RA max buffer size limit. Motivated by ongoing tech debt reduction effort.

Pull Request resolved: #13278

Test Plan: Validated that internal users do not rely on this long-gone option in their workflows.

Reviewed By: jaykorean

Differential Revision: D67909674

Pulled By: mszeszko-meta

fbshipit-source-id: 8f4b59a4a92b0b32b8b91b71ac318aafc17f1da2
  • Loading branch information
mszeszko-meta authored and facebook-github-bot committed Jan 8, 2025
1 parent b341dc8 commit d4bd67f
Show file tree
Hide file tree
Showing 24 changed files with 2 additions and 255 deletions.
2 changes: 0 additions & 2 deletions env/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1087,8 +1087,6 @@ void AssignEnvOptions(EnvOptions* env_options, const DBOptions& options) {
env_options->set_fd_cloexec = options.is_fd_close_on_exec;
env_options->bytes_per_sync = options.bytes_per_sync;
env_options->compaction_readahead_size = options.compaction_readahead_size;
env_options->random_access_max_buffer_size =
options.random_access_max_buffer_size;
env_options->rate_limiter = options.rate_limiter.get();
env_options->writable_file_max_buffer_size =
options.writable_file_max_buffer_size;
Expand Down
1 change: 0 additions & 1 deletion examples/rocksdb_option_file_example.ini
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
table_cache_numshardbits=4
max_file_opening_threads=1
writable_file_max_buffer_size=1048576
random_access_max_buffer_size=1048576
use_fsync=false
max_total_wal_size=0
max_open_files=-1
Expand Down
3 changes: 0 additions & 3 deletions include/rocksdb/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ struct EnvOptions {
// See DBOptions doc
size_t compaction_readahead_size = 0;

// See DBOptions doc
size_t random_access_max_buffer_size = 0;

// See DBOptions doc
size_t writable_file_max_buffer_size = 1024 * 1024;

Expand Down
17 changes: 0 additions & 17 deletions include/rocksdb/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -1065,23 +1065,6 @@ struct DBOptions {
// Dynamically changeable through SetDBOptions() API.
size_t compaction_readahead_size = 2 * 1024 * 1024;

// This is a maximum buffer size that is used by WinMmapReadableFile in
// unbuffered disk I/O mode. We need to maintain an aligned buffer for
// reads. We allow the buffer to grow until the specified value and then
// for bigger requests allocate one shot buffers. In unbuffered mode we
// always bypass read-ahead buffer at ReadaheadRandomAccessFile
// When read-ahead is required we then make use of compaction_readahead_size
// value and always try to read ahead. With read-ahead we always
// pre-allocate buffer to the size instead of growing it up to a limit.
//
// This option is currently honored only on Windows
//
// Default: 1 Mb
//
// Special value: 0 - means do not maintain per instance buffer. Allocate
// per request buffer and avoid locking.
size_t random_access_max_buffer_size = 1024 * 1024;

// This is the maximum buffer size that is used by WritableFileWriter.
// With direct IO, we need to maintain an aligned buffer for writes.
// We allow the buffer to grow until it's size hits the limit in buffered
Expand Down
20 changes: 0 additions & 20 deletions java/rocksjni/env_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -249,26 +249,6 @@ jlong Java_org_rocksdb_EnvOptions_compactionReadaheadSize(JNIEnv *, jclass,
return ENV_OPTIONS_GET(jhandle, compaction_readahead_size);
}

/*
* Class: org_rocksdb_EnvOptions
* Method: setRandomAccessMaxBufferSize
* Signature: (JJ)V
*/
void Java_org_rocksdb_EnvOptions_setRandomAccessMaxBufferSize(
JNIEnv *, jclass, jlong jhandle, jlong random_access_max_buffer_size) {
ENV_OPTIONS_SET_SIZE_T(jhandle, random_access_max_buffer_size);
}

/*
* Class: org_rocksdb_EnvOptions
* Method: randomAccessMaxBufferSize
* Signature: (J)J
*/
jlong Java_org_rocksdb_EnvOptions_randomAccessMaxBufferSize(JNIEnv *, jclass,
jlong jhandle) {
return ENV_OPTIONS_GET(jhandle, random_access_max_buffer_size);
}

/*
* Class: org_rocksdb_EnvOptions
* Method: setWritableFileMaxBufferSize
Expand Down
46 changes: 0 additions & 46 deletions java/rocksjni/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1577,29 +1577,6 @@ jlong Java_org_rocksdb_Options_compactionReadaheadSize(JNIEnv*, jclass,
return static_cast<jlong>(opt->compaction_readahead_size);
}

/*
* Class: org_rocksdb_Options
* Method: setRandomAccessMaxBufferSize
* Signature: (JJ)V
*/
void Java_org_rocksdb_Options_setRandomAccessMaxBufferSize(
JNIEnv*, jclass, jlong jhandle, jlong jrandom_access_max_buffer_size) {
auto* opt = reinterpret_cast<ROCKSDB_NAMESPACE::Options*>(jhandle);
opt->random_access_max_buffer_size =
static_cast<size_t>(jrandom_access_max_buffer_size);
}

/*
* Class: org_rocksdb_Options
* Method: randomAccessMaxBufferSize
* Signature: (J)J
*/
jlong Java_org_rocksdb_Options_randomAccessMaxBufferSize(JNIEnv*, jclass,
jlong jhandle) {
auto* opt = reinterpret_cast<ROCKSDB_NAMESPACE::Options*>(jhandle);
return static_cast<jlong>(opt->random_access_max_buffer_size);
}

/*
* Class: org_rocksdb_Options
* Method: setWritableFileMaxBufferSize
Expand Down Expand Up @@ -7112,29 +7089,6 @@ jlong Java_org_rocksdb_DBOptions_compactionReadaheadSize(JNIEnv*, jclass,
return static_cast<jlong>(opt->compaction_readahead_size);
}

/*
* Class: org_rocksdb_DBOptions
* Method: setRandomAccessMaxBufferSize
* Signature: (JJ)V
*/
void Java_org_rocksdb_DBOptions_setRandomAccessMaxBufferSize(
JNIEnv*, jclass, jlong jhandle, jlong jrandom_access_max_buffer_size) {
auto* opt = reinterpret_cast<ROCKSDB_NAMESPACE::DBOptions*>(jhandle);
opt->random_access_max_buffer_size =
static_cast<size_t>(jrandom_access_max_buffer_size);
}

/*
* Class: org_rocksdb_DBOptions
* Method: randomAccessMaxBufferSize
* Signature: (J)J
*/
jlong Java_org_rocksdb_DBOptions_randomAccessMaxBufferSize(JNIEnv*, jclass,
jlong jhandle) {
auto* opt = reinterpret_cast<ROCKSDB_NAMESPACE::DBOptions*>(jhandle);
return static_cast<jlong>(opt->random_access_max_buffer_size);
}

/*
* Class: org_rocksdb_DBOptions
* Method: setWritableFileMaxBufferSize
Expand Down
16 changes: 0 additions & 16 deletions java/src/main/java/org/rocksdb/DBOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -772,19 +772,6 @@ public String dailyOffpeakTimeUTC() {
return dailyOffpeakTimeUTC(nativeHandle_);
}

@Override
public DBOptions setRandomAccessMaxBufferSize(final long randomAccessMaxBufferSize) {
assert(isOwningHandle());
setRandomAccessMaxBufferSize(nativeHandle_, randomAccessMaxBufferSize);
return this;
}

@Override
public long randomAccessMaxBufferSize() {
assert(isOwningHandle());
return randomAccessMaxBufferSize(nativeHandle_);
}

@Override
public DBOptions setWritableFileMaxBufferSize(final long writableFileMaxBufferSize) {
assert(isOwningHandle());
Expand Down Expand Up @@ -1364,9 +1351,6 @@ private static native void setCompactionReadaheadSize(
private static native void setDailyOffpeakTimeUTC(
final long handle, final String dailyOffpeakTimeUTC);
private static native String dailyOffpeakTimeUTC(final long handle);
private static native void setRandomAccessMaxBufferSize(
final long handle, final long randomAccessMaxBufferSize);
private static native long randomAccessMaxBufferSize(final long handle);
private static native void setWritableFileMaxBufferSize(
final long handle, final long writableFileMaxBufferSize);
private static native long writableFileMaxBufferSize(final long handle);
Expand Down
48 changes: 0 additions & 48 deletions java/src/main/java/org/rocksdb/DBOptionsInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -938,54 +938,6 @@ public interface DBOptionsInterface<T extends DBOptionsInterface<T>> {
*/
long dbWriteBufferSize();

/**
* This is a maximum buffer size that is used by WinMmapReadableFile in
* unbuffered disk I/O mode. We need to maintain an aligned buffer for
* reads. We allow the buffer to grow until the specified value and then
* for bigger requests allocate one shot buffers. In unbuffered mode we
* always bypass read-ahead buffer at ReadaheadRandomAccessFile
* When read-ahead is required we then make use of
* {@link MutableDBOptionsInterface#compactionReadaheadSize()} value and
* always try to read ahead.
* With read-ahead we always pre-allocate buffer to the size instead of
* growing it up to a limit.
*
* This option is currently honored only on Windows
*
* Default: 1 Mb
*
* Special value: 0 - means do not maintain per instance buffer. Allocate
* per request buffer and avoid locking.
*
* @param randomAccessMaxBufferSize the maximum size of the random access
* buffer
*
* @return the reference to the current options.
*/
T setRandomAccessMaxBufferSize(long randomAccessMaxBufferSize);

/**
* This is a maximum buffer size that is used by WinMmapReadableFile in
* unbuffered disk I/O mode. We need to maintain an aligned buffer for
* reads. We allow the buffer to grow until the specified value and then
* for bigger requests allocate one shot buffers. In unbuffered mode we
* always bypass read-ahead buffer at ReadaheadRandomAccessFile
* When read-ahead is required we then make use of
* {@link MutableDBOptionsInterface#compactionReadaheadSize()} value and
* always try to read ahead. With read-ahead we always pre-allocate buffer
* to the size instead of growing it up to a limit.
*
* This option is currently honored only on Windows
*
* Default: 1 Mb
*
* Special value: 0 - means do not maintain per instance buffer. Allocate
* per request buffer and avoid locking.
*
* @return the maximum size of the random access buffer
*/
long randomAccessMaxBufferSize();

/**
* Use adaptive mutex, which spins in the user space before resorting
* to kernel. This could reduce context switch when the mutex is not
Expand Down
26 changes: 0 additions & 26 deletions java/src/main/java/org/rocksdb/EnvOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,29 +250,6 @@ public long compactionReadaheadSize() {
return compactionReadaheadSize(nativeHandle_);
}

/**
* See {@link DBOptions#setRandomAccessMaxBufferSize(long)}.
*
* @param randomAccessMaxBufferSize the max buffer size for random access.
*
* @return the reference to these options.
*/
public EnvOptions setRandomAccessMaxBufferSize(
final long randomAccessMaxBufferSize) {
setRandomAccessMaxBufferSize(nativeHandle_, randomAccessMaxBufferSize);
return this;
}

/**
* See {@link DBOptions#randomAccessMaxBufferSize()}.
*
* @return the max buffer size for random access.
*/
public long randomAccessMaxBufferSize() {
assert(isOwningHandle());
return randomAccessMaxBufferSize(nativeHandle_);
}

/**
* See {@link DBOptions#setWritableFileMaxBufferSize(long)}.
*
Expand Down Expand Up @@ -351,9 +328,6 @@ private static native void setFallocateWithKeepSize(
private static native void setCompactionReadaheadSize(
final long handle, final long compactionReadaheadSize);
private static native long compactionReadaheadSize(final long handle);
private static native void setRandomAccessMaxBufferSize(
final long handle, final long randomAccessMaxBufferSize);
private static native long randomAccessMaxBufferSize(final long handle);
private static native void setWritableFileMaxBufferSize(
final long handle, final long writableFileMaxBufferSize);
private static native long writableFileMaxBufferSize(final long handle);
Expand Down
16 changes: 0 additions & 16 deletions java/src/main/java/org/rocksdb/Options.java
Original file line number Diff line number Diff line change
Expand Up @@ -860,19 +860,6 @@ public String dailyOffpeakTimeUTC() {
return dailyOffpeakTimeUTC(nativeHandle_);
}

@Override
public Options setRandomAccessMaxBufferSize(final long randomAccessMaxBufferSize) {
assert(isOwningHandle());
setRandomAccessMaxBufferSize(nativeHandle_, randomAccessMaxBufferSize);
return this;
}

@Override
public long randomAccessMaxBufferSize() {
assert(isOwningHandle());
return randomAccessMaxBufferSize(nativeHandle_);
}

@Override
public Options setWritableFileMaxBufferSize(final long writableFileMaxBufferSize) {
assert(isOwningHandle());
Expand Down Expand Up @@ -2271,9 +2258,6 @@ private static native void setCompactionReadaheadSize(
private static native long compactionReadaheadSize(final long handle);
private static native void setDailyOffpeakTimeUTC(final long handle, final String offpeakTimeUTC);
private static native String dailyOffpeakTimeUTC(final long handle);
private static native void setRandomAccessMaxBufferSize(
final long handle, final long randomAccessMaxBufferSize);
private static native long randomAccessMaxBufferSize(final long handle);
private static native void setWritableFileMaxBufferSize(
final long handle, final long writableFileMaxBufferSize);
private static native long writableFileMaxBufferSize(final long handle);
Expand Down
9 changes: 0 additions & 9 deletions java/src/test/java/org/rocksdb/DBOptionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -462,15 +462,6 @@ public void compactionReadaheadSize() {
}
}

@Test
public void randomAccessMaxBufferSize() {
try(final DBOptions opt = new DBOptions()) {
final long longValue = rand.nextLong();
opt.setRandomAccessMaxBufferSize(longValue);
assertThat(opt.randomAccessMaxBufferSize()).isEqualTo(longValue);
}
}

@Test
public void writableFileMaxBufferSize() {
try(final DBOptions opt = new DBOptions()) {
Expand Down
9 changes: 0 additions & 9 deletions java/src/test/java/org/rocksdb/EnvOptionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,6 @@ public void compactionReadaheadSize() {
}
}

@Test
public void randomAccessMaxBufferSize() {
try (final EnvOptions envOptions = new EnvOptions()) {
final int intValue = rand.nextInt(2147483647);
envOptions.setRandomAccessMaxBufferSize(intValue);
assertThat(envOptions.randomAccessMaxBufferSize()).isEqualTo(intValue);
}
}

@Test
public void writableFileMaxBufferSize() {
try (final EnvOptions envOptions = new EnvOptions()) {
Expand Down
9 changes: 0 additions & 9 deletions java/src/test/java/org/rocksdb/OptionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -708,15 +708,6 @@ public void compactionReadaheadSize() {
}
}

@Test
public void randomAccessMaxBufferSize() {
try (final Options opt = new Options()) {
final long longValue = rand.nextLong();
opt.setRandomAccessMaxBufferSize(longValue);
assertThat(opt.randomAccessMaxBufferSize()).isEqualTo(longValue);
}
}

@Test
public void writableFileMaxBufferSize() {
try (final Options opt = new Options()) {
Expand Down
8 changes: 0 additions & 8 deletions options/db_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,6 @@ static std::unordered_map<std::string, OptionTypeInfo>
{"new_table_reader_for_compaction_inputs",
{0, OptionType::kBoolean, OptionVerificationType::kDeprecated,
OptionTypeFlags::kNone}},
{"random_access_max_buffer_size",
{offsetof(struct ImmutableDBOptions, random_access_max_buffer_size),
OptionType::kSizeT, OptionVerificationType::kNormal,
OptionTypeFlags::kNone}},
{"use_adaptive_mutex",
{offsetof(struct ImmutableDBOptions, use_adaptive_mutex),
OptionType::kBoolean, OptionVerificationType::kNormal,
Expand Down Expand Up @@ -755,7 +751,6 @@ ImmutableDBOptions::ImmutableDBOptions(const DBOptions& options)
advise_random_on_open(options.advise_random_on_open),
db_write_buffer_size(options.db_write_buffer_size),
write_buffer_manager(options.write_buffer_manager),
random_access_max_buffer_size(options.random_access_max_buffer_size),
use_adaptive_mutex(options.use_adaptive_mutex),
listeners(options.listeners),
enable_thread_tracking(options.enable_thread_tracking),
Expand Down Expand Up @@ -905,9 +900,6 @@ void ImmutableDBOptions::Dump(Logger* log) const {
db_write_buffer_size);
ROCKS_LOG_HEADER(log, " Options.write_buffer_manager: %p",
write_buffer_manager.get());
ROCKS_LOG_HEADER(
log, " Options.random_access_max_buffer_size: %" ROCKSDB_PRIszt,
random_access_max_buffer_size);
ROCKS_LOG_HEADER(log, " Options.use_adaptive_mutex: %d",
use_adaptive_mutex);
ROCKS_LOG_HEADER(log, " Options.rate_limiter: %p",
Expand Down
1 change: 0 additions & 1 deletion options/db_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ struct ImmutableDBOptions {
bool advise_random_on_open;
size_t db_write_buffer_size;
std::shared_ptr<WriteBufferManager> write_buffer_manager;
size_t random_access_max_buffer_size;
bool use_adaptive_mutex;
std::vector<std::shared_ptr<EventListener>> listeners;
bool enable_thread_tracking;
Expand Down
2 changes: 0 additions & 2 deletions options/options_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ void BuildDBOptions(const ImmutableDBOptions& immutable_db_options,
options.write_buffer_manager = immutable_db_options.write_buffer_manager;
options.compaction_readahead_size =
mutable_db_options.compaction_readahead_size;
options.random_access_max_buffer_size =
immutable_db_options.random_access_max_buffer_size;
options.writable_file_max_buffer_size =
mutable_db_options.writable_file_max_buffer_size;
options.use_adaptive_mutex = immutable_db_options.use_adaptive_mutex;
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 @@ -430,7 +430,6 @@ TEST_F(OptionsSettableTest, DBOptionsAllFieldsSettable) {
"use_direct_reads=false;"
"use_direct_io_for_flush_and_compaction=false;"
"max_log_file_size=4607;"
"random_access_max_buffer_size=1048576;"
"advise_random_on_open=true;"
"fail_if_options_file_error=false;"
"enable_pipelined_write=false;"
Expand Down
Loading

0 comments on commit d4bd67f

Please sign in to comment.