Bug 1069586

Summary: Remove unnecessary pid guessing and include README for included cnf files
Product: Red Hat Enterprise Linux 7 Reporter: Levente Farkas <lfarkas>
Component: mariadbAssignee: Honza Horak <hhorak>
Status: CLOSED CURRENTRELEASE QA Contact: Branislav Blaškovič <bblaskov>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: bblaskov, databases-maint, hhorak, john, jscotka, lmiksik
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mariadb-5.5.35-3.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 11:59:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Proposed patch
none
Proposed patch
none
spec file for el6
none
updated spec
none
latest spec none

Description Levente Farkas 2014-02-25 10:52:44 UTC
it'd be useful to decided which path to use? ie mysqld or maraidb?

in mariadb-wait-ready script this line :
get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid"
should have to be this:
get_mysql_option mysqld_safe pid-file "/var/run/mariadb/mariadb.pid"
since you create that dir in the spec.

another question that the mariadb.service file should have to add the same pid file as parameter to the mysqld_safe process!

Comment 2 Honza Horak 2014-02-26 09:51:55 UTC
(In reply to Levente Farkas from comment #0)
> it'd be useful to decided which path to use? ie mysqld or maraidb?
> 
> in mariadb-wait-ready script this line :
> get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid"
> should have to be this:
> get_mysql_option mysqld_safe pid-file "/var/run/mariadb/mariadb.pid"
> since you create that dir in the spec.

Right, this is a mistake in that file, but we actually don't need to get pid-file from /etc/my.cnf at all, since we have the daemon pid as the first argument from systemd unit file.

> another question that the mariadb.service file should have to add the same
> pid file as parameter to the mysqld_safe process!

The value pid-file is read by mysqld_safe and passed to mysqld in practice. So this doesn't have to be changed, imho.

Comment 3 Levente Farkas 2014-02-26 10:49:37 UTC
all mistake would be nice to patch sooner or later:-)

at the same time another (imho required) patch would be to patch all /usr/share/mysql/my-*.cnf file and the original /etc/my.cnf too to append this to the end:
-------------------------------
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
-------------------------------
otherwise mysqld_safe pass a wrong argument. this is mentioned in your mariadb-logrotate.patch

anyway this whole mysql - mysqld - mariadb naming mass should have to cleared (probably also the upstream too), but /var/lib/mysql dir and mysql database sharedir, includedir etc... i see the reason of being compatible with mysql but it doesn't seems to be too clear way.

Comment 4 Honza Horak 2014-02-26 11:48:38 UTC
(In reply to Levente Farkas from comment #3)
> at the same time another (imho required) patch would be to patch all
> /usr/share/mysql/my-*.cnf file and the original /etc/my.cnf too to append
> this to the end:
> -------------------------------
> [mysqld_safe]
> log-error=/var/log/mariadb/mariadb.log
> pid-file=/var/run/mariadb/mariadb.pid
> -------------------------------
> otherwise mysqld_safe pass a wrong argument. this is mentioned in your
> mariadb-logrotate.patch

I'd rather add a recommendation of how these files should be correctly used, since it is better not to replace the original my.cnf file, but rather extend it with the configuration from /usr/share/mysql/my-*.cnf files. So, I'd rather add a README file containing:
"""
This directory contains prepared configuration files with .cnf extension,
which provide a configuration for some common MariaDB deployment scenarios.
These configuration files do not include the default configuration of datadir,
log-file and pid-file locations, as specified in the default my.cnf file,
provided in this distribution.

Thus, it is recommended to use these configuration files as an addition to the
default my.cnf configuration file.

Since default my.cnf contains `!includedir /etc/my.cnf.d` directive, it is
recommended to copy required configuration under /etc/my.cnf.d/ directory,
so the default my.cnf specifications will be extended.
"""

Comment 5 Honza Horak 2014-02-26 11:57:42 UTC
The original issue mentioned in comment #0 can lead to an issue, that the server won't be able to start. It can be reproduced by:
1) remove pid-file specification in /etc/my.cnf
2) systemctl start mariadb

Current behaviour:
Server is not started.

Expected behaviour:
Server is started and pid file is in /var/lib/mysql/`hostname`.pid.

Comment 6 Honza Horak 2014-02-26 12:25:11 UTC
Created attachment 867958 [details]
Proposed patch

Proposed patch that adds the README file and removes unnecessary pid guessing

Comment 7 Levente Farkas 2014-02-26 12:53:30 UTC
i don't really like a file to be included/installed twice README.mysql-cnf...

Comment 8 Honza Horak 2014-02-26 14:06:13 UTC
Created attachment 868034 [details]
Proposed patch

(In reply to Levente Farkas from comment #7)
> i don't really like a file to be included/installed twice README.mysql-cnf...

Well, true. The reason for that was that the cnf files have been installed into two locations as well since ages (/usr/share/mysql and /usr/share/doc/mysql-server). So, maybe it would be better to install the .cnf files and README only to /usr/share/mysql as upstream does it.

Comment 12 Levente Farkas 2014-03-05 20:10:24 UTC
Created attachment 871131 [details]
spec file for el6

this is my latest'n'greatest spec for mariadb on rhel6. although it's not for el7 but imho it contains a lot's of bugfix relative to the current one in rhel7 beta.
as rhel7 should have to be able to updated from rhel6 (this's one of the biggest new feature of rhel7 as announced) the maraidb should have to have to be able update rhel6's mysql. of course the systemd <-> upstart differences not relevant to the el7 spec file.

so a few comment:
 * this above is the reason for /var/lib/rpm-state files
 * libmysql version updated to the fedora's one
   * droped libmysql.version, mariadb-versioning.patch, mariadb-dubious-exports.patch
   * added mariadb-versioning-compat.patch
 * a few more new patches
 * pam-devel for auth_pam.so plugin
 * add relevant oboslates
 * add relevant provides
 * mysql_cofig moved from base to devel (as in fedora) and also alternative too
 * path update to 5.5.35
 * run mysql_upgrade since it's required to be able to update from mysql
 * always stop mysql in pre since after mariadb file are installed you're not able to stop or even restart the old mysql serivce
 * add proper chkconfig
 * if mysql was run before update start in posttrans
 * add proper altrenative to the proper scripts section

i hope it will help.

Comment 15 Levente Farkas 2014-03-06 12:50:23 UTC
Created attachment 871417 [details]
updated spec

Comment 17 Levente Farkas 2014-03-06 14:37:51 UTC
Created attachment 871494 [details]
latest spec

Comment 18 Honza Horak 2014-03-06 15:15:45 UTC
(In reply to Levente Farkas from comment #17)
> Created attachment 871494 [details]
> latest spec

Thanks Levente for the proposal, we appreciate that and we're taking that into consideration. However, we won't be able to cover all the issues, like running mysql_upgrade automatically -- we find it too dangerous to do something like that automatically; the configurations can be too different from our expected state. However, users will be instructed to do so on their own.

Comment 20 Levente Farkas 2014-03-06 18:07:57 UTC
in the latest version i also comment it out since if root has password on localhost it's not working.
but most imho the latest spec still has a few fixes to the original ones.

Comment 21 Branislav Blaškovič 2014-03-07 11:27:54 UTC
:: [   LOG    ] :: Package versions:
:: [   LOG    ] ::   mariadb-server-5.5.35-3.el7.x86_64

:: [   LOG    ] :: Doc have to contain README.mysql-cnf
:: [   INFO   ] :: rlRun: command = 'rpm -qld mariadb-server'; exitcode = 0; expected = 0
:: [   PASS   ] :: Running 'rpm -qld mariadb-server' (Expected 0, got 0)
:: [   PASS   ] :: File '/var/tmp/tmp.HfvgoN4CN6' should contain '/usr/share/mysql/README.mysql-cnf' 
:: [   PASS   ] :: Files /root/Tests/mariadb55/Regression/bz1069586-Remove-unnecessary-pid-guessing-and-include-README/README.mysql-cnf and /usr/share/mysql/README.mysql-cnf should not differ 
:: [   LOG    ] :: Duration: 1s
:: [   LOG    ] :: Assertions: 3 good, 0 bad
:: [   PASS   ] :: RESULT: Test


The TC tests the content of file as well now.

Comment 22 Honza Horak 2014-04-08 09:57:37 UTC
*** Bug 1082018 has been marked as a duplicate of this bug. ***

Comment 23 Ludek Smid 2014-06-13 11:59:43 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.