rocksdb/cache
Peter Dillinger b6e33dbc0e Fix HyperClockCache Rollback bug in #10801 (#10843)
Summary:
In https://github.com/facebook/rocksdb/issues/10801 in ClockHandleTable::Evict, we saved a reference to the hash value (`const UniqueId64x2& hashed_key`) instead of saving the hash value itself before marking the handle as empty and thus free for use by other threads. This could lead to Rollback seeing the wrong hash value for updating the `displacements` after an entry is removed.

The fix is (like other places) to copy the hash value before it's released. (We could Rollback while we own the entry, but that creates more dependences between atomic updates, because in that case, based on the code, the Rollback writes would have to happen before or after the entry is released by marking empty. By doing the relaxed Rollback after marking empty, there's more opportunity for re-ordering / ILP.)

Intended follow-up: refactoring for better code sharing in clock_cache.cc

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10843

Test Plan: watch for clean crash test, TSAN

Reviewed By: siying

Differential Revision: D40579680

Pulled By: pdillinger

fbshipit-source-id: 258e43b3b80bc980a161d5c675ccc6708ecb8025
2022-10-21 12:09:03 -07:00
..
cache.cc
cache_bench.cc
cache_bench_tool.cc
cache_entry_roles.cc
cache_entry_roles.h
cache_entry_stats.h
cache_helpers.h
cache_key.cc
cache_key.h
cache_reservation_manager.cc
cache_reservation_manager.h
cache_reservation_manager_test.cc
cache_test.cc Refactor ShardedCache for more sharing, static polymorphism (#10801) 2022-10-18 22:06:57 -07:00
charged_cache.cc
charged_cache.h
clock_cache.cc Fix HyperClockCache Rollback bug in #10801 (#10843) 2022-10-21 12:09:03 -07:00
clock_cache.h Refactor ShardedCache for more sharing, static polymorphism (#10801) 2022-10-18 22:06:57 -07:00
compressed_secondary_cache.cc
compressed_secondary_cache.h
compressed_secondary_cache_test.cc
fast_lru_cache.cc Refactor ShardedCache for more sharing, static polymorphism (#10801) 2022-10-18 22:06:57 -07:00
fast_lru_cache.h Refactor ShardedCache for more sharing, static polymorphism (#10801) 2022-10-18 22:06:57 -07:00
lru_cache.cc Refactor ShardedCache for more sharing, static polymorphism (#10801) 2022-10-18 22:06:57 -07:00
lru_cache.h Refactor ShardedCache for more sharing, static polymorphism (#10801) 2022-10-18 22:06:57 -07:00
lru_cache_test.cc Refactor ShardedCache for more sharing, static polymorphism (#10801) 2022-10-18 22:06:57 -07:00
sharded_cache.cc Refactor ShardedCache for more sharing, static polymorphism (#10801) 2022-10-18 22:06:57 -07:00
sharded_cache.h Refactor ShardedCache for more sharing, static polymorphism (#10801) 2022-10-18 22:06:57 -07:00