Bug 1689300

Summary: mysqld_safe --dry-run doesn't work as expected
Product: Red Hat Enterprise Linux 8 Reporter: Karel Volný <kvolny>
Component: mariadbAssignee: Michal Schorm <mschorm>
Status: CLOSED CURRENTRELEASE QA Contact: Lukáš Zachar <lzachar>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0CC: databases-maint
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1691288 1691290 1691294 (view as bug list) Environment:
Last Closed: 2021-01-15 15:58:12 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:
Bug Depends On:    
Bug Blocks: 1856699    

Description Karel Volný 2019-03-15 15:56:07 UTC
Description of problem:
mysqld_safe --dry-run doesn't work as expected

Version-Release number of selected component (if applicable):
mariadb-server-10.3.11-1.module+el8+2765+cfa4f87b

How reproducible:
always

Steps to Reproduce:
1. dnf install -y mariadb-server
2. systemctl start mariadb
3. systemctl stop mariadb
4. mysqld_safe --dry-run

Actual results:
[root@host-8-250-109 ~]# mysqld_safe --dry-run
/usr/bin/mysqld_safe: line 932: return: can only `return' from a function or sourced script
^C^C^C^C^C^Z
[1]+  Stopped                 mysqld_safe --dry-run
[root@host-8-250-109 ~]# ps -ef | grep mysql
root      7196  6107  0 11:52 pts/0    00:00:00 /bin/sh /usr/bin/mysqld_safe --dry-run
mysql     7280  7196  0 11:52 pts/0    00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mariadb/plugin --user=mysql --log-error=/var/log/mariadb/mariadb.log --pid-file=/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock


Expected results:
it returns to shell without mysqld running

Additional info:
# mysqld_safe --help | grep dry
  --dry-run                  Simulate the start to detect errors but don't start

Comment 2 Michal Schorm 2019-07-18 23:42:05 UTC
CURRENT STATUS:
* As the intention of this script argument was different than we thought, we shouldn't deploy a fix for it in RHEL8.

Comment 3 Michal Schorm 2020-04-14 13:58:34 UTC
The "--dry-run" has been fixed by upstream.
It ends with exit code 1 now and does NOT start the server.

IMHO it is now fixed sufficiently (because the main issue was that it started the server despite expicitly described as an option that does NOT start the server).

The --dry-run isn't expected to be used either by us or by the end-users.
https://github.com/MariaDB/server/pull/1238#issuecomment-475494807
> The original purpose of --dry-run was https://github.com/MariaDB/server/blob/10.4/scripts/mariadb-service-convert as a script to take [mysqld_safe] params and create a systemd service file override.

Comment 5 Michal Schorm 2020-07-14 09:16:52 UTC
MAINTAINER NOTE:

I reached upstream with this issue.
The script was never meant to be called by an user, instead, that particual part of script was intended to be ran by other scripts.

The upstream solved the issue in:
  MariaDB 10.1.42
  MariaDB 10.2.28
  MariaDB 10.3.19
with:
  https://github.com/MariaDB/server/commit/6a7d51b1cb