mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-24 02:30:51 +00:00
Only grab AlterLock when we do alter.
This commit is contained in:
parent
4c675f0151
commit
b25b778349
@ -80,7 +80,6 @@ BlockIO InterpreterAlterQuery::executeToTable(const ASTAlterQuery & alter)
|
|||||||
if (table->isStaticStorage())
|
if (table->isStaticStorage())
|
||||||
throw Exception(ErrorCodes::TABLE_IS_READ_ONLY, "Table is read-only");
|
throw Exception(ErrorCodes::TABLE_IS_READ_ONLY, "Table is read-only");
|
||||||
auto table_lock = table->lockForShare(getContext()->getCurrentQueryId(), getContext()->getSettingsRef().lock_acquire_timeout);
|
auto table_lock = table->lockForShare(getContext()->getCurrentQueryId(), getContext()->getSettingsRef().lock_acquire_timeout);
|
||||||
auto alter_lock = table->lockForAlter(getContext()->getSettingsRef().lock_acquire_timeout);
|
|
||||||
auto metadata_snapshot = table->getInMemoryMetadataPtr();
|
auto metadata_snapshot = table->getInMemoryMetadataPtr();
|
||||||
|
|
||||||
/// Add default database to table identifiers that we can encounter in e.g. default expressions, mutation expression, etc.
|
/// Add default database to table identifiers that we can encounter in e.g. default expressions, mutation expression, etc.
|
||||||
@ -160,6 +159,7 @@ BlockIO InterpreterAlterQuery::executeToTable(const ASTAlterQuery & alter)
|
|||||||
|
|
||||||
if (!alter_commands.empty())
|
if (!alter_commands.empty())
|
||||||
{
|
{
|
||||||
|
auto alter_lock = table->lockForAlter(getContext()->getSettingsRef().lock_acquire_timeout);
|
||||||
StorageInMemoryMetadata metadata = table->getInMemoryMetadata();
|
StorageInMemoryMetadata metadata = table->getInMemoryMetadata();
|
||||||
alter_commands.validate(metadata, getContext());
|
alter_commands.validate(metadata, getContext());
|
||||||
alter_commands.prepare(metadata);
|
alter_commands.prepare(metadata);
|
||||||
|
Loading…
Reference in New Issue
Block a user