Page MenuHomePhabricator

Make sre.mysql.clone handling pooling/depooling
Closed, ResolvedPublic

Description

Right now when we use sre.mysql.clone we need to depool the source host.
Ideally we should let sre.mysql.clone to do that, and then once the host is back in sync with the master, slowly repool it back.

If the source isn't pooled originally at the start of the clone, the cookbook should not repool it.

Let's not pool the target host as there could be multiple reasons no to do this right away: eg (new host that was was cloned for the first time, new version testing, etc)

Ensure that host is depooled upon clone, do it if necessary (see this conversation: https://gerrit.wikimedia.org/r/c/operations/cookbooks/+/1071155/comment/d9b49037_6fa7c7e6/)

Event Timeline

ABran-WMF triaged this task as Medium priority.
ABran-WMF moved this task from Triage to Ready on the DBA board.

Change #1080718 had a related patch set uploaded (by Arnaudb; author: Arnaudb):

[operations/cookbooks@master] sre.mysql.upgrade: add depool/pool logic

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

Change #1071155 had a related patch set uploaded (by Arnaudb; author: Arnaudb):

[operations/cookbooks@master] mariadb: clone cookbook maintenance

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

Change #1082469 had a related patch set uploaded (by Arnaudb; author: Arnaudb):

[operations/software/spicerack@master] mysql_legacy: reuse old code pattern to avoid potential issue

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

Change #1082469 abandoned by Arnaudb:

[operations/software/spicerack@master] mysql_legacy: reuse old code pattern to avoid potential issue

Reason:

as discussed, this will be replaced by a comment on the cookbook where it was found, so if it fails it is identifiable.

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

code is implemented, needs to be tested under T374191

Change #1084132 had a related patch set uploaded (by Arnaudb; author: Arnaudb):

[operations/software/spicerack@master] mysql_legacy: fix _list_host_instances

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

Change #1084132 merged by jenkins-bot:

[operations/software/spicerack@master] mysql_legacy: fix list_host_instances

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

I tested the CR at the current version (patchset 26) doing a real update on db1197 and it worked without manual intervention.

https://grafana.wikimedia.org/d/000000273/mysql?orgId=1&var-job=All&var-server=db1197&var-port=9104&from=1741261829208&to=1741267475523

Screenshot 2025-03-06 at 14-29-44 MySQL - SRE Data Persistence Team - Dashboards - Grafana.png (1,255×296 px, 45 KB)

The script is able to depool, optionally, if the host is configured on dbctl and repool.
Repooling can be disabled.
Right now it's designed to upgrade one host at a time and I'd recommend doing rolling updates rather than batches to minimize the number of pooled-out hosts at a time and the impact if the update fails.
In future the cookbook could be updated to support multi-instance hosts.

Right now very little testing is done after the upgrade and this could be improved.

Also, the output of the upgrade in terms of installed packages and versions should be compared across hosts to detect unexpected differences. It would be still far from an atomic process but much bettter than unmanaged.

Change #1080718 abandoned by Arnaudb:

[operations/cookbooks@master] sre.mysql.upgrade: Switch to Host, apt-get and mysql helpers

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

Change #1071155 abandoned by Arnaudb:

[operations/cookbooks@master] mariadb: clone cookbook maintenance

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

Change #1080718 restored by Federico Ceratto:

[operations/cookbooks@master] sre.mysql.upgrade: Switch to Host, apt-get and mysql helpers

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

Change #1080718 abandoned by Federico Ceratto:

[operations/cookbooks@master] sre.mysql.upgrade: Switch to Host, apt-get and mysql helpers

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