rdbms: fix finalization stage errors in LBFactory::commitMasterChanges
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 5 May 2018 22:09:30 +0000 (15:09 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 7 May 2018 18:04:43 +0000 (18:04 +0000)
commit082ed053b699cfd52555f3432a1b4a823a259236
tree4f29bfbb3d440a41278e4adcbaf70138528b0f20
parent8f5d78961ec3d028b52a2ac530e7e391dd60bc43
rdbms: fix finalization stage errors in LBFactory::commitMasterChanges

If a pre-commit callback caused a new LoadBalancer object to be created,
that object will be in the "cursory" state rather than the "finalized"
state. If any callbacks run on an LB instance, make LBFactory iterate
over them all again to finalize these new instances.

Make LoadBalancer::finializeMasterChanges allow calls to
already-finalized instances for simplicity.

Bug: T193668
Change-Id: I4493e9571625a350c0a102219081ce090967a4ac
includes/libs/rdbms/database/DBConnRef.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/database/IDatabase.php
includes/libs/rdbms/lbfactory/LBFactory.php
includes/libs/rdbms/loadbalancer/ILoadBalancer.php
includes/libs/rdbms/loadbalancer/LoadBalancer.php
tests/phpunit/includes/db/LBFactoryTest.php