mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-29 21:20:49 +00:00
Fsync at server shutdown
This commit is contained in:
parent
6e244e7bb1
commit
ff663dc511
@ -467,6 +467,17 @@ void Changelog::flush()
|
||||
current_writer->flush();
|
||||
}
|
||||
|
||||
Changelog::~Changelog() = default;
|
||||
Changelog::~Changelog()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (current_writer)
|
||||
current_writer->flush();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
tryLogCurrentException(__PRETTY_FUNCTION__);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -66,6 +66,11 @@ void InMemoryStateManager::loadLogStore(size_t start_log_index)
|
||||
log_store->init(start_log_index);
|
||||
}
|
||||
|
||||
void InMemoryStateManager::flushLogStore()
|
||||
{
|
||||
log_store->flush();
|
||||
}
|
||||
|
||||
void InMemoryStateManager::save_config(const nuraft::cluster_config & config)
|
||||
{
|
||||
// Just keep in memory in this example.
|
||||
|
@ -27,6 +27,8 @@ public:
|
||||
|
||||
void loadLogStore(size_t start_log_index);
|
||||
|
||||
void flushLogStore();
|
||||
|
||||
nuraft::ptr<nuraft::cluster_config> load_config() override { return cluster_config; }
|
||||
|
||||
void save_config(const nuraft::cluster_config & config) override;
|
||||
|
@ -67,6 +67,7 @@ void NuKeeperServer::startup()
|
||||
void NuKeeperServer::shutdown()
|
||||
{
|
||||
state_machine->shutdownStorage();
|
||||
state_manager->flushLogStore();
|
||||
if (!launcher.shutdown(coordination_settings->shutdown_timeout.totalSeconds()))
|
||||
LOG_WARNING(&Poco::Logger::get("NuKeeperServer"), "Failed to shutdown RAFT server in {} seconds", 5);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user