Page MenuHomePhabricator

Abstract away different database depooling mechanisms into a cookbook
Closed, ResolvedPublic

Description

Currently, we have different ways to depool a host:

It makes sense to actually let all of these be handled via a cookbook instead. So an SRE oncall simply would run the cookbook instead.

The idea is by @jcrespo

Event Timeline

For further context, as this is a huge scope. I think at a first step only 1 or 2 of those need to be automated. I think it is more important that there is a script that identifies the "category" and provides even just a link to docs than 100% automation.

E.g.:

db-depool masterdb1001.eqiad.wmnet
ABORTED: Depool not done- this is a primary mediawiki server so use this procedure instead: <link to master switchover>

The idea is, as more categories and automations are created, having an easy entry point for non-DBAs.

In a ideal scenario I'd love this to be:
depooling_cookbook $HOST and all the logic and checks are done underneath. So the operator wouldn't need to care whether it is safe to depool a host or not (or a section), if it belongs to MW or misc etc.

Marostegui triaged this task as Medium priority.Jan 14 2025, 2:32 PM
Marostegui moved this task from Triage to Refine on the DBA board.

depooling_cookbook $HOST and all the logic and checks are done underneath. So the operator wouldn't need to care whether it is safe to depool a host or not (or a section), if it belongs to MW or misc etc.

+1

The start of this is the recently added sre.mysql.pool and sre.mysql.depool cookbooks for core DBs that could be expanded to cover the additional use cases.

Btw, I am going to use the same idea for backups, with a single command to $ recover db1001 and abstract the different methods into an easy to use script wrapper (but that is out of scope of this).

FCeratto-WMF changed the task status from Open to In Progress.Mar 12 2025, 5:47 PM
Marostegui moved this task from Refine to Ready on the DBA board.
FCeratto-WMF moved this task from Ready to In progress on the DBA board.

Change #1215575 had a related patch set uploaded (by Federico Ceratto; author: Federico Ceratto):

[operations/cookbooks@master] sre.mysql.pool: [de]pool various section kinds

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

Mentioned in SAL (#wikimedia-operations) [2025-12-22T11:04:48Z] <fceratto@cumin1003> START - Cookbook sre.mysql.newdepool es2051 - test T383674

Mentioned in SAL (#wikimedia-operations) [2025-12-22T11:12:38Z] <fceratto@cumin1003> END (PASS) - Cookbook sre.mysql.newdepool (exit_code=0) es2051 - test T383674

Mentioned in SAL (#wikimedia-operations) [2025-12-22T12:30:31Z] <fceratto@cumin1003> START - Cookbook sre.mysql.newpool es2051 gradually with 4 steps - test T383674

Mentioned in SAL (#wikimedia-operations) [2025-12-22T13:15:59Z] <fceratto@cumin1003> END (PASS) - Cookbook sre.mysql.newpool (exit_code=0) es2051 gradually with 4 steps - test T383674

Change #1215575 merged by Federico Ceratto:

[operations/cookbooks@master] sre.mysql.newpool: [de]pool various section kinds

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

Should we leave this open till we do the final rename?

FCeratto-WMF changed the task status from In Progress to Open.Jan 16 2026, 3:10 PM
FCeratto-WMF moved this task from In progress to Pending comment on the DBA board.

@Marostegui ok - I'll put it back into Open/Pending in the meantime.

Change #1236726 had a related patch set uploaded (by Federico Ceratto; author: Federico Ceratto):

[operations/cookbooks@master] mysql: rename newpool cookbook to pool

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

Change #1236726 merged by Federico Ceratto:

[operations/cookbooks@master] mysql: rename newpool cookbook to pool

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