Page MenuHomePhabricator

Drop unused views for: flaggedrevs tables from mediawikiwiki_p
Closed, ResolvedPublic

Description

The following tables were dropped from mediawikiwiki database in production.
The views should be cleaned up from the labsdb hosts for the mediawikiwiki_p database:

flaggedrevs                         
flaggedrevs_promote               
flaggedrevs_statistics
flaggedrevs_stats    
flaggedrevs_stats2
flaggedrevs_tracking
mysql:root@localhost [mediawikiwiki_p]> select @@hostname;
+------------+
| @@hostname |
+------------+
| labsdb1009 |
+------------+
1 row in set (0.00 sec)

mysql:root@localhost [mediawikiwiki_p]> show tables like 'flaggedrevs%';
+------------------------------------------+
| Tables_in_mediawikiwiki_p (flaggedrevs%) |
+------------------------------------------+
| flaggedrevs                              |
| flaggedrevs_promote                      |
| flaggedrevs_statistics                   |
| flaggedrevs_stats                        |
| flaggedrevs_stats2                       |
| flaggedrevs_tracking                     |
+------------------------------------------+
6 rows in set (0.00 sec)

Details

Related Gerrit Patches:
operations/puppet : productionwiki replicas: drop views with missing tables

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 4 2018, 8:38 AM

I ran sudo maintain-views --database mediawikiwiki --clean --replace-all on labsdb10{09,10,11}, but the views are still in place. I double checked that the underlying tables are gone. Looking at the code for maintain-views, I found that the --clean logic will only drop a view if the tablename is not used on any wiki by the config. There is no check to see if the table(s) actually exist.

With debug logging enabled it will log that it's not going to create the view because the table is missing:

2018-04-04 22:46:20,388 DEBUG Skipping full view flaggedrevs on database mediawikiwiki as the table does not seem to exist.
2018-04-04 22:46:20,391 DEBUG Skipping full view flaggedrevs_promote on database mediawikiwiki as the table does not seem to exist.
2018-04-04 22:46:20,394 DEBUG Skipping full view flaggedrevs_statistics on database mediawikiwiki as the table does not seem to exist.
2018-04-04 22:46:20,397 DEBUG Skipping full view flaggedrevs_stats on database mediawikiwiki as the table does not seem to exist.
2018-04-04 22:46:20,399 DEBUG Skipping full view flaggedrevs_stats2 on database mediawikiwiki as the table does not seem to exist.
2018-04-04 22:46:20,401 DEBUG Skipping full view flaggedrevs_tracking on database mediawikiwiki as the table does not seem to exist.

The missing component is it checking to see if the --clean flag is set and then dropping (or marking to drop) in that case.

Change 424166 had a related patch set uploaded (by BryanDavis; owner: Bryan Davis):
[operations/puppet@production] wiki replicas: drop views with missing tables

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

Change 424166 merged by Bstorm:
[operations/puppet@production] wiki replicas: drop views with missing tables

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

Mentioned in SAL (#wikimedia-operations) [2018-04-06T19:13:07Z] <bd808> wiki replicas: ran maintain-views --database mediawikiwiki --clean on labsdb10{09,10,11} for T191387

$ sudo maintain-views --database mediawikiwiki --clean --replace-all
2018-04-06 19:10:54,811 INFO Full views for mediawikiwiki:
...
2018-04-06 19:10:56,374 INFO cleanup is enabled
2018-04-06 19:10:56,375 INFO cleaning 9 tables
2018-04-06 19:10:56,376 INFO Dropping view flaggedrevs_tracking
2018-04-06 19:10:56,377 INFO Dropping view mark_as_helpful
2018-04-06 19:10:56,379 INFO Dropping view flaggedrevs_statistics
2018-04-06 19:10:56,382 INFO Dropping view flaggedrevs_promote
2018-04-06 19:10:56,384 INFO Dropping view flaggedrevs_stats
2018-04-06 19:10:56,386 INFO Dropping view flaggedrevs_stats2
2018-04-06 19:10:56,388 INFO Dropping view updates
2018-04-06 19:10:56,390 INFO Dropping view wikilove_image_log
2018-04-06 19:10:56,392 INFO Dropping view flaggedrevs
bd808 closed this task as Resolved.Apr 6 2018, 7:13 PM