fix merge state

Fix style && build
This commit is contained in:
sundy-li 2020-05-05 23:07:53 +08:00 committed by amudong
parent 906a43e4a8
commit d4aa3cea4b
5 changed files with 8 additions and 11 deletions

View File

@ -106,10 +106,10 @@ BlockIO InterpreterAlterQuery::execute()
replica_commands.validate(*table);
auto replicate_table = std::dynamic_pointer_cast<StorageReplicatedMergeTree>(table);
auto table_lock_holder = table->lockAlterIntention(context.getCurrentQueryId());
auto table_lock_holder = table->lockAlterIntention(context.getCurrentQueryId(), context.getSettingsRef().lock_acquire_timeout);
for (auto & command : replica_commands)
{
replicate_table->dropReplica(table_lock_holder, command.replica_name);
{
replicate_table->dropReplica(command.replica_name);
}
}
@ -294,7 +294,7 @@ AccessRightsElements InterpreterAlterQuery::getRequiredAccessForCommand(const AS
}
case ASTAlterCommand::DROP_REPLICA:
{
required_access.emplace_back(AccessType::ALTER_DELETE, alter.database, alter.table);
required_access.emplace_back(AccessType::ALTER_DELETE, database, table);
break;
}
case ASTAlterCommand::MODIFY_QUERY:

View File

@ -294,7 +294,6 @@ void ASTAlterCommand::formatImpl(
{
settings.ostr << (settings.hilite ? hilite_keyword : "") << indent_str << "REFRESH " << (settings.hilite ? hilite_none : "");
}
<<<<<<< HEAD
else if (type == ASTAlterCommand::RENAME_COLUMN)
{
settings.ostr << (settings.hilite ? hilite_keyword : "") << indent_str << "RENAME COLUMN " << (if_exists ? "IF EXISTS " : "")
@ -303,11 +302,9 @@ void ASTAlterCommand::formatImpl(
settings.ostr << (settings.hilite ? hilite_keyword : "") << " TO ";
rename_to->formatImpl(settings, state, frame);
=======
else if (type == ASTAlterCommand::DROP_REPLICA)
{
settings.ostr << (settings.hilite ? hilite_keyword : "") << indent_str << "DROP " << (settings.hilite ? hilite_none : "") << " " << std::quoted(replica_name, '\'');
>>>>>>> b3fa746... Add drop replica alter support
}
else
throw Exception("Unexpected type of ALTER", ErrorCodes::UNEXPECTED_AST_STRUCTURE);

View File

@ -58,7 +58,7 @@ public:
NO_TYPE,
LIVE_VIEW_REFRESH,
DROP_REPLICA,
};

View File

@ -4119,11 +4119,11 @@ void StorageReplicatedMergeTree::drop()
dropAllData();
}
void StorageReplicatedMergeTree::dropReplica(TableStructureWriteLockHolder & holder, const String & replica)
void StorageReplicatedMergeTree::dropReplica(const String & replica)
{
if (replica_name == replica)
{
drop(holder);
drop();
return;
}
removeReplica(replica);

View File

@ -117,7 +117,7 @@ public:
/** Removes a specific replica from Zookeeper. If replica is local, it works same as `drop` method.
*/
void dropReplica(TableStructureWriteLockHolder &, const String & replica_name);
void dropReplica(const String & replica_name);
void truncate(const ASTPtr &, const Context &, TableStructureWriteLockHolder &) override;