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)

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 4 2018, 8:38 AM
bd808 added a subscriber: bd808.Apr 4 2018, 10:55 PM

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.

bd808 added a comment.Apr 4 2018, 11:02 PM

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

bd808 claimed this task.Apr 4 2018, 11:45 PM
bd808 edited projects, added cloud-services-team (Kanban); removed cloud-services-team.
bd808 moved this task from Backlog to Wiki replicas on the Data-Services board.Apr 4 2018, 11:50 PM

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

bd808 added a comment.Apr 6 2018, 7:13 PM
$ 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
bd808 moved this task from Inbox to Done on the cloud-services-team (Kanban) board.May 6 2018, 6:47 PM