Page MenuHomePhabricator

Rename DB_MASTER to DB_PRIMARY
Closed, ResolvedPublic

Description

https://dev.mysql.com/doc/refman/8.0/en/replication.html

Replication enables data from one MySQL database server (known as a source) to be copied to one or more MySQL database servers (known as replicas).

Do we want DB_PRIMARY, or DB_SOURCE, or something else?

Follows up rMW950cf6016c10: Rename DB_SLAVE constant to DB_REPLICA and T190395: Use DB_REPLICA constant instead of DB_SLAVE

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Reedy updated the task description. (Show Details)
Reedy updated the task description. (Show Details)

Tagging 1.31/1.35 as the constants addition should be backported, but not so worried about backporting usages.

I don't like DB_SOURCE. That makes sense when talking about replication, not when talking about the only write-enabled DB server. DB_PRIMARY is better, IMO.

+1 for PRIMARY instead of SOURCE

Change 678397 had a related patch set uploaded (by Majavah; author: Majavah):

[mediawiki/core@master] rdbms: Add DB_PRIMARY to replace DB_MASTER

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

The old "multi master" has become "multi source" - https://dev.mysql.com/doc/refman/5.7/en/replication-multi-source.html.

I know MW doesn't support Multi Master... But in theory it could some day.... Multi Primary (database servers) feels odd

Multi-primary is more obviously correct than multi-source, which might imply storing different things in different databases and merging it. Let's keep that term.

I think moving MASTER to PRIMARY is good enough for now. It can be changed (again) later (if really necessary).

Change 679917 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/tools/codesniffer@master] MediaWiki.Usage.DeprecatedConstantUsage: Replace DB_MASTER from 1.36.0+

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

Jdforrester-WMF renamed this task from Rename DB_MASTER to Rename DB_MASTER to DB_PRIMARY.Apr 15 2021, 6:41 PM

Renamed so that a later task won't duplicate. :-)

Change 680357 had a related patch set uploaded (by Reedy; author: Majavah):

[mediawiki/core@REL1_36] rdbms: Add DB_PRIMARY to replace DB_MASTER

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

Change 680358 had a related patch set uploaded (by Reedy; author: Majavah):

[mediawiki/core@REL1_35] rdbms: Add DB_PRIMARY to replace DB_MASTER

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

Change 680359 had a related patch set uploaded (by Reedy; author: Majavah):

[mediawiki/core@REL1_31] rdbms: Add DB_PRIMARY to replace DB_MASTER

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

Change 678397 merged by jenkins-bot:

[mediawiki/core@master] rdbms: Add DB_PRIMARY to replace DB_MASTER

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

Change 680357 merged by jenkins-bot:

[mediawiki/core@REL1_36] rdbms: Add DB_PRIMARY to replace DB_MASTER

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

Change 680359 merged by jenkins-bot:

[mediawiki/core@REL1_31] rdbms: Add DB_PRIMARY to replace DB_MASTER

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

Change 680358 merged by jenkins-bot:

[mediawiki/core@REL1_35] rdbms: Add DB_PRIMARY to replace DB_MASTER

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

Reedy assigned this task to Majavah.

What's the new name for primary master and secondary master (in a multi-DC context)? Active primary and passive primary?

What's the new name for primary master and secondary master (in a multi-DC context)? Active primary and passive primary?

Yes, those terms sound fine to me. However, when the multi-DC work gets to the level of needing this term, the team working on it should use their discretion to decide on the label, rather than us just deciding it for them years ahead of time.

Change 679917 merged by jenkins-bot:

[mediawiki/tools/codesniffer@master] MediaWiki.Usage.DeprecatedConstantUsage: Replace DB_MASTER from 1.36.0+

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

There are also several ILoadBalancer methods with “master”:

  • getMasterPos (and also the DBMasterPos interface)
  • finalizeMasterChanges
  • approveMasterChanges
  • beginMasterChanges
  • commitMasterChanges
  • runMasterTransactionIdleCallbacks
  • runMasterTransactionListenerCallbacks
  • rollbackMasterChanges
  • flushMasterSnapshots
  • hasMasterConnection
  • hasMasterChanges
  • lastMasterChangeTimestamp
  • hasOrMadeRecentMasterChanges
  • pendingMasterChangeCallers
  • forEachOpenMasterConnection
  • waitForMasterPos

I assume those should be renamed as well?

There are also several ILoadBalancer methods with “master”

Indeed. I'll make a sub-task of the parent task about this; see my patches for work already underway.