mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 01:11:29 +00:00
Don't lock tables by default; move tables around in schema; add peq-dump.sh script
This commit is contained in:
parent
bfecd6ad14
commit
53be04c39c
@ -255,6 +255,10 @@ void DatabaseDumpService::Dump()
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsDumpDropTableSyntaxOnly()) {
|
||||
SetDumpOutputToConsole(true);
|
||||
}
|
||||
|
||||
if (IsDumpOutputToConsole()) {
|
||||
LogSys.SilenceConsoleLogging();
|
||||
}
|
||||
@ -278,7 +282,7 @@ void DatabaseDumpService::Dump()
|
||||
options += " --no-data";
|
||||
}
|
||||
|
||||
if (IsDumpNoTableLock()) {
|
||||
if (!IsDumpTableLock()) {
|
||||
options += " --skip-lock-tables";
|
||||
}
|
||||
|
||||
@ -336,10 +340,23 @@ void DatabaseDumpService::Dump()
|
||||
FileUtil::mkdir(GetSetDumpPath());
|
||||
}
|
||||
|
||||
if (IsDumpDropTableSyntaxOnly()) {
|
||||
std::vector<std::string> tables = SplitString(tables_to_dump, ' ');
|
||||
|
||||
for (auto &table : tables) {
|
||||
std::cout << "DROP TABLE `" << table << "`;" << std::endl;
|
||||
}
|
||||
|
||||
if (tables_to_dump.empty()) {
|
||||
std::cerr << "No tables were specified" << std::endl;
|
||||
}
|
||||
}
|
||||
else {
|
||||
std::string execution_result = execute(execute_command, IsDumpOutputToConsole());
|
||||
if (!execution_result.empty()) {
|
||||
std::cout << execution_result;
|
||||
}
|
||||
}
|
||||
|
||||
if (!tables_to_dump.empty()) {
|
||||
LogInfo("Dumping Tables [{}]", tables_to_dump);
|
||||
@ -439,14 +456,15 @@ void DatabaseDumpService::SetDumpAllTables(bool dump_all_tables)
|
||||
{
|
||||
DatabaseDumpService::dump_all_tables = dump_all_tables;
|
||||
}
|
||||
bool DatabaseDumpService::IsDumpNoTableLock() const
|
||||
|
||||
bool DatabaseDumpService::IsDumpTableLock() const
|
||||
{
|
||||
return dump_no_table_lock;
|
||||
return dump_table_lock;
|
||||
}
|
||||
|
||||
void DatabaseDumpService::SetDumpNoTableLock(bool dump_no_table_lock)
|
||||
void DatabaseDumpService::SetDumpTableLock(bool dump_table_lock)
|
||||
{
|
||||
DatabaseDumpService::dump_no_table_lock = dump_no_table_lock;
|
||||
DatabaseDumpService::dump_table_lock = dump_table_lock;
|
||||
}
|
||||
|
||||
bool DatabaseDumpService::IsDumpWithCompression() const
|
||||
@ -498,3 +516,13 @@ void DatabaseDumpService::SetDumpOutputToConsole(bool dump_output_to_console)
|
||||
{
|
||||
DatabaseDumpService::dump_output_to_console = dump_output_to_console;
|
||||
}
|
||||
|
||||
bool DatabaseDumpService::IsDumpDropTableSyntaxOnly() const
|
||||
{
|
||||
return dump_drop_table_syntax_only;
|
||||
}
|
||||
|
||||
void DatabaseDumpService::SetDumpDropTableSyntaxOnly(bool dump_drop_table_syntax_only)
|
||||
{
|
||||
DatabaseDumpService::dump_drop_table_syntax_only = dump_drop_table_syntax_only;
|
||||
}
|
||||
|
||||
@ -37,8 +37,8 @@ public:
|
||||
void SetDumpPlayerTables(bool dump_player_tables);
|
||||
bool IsDumpLoginServerTables() const;
|
||||
void SetDumpLoginServerTables(bool dump_login_server_tables);
|
||||
bool IsDumpNoTableLock() const;
|
||||
void SetDumpNoTableLock(bool dump_no_table_lock);
|
||||
bool IsDumpTableLock() const;
|
||||
void SetDumpTableLock(bool dump_table_lock);
|
||||
bool IsDumpWithCompression() const;
|
||||
void SetDumpWithCompression(bool dump_with_compression);
|
||||
const std::string &GetDumpPath() const;
|
||||
@ -49,6 +49,8 @@ public:
|
||||
void SetDumpQueryServerTables(bool dump_query_server_tables);
|
||||
bool IsDumpOutputToConsole() const;
|
||||
void SetDumpOutputToConsole(bool dump_output_to_console);
|
||||
bool IsDumpDropTableSyntaxOnly() const;
|
||||
void SetDumpDropTableSyntaxOnly(bool dump_drop_table_syntax_only);
|
||||
|
||||
private:
|
||||
bool dump_all_tables = false;
|
||||
@ -58,9 +60,10 @@ private:
|
||||
bool dump_query_server_tables = false;
|
||||
bool dump_login_server_tables = false;
|
||||
bool dump_with_no_data = false;
|
||||
bool dump_no_table_lock = false;
|
||||
bool dump_table_lock = false;
|
||||
bool dump_with_compression = false;
|
||||
bool dump_output_to_console = false;
|
||||
bool dump_drop_table_syntax_only = false;
|
||||
std::string dump_path;
|
||||
std::string dump_file_name;
|
||||
|
||||
|
||||
@ -85,7 +85,8 @@ namespace DatabaseSchema {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all player and meta-data tables
|
||||
* @description Gets all player and meta-data tables
|
||||
* @note These tables have no content in the PEQ daily dump
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ -98,6 +99,8 @@ namespace DatabaseSchema {
|
||||
"account_rewards",
|
||||
"adventure_details",
|
||||
"adventure_stats",
|
||||
"bugs",
|
||||
"bug_reports",
|
||||
"buyer",
|
||||
"char_recipe_list",
|
||||
"character_activities",
|
||||
@ -129,6 +132,8 @@ namespace DatabaseSchema {
|
||||
"character_tribute",
|
||||
"completed_tasks",
|
||||
"data_buckets",
|
||||
"discovered_items",
|
||||
"eventlog",
|
||||
"faction_values",
|
||||
"friends",
|
||||
"guild_bank",
|
||||
@ -141,9 +146,12 @@ namespace DatabaseSchema {
|
||||
"inventory_snapshots",
|
||||
"keyring",
|
||||
"mail",
|
||||
"petitions",
|
||||
"player_titlesets",
|
||||
"quest_globals",
|
||||
"saylink",
|
||||
"sharedbank",
|
||||
"reports",
|
||||
"timers",
|
||||
"titles",
|
||||
"trader",
|
||||
@ -255,13 +263,9 @@ namespace DatabaseSchema {
|
||||
{
|
||||
return {
|
||||
"banned_ips",
|
||||
"bugs",
|
||||
"bug_reports",
|
||||
"command_settings",
|
||||
"db_str",
|
||||
"discovered_items",
|
||||
"eqtime",
|
||||
"eventlog",
|
||||
"gm_ips",
|
||||
"hackers",
|
||||
"ip_exemptions",
|
||||
@ -271,12 +275,9 @@ namespace DatabaseSchema {
|
||||
"logsys_categories",
|
||||
"name_filter",
|
||||
"perl_event_export_settings",
|
||||
"petitions",
|
||||
"profanity_list",
|
||||
"reports",
|
||||
"rule_sets",
|
||||
"rule_values",
|
||||
"saylink",
|
||||
"variables",
|
||||
};
|
||||
}
|
||||
|
||||
47
utils/sql/peq-dump/peq-dump.sh
Executable file
47
utils/sql/peq-dump/peq-dump.sh
Executable file
@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
world_path=""
|
||||
|
||||
if [ -d "bin" ]
|
||||
then
|
||||
world_path="bin/"
|
||||
fi
|
||||
|
||||
world_bin="${world_path}world"
|
||||
|
||||
echo "World path is [$world_path] bin is [$world_bin]"
|
||||
|
||||
# Run from the context of server directory
|
||||
#
|
||||
# --content-tables
|
||||
# --login-tables
|
||||
# --player-tables
|
||||
# --system-tables
|
||||
# --query-serv-tables
|
||||
|
||||
#############################################
|
||||
# dump
|
||||
#############################################
|
||||
|
||||
dump_path=/tmp/peq-dump/
|
||||
|
||||
mkdir -p ${dump_path}
|
||||
|
||||
#############################################
|
||||
# generate "drop_" table files
|
||||
#############################################
|
||||
bash -c "${world_bin} database:dump --content-tables --drop-table-syntax-only --dump-output-to-console > ${dump_path}drop_tables_content.sql"
|
||||
bash -c "${world_bin} database:dump --login-tables --drop-table-syntax-only --dump-output-to-console > ${dump_path}drop_tables_login.sql"
|
||||
bash -c "${world_bin} database:dump --player-tables --drop-table-syntax-only --dump-output-to-console > ${dump_path}drop_tables_player.sql"
|
||||
bash -c "${world_bin} database:dump --system-tables --drop-table-syntax-only --dump-output-to-console > ${dump_path}drop_tables_system.sql"
|
||||
bash -c "${world_bin} database:dump --query-serv-tables --drop-table-syntax-only --dump-output-to-console > ${dump_path}drop_tables_queryserv.sql"
|
||||
|
||||
#############################################
|
||||
# generate "create_" table files
|
||||
#############################################
|
||||
bash -c "${world_bin} database:dump --content-tables --dump-output-to-console > ${dump_path}create_tables_content.sql"
|
||||
bash -c "${world_bin} database:dump --login-tables --table-structure-only --dump-output-to-console > ${dump_path}create_tables_login.sql"
|
||||
bash -c "${world_bin} database:dump --player-tables --table-structure-only --dump-output-to-console > ${dump_path}create_tables_player.sql"
|
||||
bash -c "${world_bin} database:dump --system-tables --dump-output-to-console > ${dump_path}create_tables_system.sql"
|
||||
bash -c "${world_bin} database:dump --query-serv-tables --table-structure-only --dump-output-to-console > ${dump_path}create_tables_queryserv.sql"
|
||||
|
||||
@ -227,9 +227,10 @@ namespace WorldserverCommandHandler {
|
||||
"--system-tables",
|
||||
"--query-serv-tables",
|
||||
"--table-structure-only",
|
||||
"--no-table-lock",
|
||||
"--table-lock",
|
||||
"--dump-path=",
|
||||
"--dump-output-to-console",
|
||||
"--drop-table-syntax-only",
|
||||
"--compress"
|
||||
};
|
||||
|
||||
@ -256,9 +257,10 @@ namespace WorldserverCommandHandler {
|
||||
database_dump_service->SetDumpWithNoData(cmd[{"-c", "--table-structure-only"}]);
|
||||
database_dump_service->SetDumpQueryServerTables(cmd[{"--query-serv-tables"}]);
|
||||
database_dump_service->SetDumpAllTables(dump_all);
|
||||
database_dump_service->SetDumpNoTableLock(cmd[{"--no-table-lock"}]);
|
||||
database_dump_service->SetDumpTableLock(cmd[{"--table-lock"}]);
|
||||
database_dump_service->SetDumpWithCompression(cmd[{"--compress"}]);
|
||||
database_dump_service->SetDumpOutputToConsole(cmd[{"--dump-output-to-console"}]);
|
||||
database_dump_service->SetDumpDropTableSyntaxOnly(cmd[{"--drop-table-syntax-only"}]);
|
||||
|
||||
/**
|
||||
* Dump
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user