diff options
author | Peter Dillinger <peterd@fb.com> | 2021-08-18 11:32:00 -0700 |
---|---|---|
committer | Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> | 2021-08-18 11:33:03 -0700 |
commit | b6269b078a58155e5dfe26d6af087ab10d5eba00 (patch) | |
tree | b1bd022b34b9cdac19f85d9474f5b6c9a0d8031a /db/repair.cc | |
parent | 2b367fa8cc58341ced2e5dae45396783143a6352 (diff) |
Stable cache keys on ingested SST files (#8669)
Summary:
Extends https://github.com/facebook/rocksdb/issues/8659 to work for ingested external SST files, even
the same file ingested into different DBs sharing a block cache.
Note: These new cache keys are currently only enabled when FileSystem
does not provide GetUniqueId. For now, they are typically larger,
so slightly less efficient.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/8669
Test Plan: Extended unit test
Reviewed By: zhichao-cao
Differential Revision: D30398532
Pulled By: pdillinger
fbshipit-source-id: 1f13e2af4b8bfff5741953a69466e9589fbc23c7
Diffstat (limited to 'db/repair.cc')
-rw-r--r-- | db/repair.cc | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/db/repair.cc b/db/repair.cc index 7eaf8adcc..3efe63dfc 100644 --- a/db/repair.cc +++ b/db/repair.cc @@ -93,6 +93,7 @@ class Repairer { const ColumnFamilyOptions& default_cf_opts, const ColumnFamilyOptions& unknown_cf_opts, bool create_unknown_cfs) : dbname_(dbname), + db_session_id_(DBImpl::GenerateDbSessionId(db_options.env)), env_(db_options.env), file_options_(), db_options_(SanitizeOptions(dbname_, db_options)), @@ -109,21 +110,16 @@ class Repairer { // TableCache can be small since we expect each table to be opened // once. NewLRUCache(10, db_options_.table_cache_numshardbits)), - table_cache_( - // TODO: db_session_id for TableCache should be initialized after - // db_session_id_ is set. - new TableCache(default_iopts_, &file_options_, - raw_table_cache_.get(), - /*block_cache_tracer=*/nullptr, - /*io_tracer=*/nullptr, /*db_session_id*/ "")), + table_cache_(new TableCache(default_iopts_, &file_options_, + raw_table_cache_.get(), + /*block_cache_tracer=*/nullptr, + /*io_tracer=*/nullptr, db_session_id_)), wb_(db_options_.db_write_buffer_size), wc_(db_options_.delayed_write_rate), - // TODO: db_session_id for VersionSet should be initialized after - // db_session_id_ is set and use it for initialization. vset_(dbname_, &immutable_db_options_, file_options_, raw_table_cache_.get(), &wb_, &wc_, /*block_cache_tracer=*/nullptr, /*io_tracer=*/nullptr, - /*db_session_id*/ ""), + db_session_id_), next_file_number_(1), db_lock_(nullptr), closed_(false) { @@ -198,10 +194,6 @@ class Repairer { } // Just create a DBImpl temporarily so we can reuse NewDB() db_impl = new DBImpl(db_options_, dbname_); - // Also use this temp DBImpl to get a session id - status = db_impl->GetDbSessionId(db_session_id_); - } - if (status.ok()) { status = db_impl->NewDB(/*new_filenames=*/nullptr); } delete db_impl; |