Page MenuHomePhabricator

In MediaWikiFarm some cache files are not read because path is used in the file name
Closed, ResolvedPublic

Description

Since T161413, it is possible to create farms differentiated by paths, but the cached file in /cache/wikis uses as identifier the host and path in reading and host in writing, which create a situation where this identifier is never found and the cached file never used.

When hosts were the unique difference between wikis, it was possible to use the host as an identifier, but it is very different now with the per-path feature: only the beginning of the path should be taken into account to create the difference, and this prefix has a variable length.

Event Timeline

Seb35 renamed this task from Some cache files are not read because path is used in the file name to In MediaWikiFarm some cache files are not read because path is used in the file name.Sep 8 2017, 6:44 AM
Seb35 claimed this task.
Seb35 triaged this task as High priority.

In earlier times I though about a caching mechanism where all existing unique identifiers (host and paths) would be in a single cache file, with associated existence configuration (variables and config to recompile the LocalSettings); but I prefered create separated files instead of such a big file to avoid too much writes in a single file (a cache with too much writes is no more a real cache). This could be a solution, with the variation such a big file could be only a dictionary 'host' => [ paths ].

I see another solution where the existing cached files (by host only) have some indirection towards cached files with host and path. I think it would be complicated to implement.


My prefered solution is to create an 'existence' dictionary 'host' => [ list of path prefixes ], and then keep the current mechanism for the other per-wiki configuration (variables and list of config files for LocalSettings). Additionnally I’m not really comfortable with the current mechanism where the wiki name is directly searched against the file name; it could create security issues, and the proposed solution is much more robust: if the host doesn’t exist => 404, if the path doesn’t exist => 404, and this check is contained in a proper PHP array instead of the file system.

In the original description I was mistaken about the cached files in /cache/composer and /cache/LocalSettings, it was correctly implemented - edited the description accordingly.

Change 376690 had a related patch set uploaded (by Seb35; owner: Seb35):
[mediawiki/extensions/MediaWikiFarm@master] Cache files in /cache/wikis were never used

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

Change 376690 merged by jenkins-bot:
[mediawiki/extensions/MediaWikiFarm@master] Cache files in /cache/wikis were never used

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

Seb35 removed a project: Patch-For-Review.

For cross-reference I found this bug when I studied T162733.