mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 13:45:04 +02:00
DB IDO: Don't enqueue queries when the feature is paused (HA)
fixes #5876 refs #6739
This commit is contained in:
parent
680103f111
commit
c0c6ea545b
@ -162,6 +162,9 @@ void IdoMysqlConnection::TxTimerHandler()
|
|||||||
|
|
||||||
void IdoMysqlConnection::NewTransaction()
|
void IdoMysqlConnection::NewTransaction()
|
||||||
{
|
{
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef I2_DEBUG /* I2_DEBUG */
|
#ifdef I2_DEBUG /* I2_DEBUG */
|
||||||
Log(LogDebug, "IdoMysqlConnection")
|
Log(LogDebug, "IdoMysqlConnection")
|
||||||
<< "Scheduling new transaction and finishing async queries.";
|
<< "Scheduling new transaction and finishing async queries.";
|
||||||
@ -715,6 +718,9 @@ void IdoMysqlConnection::DiscardRows(const IdoMysqlResult& result)
|
|||||||
|
|
||||||
void IdoMysqlConnection::ActivateObject(const DbObject::Ptr& dbobj)
|
void IdoMysqlConnection::ActivateObject(const DbObject::Ptr& dbobj)
|
||||||
{
|
{
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef I2_DEBUG /* I2_DEBUG */
|
#ifdef I2_DEBUG /* I2_DEBUG */
|
||||||
Log(LogDebug, "IdoMysqlConnection")
|
Log(LogDebug, "IdoMysqlConnection")
|
||||||
<< "Scheduling object activation task for '" << dbobj->GetName1() << "!" << dbobj->GetName2() << "'.";
|
<< "Scheduling object activation task for '" << dbobj->GetName1() << "!" << dbobj->GetName2() << "'.";
|
||||||
@ -727,6 +733,9 @@ void IdoMysqlConnection::InternalActivateObject(const DbObject::Ptr& dbobj)
|
|||||||
{
|
{
|
||||||
AssertOnWorkQueue();
|
AssertOnWorkQueue();
|
||||||
|
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!GetConnected())
|
if (!GetConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -754,6 +763,9 @@ void IdoMysqlConnection::InternalActivateObject(const DbObject::Ptr& dbobj)
|
|||||||
|
|
||||||
void IdoMysqlConnection::DeactivateObject(const DbObject::Ptr& dbobj)
|
void IdoMysqlConnection::DeactivateObject(const DbObject::Ptr& dbobj)
|
||||||
{
|
{
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef I2_DEBUG /* I2_DEBUG */
|
#ifdef I2_DEBUG /* I2_DEBUG */
|
||||||
Log(LogDebug, "IdoMysqlConnection")
|
Log(LogDebug, "IdoMysqlConnection")
|
||||||
<< "Scheduling object deactivation task for '" << dbobj->GetName1() << "!" << dbobj->GetName2() << "'.";
|
<< "Scheduling object deactivation task for '" << dbobj->GetName1() << "!" << dbobj->GetName2() << "'.";
|
||||||
@ -766,6 +778,9 @@ void IdoMysqlConnection::InternalDeactivateObject(const DbObject::Ptr& dbobj)
|
|||||||
{
|
{
|
||||||
AssertOnWorkQueue();
|
AssertOnWorkQueue();
|
||||||
|
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!GetConnected())
|
if (!GetConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -855,6 +870,9 @@ bool IdoMysqlConnection::FieldToEscapedString(const String& key, const Value& va
|
|||||||
|
|
||||||
void IdoMysqlConnection::ExecuteQuery(const DbQuery& query)
|
void IdoMysqlConnection::ExecuteQuery(const DbQuery& query)
|
||||||
{
|
{
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
ASSERT(query.Category != DbCatInvalid);
|
ASSERT(query.Category != DbCatInvalid);
|
||||||
|
|
||||||
#ifdef I2_DEBUG /* I2_DEBUG */
|
#ifdef I2_DEBUG /* I2_DEBUG */
|
||||||
@ -867,6 +885,9 @@ void IdoMysqlConnection::ExecuteQuery(const DbQuery& query)
|
|||||||
|
|
||||||
void IdoMysqlConnection::ExecuteMultipleQueries(const std::vector<DbQuery>& queries)
|
void IdoMysqlConnection::ExecuteMultipleQueries(const std::vector<DbQuery>& queries)
|
||||||
{
|
{
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
if (queries.empty())
|
if (queries.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -914,6 +935,9 @@ void IdoMysqlConnection::InternalExecuteMultipleQueries(const std::vector<DbQuer
|
|||||||
{
|
{
|
||||||
AssertOnWorkQueue();
|
AssertOnWorkQueue();
|
||||||
|
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!GetConnected())
|
if (!GetConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -942,6 +966,9 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, int typeOver
|
|||||||
{
|
{
|
||||||
AssertOnWorkQueue();
|
AssertOnWorkQueue();
|
||||||
|
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!GetConnected())
|
if (!GetConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1129,6 +1156,9 @@ void IdoMysqlConnection::FinishExecuteQuery(const DbQuery& query, int type, bool
|
|||||||
|
|
||||||
void IdoMysqlConnection::CleanUpExecuteQuery(const String& table, const String& time_column, double max_age)
|
void IdoMysqlConnection::CleanUpExecuteQuery(const String& table, const String& time_column, double max_age)
|
||||||
{
|
{
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef I2_DEBUG /* I2_DEBUG */
|
#ifdef I2_DEBUG /* I2_DEBUG */
|
||||||
Log(LogDebug, "IdoMysqlConnection")
|
Log(LogDebug, "IdoMysqlConnection")
|
||||||
<< "Rescheduling cleanup query for table '" << table << "' and column '"
|
<< "Rescheduling cleanup query for table '" << table << "' and column '"
|
||||||
@ -1142,6 +1172,9 @@ void IdoMysqlConnection::InternalCleanUpExecuteQuery(const String& table, const
|
|||||||
{
|
{
|
||||||
AssertOnWorkQueue();
|
AssertOnWorkQueue();
|
||||||
|
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!GetConnected())
|
if (!GetConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -163,6 +163,9 @@ void IdoPgsqlConnection::TxTimerHandler()
|
|||||||
|
|
||||||
void IdoPgsqlConnection::NewTransaction()
|
void IdoPgsqlConnection::NewTransaction()
|
||||||
{
|
{
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalNewTransaction, this), PriorityHigh, true);
|
m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalNewTransaction, this), PriorityHigh, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,6 +572,9 @@ Dictionary::Ptr IdoPgsqlConnection::FetchRow(const IdoPgsqlResult& result, int r
|
|||||||
|
|
||||||
void IdoPgsqlConnection::ActivateObject(const DbObject::Ptr& dbobj)
|
void IdoPgsqlConnection::ActivateObject(const DbObject::Ptr& dbobj)
|
||||||
{
|
{
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalActivateObject, this, dbobj), PriorityLow);
|
m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalActivateObject, this, dbobj), PriorityLow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,6 +609,9 @@ void IdoPgsqlConnection::InternalActivateObject(const DbObject::Ptr& dbobj)
|
|||||||
|
|
||||||
void IdoPgsqlConnection::DeactivateObject(const DbObject::Ptr& dbobj)
|
void IdoPgsqlConnection::DeactivateObject(const DbObject::Ptr& dbobj)
|
||||||
{
|
{
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalDeactivateObject, this, dbobj), PriorityLow);
|
m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalDeactivateObject, this, dbobj), PriorityLow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -699,6 +708,9 @@ bool IdoPgsqlConnection::FieldToEscapedString(const String& key, const Value& va
|
|||||||
|
|
||||||
void IdoPgsqlConnection::ExecuteQuery(const DbQuery& query)
|
void IdoPgsqlConnection::ExecuteQuery(const DbQuery& query)
|
||||||
{
|
{
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
ASSERT(query.Category != DbCatInvalid);
|
ASSERT(query.Category != DbCatInvalid);
|
||||||
|
|
||||||
m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalExecuteQuery, this, query, -1), query.Priority, true);
|
m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalExecuteQuery, this, query, -1), query.Priority, true);
|
||||||
@ -706,6 +718,9 @@ void IdoPgsqlConnection::ExecuteQuery(const DbQuery& query)
|
|||||||
|
|
||||||
void IdoPgsqlConnection::ExecuteMultipleQueries(const std::vector<DbQuery>& queries)
|
void IdoPgsqlConnection::ExecuteMultipleQueries(const std::vector<DbQuery>& queries)
|
||||||
{
|
{
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
if (queries.empty())
|
if (queries.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -748,6 +763,9 @@ void IdoPgsqlConnection::InternalExecuteMultipleQueries(const std::vector<DbQuer
|
|||||||
{
|
{
|
||||||
AssertOnWorkQueue();
|
AssertOnWorkQueue();
|
||||||
|
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!GetConnected())
|
if (!GetConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -769,6 +787,9 @@ void IdoPgsqlConnection::InternalExecuteQuery(const DbQuery& query, int typeOver
|
|||||||
{
|
{
|
||||||
AssertOnWorkQueue();
|
AssertOnWorkQueue();
|
||||||
|
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!GetConnected())
|
if (!GetConnected())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -933,6 +954,9 @@ void IdoPgsqlConnection::InternalExecuteQuery(const DbQuery& query, int typeOver
|
|||||||
|
|
||||||
void IdoPgsqlConnection::CleanUpExecuteQuery(const String& table, const String& time_column, double max_age)
|
void IdoPgsqlConnection::CleanUpExecuteQuery(const String& table, const String& time_column, double max_age)
|
||||||
{
|
{
|
||||||
|
if (IsPaused())
|
||||||
|
return;
|
||||||
|
|
||||||
m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalCleanUpExecuteQuery, this, table, time_column, max_age), PriorityLow, true);
|
m_QueryQueue.Enqueue(std::bind(&IdoPgsqlConnection::InternalCleanUpExecuteQuery, this, table, time_column, max_age), PriorityLow, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user