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 15:44:02 +0000 (15:44 +0000)
commit628a3a9b267620914701a2a0a17bad8ab2e56498
tree641b13cdea2818c5e65811c4b946b8ad4536eeab
parent11a8e0160034e4e0a7398f8b858b4fcff23c7ab7
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
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