summaryrefslogtreecommitdiff
path: root/db/fault_injection_test.cc
Commit message (Collapse)AuthorAgeFilesLines
* Remove main() from most tests.Victor Costan2022-01-031-5/+0
| | | | | | | | | | | | | | | This gives some flexibility to embedders. Currently, embedders have to build a binary for each test file. After this CL, embedders can still choose to have a binary for each test file, by linking each test file with a googletest target that includes main() (usually "gtest_main"). Embedders can also choose to build a single binary for almost all test files, and link with a googletest target that includes main(). The latter is more convenient for projects that have very few test binaries, like Chromium. PiperOrigin-RevId: 419470798
* Add some std:: qualifiers to types and functions.Victor Costan2020-04-291-2/+2
| | | | PiperOrigin-RevId: 309110431
* Remove Windows workarounds in some tests.Victor Costan2020-01-141-5/+0
| | | | | | | leveldb::Env::DeleteFile was replaced with leveldb::Env::RemoveFile in all tests. This allows us to remove workarounds for windows.h #defining DeleteFile. PiperOrigin-RevId: 289121105
* Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}.Victor Costan2020-01-091-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "DeleteFile" method name causes pain for Windows developers, because <windows.h> #defines a DeleteFile macro to DeleteFileW or DeleteFileA. Current code uses workarounds, like #undefining DeleteFile everywhere an Env is declared, implemented, or used. This CL removes the need for workarounds by renaming Env::DeleteFile to Env::RemoveFile. For consistency, Env::DeleteDir is also renamed to Env::RemoveDir. A few internal methods are also renamed for consistency. Software that supports Windows is expected to migrate any Env implementations and usage to Remove{File,Dir}, and never use the name Env::Delete{File,Dir} in its code. The renaming is done in a backwards-compatible way, at the risk of making it slightly more difficult to build a new correct Env implementation. The backwards compatibility is achieved using the following hacks: 1) Env::Remove{File,Dir} methods are added, with a default implementation that calls into Env::Delete{File,Dir}. This makes old Env implementations compatible with code that calls into the updated API. 2) The Env::Delete{File,Dir} methods are no longer pure virtuals. Instead, they gain a default implementation that calls into Env::Remove{File,Dir}. This makes updated Env implementations compatible with code that calls into the old API. The cost of this approach is that it's possible to write an Env without overriding either Rename{File,Dir} or Delete{File,Dir}, without getting a compiler warning. However, attempting to run the test suite will immediately fail with an infinite call stack ending in {Remove,Delete}{File,Dir}, making developers aware of the problem. PiperOrigin-RevId: 288710907
* Defend against inclusion of windows.h in tests that invokeleveldb Team2020-01-091-0/+5
| | | | | | Env::DeleteFile. PiperOrigin-RevId: 283607548
* Internal change.leveldb Team2019-12-021-1/+1
| | | | PiperOrigin-RevId: 282373286
* Switch testing harness to googletest.Victor Costan2019-11-211-18/+22
| | | | PiperOrigin-RevId: 281815695
* Style cleanup.Victor Costan2019-05-041-21/+24
| | | | | | | | | 1) Convert iterator-based for loops to C++11 foreach loops. 2) Convert "void operator=" to "T& operator=". 3) Switch from copy operators from private to public deleted. 4) Switch from empty ctors / dtors to "= default" where appropriate. PiperOrigin-RevId: 246679195
* Format all files IAW the Google C++ Style Guide.Chris Mumford2019-05-021-28/+15
| | | | | | Use clang-format to correct formatting to be in agreement with the [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html). Doing this simplifies the process of accepting changes. Also fixed a few warnings flagged by clang-tidy. PiperOrigin-RevId: 246350737
* Inline defaults in options.costan2019-03-201-1/+0
| | | | | | | | | | This CL moves default values for leveldb::{Options,ReadOptions,WriteOptions} from constructors to member declarations, and removes now-redundant comments stating the defaults. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=239271242
* Remove ssize_t from code that is not POSIX-specific.costan2018-09-041-4/+4
| | | | | | | | | | | | | ssize_t is not standard C++. It is a POSIX extension. Therefore, it does not belong in generic code. This change tweaks the logic in DBIter to remove the need for signed integers, so ssize_t can be replaced with size_t. The impacted method and private member are renamed to better express their purpose. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=211471606
* Replace NULL with nullptr in C++ files.costan2018-04-101-5/+5
| | | | | | ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=192365747
* leveldb: Add more thread safety annotations.costan2018-03-231-9/+17
| | | | | | | | After this CL, all classes with Mutex members should be covered by annotations. Exceptions are atomic members, which shouldn't need locking, and DBImpl members that cause errors when annotated, which will be tackled separately. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=190260865
* Fix typo (forgotten reference operator) in test.costan2017-10-101-1/+1
| | | | | | ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=171708408
* LevelDB now attempts to reuse the preceding MANIFEST and log file when ↵Sanjay Ghemawat2015-08-111-68/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Added a new fault injection test.Chris Mumford2014-12-111-0/+542
This test is intended to ensure leveldb properly detects and recovers from faults - specifically unwritten file data lost as a result of a system reset.