Page MenuHomePhabricator

PageProps doesn't cache result when it is false
Closed, ResolvedPublic

Description

I think this is actually a bug in the core PageProps class, which we are using. In PageProps::getProperties(), there's a ton of code that does caching, but only when the property is set – nothing is cached if the property we're querying for isn't present on the page. This seems unexpected to me.

Event Timeline

Krinkle reopened this task as Open.EditedAug 19 2026, 11:49 PM
Krinkle added a project: DiscussionTools.
@Krinkle wrote in the task description in September 2023:

Capturing via verbose Logstash […] yields 19 queries, roughly in order: […]

[…] the same scenario now has returns 23 queries […]

  1. MediaWiki\Page\PageProps::getProperties [0.638ms] [0 rows] db1169: SELECT pp_page,pp_propname,pp_value FROM page_props WHERE pp_page = 54249587 AND pp_propname IN ('newsectionlink','nonewsectionlink','notalk','archivedtalk')
  2. MediaWiki\Page\PageProps::getProperties [0.543ms] [0 rows] db1169: SELECT pp_page,pp_propname,pp_value FROM page_props WHERE pp_page = 54249587 AND pp_propname IN ('newsectionlink','nonewsectionlink','notalk','archivedtalk')
  3. MediaWiki\Page\PageProps::getProperties [0.81ms] [0 rows] db1169: SELECT pp_page,pp_propname,pp_value FROM page_props WHERE pp_page = 54249587 AND pp_propname IN ('newsectionlink','nonewsectionlink','notalk','archivedtalk')
  4. MediaWiki\Page\PageProps::getProperties [0.581ms] [0 rows] db1169: SELECT pp_page,pp_propname,pp_value FROM page_props WHERE pp_page = 54249587 AND pp_propname IN ('newsectionlink','nonewsectionlink','notalk','archivedtalk')
    • What: DiscussionTools extension, determining whether this is a talk page, via isAvailableForTitle() from DiscussionTools\PageHooks::onOutputPageBeforeHTML.
    • Unexpected and regressed. Pre-existing and already analyzed in-depth above. This seems avoidable because ParserCache provides this information for free without any DB queries. This information can't change between edits. One query would be an improvement though, it currently makes 4! This was supposed to be fixed as part of T297300: PageProps doesn't cache result when it is false. It's now worse than before. It used to make 3 queries (one prop each), now it makes 4 queries (each for the same 4 properties).

It didn't work.

Change #1327225 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] Page: Improve tests of PageProps service class

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

Change #1327236 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@master] Page: Fix absence caching when combined with multiple properties

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

Change #1327225 merged by jenkins-bot:

[mediawiki/core@master] Page: Clean up tests of PageProps service class

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

Change #1327671 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@wmf/1.47.0-wmf.16] Page: Clean up tests of PageProps service class

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

Change #1327236 merged by jenkins-bot:

[mediawiki/core@master] Page: Fix absence caching when combined with multiple properties

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

Change #1336609 had a related patch set uploaded (by Krinkle; author: Krinkle):

[mediawiki/core@wmf/1.47.0-wmf.18] Page: Fix absence caching when combined with multiple properties

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

Change #1336609 merged by jenkins-bot:

[mediawiki/core@wmf/1.47.0-wmf.18] Page: Fix absence caching when combined with multiple properties

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