MM-55589: Throw warn logs for MySQL < 8 (#25637)

We just throw a warn log for now. Support will be completely
removed next ESR.

https://mattermost.atlassian.net/browse/MM-55589
```release-note
MySQL 5.7 is at EOL. We recommend all customers to upgrade to atleast 8.x. For now, we are logging a warning. From version 9.5 onwards, which is the next ESR, we will stop supporting 5.7 altogether.
```


Co-authored-by: Neil B <93996140+nab-77@users.noreply.github.com>
Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
Agniva De Sarker
2023-12-11 09:21:18 +05:30
committed by GitHub
parent c7f24dfa06
commit 88bd7b65f0
2 changed files with 7 additions and 3 deletions

View File

@@ -52,7 +52,8 @@ const (
// 9.6.3 would be 90603.
minimumRequiredPostgresVersion = 110000
// major*1000 + minor*100 + patch
minimumRequiredMySQLVersion = 5712
minimumRequiredMySQLVersion = 5712
minimumRecommendedMySQLVersion = 8000
migrationsDirectionUp migrationDirection = "up"
migrationsDirectionDown migrationDirection = "down"
@@ -1231,8 +1232,11 @@ func (ss *SqlStore) ensureMinimumDBVersion(ver string) (bool, error) {
return false, fmt.Errorf("cannot parse MySQL DB version: %w", err2)
}
intVer := majorVer*1000 + minorVer*100 + patchVer
if intVer < minimumRecommendedMySQLVersion {
mlog.Warn("The MySQL version being used is EOL. Please upgrade to a later version.", mlog.Int("current_version", intVer), mlog.Int("minimum_recommended_version", minimumRecommendedMySQLVersion))
}
if intVer < minimumRequiredMySQLVersion {
return false, fmt.Errorf("minimum MySQL version requirements not met. Found: %s, Wanted: %s", versionString(intVer, *ss.settings.DriverName), versionString(minimumRequiredMySQLVersion, *ss.settings.DriverName))
return false, fmt.Errorf("Minimum MySQL version requirements not met. Found: %s, Wanted: %s", versionString(intVer, *ss.settings.DriverName), versionString(minimumRequiredMySQLVersion, *ss.settings.DriverName))
}
}
return true, nil

View File

@@ -489,7 +489,7 @@ func TestEnsureMinimumDBVersion(t *testing.T) {
driver: model.DatabaseDriverMysql,
ver: "5.6.99-test",
ok: false,
err: "minimum MySQL version requirements not met",
err: "Minimum MySQL version requirements not met",
},
{
driver: model.DatabaseDriverMysql,