PMM2 apt installation turns of slow query log

I upgraded the PMM clients on several Debian servers (9.11 and 9.12) running MySQL 5.6 and 5.7 from PMM1 to PMM2, using the Percona repository. Basically “apt update; apt install pmm2-client”.
I noticed on every one of those servers that the MySQL slow query log became disabled after running “apt install pmm2-client”.
Is that a bug or a feature I don’t understand?

Are you sure it is PMM2 installation NOT PMM1 Removal which disabled Slow Query Log ? 

Can’t tell, since “apt install pmm2-client” does both in one step.
But either way, I had slow query log enabled even before installing the pmm1 clients, so it think it’s not good to disable it when uninstalling. Luckily I have a custom dashboard that shows me all those flags, so I noticed right away.If it is an expected behavior, maybe you should add a hint to the docs or the blog posts about the upgrading process.

Hi  @steffen
I do not see the described case in my test, tested on Debian 9 and ubuntu18 with mysql 5.7 version with slow+log enabled. upgrading from pmm1 to pmm 2 client using apt install not affecting slow_log settings in mysql. 

# cat /etc/debian_version 9.6mysql 5.7.30mysql> show variables like ‘%slow%’;±--------------------------±----------------------------------------+| Variable_name             | Value                                   |±--------------------------±----------------------------------------+| log_slow_admin_statements | OFF                                     || log_slow_slave_statements | OFF                                     || slow_launch_time          | 2                                       || slow_query_log            | ON                                      || slow_query_log_file       | /var/lib/mysql/ip-172-30-3-190-slow.log |±--------------------------±----------------------------------------+5 rows in set (0.00 sec)
mysql> exitBye# apt install pmm2-clientReading package lists… DoneBuilding dependency tree       Reading state information… DoneThe following packages were automatically installed and are no longer required:  galera-3 libcgi-fast-perl libcgi-pm-perl libconfig-inifiles-perl libdbd-mysql-perl libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl  libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl libjemalloc1 liblwp-mediatypes-perl libmariadbclient18  libreadline5 libterm-readkey-perl libtimedate-perl liburi-perl lsof mariadb-common rsync socatUse ‘apt autoremove’ to remove them.The following packages will be REMOVED:  pmm-clientThe following NEW packages will be installed:  pmm2-client0 upgraded, 1 newly installed, 1 to remove and 87 not upgraded.Need to get 0 B/61.8 MB of archives.After this operation, 94.8 MB of additional disk space will be used.Do you want to continue? [Y/n] y(Reading database … 36685 files and directories currently installed.)Removing pmm-client (1.17.3-1.stretch) …OK, no services found.Uninstall complete.Selecting previously unselected package pmm2-client.(Reading database … 36664 files and directories currently installed.)Preparing to unpack …/pmm2-client_2.7.0-6.stretch_amd64.deb …Unpacking pmm2-client (2.7.0-6.stretch) …Setting up pmm2-client (2.7.0-6.stretch) …root@ip-172-30-3-190:~# mysql -u root -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 4Server version: 5.7.30 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql> show variables like ‘%slow%’;±--------------------------±----------------------------------------+| Variable_name             | Value                                   |±--------------------------±----------------------------------------+| log_slow_admin_statements | OFF                                     || log_slow_slave_statements | OFF                                     || slow_launch_time          | 2                                       || slow_query_log            | ON                                      || slow_query_log_file       | /var/lib/mysql/ip-172-30-3-190-slow.log |±--------------------------±----------------------------------------+5 rows in set (0.00 sec)

Hi Lalit,

here are the log excerpts from my upgrade (Debian 9.11, MySQL 5.6.46):

apt update
apt install percona-release
# Unpacking percona-release (1.0-19.generic) over (1.0-13.generic) …
apt update
apt list --upgradable
# pmm-client/unknown 1.17.3-1.stretch amd64 [upgradable from: 1.17.2-1.stretch]

pmm-admin annotate “db01 replacing PMM client 1.17.2 with 2.6.1”
apt install pmm2-client
# The following packages will be REMOVED:
#   pmm-client
# The following NEW packages will be installed:
#   pmm2-client

# Get:1 Percona Repo stretch/main amd64 pmm2-client amd64 2.7.0-6.stretch [61.8 MB]
# Fetched 61.8 MB in 13s (4,677 kB/s)
# Removing pmm-client (1.17.2-1.stretch) …
# OK, 3 services were removed.
# Uninstall complete.
# Selecting previously unselected package pmm2-client.
# Preparing to unpack …/pmm2-client_2.7.0-6.stretch_amd64.deb …
# Warning: The home dir /usr/local/percona you specified already exists.
# Adding system user pmm-agent' (UID 114) ...<br># Adding new group pmm-agent’ (GID 119) …
# Adding new user pmm-agent' (UID 114) with group pmm-agent’ …
# The home directory /usr/local/percona' already exists.&nbsp; Not copying from /etc/skel’.
# adduser: Warning: The home directory `/usr/local/percona’ does not belong to the user you are currently creating.
# Setting up pmm2-client (2.7.0-6.stretch) …
# Created symlink /etc/systemd/system/ ? /lib/systemd/system/pmm-agent.service.

After that I checked and found slow_query_log was set to 0, and it definitely was 1 before.
I checked the Prometheus graphs: The 0 was also set on our servers running 5.7, so it’s not an issue of 5.6.
But if it’s not a common problem, then it’s probably not worth the effort to try and figure out what exactly in our configuration caused it.

Hi Steffen,
It’s very unlikely that pmm-client installation/Removal will impact mysql setting because, in order to change mysql setting dynamically without restart mysqld server, it must access mysql and do the changes.  I will see if can do some more tests.

Hi Steffen,
I am able to reproduce it and reported this as a bug. The issue only with pmm-client (PMM1)