Page MenuHomePhabricator

Enable MariaDB/MySQL's Strict Mode
Open, Stalled, LowPublic

Description

If you are looking for the full RFC, go to T112637

This task's scope is:

  • switching to MariaDB's Strict Mode, first on CI (T119371), then on production
  • Make it so that DB insert/update that would overflow would error out rather than be silently truncated
  • Generally promote better use of MariaDB by making many things fail precommit and/or fail loudly in production rather than failing quietly

Options discussed:

  • sql_mode = 'TRADITIONAL' (equivalent to STRICT_TRANS_TABLES, STRICT_ALL_TABLES, NO_ZERO_IN_DATE, NO_ZERO_DATE, ERROR_FOR_DIVISION_BY_ZERO, NO_AUTO_CREATE_USER)
  • sql_mode = ONLY_FULL_GROUP_BY

Often, our non-strict usage is a fountain of bugs and security issues.

Slide by @jcrespo that explains it: https://www.slideshare.net/jynus/query-optimization-with-mysql-57-and-mariadb-10-even-newer-tricks/43 and https://www.slideshare.net/jynus/query-optimization-with-mysql-57-and-mariadb-10-even-newer-tricks/44

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.
StatusSubtypeAssignedTask
StalledNone
Resolvedhashar
ResolvedKrinkle
OpenNone
ResolvedNone
ResolvedNikerabbit
Resolved RobLa-WMF
OpenNone
ResolvedNikerabbit
ResolvedEjegg
OpenNone
Resolved Marostegui
OpenNone
ResolvedTK-999
ResolvedNone
OpenBUG REPORTNone
OpenBUG REPORTNone
ResolvedNone
ResolvedBUG REPORTDiesel_kapasule
DeclinedNone
ResolvedBUG REPORTapasternak

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

I have myself have no idea how to enable strict mode / which part of puppet config files have to be tweaked. The beta cluster database are also still running on Precise instance and MariaDB 5.5 , we might want to migrate them to migrate them to Jessie and MariaDB 5.10 first (that is T138778)

This is not blocked by that- it only needs to be enabled on config (see my comment on the child ticket).

Thanks @Huji for noting the SecurePoll strict mode problems (T147875).

I'll note this task still seems to be unassigned. @hashar, is the Beta cluster running in strict mode?

The beta cluster databases have been migrated to Jessie / MariaDB 5.10 T138778 and their config file is https://github.com/wikimedia/operations-puppet/blob/d3a05afd154/templates/mariadb/beta.my.cnf.erb

On beta I would guess it is about setting $wgSQLMode via operations/mediawiki-config , maybe that already has been done. For CI the task is T119371.

I am lurking on this task but reasonably have zero free time to lead the effort.

https://gerrit.wikimedia.org/r/#/c/429386/ would enable sql_mode = TRADITIONAL via includes/DevelopmentSettings.php which is loaded by CI. Tracked by sub task T119371.

The need from Wikimedia-Rdbms was to add the option and any additional support. I believe that part is done. (Ideally that would've been a subtask, but alas, better next time.)

Joe changed the task status from Open to Stalled.Mar 20 2023, 11:17 AM
Joe lowered the priority of this task from Medium to Low.
Joe subscribed.

I fail to see how this task is related to incident followup, or sustainability. So removing the tag. Adding the sprint week tag as I was triaging this task for the SRE sprint week.

Additionally, given the low activity:

  • Set as stalled
  • Lower priority.

Additionally: strict mode is on by default since mariadb 10.2, this has nothing to do with production usage at this point. Maybe another task should be opened?

I fail to see how this task is related to incident followup, or sustainability. So removing the tag. Adding the sprint week tag as I was triaging this task for the SRE sprint week.

I want to remember this was detected as a mitigation to a MW incident/bug in which, if the flag was enabled on testing, the issue would have been caught earlier. But I don't remember the details.

Additionally: strict mode is on by default since mariadb 10.2, this has nothing to do with production usage at this point. Maybe another task should be opened?

I believe ONLY_FULL_GROUP_BY is not enabled, which was part of the above scope. Strict is technically only STRICT_TRANS_TABLES.