Page MenuHomePhabricator

Create database connection service abstraction
Closed, ResolvedPublic

Description

Create slim service(s) that abstracts away getting a new database connection via LoadBalancer/LBFactory.

This service should only handle 1: getting the connection and 2: waiting for replication. And maybe handling for some edge cases iff there are some in the existing usage.

We want two slightly different services/interfaces/implementations for Repo and Client connections

  • So we can use them for type-hinting
  • Their public methods should likely be the same, they will only differ in their constructor
    • Repo connections will have their domain configured, but otherwise fixed
    • Client connections will have to be given the domain dynamically depending on the wiki
  • We want to provide the load groups from-repo and from-client for every connection
    • We may want to provide more load-groups in the future

See https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/602823 for an initial draft in this direction.

This service should (ultimately) be extracted into a separate package as proposed by ADR-14 (not yet accepted). T284231

NOTE: LBFactory/Loadbalancer have some internal caching -> we need to make sure we understand how that works, otherwise unexpected things may happen. (Ask @Ladsgroup if confused)

See parent task for more context

Event Timeline

Change 693442 had a related patch set uploaded (by Jakob; author: Jakob):

[mediawiki/extensions/Wikibase@master] Create database connection service abstraction

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

Change 696463 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/Wikibase@master] Add ClientDomainDb and use it in Change Notification Jobs

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

Change 697426 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/Wikibase@master] Introduce client service for client DomainDb abstraction

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

Change 697606 had a related patch set uploaded (by Michael Große; author: Michael Große):

[mediawiki/extensions/Wikibase@master] Set default loadgroups for DomainDb instances

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

Change 693442 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Create database service abstraction

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

Change 696463 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Add ClientDomainDb and use it in Change Notification Jobs

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

Change 697426 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Introduce client service for client DomainDb abstraction

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

Change 697606 merged by jenkins-bot:

[mediawiki/extensions/Wikibase@master] Set default loadgroups for DomainDb instances

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

Jakob_WMDE updated the task description. (Show Details)