From ce4981b23f55eee427a850986ebbdd373d0683fe Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 30 Jan 2022 15:50:35 +0100 Subject: Core/DBUpdater: Apply each sql update file in a separate transaction (cherry picked from commit b79a91039bba12d62e43806d8a20ad76107ac5d7) --- src/server/database/Updater/DBUpdater.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/server/database/Updater/DBUpdater.cpp') diff --git a/src/server/database/Updater/DBUpdater.cpp b/src/server/database/Updater/DBUpdater.cpp index 3c4d52a2639..c61aa506f7b 100644 --- a/src/server/database/Updater/DBUpdater.cpp +++ b/src/server/database/Updater/DBUpdater.cpp @@ -332,7 +332,7 @@ void DBUpdater::ApplyFile(DatabaseWorkerPool& pool, std::string const& hos Path const& path) { std::vector args; - args.reserve(7); + args.reserve(9); // CLI Client connection info args.emplace_back("-h" + host); @@ -382,13 +382,17 @@ void DBUpdater::ApplyFile(DatabaseWorkerPool& pool, std::string const& hos #endif + // Execute sql file + args.emplace_back("-e"); + args.emplace_back(Trinity::StringFormat("BEGIN; SOURCE %s; COMMIT;", path.generic_string().c_str())); + // Database if (!database.empty()) args.emplace_back(database); // Invokes a mysql process which doesn't leak credentials to logs int const ret = Trinity::StartProcess(DBUpdaterUtil::GetCorrectedMySQLExecutable(), args, - "sql.updates", path.generic_string(), true); + "sql.updates", "", true); if (ret != EXIT_SUCCESS) { -- cgit v1.2.3