rdbms: Support secondary autocommit connections in LoadBalancer
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 20 Jul 2017 03:51:54 +0000 (20:51 -0700)
committerKrinkle <krinklemail@gmail.com>
Fri, 18 Aug 2017 01:28:34 +0000 (01:28 +0000)
commit99c80a8fc7bb4d434ab5fad2d0ca404716d8f8db
tree211409887c9ec05331bd9d00d051a3e58acefeeb
parent63a95228051a25185c70c0ae9615a4c3bbf852fe
rdbms: Support secondary autocommit connections in LoadBalancer

This is useful for things like SqlBagOStuff and JobQueueDB
being able to write in auto-commit mode while the main
transaction round still goes on.

SqlBagOStuff already had this sort of logic.

JobQueueDB now also takes this approach so it does not have to
defer insertion except for sqlite. This makes callers more likely
to know when insertion failed or not.

Make sure LoadBalancer sets "master"/"replica" LB info itself;
this fixes a bug found in the new tests.

Bug: T140338
Bug: T42451
Change-Id: I4199a9598d7afbf976a6efa8ed84b85b56da02bd
includes/jobqueue/JobQueueDB.php
includes/libs/rdbms/database/DBConnRef.php
includes/libs/rdbms/loadbalancer/ILoadBalancer.php
includes/libs/rdbms/loadbalancer/LoadBalancer.php
includes/objectcache/SqlBagOStuff.php
tests/phpunit/includes/db/LoadBalancerTest.php [new file with mode: 0644]