Page MenuHomePhabricator

Wikimedia\Rdbms\DBQueryError: Error 1146: Table 'enwikinews.`categorylinks`' doesn't exist
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   Wikimedia\Rdbms\DBQueryError: Error 1146: Table 'enwikinews.`categorylinks`' doesn't exist
Function: MediaWiki\Extension\GoogleNewsSitemap\Specials\GoogleNewsSitemap::getCategories
Query: SELECT  page_namespace,page_title,page_
exception.trace
from /srv/mediawiki/php-1.39.0-wmf.15/includes/libs/rdbms/database/Database.php(1767)
#0 /srv/mediawiki/php-1.39.0-wmf.15/includes/libs/rdbms/database/Database.php(1751): Wikimedia\Rdbms\Database->getQueryException(string, integer, string, string)
#1 /srv/mediawiki/php-1.39.0-wmf.15/includes/libs/rdbms/database/Database.php(1725): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#2 /srv/mediawiki/php-1.39.0-wmf.15/includes/libs/rdbms/database/Database.php(1226): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#3 /srv/mediawiki/php-1.39.0-wmf.15/includes/libs/rdbms/database/Database.php(1857): Wikimedia\Rdbms\Database->query(string, string, integer)
#4 /srv/mediawiki/php-1.39.0-wmf.15/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#5 /srv/mediawiki/php-1.39.0-wmf.15/includes/libs/rdbms/database/DBConnRef.php(277): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#6 /srv/mediawiki/php-1.39.0-wmf.15/extensions/GoogleNewsSitemap/includes/Specials/GoogleNewsSitemap.php(409): Wikimedia\Rdbms\DBConnRef->select(array, array, array, string, array, array)
#7 /srv/mediawiki/php-1.39.0-wmf.15/extensions/GoogleNewsSitemap/includes/Specials/GoogleNewsSitemap.php(145): MediaWiki\Extension\GoogleNewsSitemap\Specials\GoogleNewsSitemap->getCategories(array, array, array)
#8 /srv/mediawiki/php-1.39.0-wmf.15/includes/specialpage/SpecialPage.php(688): MediaWiki\Extension\GoogleNewsSitemap\Specials\GoogleNewsSitemap->execute(NULL)
#9 /srv/mediawiki/php-1.39.0-wmf.15/includes/specialpage/SpecialPageFactory.php(1415): SpecialPage->run(NULL)
#10 /srv/mediawiki/php-1.39.0-wmf.15/includes/MediaWiki.php(316): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#11 /srv/mediawiki/php-1.39.0-wmf.15/includes/MediaWiki.php(916): MediaWiki->performRequest()
#12 /srv/mediawiki/php-1.39.0-wmf.15/includes/MediaWiki.php(570): MediaWiki->main()
#13 /srv/mediawiki/php-1.39.0-wmf.15/index.php(50): MediaWiki->run()
#14 /srv/mediawiki/php-1.39.0-wmf.15/index.php(46): wfIndexMain()
#15 /srv/mediawiki/w/index.php(3): require(string)
#16 {main}
Impact

A number of these and related errors noticed during group1 promotion of 1.39.0-wmf.15.

Notes

Details

Request URL
https://en.wikinews.org/w/index.php?title=*&feed=*&categories=*&notcategories=*&namespace=*&count=*&ordermethod=*&stablepages=*

Event Timeline

dduvall renamed this task from PHP Deprecated: Caller from LinkBatch::doQuery (for Skin::preloadExistence) ignored an error originally raised from MediaWiki\Extension\GoogleNewsSitemap\Specials\GoogleNewsSitemap::getCategories: [1146] Table 'nlwikinews.`cate to Wikimedia\Rdbms\DBQueryError: Error 1146: Table 'enwikinews.`categorylinks`' doesn't exist.Wed, Jun 8, 7:14 PM
dduvall changed Request URL from https://nl.wikinews.org/wiki/Speciaal:Nieuwsfeed?categories=*&feed=* to https://en.wikinews.org/w/index.php?title=*&feed=*&categories=*&notcategories=*&namespace=*&count=*&ordermethod=*&stablepages=*.
dduvall updated the task description. (Show Details)

Edited to reflect original (and likely more relevant) error instead of the re-raised one.

Links will likely be @Ladsgroup I think although T299951: Normalize categorylinks table doesn't show any changes.

Krinkle added a subscriber: Krinkle.

I do not believe this is related to T299951. The categorylinks table exists just fine. If it didn't, there'd be a lot more errors.

This error is specific and limited to queries from the GoogleNewsSitemap extension. Tagging as such.

From a quick glance, I suspect the problem is in the SQL syntax:

Table 'enwikinews.`categorylinks`'

This is mixing single quotes and backticks at the same time. I'm not 100% sure, but that seems like invalid to me and thus seen as a literal name which doesn't exist.

The GoogleNewsSitemap extension has not substantially changed since April.

Looking at the Logstash dashboard for "mediawiki-errors" and querying for message:"GoogleNewsSitemap::getCategories" in the past 90 days shows that this is a new error, introduced today with the wmf15 promotion to group1 wikis.

Reviewing https://www.mediawiki.org/wiki/MediaWiki_1.39/wmf.15 shows that the only significant changes for this extension and/or core Rdbms are:

MediaWiki core:

  • git #dd9b44b1 - rdbms: Move selectSQLText to SQLPlatform (task T307616) by Amir Sarabadani
  • git #496332e4 - rdbms: avoid DBReadOnlyRoleError in Database::doFlushSession() (task T306632) by Aaron Schulz

No changes:

  • GoogleNewsSitemap

As such, It seems most likely that the Rdbms refactor caused selectSQLText to mishave in the rather unusual way that GoogleNewsSitemap makes use of.

GoogleNewsSitemap.php
public function getCategories( $params, $categories, $notCategories ) {
	$categorylinks = $dbr->tableName( 'categorylinks' );
..
	$tables["c$currentTableNumber"] = $categorylinks;
..
	return $dbr->select( $tables, $fields, $conditions, __METHOD__, $options, $joins );

Thanks for investigating, @Krinkle and @RhinosF1 !

Mentioned in SAL (#wikimedia-operations) [2022-06-08T20:33:08Z] <dduvall> rolling back group0 as well due to T310214

Looks like SQLPlatform::isQuotedIdentifier() needs to be overridden for mysql. Database::selectSQLText() no longer uses DatabaseMysqlBase::isQuotedIdentifier() now that the work happens in SQLPlatform.

Change 803994 had a related patch set uploaded (by Aaron Schulz; author: Aaron Schulz):

[mediawiki/core@master] rdbms: move mysql isQuotedIdentifier() override to SQLPlatform

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

Change 803909 had a related patch set uploaded (by Krinkle; author: Aaron Schulz):

[mediawiki/core@wmf/1.39.0-wmf.15] rdbms: move mysql isQuotedIdentifier() override to SQLPlatform

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

Change 803994 merged by jenkins-bot:

[mediawiki/core@master] rdbms: move mysql isQuotedIdentifier() override to SQLPlatform

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

Change 803909 merged by jenkins-bot:

[mediawiki/core@wmf/1.39.0-wmf.15] rdbms: move mysql isQuotedIdentifier() override to SQLPlatform

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

Mentioned in SAL (#wikimedia-operations) [2022-06-09T00:49:51Z] <krinkle@deploy1002> Synchronized php-1.39.0-wmf.15/includes/libs/rdbms/: I99b817b3d50ffcdf56, T310214 (duration: 03m 23s)

dduvall claimed this task.

Thanks again for the quick turnaround.