Don't lock tables by default; move tables around in schema; add peq-dump.sh script

This commit is contained in:
Akkadius
2020-03-09 15:51:11 -05:00
parent bfecd6ad14
commit 53be04c39c
5 changed files with 112 additions and 31 deletions
+37 -9
View File
@@ -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,9 +340,22 @@ void DatabaseDumpService::Dump()
FileUtil::mkdir(GetSetDumpPath());
}
std::string execution_result = execute(execute_command, IsDumpOutputToConsole());
if (!execution_result.empty()) {
std::cout << execution_result;
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()) {
@@ -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
@@ -497,4 +515,14 @@ bool DatabaseDumpService::IsDumpOutputToConsole() const
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;
}
+15 -12
View File
@@ -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,18 +49,21 @@ 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;
bool dump_system_tables = false;
bool dump_content_tables = false;
bool dump_player_tables = false;
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_with_compression = false;
bool dump_output_to_console = false;
bool dump_all_tables = false;
bool dump_system_tables = false;
bool dump_content_tables = false;
bool dump_player_tables = false;
bool dump_query_server_tables = false;
bool dump_login_server_tables = false;
bool dump_with_no_data = 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;