RedisWriter: sync all config objects atomically

This commit is contained in:
Alexander A. Klimov 2018-06-22 17:29:47 +02:00 committed by Michael Friedrich
parent c92827fa5e
commit 1ad9c80143
1 changed files with 4 additions and 3 deletions

View File

@ -93,14 +93,13 @@ void RedisWriter::UpdateAllConfigObjects(void)
if (!ctype)
continue;
if (ctype->GetObject(name))
continue;
deleteQuery.push_back("icinga:config:" + type + ":" + name);
deleteQuery.push_back("icinga:status:" + type + ":" + name);
}
} while (cursor != 0);
ExecuteQuery({ "MULTI" });
if (deleteQuery.size() > 1)
ExecuteQuery(deleteQuery);
@ -125,6 +124,8 @@ void RedisWriter::UpdateAllConfigObjects(void)
ExecuteQuery({ "PUBLISH", "icinga:config:dump", typeName });
}
ExecuteQuery({ "EXEC" });
Log(LogInformation, "RedisWriter")
<< "Initial config/status dump finished in " << Utility::GetTime() - startTime << " seconds.";
}