Revision 6301dbe7a71d3663b87f66b3201ff8745bc48742 authored by Levi Tamasi on 26 March 2020, 23:16:43 UTC, committed by Facebook GitHub Bot on 26 March 2020, 23:19:58 UTC
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
1 parent 963af52
History
File Mode Size
cf_options.cc -rw-r--r-- 10.5 KB
cf_options.h -rw-r--r-- 8.8 KB
db_options.cc -rw-r--r-- 16.3 KB
db_options.h -rw-r--r-- 3.6 KB
options.cc -rw-r--r-- 25.7 KB
options_helper.cc -rw-r--r-- 92.5 KB
options_helper.h -rw-r--r-- 9.0 KB
options_parser.cc -rw-r--r-- 30.5 KB
options_parser.h -rw-r--r-- 5.2 KB
options_sanity_check.cc -rw-r--r-- 1.1 KB
options_sanity_check.h -rw-r--r-- 1.7 KB
options_settable_test.cc -rw-r--r-- 21.9 KB
options_test.cc -rw-r--r-- 80.7 KB

back to top