mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
slightly better
This commit is contained in:
parent
db0beabb1c
commit
e439921d37
@ -375,6 +375,12 @@ void IMergeTreeDataPart::unloadIndex()
|
||||
index_loaded = false;
|
||||
}
|
||||
|
||||
bool IMergeTreeDataPart::isIndexLoaded() const
|
||||
{
|
||||
std::scoped_lock lock(index_mutex);
|
||||
return index_loaded;
|
||||
}
|
||||
|
||||
void IMergeTreeDataPart::setName(const String & new_name)
|
||||
{
|
||||
mutable_name = new_name;
|
||||
|
@ -369,6 +369,7 @@ public:
|
||||
void setIndex(const Columns & cols_);
|
||||
void setIndex(Columns && cols_);
|
||||
void unloadIndex();
|
||||
bool isIndexLoaded() const;
|
||||
|
||||
/// For data in RAM ('index')
|
||||
UInt64 getIndexSizeInBytes() const;
|
||||
|
@ -8622,7 +8622,9 @@ size_t MergeTreeData::unloadPrimaryKeysOfOutdatedParts()
|
||||
for (const auto & part : parts_range)
|
||||
{
|
||||
/// Outdated part may be hold by SELECT query and still needs the index.
|
||||
if (part.unique())
|
||||
/// This check requires lock of index_mutex but if outdated part is unique then there is no
|
||||
/// contention on it, so it's relatively cheap and it's ok to check under a global parts lock.
|
||||
if (part.unique() && part->isIndexLoaded())
|
||||
parts_to_unload_index.push_back(part);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user