Bug #98565 The big size of the package mysql-community-server
Submitted: 12 Feb 2020 10:58 Modified: 13 Feb 2020 11:55
Reporter: Viktor Vakhonin Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Packaging Severity:S3 (Non-critical)
Version: OS:CentOS
Assigned to: MySQL Verification Team CPU Architecture:x86

[12 Feb 2020 10:58] Viktor Vakhonin
Description:
Hello!

I have installed a fresh version MySQL 8 on the server.

Some details of environment:

[root@seb7bfcd3 ~]# cat /etc/issue
\S
Kernel \r on an \m

[root@seb7bfcd3 ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

[root@seb7bfcd3 ~]#

[root@seb7bfcd3 ~]# yum repolist
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: mirror.vpsnet.com
 * elrepo: mirror.koddos.net
 * epel: mirror.nsc.liu.se
 * extras: mirror.vpsnet.com
 * updates: mirror.vpsnet.com
repo id                                                                                                            repo name                                                                                                                                              status
base/7/x86_64                                                                                                      CentOS-7 - Base                                                                                                                                        10097
elrepo/7                                                                                                           ELRepo.org Community Enterprise Linux Repository - el7                                                                                                   143
epel/x86_64                                                                                                        Extra Packages for Enterprise Linux 7 - x86_64                                                                                                         13524
extras/7/x86_64                                                                                                    CentOS-7 - Extras                                                                                                                                        323
fastpanel-unstable                                                                                                 FASTPANEL                                                                                                                                                 23
mysql80-community                                                                                                  MySQL 8.0 Community Server                                                                                                                               161
nginx                                                                                                              nginx repo                                                                                                                                               172
updates/7/x86_64                                                                                                   CentOS-7 - Updates                                                                                                                                      1446
repolist: 25889

[root@seb7bfcd3 ~]# yum info mysql-community-server
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
 * base: mirror.vpsnet.com
 * elrepo: mirror.koddos.net
 * epel: mirror.nsc.liu.se
 * extras: mirror.vpsnet.com
 * updates: mirror.vpsnet.com
Installed Packages
Name        : mysql-community-server
Arch        : x86_64
Version     : 8.0.19
Release     : 1.el7
Size        : 1.9 G
Repo        : installed
From repo   : mysql80-community
Summary     : A very fast and reliable SQL database server
URL         : http://www.mysql.com/
License     : Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Under GPLv2 license as shown in the Description field.
Description : The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,
            : and robust SQL (Structured Query Language) database server. MySQL Server
            : is intended for mission-critical, heavy-load production systems as well
            : as for embedding into mass-deployed software. MySQL is a trademark of
            : Oracle and/or its affiliates
            :
            : The MySQL software has Dual Licensing, which means you can use the MySQL
            : software free of charge under the GNU General Public License
            : (http://www.gnu.org/licenses/). You can also purchase commercial MySQL
            : licenses from Oracle and/or its affiliates if you do not wish to be bound by the terms of
            : the GPL. See the chapter "Licensing and Support" in the manual for
            : further info.
            :
            : The MySQL web site (http://www.mysql.com/) provides the latest news and
            : information about the MySQL software.  Also please see the documentation
            : and the manual for more information.
            :
            : This package includes the MySQL server binary as well as related utilities
            : to run and administer a MySQL server.

Please look on the size of package.

The following files occupied most of the disk space:

[root@seb7bfcd3 ~]# du -sh /usr/sbin/mysqld*
822M	/usr/sbin/mysqld
682M	/usr/sbin/mysqld-debug

Why you don't use strip for binary files when you build packages?

[root@seb7bfcd3 ~]# strip  /usr/sbin/mysqld
[root@seb7bfcd3 ~]# du -sh /usr/sbin/mysqld*
56M	/usr/sbin/mysqld
682M	/usr/sbin/mysqld-debug

How to repeat:
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql
cat << EOF > /etc/yum.repos.d/mysql.repo
[mysql80-community]
name=MySQL 8.0 Community Server
baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/x86_64/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
EOF
yum install -y mysql-community-server

Suggested fix:
Using strip when rpm builds
[13 Feb 2020 0:03] MySQL Verification Team
Hi,

Thank you for your report but we do not strip binaries intentionally.

You are, of course, free to strip them.

The rationale behind not stripping them is that benefit (having debug info) outweighs the disadvantage (larger size) in the time where disk capacity is cheap.

kind regards
[13 Feb 2020 8:25] Viktor Vakhonin
Why in Debian the binary stripped?

root@seb7bfcd3:~# apt-cache policy mysql-community-server
mysql-community-server:
  Installed: 8.0.19-1debian9
  Candidate: 8.0.19-1debian9
  Version table:
 *** 8.0.19-1debian9 500
        500 http://repo.mysql.com/apt/debian stretch/mysql-8.0 amd64 Packages
        100 /var/lib/dpkg/status
root@seb7bfcd3:~# du -sh /usr/bin/mysql
7.2M	/usr/bin/mysql
root@seb7bfcd3:~#

What difference?
[13 Feb 2020 8:31] Viktor Vakhonin
Ssory, not right file:
root@seb7bfcd3:~# du -sh /usr/sbin/mysqld*
60M	/usr/sbin/mysqld
[13 Feb 2020 11:40] MySQL Verification Team
Hi Viktor,

Different distributions have different rules. Debian changed its policy from "can be stripped" to "should be stripped" IIRC one year ago (maybe earlier). There is no such policy for Oracle Linux packages you are using on CentOS. Also if you look at tar.gz / tar.xz they are also not stripped. We prefer to ship unstripped as you can always strip yourself and disk space is cheap, but this can change as it changed once already as back in the day we used to ship stripped binaries.

kind regards
[13 Feb 2020 11:55] Viktor Vakhonin
Unfortunately I am from wild country where disk space is not cheap. What about little VMs with disk size 5G or 10G? Are Administrators should run strip on the binary files after every update?
[13 Feb 2020 12:05] MySQL Verification Team
Hi Viktor,

I'm not the one making policies. As for the best practices on small installations, the best practice I noticed during my many years in the field is that companies usually have their own repo from where they update the system (create updates, strip/patch/recompile/whatever required, test on stage, move from stage to production repo, upgrade production) but everyone has their own idea of what's best practice. 

I already passed your "feature request" to our build team to reconsider the policy but I cannot classify this as a bug.

kind regards
Bogdan