Page MenuHomePhabricator

Adapt wmf-mariadb101 package for stretch and adapt its service to systemd
Closed, ResolvedPublic

Description

Basically, fully embrace systemd for mariadb instead of using its backwards compatibility layer.

Event Timeline

jcrespo claimed this task.
jcrespo raised the priority of this task from to Needs Triage.
jcrespo updated the task description. (Show Details)
jcrespo added projects: DBA, SRE.
jcrespo subscribed.
jcrespo set Security to None.
jcrespo changed the task status from Open to Stalled.Nov 17 2015, 9:13 AM

I am going to stall it, because official packages do not do it.

jcrespo changed the task status from Stalled to Open.Feb 14 2017, 3:58 PM
jcrespo removed jcrespo as the assignee of this task.
jcrespo added a subscriber: MoritzMuehlenhoff.

This is now possible for 10.1, and I have packages for stretch that do that. We have to decide if to maintain the systemd unit on puppet or on the package.

My two cents: From a high level view I personally prefer the systemd unit to be in the Debian package since it's part of the general package logic. For packages where we anticipate many changes to the unit it sometimes makes sense to manage it rather via puppet, but (after some initial experimentation) I'd expect the systemd unit for wmf-mariadb10 to be fairly static. If add the unit to the package this would also simplify a step-wise migration from sysvinit to systemd by upgrading the package (since the migration requires a restart of mysqld anyway).

we will repurpose this for stretch, we'll keep probably 10.0 on jesssie using inet.d.

jcrespo renamed this task from Adapt wmf-mariadb10 package for jessie or puppetize differently its service to adapt it to systemd to Adapt wmf-mariadb101 package for stretch and adapt its service to systemd.May 15 2017, 4:46 PM
jcrespo raised the priority of this task from Low to Medium.
jcrespo moved this task from Backlog to In progress on the DBA board.

we got some progress:

1# dpkg -i wmf-mariadb101_10.1.23-1_amd64.deb
2Selecting previously unselected package wmf-mariadb101.
3(Reading database ... 214374 files and directories currently installed.)
4Preparing to unpack wmf-mariadb101_10.1.23-1_amd64.deb ...
5Unpacking wmf-mariadb101 (10.1.23-1) ...
6Setting up wmf-mariadb101 (10.1.23-1) ...
7update-alternatives: using /opt/wmf-mariadb101/bin/mysql to provide /usr/local/bin/mariadb (mariadb) in auto mode
8update-alternatives: using /opt/wmf-mariadb101/bin/mysqldump to provide /usr/local/bin/mariadbdump (mariadbdump) in auto mode
9update-alternatives: using /opt/wmf-mariadb101/bin/mysql to provide /usr/local/bin/mysql (mysql) in auto mode
10update-alternatives: using /opt/wmf-mariadb101/bin/mysqldump to provide /usr/local/bin/mysqldump (mysqldump) in auto mode
11update-alternatives: using /opt/wmf-mariadb101/bin/mysqlbinlog to provide /usr/local/bin/mysqlbinlog (mysqlbinlog) in auto mode
12update-alternatives: using /opt/wmf-mariadb101/bin/mysql_upgrade to provide /usr/local/bin/mysql_upgrade (mysql_upgrade) in auto mode
13update-alternatives: using /opt/wmf-mariadb101/bin/mysqlcheck to provide /usr/local/bin/mysqlcheck (mysqlcheck) in auto mode
14
15# systemctl status mariadb
16● mariadb.service - MariaDB database server
17 Loaded: loaded (/etc/systemd/system/mariadb.service; disabled; vendor preset: enabled)
18 Active: inactive (dead)
19
20# systemctl status mariadb.service
21● mariadb.service - MariaDB database server
22 Loaded: loaded (/etc/systemd/system/mariadb.service; disabled; vendor preset: enabled)
23 Active: inactive (dead)
24
25# apt remove wmf-mariadb101
26Reading package lists... Done
27Building dependency tree
28Reading state information... Done
29The following package was automatically installed and is no longer required:
30 libssl-doc
31Use 'apt autoremove' to remove it.
32The following packages will be REMOVED:
33 wmf-mariadb101
340 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
35After this operation, 0 B of additional disk space will be used.
36Do you want to continue? [Y/n] Y
37(Reading database ... 215121 files and directories currently installed.)
38Removing wmf-mariadb101 (10.1.23-1) ...
39update-alternatives: warning: alternative /opt/wmf-mariadb101/bin/mysql (part of link group mariadb) doesn't exist; removing from list of alternatives
40update-alternatives: warning: /etc/alternatives/mariadb is dangling; it will be updated with best choice
41update-alternatives: warning: alternative /opt/wmf-mariadb101/bin/mysqldump (part of link group mariadbdump) doesn't exist; removing from list of alternatives
42update-alternatives: warning: /etc/alternatives/mariadbdump is dangling; it will be updated with best choice
43update-alternatives: warning: alternative /opt/wmf-mariadb101/bin/mysql (part of link group mysql) doesn't exist; removing from list of alternatives
44update-alternatives: warning: /etc/alternatives/mysql is dangling; it will be updated with best choice
45update-alternatives: warning: alternative /opt/wmf-mariadb101/bin/mysqldump (part of link group mysqldump) doesn't exist; removing from list of alternatives
46update-alternatives: warning: /etc/alternatives/mysqldump is dangling; it will be updated with best choice
47update-alternatives: warning: alternative /opt/wmf-mariadb101/bin/mysqlbinlog (part of link group mysqlbinlog) doesn't exist; removing from list of alternatives
48update-alternatives: warning: /etc/alternatives/mysqlbinlog is dangling; it will be updated with best choice
49update-alternatives: warning: alternative /opt/wmf-mariadb101/bin/mysql_upgrade (part of link group mysql_upgrade) doesn't exist; removing from list of alternatives
50update-alternatives: warning: /etc/alternatives/mysql_upgrade is dangling; it will be updated with best choice
51update-alternatives: warning: alternative /opt/wmf-mariadb101/bin/mysqlcheck (part of link group mysqlcheck) doesn't exist; removing from list of alternatives
52update-alternatives: warning: /etc/alternatives/mysqlcheck is dangling; it will be updated with best choice
53
54# systemctl status mariadb
55Unit mariadb.service could not be found.

Some more progress, after removing galera stuff: P5501#29701

I have installed wmf-mariadb101_10.1.23-1_amd64.deb on a fresh stretch to play around with it - will get back to you if I see issues!

I have to package 10.1.24 and fix some things- coming soon.

Change 357626 had a related patch set uploaded (by Jcrespo; owner: Jcrespo):
[operations/software@master] mariadb: Improve systemd and package management

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

Change 360845 had a related patch set uploaded (by Jcrespo; owner: Jcrespo):
[operations/puppet@production] mariadb: Initial stretch support for wmf package with systemd

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

Change 360845 merged by Jcrespo:
[operations/puppet@production] mariadb: Initial stretch support for wmf package with systemd

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

The currrent package works ok, but there are 2 little details, which I am not 100% sure if to solve as config defaults or as package defaults. 2 options need to change with the new package:

socket     = /var/run/mysqld/mysql.sock
basedir    = /opt/wmf-mariadb101

The first one, because we no longer allow to use /tmp for that. The second because without mysqld_safe, it defaults to look for them on /usr/local. There are some merits on doing it on package, to have working default, but I think they should be on config to allow clearly multi-instance in the future and avoid uninteded bad defaults.

For that, we need basically T148507.

+1 to place it on config rather than in package.
I would prefer to be able to configure it thru puppet instead of hardcoding it in the package. As you already mentioned, the nearest future use case is mult-instance config.

Change 357626 merged by Jcrespo:
[operations/software@master] mariadb: Improve systemd and package management

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

I am going to resolve this because technically, the package and systemd are correct- the things missing are the socket and the basedir which we have decided are configuration; but the package can work as it is now as a bare minimum. That doesn't mean we are happy with it, it is just ok to move on and keep improving.

jcrespo removed a subtask: Restricted Task.Jun 22 2017, 7:21 PM

Change 371450 had a related patch set uploaded (by Jcrespo; owner: Jcrespo):
[operations/puppet@production] mariadb: Remove package hacks for MariaDB 10.1 on jessie

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

Change 371450 merged by Jcrespo:
[operations/puppet@production] mariadb: Remove package hacks for MariaDB 10.1 on jessie

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