diff options
author | Sanjay Ghemawat <sanjay@google.com> | 2014-12-11 08:13:18 -0800 |
---|---|---|
committer | Chris Mumford <cmumford@chromium.org> | 2015-08-11 14:56:39 -0700 |
commit | ac1d69da31205a979b5a8510f33c31ae977530f0 (patch) | |
tree | a1bbfceb74a93d34bda9544f8ad62f3555884805 /util/testutil.h | |
parent | 77948e7eec0613fb5cbecb7e320b9498607030b5 (diff) | |
download | leveldb-ac1d69da31205a979b5a8510f33c31ae977530f0.tar.gz |
LevelDB now attempts to reuse the preceding MANIFEST and log file when re-opened.
(Based on a suggestion by cmumford.)
"open" benchmark on my workstation speeds up significantly since we
can now avoid three fdatasync calls and a compaction per open:
Before: ~80000 microseconds
After: ~130 microseconds
Details:
(1) Added Options::reuse_logs (currently defaults to false) to control
new behavior. The intention is to change the default to true after some
baking.
(2) Added Env::NewAppendableFile() whose default implementation returns
a not-supported error.
(3) VersionSet::Recovery attempts to reuse the MANIFEST from which
it is recovering.
(4) DBImpl recovery attempts to reuse the last log file and memtable.
(5) db_test.cc now tests a new configuration that sets reuse_logs to true.
(6) fault_injection_test also tests a reuse_logs==true config.
(7) Added a new recovery_test.
Diffstat (limited to 'util/testutil.h')
-rw-r--r-- | util/testutil.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/util/testutil.h b/util/testutil.h index adad3fc..d7e4583 100644 --- a/util/testutil.h +++ b/util/testutil.h @@ -45,6 +45,16 @@ class ErrorEnv : public EnvWrapper { } return target()->NewWritableFile(fname, result); } + + virtual Status NewAppendableFile(const std::string& fname, + WritableFile** result) { + if (writable_file_error_) { + ++num_writable_file_errors_; + *result = NULL; + return Status::IOError(fname, "fake error"); + } + return target()->NewAppendableFile(fname, result); + } }; } // namespace test |