Skip to content

Commit

Permalink
db import
Browse files Browse the repository at this point in the history
  • Loading branch information
Winfidonarleyan committed Jul 2, 2023
1 parent c22c9f0 commit 1a1b9e1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 38 deletions.
22 changes: 7 additions & 15 deletions src/tools/dbimport/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@
#include "Banner.h"
#include "Config.h"
#include "DatabaseEnv.h"
#include "DatabaseLoader.h"
#include "DatabaseMgr.h"
#include "IoContext.h"
#include "Log.h"
#include "MySQLThreading.h"
#include "OpenSSLCrypto.h"
#include "Util.h"
#include <boost/program_options.hpp>
Expand Down Expand Up @@ -96,16 +95,12 @@ int main(int argc, char** argv)
/// Initialize connection to the database
bool StartDB()
{
MySQL::Library_Init();
sDatabaseMgr->AddDatabase(LoginDatabase, "Login");
sDatabaseMgr->AddDatabase(CharacterDatabase, "Character");
sDatabaseMgr->AddDatabase(WorldDatabase, "World");
// sDatabaseMgr->AddDatabase(DBCDatabase, "Dbc");

// Load databases
DatabaseLoader loader("dbimport");
loader
.AddDatabase(LoginDatabase, "Login")
.AddDatabase(CharacterDatabase, "Character")
.AddDatabase(WorldDatabase, "World");

if (!loader.Load())
if (!sDatabaseMgr->Load())
return false;

LOG_INFO("dbimport", "Started database connection pool.");
Expand All @@ -115,10 +110,7 @@ bool StartDB()
/// Close the connection to the database
void StopDB()
{
CharacterDatabase.Close();
WorldDatabase.Close();
LoginDatabase.Close();
MySQL::Library_End();
sDatabaseMgr->CloseAllConnections();
}

variables_map GetConsoleArguments(int argc, char** argv, fs::path& configFile)
Expand Down
31 changes: 8 additions & 23 deletions src/tools/dbimport/dbimport.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -110,36 +110,21 @@ CharacterDatabaseInfo = "127.0.0.1;3306;acore;acore;acore_characters"

Database.Reconnect.Seconds = 5
Database.Reconnect.Attempts = 5

#
# LoginDatabase.WorkerThreads
# WorldDatabase.WorkerThreads
# CharacterDatabase.WorkerThreads
# Description: The amount of worker threads spawned to handle asynchronous (delayed) MySQL
# statements. Each worker thread is mirrored with its own connection to the
# MySQL server and their own thread on the MySQL server.
# Default: 1 - (LoginDatabase.WorkerThreads)
# 1 - (WorldDatabase.WorkerThreads)
# 1 - (CharacterDatabase.WorkerThreads)
# MaxQueueSize
# Description: Max size queue before open new dynamic async connect for db
# Default: 10
#

LoginDatabase.WorkerThreads = 1
WorldDatabase.WorkerThreads = 1
CharacterDatabase.WorkerThreads = 1
MaxQueueSize = 10

#
# LoginDatabase.SynchThreads
# WorldDatabase.SynchThreads
# CharacterDatabase.SynchThreads
# Description: The amount of MySQL connections spawned to handle.
# Default: 1 - (LoginDatabase.WorkerThreads)
# 1 - (WorldDatabase.WorkerThreads)
# 1 - (CharacterDatabase.WorkerThreads)
# MaxPingTime
# Description: Time (in minutes) between database pings.
# Default: 30
#

LoginDatabase.SynchThreads = 1
WorldDatabase.SynchThreads = 1
CharacterDatabase.SynchThreads = 1
MaxPingTime = 30
###################################################################################################

###################################################################################################
Expand Down

0 comments on commit 1a1b9e1

Please sign in to comment.