Page MenuHomePhabricator

DatabaseMysqlBase::serverIsReadOnly causes software to fail with read/write split mysql environment
Open, Needs TriagePublic

Description

I am currently running MediaWiki 1.30 with the database residing in a master/multi-replica Mariadb cluster with Maxscale doing load balancing and read/write splitting. All write queries go to the master and all read queries go to the replicas.

I attempted to upgrade to 1.35 and running upgrade.php failed because the database showed as read only as the query detecting this will always be routed to a replica, which is read-only. Believing this logic would only be built into an installer/updater, I changed the db server to the current master directly and was able to update fine.

After this, I swapped the db server back to the Maxscale host and was then unable to log in. Enabling debugging I see that the read only check is being done constantly, including on login.

[DBQuery] Wikimedia\Rdbms\DatabaseMysqlBase::serverIsReadOnly [0.001s] xxxxxxxx: SELECT @@GLOBAL.read_only AS Value

Event Timeline

Reedy renamed this task from DatabaseMysqlBase::serverIsReadOnly causes software to fail with read/write split mysql environment. to DatabaseMysqlBase::serverIsReadOnly causes software to fail with read/write split mysql environment.Feb 15 2021, 11:40 PM
Reedy added a project: MediaWiki-libs-Rdbms.