Page MenuHomePhabricator

ExternalStoreDB fails to connect for foreign wikis when custom external storage database names are used
Open, LowPublic

Description

By default, MediaWiki's external storage layer assumes that blobs for a given wiki are hosted on a database on the external storage cluster with the same name as the wiki's local database name.

However, as T200471 has demonstrated, this assumption does not hold true for all setups. Sharding external storage content by wiki may not be a feasible option for all deployments, so configurations can and do use LBFactory configuration overrides to use an alternative database name for the external storage cluster.

rMWc6f0a38 partially fixed the issue by reading database name overrides from LBFactory configuration if the given external store instance was instantiated with an implicit database domain of false (i.e. the local wiki). However, this does not fix the problem for external store instances for foreign wikis, as the code will use the explicit database domain for the foreign wiki and attempt to connect to this database on the external storage cluster, ignoring any database name configuration from LBFactory.

Proposition
Introduce a configuration option that instructs ExternalStoreDB to always use an implicit database domain when connecting to the external storage cluster, irrespective of the database domain it was instantiated with. This would allow setups that employ external storage sharding strategies other than per-wiki to set this configuration flag and configure their LBFactory as appropriate, while maintaining compatibility with setups that rely on ExternalStoreDB using the wiki database domain when connecting to the cluster (WMF).

Event Timeline

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

[mediawiki/core@master] externalstore: Always use 'dbname' if set for an external cluster

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

Krinkle triaged this task as Medium priority.Dec 15 2021, 2:40 AM

Change 747225 abandoned by Krinkle:

[mediawiki/core@master] externalstore: Always use 'dbname' if set for an external cluster

Reason:

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

Krinkle lowered the priority of this task from Medium to Low.
Krinkle removed a project: Patch-For-Review.

Un-assigning for now. Further analysis is needed. Patch welcome. Happy to help at that time.