1. 02 4月, 2020 1 次提交
    • Z
      Add pipelined & parallel compression optimization (#6262) · 03a781a9
      Ziyue Yang 提交于
      Summary:
      This PR adds support for pipelined & parallel compression optimization for `BlockBasedTableBuilder`. This optimization makes block building, block compression and block appending a pipeline, and uses multiple threads to accelerate block compression. Users can set `CompressionOptions::parallel_threads` greater than 1 to enable compression parallelism.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6262
      
      Reviewed By: ajkr
      
      Differential Revision: D20651306
      
      fbshipit-source-id: 62125590a9c15b6d9071def9dc72589c1696a4cb
      03a781a9
  2. 25 3月, 2020 1 次提交
    • Y
      Update a few scripts to be python3 compatible (#6525) · ccf76764
      Yanqin Jin 提交于
      Summary:
      There are a few scripts with python3 compatibility issues that were not
      detected by automated tool before. Update them now.
      
      Test Plan (devserver):
      python2 tools/ldb_test.py
      python3 tools/ldb_test.py
      
      python2 tools/write_stress_runner.py --runtime_sec=30
      python3 tools/write_stress_runner.py --runtime_sec=30
      
      python2 tools/db_crashtest.py --simple --interval=2 --duration=10 blackbox
      python3 tools/db_crashtest.py --simple --interval=2 --duration=10 blackbox
      
      python2 tools/db_crashtest.py --simple --duration=10 --random_kill_odd=1000 --ops_per_thread=1000 whitebox
      python3 tools/db_crashtest.py --simple --duration=10 --random_kill_odd=1000 --ops_per_thread=1000 whitebox
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6525
      
      Reviewed By: cheng-chang
      
      Differential Revision: D20627820
      
      Pulled By: riversand963
      
      fbshipit-source-id: 4b25a7bd4d001c7f868be8b640ef876523be6ca3
      ccf76764
  3. 21 3月, 2020 1 次提交
    • C
      Support direct IO in RandomAccessFileReader::MultiRead (#6446) · 4fc21664
      Cheng Chang 提交于
      Summary:
      By supporting direct IO in RandomAccessFileReader::MultiRead, the benefits of parallel IO (IO uring) and direct IO can be combined.
      
      In direct IO mode, read requests are aligned and merged together before being issued to RandomAccessFile::MultiRead, so blocks in the original requests might share the same underlying buffer, the shared buffers are returned in `aligned_bufs`, which is a new parameter of the `MultiRead` API.
      
      For example, suppose alignment requirement for direct IO is 4KB, one request is (offset: 1KB, len: 1KB), another request is (offset: 3KB, len: 1KB), then since they all belong to page (offset: 0, len: 4KB), `MultiRead` only reads the page with direct IO into a buffer on heap, and returns 2 Slices referencing regions in that same buffer. See `random_access_file_reader_test.cc` for more examples.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6446
      
      Test Plan: Added a new test `random_access_file_reader_test.cc`.
      
      Reviewed By: anand1976
      
      Differential Revision: D20097518
      
      Pulled By: cheng-chang
      
      fbshipit-source-id: ca48a8faf9c3af146465c102ef6b266a363e78d1
      4fc21664
  4. 14 3月, 2020 1 次提交
  5. 13 3月, 2020 2 次提交
    • A
      Force Java version on Travis CI (#6512) · 0772768d
      Adam Retter 提交于
      Summary:
      In the `.travis.yml` file the `jdk: openjdk7` element is ignored when `language: cpp`. So whatever version of the JDK that was installed in the Travis container was used - typically JDK 11.
      
      To ensure our RocksJava builds are working, we now instead install and use OpenJDK 8. Ideally we would use OpenJDK 7, as RocksJava supports Java 7, but many of the newer Travis containers don't support Java 7, so Java 8 is the next best thing.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6512
      
      Differential Revision: D20388296
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 8bbe6b59b70cfab7fe81ff63867d907fefdd2df1
      0772768d
    • L
      Move BlobDB related files under db/ to db/blob/ (#6519) · c15e85bd
      Levi Tamasi 提交于
      Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/6519
      
      Test Plan:
      ```
      make all
      make check
      ```
      
      Differential Revision: D20400691
      
      Pulled By: ltamasi
      
      fbshipit-source-id: 20ef911cf1c2c92c7f71ef0b493f9be64f2eef94
      c15e85bd
  6. 12 3月, 2020 2 次提交
    • C
      Cache result of GetLogicalBufferSize in Linux (#6457) · 2d9efc9a
      Cheng Chang 提交于
      Summary:
      In Linux, when reopening DB with many SST files, profiling shows that 100% system cpu time spent for a couple of seconds for `GetLogicalBufferSize`. This slows down MyRocks' recovery time when site is down.
      
      This PR introduces two new APIs:
      1. `Env::RegisterDbPaths` and `Env::UnregisterDbPaths` lets `DB` tell the env when it starts or stops using its database directories . The `PosixFileSystem` takes this opportunity to set up a cache from database directories to the corresponding logical block sizes.
      2. `LogicalBlockSizeCache` is defined only for OS_LINUX to cache the logical block sizes.
      
      Other modifications:
      1. rename `logical buffer size` to `logical block size` to be consistent with Linux terms.
      2. declare `GetLogicalBlockSize` in `PosixHelper` to expose it to `PosixFileSystem`.
      3. change the functions `IOError` and `IOStatus` in `env/io_posix.h` to have external linkage since they are used in other translation units too.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6457
      
      Test Plan:
      1. A new unit test is added for `LogicalBlockSizeCache` in `env/io_posix_test.cc`.
      2. A new integration test is added for `DB` operations related to the cache in `db/db_logical_block_size_cache_test.cc`.
      
      `make check`
      
      Differential Revision: D20131243
      
      Pulled By: cheng-chang
      
      fbshipit-source-id: 3077c50f8065c0bffb544d8f49fb10bba9408d04
      2d9efc9a
    • A
      Update to latest Snappy to fix compilation issue on latest MacOS XCode (#6496) · 65b60db9
      Adam Retter 提交于
      Summary:
      * **macOS version:** 10.15.2 (Catalina)
      * **XCode/Clang version:** Apple clang version 11.0.0 (clang-1100.0.33.16)
      
      Before this bugfix the error generated is:
      
      ```
      In file included from ./util/compression.h:23:
      ./snappy-1.1.7/snappy.h:76:59: error: unknown type name 'string'; did you mean 'std::string'?
        size_t Compress(const char* input, size_t input_length, string* output);
                                                                ^~~~~~
                                                                std::string
      /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iosfwd:211:65: note: 'std::string' declared here
      typedef basic_string<char, char_traits<char>, allocator<char> > string;
                                                                      ^
      In file included from db/builder.cc:10:
      In file included from ./db/builder.h:12:
      In file included from ./db/range_tombstone_fragmenter.h:15:
      In file included from ./db/pinned_iterators_manager.h:12:
      In file included from ./table/internal_iterator.h:13:
      In file included from ./table/format.h:25:
      In file included from ./options/cf_options.h:14:
      In file included from ./util/compression.h:23:
      ./snappy-1.1.7/snappy.h:85:19: error: unknown type name 'string'; did you mean 'std::string'?
                        string* uncompressed);
                        ^~~~~~
                        std::string
      /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iosfwd:211:65: note: 'std::string' declared here
      typedef basic_string<char, char_traits<char>, allocator<char> > string;
                                                                      ^
      2 errors generated.
      make: *** [jls/db/builder.o] Error 1
      ```
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6496
      
      Differential Revision: D20389254
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 2864245c8d0dba7b2ab81294241a62f2adf02e20
      65b60db9
  7. 11 3月, 2020 1 次提交
    • L
      Split BlobFileState into an immutable and a mutable part (#6502) · f5bc3b99
      Levi Tamasi 提交于
      Summary:
      It's never too soon to refactor something. The patch splits the recently
      introduced (`VersionEdit` related) `BlobFileState` into two classes
      `BlobFileAddition` and `BlobFileGarbage`. The idea is that once blob files
      are closed, they are immutable, and the only thing that changes is the
      amount of garbage in them. In the new design, `BlobFileAddition` contains
      the immutable attributes (currently, the count and total size of all blobs, checksum
      method, and checksum value), while `BlobFileGarbage` contains the mutable
      GC-related information elements (count and total size of garbage blobs). This is a
      better fit for the GC logic and is more consistent with how SST files are handled.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6502
      
      Test Plan: `make check`
      
      Differential Revision: D20348352
      
      Pulled By: ltamasi
      
      fbshipit-source-id: ff93f0121e80ab15e0e0a6525ba0d6af16a0e008
      f5bc3b99
  8. 05 3月, 2020 1 次提交
    • Z
      Introduce FaultInjectionTestFS to test fault File system instead of Env (#6414) · e62fe506
      Zhichao Cao 提交于
      Summary:
      In the current code base, we can use FaultInjectionTestEnv to simulate the env issue such as file write/read errors, which are used in most of the test. The PR https://github.com/facebook/rocksdb/issues/5761 introduce the File System as a new Env API. This PR implement the FaultInjectionTestFS, which can be used to simulate when File System has issues such as IO error. user can specify any IOStatus error as input, such that FS corresponding actions will return certain error to the caller.
      
      A set of ErrorHandlerFSTests are introduced for testing
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6414
      
      Test Plan: pass make asan_check, pass error_handler_fs_test.
      
      Differential Revision: D20252421
      
      Pulled By: zhichao-cao
      
      fbshipit-source-id: e922038f8ce7e6d1da329fd0bba7283c4b779a21
      e62fe506
  9. 29 2月, 2020 1 次提交
  10. 25 2月, 2020 1 次提交
    • L
      Add blob file state to VersionEdit (#6416) · d87c10c6
      Levi Tamasi 提交于
      Summary:
      BlobDB currently does not keep track of blob files: no records are written to
      the manifest when a blob file is added or removed, and upon opening a database,
      the list of blob files is populated simply based on the contents of the blob directory.
      This means that lost blob files cannot be detected at the moment. We plan to solve
      this issue by making blob files a part of `Version`; as a first step, this patch makes
      it possible to store information about blob files in `VersionEdit`. Currently, this information
      includes blob file number, total number and size of all blobs, and total number and size
      of garbage blobs. However, the format is extensible: new fields can be added in
      both a forward compatible and a forward incompatible manner if needed (similarly
      to `kNewFile4`).
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6416
      
      Test Plan: `make check`
      
      Differential Revision: D19894234
      
      Pulled By: ltamasi
      
      fbshipit-source-id: f9753e1f2aedf6dadb70c09b345207cb9c58c329
      d87c10c6
  11. 11 2月, 2020 1 次提交
    • C
      Add utility class Defer (#6382) · dafb5680
      Cheng Chang 提交于
      Summary:
      Add a utility class `Defer` to defer the execution of a function until the Defer object goes out of scope.
      Used in VersionSet:: ProcessManifestWrites as an example.
      The inline comments for class `Defer` have more details.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6382
      
      Test Plan: `make defer_test version_set_test && ./defer_test && ./version_set_test`
      
      Differential Revision: D19797538
      
      Pulled By: cheng-chang
      
      fbshipit-source-id: b1a9b7306e4fd4f48ec2ab55783caa561a315f0f
      dafb5680
  12. 08 2月, 2020 1 次提交
    • C
      Support move semantics for PinnableSlice (#6374) · b42fa149
      Cheng Chang 提交于
      Summary:
      It's logically correct for PinnableSlice to support move semantics to transfer ownership of the pinned memory region. This PR adds both move constructor and move assignment to PinnableSlice.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6374
      
      Test Plan:
      A set of unit tests for the move semantics are added in slice_test.
      So `make slice_test && ./slice_test`.
      
      Differential Revision: D19739254
      
      Pulled By: cheng-chang
      
      fbshipit-source-id: f898bd811bb05b2d87384ec58b645e9915e8e0b1
      b42fa149
  13. 31 1月, 2020 1 次提交
    • P
      Don't download from (unreliable) maven.org (#6348) · 90c71aa5
      Peter Dillinger 提交于
      Summary:
      I set up a mirror of our Java deps on github so we can download
      them through github URLs rather than maven.org, which is proving
      terribly unreliable from Travis builds.
      
      Also sanitized calls to curl, so they are easier to read and
      appropriately fail on download failure.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6348
      
      Test Plan: CI
      
      Differential Revision: D19633621
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 7eb3f730953db2ead758dc94039c040f406790f3
      90c71aa5
  14. 30 1月, 2020 1 次提交
    • A
      Reduce the need to re-download dependencies (#6318) · a07a9dc9
      Adam Retter 提交于
      Summary:
      Both changes are related to RocksJava:
      
      1. Allow dependencies that are already present on the host system due to Maven to be reused in Docker builds.
      
      2. Extend the `make clean-not-downloaded` target to RocksJava, so that libraries needed as dependencies for the test suite are not deleted and re-downloaded unnecessarily.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6318
      
      Differential Revision: D19608742
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 25e25649e3e3212b537ac4512b40e2e53dc02ae7
      a07a9dc9
  15. 25 12月, 2019 1 次提交
    • P
      Fix a clang analyzer report, and 'analyze' make rule (#6244) · 95d226d8
      Peter Dillinger 提交于
      Summary:
      Clang analyzer was falsely reporting on use of txn=nullptr.
      Added a new const variable so that it can properly prune impossible
      control flows.
      
      Also, 'make analyze' previously required setting USE_CLANG=1 as an
      environment variable, not a make variable, or else compilation errors
      like
      
      g++: error: unrecognized command line option ‘-Wshorten-64-to-32’
      
      Now USE_CLANG is not required for 'make analyze' (it's implied) and you
      can do an incremental analysis (recompile what has changed) with
      'USE_CLANG=1 make analyze_incremental'
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6244
      
      Test Plan: 'make -j24 analyze', 'make crash_test'
      
      Differential Revision: D19225950
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 14f4039aa552228826a2de62b2671450e0fed3cb
      95d226d8
  16. 21 12月, 2019 1 次提交
    • Y
      Add more verification to db_stress (#6173) · 670a916d
      Yanqin Jin 提交于
      Summary:
      Currently, db_stress performs verification by calling `VerifyDb()` at the end of test and optionally before tests start. In case of corruption or incorrect result, it will be too late. This PR adds more verification in two ways.
      1. For cf consistency test, each test thread takes a snapshot and verifies every N ops. N is configurable via `-verify_db_one_in`. This option is not supported in other stress tests.
      2. For cf consistency test, we use another background thread in which a secondary instance periodically tails the primary (interval is configurable). We verify the secondary. Once an error is detected, we terminate the test and report. This does not affect other stress tests.
      
      Test plan (devserver)
      ```
      $./db_stress -test_cf_consistency -verify_db_one_in=0 -ops_per_thread=100000 -continuous_verification_interval=100
      $./db_stress -test_cf_consistency -verify_db_one_in=1000 -ops_per_thread=10000 -continuous_verification_interval=0
      $make crash_test
      ```
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6173
      
      Differential Revision: D19047367
      
      Pulled By: riversand963
      
      fbshipit-source-id: aeed584ad71f9310c111445f34975e5ab47a0615
      670a916d
  17. 20 12月, 2019 1 次提交
    • P
      Syntax check python files on testing (#6209) · 5b18729d
      Peter Dillinger 提交于
      Summary:
      Adds a python script to syntax check all python files in the
      repository and report any errors.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6209
      
      Test Plan:
      'make check' with and without seeded syntax errors. Also look
      for "No syntax errors in 34 .py files" on success, and in java_test CI output
      
      Differential Revision: D19166756
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 537df464b767260d66810b4cf4c9808a026c58a4
      5b18729d
  18. 14 12月, 2019 1 次提交
  19. 12 12月, 2019 1 次提交
  20. 11 12月, 2019 1 次提交
    • J
      Fix compile error "folly/xx.h file not found" on Mac OS (#6145) · 1dd3194f
      Jermy Li 提交于
      Summary:
      Error message when running `make` on Mac OS with master branch (v6.6.0):
      ```
      $ make
      $DEBUG_LEVEL is 1
      Makefile:168: Warning: Compiling in debug mode. Don't use the resulting binary in production
      third-party/folly/folly/synchronization/WaitOptions.cpp:6:10: fatal error: 'folly/synchronization/WaitOptions.h' file not found
      #include <folly/synchronization/WaitOptions.h>
               ^
      1 error generated.
      third-party/folly/folly/synchronization/ParkingLot.cpp:6:10: fatal error: 'folly/synchronization/ParkingLot.h' file not found
      #include <folly/synchronization/ParkingLot.h>
               ^
      1 error generated.
      third-party/folly/folly/synchronization/DistributedMutex.cpp:6:10: fatal error: 'folly/synchronization/DistributedMutex.h' file not found
      #include <folly/synchronization/DistributedMutex.h>
               ^
      1 error generated.
      third-party/folly/folly/synchronization/AtomicNotification.cpp:6:10: fatal error: 'folly/synchronization/AtomicNotification.h' file not found
      #include <folly/synchronization/AtomicNotification.h>
               ^
      1 error generated.
      third-party/folly/folly/detail/Futex.cpp:6:10: fatal error: 'folly/detail/Futex.h' file not found
      #include <folly/detail/Futex.h>
               ^
      1 error generated.
        GEN      util/build_version.cc
      $DEBUG_LEVEL is 1
      Makefile:168: Warning: Compiling in debug mode. Don't use the resulting binary in production
      third-party/folly/folly/synchronization/WaitOptions.cpp:6:10: fatal error: 'folly/synchronization/WaitOptions.h' file not found
      #include <folly/synchronization/WaitOptions.h>
               ^
      1 error generated.
      third-party/folly/folly/synchronization/ParkingLot.cpp:6:10: fatal error: 'folly/synchronization/ParkingLot.h' file not found
      #include <folly/synchronization/ParkingLot.h>
               ^
      1 error generated.
      third-party/folly/folly/synchronization/DistributedMutex.cpp:6:10: fatal error: 'folly/synchronization/DistributedMutex.h' file not found
      #include <folly/synchronization/DistributedMutex.h>
               ^
      1 error generated.
      third-party/folly/folly/synchronization/AtomicNotification.cpp:6:10: fatal error: 'folly/synchronization/AtomicNotification.h' file not found
      #include <folly/synchronization/AtomicNotification.h>
               ^
      1 error generated.
      third-party/folly/folly/detail/Futex.cpp:6:10: fatal error: 'folly/detail/Futex.h' file not found
      #include <folly/detail/Futex.h>
      ```
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6145
      
      Differential Revision: D18910812
      
      fbshipit-source-id: 5a4475466c2d0601657831a0b48d34316b2f0816
      1dd3194f
  21. 09 12月, 2019 1 次提交
    • S
      Break db_stress_tool.cc to a list of source files (#6134) · 7d79b326
      sdong 提交于
      Summary:
      db_stress_tool.cc now is a giant file. In order to main it easier to improve and maintain, break it down to multiple source files.
      Most classes are turned into their own files. Separate .h and .cc files are created for gflag definiations. Another .h and .cc files are created for some common functions. Some test execution logic that is only loosely related to class StressTest is moved to db_stress_driver.h and db_stress_driver.cc. All the files are located under db_stress_tool/. The directory name is created as such because if we end it with either stress or test, .gitignore will ignore any file under it and makes it prone to issues in developements.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6134
      
      Test Plan: Build under GCC7 with and without LITE on using GNU Make. Build with GCC 4.8. Build with cmake with -DWITH_TOOL=1
      
      Differential Revision: D18876064
      
      fbshipit-source-id: b25d0a7451840f31ac0f5ebb0068785f783fdf7d
      7d79b326
  22. 04 12月, 2019 1 次提交
    • Y
      Make folly-related targets comply with verbosity (#6120) · 4edb4284
      Yanqin Jin 提交于
      Summary:
      Before this fix, `make all` will emit full compilation command when building
      object files in the third-party/folly directory even if default verbosity is
      0 (AM_DEFAULT_VERBOSITY).
      
      Test Plan (devserver):
      ```
      $make all | tee build.log
      $make check
      ```
      Check build.log to verify.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6120
      
      Differential Revision: D18795621
      
      Pulled By: riversand963
      
      fbshipit-source-id: 04641a8359cd4fd55034e6e797ed85de29ee2fe2
      4edb4284
  23. 27 11月, 2019 4 次提交
  24. 15 11月, 2019 1 次提交
  25. 14 11月, 2019 1 次提交
    • P
      New Bloom filter implementation for full and partitioned filters (#6007) · f059c7d9
      Peter Dillinger 提交于
      Summary:
      Adds an improved, replacement Bloom filter implementation (FastLocalBloom) for full and partitioned filters in the block-based table. This replacement is faster and more accurate, especially for high bits per key or millions of keys in a single filter.
      
      Speed
      
      The improved speed, at least on recent x86_64, comes from
      * Using fastrange instead of modulo (%)
      * Using our new hash function (XXH3 preview, added in a previous commit), which is much faster for large keys and only *slightly* slower on keys around 12 bytes if hashing the same size many thousands of times in a row.
      * Optimizing the Bloom filter queries with AVX2 SIMD operations. (Added AVX2 to the USE_SSE=1 build.) Careful design was required to support (a) SIMD-optimized queries, (b) compatible non-SIMD code that's simple and efficient, (c) flexible choice of number of probes, and (d) essentially maximized accuracy for a cache-local Bloom filter. Probes are made eight at a time, so any number of probes up to 8 is the same speed, then up to 16, etc.
      * Prefetching cache lines when building the filter. Although this optimization could be applied to the old structure as well, it seems to balance out the small added cost of accumulating 64 bit hashes for adding to the filter rather than 32 bit hashes.
      
      Here's nominal speed data from filter_bench (200MB in filters, about 10k keys each, 10 bits filter data / key, 6 probes, avg key size 24 bytes, includes hashing time) on Skylake DE (relatively low clock speed):
      
      $ ./filter_bench -quick -impl=2 -net_includes_hashing # New Bloom filter
      Build avg ns/key: 47.7135
      Mixed inside/outside queries...
        Single filter net ns/op: 26.2825
        Random filter net ns/op: 150.459
          Average FP rate %: 0.954651
      $ ./filter_bench -quick -impl=0 -net_includes_hashing # Old Bloom filter
      Build avg ns/key: 47.2245
      Mixed inside/outside queries...
        Single filter net ns/op: 63.2978
        Random filter net ns/op: 188.038
          Average FP rate %: 1.13823
      
      Similar build time but dramatically faster query times on hot data (63 ns to 26 ns), and somewhat faster on stale data (188 ns to 150 ns). Performance differences on batched and skewed query loads are between these extremes as expected.
      
      The only other interesting thing about speed is "inside" (query key was added to filter) vs. "outside" (query key was not added to filter) query times. The non-SIMD implementations are substantially slower when most queries are "outside" vs. "inside". This goes against what one might expect or would have observed years ago, as "outside" queries only need about two probes on average, due to short-circuiting, while "inside" always have num_probes (say 6). The problem is probably the nastily unpredictable branch. The SIMD implementation has few branches (very predictable) and has pretty consistent running time regardless of query outcome.
      
      Accuracy
      
      The generally improved accuracy (re: Issue https://github.com/facebook/rocksdb/issues/5857) comes from a better design for probing indices
      within a cache line (re: Issue https://github.com/facebook/rocksdb/issues/4120) and improved accuracy for millions of keys in a single filter from using a 64-bit hash function (XXH3p). Design details in code comments.
      
      Accuracy data (generalizes, except old impl gets worse with millions of keys):
      Memory bits per key: FP rate percent old impl -> FP rate percent new impl
      6: 5.70953 -> 5.69888
      8: 2.45766 -> 2.29709
      10: 1.13977 -> 0.959254
      12: 0.662498 -> 0.411593
      16: 0.353023 -> 0.0873754
      24: 0.261552 -> 0.0060971
      50: 0.225453 -> ~0.00003 (less than 1 in a million queries are FP)
      
      Fixes https://github.com/facebook/rocksdb/issues/5857
      Fixes https://github.com/facebook/rocksdb/issues/4120
      
      Unlike the old implementation, this implementation has a fixed cache line size (64 bytes). At 10 bits per key, the accuracy of this new implementation is very close to the old implementation with 128-byte cache line size. If there's sufficient demand, this implementation could be generalized.
      
      Compatibility
      
      Although old releases would see the new structure as corrupt filter data and read the table as if there's no filter, we've decided only to enable the new Bloom filter with new format_version=5. This provides a smooth path for automatic adoption over time, with an option for early opt-in.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6007
      
      Test Plan: filter_bench has been used thoroughly to validate speed, accuracy, and correctness. Unit tests have been carefully updated to exercise new and old implementations, as well as the logic to select an implementation based on context (format_version).
      
      Differential Revision: D18294749
      
      Pulled By: pdillinger
      
      fbshipit-source-id: d44c9db3696e4d0a17caaec47075b7755c262c5f
      f059c7d9
  26. 08 11月, 2019 1 次提交
  27. 22 10月, 2019 1 次提交
  28. 19 10月, 2019 1 次提交
    • Y
      Expose db stress tests (#5937) · e60cc092
      Yanqin Jin 提交于
      Summary:
      expose db stress test by providing db_stress_tool.h in public header.
      This PR does the following:
      - adds a new header, db_stress_tool.h, in include/rocksdb/
      - renames db_stress.cc to db_stress_tool.cc
      - adds a db_stress.cc which simply invokes a test function.
      - update Makefile accordingly.
      
      Test Plan (dev server):
      ```
      make db_stress
      ./db_stress
      ```
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5937
      
      Differential Revision: D17997647
      
      Pulled By: riversand963
      
      fbshipit-source-id: 1a8d9994f89ce198935566756947c518f0052410
      e60cc092
  29. 08 10月, 2019 1 次提交
    • P
      filter_bench - a prelim tool for SST filter benchmarking (#5825) · 46ca51d4
      Peter Dillinger 提交于
      Summary:
      Example: using the tool before and after PR https://github.com/facebook/rocksdb/issues/5784 shows that
      the refactoring, presumed performance-neutral, actually sped up SST
      filters by about 3% to 8% (repeatable result):
      
      Before:
      -  Dry run ns/op: 22.4725
      -  Single filter ns/op: 51.1078
      -  Random filter ns/op: 120.133
      
      After:
      +  Dry run ns/op: 22.2301
      +  Single filter run ns/op: 47.4313
      +  Random filter ns/op: 115.9
      
      Only tests filters for the block-based table (full filters and
      partitioned filters - same implementation; not block-based filters),
      which seems to be the recommended format/implementation.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5825
      
      Differential Revision: D17804987
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 0f18a9c254c57f7866030d03e7fa4ba503bac3c5
      46ca51d4
  30. 19 9月, 2019 2 次提交
  31. 17 9月, 2019 2 次提交
    • P
      Refactor/consolidate legacy Bloom implementation details (#5784) · 68626249
      Peter Dillinger 提交于
      Summary:
      Refactoring to consolidate implementation details of legacy
      Bloom filters. This helps to organize and document some related,
      obscure code.
      
      Also added make/cpp var TEST_CACHE_LINE_SIZE so that it's easy to
      compile and run unit tests for non-native cache line size. (Fixed a
      related test failure in db_properties_test.)
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5784
      
      Test Plan:
      make check, including Recently added Bloom schema unit tests
      (in ./plain_table_db_test && ./bloom_test), and including with
      TEST_CACHE_LINE_SIZE=128U and TEST_CACHE_LINE_SIZE=256U. Tested the
      schema tests with temporary fault injection into new implementations.
      
      Some performance testing with modified unit tests suggest a small to moderate
      improvement in speed.
      
      Differential Revision: D17381384
      
      Pulled By: pdillinger
      
      fbshipit-source-id: ee42586da996798910fc45ac0b6289147f16d8df
      68626249
    • P
      Revert changes from PR#5784 accidentally in PR#5780 (#5810) · d3a6726f
      Peter Dillinger 提交于
      Summary:
      This will allow us to fix history by having the code changes for PR#5784 properly attributed to it.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5810
      
      Differential Revision: D17400231
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 2da8b1cdf2533cfedb35b5526eadefb38c291f09
      d3a6726f
  32. 14 9月, 2019 1 次提交
  33. 10 9月, 2019 1 次提交