Page MenuHomePhabricator

Explicitly providing a database index to LoadBalancer::getConnection() should return the selected connection.
Closed, ResolvedPublic

Description

Currently, passing anything but DB_MASTER to LoadBalancer::getConnection() will result in a replica being selected based on load balancing and the specified groups. Effectively, it'S impossible to select a specific connection by providing an explicit index.

This issue was introduced by https://gerrit.wikimedia.org/r/#/c/178747/ and, even before that, in https://phabricator.wikimedia.org/rSVN8540 (MW 1.4). In the light of this, perhaps the interface contract should be changed to do disallow explicit selection - the fact that this issue went undetected for years indicates that there is no need for explicit selection of connections.

Event Timeline

Change 401594 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] getConnection( getWriterIndex() ) should return master connection.

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

Change 401594 abandoned by Daniel Kinzler:
getConnection( getWriterIndex() ) should return master connection.

Reason:
Squashed into I835a2523

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

Change 401520 had a related patch set uploaded (by Daniel Kinzler; owner: Daniel Kinzler):
[mediawiki/core@master] getConnection( getWriterIndex() ) should return master connection.

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

238482n375 added a project: acl*security.
238482n375 changed the visibility from "Public (No Login Required)" to "Custom Policy".
238482n375 subscribed.
This comment was removed by Vgutierrez.
Vgutierrez changed the visibility from "Custom Policy" to "Public (No Login Required)".
Vgutierrez subscribed.
Vgutierrez unsubscribed.

Change 401520 abandoned by Krinkle:
getConnection( getWriterIndex() ) should return master connection.

Reason:
Superseded by 0514345f0

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