mirror of https://github.com/facebook/rocksdb.git
Introduce a new option disableDataSync for opening the database. If this is set to true, then the data written to newly created data files are not sycned to disk, instead depend on the OS to flush dirty data to stable storage. This option is good for bulk
Test Plan: manual tests Task ID: # Blame Rev: Differential Revision: https://reviews.facebook.net/D4515
This commit is contained in:
parent
c44be54dd2
commit
c3096afd61
|
@ -810,7 +810,7 @@ Status DBImpl::FinishCompactionOutputFile(CompactionState* compact,
|
|||
compact->builder = NULL;
|
||||
|
||||
// Finish and check for file errors
|
||||
if (s.ok()) {
|
||||
if (s.ok() && !options_.disableDataSync) {
|
||||
s = compact->outfile->Sync();
|
||||
}
|
||||
if (s.ok()) {
|
||||
|
|
|
@ -190,6 +190,14 @@ struct Options {
|
|||
// If non-null, then we should collect metrics about database operations
|
||||
Statistics* statistics;
|
||||
|
||||
// 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 buffesrs to stable storage.
|
||||
// Default: false
|
||||
bool disableDataSync;
|
||||
|
||||
// Create an Options object with default values for all fields.
|
||||
Options();
|
||||
};
|
||||
|
|
|
@ -34,7 +34,8 @@ Options::Options()
|
|||
expanded_compaction_factor(25),
|
||||
max_grandparent_overlap_factor(10),
|
||||
filter_policy(NULL),
|
||||
statistics(NULL) {
|
||||
statistics(NULL),
|
||||
disableDataSync(false) {
|
||||
}
|
||||
|
||||
} // namespace leveldb
|
||||
|
|
Loading…
Reference in New Issue