Log can't-do-yets

This commit is contained in:
Alexander A. Klimov 2022-03-28 17:11:46 +02:00
parent 10b3bacb48
commit eddb4beea0
2 changed files with 11 additions and 16 deletions

View File

@ -488,6 +488,8 @@ void IdoMysqlConnection::FinishConnect(double startTime)
Query("COMMIT"); Query("COMMIT");
Query("BEGIN"); Query("BEGIN");
m_Reconnected = true;
} }
void IdoMysqlConnection::ClearTablesBySession() void IdoMysqlConnection::ClearTablesBySession()
@ -1016,12 +1018,10 @@ void IdoMysqlConnection::InternalExecuteMultipleQueries(const std::vector<DbQuer
ASSERT(query.Type == DbQueryNewTransaction || query.Category != DbCatInvalid); ASSERT(query.Type == DbQueryNewTransaction || query.Category != DbCatInvalid);
if (!CanExecuteQuery(query)) { if (!CanExecuteQuery(query)) {
if (m_Reconnected && query.Table != "contactnotifications")
#ifdef I2_DEBUG /* I2_DEBUG */ Log(LogDebug, "IdoMysqlConnectionDebug")
Log(LogDebug, "IdoMysqlConnection")
<< "Scheduling multiple execute query task again: Cannot execute query now. Type '" << "Scheduling multiple execute query task again: Cannot execute query now. Type '"
<< query.Type << "', table '" << query.Table << "', queue size: '" << GetPendingQueryCount() << "'."; << query.Type << "', table '" << query.Table << "', queue size: '" << GetPendingQueryCount() << "'.";
#endif /* I2_DEBUG */
m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::InternalExecuteMultipleQueries, this, queries), query.Priority); m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::InternalExecuteMultipleQueries, this, queries), query.Priority);
return; return;
@ -1066,12 +1066,10 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, int typeOver
/* check if there are missing object/insert ids and re-enqueue the query */ /* check if there are missing object/insert ids and re-enqueue the query */
if (!CanExecuteQuery(query)) { if (!CanExecuteQuery(query)) {
if (m_Reconnected && query.Table != "contactnotifications")
#ifdef I2_DEBUG /* I2_DEBUG */ Log(LogDebug, "IdoMysqlConnectionDebug")
Log(LogDebug, "IdoMysqlConnection")
<< "Scheduling execute query task again: Cannot execute query now. Type '" << "Scheduling execute query task again: Cannot execute query now. Type '"
<< typeOverride << "', table '" << query.Table << "', queue size: '" << GetPendingQueryCount() << "'."; << typeOverride << "', table '" << query.Table << "', queue size: '" << GetPendingQueryCount() << "'.";
#endif /* I2_DEBUG */
m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::InternalExecuteQuery, this, query, typeOverride), query.Priority); m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::InternalExecuteQuery, this, query, typeOverride), query.Priority);
return; return;
@ -1089,12 +1087,10 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, int typeOver
for (const Dictionary::Pair& kv : query.WhereCriteria) { for (const Dictionary::Pair& kv : query.WhereCriteria) {
if (!FieldToEscapedString(kv.first, kv.second, &value)) { if (!FieldToEscapedString(kv.first, kv.second, &value)) {
if (m_Reconnected && query.Table != "contactnotifications")
#ifdef I2_DEBUG /* I2_DEBUG */ Log(LogDebug, "IdoMysqlConnectionDebug")
Log(LogDebug, "IdoMysqlConnection")
<< "Scheduling execute query task again: Cannot execute query now. Type '" << "Scheduling execute query task again: Cannot execute query now. Type '"
<< typeOverride << "', table '" << query.Table << "', queue size: '" << GetPendingQueryCount() << "'."; << typeOverride << "', table '" << query.Table << "', queue size: '" << GetPendingQueryCount() << "'.";
#endif /* I2_DEBUG */
m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::InternalExecuteQuery, this, query, -1), query.Priority); m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::InternalExecuteQuery, this, query, -1), query.Priority);
return; return;
@ -1169,12 +1165,10 @@ void IdoMysqlConnection::InternalExecuteQuery(const DbQuery& query, int typeOver
continue; continue;
if (!FieldToEscapedString(kv.first, kv.second, &value)) { if (!FieldToEscapedString(kv.first, kv.second, &value)) {
if (m_Reconnected && query.Table != "contactnotifications")
#ifdef I2_DEBUG /* I2_DEBUG */ Log(LogDebug, "IdoMysqlConnectionDebug")
Log(LogDebug, "IdoMysqlConnection")
<< "Scheduling execute query task again: Cannot extract required INSERT/UPDATE fields, key '" << "Scheduling execute query task again: Cannot extract required INSERT/UPDATE fields, key '"
<< kv.first << "', val '" << kv.second << "', type " << typeOverride << ", table '" << query.Table << "'."; << kv.first << "', val '" << kv.second << "', type " << typeOverride << ", table '" << query.Table << "'.";
#endif /* I2_DEBUG */
m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::InternalExecuteQuery, this, query, -1), query.Priority); m_QueryQueue.Enqueue(std::bind(&IdoMysqlConnection::InternalExecuteQuery, this, query, -1), query.Priority);
return; return;

View File

@ -64,6 +64,7 @@ private:
std::vector<IdoAsyncQuery> m_AsyncQueries; std::vector<IdoAsyncQuery> m_AsyncQueries;
uint_fast32_t m_UncommittedAsyncQueries = 0; uint_fast32_t m_UncommittedAsyncQueries = 0;
bool m_Reconnected = false;
Timer::Ptr m_ReconnectTimer; Timer::Ptr m_ReconnectTimer;
Timer::Ptr m_TxTimer; Timer::Ptr m_TxTimer;