mirror of https://github.com/Icinga/icinga2.git
RedisWriter: sync all config objects atomically
This commit is contained in:
parent
c92827fa5e
commit
1ad9c80143
|
@ -93,14 +93,13 @@ void RedisWriter::UpdateAllConfigObjects(void)
|
||||||
if (!ctype)
|
if (!ctype)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ctype->GetObject(name))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
deleteQuery.push_back("icinga:config:" + type + ":" + name);
|
deleteQuery.push_back("icinga:config:" + type + ":" + name);
|
||||||
deleteQuery.push_back("icinga:status:" + type + ":" + name);
|
deleteQuery.push_back("icinga:status:" + type + ":" + name);
|
||||||
}
|
}
|
||||||
} while (cursor != 0);
|
} while (cursor != 0);
|
||||||
|
|
||||||
|
ExecuteQuery({ "MULTI" });
|
||||||
|
|
||||||
if (deleteQuery.size() > 1)
|
if (deleteQuery.size() > 1)
|
||||||
ExecuteQuery(deleteQuery);
|
ExecuteQuery(deleteQuery);
|
||||||
|
|
||||||
|
@ -125,6 +124,8 @@ void RedisWriter::UpdateAllConfigObjects(void)
|
||||||
ExecuteQuery({ "PUBLISH", "icinga:config:dump", typeName });
|
ExecuteQuery({ "PUBLISH", "icinga:config:dump", typeName });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ExecuteQuery({ "EXEC" });
|
||||||
|
|
||||||
Log(LogInformation, "RedisWriter")
|
Log(LogInformation, "RedisWriter")
|
||||||
<< "Initial config/status dump finished in " << Utility::GetTime() - startTime << " seconds.";
|
<< "Initial config/status dump finished in " << Utility::GetTime() - startTime << " seconds.";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue