Page MenuHomePhabricator

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


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.

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).