Revision 2d9efc9ab2475876270741f0592da13eef44096b authored by Cheng Chang on 12 March 2020, 01:36:43 UTC, committed by Facebook GitHub Bot on 12 March 2020, 01:40:05 UTC
Summary: In Linux, when reopening DB with many SST files, profiling shows that 100% system cpu time spent for a couple of seconds for `GetLogicalBufferSize`. This slows down MyRocks' recovery time when site is down. This PR introduces two new APIs: 1. `Env::RegisterDbPaths` and `Env::UnregisterDbPaths` lets `DB` tell the env when it starts or stops using its database directories . The `PosixFileSystem` takes this opportunity to set up a cache from database directories to the corresponding logical block sizes. 2. `LogicalBlockSizeCache` is defined only for OS_LINUX to cache the logical block sizes. Other modifications: 1. rename `logical buffer size` to `logical block size` to be consistent with Linux terms. 2. declare `GetLogicalBlockSize` in `PosixHelper` to expose it to `PosixFileSystem`. 3. change the functions `IOError` and `IOStatus` in `env/io_posix.h` to have external linkage since they are used in other translation units too. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6457 Test Plan: 1. A new unit test is added for `LogicalBlockSizeCache` in `env/io_posix_test.cc`. 2. A new integration test is added for `DB` operations related to the cache in `db/db_logical_block_size_cache_test.cc`. `make check` Differential Revision: D20131243 Pulled By: cheng-chang fbshipit-source-id: 3077c50f8065c0bffb544d8f49fb10bba9408d04
1 parent 331e619
File | Mode | Size |
---|---|---|
.gitignore | -rw-r--r-- | 200 bytes |
Makefile | -rw-r--r-- | 2.5 KB |
README.md | -rw-r--r-- | 120 bytes |
c_simple_example.c | -rw-r--r-- | 2.6 KB |
column_families_example.cc | -rw-r--r-- | 2.0 KB |
compact_files_example.cc | -rw-r--r-- | 5.7 KB |
compaction_filter_example.cc | -rw-r--r-- | 3.0 KB |
multi_processes_example.cc | -rw-r--r-- | 11.8 KB |
optimistic_transaction_example.cc | -rw-r--r-- | 5.0 KB |
options_file_example.cc | -rw-r--r-- | 4.0 KB |
rocksdb_option_file_example.ini | -rw-r--r-- | 4.6 KB |
simple_example.cc | -rw-r--r-- | 2.4 KB |
transaction_example.cc | -rw-r--r-- | 5.3 KB |
Computing file changes ...