Semanticmediawiki: Percona XtraDB Cluster with error running update script after installing SemanticMediaWiki

Created on 15 Apr 2020  路  5Comments  路  Source: SemanticMediaWiki/SemanticMediaWiki

Setup and configuration

  • SMW version: 3.1.5
  • MW version: 1.34.0
  • PHP version: 7.3
  • DB system (MySQL, Blazegraph, etc.) and version: 5.7.25 Percona XtraDB Cluster

Issue

Installed the SemanticMediaWiki plugin 3.1.5 through composer.
The installation successfully completes through composer, but afterwards when I run the update script (php .../maintenance/update.php) to update the DB tables, I see an error:

Wikimedia\Rdbms\DBQueryError from line 1603 of <MY_PATH>/mediawiki-1.34.0/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: INSERT  INTO `smw_prop_stats` (p_id,usage_count,null_count) VALUES ('1','0','0')
Function: SMW\SQLStore\TableBuilder\Examiner\PredefinedProperties::doUpdate
Error: 1105 Percona-XtraDB-Cluster prohibits use of DML command on a table (<MY_DB_NAME>.smw_prop_stats) without an explicit primary key with pxc_strict_mode = ENFORCING or MASTER (<MY_DB_HOST:MY_DB_PORT>)

Some background

I originally ran into a similar issue when installing MediaWiki itself, but was able to work around it using the command-line installer. Another solution that was presented at that time is tracked here: https://phabricator.wikimedia.org/T226857. Due to system restrictions, I am unable to set the pxc_strict_mode=PERMISSIVE as some forums seem to suggest.
Also cross posted here: https://www.mediawiki.org/wiki/Topic:Vkjyg9uce01b20p5

enhancement

All 5 comments

DB system (MySQL, Blazegraph, etc.) and version: 5.7.25 Percona XtraDB Cluster

This isn't the first time someone has trouble with the Percona XtraDB Cluster (see #4507). @hexmode is the point man here.

Function: SMW\SQLStore\TableBuilder\Examiner\PredefinedProperties::doUpdate
Error: 1105 Percona-XtraDB-Cluster prohibits use of DML command on a table (.smw_prop_stats) without an explicit primary key with pxc_strict_mode = ENFORCING or MASTER ()

On the matter of forcing primary keys into the SMW table schema, I made some comments in #4507.

If I have time, I will propose a new config profile that users can select if they decide it deemed necessary but we cannot just add primary keys to every table because Percona requires it while others (including MySQL, MariaDB, PostgreSQL, and SQLite) don't have that requirement.

How does Percona identify itself as MySQL clone (for example as something like mysql:5.6.33-0ubuntu0.14.04.1 or mysql:10.4.11-MariaDB) in MW? We should probably filter those install attempts based on that identifier to avoid further surprises unless someone selects the appropriate "config profile".

I've been doing some work on upgrading from MW 1.27 to MW 1.34, so I've made some smw-specific changes to the DB driver for Percona using @mwjames work. I would love it if you could give it a try.

Thanks for all of the feedback and suggestions, @mwjames and @hexmode
I'm currently in the process of trying out the PerconaDB extension (i.e. cloned to my .../extensions directory, set the MW_INSTALL_PATH, and ran composer update).
However, I am noticing the following error:

Uncaught Error: Call to undefined method Installer::addDBType()

I do not see references to the addDBType function in the .../includes/installer/Installer.phpor in other files of MediaWiki. Am I missing something?

@hexmode
I'm trying out the PerconaDB extensions, and the two routes that I've tried so far are:

1) Web installer: updated the composer.local.json file to require "mediawiki/percona-db": "~1", set MW_INSTALL_PATH, and ran composer update. Then selected the PerconaDB extension in the Extensions:Options page. There, I still seem to run into 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>)

2) CLI installer: explicitly set the --dbtype percona. This installation worked fine until I tried to then require "mediawiki/semantic-media-wiki": "~3.1" and ran php maintenance/update.php. Here, I see the same error as in the original issue:

Wikimedia\Rdbms\DBQueryError from line 1603 of <MY_PATH>/mediawiki-1.34.1/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?
Query: INSERT  INTO `smw_prop_stats` (p_id,usage_count,null_count) VALUES ('1','0','0')
Function: SMW\SQLStore\TableBuilder\Examiner\PredefinedProperties::doUpdate
Error: 1105 Percona-XtraDB-Cluster prohibits use of DML command on a table (<MY_DB_NAME>.smw_prop_stats) without an explicit primary key with pxc_strict_mode = ENFORCING or MASTER (<MY_DB_HOST:MY_DB_PORT>)

Please let me know if you have any suggestions / feedback on possible solutions! Thanks again!

CLI installer: explicitly set the --dbtype percona.

@hexmode Just a note, whatever your extensions does (or adds) in terms of --dbtype it has to ensure that it is an alias for mysql in the Database layer to guarantee that checks to Database::getType remain compatible with existing implementations.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SteveRMann picture SteveRMann  路  4Comments

Nikerabbit picture Nikerabbit  路  3Comments

krabina picture krabina  路  4Comments

jaideraf picture jaideraf  路  3Comments

plegault3397 picture plegault3397  路  3Comments