1. 04 4月, 2020 5 次提交
    • S
      Fix clang anaylze warning caused by #6262 (#6641) · 00f8016b
      sdong 提交于
      Summary:
      https://github.com/facebook/rocksdb/pull/6262 causes CLANG analyze to complain. Add assertion to suppress the warning.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6641
      
      Test Plan: Run "clang analyze" and make sure it passes.
      
      Reviewed By: anand1976
      
      Differential Revision: D20841722
      
      fbshipit-source-id: 5fa6e0c5cfe7a822214c9b898a408df59d4fd2cd
      00f8016b
    • A
      fix compiler errors with -DNPERF_CONTEXT (#6642) · e60ea7fe
      Andrew Kryczka 提交于
      Summary:
      as titled
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6642
      
      Test Plan:
      ```
      $ EXTRA_CXXFLAGS="-DNPERF_CONTEXT" DEBUG_LEVEL=0 make -j48 db_bench
      ```
      
      Reviewed By: riversand963
      
      Differential Revision: D20842313
      
      Pulled By: ajkr
      
      fbshipit-source-id: a830cad312ca681591f06749242279503b101df2
      e60ea7fe
    • M
      Move the OptionTypeMap code closer to home (#6198) · 259b6ec8
      mrambacher 提交于
      Summary:
      This is a predecessor to the Configurable PR.  This change moves the OptionTypeInfo maps closer to where they will be used.
      
      When the Configurable changes are adopted, these values will become static and not associated with the OptionsHelper.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6198
      
      Reviewed By: siying
      
      Differential Revision: D20778108
      
      Pulled By: zhichao-cao
      
      fbshipit-source-id: a9f85fc73bc53503656e1958ecc1e764052fd1aa
      259b6ec8
    • P
      Revamp cache_bench to resemble a real workload (#6629) · 079e77ff
      Peter Dillinger 提交于
      Summary:
      I suspect LRUCache could use some optimization, and to support
      such an effort, a good benchmarking tool is needed. The existing
      cache_bench was heavily skewed toward insertion and lookup misses, and
      did not saturate memory with other work. This change should improve
      those things to better resemble a real workload.
      
      (All below using clang compiler, for some consistency, but not
      necessarily same version and settings.)
      
      The real workload is from production MySQL on RocksDB, filtering stacks
      containing "LRU", "ShardedCache" or "CacheShard."
      Lookup inclusive: 66%
      Insert inclusive: 17%
      Release inclusive: 15%
      
      An alternate simulated workload is MySQL running a LinkBench read test:
      Lookup inclusive: 54%
      Insert inclusive: 24%
      Release inclusive: 21%
      
      cache_bench default settings, prior to this change:
      Lookup inclusive: 35.8%
      Insert inclusive: 63.6%
      Release inclusive: 0%
      
      cache_bench after this change (intended as somewhat "tighter" workload
      than average production, more like LinkBench):
      Lookup inclusive: 52%
      Insert inclusive: 20%
      Release inclusive: 26%
      
      And top exclusive stacks (portion of stack samples as filtered above):
      Production MySQL:
      LRUHandleTable::FindPointer: 25.3%
      rocksdb::operator==: 15.1%  <-- Slice ==
      LRUCacheShard::LRU_Remove: 13.8%
      ShardedCache::Lookup: 8.9%
      __pthread_mutex_lock: 7.1%
      LRUCacheShard::LRU_Insert: 6.3%
      MurmurHash64A: 4.8%  <-- Since upgraded to XXH3p
      ...
      
      Old cache_bench:
      LRUHandleTable::FindPointer: 23.6%
      __pthread_mutex_lock: 15.0%
      __pthread_mutex_unlock_usercnt: 11.7%
      __lll_lock_wait: 8.6%
      __lll_unlock_wake: 6.8%
      LRUCacheShard::LRU_Insert: 6.0%
      ShardedCache::Lookup: 4.4%
      LRUCacheShard::LRU_Remove: 2.8%
      ...
      rocksdb::operator==: 0.2%  <-- Slice ==
      ...
      
      New cache_bench:
      LRUHandleTable::FindPointer: 22.8%
      __pthread_mutex_unlock_usercnt: 14.3%
      rocksdb::operator==: 10.5%  <-- Slice ==
      LRUCacheShard::LRU_Insert: 9.0%
      __pthread_mutex_lock: 5.9%
      LRUCacheShard::LRU_Remove: 5.0%
      ...
      ShardedCache::Lookup: 2.9%
      ...
      
      So there's a bit more lock contention in the benchmark than in
      production, but otherwise looks similar enough to me. At least it's a
      big improvement over the existing code.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6629
      
      Test Plan: No production code changes, ran cache_bench with ASAN
      
      Reviewed By: ltamasi
      
      Differential Revision: D20824318
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 6f8dc5891ead0f87edbed3a615ecd5289d9abe12
      079e77ff
    • B
      Fix msvc debug test failures (#6579) · df62cd5b
      Burton Li 提交于
      Summary:
      1. stats_history_test: one slice of stats history is 12526 Bytes, which is greater than original assumption.
      ![image](https://user-images.githubusercontent.com/17753898/77381970-5a611a80-6d3c-11ea-9d64-59d2e3c04f79.png)
      2. table_test: in VerifyBlockAccessTrace function, release trace reader before delete trace file.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6579
      
      Reviewed By: siying
      
      Differential Revision: D20767373
      
      Pulled By: pdillinger
      
      fbshipit-source-id: e8647d665cbe83a3f5429639c6219b50c0912124
      df62cd5b
  2. 03 4月, 2020 6 次提交
  3. 02 4月, 2020 5 次提交
    • Y
      Add counter in perf_context to time cipher time (#6596) · 2b02ea25
      Yi Wu 提交于
      Summary:
      Add `encrypt_data_time` and `decrypt_data_time` perf_context counters to time encryption/decryption time when `EnvEncryption` is enabled.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6596
      
      Test Plan: CI
      
      Reviewed By: anand1976
      
      Differential Revision: D20678617
      
      fbshipit-source-id: 7b57536143aa38509cde011f704de33382169e07
      2b02ea25
    • 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
    • S
      Add dependency of gtest on pthread (#6572) · 719c0f91
      Sylvain Oliver 提交于
      Summary:
      Compilation of rocksdb fails because -lpthread flag is needed by gtest
      
      **Before modification** :
      /usr/bin/c++   -W -Wextra -Wall -Wsign-compare -Wshadow -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-strict-aliasing -std=c++11 -march=native -Werror -fno-builtin-memcmp -g -DROCKSDB_USE_RTTI   CMakeFiles/table_reader_bench.dir/table/table_reader_bench.cc.o  -o table_reader_bench -Wl,-rpath,/develop/src/rocksdb/build librocksdb.so.6.8.0 libtestharness.a /usr/lib/x86_64-linux-gnu/libgflags.so -lpthread third-party/gtest-1.8.1/fused-src/gtest/libgtest.a
      
      **After modification** :
      /usr/bin/c++   -W -Wextra -Wall -Wsign-compare -Wshadow -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-strict-aliasing -std=c++11 -march=native -Werror -fno-builtin-memcmp -g -DROCKSDB_USE_RTTI   CMakeFiles/table_reader_bench.dir/table/table_reader_bench.cc.o  -o table_reader_bench -Wl,-rpath,/develop/src/rocksdb/build librocksdb.so.6.8.0 libtestharness.a /usr/lib/x86_64-linux-gnu/libgflags.so third-party/gtest-1.8.1/fused-src/gtest/libgtest.a -lpthread
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6572
      
      Reviewed By: anand1976
      
      Differential Revision: D20789059
      
      Pulled By: ajkr
      
      fbshipit-source-id: 97329f14b9044b12c8a415da3d5f27b256ff8ff7
      719c0f91
    • S
      Fix a bug that crashes the service when write buffer manager fails to insert to block cache (#6619) · 57096ab1
      sdong 提交于
      Summary:
      https://github.com/facebook/rocksdb/issues/6247 reports that when write buffer manager fails to insert the dummy entry to block cache, null pointer is still stored and used to release the handle and cause corruption. Fix the bug by not releasing it with null handle.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6619
      
      Test Plan: Add a unit test that fails without the fix.
      
      Reviewed By: ajkr
      
      Differential Revision: D20776769
      
      fbshipit-source-id: 4127fbd9f295a0a3e45774746ffcd91f939f6287
      57096ab1
    • Y
      Fix clang analyze error (#6622) · b5818f87
      Yanqin Jin 提交于
      Summary:
      As title. https://github.com/facebook/rocksdb/issues/6612 caused clang analyze to fail with the error:
      ```
      db/compaction/compaction_picker_fifo.cc:105:39: warning: Called C++ object pointer is null
                           cf_name.c_str(), f->fd.GetNumber(), creation_time);
                                            ^~~~~~~~~~~~~~~~~
      ./logging/logging.h:59:36: note: expanded from macro 'ROCKS_LOG_BUFFER'
                                       ##__VA_ARGS__)
                                         ^~~~~~~~~~~
      1 warning generated.
      ```
      
      Test Plan (devserver):
      USE_CLANG=1 make analyze
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6622
      
      Reviewed By: ltamasi
      
      Differential Revision: D20787407
      
      Pulled By: riversand963
      
      fbshipit-source-id: a5de4910cc1aa0d3481a73ec114578925bfd63f7
      b5818f87
  4. 01 4月, 2020 3 次提交
  5. 31 3月, 2020 3 次提交
  6. 30 3月, 2020 2 次提交
  7. 29 3月, 2020 1 次提交
    • C
      Be able to decrease background thread's CPU priority when creating database backup (#6602) · ee50b8d4
      Cheng Chang 提交于
      Summary:
      When creating a database backup, the background threads will not only consume IO resources by copying files, but also consuming CPU such as by computing checksums. During peak times, the CPU consumption by the background threads might affect online queries.
      
      This PR makes it possible to decrease CPU priority of these threads when creating a new backup.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6602
      
      Test Plan: make check
      
      Reviewed By: siying, zhichao-cao
      
      Differential Revision: D20683216
      
      Pulled By: cheng-chang
      
      fbshipit-source-id: 9978b9ed9488e8ce135e90ca083e5b4b7221fd84
      ee50b8d4
  8. 28 3月, 2020 5 次提交
  9. 27 3月, 2020 5 次提交
    • P
      Streamline persistent_cache_test for testing efficiency (#6601) · e91d1a21
      Peter Dillinger 提交于
      Summary:
      This test was written like a stress test, using up to 3x26GB
      RSS memory during parallel 'make check'. Now, while this code is mostly
      dormant, I've made the "for Travis" versions of the expensive tests the
      canonical versions and disabled the expensive versions. This has the
      side benefit of removing some arbitrary conditional compilation.
      
      For unknown reason, the super expensive tests were gated on
      Snappy_Supported, which appears to be irrelevant, so I removed it.
      
      The tests can be fixed / improved / migrated to stress test if/when they
      are deemed important again.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6601
      
      Test Plan:
      make check + CI
      
      ./persistent_cache_test Before:
      ...
      [==========] 10 tests from 2 test cases ran. (114541 ms total)
      [  PASSED  ] 10 tests.
      YOU HAVE 1 DISABLED TEST
      
      After:
      ...
      [==========] 3 tests from 2 test cases ran. (1714 ms total)
      [  PASSED  ] 3 tests.
      YOU HAVE 10 DISABLED TESTS
      
      Reviewed By: siying
      
      Differential Revision: D20680983
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 2be0fde13eeb0a71110ac7f5477cfe63996a509e
      e91d1a21
    • L
      Add blob files to VersionStorageInfo/VersionBuilder (#6597) · 6f62322f
      Levi Tamasi 提交于
      Summary:
      The patch adds a couple of classes to represent metadata about
      blob files: `SharedBlobFileMetaData` contains the information elements
      that are immutable (once the blob file is closed), e.g. blob file number,
      total number and size of blob files, checksum method/value, while
      `BlobFileMetaData` contains attributes that can vary across versions like
      the amount of garbage in the file. There is a single `SharedBlobFileMetaData`
      for each blob file, which is jointly owned by the `BlobFileMetaData` objects
      that point to it; `BlobFileMetaData` objects, in turn, are owned by `Version`s
      and can also be shared if the (immutable _and_ mutable) state of the blob file
      is the same in two versions.
      
      In addition, the patch adds the blob file metadata to `VersionStorageInfo`, and extends
      `VersionBuilder` so that it can apply blob file related `VersionEdit`s (i.e. those
      containing `BlobFileAddition`s and/or `BlobFileGarbage`), and save blob file metadata
      to a new `VersionStorageInfo`. Consistency checks are also extended to ensure
      that table files point to blob files that are part of the `Version`, and that all blob files
      that are part of any given `Version` have at least some _non_-garbage data in them.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6597
      
      Test Plan: `make check`
      
      Reviewed By: riversand963
      
      Differential Revision: D20656803
      
      Pulled By: ltamasi
      
      fbshipit-source-id: f1f74d135045b3b42d0146f03ee576ef0a4bfd80
      6f62322f
    • L
      Use function objects as deleters in the block cache (#6545) · 6301dbe7
      Levi Tamasi 提交于
      Summary:
      As the first step of reintroducing eviction statistics for the block
      cache, the patch switches from using simple function pointers as deleters
      to function objects implementing an interface. This will enable using
      deleters that have state, like a smart pointer to the statistics object
      that is to be updated when an entry is removed from the cache. For now,
      the patch adds a deleter template class `SimpleDeleter`, which simply
      casts the `value` pointer to its original type and calls `delete` or
      `delete[]` on it as appropriate. Note: to prevent object lifecycle
      issues, deleters must outlive the cache entries referring to them;
      `SimpleDeleter` ensures this by using the ("leaky") Meyers singleton
      pattern.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6545
      
      Test Plan: `make asan_check`
      
      Reviewed By: siying
      
      Differential Revision: D20475823
      
      Pulled By: ltamasi
      
      fbshipit-source-id: fe354c33dd96d9bafc094605462352305449a22a
      6301dbe7
    • M
      Fix iterator reading filter block despite read_tier == kBlockCacheTier (#6562) · 963af52f
      Mike Kolupaev 提交于
      Summary:
      We're seeing iterators with `ReadOptions::read_tier == kBlockCacheTier` sometimes doing file reads. Stack trace:
      
      ```
      rocksdb::RandomAccessFileReader::Read(unsigned long, unsigned long, rocksdb::Slice*, char*, bool) const
      rocksdb::BlockFetcher::ReadBlockContents()
      rocksdb::Status rocksdb::BlockBasedTable::MaybeReadBlockAndLoadToCache<rocksdb::ParsedFullFilterBlock>(rocksdb::FilePrefetchBuffer*, rocksdb::ReadOptions const&, rocksdb::BlockHandle const&, rocksdb::UncompressionDict const&, rocksdb::CachableEntry<rocksdb::ParsedFullFilterBlock>*, rocksdb::BlockType, rocksdb::GetContext*, rocksdb::BlockCacheLookupContext*, rocksdb::BlockContents*) const
      rocksdb::Status rocksdb::BlockBasedTable::RetrieveBlock<rocksdb::ParsedFullFilterBlock>(rocksdb::FilePrefetchBuffer*, rocksdb::ReadOptions const&, rocksdb::BlockHandle const&, rocksdb::UncompressionDict const&, rocksdb::CachableEntry<rocksdb::ParsedFullFilterBlock>*, rocksdb::BlockType, rocksdb::GetContext*, rocksdb::BlockCacheLookupContext*, bool, bool) const
      rocksdb::FilterBlockReaderCommon<rocksdb::ParsedFullFilterBlock>::ReadFilterBlock(rocksdb::BlockBasedTable const*, rocksdb::FilePrefetchBuffer*, rocksdb::ReadOptions const&, bool, rocksdb::GetContext*, rocksdb::BlockCacheLookupContext*, rocksdb::CachableEntry<rocksdb::ParsedFullFilterBlock>*)
      rocksdb::FilterBlockReaderCommon<rocksdb::ParsedFullFilterBlock>::GetOrReadFilterBlock(bool, rocksdb::GetContext*, rocksdb::BlockCacheLookupContext*, rocksdb::CachableEntry<rocksdb::ParsedFullFilterBlock>*) const
      rocksdb::FullFilterBlockReader::MayMatch(rocksdb::Slice const&, bool, rocksdb::GetContext*, rocksdb::BlockCacheLookupContext*) const
      rocksdb::FullFilterBlockReader::RangeMayExist(rocksdb::Slice const*, rocksdb::Slice const&, rocksdb::SliceTransform const*, rocksdb::Comparator const*, rocksdb::Slice const*, bool*, bool, rocksdb::BlockCacheLookupContext*)
      rocksdb::BlockBasedTable::PrefixMayMatch(rocksdb::Slice const&, rocksdb::ReadOptions const&, rocksdb::SliceTransform const*, bool, rocksdb::BlockCacheLookupContext*) const
      rocksdb::BlockBasedTableIterator<rocksdb::DataBlockIter, rocksdb::Slice>::SeekImpl(rocksdb::Slice const*)
      rocksdb::ForwardIterator::SeekInternal(rocksdb::Slice const&, bool)
      rocksdb::DBIter::Seek(rocksdb::Slice const&)
      ```
      
      `BlockBasedTableIterator::CheckPrefixMayMatch` was missing a check for `kBlockCacheTier`. This PR adds it.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6562
      
      Test Plan: deployed it to a logdevice test cluster and looked at logdevice's IO tracing.
      
      Reviewed By: siying
      
      Differential Revision: D20529368
      
      Pulled By: al13n321
      
      fbshipit-source-id: 65bf33964b1951464415c900336635fb20919611
      963af52f
    • P
      Re-update check_format_compatible.sh for default format_version=4 (#6598) · e70629e5
      Peter Dillinger 提交于
      Summary:
      Forward compatibility with new defaults only starts from 5.16
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6598
      
      Test Plan: facebook automated test (so much easier than running myself)
      
      Reviewed By: riversand963
      
      Differential Revision: D20665553
      
      Pulled By: pdillinger
      
      fbshipit-source-id: b846bfaccf4d0946f92d323a3b4ee6e3e548df93
      e70629e5
  10. 26 3月, 2020 1 次提交
  11. 25 3月, 2020 4 次提交
    • P
      Update default BBTO::format_version from 2 to 4 (#6582) · 93b80ca7
      Peter Dillinger 提交于
      Summary:
      Version 4 has been around long enough, for compatibility and
      extensive validation, that it should be default.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6582
      
      Test Plan:
      CI (w.r.t. changing the default; format_version=4 is well
      tested and massively in production at Facebook)
      
      Reviewed By: siying
      
      Differential Revision: D20625233
      
      Pulled By: pdillinger
      
      fbshipit-source-id: 2f83ed874cffa4a39bc7a66cdf3833b978fbb948
      93b80ca7
    • 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
    • S
      CompactRange() to use bottom pool when goes to bottommost level (#6593) · 6fd0ed49
      sdong 提交于
      Summary:
      In automatic compaction, if a compaction is bottommost, it goes to bottom thread pool. We should do the same for manual compaction too.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6593
      
      Test Plan: Add a unit test. See all existing tests pass.
      
      Reviewed By: ajkr
      
      Differential Revision: D20637408
      
      fbshipit-source-id: cb03031e8f895085f7acf6d2d65e69e84c9ddef3
      6fd0ed49
    • A
      Create a thread in DeleteScheduler only when rate limit enabled (#6564) · ceeca754
      akankshamahajan 提交于
      Summary:
      Create a thread in DeleteScheduler only when delete rate limit is set
      	 because when there is no rate limit on deletion, a thread per DeleteScheduler
      	 consumes unnecessary resources.
      
      Test Plan: make -j64 check
      
      Reviewed By: riversand963
      
      Differential Revision: D20538138
      
      Pulled By: akankshamahajan15
      
      fbshipit-source-id: 137499e810e817156345c30d627f8678b9adadf7
      ceeca754