Page MenuHomePhabricator

Inflated counts in site statistics
Closed, ResolvedPublicBUG REPORT

Description

Special:Statistics and related services on wikidata and enwiki are now displaying an inflated count for various statistics. It appears this is coming from the changes in T306589 per discussion on wikidata.

For example, earlier today enwiki reported 6,571,832 content pages on Special:Statistics, while a report on Quarry reported 6,541,605 ns0 non-redirects. "all pages including redirects" was 56,804,085 on Special:Statistics, and 56,377,417 in the report.

For Wikidata, the overcount is about a million pages in both fields, assuming 'content' is defined as ns0+146+650 (Quarry; Special:Statistics)

I haven't checked Commons as I am not sure how content pages are counted there, but it seems to use the same stats system so likely has the same problem.

Wikis that do not use the new stats system from T306589 seem unaffected; I tested frwiki and the statistics page lines up exactly with a page count from Quarry.

Event Timeline

Ladsgroup triaged this task as High priority.
Ladsgroup added a project: DBA.

I will take a look at this next week. At least I can say I can't reproduce the problem locally.

I queried the table and compared the values with the query I did a couple of days ago.

wikiadmin@10.64.16.84(wikidatawiki)> select * from site_stats;
+-----------+----------------+------------------+----------------+----------+-----------------+-----------+
| ss_row_id | ss_total_edits | ss_good_articles | ss_total_pages | ss_users | ss_active_users | ss_images |
+-----------+----------------+------------------+----------------+----------+-----------------+-----------+
|         1 |     1704515526 |         98966652 |      103316439 |  5594205 |           23362 |         0 |
|         2 |        5874685 |           110647 |         121258 |    12272 |            NULL |         0 |
|         3 |        5870760 |           110440 |         121129 |    12545 |            NULL |         0 |
|         4 |        5873775 |           110361 |         120991 |    12384 |            NULL |         0 |
|         5 |        5870166 |           111305 |         121951 |    12651 |            NULL |         0 |
|         6 |        5872632 |           110019 |         120888 |    12685 |            NULL |         0 |
|         7 |        5872443 |           109911 |         120845 |    12383 |            NULL |         0 |
|         8 |        5876128 |           109758 |         120559 |    12454 |            NULL |         0 |
|         9 |        5870099 |           109748 |         120481 |    12333 |            NULL |         0 |
|        10 |        5873868 |           110826 |         121441 |    12588 |            NULL |         0 |
+-----------+----------------+------------------+----------------+----------+-----------------+-----------+
10 rows in set (0.000 sec)

Diffing says the numbers are growing the same everywhere so it's not like a bug that one value gets updated randomly on top of the value getting updated on row=1.

It's either something causing the update happen twice (on two random rows) or maybe deletes are not being actually taking affect.

I think I know what's happening. It's the script that updates the stats for active users at the same time updates the rest and basically flushes values of other rows to the first row...

It doesn't even update active users, how that row gets updated? I should check that but for now, let's fix this.

Change 825251 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@master] SiteStats: Make sure initSiteStats.php re-distribute values

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

Can we please also quickly reset the counters to actual values?

The item count on the Wikidata main page is fed from this table, and since it is a matter of 1-3 days that we hit 100.000.000 items (which we actually don't), there are quite some eyes on this counter these days. We do not want to claim this milestone prematurely.

The script would automatically fix it. If it gets reviewed and merged, I'd force a run.

Change 825251 merged by jenkins-bot:

[mediawiki/core@master] SiteStats: Make sure initSiteStats.php re-distribute values

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

Change 825276 had a related patch set uploaded (by Ladsgroup; author: Amir Sarabadani):

[mediawiki/core@wmf/1.39.0-wmf.25] SiteStats: Make sure initSiteStats.php re-distribute values

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

Change 825276 merged by jenkins-bot:

[mediawiki/core@wmf/1.39.0-wmf.25] SiteStats: Make sure initSiteStats.php re-distribute values

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

Mentioned in SAL (#wikimedia-operations) [2022-08-22T13:13:11Z] <ladsgroup@deploy1002> Synchronized php-1.39.0-wmf.25/includes: Backport: [[gerrit:825276|SiteStats: Make sure initSiteStats.php re-distribute values (T315693)]] (duration: 03m 32s)

Ran it on testwiki and then triggered a run on enwiki and wikidatawiki which is going to take a bit.

Thanks so much for dealing with this so promptly! Will the update script need to be run on Commons as well?

yup, let me run it there as well.

Ladsgroup moved this task from Triage to Done on the DBA board.

The run has finished in all three wikis. This is fixed.

Re: Tech News - What wording would you suggest as the content? IIUC, it would be something like...

Problems (section)
Last week, there were inaccurate numbers shown for various [[Special:Statistics]] at Commons, Wikidata, and English Wikipedia. This has now been fixed.

Alternatives/improvements appreciated. :)

Maybe something like:

In recent months, there have been inaccurate numbers shown for various [[Special:Statistics]] at Commons, Wikidata, and English Wikipedia. This has now been fixed.

It was fixed this week, but presumably the problem dates back to when sharding came in rather than appearing overnight. The charts on Grafana suggest that for WD it kicked in about the first week of June, which I think matches the deploy date for 1.39.0-wmf.15.