mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 00:52:02 +00:00
Merge pull request #6583 from yandex/fix-false-race-condition-on-frozen-field
Fixed false data race in "MergeTreeDataPart::is_frozen" field
This commit is contained in:
commit
4a54f3d7b6
@ -2876,7 +2876,7 @@ void MergeTreeData::freezePartitionsByMatcher(MatcherFn matcher, const String &
|
||||
String backup_part_absolute_path = part_absolute_path;
|
||||
backup_part_absolute_path.replace(0, clickhouse_path.size(), backup_path);
|
||||
localBackup(part_absolute_path, backup_part_absolute_path);
|
||||
part->is_frozen = true;
|
||||
part->is_frozen.store(true, std::memory_order_relaxed);
|
||||
++parts_processed;
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,8 @@ struct MergeTreeDataPart
|
||||
/// If true it means that there are no ZooKeeper node for this part, so it should be deleted only from filesystem
|
||||
bool is_duplicate = false;
|
||||
|
||||
/// Frozen by ALTER TABLE ... FREEZE ...
|
||||
mutable bool is_frozen = false;
|
||||
/// Frozen by ALTER TABLE ... FREEZE ... It is used for information purposes in system.parts table.
|
||||
mutable std::atomic<bool> is_frozen {false};
|
||||
|
||||
/**
|
||||
* Part state is a stage of its lifetime. States are ordered and state of a part could be increased only.
|
||||
|
@ -103,7 +103,7 @@ void StorageSystemParts::processNextStorage(MutableColumns & columns_, const Sto
|
||||
columns_[i++]->insert(static_cast<UInt64>(part->info.getDataVersion()));
|
||||
columns_[i++]->insert(part->getIndexSizeInBytes());
|
||||
columns_[i++]->insert(part->getIndexSizeInAllocatedBytes());
|
||||
columns_[i++]->insert(part->is_frozen);
|
||||
columns_[i++]->insert(part->is_frozen.load(std::memory_order_relaxed));
|
||||
|
||||
columns_[i++]->insert(info.database);
|
||||
columns_[i++]->insert(info.table);
|
||||
|
Loading…
Reference in New Issue
Block a user