mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 01:22:04 +00:00
Correctly accuire lock
This commit is contained in:
parent
5a96eaf0e8
commit
2dca542d2e
@ -3272,9 +3272,8 @@ void StorageReplicatedMergeTree::alter(
|
||||
std::vector<ChangedNode> changed_nodes;
|
||||
|
||||
{
|
||||
/// Just to read current structure. Alter will be done in separate thread.
|
||||
auto table_lock = lockStructureForShare(false, query_context.getCurrentQueryId());
|
||||
|
||||
/// Guard races of alter thread metadata change
|
||||
lockNewDataStructureExclusively(table_lock_holder, query_context.getCurrentQueryId());
|
||||
if (is_readonly)
|
||||
throw Exception("Can't ALTER readonly table", ErrorCodes::TABLE_IS_READ_ONLY);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user