1. 01 4月, 2020 1 次提交
  2. 27 3月, 2020 1 次提交
    • 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
  3. 21 2月, 2020 1 次提交
    • S
      Replace namespace name "rocksdb" with ROCKSDB_NAMESPACE (#6433) · fdf882de
      sdong 提交于
      Summary:
      When dynamically linking two binaries together, different builds of RocksDB from two sources might cause errors. To provide a tool for user to solve the problem, the RocksDB namespace is changed to a flag which can be overridden in build time.
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/6433
      
      Test Plan: Build release, all and jtest. Try to build with ROCKSDB_NAMESPACE with another flag.
      
      Differential Revision: D19977691
      
      fbshipit-source-id: aa7f2d0972e1c31d75339ac48478f34f6cfcfb3e
      fdf882de
  4. 17 9月, 2019 1 次提交
    • M
      Charge block cache for cache internal usage (#5797) · 638d2395
      Maysam Yabandeh 提交于
      Summary:
      For our default block cache, each additional entry has extra memory overhead. It include LRUHandle (72 bytes currently) and the cache key (two varint64, file id and offset). The usage is not negligible. For example for block_size=4k, the overhead accounts for an extra 2% memory usage for the cache. The patch charging the cache for the extra usage, reducing untracked memory usage outside block cache. The feature is enabled by default and can be disabled by passing kDontChargeCacheMetadata to the cache constructor.
      This PR builds up on https://github.com/facebook/rocksdb/issues/4258
      Pull Request resolved: https://github.com/facebook/rocksdb/pull/5797
      
      Test Plan:
      - Existing tests are updated to either disable the feature when the test has too much dependency on the old way of accounting the usage or increasing the cache capacity to account for the additional charge of metadata.
      - The Usage tests in cache_test.cc are augmented to test the cache usage under kFullChargeCacheMetadata.
      
      Differential Revision: D17396833
      
      Pulled By: maysamyabandeh
      
      fbshipit-source-id: 7684ccb9f8a40ca595e4f5efcdb03623afea0c6f
      638d2395
  5. 06 4月, 2019 1 次提交
  6. 15 2月, 2019 1 次提交
    • M
      Apply modernize-use-override (2nd iteration) · ca89ac2b
      Michael Liu 提交于
      Summary:
      Use C++11’s override and remove virtual where applicable.
      Change are automatically generated.
      
      Reviewed By: Orvid
      
      Differential Revision: D14090024
      
      fbshipit-source-id: 1e9432e87d2657e1ff0028e15370a85d1739ba2a
      ca89ac2b
  7. 13 4月, 2018 1 次提交
  8. 06 4月, 2018 1 次提交
  9. 06 3月, 2018 1 次提交
  10. 23 2月, 2018 2 次提交
  11. 29 7月, 2017 1 次提交
    • S
      Replace dynamic_cast<> · 21696ba5
      Siying Dong 提交于
      Summary:
      Replace dynamic_cast<> so that users can choose to build with RTTI off, so that they can save several bytes per object, and get tiny more memory available.
      Some nontrivial changes:
      1. Add Comparator::GetRootComparator() to get around the internal comparator hack
      2. Add the two experiemental functions to DB
      3. Add TableFactory::GetOptionString() to avoid unnecessary casting to get the option string
      4. Since 3 is done, move the parsing option functions for table factory to table factory files too, to be symmetric.
      Closes https://github.com/facebook/rocksdb/pull/2645
      
      Differential Revision: D5502723
      
      Pulled By: siying
      
      fbshipit-source-id: fd13cec5601cf68a554d87bfcf056f2ffa5fbf7c
      21696ba5
  12. 22 7月, 2017 2 次提交
  13. 16 7月, 2017 1 次提交
  14. 28 4月, 2017 1 次提交
  15. 25 4月, 2017 1 次提交
    • M
      Add erase option to release cache · 4c9447d8
      Maysam Yabandeh 提交于
      Summary:
      This is useful when we put the entries in the block cache for accounting
      purposes and do not expect it to be used after it is released. If the cache does not
      erase the item in such cases not only the performance of cache is
      negatively affected but the item's destructor not being called at the
      time of release might violate the assumptions about the lifetime of the
      object.
      
      The new change adds a force_erase option to the Release method and
      returns a boolean to indicate whehter the item is successfully deleted.
      Closes https://github.com/facebook/rocksdb/pull/2180
      
      Differential Revision: D4916032
      
      Pulled By: maysamyabandeh
      
      fbshipit-source-id: 94409a346069923cac9de8e57adc313b4ed46f28
      4c9447d8
  16. 06 4月, 2017 1 次提交
  17. 27 1月, 2017 1 次提交
  18. 11 1月, 2017 1 次提交
    • A
      Allow incrementing refcount on cache handles · fe395fb6
      Andrew Kryczka 提交于
      Summary:
      Previously the only way to increment a handle's refcount was to invoke Lookup(), which (1) did hash table lookup to get cache handle, (2) incremented that handle's refcount. For a future DeleteRange optimization, I added a function, Ref(), for when the caller already has a cache handle and only needs to do (2).
      Closes https://github.com/facebook/rocksdb/pull/1761
      
      Differential Revision: D4397114
      
      Pulled By: ajkr
      
      fbshipit-source-id: 9addbe5
      fe395fb6
  19. 31 8月, 2016 1 次提交
    • Y
      Fix ClockCache memory leak · de47e2bd
      Yi Wu 提交于
      Summary:
      Fix ClockCache memory leak found by valgrind:
      # Add destructor to cleanup cached values.
      # Delete key with cache handle immediately after handle is recycled, and erase table entry immediately if duplicated cache entry is inserted.
      
      Test Plan:
          make DISABLE_JEMALLOC=1 valgrind_check
      
      Reviewers: IslamAbdelRahman, sdong
      
      Reviewed By: sdong
      
      Subscribers: andrewkr, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D62973
      de47e2bd
  20. 24 8月, 2016 1 次提交
  21. 20 8月, 2016 2 次提交
    • Y
      LRU cache mid-point insertion · 72f8cc70
      Yi Wu 提交于
      Summary:
      Add mid-point insertion functionality to LRU cache. Caller of `Cache::Insert()` can set an additional parameter to make a cache entry have higher priority. The LRU cache will reserve at most `capacity * high_pri_pool_pct` bytes for high-pri cache entries. If `high_pri_pool_pct` is zero, the cache degenerates to normal LRU cache.
      
      Context: If we are to put index and filter blocks into RocksDB block cache, index/filter block can be swap out too early. We want to add an option to RocksDB to reserve some capacity in block cache just for index/filter blocks, to mitigate the issue.
      
      In later diffs I'll update block based table reader to use the interface to cache index/filter blocks at high priority, and expose the option to `DBOptions` and make it dynamic changeable.
      
      Test Plan: unit test.
      
      Reviewers: IslamAbdelRahman, sdong, lightmark
      
      Reviewed By: lightmark
      
      Subscribers: andrewkr, dhruba, march, leveldb
      
      Differential Revision: https://reviews.facebook.net/D61977
      72f8cc70
    • Y
      Introduce ClockCache · 4cc37f59
      Yi Wu 提交于
      Summary:
      Clock-based cache implemenetation aim to have better concurreny than
      default LRU cache. See inline comments for implementation details.
      
      Test Plan:
      Update cache_test to run on both LRUCache and ClockCache. Adding some
      new tests to catch some of the bugs that I fixed while implementing the
      cache.
      
      Reviewers: kradhakrishnan, sdong
      
      Reviewed By: sdong
      
      Subscribers: andrewkr, dhruba, leveldb
      
      Differential Revision: https://reviews.facebook.net/D61647
      4cc37f59