fix race on system restart replica

This commit is contained in:
Alexander Tokmakov 2022-08-23 16:10:44 +02:00
parent 24615059fb
commit 77178a18fa
2 changed files with 5 additions and 2 deletions

View File

@ -573,7 +573,9 @@ StoragePtr InterpreterSystemQuery::tryRestartReplica(const StorageID & replica,
database->detachTable(system_context, replica.table_name);
}
UUID uuid = table->getStorageID().uuid;
table.reset();
database->waitDetachedTableNotInUse(uuid);
/// Attach actions
/// getCreateTableQuery must return canonical CREATE query representation, there are no need for AST postprocessing

View File

@ -428,8 +428,6 @@ void TCPHandler::runImpl()
if (e.code() == ErrorCodes::UNKNOWN_PACKET_FROM_CLIENT)
throw;
LOG_TEST(log, "Going to close connection due to exception: {}", e.message());
/// If there is UNEXPECTED_PACKET_FROM_CLIENT emulate network_error
/// to break the loop, but do not throw to send the exception to
/// the client.
@ -439,6 +437,9 @@ void TCPHandler::runImpl()
/// If a timeout occurred, try to inform client about it and close the session
if (e.code() == ErrorCodes::SOCKET_TIMEOUT)
network_error = true;
if (network_error)
LOG_TEST(log, "Going to close connection due to exception: {}", e.message());
}
catch (const Poco::Net::NetException & e)
{