This commit is contained in:
Nikita Mikhaylov 2023-07-17 12:59:58 +00:00
parent 9014e7e8c0
commit 01cd7a1fd7
3 changed files with 2 additions and 13 deletions

View File

@ -2829,16 +2829,6 @@ std::map<String, zkutil::ZooKeeperPtr> Context::getAuxiliaryZooKeepers() const
}
#if USE_ROCKSDB
MergeTreeMetadataCachePtr Context::getMergeTreeMetadataCache() const
{
auto cache = tryGetMergeTreeMetadataCache();
if (!cache)
throw Exception(
ErrorCodes::BAD_ARGUMENTS,
"Merge tree metadata cache is not initialized, please add config merge_tree_metadata_cache in config.xml and restart");
return cache;
}
MergeTreeMetadataCachePtr Context::tryGetMergeTreeMetadataCache() const
{
return shared->merge_tree_metadata_cache;

View File

@ -855,7 +855,6 @@ public:
void setClientProtocolVersion(UInt64 version);
#if USE_ROCKSDB
MergeTreeMetadataCachePtr getMergeTreeMetadataCache() const;
MergeTreeMetadataCachePtr tryGetMergeTreeMetadataCache() const;
#endif

View File

@ -1660,8 +1660,8 @@ std::pair<bool, NameSet> IMergeTreeDataPart::canRemovePart() const
void IMergeTreeDataPart::initializePartMetadataManager()
{
#if USE_ROCKSDB
if (use_metadata_cache)
metadata_manager = std::make_shared<PartMetadataManagerWithCache>(this, storage.getContext()->getMergeTreeMetadataCache());
if (auto metadata_cache = getContext()->tryGetMergeTreeMetadataCache(); metadata_cache && use_metadata_cache)
metadata_manager = std::make_shared<PartMetadataManagerWithCache>(this, metadata_cache);
else
metadata_manager = std::make_shared<PartMetadataManagerOrdinary>(this);
#else