fix(Core/Updater): fail the dry run when a SQL update fails to apply (#26795)

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
sudlud
2026-07-26 14:27:03 +02:00
committed by GitHub
parent 70da2f25d6
commit 95eaad9901
6 changed files with 109 additions and 2 deletions

View File

@@ -64,6 +64,22 @@ std::string& DBUpdaterUtil::corrected_path()
return path;
}
uint32& DBUpdaterUtil::failed_updates()
{
static uint32 count = 0;
return count;
}
void DBUpdaterUtil::MarkUpdateFailed()
{
++failed_updates();
}
uint32 DBUpdaterUtil::GetFailedUpdateCount()
{
return failed_updates();
}
// Auth Database
template<>
std::string DBUpdater<LoginDatabaseConnection>::GetConfigEntry()
@@ -524,6 +540,10 @@ void DBUpdater<T>::ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& hos
"If you are a developer, please fix your sql query.",
path.generic_string(), pool.GetConnectionInfo()->database);
// Recorded in both modes. A dry run does not throw below, so it keeps attempting the
// remaining files and this count is the only thing left to fail the run on.
DBUpdaterUtil::MarkUpdateFailed();
if (!sConfigMgr->isDryRun())
{
if (uint32 delay = sConfigMgr->GetOption<uint32>("Updates.ExceptionShutdownDelay", 10000))

View File

@@ -60,8 +60,15 @@ public:
static bool CheckExecutable();
// Counts every update file that failed to apply, in any mode. A dry run does not throw
// on a bad file, so it keeps going and a single run reports all of them; whoever ends
// the run must check this and exit non-zero, otherwise CI goes green on a failed import.
static void MarkUpdateFailed();
static uint32 GetFailedUpdateCount();
private:
static std::string& corrected_path();
static uint32& failed_updates();
};
template <class T>