1. 14 12月, 2019 5 次提交
    • P
      Add useful idioms to Random API (OneInOpt, PercentTrue) (#6154) · 58d46d19
      Peter Dillinger 提交于
      Summary:
      And clean up related code, especially in stress test.
      
      (More clean up of db_stress_test_base.cc coming after this.)
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6154
      
      Test Plan: make check, make blackbox_crash_test for a bit
      
      Differential Revision: D18938180
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 524d27621b8dbb25f6dff40f1081e7c00630357e
      58d46d19
    • L
      Do not create/install new SuperVersion if nothing was deleted during memtable trim (#6169) · 6d54eb3d
      Levi Tamasi 提交于
      Summary:
      We have observed an increase in CPU load caused by frequent calls to
      `ColumnFamilyData::InstallSuperVersion` from `DBImpl::TrimMemtableHistory`
      when using `max_write_buffer_size_to_maintain` to limit the amount of
      memtable history maintained for transaction conflict checking. As it turns out,
      this is caused by the code creating and installing a new `SuperVersion` even if
      no memtables were actually trimmed. The patch adds a check to avoid this.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6169
      
      Test Plan:
      Compared `perf` output for
      
      ```
      ./db_bench -benchmarks=randomtransaction -optimistic_transaction_db=1 -statistics -stats_interval_seconds=1 -duration=90 -num=500000 --max_write_buffer_size_to_maintain=16000000 --transaction_set_snapshot=1 --threads=32
      ```
      
      before and after the change. With the fix, the call chain `rocksdb::DBImpl::TrimMemtableHistory` ->
      `rocksdb::ColumnFamilyData::InstallSuperVersion` -> `rocksdb::ThreadLocalPtr::StaticMeta::Scrape`
      no longer registers in the `perf` report.
      
      Differential Revision: D19031509
      
      Pulled By: ltamasi
      
      fbshipit-source-id: 02686fce594e5b50eba0710e4b28a9b808c8aa20
      6d54eb3d
    • K
      cmake: do not build tests for Release build and cleanups (#5916) · ac304adf
      Kefu Chai 提交于
      Summary:
      fixes https://github.com/facebook/rocksdb/issues/2445
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5916
      
      Differential Revision: D19031236
      
      fbshipit-source-id: bc3107b6b25a01958677d7cb411b1f381aae91c6
      ac304adf
    • M
      Enable unordered_write in stress tests (#6164) · fec7302a
      Maysam Yabandeh 提交于
      Summary:
      With WritePrepared transactions configured with two_write_queues, unordered_write will offer the same guarantees as vanilla rocksdb and thus can be enabled in stress tests.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6164
      
      Test Plan:
      ```
      make -j32 crash_test_with_txn
      
      Differential Revision: D18991899
      
      Pulled By: maysamyabandeh
      
      fbshipit-source-id: eece5e96b4169b67d7931e5c0afca88540a113e1
      fec7302a
    • L
      Move out valid blobs from the oldest blob files during compaction (#6121) · 583c6953
      Levi Tamasi 提交于
      Summary:
      The patch adds logic that relocates live blobs from the oldest N non-TTL
      blob files as they are encountered during compaction (assuming the BlobDB
      configuration option `enable_garbage_collection` is `true`), where N is defined
      as the number of immutable non-TTL blob files multiplied by the value of
      a new BlobDB configuration option called `garbage_collection_cutoff`.
      (The default value of this parameter is 0.25, that is, by default the valid blobs
      residing in the oldest 25% of immutable non-TTL blob files are relocated.)
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6121
      
      Test Plan: Added unit test and tested using the BlobDB mode of `db_bench`.
      
      Differential Revision: D18785357
      
      Pulled By: ltamasi
      
      fbshipit-source-id: 8c21c512a18fba777ec28765c88682bb1a5e694e
      583c6953
  2. 13 12月, 2019 9 次提交
  3. 12 12月, 2019 7 次提交
  4. 11 12月, 2019 9 次提交
    • Y
      Add SyncWAL to db_stress (#6149) · 383f5071
      Yanqin Jin 提交于
      Summary:
      Add SyncWAL to db_stress. Specify with `-sync_wal_one_in=N` so that it will be
      called once every N operations on average.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6149
      
      Test Plan:
      ```
      $make db_stress
      $./db_stress -sync_wal_one_in=100 -ops_per_thread=100000
      ```
      
      Differential Revision: D18922529
      
      Pulled By: riversand963
      
      fbshipit-source-id: 4c0b8cb8fa21852722cffd957deddf688f12ea56
      383f5071
    • S
      db_stress: sometimes call CancelAllBackgroundWork() and Close() before closing DB (#6141) · 7a99162a
      sdong 提交于
      Summary:
      CancelAllBackgroundWork() and Close() are frequently used features but we don't cover it in stress test. Simply execute them before closing the DB with 1/2 chance.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6141
      
      Test Plan: Run "db_stress".
      
      Differential Revision: D18900861
      
      fbshipit-source-id: 49b46ccfae120d0f9de3e0543b82fb6d715949d0
      7a99162a
    • A
      Add Visual Studio 2015 to AppVeyor (#5446) · 984b6e71
      Adam Retter 提交于
      Summary:
      This is required to compile on Windows with Visual Studio 2015, which is used for creating the RocksJava releases.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5446
      
      Differential Revision: D18924811
      
      fbshipit-source-id: a183a62e79a2af5aaf59cd08235458a172fe7dcb
      984b6e71
    • P
      Add PauseBackgroundWork() to db_stress (#6148) · a6538571
      Peter Dillinger 提交于
      Summary:
      Worker thread will occasionally call PauseBackgroundWork(),
      briefly sleep (to avoid stalling itself) and then call
      ContinueBackgroundWork().
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6148
      
      Test Plan:
      some running of 'make blackbox_crash_test' with temporary
      printf output to confirm code occasionally reached.
      
      Differential Revision: D18913886
      
      Pulled By: pdillinger
      
      fbshipit-source-id: ae9356a803390929f3165dfb6a00194692ba92be
      a6538571
    • A
      Add an option to the CMake build to disable building shared libraries (#6122) · 2bb5fc12
      Adam Simpkins 提交于
      Summary:
      Add an option to explicitly disable building shared versions of the
      RocksDB libraries.  The shared libraries cannot be built in cases where
      some dependencies are only available as static libraries.  This allows
      still building RocksDB in these situations.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6122
      
      Differential Revision: D18920740
      
      fbshipit-source-id: d24f66d93c68a1e65635e6e0b663bae62c903bca
      2bb5fc12
    • Y
      Use Env::GetChildren() instead of readdir (#6139) · 2b060c14
      Yanqin Jin 提交于
      Summary:
      For more portability, switch from readdir to Env::GetChildren() in ldb's
      manifest_dump subcommand.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6139
      
      Test Plan:
      ```
      $make check
      ```
      Manually check ldb command.
      
      Differential Revision: D18898197
      
      Pulled By: riversand963
      
      fbshipit-source-id: 92afca379e9fbe78ab70b2eb40d127daad8df5e2
      2b060c14
    • S
      db_stress: sometimes validate compact range data (#6140) · 14c38bac
      sdong 提交于
      Summary:
      Right now, in db_stress, compact range is simply executed without any immediate data validation. Add a simply validation which compares hash for all keys within the compact range to stay the same against the same snapshot before and after the compaction.
      
      Also, randomly tune most knobs of CompactRangeOptions.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6140
      
      Test Plan: Run db_stress with "--compact_range_one_in=2000 --compact_range_width=100000000" for a while. Manually ingest some hacky code and observe the error path.
      
      Differential Revision: D18900230
      
      fbshipit-source-id: d96e75bc8c38dd5ec702571ffe7cf5f4ea93ee10
      14c38bac
    • 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
    • P
      Vary bloom_bits in db_crashtest (#6103) · 6380df5e
      Peter Dillinger 提交于
      Summary:
      Especially with non-integral bits/key now supported,
      db_crashtest should vary the bloom_bits configuration. The probabilities
      look like this:
      
      1/2 chance of a uniform int from 0 to 19. This includes overall 1/40
      chance of 0 which disables the bloom filter.
      
      1/2 chance of a float from a lognormal distribution with a median of 10.
      This always produces positive values but with a decent chance of < 1
      (overall ~1/40) or > 100 (overall ~1/40), the enforced/coerced
      implementation limits.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6103
      
      Test Plan:
      start 'make blackbox_crash_test' several times and look at
      configuration output
      
      Differential Revision: D18734877
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 4a38cb057d3b3fc1327f93199f65b9a9ffbd7316
      6380df5e
  5. 10 12月, 2019 7 次提交
    • S
      Apply formatter to some recent commits (#6138) · a68dff5c
      sdong 提交于
      Summary:
      Formatter somehow complains some recent lines changed. Apply them to make the formatter happy.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6138
      
      Test Plan: See CI passes.
      
      Differential Revision: D18895950
      
      fbshipit-source-id: 7d1696cf3e3a682bc10a30cdca748a23c6565255
      a68dff5c
    • S
      db_stress: Some code style improvements (#6137) · a960287d
      sdong 提交于
      Summary:
      Two changes:
      1. Prevent static variables in a header file
      2. Add "override" keyword when virtual functions are overridden.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6137
      
      Test Plan: Build db_stress with or without LITE.
      
      Differential Revision: D18892007
      
      fbshipit-source-id: 295356427a34473b23ed36d6ed4ef3ae35a32db0
      a960287d
    • P
      Fix & test rocksdb_filterpolicy_create_bloom_full (#6132) · e43d2c44
      Peter Dillinger 提交于
      Summary:
      Add overrides needed in FilterPolicy wrapper to fix
      rocksdb_filterpolicy_create_bloom_full (see issue https://github.com/facebook/rocksdb/issues/6129). Re-enabled
      assertion in BloomFilterPolicy::CreateFilter that was being violated.
      Expanded c_test to identify Bloom filter implementations by FP counts.
      (Without the fix, updated test will trigger assertion and fail otherwise
      without the assertion.)
      
      Fixes https://github.com/facebook/rocksdb/issues/6129
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6132
      
      Test Plan: updated c_test, also run under valgrind.
      
      Differential Revision: D18864911
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 08e81d7b5368b08e501cd402ef5583f2650c19fa
      e43d2c44
    • S
      Fix thread_local_test failure caused by recent io_uring change (#6136) · 3c347821
      sdong 提交于
      Summary:
      thread_local_test now fails because it asserts no thread local instance is created when the test started. However, right now a thread local instance might be created when creating PosixEnv as a static variable. Fix the test by relaxing the assumption of starting from 0.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6136
      
      Test Plan: Find an environment where the test fails, and see it passes with the fix applied.
      
      Differential Revision: D18889224
      
      fbshipit-source-id: 7946f3bfea81d236f7bb1554076696705b211b92
      3c347821
    • Z
      Fix wrong ExtractUserKey usage in BlockBasedTableBuilder::EnterUnbuff… (#6100) · 7e2f8319
      Ziyue Yang 提交于
      Summary:
      BlockBasedTableBuilder uses ExtractUserKey in EnterUnbuffered. This would
      cause index filter building error, since user-provided timestamp is supported
      by ExtractUserKeyAndStripTimestamp, and it's used in Add. This commit changes
      ExtractUserKey to ExtractUserKeyAndStripTimestamp.
      
      A test case is also added by modifying DBBasicTestWithTimestampWithParam_
      PutAndGet test in db_basic_test to cover ExtractUserKeyAndStripTimestamp usage
      in both kBuffered and kUnbuffered state of BlockBasedTableBuilder.
      
      Before the ExtractUserKeyAndStripTimstamp fix:
      
      ```
      $ ./db_basic_test --gtest_filter="*PutAndGet*"
      Note: Google Test filter = *PutAndGet*
      [==========] Running 2 tests from 1 test case.
      [----------] Global test environment set-up.
      [----------] 2 tests from Timestamp/DBBasicTestWithTimestampWithParam
      [ RUN      ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/0
      db/db_basic_test.cc:2109: Failure
      db_->Get(ropts, cfh, "key" + std::to_string(j), &value)
      NotFound:
      db/db_basic_test.cc:2109: Failure
      db_->Get(ropts, cfh, "key" + std::to_string(j), &value)
      NotFound:
      db/db_basic_test.cc:2109: Failure
      db_->Get(ropts, cfh, "key" + std::to_string(j), &value)
      NotFound:
      db/db_basic_test.cc:2109: Failure
      db_->Get(ropts, cfh, "key" + std::to_string(j), &value)
      NotFound:
      db/db_basic_test.cc:2109: Failure
      db_->Get(ropts, cfh, "key" + std::to_string(j), &value)
      NotFound:
      [  FAILED  ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/0, where GetParam() = false (1177 ms)
      [ RUN      ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/1
      [       OK ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/1 (1056 ms)
      [----------] 2 tests from Timestamp/DBBasicTestWithTimestampWithParam (2233 ms total)
      
      [----------] Global test environment tear-down
      [==========] 2 tests from 1 test case ran. (2233 ms total)
      [  PASSED  ] 1 test.
      [  FAILED  ] 1 test, listed below:
      [  FAILED  ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/0, where GetParam() = false
      
       1 FAILED TEST
      ```
      
      After the ExtractUserKeyAndStripTimstamp fix:
      
      ```
      $ ./db_basic_test --gtest_filter="*PutAndGet*"
      Note: Google Test filter = *PutAndGet*
      [==========] Running 2 tests from 1 test case.
      [----------] Global test environment set-up.
      [----------] 2 tests from Timestamp/DBBasicTestWithTimestampWithParam
      [ RUN      ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/0
      [       OK ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/0 (1417 ms)
      [ RUN      ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/1
      [       OK ] Timestamp/DBBasicTestWithTimestampWithParam.PutAndGet/1 (1041 ms)
      [----------] 2 tests from Timestamp/DBBasicTestWithTimestampWithParam (2458 ms total)
      
      [----------] Global test environment tear-down
      [==========] 2 tests from 1 test case ran. (2458 ms total)
      [  PASSED  ] 2 tests.
      ```
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6100
      
      Differential Revision: D18769654
      
      Pulled By: riversand963
      
      fbshipit-source-id: 76c2cf2c9a5e0d85db95d98e812e6af0c2a15c6b
      7e2f8319
    • S
      Fix an asan warning caused by the recent io_uring change (#6135) · d1ae2c3f
      sdong 提交于
      Summary:
      ASAN reports:
      
      internal_repo_rocksdb/repo:db_test - MultiThreaded/MultiThreadedDBTest.MultiThreaded/43: fatal
      ==2692739==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6130000500ca at pc 0x0000006be780 bp 0x7efef85ccd20 sp 0x7efef85cc4d0
      [CONTEXT] === How to use this, how to get the raw stack trace, and more: fburl.com/ASAN ===
      [CONTEXT] READ of size 331 at 0x6130000500ca thread T195
      [CONTEXT]      #0 db_test_bin+0x6be77f                     __interceptor_strlen.part.35
      [CONTEXT]      https://github.com/facebook/rocksdb/issues/1 internal_repo_rocksdb/repo/include/rocksdb/slice.h:55 rocksdb::Slice::Slice(char const*)
      [CONTEXT]      https://github.com/facebook/rocksdb/issues/2 internal_repo_rocksdb/repo/env/io_posix.cc:522 rocksdb::PosixRandomAccessFile::MultiRead(rocksdb::ReadRequest*, unsigned long)
      
      I looked at env/io_posix.cc:522 but don't see a reason why the line needs to be there at all, because it is not used before overwritten. So it must be a line that is put there as a bug. Remove it.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6135
      
      Test Plan: Rerun the same test which passes after the fix. Run all the tests and make sure they all pass.
      
      Differential Revision: D18880251
      
      fbshipit-source-id: 3b84ac6a05b67b529c4202e0ceb4c047460f44f2
      d1ae2c3f
    • P
      Use SpecialSkipListFactory in RecalculateScoreAfterPicking (#6125) · 3a6d9436
      Peter Dillinger 提交于
      Summary:
      Test DBTestUniversalCompaction.RecalculateScoreAfterPicking was
      flaky on ARM, so it now uses SpecialSkipListFactory (like other tests)
      for predictable memtable flushes.
      
      Fixes https://github.com/facebook/rocksdb/issues/5736
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6125
      
      Test Plan:
      while ./db_universal_compaction_test; do :; done # for a
      while on ARM and on Intel (both Linux)
      
      Differential Revision: D18864821
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 2f3ca0ea66ce420dcd6d41b0ec12377112a5a79f
      3a6d9436
  6. 09 12月, 2019 2 次提交
    • 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
    • S
      Isolate building db_bench from tests with `WITH_BENCHMARK_TOOLS` option. (#6098) · bac38c99
      suzanwen 提交于
      Summary:
      Isolate `db_bench` from building tests, out of respect for the related comments.
      Let building tests yields to `WITH_TEST=ON` AND `CMAKE_BUILD_TYPE=Debug` both,
      and building `db_bench` yields to `WITH_BENCHMARK_TOOLS=ON`.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6098
      
      Test Plan: cmake -DCMAKE_BUILD_TYPE=Debug/Release -DWITH_TESTS=ON/OFF -DWITH_BENCHMARK_TOOLS=ON/OFF -DWITH_TOOLS=ON/OFF && make
      
      Differential Revision: D18856891
      
      Pulled By: riversand963
      
      fbshipit-source-id: addbee8ad6abefb877843a313b4630cfab3ce4f0
      bac38c99
  7. 08 12月, 2019 1 次提交
    • S
      PosixRandomAccessFile::MultiRead() to use I/O uring if supported (#5881) · e3a82bb9
      sdong 提交于
      Summary:
      Right now, PosixRandomAccessFile::MultiRead() executes read requests in parallel. In this PR, it leverages I/O Uring library to run it in parallel, even when page cache is enabled. This function will fall back if the kernel version doesn't support it.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5881
      
      Test Plan: Run the unit test on a kernel version supporting it and make sure all tests pass, and run a unit test on kernel version supporting it and see it pass. Before merging, will also run stress test and see it passes.
      
      Differential Revision: D17742266
      
      fbshipit-source-id: e05699c925ac04fdb42379456a4e23e4ebcb803a
      e3a82bb9