Commit graph

280 commits

Author SHA1 Message Date
Alexander Barkov
0a359d7627 Merge remote-tracking branch 'origin/10.1' into 10.2 2019-09-24 19:19:25 +04:00
Alexander Barkov
5f118b26c8 Merge remote-tracking branch 'origin/5.5' into 10.1 2019-09-24 11:18:39 +04:00
Marko Mäkelä
44c5144943 Merge 10.1 into 10.2 2019-09-23 08:26:08 +03:00
rantal
fd3ad41eed Update mysqld_safe.sh - introduce defaults-group-suffix handling
"--defaults-group-suffix" must be be given as the first argument on the command-line of mysqld
2019-09-21 01:53:40 +03:00
Vicențiu Ciorbaru
6a7d51b1cb MDEV-19211 Fix mysqld_safe --dry-run
mysqld_safe --dry-run needs to either call exit or return, depending if
it is being sourced or not, otherise return can lead to the error:

return: can only `return' from a function or sourced script

The original fix suggestion was proposed by FaramosCZ <mschorm@centrum.cz>
2019-09-21 01:04:07 +03:00
Eugene Kosov
26c389b7b7 Merge 10.1 into 10.2 2019-07-09 13:22:22 +03:00
Sergei Golubchik
bee24fe181 MDEV-19726 MariaDB server or backup RPM install assumes mysql user exists
mysqld_safe shouldn't try to mkdir or chown if --dry-run
2019-07-04 18:19:52 +02:00
Sergei Golubchik
1003c76eb4 fix incorrect shell usage 2019-07-04 18:19:52 +02:00
Vicențiu Ciorbaru
985d2d393c Merge remote-tracking branch 'origin/10.1' into 10.2 2017-12-22 12:23:39 +02:00
Vicențiu Ciorbaru
e3d89652e5 Merge branch '10.0' into 10.1 2017-12-20 13:30:05 +02:00
Vicențiu Ciorbaru
042f763268 Merge remote-tracking branch '5.5' into 10.0 2017-12-20 12:51:57 +02:00
Sergei Golubchik
36f8474403 MDEV-14337 mysqld_safe may suppress error messages with --log-output=file
don't close stdout/stderr, redirect them to /dev/null instead.
otherwise redirections like >&2 fail with "invalid file descriptor"
2017-11-10 12:48:52 +01:00
Monty
6b7918d524 Fixed that --malloc-lib works properly
- Expand paths also for jemalloc
- Test also if tcmalloc or jemalloc is in /usr/lib64
- Take into account that .so has a version
- Remove automatic adding of flavors ( _minial, _debug). Better to
  have user specify these directly
- Changed documentation link to MariaDB
- Don't give extra error if mysqld_safe_helper doesn't exist
2017-11-01 12:21:46 +02:00
Sergei Golubchik
08c493c62a Merge branch '10.1' into 10.2 2017-10-04 18:36:58 +02:00
sachin
bcda03b4fa MDEV-13950 mysqld_safe could not start Galera node after upgrade ...
This is regression caused by patch of mdev-10767.

1st problem :- mktmp is invoked without '-t' or specifing tmp directory.
2nd problem :- Since eval_log_error redirect stderr to stdout  '2>' will
return nothing. and hence $wr_logfile will be empty.

Patch Credit:- Andrii Nikitin
2017-10-02 14:07:22 +05:30
Sergei Golubchik
f1ce69f3a9 Merge branch '10.1' into 10.2
But without f4f48e06215..f8a800bec81 - fixes for MDEV-12672
and related issues. 10.2 specific fix follows...
2017-09-22 02:27:00 +02:00
sachin
bb7a70c955 MDEV-10767 /tmp/wsrep_recovery.${RANDOM} file created in unallowed SELinux context
Problem:- To create file in /tmp dir mysqld require permission initrc_tmp_t.
And mysqld does not have his permission.

Solution:- Instead of giving mysqld permission of initrc_tmp_t , we redirected
log to file in /tmp dir through shell. I also removed a earlier workarround
in mysqld_safe.sh , which create tmp log file in datadir.
2017-09-21 12:37:40 +05:30
Sergei Golubchik
e74f2e2b86 Merge branch '10.0' 10.1 2017-04-28 20:19:32 +02:00
Sergei Golubchik
8d75a7533e Merge branch '5.5' into 10.0 2017-04-21 18:34:06 +02:00
Sergei Golubchik
663068c6ee Merge remote-tracking branch 'mysql/5.5' into 5.5 2017-04-11 10:18:04 -04:00
Terje Rosten
b7f33d22d8 Bug#25144379 MYSQLD PROCESS DOES NOT INCLUDE FULL PATH WHEN STARTING MYSQL SERVER
Fix of Bug#25088048 caused paths to be relative, not absolute, this
proved to be problematic.

Fix is to still ignore current working directory, however switch to
using full path of basedir, which is set to parent directory of bin/
directory where mysqld_safe is located.

References to legacy tool mysql_print_defaults are removed, only
my_print_defaults is used these days.

This will also fix:
  Bug#11745176 (11192) MYSQLD_SAFE ONLY EVALUATES --DEFAULTS-FILE OPTION WHEN IT IS THE FIRST OP
  Bug#23013510 (80866) MYSQLD_SAFE SHOULD NOT SEARCH $MY_BASEDIR_VERSION/VAR AS DATADIR
  Bug#25244898 (84173) MYSQLD_SAFE --NO-DEFAULTS & SILENTLY DOES NOT WORK ANY MORE
  Bug#25261472 (84219) INITSCRIPT ERRORS WHEN LAUCHING MYSQLD_SAFE IN NON DEFAULT BASEDIR
  Bug#25319392 (84263) MYSQL.SERVER (MYSQL SERVER STARTUP SCRIPT) CAN NOT WORK,AND EXPORT SOME ERROR.
  Bug#25319457         MYSQLD_SAFE MIGHT FAIL IF $DATADIR HAS TRAILING /
  Bug#25341981         MYSQLD_SAFE ASSUMES INCORRECT BASEDIR WHEN EXECUTED WITH ABSOLUTE PATH
  Bug#25356221 (84427) MYSQLD_SAFE FAILS TO START WHEN USING A FIFO FOR LOG-ERROR (REGRESSION)
  Bug#25365194 (84447) MYSQLD_SAFE DOESN'T CHECK EXISTENCE OF GIVEN BASEDIR PARAMETER
  Bug#25377815         ERRORS WHILE STARTING MYSQLD_SAFE WITH SYM LINK ENABLED
2017-02-13 14:56:28 +01:00
Sergei Golubchik
2195bb4e41 Merge branch '10.1' into 10.2 2017-02-10 17:01:45 +01:00
Vicențiu Ciorbaru
1e192e901c Post merge review fixes
* Remove duplicate lines from tests
* Use thd instead of current_thd
* Remove extra wsrep_binlog_format_names
* Correctly merge union patch from 5.5 wrt duplicate rows.
* Correctly merge SELinux changes into 10.1
2017-01-17 04:16:38 +02:00
Vicențiu Ciorbaru
5ac71d4464 Merge remote-tracking branch '10.0-galera' into 10.1 2017-01-16 04:53:57 +02:00
Vicențiu Ciorbaru
8e15768731 Merge branch '10.0' into 10.1 2017-01-16 03:18:14 +02:00
Nirbhay Choubey
ee8b5c305a Merge tag 'mariadb-10.0.29' into 10.0-galera 2017-01-13 13:53:59 -05:00
Vicențiu Ciorbaru
1c5ca7c183 Merge branch '5.5' into 10.0 2017-01-12 03:37:13 +02:00
Sergei Golubchik
6ad3dd6054 mysqld_safe: don't close stdout if set -x 2017-01-10 14:19:11 +01:00
Vicențiu Ciorbaru
ecdb39a9f5 Fix problems from 5.5 merge
* Update mysqld_safe script to remove duplicated parameter --crash-script
* Make --core-file-size accept underscores as well as dashes correctly.
* Add mysqld_safe_helper to Debian and Ubuntu files.
* Update innodb minor version to 35
2017-01-10 12:33:08 +02:00
vicentiu
e9aed131ea Merge remote-tracking branch 'origin/5.5' into 10.0 2017-01-06 17:09:59 +02:00
Sergei Golubchik
4a5d25c338 Merge branch '10.1' into 10.2 2016-12-29 13:23:18 +01:00
Sergei Golubchik
8fcdd6b0ec Numerous issues in mysqld_safe 2016-12-22 12:25:10 +01:00
Shishir Jaiswal
e00810b934 Bug#11751149 - TRYING TO START MYSQL WHILE ANOTHER INSTANCE
IS STARTING: CONFUSING ERROR

DESCRIPTION
===========
When mysql server processes transactions but has not yet
committed and shuts down abnormally (due to crash, external
killing etc.), a recovery is due from Storage engine side
which takes place the next time mysql server (either
through mysqld or mysqld_safe) is run.

While the 1st server is in mid of recovery, if another
instance of mysqld_safe is made to run, it may result into
2nd instance killing the 1st one after a moment.

ANALYSIS
========
In the "while true" loop, we've a check (which is done
after the server stops) for the existence of pid file to
enquire if it was a normal shutdown or not. If the file is
absent, it means that the graceful exit of server had
removed this file.

However if the file is present, the scripts makes a plain
assumption that this file is leftover of the "current"
server. It misses to consider that it could be a valid pid
file belonging to another running mysql server.

We need to add more checks in the latter case. The script
should extract the PID from this existing file and check if
its running or not. If yes, it means an older instance of
mysql server is running and hence the script should abort.

FIX
===
Checking the status of process (alive or not) by adding a
@CHECK_PID@ in such a case. Aborting if its alive. Detailed
logic is as follows:

- The mysqld_safe script would quit at start only as soon
as it finds that there is an active PID i.e. a mysql server
is already running.
- The PID file creation takes place after InnoDb recovery,
which means in rare case (when PID file isn't created yet)
it may happen that more than 1 server can come up but even
in that case others will have to wait till the 1st server
has released the acquired InnoDb lock. In this case all
these servers will either TIMEOUT waiting for InnoDb lock
or after this they would find that the 1st server is
already running (by reading $pid_file) and would abort.
- Our core fix is that we now check the status of mysql
server process (alive or not) after the server stops
running within the loop of "run -> shutdown/kill/abort ->
run ... ", so that only the script who owns the mysql
server would be able to bring it down if required.

NOTE
====
Removed the deletion of pid file and socket file from entry
of the loop, as it may result in 2nd instance deleting
these files created by 1st instance in RACE condition.
Compensated this by deleting these files at end of the loop

Reverted the changes made in patch to Bug#16776528. So
after this patch is pushed, the concept of mysqld_safe.pid
would go altogether. This was required as the script was
deleting other instance's mysqld_safe.pid allowing multiple
mysqld_safe instances to run in parallel. This patch would
fix Bug#16776528 as well as the resources would be guarded
anyway by InnoDb lock + our planned 5.7 patch.
2016-12-22 14:56:02 +05:30
Sergei Golubchik
5142cd55f4 MDEV-11052 mariadb-service-convert does not work after upgrading to 10.1.18
mysqld_safe: don't close stdout and stderr if --dry-run
2016-12-06 09:45:50 +01:00
Terje Rosten
cdd57aa719 Bug#25088048 ADDITIONAL ISSUES IN MYSQLD_SAFE
Don't read --ledir option from config file.
Ignore current working for finding location of mysqld
Remove use of chown/chmod in scripts.
Be helpful only when basedir is /var/log or /var/lib.
Removed unused systemd files for SLES.
Set explicit basedir in scripts.
2016-11-16 14:01:12 +01:00
Nirbhay Choubey
5db2195a35 Merge tag 'mariadb-10.0.28' into 10.0-galera 2016-10-28 15:50:13 -04:00
Terje Rosten
1f93f4381b Bug#24483092 UNSAFE USE OF VARIOUS SHELL UTILITIES
- Remove use of touch and chmod.
 - Restrict usage of chown to cases where target directory is /var/log.
 - Due to limited feature set in /bin/sh on Solaris, /bin/bash will be
   used on this platform.
 - Give error if directory for UNIX socket file is missing.
 - Privileged user should not log to files owned by different user
   (mysqld will log as before).
2016-10-06 13:26:16 +02:00
Sergei Golubchik
2ede40e67e Merge branch '10.0' into 10.1 2016-09-29 12:59:51 +02:00
Sergei Golubchik
a3f11f7549 Merge branch '5.5' into 10.0 2016-09-29 12:31:46 +02:00
Sergei Golubchik
7497ebf8a4 mysqld_safe: close stdout and stderr
when they're not needed anymore. Helps when
daemonizing it from mysql.init
2016-09-29 10:16:24 +02:00
Sergei Golubchik
fb8bc59f01 mysqld_safe: don't use "$DATADIR/my.cnf"
finally removed, after being deprecated since 2005
2016-09-19 20:13:49 +02:00
Terje Rosten
7603ac53c8 Bug#24464380 PRIVILEGE ESCALATION USING MYSQLD_SAFE
Post push fix: Solaris 10 /bin/sh don't understand $().
2016-08-26 11:25:40 +02:00
Terje Rosten
8b1f4d84ca Bug#24464380 PRIVILEGE ESCALATION USING MYSQLD_SAFE
Argument to malloc-lib must be included in restricted list of
directories, symlink guards added, and mysqld and mysqld-version
options restricted to command line only. Don't redirect errors to
stderr.
2016-08-18 12:19:15 +02:00
Nirbhay Choubey
7ef5257a64 MDEV-10230: --wsrep_on option no longer passed through by mysqld_safe
Append mysqld_safe's wsrep-on option to the list of options
used to start mysqld.
[Patch contributed by Hartmut]
2016-06-27 18:22:35 -04:00
Sergey Vojtovich
6346d1de2f MDEV-427/MDEV-5713 Add systemd script with notify functionality
After review/QA fixes.
2015-10-12 17:51:49 +02:00
Daniel Black
20c2ae39db MDEV-427/MDEV-5713 Add systemd script with notify functionality 2015-10-12 17:51:49 +02:00
Sergei Golubchik
530a6e7481 Merge branch '10.0' into 10.1
referenced_by_foreign_key2(), needed for InnoDB to compile,
was taken from 10.0-galera
2015-09-03 12:58:41 +02:00
Nirbhay Choubey
91acc8b16f Merge tag 'mariadb-10.0.21' into 10.0-galera 2015-08-08 14:21:22 -04:00
Sergey Vojtovich
94bc50650e MDEV-8374 - Debian: mysqld_safe Can't log to error log and syslog at the same time
Let mysqld_safe_syslog.cnf force disable error log so that logging to syslog is
not affected by previous log_error setting.

Added handling of --skip-log-error to mysqld_safe.
2015-07-16 14:03:29 +04:00
Sergei Golubchik
5091a4ba75 Merge tag 'mariadb-10.0.19' into 10.1 2015-06-01 15:51:25 +02:00