mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-25 22:54:57 +02:00
cluster: Re-open logfile after log replay.
This commit is contained in:
parent
235efa107b
commit
e383a3cc3e
@ -336,10 +336,6 @@ void ClusterComponent::ReplayLog(const Endpoint::Ptr& endpoint, const Stream::Pt
|
|||||||
CloseLogFile();
|
CloseLogFile();
|
||||||
RotateLogFile();
|
RotateLogFile();
|
||||||
|
|
||||||
std::vector<int> files;
|
|
||||||
Utility::Glob(GetClusterDir() + "log/*", boost::bind(&ClusterComponent::LogGlobHandler, boost::ref(files), _1));
|
|
||||||
std::sort(files.begin(), files.end());
|
|
||||||
|
|
||||||
if (count == -1 || count > 50000) {
|
if (count == -1 || count > 50000) {
|
||||||
OpenLogFile();
|
OpenLogFile();
|
||||||
olock.Unlock();
|
olock.Unlock();
|
||||||
@ -349,6 +345,10 @@ void ClusterComponent::ReplayLog(const Endpoint::Ptr& endpoint, const Stream::Pt
|
|||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
|
|
||||||
|
std::vector<int> files;
|
||||||
|
Utility::Glob(GetClusterDir() + "log/*", boost::bind(&ClusterComponent::LogGlobHandler, boost::ref(files), _1));
|
||||||
|
std::sort(files.begin(), files.end());
|
||||||
|
|
||||||
BOOST_FOREACH(int ts, files) {
|
BOOST_FOREACH(int ts, files) {
|
||||||
String path = GetClusterDir() + "log/" + Convert::ToString(ts);
|
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.");
|
Log(LogInformation, "cluster", "Replayed " + Convert::ToString(count) + " messages.");
|
||||||
|
|
||||||
if (last_sync) {
|
if (last_sync) {
|
||||||
ObjectLock olock2(endpoint);
|
{
|
||||||
|
ObjectLock olock2(endpoint);
|
||||||
|
endpoint->SetSyncing(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenLogFile();
|
||||||
|
|
||||||
endpoint->SetSyncing(false);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user