rdbms: Move cpStash message to ChronologyProtector.php

* It's now only logged when we actually read or write to CP.
  This makes it less confusing to see the message in cases where
  CP isn't or can't be used, as it would claim to use it when really
  it isn't/wouldn't.

* This was adding some overhead as it was the only non-wfDebug()
  thing I could find on all requests. Mainly noticable locally with
  mw-docker and writing to mw-www-debug.log. This helps a bit
  with T85805 and making dozens of load.php requests in debug mode
  less slow.

* It duplicated the channel name outside its class instead of
  using DI.

Change-Id: I0947b98d285f26ab5af8dd58a6dce2e3e0525d44
This commit is contained in:
Timo Tijhof 2022-04-05 23:05:52 +01:00 committed by Krinkle
parent d3327f3fdb
commit ac09cb7510
2 changed files with 8 additions and 7 deletions

View file

@ -545,10 +545,6 @@ return [
$cpStash = new EmptyBagOStuff(); // T141804: handle cases like CACHE_DB
}
}
LoggerFactory::getInstance( 'DBReplication' )->debug(
'ChronologyProtector using store {class}',
[ 'class' => get_class( $cpStash ) ]
);
try {
$wanCache = $services->getMainWANObjectCache();
@ -942,12 +938,13 @@ return [
$mainConfig = $services->getMainConfig();
$id = $mainConfig->get( MainConfigNames::MainStash );
if ( !isset( $mainConfig->get( MainConfigNames::ObjectCaches )[$id] ) ) {
$params = $mainConfig->get( MainConfigNames::ObjectCaches )[$id] ?? null;
if ( !$params ) {
throw new UnexpectedValueException(
"Cache type \"$id\" is not present in \$wgObjectCaches." );
"\$wgObjectCaches must have \"$id\" set (via \$wgMainStash)"
);
}
$params = $mainConfig->get( MainConfigNames::ObjectCaches )[$id];
$params['stats'] = $services->getStatsdDataFactory();
$store = ObjectCache::newFromParams( $params, $mainConfig );

View file

@ -430,6 +430,10 @@ class ChronologyProtector implements LoggerAwareInterface {
}
$this->startupTimestamp = $this->getCurrentTime();
$this->logger->debug(
'ChronologyProtector using store {class}',
[ 'class' => get_class( $this->store ) ]
);
$this->logger->debug(
__METHOD__ .
": client ID is {$this->clientId}; key is {$this->key}"