-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check mysql charset, if it's utf8, display an error log #24392
Conversation
It's wired, we never test emoji with our CI mysql services? |
What about adding a "self check" page in site admin? It could do a full self check, including:
|
sounds like web-based gitea doctor |
Yes, some checks could only be done by web UI (eg: 3, 4) |
UI self check I'd say is out of scope for this PR, but I agree it might be useful. |
} | ||
if dbCharset == "utf8" { | ||
log.Error("database charset is utf8 which is deprecated, please convert it to utf8mb4 and change your app.ini [database]charset") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also match for utf8mb3
which is an alias to utf8
and interpolate charset into the message.
Reference: https://dev.mysql.com/doc/refman/8.0/en/charset-unicode-utf8.html
But checking default charset is not enough. Every column should be checked one by one. |
I think you are right, but we should not check them when start. It should be a backend task. |
That why I suggest to make an admin UI |
Still not sure about UI. How about actually refusing to start on wrong charset? Yes it's strict, but it's the only way to really ensure all users get it. |
IMO an admin UI is the only solution. See these 5 points (actually not only these) We shouldn't stop Gitea from starting, and we should do full check (check every column) when checking. So we still need an admin UI. |
How about doing a full table check and display a warning on frontpage to every admin user if issues were found? That should be a simple UI to add and would be better than something hidden away in the admin section. I assume a full table scan won't take so long. For people concerned about startup performance, we could add a opt-out to these checks in config. |
Atlassian does exactly this (a full table check, and then reports in UI) for the datacentre version of their products, they aren't blocking on the boot of the server (IIRC) and so we could probably do something similar. I agree re: having it block the startup for the check is bad. At the very least a one-off "on-boot" cron might be sufficient. |
Close as this will break users' instances. |
This PR will check MySQL database charset when Gitea start. If it's
utf8
, an error log will be displayed.