Sessions in clickhouse-keeper are local entity for each quorum participant but some information about session are global for the state of keeper: session_ids and corresponding ephemeral nodes. It make sense to send close requests to RAFT during server shutdown so all connected sessions will be closed properly and corresponding ephemeral nodes will be removed from state.

{
    return checkInit() && hasLeader() && !server->isRecovering();
}
void KeeperDispatcher::updateConfiguration(const Poco::Util::AbstractConfiguration & config)
{
    auto diff = server->getConfigurationDiff(config);
    if (diff.empty())
        LOG_TRACE(log, "Configuration update triggered, but nothing changed for RAFT");
    else if (diff.size() > 1)
        LOG_WARNING(log, "Configuration changed for more than one server ({}) from cluster, it's strictly not recommended", diff.size());
    else
        LOG_DEBUG(log, "Configuration change size ({})", diff.size());
    for (auto & change : diff)
    {
        bool push_result = update_configuration_queue.push(change);
        if (!push_result)
            throw Exception(ErrorCodes::SYSTEM_ERROR, "Cannot push configuration update to queue");
    }
}
void KeeperDispatcher::updateKeeperStatLatency(uint64_t process_time_ms)