From eb912a927ec0858ac53d0706ffb23dab0a9a4585 Mon Sep 17 00:00:00 2001 From: Sagar Vemuri Date: Mon, 13 Feb 2017 10:54:38 -0800 Subject: [PATCH] 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 --- HISTORY.md | 2 + build_tools/regression_build_test.sh | 15 ------- db/builder.cc | 2 +- db/c.cc | 5 --- db/column_family_test.cc | 9 ---- db/compaction_job.cc | 4 +- db/db_impl.cc | 3 +- db/db_test.cc | 26 ------------ db/filename.cc | 8 +--- db/flush_job.cc | 2 +- db/version_set.cc | 2 +- examples/rocksdb_option_file_example.ini | 2 - include/rocksdb/c.h | 2 - include/rocksdb/options.h | 8 ---- .../org/rocksdb/benchmark/DbBenchmark.java | 8 ---- java/rocksjni/options.cc | 42 ------------------- java/src/main/java/org/rocksdb/DBOptions.java | 16 ------- .../java/org/rocksdb/DBOptionsInterface.java | 29 ------------- java/src/main/java/org/rocksdb/Options.java | 15 ------- .../test/java/org/rocksdb/DBOptionsTest.java | 9 ---- .../test/java/org/rocksdb/OptionsTest.java | 10 ----- table/sst_file_writer.cc | 4 +- tools/benchmark.sh | 1 - tools/db_bench_tool.cc | 4 -- tools/db_bench_tool_test.cc | 2 - tools/db_crashtest.py | 2 - tools/db_stress.cc | 4 -- util/cf_options.cc | 1 - util/cf_options.h | 2 - util/db_options.cc | 3 -- util/db_options.h | 1 - util/options.cc | 2 - util/options_helper.cc | 1 - util/options_helper.h | 6 +-- util/options_settable_test.cc | 2 - util/options_test.cc | 2 - util/testutil.cc | 1 - utilities/spatialdb/spatial_db.cc | 1 - 38 files changed, 13 insertions(+), 245 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index b778c3189..b984b5c2e 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,7 @@ # Rocksdb Change Log ## Unreleased +### Public API Change +* Remove disableDataSync option. ## 5.2.0 (02/08/2017) ### Public API Change diff --git a/build_tools/regression_build_test.sh b/build_tools/regression_build_test.sh index 8ac1ceece..765898821 100755 --- a/build_tools/regression_build_test.sh +++ b/build_tools/regression_build_test.sh @@ -55,7 +55,6 @@ make release --open_files=55000 \ --statistics=1 \ --histogram=1 \ - --disable_data_sync=1 \ --disable_wal=1 \ --sync=0 > ${STAT_FILE}.fillseq @@ -73,7 +72,6 @@ make release --open_files=55000 \ --statistics=1 \ --histogram=1 \ - --disable_data_sync=1 \ --disable_wal=1 \ --sync=0 \ --threads=8 > ${STAT_FILE}.overwrite @@ -92,7 +90,6 @@ make release --open_files=55000 \ --statistics=1 \ --histogram=1 \ - --disable_data_sync=1 \ --disable_wal=1 \ --sync=0 \ --threads=1 > /dev/null @@ -111,7 +108,6 @@ make release --open_files=55000 \ --statistics=1 \ --histogram=1 \ - --disable_data_sync=1 \ --disable_wal=1 \ --sync=0 \ --threads=16 > ${STAT_FILE}.readrandom @@ -131,7 +127,6 @@ make release --use_tailing_iterator=1 \ --statistics=1 \ --histogram=1 \ - --disable_data_sync=1 \ --disable_wal=1 \ --sync=0 \ --threads=16 > ${STAT_FILE}.readrandomtailing @@ -150,7 +145,6 @@ make release --open_files=55000 \ --statistics=1 \ --histogram=1 \ - --disable_data_sync=1 \ --disable_wal=1 \ --sync=0 \ --threads=16 > ${STAT_FILE}.readrandomsmallblockcache @@ -171,7 +165,6 @@ make release --open_files=55000 \ --statistics=1 \ --histogram=1 \ - --disable_data_sync=1 \ --disable_wal=1 \ --sync=0 \ --threads=16 > ${STAT_FILE}.readrandom_mem_sst @@ -191,7 +184,6 @@ make release --open_files=55000 \ --statistics=1 \ --histogram=1 \ - --disable_data_sync=1 \ --disable_wal=1 \ --sync=0 \ --threads=1 > /dev/null @@ -210,7 +202,6 @@ make release --open_files=55000 \ --statistics=1 \ --histogram=1 \ - --disable_data_sync=1 \ --disable_wal=1 \ --sync=0 \ --threads=16 > /dev/null @@ -230,7 +221,6 @@ make release --disable_auto_compactions=1 \ --statistics=1 \ --histogram=1 \ - --disable_data_sync=1 \ --disable_wal=1 \ --sync=0 \ --threads=16 > ${STAT_FILE}.readrandom_filluniquerandom @@ -251,7 +241,6 @@ make release --open_files=55000 \ --statistics=1 \ --histogram=1 \ - --disable_data_sync=1 \ --disable_wal=1 \ --sync=0 \ --threads=16 > ${STAT_FILE}.readwhilewriting @@ -270,7 +259,6 @@ make release --open_files=55000 \ --statistics=1 \ --histogram=1 \ - --disable_data_sync=1 \ --disable_wal=1 \ --sync=0 \ --value_size=10 \ @@ -295,7 +283,6 @@ common_in_mem_args="--db=/dev/shm/rocksdb \ --disable_wal=0 \ --wal_dir=/dev/shm/rocksdb \ --sync=0 \ - --disable_data_sync=1 \ --verify_checksum=1 \ --delete_obsolete_files_period_micros=314572800 \ --max_grandparent_overlap_factor=10 \ @@ -356,7 +343,6 @@ common_in_mem_args="--db=/dev/shm/rocksdb \ --open_files=55000 \ --statistics=1 \ --histogram=1 \ - --disable_data_sync=1 \ --disable_wal=1 \ --sync=0 > ${STAT_FILE}.fillseq_lots_column_families @@ -372,7 +358,6 @@ common_in_mem_args="--db=/dev/shm/rocksdb \ --open_files=55000 \ --statistics=1 \ --histogram=1 \ - --disable_data_sync=1 \ --disable_wal=1 \ --sync=0 \ --threads=8 > ${STAT_FILE}.overwrite_lots_column_families diff --git a/db/builder.cc b/db/builder.cc index d59146c3d..b06f1c4fc 100644 --- a/db/builder.cc +++ b/db/builder.cc @@ -170,7 +170,7 @@ Status BuildTable( delete builder; // 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); file_writer->Sync(ioptions.use_fsync); } diff --git a/db/c.cc b/db/c.cc index 2e4666648..68ecdb52c 100644 --- a/db/c.cc +++ b/db/c.cc @@ -1713,11 +1713,6 @@ void rocksdb_options_set_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( rocksdb_options_t* opt, int use_fsync) { opt->rep.use_fsync = use_fsync; diff --git a/db/column_family_test.cc b/db/column_family_test.cc index e55e434cd..5b898aea4 100644 --- a/db/column_family_test.cc +++ b/db/column_family_test.cc @@ -1148,7 +1148,6 @@ TEST_F(ColumnFamilyTest, DifferentCompactionStyles) { CreateColumnFamilies({"one", "two"}); ColumnFamilyOptions default_cf, one, two; db_options_.max_open_files = 20; // only 10 files in file cache - db_options_.disableDataSync = true; default_cf.compaction_style = kCompactionStyleLevel; default_cf.num_levels = 3; @@ -1221,7 +1220,6 @@ TEST_F(ColumnFamilyTest, MultipleManualCompactions) { CreateColumnFamilies({"one", "two"}); ColumnFamilyOptions default_cf, one, two; db_options_.max_open_files = 20; // only 10 files in file cache - db_options_.disableDataSync = true; db_options_.max_background_compactions = 3; default_cf.compaction_style = kCompactionStyleLevel; @@ -1319,7 +1317,6 @@ TEST_F(ColumnFamilyTest, AutomaticAndManualCompactions) { CreateColumnFamilies({"one", "two"}); ColumnFamilyOptions default_cf, one, two; db_options_.max_open_files = 20; // only 10 files in file cache - db_options_.disableDataSync = true; db_options_.max_background_compactions = 3; db_options_.base_background_compactions = 3; @@ -1412,7 +1409,6 @@ TEST_F(ColumnFamilyTest, ManualAndAutomaticCompactions) { CreateColumnFamilies({"one", "two"}); ColumnFamilyOptions default_cf, one, two; db_options_.max_open_files = 20; // only 10 files in file cache - db_options_.disableDataSync = true; db_options_.max_background_compactions = 3; db_options_.base_background_compactions = 3; @@ -1508,7 +1504,6 @@ TEST_F(ColumnFamilyTest, SameCFManualManualCompactions) { CreateColumnFamilies({"one"}); ColumnFamilyOptions default_cf, one; db_options_.max_open_files = 20; // only 10 files in file cache - db_options_.disableDataSync = true; db_options_.max_background_compactions = 3; db_options_.base_background_compactions = 3; @@ -1607,7 +1602,6 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactions) { CreateColumnFamilies({"one"}); ColumnFamilyOptions default_cf, one; db_options_.max_open_files = 20; // only 10 files in file cache - db_options_.disableDataSync = true; db_options_.max_background_compactions = 3; db_options_.base_background_compactions = 3; @@ -1697,7 +1691,6 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticCompactionsLevel) { CreateColumnFamilies({"one"}); ColumnFamilyOptions default_cf, one; db_options_.max_open_files = 20; // only 10 files in file cache - db_options_.disableDataSync = true; db_options_.max_background_compactions = 3; db_options_.base_background_compactions = 3; @@ -1794,7 +1787,6 @@ TEST_F(ColumnFamilyTest, SameCFManualAutomaticConflict) { CreateColumnFamilies({"one"}); ColumnFamilyOptions default_cf, one; db_options_.max_open_files = 20; // only 10 files in file cache - db_options_.disableDataSync = true; db_options_.max_background_compactions = 3; db_options_.base_background_compactions = 3; @@ -1914,7 +1906,6 @@ TEST_F(ColumnFamilyTest, SameCFAutomaticManualCompactions) { CreateColumnFamilies({"one"}); ColumnFamilyOptions default_cf, one; db_options_.max_open_files = 20; // only 10 files in file cache - db_options_.disableDataSync = true; db_options_.max_background_compactions = 3; db_options_.base_background_compactions = 3; diff --git a/db/compaction_job.cc b/db/compaction_job.cc index f345e1f96..5571312d3 100644 --- a/db/compaction_job.cc +++ b/db/compaction_job.cc @@ -538,7 +538,7 @@ Status CompactionJob::Run() { thread.join(); } - if (output_directory_ && !db_options_.disable_data_sync) { + if (output_directory_) { output_directory_->Fsync(); } @@ -1059,7 +1059,7 @@ Status CompactionJob::FinishCompactionOutputFile( sub_compact->total_bytes += current_bytes; // 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); s = sub_compact->outfile->Sync(db_options_.use_fsync); } diff --git a/db/db_impl.cc b/db/db_impl.cc index 09d75d841..79113ddf5 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1915,8 +1915,7 @@ Status DBImpl::FlushMemTableToOutputFile( Status s; if (logfile_number_ > 0 && - versions_->GetColumnFamilySet()->NumberOfColumnFamilies() > 0 && - !immutable_db_options_.disable_data_sync) { + versions_->GetColumnFamilySet()->NumberOfColumnFamilies() > 0) { // 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 // the host crashes after flushing and before WAL is persistent, the diff --git a/db/db_test.cc b/db/db_test.cc index f80303ed5..5e171bdc8 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -827,7 +827,6 @@ TEST_F(DBTest, GetPicksCorrectFile) { TEST_F(DBTest, GetEncountersEmptyLevel) { do { Options options = CurrentOptions(); - options.disableDataSync = true; CreateAndReopenWithCF({"pikachu"}, options); // Arrange for the following to happen: // * 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 TEST_F(DBTest, DynamicMemtableOptions) { const uint64_t k64KB = 1 << 16; diff --git a/db/filename.cc b/db/filename.cc index 04a692cef..6e48058e3 100644 --- a/db/filename.cc +++ b/db/filename.cc @@ -389,12 +389,8 @@ Status SetIdentityFile(Env* env, const std::string& dbname) { Status SyncManifest(Env* env, const ImmutableDBOptions* db_options, WritableFileWriter* file) { 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); - return file->Sync(db_options->use_fsync); - } + StopWatch sw(env, db_options->statistics.get(), MANIFEST_FILE_SYNC_MICROS); + return file->Sync(db_options->use_fsync); } } // namespace rocksdb diff --git a/db/flush_job.cc b/db/flush_job.cc index f7eb20f6f..6fc087149 100644 --- a/db/flush_job.cc +++ b/db/flush_job.cc @@ -313,7 +313,7 @@ Status FlushJob::WriteLevel0Table() { meta_.fd.GetFileSize(), s.ToString().c_str(), 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(); } TEST_SYNC_POINT("FlushJob::WriteLevel0Table"); diff --git a/db/version_set.cc b/db/version_set.cc index 432653adb..ffcd60241 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -2363,7 +2363,7 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data, if (s.ok() && new_descriptor_log) { s = SetCurrentFile( env_, dbname_, pending_manifest_file_number_, - db_options_->disable_data_sync ? nullptr : db_directory); + db_directory); } if (s.ok()) { diff --git a/examples/rocksdb_option_file_example.ini b/examples/rocksdb_option_file_example.ini index 61ef92b6d..a8f2b9010 100644 --- a/examples/rocksdb_option_file_example.ini +++ b/examples/rocksdb_option_file_example.ini @@ -62,13 +62,11 @@ create_missing_column_families=false paranoid_checks=true delete_obsolete_files_period_micros=21600000000 - disable_data_sync=false log_file_time_to_roll=0 compaction_readahead_size=0 create_if_missing=false use_adaptive_mutex=false enable_thread_tracking=false - disableDataSync=false allow_fallocate=true error_if_exists=false recycle_log_file_num=0 diff --git a/include/rocksdb/c.h b/include/rocksdb/c.h index 0962fb75f..4193c724c 100644 --- a/include/rocksdb/c.h +++ b/include/rocksdb/c.h @@ -705,8 +705,6 @@ rocksdb_options_set_verify_checksums_in_compaction(rocksdb_options_t*, extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_sequential_skip_in_iterations(rocksdb_options_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( rocksdb_options_t*, int); extern ROCKSDB_LIBRARY_API void rocksdb_options_set_optimize_filters_for_hits( diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index 5ab211aed..82a97fe75 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -948,14 +948,6 @@ struct DBOptions { // If non-null, then we should collect metrics about database operations std::shared_ptr 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 false, then every store to stable storage will issue a fdatasync. // This parameter should be set to true while storing data to diff --git a/java/benchmark/src/main/java/org/rocksdb/benchmark/DbBenchmark.java b/java/benchmark/src/main/java/org/rocksdb/benchmark/DbBenchmark.java index 926fb7432..20601a95f 100644 --- a/java/benchmark/src/main/java/org/rocksdb/benchmark/DbBenchmark.java +++ b/java/benchmark/src/main/java/org/rocksdb/benchmark/DbBenchmark.java @@ -545,8 +545,6 @@ public class DbBenchmark { (Integer)flags_.get(Flag.max_background_flushes)); options.setMaxOpenFiles( (Integer)flags_.get(Flag.open_files)); - options.setDisableDataSync( - (Boolean)flags_.get(Flag.disable_data_sync)); options.setUseFsync( (Boolean)flags_.get(Flag.use_fsync)); options.setWalDir( @@ -1225,12 +1223,6 @@ public class DbBenchmark { 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.") { @Override public Object parseValue(String value) { return parseBoolean(value); diff --git a/java/rocksjni/options.cc b/java/rocksjni/options.cc index 9ba02cfef..83af11e95 100644 --- a/java/rocksjni/options.cc +++ b/java/rocksjni/options.cc @@ -342,27 +342,6 @@ void Java_org_rocksdb_Options_setMaxOpenFiles( static_cast(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(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(jhandle)->disableDataSync = - static_cast(disableDataSync); -} - /* * Class: org_rocksdb_Options * Method: useFsync @@ -3748,27 +3727,6 @@ jlong Java_org_rocksdb_DBOptions_statisticsPtr( return reinterpret_cast(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(jhandle)->disableDataSync = - static_cast(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(jhandle)->disableDataSync; -} - /* * Class: org_rocksdb_DBOptions * Method: setUseFsync diff --git a/java/src/main/java/org/rocksdb/DBOptions.java b/java/src/main/java/org/rocksdb/DBOptions.java index 411edd7e4..22bde7147 100644 --- a/java/src/main/java/org/rocksdb/DBOptions.java +++ b/java/src/main/java/org/rocksdb/DBOptions.java @@ -221,20 +221,6 @@ public class DBOptions extends RocksObject implements DBOptionsInterface { 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 public DBOptions setUseFsync( final boolean useFsync) { @@ -680,8 +666,6 @@ public long delayedWriteRate(){ private native long maxTotalWalSize(long handle); private native void createStatistics(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 void setUseFsync(long handle, boolean useFsync); private native void setDbLogDir(long handle, String dbLogDir); diff --git a/java/src/main/java/org/rocksdb/DBOptionsInterface.java b/java/src/main/java/org/rocksdb/DBOptionsInterface.java index 95f5db4b1..e762119d5 100644 --- a/java/src/main/java/org/rocksdb/DBOptionsInterface.java +++ b/java/src/main/java/org/rocksdb/DBOptionsInterface.java @@ -242,35 +242,6 @@ public interface DBOptionsInterface { */ Statistics statisticsPtr(); - /** - *

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.

- * - *

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

- * - * @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(); - /** *

If true, then every store to stable storage will issue a fsync.

*

If false, then every store to stable storage will issue a fdatasync. diff --git a/java/src/main/java/org/rocksdb/Options.java b/java/src/main/java/org/rocksdb/Options.java index 22b5d244a..13d308fde 100644 --- a/java/src/main/java/org/rocksdb/Options.java +++ b/java/src/main/java/org/rocksdb/Options.java @@ -270,19 +270,6 @@ public class Options extends RocksObject 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 public boolean useFsync() { assert(isOwningHandle()); @@ -1256,8 +1243,6 @@ public class Options extends RocksObject private native long maxTotalWalSize(long handle); private native void createStatistics(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 void setUseFsync(long handle, boolean useFsync); private native void setDbLogDir(long handle, String dbLogDir); diff --git a/java/src/test/java/org/rocksdb/DBOptionsTest.java b/java/src/test/java/org/rocksdb/DBOptionsTest.java index c1d908ea6..ac00d1d16 100644 --- a/java/src/test/java/org/rocksdb/DBOptionsTest.java +++ b/java/src/test/java/org/rocksdb/DBOptionsTest.java @@ -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 public void useFsync() { try(final DBOptions opt = new DBOptions()) { diff --git a/java/src/test/java/org/rocksdb/OptionsTest.java b/java/src/test/java/org/rocksdb/OptionsTest.java index be04598b1..26380451c 100644 --- a/java/src/test/java/org/rocksdb/OptionsTest.java +++ b/java/src/test/java/org/rocksdb/OptionsTest.java @@ -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 public void useFsync() { try (final Options opt = new Options()) { diff --git a/table/sst_file_writer.cc b/table/sst_file_writer.cc index 2c3c63547..59ae70157 100644 --- a/table/sst_file_writer.cc +++ b/table/sst_file_writer.cc @@ -184,9 +184,7 @@ Status SstFileWriter::Finish(ExternalSstFileInfo* file_info) { r->file_info.file_size = r->builder->FileSize(); 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 */); if (s.ok()) { s = r->file_writer->Close(); diff --git a/tools/benchmark.sh b/tools/benchmark.sh index 5298bbe07..708c22e59 100755 --- a/tools/benchmark.sh +++ b/tools/benchmark.sh @@ -61,7 +61,6 @@ block_size=${BLOCK_SIZE:-8192} const_params=" --db=$DB_DIR \ --wal_dir=$WAL_DIR \ - --disable_data_sync=0 \ \ --num=$num_keys \ --num_levels=6 \ diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index c4268dcc9..14f8ada9f 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -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(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(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.random_access_max_buffer_size = FLAGS_random_access_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.num_levels = FLAGS_num_levels; options.target_file_size_base = FLAGS_target_file_size_base; diff --git a/tools/db_bench_tool_test.cc b/tools/db_bench_tool_test.cc index 025556d4b..eae1e82a7 100644 --- a/tools/db_bench_tool_test.cc +++ b/tools/db_bench_tool_test.cc @@ -200,9 +200,7 @@ const std::string options_file_content = R"OPTIONS_FILE( is_fd_close_on_exec=true bytes_per_sync=1048576 enable_thread_tracking=true - disable_data_sync=false recycle_log_file_num=0 - disableDataSync=false create_missing_column_families=false log_file_time_to_roll=0 max_background_flushes=1 diff --git a/tools/db_crashtest.py b/tools/db_crashtest.py index 66f362155..d28e7a1a2 100644 --- a/tools/db_crashtest.py +++ b/tools/db_crashtest.py @@ -22,7 +22,6 @@ default_params = { "use_clock_cache": "false", "delpercent": 5, "destroy_db_initially": 0, - "disable_data_sync": 0, "disable_wal": 0, "allow_concurrent_memtable_write": 0, "iterpercent": 10, @@ -89,7 +88,6 @@ simple_default_params = { "column_families": 1, "delpercent": 5, "destroy_db_initially": 0, - "disable_data_sync": 0, "disable_wal": 0, "allow_concurrent_memtable_write": lambda: random.randint(0, 1), "iterpercent": 10, diff --git a/tools/db_stress.cc b/tools/db_stress.cc index 3177cb1d1..1df218214 100644 --- a/tools/db_stress.cc +++ b/tools/db_stress.cc @@ -276,9 +276,6 @@ DEFINE_bool(statistics, false, "Create database statistics"); 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_int32(kill_random_test, 0, @@ -2143,7 +2140,6 @@ class StressTest { options_.max_open_files = FLAGS_open_files; options_.statistics = dbstats; options_.env = FLAGS_env; - options_.disableDataSync = FLAGS_disable_data_sync; options_.use_fsync = FLAGS_use_fsync; options_.allow_mmap_reads = FLAGS_mmap_read; options_.target_file_size_base = FLAGS_target_file_size_base; diff --git a/util/cf_options.cc b/util/cf_options.cc index e91bdc85c..a6da3e92e 100644 --- a/util/cf_options.cc +++ b/util/cf_options.cc @@ -55,7 +55,6 @@ ImmutableCFOptions::ImmutableCFOptions(const ImmutableDBOptions& db_options, bloom_locality(cf_options.bloom_locality), 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), compression_per_level(cf_options.compression_per_level), bottommost_compression(cf_options.bottommost_compression), diff --git a/util/cf_options.h b/util/cf_options.h index 46e093cdf..0354a0175 100644 --- a/util/cf_options.h +++ b/util/cf_options.h @@ -86,8 +86,6 @@ struct ImmutableCFOptions { bool purge_redundant_kvs_while_flush; - bool disable_data_sync; - bool use_fsync; std::vector compression_per_level; diff --git a/util/db_options.cc b/util/db_options.cc index 8e141d728..5fe469270 100644 --- a/util/db_options.cc +++ b/util/db_options.cc @@ -34,7 +34,6 @@ ImmutableDBOptions::ImmutableDBOptions(const DBOptions& options) max_open_files(options.max_open_files), max_file_opening_threads(options.max_file_opening_threads), statistics(options.statistics), - disable_data_sync(options.disableDataSync), use_fsync(options.use_fsync), db_paths(options.db_paths), db_log_dir(options.db_log_dir), @@ -102,8 +101,6 @@ void ImmutableDBOptions::Dump(Logger* log) const { max_open_files); Header(log, " Options.max_file_opening_threads: %d", max_file_opening_threads); - Header(log, " Options.disableDataSync: %d", - disable_data_sync); Header(log, " Options.use_fsync: %d", use_fsync); Header(log, " Options.max_log_file_size: %" ROCKSDB_PRIszt, diff --git a/util/db_options.h b/util/db_options.h index e50d158a4..c7edb13c0 100644 --- a/util/db_options.h +++ b/util/db_options.h @@ -30,7 +30,6 @@ struct ImmutableDBOptions { int max_open_files; int max_file_opening_threads; std::shared_ptr statistics; - bool disable_data_sync; bool use_fsync; std::vector db_paths; std::string db_log_dir; diff --git a/util/options.cc b/util/options.cc index 6df137dbe..c582b468d 100644 --- a/util/options.cc +++ b/util/options.cc @@ -133,7 +133,6 @@ DBOptions::DBOptions(const Options& options) max_file_opening_threads(options.max_file_opening_threads), max_total_wal_size(options.max_total_wal_size), statistics(options.statistics), - disableDataSync(options.disableDataSync), use_fsync(options.use_fsync), db_paths(options.db_paths), db_log_dir(options.db_log_dir), @@ -387,7 +386,6 @@ Options::PrepareForBulkLoad() // no auto compactions please. The application should issue a // manual compaction after all data is loaded into L0. disable_auto_compactions = true; - disableDataSync = true; // A manual compaction run should pick all files in L0 in // a single compaction run. max_compaction_bytes = (static_cast(1) << 60); diff --git a/util/options_helper.cc b/util/options_helper.cc index 66763eb3c..2aa071bd8 100644 --- a/util/options_helper.cc +++ b/util/options_helper.cc @@ -47,7 +47,6 @@ DBOptions BuildDBOptions(const ImmutableDBOptions& immutable_db_options, immutable_db_options.max_file_opening_threads; options.max_total_wal_size = mutable_db_options.max_total_wal_size; options.statistics = immutable_db_options.statistics; - options.disableDataSync = immutable_db_options.disable_data_sync; options.use_fsync = immutable_db_options.use_fsync; options.db_paths = immutable_db_options.db_paths; options.db_log_dir = immutable_db_options.db_log_dir; diff --git a/util/options_helper.h b/util/options_helper.h index 1af4aa300..bd938c573 100644 --- a/util/options_helper.h +++ b/util/options_helper.h @@ -214,11 +214,9 @@ static std::unordered_map db_options_type_info = { {offsetof(struct DBOptions, create_missing_column_families), OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}}, {"disableDataSync", - {offsetof(struct DBOptions, disableDataSync), OptionType::kBoolean, - OptionVerificationType::kNormal, false, 0}}, + {0, OptionType::kBoolean, OptionVerificationType::kDeprecated, false, 0}}, {"disable_data_sync", // for compatibility - {offsetof(struct DBOptions, disableDataSync), OptionType::kBoolean, - OptionVerificationType::kNormal, false, 0}}, + {0, OptionType::kBoolean, OptionVerificationType::kDeprecated, false, 0}}, {"enable_thread_tracking", {offsetof(struct DBOptions, enable_thread_tracking), OptionType::kBoolean, OptionVerificationType::kNormal, false, 0}}, diff --git a/util/options_settable_test.cc b/util/options_settable_test.cc index 243e90bba..9b0cedc4b 100644 --- a/util/options_settable_test.cc +++ b/util/options_settable_test.cc @@ -260,9 +260,7 @@ TEST_F(OptionsSettableTest, DBOptionsAllFieldsSettable) { "is_fd_close_on_exec=false;" "bytes_per_sync=4295013613;" "enable_thread_tracking=false;" - "disable_data_sync=false;" "recycle_log_file_num=0;" - "disableDataSync=false;" "create_missing_column_families=true;" "log_file_time_to_roll=3097;" "max_background_flushes=35;" diff --git a/util/options_test.cc b/util/options_test.cc index 178af7044..3d0b997c2 100644 --- a/util/options_test.cc +++ b/util/options_test.cc @@ -100,7 +100,6 @@ TEST_F(OptionsTest, GetOptionsFromMapTest) { {"paranoid_checks", "true"}, {"max_open_files", "32"}, {"max_total_wal_size", "33"}, - {"disable_data_sync", "false"}, {"use_fsync", "true"}, {"db_log_dir", "/db_log_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.max_open_files, 32); ASSERT_EQ(new_db_opt.max_total_wal_size, static_cast(33)); - ASSERT_EQ(new_db_opt.disableDataSync, false); ASSERT_EQ(new_db_opt.use_fsync, true); ASSERT_EQ(new_db_opt.db_log_dir, "/db_log_dir"); ASSERT_EQ(new_db_opt.wal_dir, "/wal_dir"); diff --git a/util/testutil.cc b/util/testutil.cc index 8642df295..02de9a239 100644 --- a/util/testutil.cc +++ b/util/testutil.cc @@ -244,7 +244,6 @@ void RandomInitDBOptions(DBOptions* db_opt, Random* rnd) { db_opt->use_direct_writes = rnd->Uniform(2); db_opt->create_if_missing = 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->error_if_exists = rnd->Uniform(2); db_opt->is_fd_close_on_exec = rnd->Uniform(2); diff --git a/utilities/spatialdb/spatial_db.cc b/utilities/spatialdb/spatial_db.cc index ec10ce78f..d05fd6b90 100644 --- a/utilities/spatialdb/spatial_db.cc +++ b/utilities/spatialdb/spatial_db.cc @@ -698,7 +698,6 @@ DBOptions GetDBOptionsFromSpatialDBOptions(const SpatialDBOptions& options) { db_options.statistics = CreateDBStatistics(); if (options.bulk_load) { db_options.stats_dump_period_sec = 600; - db_options.disableDataSync = true; } else { db_options.stats_dump_period_sec = 1800; // 30min }