mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-26 23:24:09 +02:00
IdoCheckTask: de-couple MySQL and Postgres schema versions
This commit is contained in:
parent
83cfb84fe0
commit
9e2f58ea9f
@ -12,7 +12,6 @@
|
|||||||
#include <boost/thread/once.hpp>
|
#include <boost/thread/once.hpp>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#define IDO_CURRENT_SCHEMA_VERSION "1.14.3"
|
|
||||||
#define IDO_COMPAT_SCHEMA_VERSION "1.14.3"
|
#define IDO_COMPAT_SCHEMA_VERSION "1.14.3"
|
||||||
|
|
||||||
namespace icinga
|
namespace icinga
|
||||||
@ -30,6 +29,8 @@ public:
|
|||||||
|
|
||||||
static void InitializeDbTimer();
|
static void InitializeDbTimer();
|
||||||
|
|
||||||
|
virtual const char * GetLatestSchemaVersion() const noexcept = 0;
|
||||||
|
|
||||||
void SetConfigHash(const DbObject::Ptr& dbobj, const String& hash);
|
void SetConfigHash(const DbObject::Ptr& dbobj, const String& hash);
|
||||||
void SetConfigHash(const DbType::Ptr& type, const DbReference& objid, const String& hash);
|
void SetConfigHash(const DbType::Ptr& type, const DbReference& objid, const String& hash);
|
||||||
String GetConfigHash(const DbObject::Ptr& dbobj) const;
|
String GetConfigHash(const DbObject::Ptr& dbobj) const;
|
||||||
|
@ -140,9 +140,9 @@ void IdoCheckTask::ScriptFunc(const Checkable::Ptr& checkable, const CheckResult
|
|||||||
String schema_version = conn->GetSchemaVersion();
|
String schema_version = conn->GetSchemaVersion();
|
||||||
std::ostringstream msgbuf;
|
std::ostringstream msgbuf;
|
||||||
|
|
||||||
if (Utility::CompareVersion(IDO_CURRENT_SCHEMA_VERSION, schema_version) < 0) {
|
if (Utility::CompareVersion(conn->GetLatestSchemaVersion(), schema_version) < 0) {
|
||||||
msgbuf << "Outdated schema version: '" << schema_version << "'. Latest version: '"
|
msgbuf << "Outdated schema version: '" << schema_version << "'. Latest version: '"
|
||||||
<< IDO_CURRENT_SCHEMA_VERSION << "'."
|
<< conn->GetLatestSchemaVersion() << "'."
|
||||||
<< " Queries per second: " << std::fixed << std::setprecision(3) << qps
|
<< " Queries per second: " << std::fixed << std::setprecision(3) << qps
|
||||||
<< " Pending queries: " << std::fixed << std::setprecision(3) << pendingQueries << ".";
|
<< " Pending queries: " << std::fixed << std::setprecision(3) << pendingQueries << ".";
|
||||||
|
|
||||||
|
@ -21,6 +21,11 @@ using namespace icinga;
|
|||||||
REGISTER_TYPE(IdoMysqlConnection);
|
REGISTER_TYPE(IdoMysqlConnection);
|
||||||
REGISTER_STATSFUNCTION(IdoMysqlConnection, &IdoMysqlConnection::StatsFunc);
|
REGISTER_STATSFUNCTION(IdoMysqlConnection, &IdoMysqlConnection::StatsFunc);
|
||||||
|
|
||||||
|
const char * IdoMysqlConnection::GetLatestSchemaVersion() const noexcept
|
||||||
|
{
|
||||||
|
return "1.14.3";
|
||||||
|
}
|
||||||
|
|
||||||
void IdoMysqlConnection::OnConfigLoaded()
|
void IdoMysqlConnection::OnConfigLoaded()
|
||||||
{
|
{
|
||||||
ObjectImpl<IdoMysqlConnection>::OnConfigLoaded();
|
ObjectImpl<IdoMysqlConnection>::OnConfigLoaded();
|
||||||
|
@ -37,6 +37,8 @@ public:
|
|||||||
|
|
||||||
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
|
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
|
||||||
|
|
||||||
|
const char * GetLatestSchemaVersion() const noexcept override;
|
||||||
|
|
||||||
int GetPendingQueryCount() const override;
|
int GetPendingQueryCount() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -23,6 +23,11 @@ REGISTER_TYPE(IdoPgsqlConnection);
|
|||||||
|
|
||||||
REGISTER_STATSFUNCTION(IdoPgsqlConnection, &IdoPgsqlConnection::StatsFunc);
|
REGISTER_STATSFUNCTION(IdoPgsqlConnection, &IdoPgsqlConnection::StatsFunc);
|
||||||
|
|
||||||
|
const char * IdoPgsqlConnection::GetLatestSchemaVersion() const noexcept
|
||||||
|
{
|
||||||
|
return "1.14.3";
|
||||||
|
}
|
||||||
|
|
||||||
IdoPgsqlConnection::IdoPgsqlConnection()
|
IdoPgsqlConnection::IdoPgsqlConnection()
|
||||||
{
|
{
|
||||||
m_QueryQueue.SetName("IdoPgsqlConnection, " + GetName());
|
m_QueryQueue.SetName("IdoPgsqlConnection, " + GetName());
|
||||||
|
@ -30,6 +30,8 @@ public:
|
|||||||
|
|
||||||
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
|
static void StatsFunc(const Dictionary::Ptr& status, const Array::Ptr& perfdata);
|
||||||
|
|
||||||
|
const char * GetLatestSchemaVersion() const noexcept override;
|
||||||
|
|
||||||
int GetPendingQueryCount() const override;
|
int GetPendingQueryCount() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user