Core/DBLayer:

- DB Threading model update
* Get rid of ThreadBundleMask and bundled connection
* Implement configurable amount of Synch threads for databasepools
* Use modulus based algorithm to check for free synchronous connections instead of previous ¨get connection by thread key or bundlemask¨ feature
* Locks on mysql context objects are now managed outside the mysql query methods

Fixes issue #4058
Fixes issue #4059
Introduces a ton of more issues. Use at own risk. You were warned. Really.

Don´t forget to update your worldserver.conf

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-09-27 00:20:56 +02:00
parent 894b2081b3
commit a9e9a2c884
11 changed files with 172 additions and 241 deletions

View File

@@ -339,15 +339,22 @@ bool StartDB()
return false;
}
uint8 num_threads = sConfig.GetIntDefault("LoginDatabase.WorkerThreads", 1);
if (num_threads < 1 || num_threads > 32)
uint8 worker_threads = sConfig.GetIntDefault("LoginDatabase.WorkerThreads", 1);
if (worker_threads < 1 || worker_threads > 32)
{
sLog.outError("Improper value specified for LoginDatabase.WorkerThreads, defaulting to 1.");
num_threads = 1;
worker_threads = 1;
}
//- Authserver has singlethreaded synchronous DB access, hence MYSQL_BUNDLE_ALL
if (!LoginDatabase.Open(dbstring.c_str(), num_threads, MYSQL_BUNDLE_ALL))
uint8 synch_threads = sConfig.GetIntDefault("LoginDatabase.SynchThreads", 1);
if (synch_threads < 1 || synch_threads > 32)
{
sLog.outError("Improper value specified for LoginDatabase.SynchThreads, defaulting to 1.");
synch_threads = 1;
}
/// NOTE: While authserver is singlethreaded you should keep synch_threads == 1. Increasing it is just silly since only 1 will be used ever.
if (!LoginDatabase.Open(dbstring.c_str(), worker_threads, synch_threads))
{
sLog.outError("Cannot connect to database");
return false;