Remove disableDataSync option

Summary:
Remove disableDataSync, and another similarly named disable_data_sync options.
This is being done to simplify options, and also because the performance gains of this feature can be achieved by other methods.
Closes https://github.com/facebook/rocksdb/pull/1859

Differential Revision: D4541292

Pulled By: sagar0

fbshipit-source-id: 5b3a6ca
main
Sagar Vemuri 8 years ago committed by Facebook Github Bot
parent 0227c16d67
commit eb912a927e
  1. 2
      HISTORY.md
  2. 15
      build_tools/regression_build_test.sh
  3. 2
      db/builder.cc
  4. 5
      db/c.cc
  5. 9
      db/column_family_test.cc
  6. 4
      db/compaction_job.cc
  7. 3
      db/db_impl.cc
  8. 26
      db/db_test.cc
  9. 4
      db/filename.cc
  10. 2
      db/flush_job.cc
  11. 2
      db/version_set.cc
  12. 2
      examples/rocksdb_option_file_example.ini
  13. 2
      include/rocksdb/c.h
  14. 8
      include/rocksdb/options.h
  15. 8
      java/benchmark/src/main/java/org/rocksdb/benchmark/DbBenchmark.java
  16. 42
      java/rocksjni/options.cc
  17. 16
      java/src/main/java/org/rocksdb/DBOptions.java
  18. 29
      java/src/main/java/org/rocksdb/DBOptionsInterface.java
  19. 15
      java/src/main/java/org/rocksdb/Options.java
  20. 9
      java/src/test/java/org/rocksdb/DBOptionsTest.java
  21. 10
      java/src/test/java/org/rocksdb/OptionsTest.java
  22. 2
      table/sst_file_writer.cc
  23. 1
      tools/benchmark.sh
  24. 4
      tools/db_bench_tool.cc
  25. 2
      tools/db_bench_tool_test.cc
  26. 2
      tools/db_crashtest.py
  27. 4
      tools/db_stress.cc
  28. 1
      util/cf_options.cc
  29. 2
      util/cf_options.h
  30. 3
      util/db_options.cc
  31. 1
      util/db_options.h
  32. 2
      util/options.cc
  33. 1
      util/options_helper.cc
  34. 6
      util/options_helper.h
  35. 2
      util/options_settable_test.cc
  36. 2
      util/options_test.cc
  37. 1
      util/testutil.cc
  38. 1
      utilities/spatialdb/spatial_db.cc

@ -1,5 +1,7 @@
# Rocksdb Change Log # Rocksdb Change Log
## Unreleased ## Unreleased
### Public API Change
* Remove disableDataSync option.
## 5.2.0 (02/08/2017) ## 5.2.0 (02/08/2017)
### Public API Change ### Public API Change

@ -55,7 +55,6 @@ make release
--open_files=55000 \ --open_files=55000 \
--statistics=1 \ --statistics=1 \
--histogram=1 \ --histogram=1 \
--disable_data_sync=1 \
--disable_wal=1 \ --disable_wal=1 \
--sync=0 > ${STAT_FILE}.fillseq --sync=0 > ${STAT_FILE}.fillseq
@ -73,7 +72,6 @@ make release
--open_files=55000 \ --open_files=55000 \
--statistics=1 \ --statistics=1 \
--histogram=1 \ --histogram=1 \
--disable_data_sync=1 \
--disable_wal=1 \ --disable_wal=1 \
--sync=0 \ --sync=0 \
--threads=8 > ${STAT_FILE}.overwrite --threads=8 > ${STAT_FILE}.overwrite
@ -92,7 +90,6 @@ make release
--open_files=55000 \ --open_files=55000 \
--statistics=1 \ --statistics=1 \
--histogram=1 \ --histogram=1 \
--disable_data_sync=1 \
--disable_wal=1 \ --disable_wal=1 \
--sync=0 \ --sync=0 \
--threads=1 > /dev/null --threads=1 > /dev/null
@ -111,7 +108,6 @@ make release
--open_files=55000 \ --open_files=55000 \
--statistics=1 \ --statistics=1 \
--histogram=1 \ --histogram=1 \
--disable_data_sync=1 \
--disable_wal=1 \ --disable_wal=1 \
--sync=0 \ --sync=0 \
--threads=16 > ${STAT_FILE}.readrandom --threads=16 > ${STAT_FILE}.readrandom
@ -131,7 +127,6 @@ make release
--use_tailing_iterator=1 \ --use_tailing_iterator=1 \
--statistics=1 \ --statistics=1 \
--histogram=1 \ --histogram=1 \
--disable_data_sync=1 \
--disable_wal=1 \ --disable_wal=1 \
--sync=0 \ --sync=0 \
--threads=16 > ${STAT_FILE}.readrandomtailing --threads=16 > ${STAT_FILE}.readrandomtailing
@ -150,7 +145,6 @@ make release
--open_files=55000 \ --open_files=55000 \
--statistics=1 \ --statistics=1 \
--histogram=1 \ --histogram=1 \
--disable_data_sync=1 \
--disable_wal=1 \ --disable_wal=1 \
--sync=0 \ --sync=0 \
--threads=16 > ${STAT_FILE}.readrandomsmallblockcache --threads=16 > ${STAT_FILE}.readrandomsmallblockcache
@ -171,7 +165,6 @@ make release
--open_files=55000 \ --open_files=55000 \
--statistics=1 \ --statistics=1 \
--histogram=1 \ --histogram=1 \
--disable_data_sync=1 \
--disable_wal=1 \ --disable_wal=1 \
--sync=0 \ --sync=0 \
--threads=16 > ${STAT_FILE}.readrandom_mem_sst --threads=16 > ${STAT_FILE}.readrandom_mem_sst
@ -191,7 +184,6 @@ make release
--open_files=55000 \ --open_files=55000 \
--statistics=1 \ --statistics=1 \
--histogram=1 \ --histogram=1 \
--disable_data_sync=1 \
--disable_wal=1 \ --disable_wal=1 \
--sync=0 \ --sync=0 \
--threads=1 > /dev/null --threads=1 > /dev/null
@ -210,7 +202,6 @@ make release
--open_files=55000 \ --open_files=55000 \
--statistics=1 \ --statistics=1 \
--histogram=1 \ --histogram=1 \
--disable_data_sync=1 \
--disable_wal=1 \ --disable_wal=1 \
--sync=0 \ --sync=0 \
--threads=16 > /dev/null --threads=16 > /dev/null
@ -230,7 +221,6 @@ make release
--disable_auto_compactions=1 \ --disable_auto_compactions=1 \
--statistics=1 \ --statistics=1 \
--histogram=1 \ --histogram=1 \
--disable_data_sync=1 \
--disable_wal=1 \ --disable_wal=1 \
--sync=0 \ --sync=0 \
--threads=16 > ${STAT_FILE}.readrandom_filluniquerandom --threads=16 > ${STAT_FILE}.readrandom_filluniquerandom
@ -251,7 +241,6 @@ make release
--open_files=55000 \ --open_files=55000 \
--statistics=1 \ --statistics=1 \
--histogram=1 \ --histogram=1 \
--disable_data_sync=1 \
--disable_wal=1 \ --disable_wal=1 \
--sync=0 \ --sync=0 \
--threads=16 > ${STAT_FILE}.readwhilewriting --threads=16 > ${STAT_FILE}.readwhilewriting
@ -270,7 +259,6 @@ make release
--open_files=55000 \ --open_files=55000 \
--statistics=1 \ --statistics=1 \
--histogram=1 \ --histogram=1 \
--disable_data_sync=1 \
--disable_wal=1 \ --disable_wal=1 \
--sync=0 \ --sync=0 \
--value_size=10 \ --value_size=10 \
@ -295,7 +283,6 @@ common_in_mem_args="--db=/dev/shm/rocksdb \
--disable_wal=0 \ --disable_wal=0 \
--wal_dir=/dev/shm/rocksdb \ --wal_dir=/dev/shm/rocksdb \
--sync=0 \ --sync=0 \
--disable_data_sync=1 \
--verify_checksum=1 \ --verify_checksum=1 \
--delete_obsolete_files_period_micros=314572800 \ --delete_obsolete_files_period_micros=314572800 \
--max_grandparent_overlap_factor=10 \ --max_grandparent_overlap_factor=10 \
@ -356,7 +343,6 @@ common_in_mem_args="--db=/dev/shm/rocksdb \
--open_files=55000 \ --open_files=55000 \
--statistics=1 \ --statistics=1 \
--histogram=1 \ --histogram=1 \
--disable_data_sync=1 \
--disable_wal=1 \ --disable_wal=1 \
--sync=0 > ${STAT_FILE}.fillseq_lots_column_families --sync=0 > ${STAT_FILE}.fillseq_lots_column_families
@ -372,7 +358,6 @@ common_in_mem_args="--db=/dev/shm/rocksdb \
--open_files=55000 \ --open_files=55000 \
--statistics=1 \ --statistics=1 \
--histogram=1 \ --histogram=1 \
--disable_data_sync=1 \
--disable_wal=1 \ --disable_wal=1 \
--sync=0 \ --sync=0 \
--threads=8 > ${STAT_FILE}.overwrite_lots_column_families --threads=8 > ${STAT_FILE}.overwrite_lots_column_families

@ -170,7 +170,7 @@ Status BuildTable(
delete builder; delete builder;
// Finish and check for file errors // Finish and check for file errors
if (s.ok() && !empty && !ioptions.disable_data_sync) { if (s.ok() && !empty) {
StopWatch sw(env, ioptions.statistics, TABLE_SYNC_MICROS); StopWatch sw(env, ioptions.statistics, TABLE_SYNC_MICROS);
file_writer->Sync(ioptions.use_fsync); file_writer->Sync(ioptions.use_fsync);
} }

@ -1713,11 +1713,6 @@ void rocksdb_options_set_prefix_extractor(
opt->rep.prefix_extractor.reset(prefix_extractor); opt->rep.prefix_extractor.reset(prefix_extractor);
} }
void rocksdb_options_set_disable_data_sync(
rocksdb_options_t* opt, int disable_data_sync) {
opt->rep.disableDataSync = disable_data_sync;
}
void rocksdb_options_set_use_fsync( void rocksdb_options_set_use_fsync(
rocksdb_options_t* opt, int use_fsync) { rocksdb_options_t* opt, int use_fsync) {
opt->rep.use_fsync = use_fsync; opt->rep.use_fsync = use_fsync;

@ -1148,7 +1148,6 @@ TEST_F(ColumnFamilyTest, DifferentCompactionStyles) {
CreateColumnFamilies({"one", "two"}); CreateColumnFamilies({"one", "two"});
ColumnFamilyOptions default_cf, one, two; ColumnFamilyOptions default_cf, one, two;
db_options_.max_open_files = 20; // only 10 files in file cache db_options_.max_open_files = 20; // only 10 files in file cache
db_options_.disableDataSync = true;
default_cf.compaction_style = kCompactionStyleLevel; default_cf.compaction_style = kCompactionStyleLevel;
default_cf.num_levels = 3; default_cf.num_levels = 3;
@ -1221,7 +1220,6 @@ TEST_F(ColumnFamilyTest, MultipleManualCompactions) {
CreateColumnFamilies({"one", "two"}); CreateColumnFamilies({"one", "two"});
ColumnFamilyOptions default_cf, one, two; ColumnFamilyOptions default_cf, one, two;
db_options_.max_open_files = 20; // only 10 files in file cache db_options_.max_open_files = 20; // only 10 files in file cache
db_options_.disableDataSync = true;
db_options_.max_background_compactions = 3; db_options_.max_background_compactions = 3;
default_cf.compaction_style = kCompactionStyleLevel; default_cf.compaction_style = kCompactionStyleLevel;
@ -1319,7 +1317,6 @@ TEST_F(ColumnFamilyTest, AutomaticAndManualCompactions) {
CreateColumnFamilies({"one", "two"}); CreateColumnFamilies({"one", "two"});
ColumnFamilyOptions default_cf, one, two; ColumnFamilyOptions default_cf, one, two;
db_options_.max_open_files = 20; // only 10 files in file cache db_options_.max_open_files = 20; // only 10 files in file cache
db_options_.disableDataSync = true;
db_options_.max_background_compactions = 3; db_options_.max_background_compactions = 3;
db_options_.base_background_compactions = 3; db_options_.base_background_compactions = 3;
@ -1412,7 +1409,6 @@ TEST_F(ColumnFamilyTest, ManualAndAutomaticCompactions) {
CreateColumnFamilies({"one", "two"}); CreateColumnFamilies({"one", "two"});
ColumnFamilyOptions default_cf, one, two; ColumnFamilyOptions default_cf, one, two;
db_options_.max_open_files = 20; // only 10 files in file cache db_options_.max_open_files = 20; // only 10 files in file cache
db_options_.disableDataSync = true;
db_options_.max_background_compactions = 3; db_options_.max_background_compactions = 3;
db_options_.base_background_compactions = 3; db_options_.base_background_compactions = 3;
@ -1508,7 +1504,6 @@ TEST_F(ColumnFamilyTest, SameCFManualManualCompactions) {
CreateColumnFamilies({"one"}); CreateColumnFamilies({"one"});
ColumnFamilyOptions default_cf, one; ColumnFamilyOptions default_cf, one;
db_options_.max_open_files = 20; // only 10 files in file cache db_options_.max_open_files = 20; // only 10 files in file cache
db_options_.disableDataSync = true;
db_options_.max_background_compactions = 3; db_options_.max_background_compactions = 3;
db_options_.base_background_compactions = 3; db_options_.base_background_compactions = 3;
@ -1607,7 +1602,6 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactions) {
CreateColumnFamilies({"one"}); CreateColumnFamilies({"one"});
ColumnFamilyOptions default_cf, one; ColumnFamilyOptions default_cf, one;
db_options_.max_open_files = 20; // only 10 files in file cache db_options_.max_open_files = 20; // only 10 files in file cache
db_options_.disableDataSync = true;
db_options_.max_background_compactions = 3; db_options_.max_background_compactions = 3;
db_options_.base_background_compactions = 3; db_options_.base_background_compactions = 3;
@ -1697,7 +1691,6 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactionsLevel) {
CreateColumnFamilies({"one"}); CreateColumnFamilies({"one"});
ColumnFamilyOptions default_cf, one; ColumnFamilyOptions default_cf, one;
db_options_.max_open_files = 20; // only 10 files in file cache db_options_.max_open_files = 20; // only 10 files in file cache
db_options_.disableDataSync = true;
db_options_.max_background_compactions = 3; db_options_.max_background_compactions = 3;
db_options_.base_background_compactions = 3; db_options_.base_background_compactions = 3;
@ -1794,7 +1787,6 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticConflict) {
CreateColumnFamilies({"one"}); CreateColumnFamilies({"one"});
ColumnFamilyOptions default_cf, one; ColumnFamilyOptions default_cf, one;
db_options_.max_open_files = 20; // only 10 files in file cache db_options_.max_open_files = 20; // only 10 files in file cache
db_options_.disableDataSync = true;
db_options_.max_background_compactions = 3; db_options_.max_background_compactions = 3;
db_options_.base_background_compactions = 3; db_options_.base_background_compactions = 3;
@ -1914,7 +1906,6 @@ TEST_F(ColumnFamilyTest, SameCFAutomaticManualCompactions) {
CreateColumnFamilies({"one"}); CreateColumnFamilies({"one"});
ColumnFamilyOptions default_cf, one; ColumnFamilyOptions default_cf, one;
db_options_.max_open_files = 20; // only 10 files in file cache db_options_.max_open_files = 20; // only 10 files in file cache
db_options_.disableDataSync = true;
db_options_.max_background_compactions = 3; db_options_.max_background_compactions = 3;
db_options_.base_background_compactions = 3; db_options_.base_background_compactions = 3;

@ -538,7 +538,7 @@ Status CompactionJob::Run() {
thread.join(); thread.join();
} }
if (output_directory_ && !db_options_.disable_data_sync) { if (output_directory_) {
output_directory_->Fsync(); output_directory_->Fsync();
} }
@ -1059,7 +1059,7 @@ Status CompactionJob::FinishCompactionOutputFile(
sub_compact->total_bytes += current_bytes; sub_compact->total_bytes += current_bytes;
// Finish and check for file errors // Finish and check for file errors
if (s.ok() && !db_options_.disable_data_sync) { if (s.ok()) {
StopWatch sw(env_, stats_, COMPACTION_OUTFILE_SYNC_MICROS); StopWatch sw(env_, stats_, COMPACTION_OUTFILE_SYNC_MICROS);
s = sub_compact->outfile->Sync(db_options_.use_fsync); s = sub_compact->outfile->Sync(db_options_.use_fsync);
} }

@ -1915,8 +1915,7 @@ Status DBImpl::FlushMemTableToOutputFile(
Status s; Status s;
if (logfile_number_ > 0 && if (logfile_number_ > 0 &&
versions_->GetColumnFamilySet()->NumberOfColumnFamilies() > 0 && versions_->GetColumnFamilySet()->NumberOfColumnFamilies() > 0) {
!immutable_db_options_.disable_data_sync) {
// If there are more than one column families, we need to make sure that // If there are more than one column families, we need to make sure that
// all the log files except the most recent one are synced. Otherwise if // all the log files except the most recent one are synced. Otherwise if
// the host crashes after flushing and before WAL is persistent, the // the host crashes after flushing and before WAL is persistent, the

@ -827,7 +827,6 @@ TEST_F(DBTest, GetPicksCorrectFile) {
TEST_F(DBTest, GetEncountersEmptyLevel) { TEST_F(DBTest, GetEncountersEmptyLevel) {
do { do {
Options options = CurrentOptions(); Options options = CurrentOptions();
options.disableDataSync = true;
CreateAndReopenWithCF({"pikachu"}, options); CreateAndReopenWithCF({"pikachu"}, options);
// Arrange for the following to happen: // Arrange for the following to happen:
// * sstable A in level 0 // * sstable A in level 0
@ -3574,31 +3573,6 @@ TEST_F(DBTest, WriteSingleThreadEntry) {
} }
} }
TEST_F(DBTest, DisableDataSyncTest) {
env_->sync_counter_.store(0);
// iter 0 -- no sync
// iter 1 -- sync
for (int iter = 0; iter < 2; ++iter) {
Options options = CurrentOptions();
options.disableDataSync = iter == 0;
options.create_if_missing = true;
options.num_levels = 10;
options.env = env_;
Reopen(options);
CreateAndReopenWithCF({"pikachu"}, options);
MakeTables(10, "a", "z");
Compact("a", "z");
if (iter == 0) {
ASSERT_EQ(env_->sync_counter_.load(), 0);
} else {
ASSERT_GT(env_->sync_counter_.load(), 0);
}
Destroy(options);
}
}
#ifndef ROCKSDB_LITE #ifndef ROCKSDB_LITE
TEST_F(DBTest, DynamicMemtableOptions) { TEST_F(DBTest, DynamicMemtableOptions) {
const uint64_t k64KB = 1 << 16; const uint64_t k64KB = 1 << 16;

@ -389,12 +389,8 @@ Status SetIdentityFile(Env* env, const std::string& dbname) {
Status SyncManifest(Env* env, const ImmutableDBOptions* db_options, Status SyncManifest(Env* env, const ImmutableDBOptions* db_options,
WritableFileWriter* file) { WritableFileWriter* file) {
TEST_KILL_RANDOM("SyncManifest:0", rocksdb_kill_odds * REDUCE_ODDS2); TEST_KILL_RANDOM("SyncManifest:0", rocksdb_kill_odds * REDUCE_ODDS2);
if (db_options->disable_data_sync) {
return Status::OK();
} else {
StopWatch sw(env, db_options->statistics.get(), MANIFEST_FILE_SYNC_MICROS); StopWatch sw(env, db_options->statistics.get(), MANIFEST_FILE_SYNC_MICROS);
return file->Sync(db_options->use_fsync); return file->Sync(db_options->use_fsync);
} }
}
} // namespace rocksdb } // namespace rocksdb

@ -313,7 +313,7 @@ Status FlushJob::WriteLevel0Table() {
meta_.fd.GetFileSize(), s.ToString().c_str(), meta_.fd.GetFileSize(), s.ToString().c_str(),
meta_.marked_for_compaction ? " (needs compaction)" : ""); meta_.marked_for_compaction ? " (needs compaction)" : "");
if (!db_options_.disable_data_sync && output_file_directory_ != nullptr) { if (output_file_directory_ != nullptr) {
output_file_directory_->Fsync(); output_file_directory_->Fsync();
} }
TEST_SYNC_POINT("FlushJob::WriteLevel0Table"); TEST_SYNC_POINT("FlushJob::WriteLevel0Table");

@ -2363,7 +2363,7 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data,
if (s.ok() && new_descriptor_log) { if (s.ok() && new_descriptor_log) {
s = SetCurrentFile( s = SetCurrentFile(
env_, dbname_, pending_manifest_file_number_, env_, dbname_, pending_manifest_file_number_,
db_options_->disable_data_sync ? nullptr : db_directory); db_directory);
} }
if (s.ok()) { if (s.ok()) {

@ -62,13 +62,11 @@
create_missing_column_families=false create_missing_column_families=false
paranoid_checks=true paranoid_checks=true
delete_obsolete_files_period_micros=21600000000 delete_obsolete_files_period_micros=21600000000
disable_data_sync=false
log_file_time_to_roll=0 log_file_time_to_roll=0
compaction_readahead_size=0 compaction_readahead_size=0
create_if_missing=false create_if_missing=false
use_adaptive_mutex=false use_adaptive_mutex=false
enable_thread_tracking=false enable_thread_tracking=false
disableDataSync=false
allow_fallocate=true allow_fallocate=true
error_if_exists=false error_if_exists=false
recycle_log_file_num=0 recycle_log_file_num=0

@ -705,8 +705,6 @@ rocksdb_options_set_verify_checksums_in_compaction(rocksdb_options_t*,
extern ROCKSDB_LIBRARY_API void extern ROCKSDB_LIBRARY_API void
rocksdb_options_set_max_sequential_skip_in_iterations(rocksdb_options_t*, rocksdb_options_set_max_sequential_skip_in_iterations(rocksdb_options_t*,
uint64_t); uint64_t);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_disable_data_sync(
rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_disable_auto_compactions( extern ROCKSDB_LIBRARY_API void rocksdb_options_set_disable_auto_compactions(
rocksdb_options_t*, int); rocksdb_options_t*, int);
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_optimize_filters_for_hits( extern ROCKSDB_LIBRARY_API void rocksdb_options_set_optimize_filters_for_hits(

@ -948,14 +948,6 @@ struct DBOptions {
// If non-null, then we should collect metrics about database operations // If non-null, then we should collect metrics about database operations
std::shared_ptr<Statistics> statistics = nullptr; std::shared_ptr<Statistics> statistics = nullptr;
// If true, then the contents of manifest and data files are not synced
// to stable storage. Their contents remain in the OS buffers till the
// OS decides to flush them. This option is good for bulk-loading
// of data. Once the bulk-loading is complete, please issue a
// sync to the OS to flush all dirty buffers to stable storage.
// Default: false
bool disableDataSync = false;
// If true, then every store to stable storage will issue a fsync. // If true, then every store to stable storage will issue a fsync.
// If false, then every store to stable storage will issue a fdatasync. // If false, then every store to stable storage will issue a fdatasync.
// This parameter should be set to true while storing data to // This parameter should be set to true while storing data to

@ -545,8 +545,6 @@ public class DbBenchmark {
(Integer)flags_.get(Flag.max_background_flushes)); (Integer)flags_.get(Flag.max_background_flushes));
options.setMaxOpenFiles( options.setMaxOpenFiles(
(Integer)flags_.get(Flag.open_files)); (Integer)flags_.get(Flag.open_files));
options.setDisableDataSync(
(Boolean)flags_.get(Flag.disable_data_sync));
options.setUseFsync( options.setUseFsync(
(Boolean)flags_.get(Flag.use_fsync)); (Boolean)flags_.get(Flag.use_fsync));
options.setWalDir( options.setWalDir(
@ -1225,12 +1223,6 @@ public class DbBenchmark {
return parseBoolean(value); return parseBoolean(value);
} }
}, },
disable_data_sync(false,"If true, do not wait until data is\n" +
"\tsynced to disk.") {
@Override public Object parseValue(String value) {
return parseBoolean(value);
}
},
use_fsync(false,"If true, issue fsync instead of fdatasync.") { use_fsync(false,"If true, issue fsync instead of fdatasync.") {
@Override public Object parseValue(String value) { @Override public Object parseValue(String value) {
return parseBoolean(value); return parseBoolean(value);

@ -342,27 +342,6 @@ void Java_org_rocksdb_Options_setMaxOpenFiles(
static_cast<int>(max_open_files); static_cast<int>(max_open_files);
} }
/*
* Class: org_rocksdb_Options
* Method: disableDataSync
* Signature: (J)Z
*/
jboolean Java_org_rocksdb_Options_disableDataSync(
JNIEnv* env, jobject jobj, jlong jhandle) {
return reinterpret_cast<rocksdb::Options*>(jhandle)->disableDataSync;
}
/*
* Class: org_rocksdb_Options
* Method: setDisableDataSync
* Signature: (JZ)V
*/
void Java_org_rocksdb_Options_setDisableDataSync(
JNIEnv* env, jobject jobj, jlong jhandle, jboolean disableDataSync) {
reinterpret_cast<rocksdb::Options*>(jhandle)->disableDataSync =
static_cast<bool>(disableDataSync);
}
/* /*
* Class: org_rocksdb_Options * Class: org_rocksdb_Options
* Method: useFsync * Method: useFsync
@ -3748,27 +3727,6 @@ jlong Java_org_rocksdb_DBOptions_statisticsPtr(
return reinterpret_cast<jlong>(st); return reinterpret_cast<jlong>(st);
} }
/*
* Class: org_rocksdb_DBOptions
* Method: setDisableDataSync
* Signature: (JZ)V
*/
void Java_org_rocksdb_DBOptions_setDisableDataSync(
JNIEnv* env, jobject jobj, jlong jhandle, jboolean disableDataSync) {
reinterpret_cast<rocksdb::DBOptions*>(jhandle)->disableDataSync =
static_cast<bool>(disableDataSync);
}
/*
* Class: org_rocksdb_DBOptions
* Method: disableDataSync
* Signature: (J)Z
*/
jboolean Java_org_rocksdb_DBOptions_disableDataSync(
JNIEnv* env, jobject jobj, jlong jhandle) {
return reinterpret_cast<rocksdb::DBOptions*>(jhandle)->disableDataSync;
}
/* /*
* Class: org_rocksdb_DBOptions * Class: org_rocksdb_DBOptions
* Method: setUseFsync * Method: setUseFsync

@ -221,20 +221,6 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
return new Statistics(statsPtr); return new Statistics(statsPtr);
} }
@Override
public DBOptions setDisableDataSync(
final boolean disableDataSync) {
assert(isOwningHandle());
setDisableDataSync(nativeHandle_, disableDataSync);
return this;
}
@Override
public boolean disableDataSync() {
assert(isOwningHandle());
return disableDataSync(nativeHandle_);
}
@Override @Override
public DBOptions setUseFsync( public DBOptions setUseFsync(
final boolean useFsync) { final boolean useFsync) {
@ -680,8 +666,6 @@ public long delayedWriteRate(){
private native long maxTotalWalSize(long handle); private native long maxTotalWalSize(long handle);
private native void createStatistics(long optHandle); private native void createStatistics(long optHandle);
private native long statisticsPtr(long optHandle); private native long statisticsPtr(long optHandle);
private native void setDisableDataSync(long handle, boolean disableDataSync);
private native boolean disableDataSync(long handle);
private native boolean useFsync(long handle); private native boolean useFsync(long handle);
private native void setUseFsync(long handle, boolean useFsync); private native void setUseFsync(long handle, boolean useFsync);
private native void setDbLogDir(long handle, String dbLogDir); private native void setDbLogDir(long handle, String dbLogDir);

@ -242,35 +242,6 @@ public interface DBOptionsInterface {
*/ */
Statistics statisticsPtr(); Statistics statisticsPtr();
/**
* <p>If true, then the contents of manifest and data files are
* not synced to stable storage. Their contents remain in the
* OS buffers till theOS decides to flush them.</p>
*
* <p>This option is good for bulk-loading of data.</p>
*
* <p>Once the bulk-loading is complete, please issue a sync to
* the OS to flush all dirty buffers to stable storage.</p>
*
* <p>Default: false</p>
*
* @param disableDataSync a boolean flag to specify whether to
* disable data sync.
* @return the instance of the current Object.
*/
Object setDisableDataSync(boolean disableDataSync);
/**
* If true, then the contents of data files are not synced
* to stable storage. Their contents remain in the OS buffers till the
* OS decides to flush them. This option is good for bulk-loading
* of data. Once the bulk-loading is complete, please issue a
* sync to the OS to flush all dirty buffers to stable storage.
*
* @return if true, then data-sync is disabled.
*/
boolean disableDataSync();
/** /**
* <p>If true, then every store to stable storage will issue a fsync.</p> * <p>If true, then every store to stable storage will issue a fsync.</p>
* <p>If false, then every store to stable storage will issue a fdatasync. * <p>If false, then every store to stable storage will issue a fdatasync.

@ -270,19 +270,6 @@ public class Options extends RocksObject
return this; return this;
} }
@Override
public boolean disableDataSync() {
assert(isOwningHandle());
return disableDataSync(nativeHandle_);
}
@Override
public Options setDisableDataSync(final boolean disableDataSync) {
assert(isOwningHandle());
setDisableDataSync(nativeHandle_, disableDataSync);
return this;
}
@Override @Override
public boolean useFsync() { public boolean useFsync() {
assert(isOwningHandle()); assert(isOwningHandle());
@ -1256,8 +1243,6 @@ public class Options extends RocksObject
private native long maxTotalWalSize(long handle); private native long maxTotalWalSize(long handle);
private native void createStatistics(long optHandle); private native void createStatistics(long optHandle);
private native long statisticsPtr(long optHandle); private native long statisticsPtr(long optHandle);
private native void setDisableDataSync(long handle, boolean disableDataSync);
private native boolean disableDataSync(long handle);
private native boolean useFsync(long handle); private native boolean useFsync(long handle);
private native void setUseFsync(long handle, boolean useFsync); private native void setUseFsync(long handle, boolean useFsync);
private native void setDbLogDir(long handle, String dbLogDir); private native void setDbLogDir(long handle, String dbLogDir);

@ -125,15 +125,6 @@ public class DBOptionsTest {
} }
} }
@Test
public void disableDataSync() {
try(final DBOptions opt = new DBOptions()) {
final boolean boolValue = rand.nextBoolean();
opt.setDisableDataSync(boolValue);
assertThat(opt.disableDataSync()).isEqualTo(boolValue);
}
}
@Test @Test
public void useFsync() { public void useFsync() {
try(final DBOptions opt = new DBOptions()) { try(final DBOptions opt = new DBOptions()) {

@ -408,16 +408,6 @@ public class OptionsTest {
} }
} }
@Test
public void disableDataSync() {
try (final Options opt = new Options()) {
final boolean boolValue = rand.nextBoolean();
opt.setDisableDataSync(boolValue);
assertThat(opt.disableDataSync()).
isEqualTo(boolValue);
}
}
@Test @Test
public void useFsync() { public void useFsync() {
try (final Options opt = new Options()) { try (final Options opt = new Options()) {

@ -184,9 +184,7 @@ Status SstFileWriter::Finish(ExternalSstFileInfo* file_info) {
r->file_info.file_size = r->builder->FileSize(); r->file_info.file_size = r->builder->FileSize();
if (s.ok()) { if (s.ok()) {
if (!r->ioptions.disable_data_sync) {
s = r->file_writer->Sync(r->ioptions.use_fsync); s = r->file_writer->Sync(r->ioptions.use_fsync);
}
InvalidatePageCache(true /* closing */); InvalidatePageCache(true /* closing */);
if (s.ok()) { if (s.ok()) {
s = r->file_writer->Close(); s = r->file_writer->Close();

@ -61,7 +61,6 @@ block_size=${BLOCK_SIZE:-8192}
const_params=" const_params="
--db=$DB_DIR \ --db=$DB_DIR \
--wal_dir=$WAL_DIR \ --wal_dir=$WAL_DIR \
--disable_data_sync=0 \
\ \
--num=$num_keys \ --num=$num_keys \
--num_levels=6 \ --num_levels=6 \

@ -466,9 +466,6 @@ DEFINE_int64(writes, -1, "Number of write operations to do. If negative, do"
DEFINE_bool(sync, false, "Sync all writes to disk"); DEFINE_bool(sync, false, "Sync all writes to disk");
DEFINE_bool(disable_data_sync, false, "If true, do not wait until data is"
" synced to disk.");
DEFINE_bool(use_fsync, false, "If true, issue fsync instead of fdatasync"); DEFINE_bool(use_fsync, false, "If true, issue fsync instead of fdatasync");
DEFINE_bool(disable_wal, false, "If true, do not write WAL for write."); DEFINE_bool(disable_wal, false, "If true, do not write WAL for write.");
@ -2785,7 +2782,6 @@ class Benchmark {
options.compaction_readahead_size = FLAGS_compaction_readahead_size; options.compaction_readahead_size = FLAGS_compaction_readahead_size;
options.random_access_max_buffer_size = FLAGS_random_access_max_buffer_size; options.random_access_max_buffer_size = FLAGS_random_access_max_buffer_size;
options.writable_file_max_buffer_size = FLAGS_writable_file_max_buffer_size; options.writable_file_max_buffer_size = FLAGS_writable_file_max_buffer_size;
options.disableDataSync = FLAGS_disable_data_sync;
options.use_fsync = FLAGS_use_fsync; options.use_fsync = FLAGS_use_fsync;
options.num_levels = FLAGS_num_levels; options.num_levels = FLAGS_num_levels;
options.target_file_size_base = FLAGS_target_file_size_base; options.target_file_size_base = FLAGS_target_file_size_base;

@ -200,9 +200,7 @@ const std::string options_file_content = R"OPTIONS_FILE(
is_fd_close_on_exec=true is_fd_close_on_exec=true
bytes_per_sync=1048576 bytes_per_sync=1048576
enable_thread_tracking=true enable_thread_tracking=true
disable_data_sync=false
recycle_log_file_num=0 recycle_log_file_num=0
disableDataSync=false
create_missing_column_families=false create_missing_column_families=false
log_file_time_to_roll=0 log_file_time_to_roll=0
max_background_flushes=1 max_background_flushes=1

@ -22,7 +22,6 @@ default_params = {
"use_clock_cache": "false", "use_clock_cache": "false",
"delpercent": 5, "delpercent": 5,
"destroy_db_initially": 0, "destroy_db_initially": 0,
"disable_data_sync": 0,
"disable_wal": 0, "disable_wal": 0,
"allow_concurrent_memtable_write": 0, "allow_concurrent_memtable_write": 0,
"iterpercent": 10, "iterpercent": 10,
@ -89,7 +88,6 @@ simple_default_params = {
"column_families": 1, "column_families": 1,
"delpercent": 5, "delpercent": 5,
"destroy_db_initially": 0, "destroy_db_initially": 0,
"disable_data_sync": 0,
"disable_wal": 0, "disable_wal": 0,
"allow_concurrent_memtable_write": lambda: random.randint(0, 1), "allow_concurrent_memtable_write": lambda: random.randint(0, 1),
"iterpercent": 10, "iterpercent": 10,

@ -276,9 +276,6 @@ DEFINE_bool(statistics, false, "Create database statistics");
DEFINE_bool(sync, false, "Sync all writes to disk"); DEFINE_bool(sync, false, "Sync all writes to disk");
DEFINE_bool(disable_data_sync, false,
"If true, do not wait until data is synced to disk.");
DEFINE_bool(use_fsync, false, "If true, issue fsync instead of fdatasync"); DEFINE_bool(use_fsync, false, "If true, issue fsync instead of fdatasync");
DEFINE_int32(kill_random_test, 0, DEFINE_int32(kill_random_test, 0,
@ -2143,7 +2140,6 @@ class StressTest {
options_.max_open_files = FLAGS_open_files; options_.max_open_files = FLAGS_open_files;
options_.statistics = dbstats; options_.statistics = dbstats;
options_.env = FLAGS_env; options_.env = FLAGS_env;
options_.disableDataSync = FLAGS_disable_data_sync;
options_.use_fsync = FLAGS_use_fsync; options_.use_fsync = FLAGS_use_fsync;
options_.allow_mmap_reads = FLAGS_mmap_read; options_.allow_mmap_reads = FLAGS_mmap_read;
options_.target_file_size_base = FLAGS_target_file_size_base; options_.target_file_size_base = FLAGS_target_file_size_base;

@ -55,7 +55,6 @@ ImmutableCFOptions::ImmutableCFOptions(const ImmutableDBOptions& db_options,
bloom_locality(cf_options.bloom_locality), bloom_locality(cf_options.bloom_locality),
purge_redundant_kvs_while_flush( purge_redundant_kvs_while_flush(
cf_options.purge_redundant_kvs_while_flush), cf_options.purge_redundant_kvs_while_flush),
disable_data_sync(db_options.disable_data_sync),
use_fsync(db_options.use_fsync), use_fsync(db_options.use_fsync),
compression_per_level(cf_options.compression_per_level), compression_per_level(cf_options.compression_per_level),
bottommost_compression(cf_options.bottommost_compression), bottommost_compression(cf_options.bottommost_compression),

@ -86,8 +86,6 @@ struct ImmutableCFOptions {
bool purge_redundant_kvs_while_flush; bool purge_redundant_kvs_while_flush;
bool disable_data_sync;
bool use_fsync; bool use_fsync;
std::vector<CompressionType> compression_per_level; std::vector<CompressionType> compression_per_level;

@ -34,7 +34,6 @@ ImmutableDBOptions::ImmutableDBOptions(const DBOptions& options)
max_open_files(options.max_open_files), max_open_files(options.max_open_files),
max_file_opening_threads(options.max_file_opening_threads), max_file_opening_threads(options.max_file_opening_threads),
statistics(options.statistics), statistics(options.statistics),
disable_data_sync(options.disableDataSync),
use_fsync(options.use_fsync), use_fsync(options.use_fsync),
db_paths(options.db_paths), db_paths(options.db_paths),
db_log_dir(options.db_log_dir), db_log_dir(options.db_log_dir),
@ -102,8 +101,6 @@ void ImmutableDBOptions::Dump(Logger* log) const {
max_open_files); max_open_files);
Header(log, " Options.max_file_opening_threads: %d", Header(log, " Options.max_file_opening_threads: %d",
max_file_opening_threads); max_file_opening_threads);
Header(log, " Options.disableDataSync: %d",
disable_data_sync);
Header(log, " Options.use_fsync: %d", use_fsync); Header(log, " Options.use_fsync: %d", use_fsync);
Header(log, Header(log,
" Options.max_log_file_size: %" ROCKSDB_PRIszt, " Options.max_log_file_size: %" ROCKSDB_PRIszt,

@ -30,7 +30,6 @@ struct ImmutableDBOptions {
int max_open_files; int max_open_files;
int max_file_opening_threads; int max_file_opening_threads;
std::shared_ptr<Statistics> statistics; std::shared_ptr<Statistics> statistics;
bool disable_data_sync;
bool use_fsync; bool use_fsync;
std::vector<DbPath> db_paths; std::vector<DbPath> db_paths;
std::string db_log_dir; std::string db_log_dir;

@ -133,7 +133,6 @@ DBOptions::DBOptions(const Options& options)
max_file_opening_threads(options.max_file_opening_threads), max_file_opening_threads(options.max_file_opening_threads),
max_total_wal_size(options.max_total_wal_size), max_total_wal_size(options.max_total_wal_size),
statistics(options.statistics), statistics(options.statistics),
disableDataSync(options.disableDataSync),
use_fsync(options.use_fsync), use_fsync(options.use_fsync),
db_paths(options.db_paths), db_paths(options.db_paths),
db_log_dir(options.db_log_dir), db_log_dir(options.db_log_dir),
@ -387,7 +386,6 @@ Options::PrepareForBulkLoad()
// no auto compactions please. The application should issue a // no auto compactions please. The application should issue a
// manual compaction after all data is loaded into L0. // manual compaction after all data is loaded into L0.
disable_auto_compactions = true; disable_auto_compactions = true;
disableDataSync = true;
// A manual compaction run should pick all files in L0 in // A manual compaction run should pick all files in L0 in
// a single compaction run. // a single compaction run.
max_compaction_bytes = (static_cast<uint64_t>(1) << 60); max_compaction_bytes = (static_cast<uint64_t>(1) << 60);

@ -47,7 +47,6 @@ DBOptions BuildDBOptions(const ImmutableDBOptions& immutable_db_options,
immutable_db_options.max_file_opening_threads; immutable_db_options.max_file_opening_threads;
options.max_total_wal_size = mutable_db_options.max_total_wal_size; options.max_total_wal_size = mutable_db_options.max_total_wal_size;
options.statistics = immutable_db_options.statistics; options.statistics = immutable_db_options.statistics;
options.disableDataSync = immutable_db_options.disable_data_sync;
options.use_fsync = immutable_db_options.use_fsync; options.use_fsync = immutable_db_options.use_fsync;
options.db_paths = immutable_db_options.db_paths; options.db_paths = immutable_db_options.db_paths;
options.db_log_dir = immutable_db_options.db_log_dir; options.db_log_dir = immutable_db_options.db_log_dir;

@ -214,11 +214,9 @@ static std::unordered_map<std::string, OptionTypeInfo> db_options_type_info = {
{offsetof(struct DBOptions, create_missing_column_families), {offsetof(struct DBOptions, create_missing_column_families),
OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}}, OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}},
{"disableDataSync", {"disableDataSync",
{offsetof(struct DBOptions, disableDataSync), OptionType::kBoolean, {0, OptionType::kBoolean, OptionVerificationType::kDeprecated, false, 0}},
OptionVerificationType::kNormal, false, 0}},
{"disable_data_sync", // for compatibility {"disable_data_sync", // for compatibility
{offsetof(struct DBOptions, disableDataSync), OptionType::kBoolean, {0, OptionType::kBoolean, OptionVerificationType::kDeprecated, false, 0}},
OptionVerificationType::kNormal, false, 0}},
{"enable_thread_tracking", {"enable_thread_tracking",
{offsetof(struct DBOptions, enable_thread_tracking), OptionType::kBoolean, {offsetof(struct DBOptions, enable_thread_tracking), OptionType::kBoolean,
OptionVerificationType::kNormal, false, 0}}, OptionVerificationType::kNormal, false, 0}},

@ -260,9 +260,7 @@ TEST_F(OptionsSettableTest, DBOptionsAllFieldsSettable) {
"is_fd_close_on_exec=false;" "is_fd_close_on_exec=false;"
"bytes_per_sync=4295013613;" "bytes_per_sync=4295013613;"
"enable_thread_tracking=false;" "enable_thread_tracking=false;"
"disable_data_sync=false;"
"recycle_log_file_num=0;" "recycle_log_file_num=0;"
"disableDataSync=false;"
"create_missing_column_families=true;" "create_missing_column_families=true;"
"log_file_time_to_roll=3097;" "log_file_time_to_roll=3097;"
"max_background_flushes=35;" "max_background_flushes=35;"

@ -100,7 +100,6 @@ TEST_F(OptionsTest, GetOptionsFromMapTest) {
{"paranoid_checks", "true"}, {"paranoid_checks", "true"},
{"max_open_files", "32"}, {"max_open_files", "32"},
{"max_total_wal_size", "33"}, {"max_total_wal_size", "33"},
{"disable_data_sync", "false"},
{"use_fsync", "true"}, {"use_fsync", "true"},
{"db_log_dir", "/db_log_dir"}, {"db_log_dir", "/db_log_dir"},
{"wal_dir", "/wal_dir"}, {"wal_dir", "/wal_dir"},
@ -215,7 +214,6 @@ TEST_F(OptionsTest, GetOptionsFromMapTest) {
ASSERT_EQ(new_db_opt.paranoid_checks, true); ASSERT_EQ(new_db_opt.paranoid_checks, true);
ASSERT_EQ(new_db_opt.max_open_files, 32); ASSERT_EQ(new_db_opt.max_open_files, 32);
ASSERT_EQ(new_db_opt.max_total_wal_size, static_cast<uint64_t>(33)); ASSERT_EQ(new_db_opt.max_total_wal_size, static_cast<uint64_t>(33));
ASSERT_EQ(new_db_opt.disableDataSync, false);
ASSERT_EQ(new_db_opt.use_fsync, true); ASSERT_EQ(new_db_opt.use_fsync, true);
ASSERT_EQ(new_db_opt.db_log_dir, "/db_log_dir"); ASSERT_EQ(new_db_opt.db_log_dir, "/db_log_dir");
ASSERT_EQ(new_db_opt.wal_dir, "/wal_dir"); ASSERT_EQ(new_db_opt.wal_dir, "/wal_dir");

@ -244,7 +244,6 @@ void RandomInitDBOptions(DBOptions* db_opt, Random* rnd) {
db_opt->use_direct_writes = rnd->Uniform(2); db_opt->use_direct_writes = rnd->Uniform(2);
db_opt->create_if_missing = rnd->Uniform(2); db_opt->create_if_missing = rnd->Uniform(2);
db_opt->create_missing_column_families = rnd->Uniform(2); db_opt->create_missing_column_families = rnd->Uniform(2);
db_opt->disableDataSync = rnd->Uniform(2);
db_opt->enable_thread_tracking = rnd->Uniform(2); db_opt->enable_thread_tracking = rnd->Uniform(2);
db_opt->error_if_exists = rnd->Uniform(2); db_opt->error_if_exists = rnd->Uniform(2);
db_opt->is_fd_close_on_exec = rnd->Uniform(2); db_opt->is_fd_close_on_exec = rnd->Uniform(2);

@ -698,7 +698,6 @@ DBOptions GetDBOptionsFromSpatialDBOptions(const SpatialDBOptions& options) {
db_options.statistics = CreateDBStatistics(); db_options.statistics = CreateDBStatistics();
if (options.bulk_load) { if (options.bulk_load) {
db_options.stats_dump_period_sec = 600; db_options.stats_dump_period_sec = 600;
db_options.disableDataSync = true;
} else { } else {
db_options.stats_dump_period_sec = 1800; // 30min db_options.stats_dump_period_sec = 1800; // 30min
} }

Loading…
Cancel
Save