mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-04 05:22:17 +00:00
Added lock for table structure during validation of alter commands in order to fix segfault during coucurrent alter.
This commit is contained in:
parent
97f5b3dfaa
commit
9437a1abce
@ -252,10 +252,15 @@ void AlterCommands::apply(ColumnsDescription & columns_description) const
|
||||
columns_description = std::move(new_columns_description);
|
||||
}
|
||||
|
||||
void AlterCommands::validate(const IStorage & table, const Context & context)
|
||||
void AlterCommands::validate(IStorage & table, const Context & context)
|
||||
{
|
||||
auto all_columns = table.getColumns().getAll();
|
||||
auto defaults = table.getColumns().defaults;
|
||||
NamesAndTypesList all_columns;
|
||||
ColumnDefaults defaults;
|
||||
{
|
||||
auto structure_lock = table.lockStructure(/*will_modify_data = */ false, __PRETTY_FUNCTION__);
|
||||
all_columns = table.getColumns().getAll();
|
||||
defaults = table.getColumns().defaults;
|
||||
}
|
||||
|
||||
std::vector<std::pair<NameAndTypePair, AlterCommand *>> defaulted_columns{};
|
||||
|
||||
|
@ -60,7 +60,7 @@ class AlterCommands : public std::vector<AlterCommand>
|
||||
public:
|
||||
void apply(ColumnsDescription & columns_description) const;
|
||||
|
||||
void validate(const IStorage & table, const Context & context);
|
||||
void validate(IStorage & table, const Context & context);
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user