mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 18:36:31 +01:00
Core/DBLayer: Proper core-side handling of MySQL errno 1213 to prevent a snowballeffect (until innodb_lock_wait_timeout)
This commit is contained in:
@@ -24,7 +24,7 @@ void Transaction::Append(const char* sql)
|
||||
SQLElementData data;
|
||||
data.type = SQL_ELEMENT_RAW;
|
||||
data.element.query = strdup(sql);
|
||||
m_queries.push(data);
|
||||
m_queries.push_back(data);
|
||||
}
|
||||
|
||||
void Transaction::PAppend(const char* sql, ...)
|
||||
@@ -44,14 +44,18 @@ void Transaction::Append(PreparedStatement* stmt)
|
||||
SQLElementData data;
|
||||
data.type = SQL_ELEMENT_PREPARED;
|
||||
data.element.stmt = stmt;
|
||||
m_queries.push(data);
|
||||
m_queries.push_back(data);
|
||||
}
|
||||
|
||||
void Transaction::Cleanup()
|
||||
{
|
||||
// This might be called by explicit calls to Cleanup or by the auto-destructor
|
||||
if (_cleanedUp)
|
||||
return;
|
||||
|
||||
while (!m_queries.empty())
|
||||
{
|
||||
SQLElementData data = m_queries.front();
|
||||
SQLElementData const &data = m_queries.front();
|
||||
switch (data.type)
|
||||
{
|
||||
case SQL_ELEMENT_PREPARED:
|
||||
@@ -61,8 +65,11 @@ void Transaction::Cleanup()
|
||||
free((void*)(data.element.query));
|
||||
break;
|
||||
}
|
||||
m_queries.pop();
|
||||
|
||||
m_queries.pop_front();
|
||||
}
|
||||
|
||||
_cleanedUp = true;
|
||||
}
|
||||
|
||||
bool TransactionTask::Execute()
|
||||
@@ -78,5 +85,8 @@ bool TransactionTask::Execute()
|
||||
return true;
|
||||
}
|
||||
|
||||
// Clean up now.
|
||||
m_trans->Cleanup();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user