From a40209e84d078ab6a26e7366f0513afba3803978 Mon Sep 17 00:00:00 2001 From: alesapin Date: Tue, 6 Apr 2021 15:25:15 +0300 Subject: [PATCH 1/2] Remove strange fsync on coordination logs rotation --- src/Coordination/Changelog.cpp | 4 ---- src/Coordination/KeeperServer.cpp | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Coordination/Changelog.cpp b/src/Coordination/Changelog.cpp index 227192fdf8a..871a7f8734a 100644 --- a/src/Coordination/Changelog.cpp +++ b/src/Coordination/Changelog.cpp @@ -357,10 +357,6 @@ void Changelog::readChangelogAndInitWriter(size_t last_commited_log_index, size_ void Changelog::rotate(size_t new_start_log_index) { - //// doesn't exist on init - if (current_writer) - current_writer->flush(); - ChangelogFileDescription new_description; new_description.prefix = DEFAULT_PREFIX; new_description.from_log_index = new_start_log_index; diff --git a/src/Coordination/KeeperServer.cpp b/src/Coordination/KeeperServer.cpp index c7446c296f0..5d08c2825f5 100644 --- a/src/Coordination/KeeperServer.cpp +++ b/src/Coordination/KeeperServer.cpp @@ -192,15 +192,15 @@ bool KeeperServer::isLeaderAlive() const nuraft::cb_func::ReturnCode KeeperServer::callbackFunc(nuraft::cb_func::Type type, nuraft::cb_func::Param * /* param */) { + if (initialized_flag) + return nuraft::cb_func::ReturnCode::Ok; + size_t last_commited = state_machine->last_commit_index(); size_t next_index = state_manager->getLogStore()->next_slot(); bool commited_store = false; if (next_index < last_commited || next_index - last_commited <= 1) commited_store = true; - if (initialized_flag) - return nuraft::cb_func::ReturnCode::Ok; - auto set_initialized = [this] () { std::unique_lock lock(initialized_mutex); From 80d441ec9536dd93b3db3d03434dfb684f3d45a2 Mon Sep 17 00:00:00 2001 From: alesapin Date: Tue, 6 Apr 2021 19:11:29 +0300 Subject: [PATCH 2/2] Reset timeouts to default --- tests/config/config.d/database_replicated.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/config/config.d/database_replicated.xml b/tests/config/config.d/database_replicated.xml index c2e62f9645a..1e6871a525d 100644 --- a/tests/config/config.d/database_replicated.xml +++ b/tests/config/config.d/database_replicated.xml @@ -19,8 +19,8 @@ 1 - 5000 - 10000 + 10000 + 30000 1000 2000 4000