Fix clang tidy and race

This commit is contained in:
Alexander Sapin 2023-07-07 13:03:44 +02:00
parent 8cdb181c39
commit e618dd05cc
2 changed files with 13 additions and 4 deletions

View File

@ -2285,6 +2285,7 @@ void Server::updateServers(
Poco::Util::AbstractConfiguration & previous_config = latest_config ? *latest_config : this->config();
std::vector<ProtocolServerAdapter *> all_servers;
all_servers.reserve(servers.size() + servers_to_start_before_tables.size());
for (auto & server : servers)
all_servers.push_back(&server);

View File

@ -4890,14 +4890,23 @@ void StorageReplicatedMergeTree::shutdown()
if (shutdown_called.exchange(true))
return;
if (!shutdown_prepared_called.load())
flushAndPrepareForShutdown();
auto settings_ptr = getSettings();
if (!shutdown_deadline.has_value())
throw Exception(ErrorCodes::LOGICAL_ERROR, "Shutdown deadline is not set in shutdown");
try
{
waitForUniquePartsToBeFetchedByOtherReplicas(*shutdown_deadline);
}
catch (const Exception & ex)
{
if (ex.code() == ErrorCodes::LOGICAL_ERROR)
throw;
tryLogCurrentException(log, __PRETTY_FUNCTION__);
}
session_expired_callback_handler.reset();
stopOutdatedDataPartsLoadingTask();
@ -4905,7 +4914,6 @@ void StorageReplicatedMergeTree::shutdown()
partialShutdown();
part_moves_between_shards_orchestrator.shutdown();
background_operations_assignee.finish();
{
auto lock = queue.lockQueue();