Core/DBLayer:

- Implement DatabaseWorkerPool::DirectCommitTransaction for synchronous transaction execution (as opposed to asynchronous/enqueued).
- Add MySQL errno 1213 "Deadlock found when trying to get lock; try restarting transaction" handler. If 1213 is called the core will retry to directly execute the transaction a maximum of 5 times.
This commit is contained in:
Machiavelli
2011-01-13 20:07:09 +01:00
parent 8d59953f93
commit cf9250c29f
5 changed files with 89 additions and 39 deletions

View File

@@ -18,6 +18,7 @@
#include <ace/Activation_Queue.h>
#include "DatabaseWorkerPool.h"
#include "Transaction.h"
#include "Util.h"
#ifndef _MYSQLCONNECTION_H
@@ -91,10 +92,13 @@ class MySQLConnection
void BeginTransaction();
void RollbackTransaction();
void CommitTransaction();
bool ExecuteTransaction(SQLTransaction& transaction);
operator bool () const { return m_Mysql != NULL; }
void Ping() { mysql_ping(m_Mysql); }
uint32 GetLastError() { return mysql_errno(m_Mysql); }
protected:
bool LockIfReady()
{