Page MenuHomePhabricator

Pageinfo crashing due to missing db table wbt_item_terms
Closed, ResolvedPublic

Description

When opening *any* pageinfo for any wiki, it errors out with:

/var/www/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php: 61 - An exception occurred while executing 'SET STATEMENT max_statement_time = 900 FORSELECT wby_name AS term, wbx_text AS term_text                FROM wikidatawiki_p.wbt_item_terms                JOIN wikidatawiki_p.wbt_term_in_lang ON wbit_term_in_lang_id = wbtl_id                JOIN wikidatawiki_p.wbt_type ON wbtl_type_id = wby_id                JOIN wikidatawiki_p.wbt_text_in_lang ON wbtl_text_in_lang_id = wbxl_id                JOIN wikidatawiki_p.wbt_text ON wbxl_text_id = wbx_id                WHERE wbit_item_id = ?                AND wby_name IN ('label', 'description')                AND wbxl_language = ?' with params ["4262307", "en"]:SQLSTATE[42S02]: Base table or view not found: 1146 Table 'wikidatawiki_p.wbt_item_terms' doesn't exist

(For instance, at https://xtools.wmcloud.org/articleinfo/en.wikipedia.org/Prambors_FM.)

XTools version: 3.21.0-039a6af3

Event Timeline

Alien333 moved this task from Backlog to Page History on the XTools board.
Alien333 subscribed.

Maybe a schema change? However, it's tuesday, and wikidata is in group 1 (wednesdays).

Alien333 renamed this task from Page statistic error to Pageinfo crashing due to missing db table.Jul 8 2025, 11:19 AM
Alien333 updated the task description. (Show Details)

According to the doc, wikibase still uses that table: https://doc.wikimedia.org/Wikibase/master/php/docs_sql_wbt_item_terms.html. Possibly an issue with replication, then, given that WD, well, you know, isn't down.

Alien333 renamed this task from Pageinfo crashing due to missing db table to Pageinfo crashing due to missing db table `wbt_item_terms`.Jul 8 2025, 11:25 AM
Alien333 renamed this task from Pageinfo crashing due to missing db table `wbt_item_terms` to Pageinfo crashing due to missing db table wbt_item_terms.

Ok, so: https://wikitech.wikimedia.org/wiki/News/2025_Wikidata_term_store_database_split. The wbt_* tables have been moved to a new database cluster, x3, from the main wikidata tables in s8. Their hostname is termstore.wikidatawiki.web.db.svc.wikimedia.cloud. The relevant task with the details is T351820: Move Wikidata term store to separate database cluster. Solutions:

  • switch to using the Wikibase API. Slower, but would protect us from further DB changes
  • query the new cluster. This will mean querying both x3 and s8 at the same time. I'll have a look, but that's probably beyond my skills.

Side note: this is (thank goodness) the only query of ours that uses the wbt_* tables.

Furthermore:

  • The wbt_type table has been removed as part of this migration (ADR 27); if you want to keep using SQL, you’d want to remove the JOIN on it and directly check wbtl_type_id IN (1, 2).
  • Using the API would also give you language fallbacks almost for free (assuming action=wbgetentities with props=labels|descriptions, use languages=en and languagefallback=1). The current SQL query doesn’t seem to use 'mul' labels, so it would have been missing data for e.g. Q2632.
MusikAnimal lowered the priority of this task from High to Medium.EditedJul 8 2025, 3:40 PM
MusikAnimal subscribed.

I have hotfixed the prod appserver to disable the wikidata integration entirely for the time being. This data provides only a few things to the "Bugs" section of the Page History tool, namely missing labels and descriptions. That info is also fed to XTools by https://checkwiki.toolforge.org/ (for most if not all wikis), so perhaps we don't need this direct Wikidata integration at all.

The long-term philosophy with XTools is to always query the db over the API where possible, purely for performance reasons. However here, we were only fetching the label and description, and also only for a single page. So using the API would come at a minimal cost (a single API request, I assume), while also avoiding issues like this task and the language fallbacks that Lucas mentions.

Hello, for me PetScan is working again since this evening. Thanks a lot!

MusikAnimal claimed this task.
MusikAnimal moved this task from Page History to Complete on the XTools board.