Mattermost Upgrade to 1.59.0 breaks
-
Log after upgrade looks like a DB migration issue:
Feb 20 02:35:05 {"timestamp":"2022-02-20 02:35:05.969 Z","level":"fatal","msg":"Failed to apply database migrations.","caller":"sqlstore/store.go:157","error":"driver: mysql, message: failed when applying migration, command: apply_migration, originalError: Error 1304: PROCEDURE RenameSolarizedThemeWithUnderscore already exists, query: \n\nCREATE TABLE IF NOT EXISTS Preferences (\n UserId varchar(26) NOT NULL,\n Category varchar(32) NOT NULL,\n Name varchar(32) NOT NULL,\n Value text,\n PRIMARY KEY (UserId, Category, Name)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;\n\nSET @preparedStatement = (SELECT IF(\n (\n SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS\n WHERE table_name = 'Preferences'\n AND table_schema = DATABASE()\n AND column_name = 'Value'\n AND data_type != 'text'\n ) > 0,\n 'ALTER TABLE Preferences MODIFY Value text;',\n 'SELECT 1'\n));\n\nPREPARE alterIfExists FROM @preparedStatement;\nEXECUTE alterIfExists;\nDEALLOCATE PREPARE alterIfExists;\n\nSET @preparedStatement = (SELECT IF(\n (\n SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS\n WHERE table_name = 'Preferences'\n AND table_schema = DATABASE()\n AND index_name = 'idx_preferences_category'\n ) > 0,\n 'SELECT 1',\n 'CREATE INDEX idx_preferences_category ON Preferences(Category);'\n));\n\nPREPARE createIndexIfNotExists FROM @preparedStatement;\nEXECUTE createIndexIfNotExists;\nDEALLOCATE PREPARE createIndexIfNotExists;\n\nSET @preparedStatement = (SELECT IF(\n (\n SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS\n WHERE table_name = 'Preferences'\n AND table_schema = DATABASE()\n AND index_name = 'idx_preferences_name'\n ) > 0,\n 'SELECT 1',\n 'CREATE INDEX idx_preferences_name ON Preferences(Name);'\n));\n\nPREPARE createIndexIfNotExists FROM @preparedStatement;\nEXECUTE createIndexIfNotExists;\nDEALLOCATE PREPARE createIndexIfNotExists;\n\nCREATE PROCEDURE RenameSolarizedThemeWithUnderscore()\nBEGIN\n DECLARE finished INTEGER DEFAULT 0;\n DECLARE curUserId VARCHAR(26);\n DECLARE curName VARCHAR(32);\n DECLARE curValue text;\n\n DECLARE preference\n CURSOR FOR\n SELECT UserId, Name, Value\n FROM Preferences\n WHERE Category = 'theme' AND Value LIKE '%solarized_%';\n\n -- declare NOT FOUND handler\n DECLARE CONTINUE HANDLER\n FOR NOT FOUND SET finished = 1;\n\n OPEN preference;\n\n getPreference: LOOP\n FETCH preference INTO curUserId, curName, curValue;\n IF finished = 1 THEN\n LEAVE getPreference;\n END IF;\n\n -- update affected rows\n UPDATE Preferences\n SET Value = replace(curValue, 'solaraized_', 'solarized-')\n WHERE Category = 'theme'\n AND UserId = curUserId\n AND Name = curName;\n END LOOP getPreference;\nEND;\n\nCALL RenameSolarizedThemeWithUnderscore();\n\nDROP PROCEDURE IF EXISTS RenameSolarizedThemeWithUnderscore;\n\nSET @preparedStatement = (SELECT IF(\n (\n SELECT COUNT(*) FROM INFORMATION_SCHEMA.STATISTICS\n WHERE table_name = 'Preferences'\n AND table_schema = DATABASE()\n AND index_name = 'idx_preferences_user_id'\n ) > 0,\n 'DROP INDEX idx_preferences_user_id ON Preferences;',\n 'SELECT 1'\n));\n\nPREPARE removeIndexIfExists FROM @preparedStatement;\nEXECUTE removeIndexIfExists;\nDEALLOCATE PREPARE removeIndexIfExists;\n\n"}
Restored previous version for now.
-
My organization is getting the same error. We've rolled back to 1.58.0 for the moment and disabled updates.
-
-
OK, I have found the root cause - https://github.com/mattermost/mattermost-server/issues/19602#issuecomment-1057360142 . It's a mixture of app not specifying the collation order and Cloudron provisioning database collation to not match upstream defaults.