diff options
author | Machiavelli <none@none> | 2010-09-27 00:20:56 +0200 |
---|---|---|
committer | Machiavelli <none@none> | 2010-09-27 00:20:56 +0200 |
commit | a9e9a2c8848c22e4a3e3b7bab0caeca25d9ea408 (patch) | |
tree | a7c4960796d0a9a42cb1e0252d4a75c4436d1f01 /src/server/worldserver/Master.cpp | |
parent | 894b2081b3837575bd44c71ea4ebc76008b5b5e3 (diff) |
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
Diffstat (limited to 'src/server/worldserver/Master.cpp')
-rw-r--r-- | src/server/worldserver/Master.cpp | 40 |
1 files changed, 13 insertions, 27 deletions
diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index 3dca8d3935b..bf1811523bb 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -163,14 +163,6 @@ public: sLog.outString ("Starting Remote access listner on port %d on %s", raport, stringip.c_str ()); } - - if ((LoginDatabase.GetBundleMask() & MYSQL_BUNDLE_RA)) - { - LoginDatabase.Init_MySQL_Connection(); - needInit = false; - } - if (needInit) - MySQL::Thread_Init(); } // Socket Selet time is in microseconds , not miliseconds!! @@ -184,11 +176,6 @@ public: h.Select (0, socketSelecttime); checkping (); } - - if (!needInit) - LoginDatabase.End_MySQL_Connection(); - else - MySQL::Thread_End(); } else { @@ -452,8 +439,7 @@ bool Master::_StartDB() { sLog.SetLogDB(false); std::string dbstring; - uint8 num_threads; - int32 mask; + uint8 async_threads, synch_threads; dbstring = sConfig.GetStringDefault("WorldDatabaseInfo", ""); if (dbstring.empty()) @@ -462,18 +448,18 @@ bool Master::_StartDB() return false; } - num_threads = sConfig.GetIntDefault("WorldDatabase.WorkerThreads", 1); - if (num_threads < 1 || num_threads > 32) + async_threads = sConfig.GetIntDefault("WorldDatabase.WorkerThreads", 1); + if (async_threads < 1 || async_threads > 32) { sLog.outError("World database: invalid number of worker threads specified. " "Please pick a value between 1 and 32."); return false; } - mask = sConfig.GetIntDefault("WorldDatabase.ThreadBundleMask", MYSQL_BUNDLE_ALL); + synch_threads = sConfig.GetIntDefault("WorldDatabase.SynchThreads", 1); ///- Initialise the world database - if (!WorldDatabase.Open(dbstring, num_threads, MySQLThreadBundle(mask))) + if (!WorldDatabase.Open(dbstring, async_threads, synch_threads)) { sLog.outError("Cannot connect to world database %s", dbstring.c_str()); return false; @@ -486,18 +472,18 @@ bool Master::_StartDB() return false; } - num_threads = sConfig.GetIntDefault("CharacterDatabase.WorkerThreads", 1); - if (num_threads < 1 || num_threads > 32) + async_threads = sConfig.GetIntDefault("CharacterDatabase.WorkerThreads", 1); + if (async_threads < 1 || async_threads > 32) { sLog.outError("Character database: invalid number of worker threads specified. " "Please pick a value between 1 and 32."); return false; } - mask = sConfig.GetIntDefault("CharacterDatabase.ThreadBundleMask", MYSQL_BUNDLE_ALL); + synch_threads = sConfig.GetIntDefault("CharacterDatabase.SynchThreads", 2); ///- Initialise the Character database - if (!CharacterDatabase.Open(dbstring, num_threads, MySQLThreadBundle(mask))) + if (!CharacterDatabase.Open(dbstring, async_threads, synch_threads)) { sLog.outError("Cannot connect to Character database %s", dbstring.c_str()); return false; @@ -511,18 +497,18 @@ bool Master::_StartDB() return false; } - num_threads = sConfig.GetIntDefault("LoginDatabase.WorkerThreads", 1); - if (num_threads < 1 || num_threads > 32) + async_threads = sConfig.GetIntDefault("LoginDatabase.WorkerThreads", 1); + if (async_threads < 1 || async_threads > 32) { sLog.outError("Login database: invalid number of worker threads specified. " "Please pick a value between 1 and 32."); return false; } - mask = sConfig.GetIntDefault("LoginDatabase.ThreadBundleMask", MYSQL_BUNDLE_ALL); + synch_threads = sConfig.GetIntDefault("LoginDatabase.SynchThreads", 1); ///- Initialise the login database - if (!LoginDatabase.Open(dbstring, num_threads, MySQLThreadBundle(mask))) + if (!LoginDatabase.Open(dbstring, async_threads, synch_threads)) { sLog.outError("Cannot connect to login database %s", dbstring.c_str()); return false; |