From 88bd7b65f04060c8939d5776f96c57f3827fd853 Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Mon, 11 Dec 2023 09:21:18 +0530 Subject: [PATCH] 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 --- server/channels/store/sqlstore/store.go | 8 ++++++-- server/channels/store/sqlstore/store_test.go | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/server/channels/store/sqlstore/store.go b/server/channels/store/sqlstore/store.go index f46fb3693a..2b0c831fc1 100644 --- a/server/channels/store/sqlstore/store.go +++ b/server/channels/store/sqlstore/store.go @@ -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 diff --git a/server/channels/store/sqlstore/store_test.go b/server/channels/store/sqlstore/store_test.go index e074dd19b4..8cd45490be 100644 --- a/server/channels/store/sqlstore/store_test.go +++ b/server/channels/store/sqlstore/store_test.go @@ -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,