Cleanup MySQL 4 related remnants from core
Open, LowPublic

Description

So we get nice things like subqueries, which using them now was somewhat dependant on what the cluster was running.

MySQL 5 has been production release since October 2005 [1], I think we've been supporting it long enough.

I can't imagine too many people are still running it...?

[1] http://en.wikipedia.org/wiki/MySQL#Product_history


Version: 1.22.0
Severity: enhancement

Details

Reference
bz32217
bzimport raised the priority of this task from to Low.
bzimport set Reference to bz32217.
bzimport added a subscriber: Unknown Object (MLST).
Reedy created this task.Nov 5 2011, 3:07 PM

sam wrote:

Note, I'm not suggesting to actively break back compat (is there any way we could?)?

Does anyone even actually test on mysql4 now after the last mysql boxen have gone from WMF?

brion added a comment.Nov 5 2011, 5:31 PM

Using subqueries would pretty actively break back compat. :)

I've no objection to this...

sam wrote:

(In reply to comment #2)

Using subqueries would pretty actively break back compat. :)

I've no objection to this...

I was meaning going actively out of our way to break it. But this is slightly pointless, and probably just ignore it completely

But yeah, it's not like we're breaking stuff for a recent high use version of it.

Maybe something just to explicitly change for 1.19, and going forward

Probably some cleanup work to remove some of the mysql 4 related globals and such

Be nice to clear it all out

Thinks like: $wgDBmysql4, $wgDBmysql5...

And then 4 other usages in MysqlInstaller

sam wrote:

r104045 kills $wgDBmysql4

r104046 kills some mysql 4 related code from the installer

r104047 Kill mysql4 code from DatabaseMysql, bumps minimum mysql version in the installer

TODO:

  • Kill 'config-charset-mysql4' ?
  • Kill $existingSchema = 'mysql4'; ?

*

MySQL 5 has been production release since October 2005 [1], I think we've been
supporting it long enough.
I can't imagine too many people are still running it...?

We were running mysql 4 until 2009 or so.

$wgDBmysql4 is always true "for compatibility with extensions that might be checking". Seems $wgDBmysql5 should follow the same fate.

Anyway $wgDBmysql5 does a useful task. Suddenly sending SET NAMES utf8 to everybody would break utf8-in-latin1 installs (beginning with WMF servers).

A second reason to avoid subqueries was that 'they were inefficient'. Which ones did you want to add? If we don't have a direct gain from dropping support, I'd keep it in.

sam wrote:

(In reply to comment #5)

> MySQL 5 has been production release since October 2005 [1], I think we've been
> supporting it long enough.
> I can't imagine too many people are still running it...?

We were running mysql 4 until 2009 or so.

We only got rid of it it on the live WMF sites in the last few months...

I wouldn't run to remove it, then.

MediaWiki 1.19 and above do not support MySQL 4 and below. Is the message
'config-charset-mysql' the only reason this is not RESOLVED FIXED?

sam wrote:

We're already requiring >= 5.0.2

public $minimumVersion = '5.0.2';

Back in 16:27, 23 November 2011 I made this 5.0.0

There's also another 7 usages in comments/commented code which should potentially be addressed and/or bugs filed for them. This could then be used as a tracking bug for these issues

There are 4 installed related messages that mention MySQL 4.X, which I believe is suggestionable that MySQL 4.X can actually be used. This really isn't the case, is misleading and should be removed

MySQL 4.0 back-compat isn't needed

'config-charset-mysql5-binary' => 'MySQL 4.1/5.0 binary',
'config-charset-mysql5' => 'MySQL 4.1/5.0 UTF-8',
'config-charset-mysql4' => 'MySQL 4.0 backwards-compatible UTF-8',
'config-charset-help' => "'''Warning:''' If you use '''backwards-compatible UTF-8''' on MySQL 4.1+, and subsequently back up the database with <code>mysqldump</code>, it may destroy all non-ASCII characters, irreversibly corrupting your backups!

In '''binary mode''', MediaWiki stores UTF-8 text to the database in binary fields.
This is more efficient than MySQL's UTF-8 mode, and allows you to use the full range of Unicode characters.
In '''UTF-8 mode''', MySQL will know what character set your data is in, and can present and convert it appropriately,
but it will not let you store characters above the [//en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes Basic Multilingual Plane].",

jcrespo added a subscriber: jcrespo.Oct 4 2017, 9:33 AM

Is this relevant anymore? Can this be closed, as we (will) require MySQL 5.5 on newer mediawiki versions, and if some discussion has to be done about charsets, is probably a separate matter. E.g. we should probably default to utf8mb4 rather than utf8(mb3) for regular installations.

Reedy added a comment.Oct 4 2017, 1:11 PM

I think, most of the stuff has been cleaned up in the last few years.. Certainly from the i18n installer messages et al (other than some orphaned messages in some languages that look to have never been deleted)

This is the only obvious remnant still about

/**
 * Set to true to engage MySQL 4.1/5.0 charset-related features;
 * for now will just cause sending of 'SET NAMES=utf8' on connect.
 *
 * @warning THIS IS EXPERIMENTAL!
 *
 * May break if you're not using the table defs from mysql5/tables.sql.
 * May break if you're upgrading an existing wiki if set differently.
 * Broken symptoms likely to include incorrect behavior with page titles,
 * usernames, comments etc containing non-ASCII characters.
 * Might also cause failures on the object cache and other things.
 *
 * Even correct usage may cause failures with Unicode supplementary
 * characters (those not in the Basic Multilingual Plane) unless MySQL
 * has enhanced their Unicode support.
 */
$wgDBmysql5 = false;

I don't think the MySQL 4.1/5.0 comment is a big issue... Of course, this being "experimental" is kinda amusing. Maybe we need to decide on the future of this feature, and look to deprecate and sunset it. Which, may require writing a maintenance script to transfer it across...

Targets
    Occurrences of 'DBmysql5' in Directory /Users/reedy/PhpstormProjects/mediawiki/core
Found Occurrences  (11 usages found)
    Unclassified occurrence  (4 usages found)
        mediawiki  (4 usages found)
            core  (1 usage found)
                HISTORY  (1 usage found)
                    14175 option to send 'SET NAMES utf8' is set by $wgDBmysql5 = true.
            core/includes  (1 usage found)
                DefaultSettings.php  (1 usage found)
                    2034 $wgDBmysql5 = false;
            core/includes/installer  (2 usages found)
                MysqlInstaller.php  (2 usages found)
                    678 $dbmysql5 = wfBoolToStr( $this->getVar( 'wgDBmysql5', true ) );
                    689 \$wgDBmysql5 = {$dbmysql5};";
    Usage in string constants  (7 usages found)
        mediawiki  (7 usages found)
            core/includes/db  (3 usages found)
                MWLBFactory.php  (3 usages found)
                    95 'utf8Mode' => $mainConfig->get( 'DBmysql5' )
                    115 'utf8Mode' => $mainConfig->get( 'DBmysql5' )
                    141 $lbConf['serverTemplate']['utf8Mode'] = $mainConfig->get( 'DBmysql5' );
            core/includes/installer  (4 usages found)
                CliInstaller.php  (1 usage found)
                    41 'dbmysql5' => 'wgDBmysql5',
                MysqlInstaller.php  (3 usages found)
                    43 'wgDBmysql5',
                    678 $dbmysql5 = wfBoolToStr( $this->getVar( 'wgDBmysql5', true ) );
                    689 \$wgDBmysql5 = {$dbmysql5};";
Targets
    Occurrences of 'mysql ?4' in Directory /Users/reedy/PhpstormProjects/mediawiki/core
Found Occurrences  (35 usages found)
    Unclassified occurrence  (17 usages found)
        mediawiki  (17 usages found)
            core  (17 usages found)
                HISTORY  (17 usages found)
                    6017 * (bug 29102) Upgrades no longer fail with the error "Unknown character set: 'mysql4'.
                    6074 * (bug 29102) Upgrade fails "Unknown character set: 'mysql4".
                    6258 * In MySQL 4.1.9+ with replication enabled, fetch the slave lag from SHOW SLAVE
                    9770 * (bug 11563) Deprecated SearchMySQL4 class; merged code to SearchMySQL
                    11559 * Disable MySQL's strict mode at session start for MySQL 4.1+, to avoid the
                    11898 * Installer support for experimental MySQL 4.1/5.0 binary-safe schema
                    13305 * (bug 3786) Experimental support for MySQL 4.1/5.0 utf8 charset mode
                    14317 MySQL 4.1+:
                    14318   Some users may encounter installation problems with MySQL 4.1 or higher
                    14618 * (bug 650) Prominently link MySQL 4.1 help page in installer if a possible
                    14621 * (bug 1322) Use a shorter cl_sortkey field to avoid breaking on MySQL 4.1
                    15008 * (bug 3786) Experimental support for MySQL 4.1/5.0 utf8 charset mode
                    15191 ==== READ THIS FIRST, TOO: MySQL 4.1 AND 5.0 ====
                    15196 If you have the choice of MySQL 4.0 or MySQL 4.1 and don't need 4.1 for
                    15201 MySQL 4.1 has changed the authentication protocol in an incompatible
                    15441 * Set MySQL 4 boolean search back to 'and' mode by default
                    15609 * (bug 1057) Fix logging table encoding (error on MySQL 4.1)
    Usage in comments  (11 usages found)
        mediawiki  (11 usages found)
            core/includes  (1 usage found)
                DefaultSettings.php  (1 usage found)
                    2019  * Set to true to engage MySQL 4.1/5.0 charset-related features;
            core/includes/installer  (1 usage found)
                MysqlUpdater.php  (1 usage found)
                    336 	 * which causes a collation mismatch error on joins in MySQL 4.1.
            core/includes/libs/rdbms/database  (2 usages found)
                Database.php  (2 usages found)
                    2178 	 * its use on Wikipedia, and b) MySQL 4.0 is kind of dumb sometimes about
                    2192 	 * its use on Wikipedia, and b) MySQL 4.0 is kind of dumb sometimes about
            core/includes/search  (1 usage found)
                SearchMySQL.php  (1 usage found)
                    28  * Search engine hook for MySQL 4+
            core/maintenance  (1 usage found)
                tables.sql  (1 usage found)
                    1712 -- that only works on MySQL 4.1+
            core/maintenance/archives  (3 usages found)
                patch-logging-title.sql  (1 usage found)
                    2 -- which causes a collation mismatch error on joins in MySQL 4.1.
                patch-random-dateindex.sql  (1 usage found)
                    18 --    We won't need this on MySQL 4; there will be a removal patch later.
                patch-tag_summary.sql  (1 usage found)
                    1 -- Rollup table to pull a LIST of tags simply without ugly GROUP_CONCAT that only works on MySQL 4.1+
            core/maintenance/mssql  (1 usage found)
                tables.sql  (1 usage found)
                    1225 -- that only works on MySQL 4.1+
            core/maintenance/storage  (1 usage found)
                fixT22757.php  (1 usage found)
                    60 // In MySQL 4.1+, the binary field old_text has a non-working LOWER() function
    Usage in string constants  (7 usages found)
        mediawiki  (7 usages found)
            core/includes/installer  (1 usage found)
                MysqlUpdater.php  (1 usage found)
                    1205 'CHARSET=mysql4',
            core/includes/installer/i18n  (6 usages found)
                bto.json  (3 usages found)
                    28 "config-charset-mysql5-binary": "MySQL 4.1/5.0 binary",
                    29 "config-charset-mysql5": "MySQL 4.1/5.0 UTF-8",
                    30 "config-charset-mysql4": "MySQL 4.0 backwards-compatible UTF-8",
                eml.json  (2 usages found)
                    10 "config-charset-mysql5-binary": "binàri MySQL 4.1/5.0",
                    11 "config-charset-mysql5": "MySQL 4.1/5.0 UTF-8",
                gor.json  (1 usage found)
                    41 "config-charset-mysql5": "MySQL 4.1/5.0 UFT-8",

Change 382159 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/core@master] Remove some old mysql 4 messages from installer i18n files

https://gerrit.wikimedia.org/r/382159

Change 382159 merged by jenkins-bot:
[mediawiki/core@master] Remove some old mysql 4 messages from installer i18n files

https://gerrit.wikimedia.org/r/382159

Reedy removed a subscriber: wikibugs-l-list.