diff options
author | Machiavelli <none@none> | 2010-08-18 02:25:52 +0200 |
---|---|---|
committer | Machiavelli <none@none> | 2010-08-18 02:25:52 +0200 |
commit | 87218eadcdeac5ba86a035edfd079958405cb24f (patch) | |
tree | b72020ed0d390953b70d2026bf4c0b16c8271d11 /src/server/worldserver/Master.cpp | |
parent | 1ab2bd6d58adf35090ca3a9ef82eee00a14ff507 (diff) |
* HIGHLY EXPERIMENTAL - USE AT OWN RISK *
Database Layer:
- Implement connection pooling: Instead of 1 delay thread per database, you can configure between 1 and 32 worker threads that have a seperate thread in the core and have a seperate connection to the MySQL server (based on raczman/Albator´s database layer for Trinitycore3)
- Implement a configurable thread bundle for synchroneous requests from seperate core threads (see worldserver.conf.dist for more info)
- Every mapupdate thread now has its seperate MySQL connection to the world and characters database
- Drop inconsistent PExecuteLog function - query logging will be implemented CONSISTENTLY later
- Drop current prepared statement interface - this will be done *properly* later
- You´ll need to update your worldserver.conf and authserver.conf
- You´re recommended to make a backup of your databases before using this.
* HIGHLY EXPERIMENTAL - USE AT OWN RISK *
* HIGHLY EXPERIMENTAL - USE AT OWN RISK *
etc.
--HG--
branch : trunk
Diffstat (limited to 'src/server/worldserver/Master.cpp')
-rw-r--r-- | src/server/worldserver/Master.cpp | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index ce2f442fa8f..ab906cb9b42 100644 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -370,9 +370,9 @@ int Master::Run() clearOnlineAccounts(); ///- Wait for delay threads to end - CharacterDatabase.HaltDelayThread(); - WorldDatabase.HaltDelayThread(); - LoginDatabase.HaltDelayThread(); + CharacterDatabase.Close(); + WorldDatabase.Close(); + LoginDatabase.Close(); sLog.outString( "Halting process..." ); @@ -439,8 +439,8 @@ bool Master::_StartDB() { sLog.SetLogDB(false); std::string dbstring; + uint8 num_threads; - ///- Get world database info from configuration file dbstring = sConfig.GetStringDefault("WorldDatabaseInfo", ""); if (dbstring.empty()) { @@ -448,13 +448,20 @@ bool Master::_StartDB() return false; } - ///- Initialise the world database - if( !WorldDatabase.Initialize(dbstring.c_str())) + num_threads = sConfig.GetIntDefault("WorldDatabase.WorkerThreads", 1); + if (num_threads < 1 || num_threads > 32) { - sLog.outError("Cannot connect to world database %s",dbstring.c_str()); + sLog.outError("World database: invalid number of worker threads specified. " + "Please pick a value between 1 and 32."); return false; } + ///- Initialise the world database + if (!WorldDatabase.Open(dbstring, num_threads)) + { + sLog.outError("Cannot connect to world database %s", dbstring.c_str()); + return false; + } ///- Get character database info from configuration file dbstring = sConfig.GetStringDefault("CharacterDatabaseInfo", ""); if (dbstring.empty()) @@ -463,13 +470,20 @@ bool Master::_StartDB() return false; } - ///- Initialise the Character database - if (!CharacterDatabase.Initialize(dbstring.c_str())) + num_threads = sConfig.GetIntDefault("CharacterDatabase.WorkerThreads", 1); + if (num_threads < 1 || num_threads > 32) { - sLog.outError("Cannot connect to Character database %s",dbstring.c_str()); + sLog.outError("Character database: invalid number of worker threads specified. " + "Please pick a value between 1 and 32."); return false; } + ///- Initialise the Character database + if (!CharacterDatabase.Open(dbstring, num_threads)) + { + sLog.outError("Cannot connect to Character database %s", dbstring.c_str()); + return false; + } ///- Get login database info from configuration file dbstring = sConfig.GetStringDefault("LoginDatabaseInfo", ""); if (dbstring.empty()) @@ -478,13 +492,20 @@ bool Master::_StartDB() return false; } - ///- Initialise the login database - if (!LoginDatabase.Initialize(dbstring.c_str())) + num_threads = sConfig.GetIntDefault("LoginDatabase.WorkerThreads", 1); + if (num_threads < 1 || num_threads > 32) { - sLog.outError("Cannot connect to login database %s",dbstring.c_str()); + sLog.outError("Login database: invalid number of worker threads specified. " + "Please pick a value between 1 and 32."); return false; } + ///- Initialise the login database + if (!LoginDatabase.Open(dbstring, num_threads)) + { + sLog.outError("Cannot connect to login database %s", dbstring.c_str()); + return false; + } ///- Get the realm Id from the configuration file realmID = sConfig.GetIntDefault("RealmID", 0); if (!realmID) |