Page MenuHomePhabricator

site_stats tables unavailable on Cloud replicas
Closed, ResolvedPublic

Description

The Pagecounts Tool is used to populate the article numbers on www.wikipedia.org. Recently, this tool started showing 0 as the page-count for all wikis :(

https://tools.wmflabs.org/pagecounts/pagecounts.json

The tool makes a simple DB query on the Toolforge database, something like:

SELECT ss_total_pages, ss_good_articles FROM site_stats LIMIT 1

When trying to manually make this call with the Pagecount credentials, or even accessing the site_stats table, the following error occurs:

MariaDB [enwiki_p]> describe site_stats;
ERROR 1356 (HY000): View 'enwiki_p.site_stats' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

The Pagecounts code is hosted on GitHub here https://github.com/MaxSem/pagecounts/blob/master/pagecounts.php#L35

Other report: https://www.mediawiki.org/wiki/Topic:Up0qpe0wey94ca5n

Event Timeline

Something's wrong with some labs replicas:

MariaDB [enwiki_p]> select * from site_stats \G
ERROR 1356 (HY000): View 'enwiki_p.site_stats' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

MariaDB [adywiki_p]> select * from site_stats \G
*************************** 1. row ***************************
       ss_row_id: 1
  ss_total_edits: 7793
 [ . . . ]
Marostegui triaged this task as High priority.
Marostegui moved this task from Triage to In progress on the DBA board.
Marostegui added subscribers: Bstorm, Marostegui.

Something's wrong with some labs replicas:

MariaDB [enwiki_p]> select * from site_stats \G
ERROR 1356 (HY000): View 'enwiki_p.site_stats' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

MariaDB [adywiki_p]> select * from site_stats \G
*************************** 1. row ***************************
       ss_row_id: 1
  ss_total_edits: 7793
 [ . . . ]

That is because: T86339
@Bstorm can you recreate all the views for site_stats table across all the wikis?

Framawiki renamed this task from Pagecounts.json Tool reports zero pages for all wikis to site_stats tables available on Cloud replicas.Nov 27 2018, 6:06 PM
Framawiki renamed this task from site_stats tables available on Cloud replicas to site_stats tables unavailable on Cloud replicas.
Framawiki edited projects, added Data-Services; removed Toolforge.
Framawiki updated the task description. (Show Details)
Framawiki added a subscriber: Framawiki.

Rebuilt the views on all replicas. Please check that this is working now.

Works for me and the two reported queries now work - thanks @Bstorm!:

root@cumin1001:~# for i in labsdb1009 labsdb1010 labsdb1011; do echo $i; mysql.py -h $i enwiki_p -e "SELECT ss_total_pages, ss_good_articles FROM site_stats LIMIT 1";done
labsdb1009
+----------------+------------------+
| ss_total_pages | ss_good_articles |
+----------------+------------------+
|       46446353 |          5758648 |
+----------------+------------------+
labsdb1010
+----------------+------------------+
| ss_total_pages | ss_good_articles |
+----------------+------------------+
|       46446362 |          5758650 |
+----------------+------------------+
labsdb1011
+----------------+------------------+
| ss_total_pages | ss_good_articles |
+----------------+------------------+
|       46446362 |          5758650 |
+----------------+------------------+

And:

root@cumin1001:~# for i in labsdb1009 labsdb1010 labsdb1011; do echo $i; mysql.py -h $i enwiki_p -e "describe site_stats;";done
labsdb1009
+------------------+---------------------+------+-----+---------+-------+
| Field            | Type                | Null | Key | Default | Extra |
+------------------+---------------------+------+-----+---------+-------+
| ss_row_id        | int(8) unsigned     | NO   |     | 0       |       |
| ss_total_edits   | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_good_articles | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_total_pages   | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_users         | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_images        | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_active_users  | bigint(20) unsigned | YES  |     | NULL    |       |
+------------------+---------------------+------+-----+---------+-------+
labsdb1010
+------------------+---------------------+------+-----+---------+-------+
| Field            | Type                | Null | Key | Default | Extra |
+------------------+---------------------+------+-----+---------+-------+
| ss_row_id        | int(8) unsigned     | NO   |     | 0       |       |
| ss_total_edits   | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_good_articles | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_total_pages   | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_users         | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_images        | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_active_users  | bigint(20) unsigned | YES  |     | NULL    |       |
+------------------+---------------------+------+-----+---------+-------+
labsdb1011
+------------------+---------------------+------+-----+---------+-------+
| Field            | Type                | Null | Key | Default | Extra |
+------------------+---------------------+------+-----+---------+-------+
| ss_row_id        | int(8) unsigned     | NO   |     | 0       |       |
| ss_total_edits   | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_good_articles | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_total_pages   | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_users         | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_images        | bigint(20) unsigned | YES  |     | NULL    |       |
| ss_active_users  | bigint(20) unsigned | YES  |     | NULL    |       |
+------------------+---------------------+------+-----+---------+-------+

I

Thanks, everybody! pagecounts.json now has the correct numbers.