Core/Logging:
- Implement sLog.outSQLDriver that will log SQL driver related events (non-content related). - Queries will now be logged into this file as well instead of normal log file (requires debug build). - Don´t forget to update your authserver.conf and worldserver.conf Core/build: - Fix non-PCH build --HG-- branch : trunk
This commit is contained in:
1 parent
11de1d4369
commit
175fece073
7 files changed
+74
-30
No files matched your search
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DatabaseWorker.h"
|
||||
#include "DatabaseWorkerPool.h"
|
||||
#include "MySQLConnection.h"
|
||||
#include "SQLOperation.h"
|
||||
@@ -38,7 +39,7 @@ DatabaseWorkerPool::~DatabaseWorkerPool()
|
||||
|
||||
bool DatabaseWorkerPool::Open(const std::string& infoString, uint8 num_threads)
|
||||
{
|
||||
sLog.outDebug("Creating bundled/master MySQL connection.");
|
||||
sLog.outSQLDriver("Creating bundled/master MySQL connection.");
|
||||
m_bundle_conn = new MySQLConnection();
|
||||
m_bundle_conn->Open(infoString);
|
||||
++m_connections;
|
||||
@@ -51,7 +52,7 @@ bool DatabaseWorkerPool::Open(const std::string& infoString, uint8 num_threads)
|
||||
m_async_connections[i] = new MySQLConnection(m_queue);
|
||||
m_async_connections[i]->Open(infoString);
|
||||
++m_connections;
|
||||
sLog.outDebug("Async database thread pool opened. Worker thread count: %u", num_threads);
|
||||
sLog.outSQLDriver("Async database thread pool opened. Worker thread count: %u", num_threads);
|
||||
}
|
||||
|
||||
m_infoString = infoString;
|
||||
@@ -60,7 +61,7 @@ bool DatabaseWorkerPool::Open(const std::string& infoString, uint8 num_threads)
|
||||
|
||||
void DatabaseWorkerPool::Close()
|
||||
{
|
||||
sLog.outStaticDebug("Closing down %u connections on this DatabaseWorkerPool", (uint32)m_connections.value());
|
||||
sLog.outSQLDriver("Closing down %u connections on this DatabaseWorkerPool", (uint32)m_connections.value());
|
||||
/// Shuts down worker threads for this connection pool.
|
||||
m_queue->queue()->deactivate();
|
||||
|
||||
@@ -73,14 +74,14 @@ void DatabaseWorkerPool::Close()
|
||||
delete m_bundle_conn;
|
||||
m_bundle_conn = NULL;
|
||||
--m_connections;
|
||||
sLog.outStaticDebug("Closed bundled connection.");
|
||||
sLog.outSQLDriver("Closed bundled connection.");
|
||||
|
||||
//- MySQL::Thread_End() should be called manually from the aborting calling threads
|
||||
sLog.outStaticDebug("Waiting for %u synchroneous database threads to exit.", (uint32)m_connections.value());
|
||||
sLog.outSQLDriver("Waiting for %u synchroneous database threads to exit.", (uint32)m_connections.value());
|
||||
while (!m_sync_connections.empty())
|
||||
{
|
||||
}
|
||||
sLog.outStaticDebug("Synchroneous database threads exited succesfuly.");
|
||||
sLog.outSQLDriver("Synchroneous database threads exited succesfuly.");
|
||||
}
|
||||
|
||||
/*! This function creates a new MySQL connection for every MapUpdate thread
|
||||
@@ -96,12 +97,12 @@ void DatabaseWorkerPool::Init_MySQL_Connection()
|
||||
ConnectionMap::const_iterator itr = m_sync_connections.find(ACE_Based::Thread::current());
|
||||
#ifdef _DEBUG
|
||||
if (itr != m_sync_connections.end())
|
||||
sLog.outError("Thread ["UI64FMTD"] already started a MySQL connection", (uint64)ACE_Based::Thread::currentId());
|
||||
sLog.outSQLDriver("Thread ["UI64FMTD"] already started a MySQL connection", (uint64)ACE_Based::Thread::currentId());
|
||||
#endif
|
||||
m_sync_connections[ACE_Based::Thread::current()] = conn;
|
||||
}
|
||||
|
||||
sLog.outDebug("Core thread with ID ["UI64FMTD"] initializing MySQL connection.",
|
||||
sLog.outSQLDriver("Core thread with ID ["UI64FMTD"] initializing MySQL connection.",
|
||||
(uint64)ACE_Based::Thread::currentId());
|
||||
|
||||
++m_connections;
|
||||
@@ -115,7 +116,7 @@ void DatabaseWorkerPool::End_MySQL_Connection()
|
||||
ConnectionMap::iterator itr = m_sync_connections.find(ACE_Based::Thread::current());
|
||||
#ifdef _DEBUG
|
||||
if (itr == m_sync_connections.end())
|
||||
sLog.outError("Thread ["UI64FMTD" already shut down their MySQL connection.", (uint64)ACE_Based::Thread::currentId());
|
||||
sLog.outSQLDriver("Thread ["UI64FMTD"] already shut down their MySQL connection.", (uint64)ACE_Based::Thread::currentId());
|
||||
#endif
|
||||
conn = itr->second;
|
||||
m_sync_connections.erase(itr);
|
||||
@@ -197,12 +198,12 @@ void DatabaseWorkerPool::CommitTransaction(SQLTransaction transaction)
|
||||
#ifdef _DEBUG
|
||||
if (transaction->GetSize() == 0)
|
||||
{
|
||||
sLog.outError("Transaction contains 0 queries");
|
||||
sLog.outSQLDriver("Transaction contains 0 queries. Not executing.");
|
||||
return;
|
||||
}
|
||||
if (transaction->GetSize() == 1)
|
||||
{
|
||||
sLog.outDetail("Warning: Transaction only holds 1 query, consider removing Transaction context in code.");
|
||||
sLog.outSQLDriver("Warning: Transaction only holds 1 query, consider removing Transaction context in code.");
|
||||
}
|
||||
#endif
|
||||
Enqueue(new TransactionTask(transaction));
|
||||
|
||||
Reference in new issue
Block a user