ExternalStoreDB: Rename getMaster to getPrimary
Bug: T282894 Change-Id: I6d6361a0b84f7130a27df6a6c75a983c73e5dd95
This commit is contained in:
parent
af079ea4c6
commit
eeaec4ce6b
4 changed files with 20 additions and 8 deletions
|
|
@ -492,6 +492,7 @@ because of Phabricator reports.
|
|||
- ILoadBalancer::waitForMasterPos() -> ::waitForPrimaryPos()
|
||||
- Database::assertIsWritableMaster() -> ::assertIsWritablePrimary()
|
||||
- RevDelList::reloadFromMaster -> ::reloadFromPrimary()
|
||||
- ExternalStoreDB::getMaster -> ::getPrimary()
|
||||
* 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.
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
|
|||
* @inheritDoc
|
||||
*/
|
||||
public function store( $location, $data ) {
|
||||
$dbw = $this->getMaster( $location );
|
||||
$dbw = $this->getPrimary( $location );
|
||||
$dbw->insert(
|
||||
$this->getTable( $dbw, $location ),
|
||||
[ 'blob_text' => $data ],
|
||||
|
|
@ -187,8 +187,9 @@ class ExternalStoreDB extends ExternalStoreMedium {
|
|||
*
|
||||
* @param string $cluster Cluster name
|
||||
* @return MaintainableDBConnRef
|
||||
* @since 1.37
|
||||
*/
|
||||
public function getMaster( $cluster ) {
|
||||
public function getPrimary( $cluster ) {
|
||||
$lb = $this->getLoadBalancer( $cluster );
|
||||
|
||||
return $lb->getMaintenanceConnectionRef(
|
||||
|
|
@ -199,6 +200,16 @@ class ExternalStoreDB extends ExternalStoreMedium {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.37; please use getPrimary() instead.
|
||||
* @param string $cluster Cluster name
|
||||
* @return MaintainableDBConnRef
|
||||
*/
|
||||
public function getMaster( $cluster ) {
|
||||
// wfDeprecated( __METHOD__, '1.37' );
|
||||
return $this->getPrimary( $cluster );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $server Primary DB server configuration array for LoadBalancer
|
||||
* @return string|bool Database domain ID or false
|
||||
|
|
@ -257,7 +268,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
|
|||
|
||||
static $supportedTypes = [ 'mysql', 'sqlite' ];
|
||||
|
||||
$dbw = $this->getMaster( $cluster );
|
||||
$dbw = $this->getPrimary( $cluster );
|
||||
if ( !in_array( $dbw->getType(), $supportedTypes, true ) ) {
|
||||
throw new DBUnexpectedError( $dbw, "RDBMS type '{$dbw->getType()}' not supported." );
|
||||
}
|
||||
|
|
@ -321,7 +332,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
|
|||
// Try the primary DB
|
||||
$this->logger->warning( __METHOD__ . ": primary DB fallback on $cacheID" );
|
||||
$scope = $this->lbFactory->getTransactionProfiler()->silenceForScope();
|
||||
$dbw = $this->getMaster( $cluster );
|
||||
$dbw = $this->getPrimary( $cluster );
|
||||
$ret = $dbw->selectField(
|
||||
$this->getTable( $dbw, $cluster ),
|
||||
'blob_text',
|
||||
|
|
@ -371,7 +382,7 @@ class ExternalStoreDB extends ExternalStoreMedium {
|
|||
implode( ',', array_keys( $ids ) )
|
||||
);
|
||||
$scope = $this->lbFactory->getTransactionProfiler()->silenceForScope();
|
||||
$dbw = $this->getMaster( $cluster );
|
||||
$dbw = $this->getPrimary( $cluster );
|
||||
$res = $dbw->select(
|
||||
$this->getTable( $dbr, $cluster ),
|
||||
[ 'blob_id', 'blob_text' ],
|
||||
|
|
|
|||
|
|
@ -813,7 +813,7 @@ class CgzCopyTransaction {
|
|||
// Insert the data into the destination cluster
|
||||
$targetCluster = $this->parent->getTargetCluster();
|
||||
$store = $this->parent->store;
|
||||
$targetDB = $store->getMaster( $targetCluster );
|
||||
$targetDB = $store->getPrimary( $targetCluster );
|
||||
$targetDB->clearFlag( DBO_TRX ); // we manage the transactions
|
||||
$targetDB->begin( __METHOD__ );
|
||||
$baseUrl = $this->parent->store->store( $targetCluster, serialize( $this->cgz ) );
|
||||
|
|
|
|||
|
|
@ -1578,9 +1578,9 @@ abstract class MediaWikiIntegrationTestCase extends PHPUnit\Framework\TestCase {
|
|||
foreach ( $defaultArray as $url ) {
|
||||
if ( strpos( $url, 'DB://' ) === 0 ) {
|
||||
[ $proto, $cluster ] = explode( '://', $url, 2 );
|
||||
// Avoid getMaster() because setupDatabaseWithTestPrefix()
|
||||
// Avoid getPrimary() because setupDatabaseWithTestPrefix()
|
||||
// requires Database instead of plain DBConnRef/IDatabase
|
||||
$dbws[] = $externalStoreDB->getMaster( $cluster );
|
||||
$dbws[] = $externalStoreDB->getPrimary( $cluster );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue