Page MenuHomePhabricator

Correct schema drift for wikilove_log between abstract and old non-abstract
Closed, ResolvedPublic

Description

The abstract schema work on https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikiLove/+/621924 for table wikilove_log contains some drifts between the old and the new schema.

Here the table from replica as reference:

MariaDB [enwiki_p]> desc wikilove_log;
+---------------------------+----------------+------+-----+---------+-------+
| Field                     | Type           | Null | Key | Default | Extra |
+---------------------------+----------------+------+-----+---------+-------+
| wll_id                    | int(11)        | NO   |     | 0       |       |
| wll_timestamp             | binary(14)     | NO   |     | NULL    |       |
| wll_sender                | int(11)        | NO   |     | NULL    |       |
| wll_sender_registration   | binary(14)     | YES  |     | NULL    |       |
| wll_sender_editcount      | int(11)        | YES  |     | NULL    |       |
| wll_receiver              | int(11)        | NO   |     | NULL    |       |
| wll_receiver_registration | binary(14)     | YES  |     | NULL    |       |
| wll_receiver_editcount    | int(11)        | YES  |     | NULL    |       |
| wll_type                  | varbinary(64)  | NO   |     | NULL    |       |
| wll_subject               | varbinary(255) | NO   |     | NULL    |       |
| wll_message               | blob           | NO   |     | NULL    |       |
| wll_email                 | tinyint(1)     | NO   |     | 0       |       |
+---------------------------+----------------+------+-----+---------+-------+
12 rows in set (0.00 sec)

Seen at the moment:

  • wll_timestamp varbinary vs. binary (could use mwtimestamp type in abstract)
  • wll_sender_registration varbinary vs. binary
  • wll_receiver_registration int vs. binary
  • wll_email int vs. tinyint(1)

This does not affect WMF (Assume there are no new deployment of wikilove at all)

Not sure if this must contain update patches for third party wikis (Released with REL1_36).

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

If the actual DB schema (based on the old SQL files) differs from the abstract schema, that does affect WMF AIUI, as part of the goals with the abstract schema is to monitor drift.

For posterity, there is how the table looks at one of the enwiki production DB replicas:

wikiadmin@10.64.32.13(enwiki)> show create table wikilove_log\G
*************************** 1. row ***************************
       Table: wikilove_log
Create Table: CREATE TABLE `wikilove_log` (
  `wll_id` int(11) NOT NULL AUTO_INCREMENT,
  `wll_timestamp` binary(14) NOT NULL,
  `wll_sender` int(11) NOT NULL,
  `wll_sender_registration` binary(14) DEFAULT NULL,
  `wll_sender_editcount` int(11) DEFAULT NULL,
  `wll_receiver` int(11) NOT NULL,
  `wll_receiver_registration` binary(14) DEFAULT NULL,
  `wll_receiver_editcount` int(11) DEFAULT NULL,
  `wll_type` varbinary(64) NOT NULL,
  `wll_subject` varbinary(255) NOT NULL,
  `wll_message` blob NOT NULL,
  `wll_email` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`wll_id`),
  KEY `wll_timestamp` (`wll_timestamp`),
  KEY `wll_type_time` (`wll_type`,`wll_timestamp`),
  KEY `wll_sender_time` (`wll_sender`,`wll_timestamp`),
  KEY `wll_receiver_time` (`wll_receiver`,`wll_timestamp`)
) ENGINE=InnoDB AUTO_INCREMENT=153645 DEFAULT CHARSET=binary ROW_FORMAT=COMPRESSED
1 row in set (0.000 sec)

It indeeds appears to be different from what's in the repo now.

For posterity, there is how the table looks at one of the enwiki production DB replicas:

wikiadmin@10.64.32.13(enwiki)> show create table wikilove_log\G
*************************** 1. row ***************************
       Table: wikilove_log
Create Table: CREATE TABLE `wikilove_log` (
  `wll_id` int(11) NOT NULL AUTO_INCREMENT,
  `wll_timestamp` binary(14) NOT NULL,
  `wll_sender` int(11) NOT NULL,
  `wll_sender_registration` binary(14) DEFAULT NULL,
  `wll_sender_editcount` int(11) DEFAULT NULL,
  `wll_receiver` int(11) NOT NULL,
  `wll_receiver_registration` binary(14) DEFAULT NULL,
  `wll_receiver_editcount` int(11) DEFAULT NULL,
  `wll_type` varbinary(64) NOT NULL,
  `wll_subject` varbinary(255) NOT NULL,
  `wll_message` blob NOT NULL,
  `wll_email` tinyint(1) NOT NULL DEFAULT 0,
  PRIMARY KEY (`wll_id`),
  KEY `wll_timestamp` (`wll_timestamp`),
  KEY `wll_type_time` (`wll_type`,`wll_timestamp`),
  KEY `wll_sender_time` (`wll_sender`,`wll_timestamp`),
  KEY `wll_receiver_time` (`wll_receiver`,`wll_timestamp`)
) ENGINE=InnoDB AUTO_INCREMENT=153645 DEFAULT CHARSET=binary ROW_FORMAT=COMPRESSED
1 row in set (0.000 sec)

It indeeds appears to be different from what's in the repo now.

Thanks for the definition, it missed the unsigned on two columns as done back in 2016 at https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/WikiLove/+/7d61821685181b8c97a4df9d988495ab25a3b04f%5E%21/patches/WikiLoveLog.sql

Change 758943 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/WikiLove@master] Correct schema drift between abstract and old non-abstract

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

Umherirrender triaged this task as Lowest priority.

Change 758943 merged by jenkins-bot:

[mediawiki/extensions/WikiLove@master] Correct schema drift between abstract and old non-abstract

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