Page MenuHomePhabricator

Provide capability for a DB to be added in an extension
Open, MediumPublic

Description

The supported DBTypes are hard-coded into a protected static array in the Installer class.

I'm working on a DB backend for Percona and I need a way to make it available to a user of the web installer.

The CLI-based installer works since the user can just say "percona" and MediaWiki will find the provided DatabasePercona class. The web installer, though, provides a list of possible backends that has been hard-coded in.

Optional:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 28 2019, 6:58 PM

Change 519681 had a related patch set uploaded (by markahershberger; owner: markahershberger):
[mediawiki/core@master] Provide a way to add different DB types to Installer

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

This comment by @Anomie is related here T191231#4998548 but I'm not sure because Installer can't find any extension since there's no LocalSettings.php to load any extension (yet). So how that can be done?

So how that can be done?

Right, when using the built-in installer to install MediaWiki, the only possible way to extend the auto-loader so that MediaWiki can find the code to use other databases is by using Composer's autoloader.

I know a decision was made in the past (T467, which @Anomie .mentions in gerrit) that MW wouldn't rely on composer to load extension code, so that means (from what I can see) we have three options:

  1. revisit the decision made in T467 in light of new information and new plans;
  2. write the DB support as a composer package, not as an extension; or
  3. write new code for MW that will allow extensions to provide capabilities for non-MySQL databases.

It is apparent that a lot of extension developers are not aware of T467 or are ignoring it entirely. I don't think we should double-down on the dogma therein.

Anomie added a comment.EditedAug 14 2019, 3:15 PM

This comment by @Anomie is related here T191231#4998548 but I'm not sure because Installer can't find any extension since there's no LocalSettings.php to load any extension (yet). So how that can be done?

Installer::findExtensions(), same as it does during the "Options" step to find skins and extensions to offer to enable. This is really just an "offer to enable" at an earlier step.

It could do ->findExtensions() and then filter for extensions that provide a DB implementation, or we could make a new class of "database extensions" with their own subdirectory. Personally I'd lean towards the former, but that can be bikeshedded later.

Change 519681 abandoned by markahershberger:
Provide a way to add different DB types to Installer

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

CCicalese_WMF renamed this task from Provide a Installer::addDBType() so DB types can be added via an extension to Provide capability for a DB to be added in an extension.Feb 21 2020, 4:45 PM
Peter.ovchyn removed MarkAHershberger as the assignee of this task.Apr 30 2020, 2:22 PM
Peter.ovchyn added a subscriber: Peter.ovchyn.
Nnaka1 added a subscriber: Nnaka1.Fri, May 8, 2:10 PM

@Ladsgroup were you able to set this up using Percona from the web installer? I was able to do it through cli (with the --dbtype percona flag), but later ran into similar issues when trying to update the tables after installing the Semantic MediaWiki extension: https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/4724

I've tried adding the PercondaDB extension ("mediawiki/percona-db": "~1") to both the require as well as autoload sections of the composer.local.json after setting the MW_INSTALL_PATH. Both of these didn't seem to work even though I was able to select PerconaDB extension in the Extensions:Options page of the web installer. Would love to know if you or anyone can provide some suggestions / guide me on how to work around this.

Specifically, with the above steps, when I run composer update, I see the following error:

Could not insert main page: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? Query: SELECT GET_LOCK(<MY_HASH>) AS lockstatus Function: MediaWiki\Storage\PageEditStash::getAndWaitForStashValue Error: 1105 Percona-XtraDB-Cluster prohibits use of GET_LOCK with pxc_strict_mode = ENFORCING (<MY_HOST>:<MY_PORT>)

Apologies in advance if this should be a question in the forums (etc) instead of here; still quite new to this community. I will add / update / delete this accordingly based on feedback I receive!

PerconaDB should override locks. Granted, I haven't tried installing into an empty Percona DB using this extension.

Could you file a new bug @Nnaka1 ?

Reedy added a subscriber: Reedy.Tue, May 12, 2:02 AM

The bug seems very much with the library and how it's being implemented/installed. And seems to demonstrate why T249573: RFC: Remove ability to install extensions and skins with Composer and T250406: RFC: Hybrid extension management need to happen

This weird installation into extension and autoloading/enabling/whatever is very much not supported by MediaWiki, nor is it suggested, encouraged or otherwise.

The bug seems very much with the library and how it's being implemented/installed. And seems to demonstrate why T249573: RFC: Remove ability to install extensions and skins with Composer and T250406: RFC: Hybrid extension management need to happen

It would be helpful if you could provide direction here.

How should a database driver be implemented for MW so that it can be used during installation? Is this something that should only be done in core MW?

AFAICS, the only way to provide a DB driver outside of core is to use composer's autoloader since it works with the installer.

Well, surely that's the point of this task? To formally define a way this could/should work and implement it as such?

Art-Baltai updated the task description. (Show Details)Thu, May 28, 1:04 PM
Art-Baltai updated the task description. (Show Details)
Art-Baltai updated the task description. (Show Details)Wed, Jun 3, 4:37 PM