1. 12 3月, 2020 1 次提交
    • 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
  2. 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
  3. 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
  4. 29 2月, 2020 1 次提交
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 14 12月, 2019 1 次提交
  14. 12 12月, 2019 1 次提交
  15. 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
  16. 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
  17. 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
  18. 27 11月, 2019 4 次提交
  19. 15 11月, 2019 1 次提交
  20. 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
  21. 08 11月, 2019 1 次提交
  22. 22 10月, 2019 1 次提交
  23. 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
  24. 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
  25. 19 9月, 2019 2 次提交
  26. 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
  27. 14 9月, 2019 1 次提交
  28. 10 9月, 2019 1 次提交
  29. 05 9月, 2019 1 次提交
    • E
      fix checking the '-march' flag (#5766) · 3f2723a8
      ENDOH takanao 提交于
      Summary:
      Hi! guys,
      
      I got errors on the ARM machine.
      
      before:
      
      ```console
      $ make static_lib
      ...
      g++: error: unrecognized argument in option '-march=armv8-a+crc+crypto'
      g++: note: valid arguments to '-march=' are: armv2 armv2a armv3 armv3m armv4 armv4t armv5 armv5e armv5t armv5te armv6 armv6-m armv6j armv6k armv6kz armv6s-m armv6t2 armv6z armv6zk armv7 armv7-a armv7-m armv7-r armv7e-m armv7ve armv8-a armv8-a+crc armv8.1-a armv8.1-a+crc iwmmxt iwmmxt2 native
      ```
      
      Thanks!
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5766
      
      Differential Revision: D17191117
      
      fbshipit-source-id: 7a61e3a2a4a06f37faeb8429bd7314da54ec5868
      3f2723a8
  30. 23 8月, 2019 1 次提交
    • S
      Atomic Flush Crash Test also covers the case that WAL is enabled. (#5729) · d8a27d93
      sdong 提交于
      Summary:
      AtomicFlushStressTest is a powerful test, but right now we only run it for atomic_flush=true + disable_wal=true. We further extend it to the case where atomic_flush=false + disable_wal = false. All the workload generation and validation can stay the same.
      Atomic flush crash test is also changed to switch between the two test scenarios. It makes the name "atomic flush crash test" out of sync from what it really does. We leave it as it is to avoid troubles with continous test set-up.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5729
      
      Test Plan: Run "CRASH_TEST_KILL_ODD=188 TEST_TMPDIR=/dev/shm/ USE_CLANG=1 make whitebox_crash_test_with_atomic_flush", observe the settings used and see it passed.
      
      Differential Revision: D16969791
      
      fbshipit-source-id: 56e37487000ae631e31b0100acd7bdc441c04163
      d8a27d93
  31. 17 8月, 2019 2 次提交
  32. 15 8月, 2019 1 次提交
    • A
      Fix TSAN failures in DistributedMutex tests (#5684) · 77273d41
      Aaryaman Sagar 提交于
      Summary:
      TSAN was not able to correctly instrument atomic bts and btr instructions, so
      when TSAN is enabled implement those with std::atomic::fetch_or and
      std::atomic::fetch_and. Also disable tests that fail on TSAN with false
      negatives (we know these are false negatives because this other verifiably
      correct program fails with the same TSAN error <link>)
      
      ```
      make clean
      TEST_TMPDIR=/dev/shm/rocksdb OPT=-g COMPILE_WITH_TSAN=1 make J=1 -j56 folly_synchronization_distributed_mutex_test
      ```
      
      This is the code that fails with the same false-negative with TSAN
      ```
      namespace {
      class ExceptionWithConstructionTrack : public std::exception {
       public:
        explicit ExceptionWithConstructionTrack(int id)
            : id_{folly::to<std::string>(id)}, constructionTrack_{id} {}
      
        const char* what() const noexcept override {
          return id_.c_str();
        }
      
       private:
        std::string id_;
        TestConstruction constructionTrack_;
      };
      
      template <typename Storage, typename Atomic>
      void transferCurrentException(Storage& storage, Atomic& produced) {
        assert(std::current_exception());
        new (&storage) std::exception_ptr(std::current_exception());
        produced->store(true, std::memory_order_release);
      }
      
      void concurrentExceptionPropagationStress(
          int numThreads,
          std::chrono::milliseconds milliseconds) {
        auto&& stop = std::atomic<bool>{false};
        auto&& exceptions = std::vector<std::aligned_storage<48, 8>::type>{};
        auto&& produced = std::vector<std::unique_ptr<std::atomic<bool>>>{};
        auto&& consumed = std::vector<std::unique_ptr<std::atomic<bool>>>{};
        auto&& consumers = std::vector<std::thread>{};
        for (auto i = 0; i < numThreads; ++i) {
          produced.emplace_back(new std::atomic<bool>{false});
          consumed.emplace_back(new std::atomic<bool>{false});
          exceptions.push_back({});
        }
      
        auto producer = std::thread{[&]() {
          auto counter = std::vector<int>(numThreads, 0);
          for (auto i = 0; true; i = ((i + 1) % numThreads)) {
            try {
              throw ExceptionWithConstructionTrack{counter.at(i)++};
            } catch (...) {
              transferCurrentException(exceptions.at(i), produced.at(i));
            }
      
            while (!consumed.at(i)->load(std::memory_order_acquire)) {
              if (stop.load(std::memory_order_acquire)) {
                return;
              }
            }
      
            consumed.at(i)->store(false, std::memory_order_release);
          }
        }};
      
        for (auto i = 0; i < numThreads; ++i) {
          consumers.emplace_back([&, i]() {
            auto counter = 0;
            while (true) {
              while (!produced.at(i)->load(std::memory_order_acquire)) {
                if (stop.load(std::memory_order_acquire)) {
                  return;
                }
              }
              produced.at(i)->store(false, std::memory_order_release);
      
              try {
                auto storage = &exceptions.at(i);
                auto exc = folly::launder(
                  reinterpret_cast<std::exception_ptr*>(storage));
                auto copy = std::move(*exc);
                exc->std::exception_ptr::~exception_ptr();
                std::rethrow_exception(std::move(copy));
              } catch (std::exception& exc) {
                auto value = std::stoi(exc.what());
                EXPECT_EQ(value, counter++);
              }
      
              consumed.at(i)->store(true, std::memory_order_release);
            }
          });
        }
      
        std::this_thread::sleep_for(milliseconds);
        stop.store(true);
        producer.join();
        for (auto& thread : consumers) {
          thread.join();
        }
      }
      } // namespace
      ```
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5684
      
      Differential Revision: D16746077
      
      Pulled By: miasantreble
      
      fbshipit-source-id: 8af88dcf9161c05daec1a76290f577918638f79d
      77273d41
  33. 08 8月, 2019 1 次提交
    • A
      Port folly/synchronization/DistributedMutex to rocksdb (#5642) · 38b03c84
      Aaryaman Sagar 提交于
      Summary:
      This ports `folly::DistributedMutex` into RocksDB. The PR includes everything else needed to compile and use DistributedMutex as a component within folly. Most files are unchanged except for some portability stuff and includes.
      
      For now, I've put this under `rocksdb/third-party`, but if there is a better folder to put this under, let me know. I also am not sure how or where to put unit tests for third-party stuff like this. It seems like gtest is included already, but I need to link with it from another third-party folder.
      
      This also includes some other common components from folly
      
      - folly/Optional
      - folly/ScopeGuard (In particular `SCOPE_EXIT`)
      - folly/synchronization/ParkingLot (A portable futex-like interface)
      - folly/synchronization/AtomicNotification (The standard C++ interface for futexes)
      - folly/Indestructible (For singletons that don't get destroyed without allocations)
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5642
      
      Differential Revision: D16544439
      
      fbshipit-source-id: 179b98b5dcddc3075926d31a30f92fd064245731
      38b03c84
  34. 07 8月, 2019 1 次提交
    • V
      New API to get all merge operands for a Key (#5604) · d150e014
      Vijay Nadimpalli 提交于
      Summary:
      This is a new API added to db.h to allow for fetching all merge operands associated with a Key. The main motivation for this API is to support use cases where doing a full online merge is not necessary as it is performance sensitive. Example use-cases:
      1. Update subset of columns and read subset of columns -
      Imagine a SQL Table, a row is encoded as a K/V pair (as it is done in MyRocks). If there are many columns and users only updated one of them, we can use merge operator to reduce write amplification. While users only read one or two columns in the read query, this feature can avoid a full merging of the whole row, and save some CPU.
      2. Updating very few attributes in a value which is a JSON-like document -
      Updating one attribute can be done efficiently using merge operator, while reading back one attribute can be done more efficiently if we don't need to do a full merge.
      ----------------------------------------------------------------------------------------------------
      API :
      Status GetMergeOperands(
            const ReadOptions& options, ColumnFamilyHandle* column_family,
            const Slice& key, PinnableSlice* merge_operands,
            GetMergeOperandsOptions* get_merge_operands_options,
            int* number_of_operands)
      
      Example usage :
      int size = 100;
      int number_of_operands = 0;
      std::vector<PinnableSlice> values(size);
      GetMergeOperandsOptions merge_operands_info;
      db_->GetMergeOperands(ReadOptions(), db_->DefaultColumnFamily(), "k1", values.data(), merge_operands_info, &number_of_operands);
      
      Description :
      Returns all the merge operands corresponding to the key. If the number of merge operands in DB is greater than merge_operands_options.expected_max_number_of_operands no merge operands are returned and status is Incomplete. Merge operands returned are in the order of insertion.
      merge_operands-> Points to an array of at-least merge_operands_options.expected_max_number_of_operands and the caller is responsible for allocating it. If the status returned is Incomplete then number_of_operands will contain the total number of merge operands found in DB for key.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5604
      
      Test Plan:
      Added unit test and perf test in db_bench that can be run using the command:
      ./db_bench -benchmarks=getmergeoperands --merge_operator=sortlist
      
      Differential Revision: D16657366
      
      Pulled By: vjnadimpalli
      
      fbshipit-source-id: 0faadd752351745224ee12d4ae9ef3cb529951bf
      d150e014