Page MenuHomePhabricator

Switchover s1 master (db1163 -> db1184)
Closed, ResolvedPublic

Description

When: During a pre-defined DBA maintenance windows

Prerequisites: https://wikitech.wikimedia.org/wiki/MariaDB/Primary_switchover

  • Team calendar invite

Affected wikis:: https://noc.wikimedia.org/conf/highlight.php?file=dblists/s1.dblist

Checklist:

NEW primary: db1184
OLD primary: db1163

  • Check configuration differences between new and old primary:
sudo pt-config-diff --defaults-file /root/.my.cnf h=db1163.eqiad.wmnet h=db1184.eqiad.wmnet

Failover prep:

  • Silence alerts on all hosts:
sudo cookbook sre.hosts.downtime --hours 1 -r "Primary switchover s1 T402870" 'A:db-section-s1'
  • Set NEW primary with weight 0
sudo dbctl instance db1184 set-weight 0
sudo dbctl config commit -m "Set db1184 with weight 0 T402870"
  • Depool NEW from any specific group (API, vslow, dump) if present.
sudo dbctl instance db1184 edit
# If some changes were made:
sudo dbctl config commit -m "Remove db1184 from API/vslow/dump T402870"
  • Topology changes, move all replicas under NEW primary
sudo db-switchover --timeout=25 --only-slave-move db1163 db1184
  • Disable puppet on both nodes
sudo cumin 'db1163* or db1184*' 'disable-puppet "primary switchover T402870"'
  • Merge gerrit puppet change to promote NEW primary: FIXME

Failover:

  • Log the failover:
!log Starting s1 eqiad failover from db1163 to db1184 - T402870
  • Set section read-only:
sudo dbctl --scope eqiad section s1 ro "Maintenance until 12:30 UTC - T402870"
sudo dbctl --scope codfw section s1 ro "Maintenance until 12:30 UTC - T402870"
sudo dbctl config commit -m "Set s1 eqiad as read-only for maintenance - T402870"
  • Check s1 is indeed read-only
  • Switch primaries:
sudo db-switchover --skip-slave-move db1163 db1184
echo "===== db1163 (OLD)"; sudo db-mysql db1163 -e 'show slave status\G'
echo "===== db1184 (NEW)"; sudo db-mysql db1184 -e 'show slave status\G'
  • Promote NEW primary in dbctl, and remove read-only
sudo dbctl --scope eqiad section s1 set-master db1184
sudo dbctl --scope eqiad section s1 rw
sudo dbctl --scope codfw section s1 rw
sudo dbctl config commit -m "Promote db1184 to s1 primary and set section read-write T402870"
  • Clean up heartbeat table(s).
sudo db-mysql db1184 heartbeat -e "delete from heartbeat where file like 'db1163%';"
  • Restart puppet on both hosts:
sudo cumin 'db1163* or db1184*' 'run-puppet-agent -e "primary switchover T402870"'

Clean up tasks:

  • change events for query killer:
curl -sS 'https://gerrit.wikimedia.org/r/plugins/gitiles/operations/software/+/refs/heads/master/dbtools/events_coredb_master.sql?format=TEXT' | base64 -d | sudo db-mysql db1184
curl -sS 'https://gerrit.wikimedia.org/r/plugins/gitiles/operations/software/+/refs/heads/master/dbtools/events_coredb_slave.sql?format=TEXT' | base64 -d | sudo db-mysql db1163
  • Merge DNS change: FIX ME
sudo authdns-update
  • Update candidate primary dbctl and orchestrator notes
sudo dbctl instance db1163 set-candidate-master --section s1 true
sudo dbctl instance db1184 set-candidate-master --section s1 false
sudo cumin 'dborch*' 'orchestrator-client -c untag -i db1184 --tag name=candidate'
sudo cumin 'dborch*' 'orchestrator-client -c tag -i db1163 --tag name=candidate'
sudo db-mysql db1215 zarcillo -e "select * from masters where section = 's1';"
  • (If needed): Depool db1163 for maintenance.
sudo dbctl instance db1163 depool
sudo dbctl config commit -m "Depool db1163 T402870"
  • Change db1163 weight to mimic the previous weight db1184 (main/api/vslow/dumps):
sudo dbctl instance db1163 edit
  • Apply outstanding schema changes to db1163 (if any)
  • Update/resolve this ticket.

Event Timeline

Change #1181799 had a related patch set uploaded (by Gerrit maintenance bot; author: Gerrit maintenance bot):

[operations/puppet@production] mariadb: Promote db1184 to s1 master

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

Change #1181800 had a related patch set uploaded (by Gerrit maintenance bot; author: Gerrit maintenance bot):

[operations/dns@master] wmnet: Update s1-master alias

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

Ladsgroup changed the task status from Open to Stalled.Aug 26 2025, 1:04 AM
Ladsgroup subscribed.

Before doing it. I REALLY need to understand why we had so much fun with s4 (T402871#11117464). The last thing I want to data corruption or long-RO on English Wikipedia.

Ladsgroup changed the task status from Stalled to In Progress.Sep 2 2025, 11:41 AM
Ladsgroup claimed this task.
Ladsgroup updated the task description. (Show Details)

Mentioned in SAL (#wikimedia-operations) [2025-09-02T11:43:40Z] <ladsgroup@cumin1003> DONE (PASS) - Cookbook sre.hosts.downtime (exit_code=0) for 1:00:00 on 32 hosts with reason: Primary switchover s1 T402870

Mentioned in SAL (#wikimedia-operations) [2025-09-02T11:44:09Z] <ladsgroup@cumin1003> dbctl commit (dc=all): 'Set db1184 with weight 0 T402870', diff saved to https://phabricator.wikimedia.org/P82377 and previous config saved to /var/cache/conftool/dbconfig/20250902-114408-ladsgroup.json

Ladsgroup updated the task description. (Show Details)

Change #1181799 merged by Ladsgroup:

[operations/puppet@production] mariadb: Promote db1184 to s1 master

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

Mentioned in SAL (#wikimedia-operations) [2025-09-02T12:15:29Z] <Amir1> Starting s1 eqiad failover from db1163 to db1184 - T402870

Mentioned in SAL (#wikimedia-operations) [2025-09-02T12:15:49Z] <ladsgroup@cumin1003> dbctl commit (dc=all): 'Set s1 eqiad as read-only for maintenance - T402870', diff saved to https://phabricator.wikimedia.org/P82383 and previous config saved to /var/cache/conftool/dbconfig/20250902-121548-ladsgroup.json

Mentioned in SAL (#wikimedia-operations) [2025-09-02T12:18:14Z] <ladsgroup@cumin1003> dbctl commit (dc=all): 'Promote db1184 to s1 primary and set section read-write T402870', diff saved to https://phabricator.wikimedia.org/P82384 and previous config saved to /var/cache/conftool/dbconfig/20250902-121814-ladsgroup.json

Change #1181800 merged by Ladsgroup:

[operations/dns@master] wmnet: Update s1-master alias

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

Mentioned in SAL (#wikimedia-operations) [2025-09-02T12:23:11Z] <ladsgroup@cumin1003> dbctl commit (dc=all): 'Depool db1163 T402870', diff saved to https://phabricator.wikimedia.org/P82385 and previous config saved to /var/cache/conftool/dbconfig/20250902-122310-ladsgroup.json

Ladsgroup removed a project: Patch-For-Review.
Ladsgroup updated the task description. (Show Details)

It also broke the same place the s4 broke. Which was expected given the semi-sync bug. Also the old master refused to die (same as s4).