40 parent::__construct(
$lb,
$srvCache, $wCache, $options );
42 $this->warmCacheRatio = $options[
'warmCacheRatio'] ?? 0.0;
47 return parent::getWeightScale( $index, $conn );
51 if ( $this->warmCacheRatio > 0 ) {
52 $res = $conn->query(
'SHOW STATUS', __METHOD__ );
53 $s =
$res ? $conn->fetchObject(
$res ) :
false;
55 $host = $this->lb->getServerName( $index );
56 $this->replLogger->error( __METHOD__ .
": could not get status for $host" );
59 if (
$s->Innodb_buffer_pool_pages_total > 0 ) {
60 $ratio =
$s->Innodb_buffer_pool_pages_data /
$s->Innodb_buffer_pool_pages_total;
65 $weight *= min( $ratio / $this->warmCacheRatio, 1.0 );