Allow WikiPageEntityRevisionLookup to work with foreign repos
Closed, ResolvedPublic

Description

WikiPageEntityRevisionLookup loads entity data directly from a mediawiki database. It already supports accessign a "foreign" wiki database (not the local wiki). It now needs to support foreign entity IDs. To achieve this, we must do two things:

  • check that the EntityId used to request the desired entity revision belongs to the correct repository. That is, EntityId::getRepositoryName should return the name of the repo to corresponds to the database name used by the WikiPageEntityRevisionLookup. Note that repo name and database name are usually but not necessarily the same. We can assume that the repo name is the same as the global site ID. Note: checking this should happen already in WikiPageEntityMetaDataAccessor.
  • the factory logic that instantiates the WikiPageEntityRevisionLookup must make sure to provide a EntityContentDataCodec that uses a Deserializer that is configured to apply the correct ID prefix mapping for the given foreign repo. We may want to introduce a ForeignEntityRevisionLookupFactory for this purpose, which can be used to acquire an EntityRevisionLookup for a given repo. Creating that interface should be tracked in a separate task.
daniel created this task.Oct 31 2016, 3:24 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 31 2016, 3:24 PM
daniel triaged this task as Normal priority.Oct 31 2016, 4:12 PM
daniel moved this task from proposed to accepted on the WMDE-TLA-Team board.Nov 1 2016, 1:39 PM

Change 319321 had a related patch set uploaded (by WMDE-leszek):
Check if the EntityId belongs to the right repository in WikiPageEntityRevisionLookup

https://gerrit.wikimedia.org/r/319321

WMDE-leszek moved this task from accepted to doing on the WMDE-TLA-Team board.Nov 3 2016, 1:08 PM

Change 320588 had a related patch set uploaded (by WMDE-leszek):
Strip foreign repository prefix when looking up an entity revision in WikiPageEntityRevisionLookup

https://gerrit.wikimedia.org/r/320588

While discussing https://gerrit.wikimedia.org/r/#/c/319321 @thiemowmde suggested to move checking that entity id belongs to the repository the lookup instance has been configured for down to WikiPageEntityMetaDataAccessor, instead of doing it in WikiPageEntityRevisionLookup.
We will do it as suggested. Note: I think this check should be only in "first-level" implementations of WikiPageEntityMetaDataAccessor interface, ie. in WikiPageEntityMetaDataLookup but not in PrefetchingWikiPageEntityMetaDataAccessor.

WMDE-leszek updated the task description. (Show Details)Nov 11 2016, 9:54 AM

Change 319321 merged by jenkins-bot:
Check if the EntityId belongs to the right repository in WikiPageEntityMetaDataLookup

https://gerrit.wikimedia.org/r/319321

Change 320588 merged by jenkins-bot:
Strip foreign repository prefix when looking up an entity revision in WikiPageEntityMetaDataLookup

https://gerrit.wikimedia.org/r/320588

WMDE-leszek moved this task from needs review to done on the WMDE-TLA-Team board.Nov 15 2016, 7:44 AM
WMDE-leszek closed this task as Resolved.Nov 22 2016, 1:26 PM