summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Add Env::Remove{File,Dir} which obsolete Env::Delete{File,Dir}.env_renameVictor Costan2019-12-0223-90/+140
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add WITHOUT ROWID to SQLite benchmark.Victor Costan2019-12-021-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SQLite-specific schema feature is documented at https://www.sqlite.org/withoutrowid.html and https://www.sqlite.org/rowidtable.html. By default, SQLite stores each table in a B-tree keyed by an integer, called the ROWID. Any index, including the PRIMARY KEY index, is a separate B-tree mapping index keys to ROWIDs. Tables without ROWIDs are stored in a B-tree keyed by the primary key. Additional indexes (the PRIMARY KEY index is implicitly built into the table) are stored as B-trees mapping index keys to row primary keys. This CL introduces a boolean --use-rowids flag to db_bench_sqlite. When the flag is false (default), the schema of the test table includes WITHOUT ROWID. The test table uses a primary key, so adding WITHOUT ROWID to the schema reduces the number of B-trees used by the benchmark from 2 to 1. This brings SQLite's disk usage closer to LevelDB. When WITHOUT ROWID is used, SQLite fares better (than today) on benchmarks with small (16-byte) keys, and worse on benchmarks with large (100kb) keys. Baseline results: fillseq : 21.310 micros/op; 5.2 MB/s fillseqsync : 146.377 micros/op; 0.8 MB/s (10000 ops) fillseqbatch : 2.065 micros/op; 53.6 MB/s fillrandom : 34.767 micros/op; 3.2 MB/s fillrandsync : 159.943 micros/op; 0.7 MB/s (10000 ops) fillrandbatch : 15.055 micros/op; 7.3 MB/s overwrite : 43.660 micros/op; 2.5 MB/s overwritebatch : 27.691 micros/op; 4.0 MB/s readrandom : 12.725 micros/op; readseq : 2.602 micros/op; 36.7 MB/s fillrand100K : 606.333 micros/op; 157.3 MB/s (1000 ops) fillseq100K : 657.457 micros/op; 145.1 MB/s (1000 ops) readseq : 46.523 micros/op; 2049.9 MB/s readrand100K : 54.943 micros/op; Results after this CL: fillseq : 16.231 micros/op; 6.8 MB/s fillseqsync : 147.460 micros/op; 0.8 MB/s (10000 ops) fillseqbatch : 2.294 micros/op; 48.2 MB/s fillrandom : 27.871 micros/op; 4.0 MB/s fillrandsync : 141.979 micros/op; 0.8 MB/s (10000 ops) fillrandbatch : 16.087 micros/op; 6.9 MB/s overwrite : 26.829 micros/op; 4.1 MB/s overwritebatch : 19.014 micros/op; 5.8 MB/s readrandom : 11.657 micros/op; readseq : 0.155 micros/op; 615.0 MB/s fillrand100K : 816.812 micros/op; 116.8 MB/s (1000 ops) fillseq100K : 754.689 micros/op; 126.4 MB/s (1000 ops) readseq : 47.112 micros/op; 2024.3 MB/s readrand100K : 287.679 micros/op; Results after this CL, with --use-rowids=1 fillseq : 20.655 micros/op; 5.4 MB/s fillseqsync : 146.408 micros/op; 0.8 MB/s (10000 ops) fillseqbatch : 2.045 micros/op; 54.1 MB/s fillrandom : 34.080 micros/op; 3.2 MB/s fillrandsync : 154.582 micros/op; 0.7 MB/s (10000 ops) fillrandbatch : 14.404 micros/op; 7.7 MB/s overwrite : 42.928 micros/op; 2.6 MB/s overwritebatch : 27.829 micros/op; 4.0 MB/s readrandom : 12.835 micros/op; readseq : 2.483 micros/op; 38.4 MB/s fillrand100K : 603.265 micros/op; 158.1 MB/s (1000 ops) fillseq100K : 662.473 micros/op; 144.0 MB/s (1000 ops) readseq : 45.478 micros/op; 2097.0 MB/s readrand100K : 54.439 micros/op; PiperOrigin-RevId: 283407101
* Merge pull request #756 from pwnall/third_party_2Victor Costan2019-12-021-0/+0
|\ | | | | Fixup for adding the third_party/googletest submodule.
| * Fixup for adding the third_party/googletest submodule.Victor Costan2019-12-021-0/+0
|/
* Internal change.leveldb Team2019-12-0232-32/+32
| | | | PiperOrigin-RevId: 282373286
* Fixup for adding the third_party/googletest submodule. (#754)Victor Costan2019-11-251-0/+0
|
* Switch testing harness to googletest.Victor Costan2019-11-2137-863/+763
| | | | PiperOrigin-RevId: 281815695
* Move CI to Visual Studio 2019.Victor Costan2019-11-111-5/+6
| | | | PiperOrigin-RevId: 279785825
* Allow different C/C++ standards when this is used as a subproject.Victor Costan2019-11-101-9/+15
| | | | | | Inspired by https://github.com/google/snappy/pull/85 PiperOrigin-RevId: 279649967
* Align CMake configuration with related projects.Victor Costan2019-11-073-8/+21
| | | | PiperOrigin-RevId: 279238007
* Remove redundant PROJECT_SOURCE_DIR usage from CMake config.Victor Costan2019-11-051-142/+142
| | | | | | Inspired by https://github.com/google/crc32c/pull/32 PiperOrigin-RevId: 278718726
* Fix installed target definition.Victor Costan2019-11-051-1/+3
| | | | | | | | | | Using CMAKE_INSTALL_INCLUDEDIR before including GNUINstallDirs results in a broken installation when CMAKE_INSTALL_PREFIX is a non-standard directory. Inspired from https://github.com/google/crc32c/pull/39 PiperOrigin-RevId: 278427974
* Test CMake installation on Travis.Victor Costan2019-11-031-0/+2
| | | | PiperOrigin-RevId: 278300591
* Renamed local variable in DBImpl::Write.Chris Mumford2019-10-281-6/+6
| | | | | | | The local variable `updates` in DBImpl::Write was hiding the `updates` parameter. Renamed to avoid this conflict. PiperOrigin-RevId: 277089971
* Added return in Version::Get::State::Match to quiet warning.Chris Mumford2019-10-281-0/+4
| | | | | | | | | | | | | | Added unreached return at the end of Version::Get::State::Match to stop this _incorrect_ warning: version_set.cc:376:5: warning: control reaches end of non-void function [-Wreturn-type] This warning was being emitted when building with clang 6.0.1-10 and also emitted by lgtm.com when statically analyzing leveldb even though all SaverState enumeration values were handled. PiperOrigin-RevId: 272455474
* Using CMake's check_cxx_compiler_flag to check support for -Wthread-safety.Chris Mumford2019-10-011-17/+4
| | | | | | | | | | | | | | | Previously used check_cxx_source_compiles to attempt a build to determine support for clang thread safety checks. This change is to support static analysis of the leveldb source by lgtm.com (using Semmle). It failed to build with the following error: ``` [2019-07-04 22:29:58] [build] c++: error: unrecognized command line option ‘-Wthread-safety’; did you mean ‘-fthread-jumps’? [2019-07-04 22:30:02] [build] make[2]: *** [CMakeFiles/leveldb.dir/build.make:66: CMakeFiles/leveldb.dir/db/builder.cc.o] Error 1 ``` PiperOrigin-RevId: 272275528
* Update Travis CI configuration.Victor Costan2019-09-291-10/+11
| | | | | | | * Use Ubuntu 18.04 and LLVM 9 on Travis. * Fix bash conditionals: [ a == b ] should be [ a = b ]. PiperOrigin-RevId: 271898719
* Fix tsan problem in env_test.Sanjay Ghemawat2019-09-291-37/+49
| | | | PiperOrigin-RevId: 268265314
* Merge pull request #698 from neal-zhu:masterVictor Costan2019-08-281-77/+53
|\ | | | | | | PiperOrigin-RevId: 266001777
| * drop fileds in State that are duplicates of fileds in Saver and fix typoneal-zhu2019-08-281-12/+7
| |
| * cache Saver in State objectneal-zhu2019-06-121-21/+20
| |
| * fix bug(uninitialized options pointer in State)neal-zhu2019-06-121-7/+8
| |
| * remove TODO in Version::ForEachOverlappingneal-zhu2019-06-111-1/+0
| |
| * formatneal-zhu2019-06-111-6/+7
| |
| * fix bugneal-zhu2019-06-111-8/+14
| |
| * use ForEachOverlapping to impl Getneal-zhu2019-06-111-70/+45
| |
* | Simplify unlocking in DeleteObsoleteFiles.Chris Mumford2019-06-131-12/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A recent change (4cb80b7ddce6f) to DBImpl::DeleteObsoleteFiles unlocked DBImpl::mutex_ while deleting files to allow for greater concurrency. This change improves on the prior in a few areas: 1. The table is evicted from the table cache before unlocking the mutex. This should only improve performance. 2. This implementation is slightly simpler, but at the cost of a bit more memory usage. 3. A comment adding more detail as to why the mutex is being unlocked and why it is safe to do so. PiperOrigin-RevId: 253111645
* | Add "leveldb" subdirectory to public include paths.Chris Mumford2019-06-132-11/+11
| | | | | | | | | | | | | | The documentation (README.md and index.md) referred to the public headers using an incorrect path - fixing. PiperOrigin-RevId: 252922925
* | Ending sentences with periods in README.md.Chris Mumford2019-06-131-4/+4
| | | | | | | | | | | | | | | | | | This change was submitted in https://github.com/google/leveldb/pull/575 by @prajwalchalla. This fixes issue #523. PiperOrigin-RevId: 252912613
* | Align EnvPosix and EnvWindows.Victor Costan2019-06-132-227/+316
| | | | | | | | | | | | Fixes #695. PiperOrigin-RevId: 252895299
* | Disable exceptions and RTTI in CMake configuration.Victor Costan2019-06-131-2/+24
|/ | | | PiperOrigin-RevId: 252842234
* Merge pull request #386 from ivanabc:masterChris Mumford2019-05-301-3/+10
|\ | | | | | | PiperOrigin-RevId: 250702492
| * Merge branch 'master' into masterivan2019-05-23160-7134/+10265
| |\
| * | set const propertyivanabc2016-06-211-3/+5
| | |
| * | reduce lock's range in DeleteObsoleteFilesivanabc2016-06-201-3/+12
| | |
* | | Replace "> >" with ">>"Victor Costan2019-05-302-4/+4
| | | | | | | | | | | | PiperOrigin-RevId: 250383036
* | | unsigned char -> uint8_tVictor Costan2019-05-2811-59/+55
| | | | | | | | | | | | PiperOrigin-RevId: 250309603
* | | Use GCC 9 on Travis CIVictor Costan2019-05-241-4/+4
| | | | | | | | | | | | PiperOrigin-RevId: 249899128
* | | Add explicit typecasts to avoid compiler warning.Chris Mumford2019-05-241-2/+2
| |/ |/| | | | | | | | | Fixes issue #684. PiperOrigin-RevId: 249531001
* | Guard DBImpl::versions_ by mutex_.Chris Mumford2019-05-162-12/+7
| | | | | | | | | | | | | | | | mutex_ was already acquired before accessing DBImpl::versions_ in all but one place: DBImpl::GetApproximateSizes. This change requires mutex_ to be held before accessing versions_. PiperOrigin-RevId: 248390814
* | Converted two for-loops to while-loops.Chris Mumford2019-05-132-2/+2
| | | | | | | | | | | | Converted `for (;<condition>;)` to `while (<condition>)`. PiperOrigin-RevId: 247950510
* | Switch to using C++ 11 override specifier.Chris Mumford2019-05-0919-160/+161
| | | | | | | | PiperOrigin-RevId: 247491163
* | Added unit test for InternalKey::DecodeFrom with empty string.Chris Mumford2019-05-091-0/+6
| | | | | | | | PiperOrigin-RevId: 247483339
* | Merge pull request #411 from proller:assert1Chris Mumford2019-05-092-3/+6
|\ \ | | | | | | | | | PiperOrigin-RevId: 247424040
| * | broken db: fix assertion in leveldb::InternalKey::Encode, mark base as corruptproller2016-10-032-3/+6
| | |
* | | Using std::ostringstream in key DebugString.Chris Mumford2019-05-082-13/+24
| | | | | | | | | | | | | | | | | | | | | Switching from snprintf to std::ostringstream eliminates cast warning for (unsigned long long). PiperOrigin-RevId: 247326681
* | | Merge pull request #457 from jellor:patch-2Chris Mumford2019-05-081-1/+1
|\ \ \ | | | | | | | | | | | | PiperOrigin-RevId: 247261470
| * \ \ Merge branch 'master' into patch-2果冻2019-05-09152-6259/+8094
| |\ \ \ | |/ / / |/| | |
* | | | Fix EnvPosix tests on Travis CI.Victor Costan2019-05-072-87/+280
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous attempt of having EnvPosix use O_CLOEXEC (close-on-exec()) when opening file descriptors added tests that relied on procfs, which is Linux-specific. These tests failed on macOS. Unfortunately, the test failures were not caught due to a (since fixed) error in our Travis CI configuration. This CL re-structures the tests to only rely on POSIX features. Since there is no POSIX-compliant way to get a file name/path out of a file descriptor, this CL breaks up the O_CLOEXEC test into multiple tests, where each Env method that creates an FD gets its own test. This is intended to make it easier to find and fix errors in Env implementations. This CL also fixes the implementation of NewLogger() to use O_CLOEXEC on macOS. The current implementation passes "we" to fopen(), but the macOS standard C library does not implement the "e" flag yet. PiperOrigin-RevId: 247088953
* | | | Formatting changes for prior O_CLOEXEC fix.Chris Mumford2019-05-062-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Two minor corrections to correct the 900f7d37eb322 commit to conform to the Google C++ style guide. PiperOrigin-RevId: 246907647