mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 16:12:01 +00:00
Add some locks on freeze and support |freezeAll()| for replicated merge-tree.
This commit is contained in:
parent
aeb0759f22
commit
4eb0f33ec2
@ -815,6 +815,8 @@ void StorageMergeTree::dropPartition(const ASTPtr & /*query*/, const ASTPtr & pa
|
|||||||
|
|
||||||
void StorageMergeTree::attachPartition(const ASTPtr & partition, bool part, const Context & context)
|
void StorageMergeTree::attachPartition(const ASTPtr & partition, bool part, const Context & context)
|
||||||
{
|
{
|
||||||
|
// TODO: should get some locks to prevent race with 'alter … modify column'
|
||||||
|
|
||||||
String partition_id;
|
String partition_id;
|
||||||
|
|
||||||
if (part)
|
if (part)
|
||||||
@ -869,6 +871,7 @@ void StorageMergeTree::attachPartition(const ASTPtr & partition, bool part, cons
|
|||||||
|
|
||||||
void StorageMergeTree::freezePartition(const ASTPtr & partition, const String & with_name, const Context & context)
|
void StorageMergeTree::freezePartition(const ASTPtr & partition, const String & with_name, const Context & context)
|
||||||
{
|
{
|
||||||
|
auto lock = lockStructure(false, __PRETTY_FUNCTION__);
|
||||||
data.freezePartition(partition, with_name, context);
|
data.freezePartition(partition, with_name, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3279,6 +3279,15 @@ void StorageReplicatedMergeTree::alter(const AlterCommands & params,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Do freeze of all parts local-only after all other operations.
|
||||||
|
for (const AlterCommand & param : params)
|
||||||
|
{
|
||||||
|
if (param.type == AlterCommand::FREEZE_ALL)
|
||||||
|
{
|
||||||
|
data.freezeAll(param.with_name, context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LOG_DEBUG(log, "ALTER finished");
|
LOG_DEBUG(log, "ALTER finished");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3427,6 +3436,8 @@ void StorageReplicatedMergeTree::truncate(const ASTPtr & query)
|
|||||||
|
|
||||||
void StorageReplicatedMergeTree::attachPartition(const ASTPtr & partition, bool attach_part, const Context & context)
|
void StorageReplicatedMergeTree::attachPartition(const ASTPtr & partition, bool attach_part, const Context & context)
|
||||||
{
|
{
|
||||||
|
// TODO: should get some locks to prevent race with 'alter … modify column'
|
||||||
|
|
||||||
assertNotReadonly();
|
assertNotReadonly();
|
||||||
|
|
||||||
String partition_id;
|
String partition_id;
|
||||||
@ -4156,6 +4167,7 @@ void StorageReplicatedMergeTree::fetchPartition(const ASTPtr & partition, const
|
|||||||
|
|
||||||
void StorageReplicatedMergeTree::freezePartition(const ASTPtr & partition, const String & with_name, const Context & context)
|
void StorageReplicatedMergeTree::freezePartition(const ASTPtr & partition, const String & with_name, const Context & context)
|
||||||
{
|
{
|
||||||
|
auto lock = lockStructure(false, __PRETTY_FUNCTION__);
|
||||||
data.freezePartition(partition, with_name, context);
|
data.freezePartition(partition, with_name, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user