DatabaseMysqlBase: Rename getMasterServerInfo to getPrimaryServerInfo

Hard-deprecating immediately as no known users in git outside of this repo.

Bug: T282894
Change-Id: I79310cafeae368aa2a06b4eec69359663fa11e9d
This commit is contained in:
James D. Forrester 2021-09-02 16:23:41 -07:00 committed by Jforrester
parent eeaec4ce6b
commit b81dfed73e
3 changed files with 10 additions and 4 deletions

View file

@ -493,6 +493,7 @@ because of Phabricator reports.
- Database::assertIsWritableMaster() -> ::assertIsWritablePrimary()
- RevDelList::reloadFromMaster -> ::reloadFromPrimary()
- ExternalStoreDB::getMaster -> ::getPrimary()
- DatabaseMysqlBase::getMasterServerInfo() -> ::getPrimaryServerInfo()
* wfIncrStats(), deprecated in 1.36, now emits deprecation warnings.
* wfCanIPUseHTTPS() is now deprecated, and always returns true.
* The UserLoadFromDatabase hook has been deprecated. It had no known uses.

View file

@ -564,7 +564,7 @@ abstract class DatabaseMysqlBase extends Database {
$ago = $this->fetchSecondsSinceHeartbeat( $options['conds'] );
} else {
// Standard method: use primary server ID (works with stock pt-heartbeat)
$masterInfo = $this->getMasterServerInfo();
$masterInfo = $this->getPrimaryServerInfo();
if ( !$masterInfo ) {
$this->queryLogger->error(
"Unable to query primary of {db_server} for server ID",
@ -594,7 +594,7 @@ abstract class DatabaseMysqlBase extends Database {
return false;
}
protected function getMasterServerInfo() {
protected function getPrimaryServerInfo() {
$cache = $this->srvCache;
$key = $cache->makeGlobalKey(
'mysql',
@ -634,6 +634,11 @@ abstract class DatabaseMysqlBase extends Database {
);
}
protected function getMasterServerInfo() {
wfDeprecated( __METHOD__, '1.37' );
return $this->getPrimaryServerInfo();
}
/**
* @param array $conds WHERE clause conditions to find a row
* @return float|null Elapsed seconds since the newest beat or null if none was found

View file

@ -362,13 +362,13 @@ class DatabaseMysqlBaseTest extends PHPUnit\Framework\TestCase {
$db = $this->getMockBuilder( DatabaseMysqli::class )
->disableOriginalConstructor()
->onlyMethods( [
'getLagDetectionMethod', 'fetchSecondsSinceHeartbeat', 'getMasterServerInfo' ] )
'getLagDetectionMethod', 'fetchSecondsSinceHeartbeat', 'getPrimaryServerInfo' ] )
->getMock();
$db->method( 'getLagDetectionMethod' )
->willReturn( 'pt-heartbeat' );
$db->method( 'getMasterServerInfo' )
$db->method( 'getPrimaryServerInfo' )
->willReturn( [ 'serverId' => 172, 'asOf' => time() ] );
$db->setLBInfo( 'replica', true );