rdbms: make sure cpPosIndex cookie is applied to LBFactory in time
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 20 Apr 2018 20:45:49 +0000 (13:45 -0700)
committerKrinkle <krinklemail@gmail.com>
Mon, 23 Apr 2018 16:04:51 +0000 (16:04 +0000)
commitc91a71c5f608675df6205a945bdc4be29d81d21e
tree212410d4dc2036a450cdfcad68602dbdfa1c49d3
parent2324d1af57aebfc5a5ddcbbd01b4d974d989fd5f
rdbms: make sure cpPosIndex cookie is applied to LBFactory in time

Once getMain() was called in setSchemaAliases(), the ChronologyProtector
was initialized and the setRequestInfo() call in Setup.php had no effect.
Only the request values read in LBFactory::__construct() were used, which
reflect $_GET but not cookie values.

Use the $wgDBtype variable to avoid this and add an exception when that
sort of thing happens.

Further defer instantiation of ChronologyProtector so that methods like
ILBFactory::getMainLB() do not trigger construction.

Bug: T192611
Change-Id: I735d3ade5cd12a5d609f4dae19ac88fec4b18b51
(cherry picked from commit 628a3a9b267620914701a2a0a17bad8ab2e56498)
includes/ServiceWiring.php
includes/db/MWLBFactory.php
includes/libs/rdbms/lbfactory/LBFactory.php
includes/libs/rdbms/loadbalancer/ILoadBalancer.php
includes/libs/rdbms/loadbalancer/LoadBalancer.php
tests/phpunit/includes/db/LoadBalancerTest.php