From: Gunnar Beutner Date: Mon, 16 Sep 2013 08:06:09 +0000 (+0200) Subject: cluster: Re-open logfile after log replay. X-Git-Tag: v0.0.3~505 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e383a3cc3e9fd7d828787a6e2c42dc168d9e26d5;p=icinga2 cluster: Re-open logfile after log replay. --- diff --git a/components/cluster/clustercomponent.cpp b/components/cluster/clustercomponent.cpp index 031fade31..e34833d59 100644 --- a/components/cluster/clustercomponent.cpp +++ b/components/cluster/clustercomponent.cpp @@ -336,10 +336,6 @@ void ClusterComponent::ReplayLog(const Endpoint::Ptr& endpoint, const Stream::Pt CloseLogFile(); RotateLogFile(); - std::vector files; - Utility::Glob(GetClusterDir() + "log/*", boost::bind(&ClusterComponent::LogGlobHandler, boost::ref(files), _1)); - std::sort(files.begin(), files.end()); - if (count == -1 || count > 50000) { OpenLogFile(); olock.Unlock(); @@ -349,6 +345,10 @@ void ClusterComponent::ReplayLog(const Endpoint::Ptr& endpoint, const Stream::Pt count = 0; + std::vector files; + Utility::Glob(GetClusterDir() + "log/*", boost::bind(&ClusterComponent::LogGlobHandler, boost::ref(files), _1)); + std::sort(files.begin(), files.end()); + BOOST_FOREACH(int ts, files) { String path = GetClusterDir() + "log/" + Convert::ToString(ts); @@ -391,9 +391,13 @@ void ClusterComponent::ReplayLog(const Endpoint::Ptr& endpoint, const Stream::Pt Log(LogInformation, "cluster", "Replayed " + Convert::ToString(count) + " messages."); if (last_sync) { - ObjectLock olock2(endpoint); + { + ObjectLock olock2(endpoint); + endpoint->SetSyncing(false); + } + + OpenLogFile(); - endpoint->SetSyncing(false); break; } }