Ladsgroup has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/372820 )
Change subject: slave -> replica
......................................................................
slave -> replica
This should've been done very long time ago
Change-Id: I158d2d30f6fdbde9649d5ef9dbfa08546119d508
---
M client/config/WikibaseClient.example.php
M client/includes/Changes/ChangeRunCoalescer.php
M client/includes/Hooks/DataUpdateHookHandlers.php
M client/includes/Store/Sql/BulkSubscriptionUpdater.php
M lib/includes/Store/CachingEntityRevisionLookup.php
M lib/includes/Store/DispatchingEntityRevisionLookup.php
M lib/includes/Store/EntityRevisionLookup.php
M lib/includes/Store/Sql/EntityChangeLookup.php
M lib/includes/Store/Sql/PrefetchingWikiPageEntityMetaDataAccessor.php
M lib/includes/Store/Sql/WikiPageEntityMetaDataAccessor.php
M lib/includes/Store/Sql/WikiPageEntityMetaDataLookup.php
M lib/includes/Store/Sql/WikiPageEntityRevisionLookup.php
M lib/tests/phpunit/MockRepository.php
M lib/tests/phpunit/Store/PrefetchingWikiPageEntityMetaDataAccessorTest.php
M repo/includes/Api/EntityLoadingHelper.php
M repo/includes/Api/ModifyEntity.php
M repo/includes/EditEntity.php
M repo/includes/Store/Sql/ItemsPerSiteBuilder.php
M repo/includes/Store/Sql/PropertyInfoTableBuilder.php
M repo/includes/Store/Sql/TermSearchKeyBuilder.php
M repo/tests/phpunit/includes/Store/Sql/WikiPageEntityMetaDataLookupTest.php
21 files changed, 79 insertions(+), 79 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase
refs/changes/20/372820/1
diff --git a/client/config/WikibaseClient.example.php
b/client/config/WikibaseClient.example.php
index 07d4489..03f0878 100644
--- a/client/config/WikibaseClient.example.php
+++ b/client/config/WikibaseClient.example.php
@@ -119,7 +119,7 @@
'local3' => '127.0.2.3',
],
- // Set up as fake master, because there are no slaves.
+ // Set up as fake master, because there are no replicas.
'masterTemplateOverrides' => [ 'fakeMaster' => true ],
];
diff --git a/client/includes/Changes/ChangeRunCoalescer.php
b/client/includes/Changes/ChangeRunCoalescer.php
index ee0afba..ce9acfd 100644
--- a/client/includes/Changes/ChangeRunCoalescer.php
+++ b/client/includes/Changes/ChangeRunCoalescer.php
@@ -151,7 +151,7 @@
$entityRev = $this->entityRevisionLookup->getEntityRevision(
$entityId,
$latestRevId,
- EntityRevisionLookup::LATEST_FROM_SLAVE_WITH_FALLBACK
+ EntityRevisionLookup::LATEST_FROM_REPLICA_WITH_FALLBACK
);
if ( !$entityRev ) {
diff --git a/client/includes/Hooks/DataUpdateHookHandlers.php
b/client/includes/Hooks/DataUpdateHookHandlers.php
index 536c5d2..5b49574 100644
--- a/client/includes/Hooks/DataUpdateHookHandlers.php
+++ b/client/includes/Hooks/DataUpdateHookHandlers.php
@@ -162,7 +162,7 @@
// schedule the usage updates in the job queue, to avoid
writing to the database
// during a GET request.
- //TODO: Before posting a job, check slave database. If no
changes are needed, skip update.
+ //TODO: Before posting a job, check replica database. If no
changes are needed, skip update.
$addUsagesForPageJob = AddUsagesForPageJob::newSpec( $title,
$usageAcc->getUsages() );
$enqueueJob = EnqueueJob::newFromLocalJobs(
$addUsagesForPageJob );
diff --git a/client/includes/Store/Sql/BulkSubscriptionUpdater.php
b/client/includes/Store/Sql/BulkSubscriptionUpdater.php
index 805276e..2c98e65 100644
--- a/client/includes/Store/Sql/BulkSubscriptionUpdater.php
+++ b/client/includes/Store/Sql/BulkSubscriptionUpdater.php
@@ -38,7 +38,7 @@
private $subscriberWikiId;
/**
- * @var string|false The repo wiki's id, as used by the LoadBalancer.
Used for wait for slaves.
+ * @var string|false The repo wiki's id, as used by the LoadBalancer.
Used for wait for replicas.
* False indicates to use the local wiki's database,
and is the default
* for the repoWiki setting.
*/
diff --git a/lib/includes/Store/CachingEntityRevisionLookup.php
b/lib/includes/Store/CachingEntityRevisionLookup.php
index f7cace3..dc24a9c 100644
--- a/lib/includes/Store/CachingEntityRevisionLookup.php
+++ b/lib/includes/Store/CachingEntityRevisionLookup.php
@@ -95,7 +95,7 @@
*
* @param EntityId $entityId
* @param int $revisionId The desired revision id, or 0 for the latest
revision.
- * @param string $mode LATEST_FROM_SLAVE,
LATEST_FROM_SLAVE_WITH_FALLBACK or
+ * @param string $mode LATEST_FROM_REPLICA,
LATEST_FROM_REPLICA_WITH_FALLBACK or
* LATEST_FROM_MASTER.
*
* @throws StorageException
@@ -104,7 +104,7 @@
public function getEntityRevision(
EntityId $entityId,
$revisionId = 0,
- $mode = self::LATEST_FROM_SLAVE
+ $mode = self::LATEST_FROM_REPLICA
) {
Assert::parameterType( 'integer', $revisionId, '$revisionId' );
Assert::parameterType( 'string', $mode, '$mode' );
@@ -175,7 +175,7 @@
*
* @return int|false
*/
- public function getLatestRevisionId( EntityId $entityId, $mode =
self::LATEST_FROM_SLAVE ) {
+ public function getLatestRevisionId( EntityId $entityId, $mode =
self::LATEST_FROM_REPLICA ) {
// If we do not need to verify the revision, and the revision
isn't
// needed for an update, we can get the revision from the
cached object.
// XXX: whether this is actually quicker depends on the cache.
diff --git a/lib/includes/Store/DispatchingEntityRevisionLookup.php
b/lib/includes/Store/DispatchingEntityRevisionLookup.php
index 34b98a7..f6d1f15 100644
--- a/lib/includes/Store/DispatchingEntityRevisionLookup.php
+++ b/lib/includes/Store/DispatchingEntityRevisionLookup.php
@@ -44,7 +44,7 @@
*
* @param EntityId $entityId
* @param int $revisionId The desired revision id, or 0 for the latest
revision.
- * @param string $mode LATEST_FROM_SLAVE,
LATEST_FROM_SLAVE_WITH_FALLBACK or LATEST_FROM_MASTER
+ * @param string $mode LATEST_FROM_REPLICA,
LATEST_FROM_REPLICA_WITH_FALLBACK or LATEST_FROM_MASTER
*
* @throws RevisionedUnresolvedRedirectException
* @throws StorageException
@@ -53,7 +53,7 @@
public function getEntityRevision(
EntityId $entityId,
$revisionId = 0,
- $mode = self::LATEST_FROM_SLAVE
+ $mode = self::LATEST_FROM_REPLICA
) {
$lookup = $this->getLookupForEntityId( $entityId );
return $lookup !== null ? $lookup->getEntityRevision(
$entityId, $revisionId, $mode ) : null;
@@ -64,11 +64,11 @@
* Returns false also when $entityId does not belong to the repository
with the configured lookup.
*
* @param EntityId $entityId
- * @param string $mode LATEST_FROM_SLAVE,
LATEST_FROM_SLAVE_WITH_FALLBACK or LATEST_FROM_MASTER
+ * @param string $mode LATEST_FROM_REPLICA,
LATEST_FROM_REPLICA_WITH_FALLBACK or LATEST_FROM_MASTER
*
* @return int|false
*/
- public function getLatestRevisionId( EntityId $entityId, $mode =
self::LATEST_FROM_SLAVE ) {
+ public function getLatestRevisionId( EntityId $entityId, $mode =
self::LATEST_FROM_REPLICA ) {
$lookup = $this->getLookupForEntityId( $entityId );
return $lookup !== null ? $lookup->getLatestRevisionId(
$entityId, $mode ) : false;
}
diff --git a/lib/includes/Store/EntityRevisionLookup.php
b/lib/includes/Store/EntityRevisionLookup.php
index 6a5278e..bda324a 100644
--- a/lib/includes/Store/EntityRevisionLookup.php
+++ b/lib/includes/Store/EntityRevisionLookup.php
@@ -17,14 +17,14 @@
* but a slightly lagged version is acceptable. This would generally be
the case when fetching
* entities for display.
*/
- const LATEST_FROM_SLAVE = 'slave';
+ const LATEST_FROM_REPLICA = 'replica';
/**
* Flag used to indicate that loading slightly lagged data is fine (like
- * LATEST_FROM_SLAVE), but in case an entity or revision couldn't be
found,
+ * LATEST_FROM_REPLICA), but in case an entity or revision couldn't be
found,
* we try loading it from master.
*/
- const LATEST_FROM_SLAVE_WITH_FALLBACK = 'master_fallback';
+ const LATEST_FROM_REPLICA_WITH_FALLBACK = 'master_fallback';
/**
* Flag to use instead of a revision ID to indicate that the latest
revision is desired,
@@ -44,7 +44,7 @@
*
* @param EntityId $entityId
* @param int $revisionId The desired revision id, or 0 for the latest
revision.
- * @param string $mode LATEST_FROM_SLAVE,
LATEST_FROM_SLAVE_WITH_FALLBACK or
+ * @param string $mode LATEST_FROM_REPLICA,
LATEST_FROM_REPLICA_WITH_FALLBACK or
* LATEST_FROM_MASTER.
*
* @throws RevisionedUnresolvedRedirectException
@@ -54,7 +54,7 @@
public function getEntityRevision(
EntityId $entityId,
$revisionId = 0,
- $mode = self::LATEST_FROM_SLAVE
+ $mode = self::LATEST_FROM_REPLICA
);
/**
@@ -63,11 +63,11 @@
* Implementations of this method must not silently resolve redirects.
*
* @param EntityId $entityId
- * @param string $mode LATEST_FROM_SLAVE,
LATEST_FROM_SLAVE_WITH_FALLBACK or LATEST_FROM_MASTER.
+ * @param string $mode LATEST_FROM_REPLICA,
LATEST_FROM_REPLICA_WITH_FALLBACK or LATEST_FROM_MASTER.
* LATEST_FROM_MASTER would force the revision to be determined
from the canonical master database.
*
* @return int|false Returns false in case the entity doesn't exist
(this includes redirects).
*/
- public function getLatestRevisionId( EntityId $entityId, $mode =
self::LATEST_FROM_SLAVE );
+ public function getLatestRevisionId( EntityId $entityId, $mode =
self::LATEST_FROM_REPLICA );
}
diff --git a/lib/includes/Store/Sql/EntityChangeLookup.php
b/lib/includes/Store/Sql/EntityChangeLookup.php
index 24d601b..84be32c 100644
--- a/lib/includes/Store/Sql/EntityChangeLookup.php
+++ b/lib/includes/Store/Sql/EntityChangeLookup.php
@@ -23,7 +23,7 @@
*/
const FROM_MASTER = 'master';
- const FROM_SLAVE = 'slave';
+ const FROM_REPLICA = 'replica';
/**
* @var EntityChangeFactory
@@ -106,7 +106,7 @@
*
* @return EntityChange|null
*/
- public function loadByRevisionId( $revisionId, $mode = self::FROM_SLAVE
) {
+ public function loadByRevisionId( $revisionId, $mode =
self::FROM_REPLICA ) {
Assert::parameterType( 'integer', $revisionId, '$revisionId' );
$change = $this->loadChanges(
diff --git
a/lib/includes/Store/Sql/PrefetchingWikiPageEntityMetaDataAccessor.php
b/lib/includes/Store/Sql/PrefetchingWikiPageEntityMetaDataAccessor.php
index ae9c0c4..9829e8b 100644
--- a/lib/includes/Store/Sql/PrefetchingWikiPageEntityMetaDataAccessor.php
+++ b/lib/includes/Store/Sql/PrefetchingWikiPageEntityMetaDataAccessor.php
@@ -136,8 +136,8 @@
* @see WikiPageEntityMetaDataAccessor::loadRevisionInformation
*
* @param EntityId[] $entityIds
- * @param string $mode (EntityRevisionLookup::LATEST_FROM_SLAVE,
- * EntityRevisionLookup::LATEST_FROM_SLAVE_WITH_FALLBACK or
+ * @param string $mode (EntityRevisionLookup::LATEST_FROM_REPLICA,
+ * EntityRevisionLookup::LATEST_FROM_REPLICA_WITH_FALLBACK or
* EntityRevisionLookup::LATEST_FROM_MASTER)
*
* @return stdClass[] Array of entity id serialization => object.
@@ -175,8 +175,8 @@
*
* @param EntityId $entityId
* @param int $revisionId
- * @param string $mode (EntityRevisionLookup::LATEST_FROM_SLAVE,
- * EntityRevisionLookup::LATEST_FROM_SLAVE_WITH_FALLBACK or
+ * @param string $mode (EntityRevisionLookup::LATEST_FROM_REPLICA,
+ * EntityRevisionLookup::LATEST_FROM_REPLICA_WITH_FALLBACK or
* EntityRevisionLookup::LATEST_FROM_MASTER)
*
* @return stdClass|bool false if no such entity exists
diff --git a/lib/includes/Store/Sql/WikiPageEntityMetaDataAccessor.php
b/lib/includes/Store/Sql/WikiPageEntityMetaDataAccessor.php
index 4406909..c09ef23 100644
--- a/lib/includes/Store/Sql/WikiPageEntityMetaDataAccessor.php
+++ b/lib/includes/Store/Sql/WikiPageEntityMetaDataAccessor.php
@@ -22,8 +22,8 @@
* 'page_latest', 'old_id', 'old_text' and 'old_flags'.
*
* @param EntityId[] $entityIds
- * @param string $mode (EntityRevisionLookup::LATEST_FROM_SLAVE,
- * EntityRevisionLookup::LATEST_FROM_SLAVE_WITH_FALLBACK or
+ * @param string $mode (EntityRevisionLookup::LATEST_FROM_REPLICA,
+ * EntityRevisionLookup::LATEST_FROM_REPLICA_WITH_FALLBACK or
* EntityRevisionLookup::LATEST_FROM_MASTER)
*
* @return stdClass[] Array of entity id serialization => object.
@@ -36,13 +36,13 @@
* 'rev_id', 'rev_content_format', 'rev_timestamp', 'page_latest',
'old_id', 'old_text'
* and 'old_flags'.
* Given that revision are immutable, this function will always try to
load a revision from
- * slave first and only use the master (with
EntityRevisionLookup::LATEST_FROM_SLAVE_WITH_FALLBACK
+ * replica first and only use the master (with
EntityRevisionLookup::LATEST_FROM_REPLICA_WITH_FALLBACK
* or EntityRevisionLookup::LATEST_FROM_MASTER) in case the revision
couldn't be found.
*
* @param EntityId $entityId
* @param int $revisionId Revision id to fetch data about, must be an
integer greater than 0.
- * @param string $mode (EntityRevisionLookup::LATEST_FROM_SLAVE,
- * EntityRevisionLookup::LATEST_FROM_SLAVE_WITH_FALLBACK or
+ * @param string $mode (EntityRevisionLookup::LATEST_FROM_REPLICA,
+ * EntityRevisionLookup::LATEST_FROM_REPLICA_WITH_FALLBACK or
* EntityRevisionLookup::LATEST_FROM_MASTER).
*
* @return stdClass|bool false if no such entity exists
diff --git a/lib/includes/Store/Sql/WikiPageEntityMetaDataLookup.php
b/lib/includes/Store/Sql/WikiPageEntityMetaDataLookup.php
index 62017ad..0b3c4b5 100644
--- a/lib/includes/Store/Sql/WikiPageEntityMetaDataLookup.php
+++ b/lib/includes/Store/Sql/WikiPageEntityMetaDataLookup.php
@@ -52,8 +52,8 @@
/**
* @param EntityId[] $entityIds
- * @param string $mode (EntityRevisionLookup::LATEST_FROM_SLAVE,
- * EntityRevisionLookup::LATEST_FROM_SLAVE_WITH_FALLBACK or
+ * @param string $mode (EntityRevisionLookup::LATEST_FROM_REPLICA,
+ * EntityRevisionLookup::LATEST_FROM_REPLICA_WITH_FALLBACK or
* EntityRevisionLookup::LATEST_FROM_MASTER)
*
* @throws DBQueryError
@@ -77,7 +77,7 @@
$rows = $this->selectRevisionInformationMultiple(
$entityIds, DB_REPLICA );
}
- if ( $mode !== EntityRevisionLookup::LATEST_FROM_SLAVE ) {
+ if ( $mode !== EntityRevisionLookup::LATEST_FROM_REPLICA ) {
// Attempt to load (missing) rows from master if the
caller asked for that.
$loadFromMaster = [];
/** @var EntityId $entityId */
@@ -101,8 +101,8 @@
/**
* @param EntityId $entityId
* @param int $revisionId
- * @param string $mode
(WikiPageEntityMetaDataAccessor::LATEST_FROM_SLAVE,
- * WikiPageEntityMetaDataAccessor::LATEST_FROM_SLAVE_WITH_FALLBACK
or
+ * @param string $mode
(WikiPageEntityMetaDataAccessor::LATEST_FROM_REPLICA,
+ *
WikiPageEntityMetaDataAccessor::LATEST_FROM_REPLICA_WITH_FALLBACK or
* WikiPageEntityMetaDataAccessor::LATEST_FROM_MASTER)
*
* @throws DBQueryError
@@ -123,8 +123,8 @@
$row = $this->selectRevisionInformationById( $entityId,
$revisionId, DB_REPLICA );
- if ( !$row && $mode !== EntityRevisionLookup::LATEST_FROM_SLAVE
) {
- // Try loading from master, unless the caller only
wants slave data.
+ if ( !$row && $mode !==
EntityRevisionLookup::LATEST_FROM_REPLICA ) {
+ // Try loading from master, unless the caller only
wants replica data.
wfDebugLog( __CLASS__, __FUNCTION__ . ': try to load '
. $entityId
. " with $revisionId from DB_MASTER." );
diff --git a/lib/includes/Store/Sql/WikiPageEntityRevisionLookup.php
b/lib/includes/Store/Sql/WikiPageEntityRevisionLookup.php
index b14f67e..5982cb5 100644
--- a/lib/includes/Store/Sql/WikiPageEntityRevisionLookup.php
+++ b/lib/includes/Store/Sql/WikiPageEntityRevisionLookup.php
@@ -58,7 +58,7 @@
*
* @param EntityId $entityId
* @param int $revisionId The desired revision id, or 0 for the latest
revision.
- * @param string $mode LATEST_FROM_SLAVE,
LATEST_FROM_SLAVE_WITH_FALLBACK or
+ * @param string $mode LATEST_FROM_REPLICA,
LATEST_FROM_REPLICA_WITH_FALLBACK or
* LATEST_FROM_MASTER.
*
* @throws RevisionedUnresolvedRedirectException
@@ -68,7 +68,7 @@
public function getEntityRevision(
EntityId $entityId,
$revisionId = 0,
- $mode = self::LATEST_FROM_SLAVE
+ $mode = self::LATEST_FROM_REPLICA
) {
Assert::parameterType( 'integer', $revisionId, '$revisionId' );
Assert::parameterType( 'string', $mode, '$mode' );
@@ -135,7 +135,7 @@
*
* @return int|false
*/
- public function getLatestRevisionId( EntityId $entityId, $mode =
self::LATEST_FROM_SLAVE ) {
+ public function getLatestRevisionId( EntityId $entityId, $mode =
self::LATEST_FROM_REPLICA ) {
$rows = $this->entityMetaDataAccessor->loadRevisionInformation(
[ $entityId ], $mode );
$row = $rows[$entityId->getSerialization()];
diff --git a/lib/tests/phpunit/MockRepository.php
b/lib/tests/phpunit/MockRepository.php
index e70d01d..52e5497 100644
--- a/lib/tests/phpunit/MockRepository.php
+++ b/lib/tests/phpunit/MockRepository.php
@@ -113,7 +113,7 @@
*
* @param EntityId $entityId
* @param int $revisionId The desired revision id, or 0 for the latest
revision.
- * @param string $mode LATEST_FROM_SLAVE,
LATEST_FROM_SLAVE_WITH_FALLBACK or
+ * @param string $mode LATEST_FROM_REPLICA,
LATEST_FROM_REPLICA_WITH_FALLBACK or
* LATEST_FROM_MASTER.
*
* @throws RevisionedUnresolvedRedirectException
@@ -123,7 +123,7 @@
public function getEntityRevision(
EntityId $entityId,
$revisionId = 0,
- $mode = self::LATEST_FROM_SLAVE
+ $mode = self::LATEST_FROM_REPLICA
) {
$key = $entityId->getSerialization();
@@ -457,7 +457,7 @@
*
* @return int|false
*/
- public function getLatestRevisionId( EntityId $entityId, $mode =
self::LATEST_FROM_SLAVE ) {
+ public function getLatestRevisionId( EntityId $entityId, $mode =
self::LATEST_FROM_REPLICA ) {
try {
$revision = $this->getEntityRevision( $entityId, 0,
$mode );
} catch ( RevisionedUnresolvedRedirectException $e ) {
diff --git
a/lib/tests/phpunit/Store/PrefetchingWikiPageEntityMetaDataAccessorTest.php
b/lib/tests/phpunit/Store/PrefetchingWikiPageEntityMetaDataAccessorTest.php
index 2059810..2530463 100644
--- a/lib/tests/phpunit/Store/PrefetchingWikiPageEntityMetaDataAccessorTest.php
+++ b/lib/tests/phpunit/Store/PrefetchingWikiPageEntityMetaDataAccessorTest.php
@@ -24,7 +24,7 @@
class PrefetchingWikiPageEntityMetaDataAccessorTest extends
PHPUnit_Framework_TestCase {
public function testPrefetch() {
- $fromSlave = EntityRevisionLookup::LATEST_FROM_SLAVE;
+ $fromReplica = EntityRevisionLookup::LATEST_FROM_REPLICA;
$q1 = new ItemId( 'Q1' );
$q2 = new ItemId( 'Q2' );
$q3 = new ItemId( 'Q3' );
@@ -38,7 +38,7 @@
$q3->getSerialization() => $q3,
$q2->getSerialization() => $q2
],
- $fromSlave
+ $fromReplica
)
->will( $this->returnValue( [
'Q1' => 'Nyan',
@@ -54,13 +54,13 @@
$accessor->prefetch( [ $q1 ] );
// This will trigger all three to be loaded
- $rows = $accessor->loadRevisionInformation( [ $q2 ], $fromSlave
);
+ $rows = $accessor->loadRevisionInformation( [ $q2 ],
$fromReplica );
$result = $rows[$q2->getSerialization()];
$this->assertSame( 'cat', $result );
// No need to load this, already in cache
- $rows = $accessor->loadRevisionInformation( [ $q3 ], $fromSlave
);
+ $rows = $accessor->loadRevisionInformation( [ $q3 ],
$fromReplica );
$result = $rows[$q3->getSerialization()];
$this->assertSame( '~=[,,_,,]:3', $result );
@@ -71,7 +71,7 @@
* automatically resizes the cache to handle that.
*/
public function testPrefetch_moreAtOnce() {
- $fromSlave = EntityRevisionLookup::LATEST_FROM_SLAVE;
+ $fromReplica = EntityRevisionLookup::LATEST_FROM_REPLICA;
$q1 = new ItemId( 'Q1' );
$q2 = new ItemId( 'Q2' );
$q3 = new ItemId( 'Q3' );
@@ -93,7 +93,7 @@
$accessor = new PrefetchingWikiPageEntityMetaDataAccessor(
$lookup, 2 );
// This will trigger all three to be loaded
- $result = $accessor->loadRevisionInformation( [ $q1, $q2, $q3
], $fromSlave );
+ $result = $accessor->loadRevisionInformation( [ $q1, $q2, $q3
], $fromReplica );
$this->assertSame( $expected, $result );
}
@@ -103,7 +103,7 @@
* discard some entities in order to store the ones that are
immediately needed.
*/
public function testPrefetch_discardPrefetch() {
- $fromSlave = EntityRevisionLookup::LATEST_FROM_SLAVE;
+ $fromReplica = EntityRevisionLookup::LATEST_FROM_REPLICA;
$q1 = new ItemId( 'Q1' );
$q2 = new ItemId( 'Q2' );
$q3 = new ItemId( 'Q3' );
@@ -126,7 +126,7 @@
$accessor->prefetch( [ $q1, $q3 ] );
// Load $q1 and $q2... should not load $q3 as we don't have
space to cache that data.
- $result = $accessor->loadRevisionInformation( [ $q1, $q2 ],
$fromSlave );
+ $result = $accessor->loadRevisionInformation( [ $q1, $q2 ],
$fromReplica );
$this->assertSame( $expected, $result );
}
@@ -139,7 +139,7 @@
$q5 = new ItemId( 'Q5' );
$fromMaster = EntityRevisionLookup::LATEST_FROM_MASTER;
- $fromSlave = EntityRevisionLookup::LATEST_FROM_SLAVE;
+ $fromReplica = EntityRevisionLookup::LATEST_FROM_REPLICA;
$lookup = $this->getMock( WikiPageEntityMetaDataAccessor::class
);
$lookup->expects( $this->exactly( 3 ) )
@@ -162,23 +162,23 @@
$accessor->prefetch( [ $q1, $q3 ] );
// This will trigger loading Q1, Q2 and Q3
- $result = $accessor->loadRevisionInformation( [ $q2 ],
$fromSlave );
+ $result = $accessor->loadRevisionInformation( [ $q2 ],
$fromReplica );
- $this->assertSame( [ 'Q2' => "$fromSlave:Q2" ], $result );
+ $this->assertSame( [ 'Q2' => "$fromReplica:Q2" ], $result );
// This can be served entirely from cache
- $result = $accessor->loadRevisionInformation( [ $q1, $q3 ],
$fromSlave );
+ $result = $accessor->loadRevisionInformation( [ $q1, $q3 ],
$fromReplica );
$this->assertSame(
- [ 'Q1' => "$fromSlave:Q1", 'Q3' => "$fromSlave:Q3" ],
+ [ 'Q1' => "$fromReplica:Q1", 'Q3' => "$fromReplica:Q3"
],
$result
);
// Fetch Q2 and Q5. Q2 is already cached Q5 needs to be loaded
- $result = $accessor->loadRevisionInformation( [ $q2, $q5 ],
$fromSlave );
+ $result = $accessor->loadRevisionInformation( [ $q2, $q5 ],
$fromReplica );
$this->assertSame(
- [ 'Q2' => "$fromSlave:Q2", 'Q5' => "$fromSlave:Q5" ],
+ [ 'Q2' => "$fromReplica:Q2", 'Q5' => "$fromReplica:Q5"
],
$result
);
@@ -188,10 +188,10 @@
$this->assertSame( [ 'Q4' => "$fromMaster:Q4" ], $result );
// Fetch Q2 and Q4, both from cache
- $result = $accessor->loadRevisionInformation( [ $q2, $q4 ],
$fromSlave );
+ $result = $accessor->loadRevisionInformation( [ $q2, $q4 ],
$fromReplica );
$this->assertSame(
- [ 'Q2' => "$fromSlave:Q2", 'Q4' => "$fromMaster:Q4" ],
+ [ 'Q2' => "$fromReplica:Q2", 'Q4' => "$fromMaster:Q4" ],
$result
);
}
@@ -245,7 +245,7 @@
* @param array $params
*/
private function purgeMethodTest( $method, array $params ) {
- $fromSlave = EntityRevisionLookup::LATEST_FROM_SLAVE;
+ $fromReplica = EntityRevisionLookup::LATEST_FROM_REPLICA;
$q1 = new ItemId( 'Q1' );
$lookup = $this->getMock( WikiPageEntityMetaDataAccessor::class
);
@@ -264,7 +264,7 @@
$accessor = new PrefetchingWikiPageEntityMetaDataAccessor(
$lookup );
- $rows = $accessor->loadRevisionInformation( [ $q1 ], $fromSlave
);
+ $rows = $accessor->loadRevisionInformation( [ $q1 ],
$fromReplica );
$result = $rows[$q1->getSerialization()];
$this->assertSame( 'Foo', $result );
@@ -272,7 +272,7 @@
call_user_func_array( [ $accessor, $method ], $params );
// Load it again after purge
- $rows = $accessor->loadRevisionInformation( [ $q1 ], $fromSlave
);
+ $rows = $accessor->loadRevisionInformation( [ $q1 ],
$fromReplica );
$result = $rows[$q1->getSerialization()];
$this->assertSame( 'Bar', $result );
diff --git a/repo/includes/Api/EntityLoadingHelper.php
b/repo/includes/Api/EntityLoadingHelper.php
index 43b8883..766f4cd 100644
--- a/repo/includes/Api/EntityLoadingHelper.php
+++ b/repo/includes/Api/EntityLoadingHelper.php
@@ -49,7 +49,7 @@
/**
* @var string See the LATEST_XXX constants defined in
EntityRevisionLookup
*/
- protected $defaultRetrievalMode =
EntityRevisionLookup::LATEST_FROM_SLAVE;
+ protected $defaultRetrievalMode =
EntityRevisionLookup::LATEST_FROM_REPLICA;
/**
* @var SiteLinkLookup|null
@@ -126,7 +126,7 @@
*
* @param EntityId $entityId EntityId of the page to load the revision
for
* @param int $revId The desired revision id, or 0 for the latest
revision.
- * @param string|null $mode LATEST_FROM_SLAVE,
LATEST_FROM_SLAVE_WITH_FALLBACK or
+ * @param string|null $mode LATEST_FROM_REPLICA,
LATEST_FROM_REPLICA_WITH_FALLBACK or
* LATEST_FROM_MASTER (from EntityRevisionLookup). Null for the
default.
*
* @throws ApiUsageException
diff --git a/repo/includes/Api/ModifyEntity.php
b/repo/includes/Api/ModifyEntity.php
index 8e230db..05a1d33 100644
--- a/repo/includes/Api/ModifyEntity.php
+++ b/repo/includes/Api/ModifyEntity.php
@@ -182,7 +182,7 @@
$currentEntityRevision =
$this->revisionLookup->getEntityRevision(
$entity->getId(),
0,
-
EntityRevisionLookup::LATEST_FROM_SLAVE_WITH_FALLBACK
+
EntityRevisionLookup::LATEST_FROM_REPLICA_WITH_FALLBACK
);
$currentEntity = $currentEntityRevision ?
$currentEntityRevision->getEntity() : $entity;
$result = $changeOp->validate( $currentEntity );
diff --git a/repo/includes/EditEntity.php b/repo/includes/EditEntity.php
index 5b1306f..c79edfe 100644
--- a/repo/includes/EditEntity.php
+++ b/repo/includes/EditEntity.php
@@ -329,7 +329,7 @@
$this->baseRev =
$this->entityRevisionLookup->getEntityRevision(
$id,
$baseRevId,
-
EntityRevisionLookup::LATEST_FROM_SLAVE_WITH_FALLBACK
+
EntityRevisionLookup::LATEST_FROM_REPLICA_WITH_FALLBACK
);
if ( $this->baseRev === null ) {
diff --git a/repo/includes/Store/Sql/ItemsPerSiteBuilder.php
b/repo/includes/Store/Sql/ItemsPerSiteBuilder.php
index de320d4..56c1000 100644
--- a/repo/includes/Store/Sql/ItemsPerSiteBuilder.php
+++ b/repo/includes/Store/Sql/ItemsPerSiteBuilder.php
@@ -112,7 +112,7 @@
$c++;
}
- // Wait for the slaves, just in case we e.g. hit a range of ids
which need a lot of writes.
+ // Wait for the replicas, just in case we e.g. hit a range of
ids which need a lot of writes.
wfWaitForSlaves();
return $c;
diff --git a/repo/includes/Store/Sql/PropertyInfoTableBuilder.php
b/repo/includes/Store/Sql/PropertyInfoTableBuilder.php
index 8d4d7e5..04da5bd 100644
--- a/repo/includes/Store/Sql/PropertyInfoTableBuilder.php
+++ b/repo/includes/Store/Sql/PropertyInfoTableBuilder.php
@@ -153,7 +153,7 @@
$pageId = 1;
while ( true ) {
- // Make sure we are not running too far ahead of the
slaves,
+ // Make sure we are not running too far ahead of the
replicas,
// as that would cause the site to be rendered read
only.
$lbFactory->commitAndWaitForReplication( __METHOD__,
$ticket );
diff --git a/repo/includes/Store/Sql/TermSearchKeyBuilder.php
b/repo/includes/Store/Sql/TermSearchKeyBuilder.php
index ebb4f9d..5a3cd98 100644
--- a/repo/includes/Store/Sql/TermSearchKeyBuilder.php
+++ b/repo/includes/Store/Sql/TermSearchKeyBuilder.php
@@ -98,7 +98,7 @@
$lbFactory =
MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
$ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ );
while ( true ) {
- // Make sure we are not running too far ahead of the
slaves,
+ // Make sure we are not running too far ahead of the
replicas,
// as that would cause the site to be rendered read
only.
$lbFactory->commitAndWaitForReplication( __METHOD__,
$ticket );
diff --git
a/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityMetaDataLookupTest.php
b/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityMetaDataLookupTest.php
index cbbf448..4f2d989 100644
--- a/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityMetaDataLookupTest.php
+++ b/repo/tests/phpunit/includes/Store/Sql/WikiPageEntityMetaDataLookupTest.php
@@ -150,13 +150,13 @@
$entityRevision = $this->data[0];
// Make sure we have two calls to getConnection: One that asks
for a
- // slave and one that asks for the master.
+ // replica and one that asks for the master.
$lookup = $this->getLookupWithLaggedConnection( 0, 1, 2 );
$result = $lookup->loadRevisionInformationByRevisionId(
$entityRevision->getEntity()->getId(),
$entityRevision ->getRevisionId(),
- EntityRevisionLookup::LATEST_FROM_SLAVE_WITH_FALLBACK
+ EntityRevisionLookup::LATEST_FROM_REPLICA_WITH_FALLBACK
);
$this->assertEquals( $entityRevision->getRevisionId(),
$result->rev_id );
@@ -172,7 +172,7 @@
$result = $lookup->loadRevisionInformationByRevisionId(
$entityRevision->getEntity()->getId(),
$entityRevision ->getRevisionId(),
- EntityRevisionLookup::LATEST_FROM_SLAVE
+ EntityRevisionLookup::LATEST_FROM_REPLICA
);
// No fallback: Lagged data is omitted.
@@ -254,7 +254,7 @@
$result = $this->getWikiPageEntityMetaDataLookup()
->loadRevisionInformation(
$entityIds,
- EntityRevisionLookup::LATEST_FROM_SLAVE
+ EntityRevisionLookup::LATEST_FROM_REPLICA
);
$this->assertRevisionInformation( $entityIds, $result );
@@ -269,12 +269,12 @@
];
// Make sure we have two calls to getConnection: One that asks
for a
- // slave and one that asks for the master.
+ // replica and one that asks for the master.
$lookup = $this->getLookupWithLaggedConnection( 1, 0, 2 );
$result = $lookup->loadRevisionInformation(
$entityIds,
- EntityRevisionLookup::LATEST_FROM_SLAVE_WITH_FALLBACK
+ EntityRevisionLookup::LATEST_FROM_REPLICA_WITH_FALLBACK
);
$this->assertRevisionInformation( $entityIds, $result );
@@ -287,7 +287,7 @@
$lookup->loadRevisionInformation(
[ new ItemId( 'foo:Q123' ) ],
- EntityRevisionLookup::LATEST_FROM_SLAVE
+ EntityRevisionLookup::LATEST_FROM_REPLICA
);
}
@@ -299,7 +299,7 @@
$lookup->loadRevisionInformationByRevisionId(
new ItemId( 'foo:Q123' ),
1,
- EntityRevisionLookup::LATEST_FROM_SLAVE
+ EntityRevisionLookup::LATEST_FROM_REPLICA
);
}
@@ -311,7 +311,7 @@
$prefixedId = 'foo:' . $unprefixedId;
- $result = $lookup->loadRevisionInformation( [ new ItemId(
$prefixedId ) ], EntityRevisionLookup::LATEST_FROM_SLAVE );
+ $result = $lookup->loadRevisionInformation( [ new ItemId(
$prefixedId ) ], EntityRevisionLookup::LATEST_FROM_REPLICA );
$this->assertCount( 1, $result );
$this->assertArrayHasKey( $prefixedId, $result );
@@ -336,7 +336,7 @@
$result = $lookup->loadRevisionInformationByRevisionId(
new ItemId( $prefixedId ),
$revision->getRevisionId(),
- EntityRevisionLookup::LATEST_FROM_SLAVE
+ EntityRevisionLookup::LATEST_FROM_REPLICA
);
$this->assertInstanceOf( stdClass::class, $result );
--
To view, visit https://gerrit.wikimedia.org/r/372820
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I158d2d30f6fdbde9649d5ef9dbfa08546119d508
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Ladsgroup <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits