提交 fa609036 编写于 作者: A alesapin

Fix race condition

上级 ccc2bda6
......@@ -160,13 +160,14 @@ Pipes StorageBuffer::read(
{
auto destination = DatabaseCatalog::instance().getTable(destination_id, context);
auto destination_metadata_snapshot = destination->getInMemoryMetadataPtr();
if (destination.get() == this)
throw Exception("Destination table is myself. Read will cause infinite loop.", ErrorCodes::INFINITE_LOOP);
auto destination_lock = destination->lockStructureForShare(
false, context.getCurrentQueryId(), context.getSettingsRef().lock_acquire_timeout);
auto destination_metadata_snapshot = destination->getInMemoryMetadataPtr();
const bool dst_has_same_structure = std::all_of(column_names.begin(), column_names.end(), [metadata_snapshot, destination](const String& column_name)
{
const auto & dest_columns = destination->getColumns();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册