We're Hiring!

Mattermost Discussion Forums

Upgrade from 5.37 to 6.0.2 fails with Mysql DB

Hi,

I am trying to upgrade MM from 5.37 to 6.0.2 on Ubuntu 20.04 with Mysql 8.0.27. DB migration is completed but MM fails to start due to below error and I do not know the fix for this problem. Do let me know if you need any further information.

{“timestamp”:“2021-11-17 06:48:56.618 Z”,“level”:“fatal”,“msg”:“Failed to alter column type. It is likely you have invalid JSON values in the column. Please fix the values manually and run the migration again.”,“caller”:“sqlstore/store.go:860”,“error”:“Error 3140: Invalid JSON text: “Missing a closing quotation mark in string.” at position 65535 in value for column ‘#sql-5a0_2e.Data’.”,“tableName”:“LinkMetadata”,“columnName”:“Data”}

The below query returns “0” record

SELECT COUNT() FROM LinkMetadata WHERE data LIKE ‘%\u0000%’;
±---------+
| COUNT(
) |
±---------+
| 0 |
±---------+

Regards

Ankush Grover

Why are you filtering on \u0000 in the SELECT? From what I read, there is at least one data field that contains invalid JSON. This must be a pretty log data field containing more than 65534 chars. I would check with WHERE LENGTH(Data) > 65534 and check, if the content of the Data field is valid JSON.
My guess is, that the data has been cut off due to length limitations.

Thanks for sharing the query and it returns 2 records. After deleting those 2 offending records upgrade went smooth.

Thank you very much for your help