1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge branch '10.4' into 10.5

This commit is contained in:
Oleksandr Byelkin
2022-02-01 20:33:04 +01:00
460 changed files with 9909 additions and 2408 deletions

View File

@@ -174,6 +174,7 @@ ENDIF()
SET(HOSTNAME "uname -n")
SET(MYSQLD_USER "mysql")
SET(MYSQLD_GROUP "mysql")
ENDIF(UNIX)
# Really ugly, one script, "mysql_install_db", needs prefix set to ".",

View File

@@ -31,6 +31,7 @@ defaults=""
defaults_group_suffix=""
mysqld_opt=""
user=""
group=""
silent_startup="--silent-startup"
force=0
@@ -95,6 +96,11 @@ Usage: $0 [OPTIONS]
user. You must be root to use this option. By default
mysqld runs using your current login name and files and
directories that it creates will be owned by you.
--group=group_name The login group to use for running mysqld. Files and
directories created by mysqld will be owned by this
group. You must be root to use this option. By default
mysqld runs using your current group and files and
directories that it creates will be owned by you.
All other options are passed to the mysqld program
@@ -144,11 +150,11 @@ parse_arguments()
--ldata=*|--datadir=*|--data=*) ldata=`parse_arg "$arg"` ;;
--log-error=*)
log_error=`parse_arg "$arg"` ;;
--user=*)
# Note that the user will be passed to mysqld so that it runs
# as 'user' (crucial e.g. if log-bin=/some_other_path/
# where a chown of datadir won't help)
user=`parse_arg "$arg"` ;;
--user=*) user=`parse_arg "$arg"` ;;
--group=*) group=`parse_arg "$arg"` ;;
--skip-name-resolve) ip_only=1 ;;
--verbose) verbose=1 ; silent_startup="" ;;
--rpm) in_rpm=1 ;;
@@ -467,7 +473,12 @@ do
fi
if test -n "$user"
then
chown $user "$dir"
if test -z "$group"
then
chown $user $dir
else
chown $user:$group $dir
fi
if test $? -ne 0
then
echo "Cannot change ownership of the database directories to the '$user'"
@@ -501,6 +512,11 @@ then
args="$args --user=$user"
fi
if test -n "$group"
then
args="$args --group=$group"
fi
if test -f "$ldata/mysql/user.frm"
then
echo "mysql.user table already exists!"
@@ -524,7 +540,7 @@ mysqld_install_cmd_line()
{
"$mysqld_bootstrap" $defaults $defaults_group_suffix "$mysqld_opt" --bootstrap $silent_startup\
"--basedir=$basedir" "--datadir=$ldata" --log-warnings=0 --enforce-storage-engine="" \
"--plugin-dir=${plugindir}" \
"--plugin-dir=${plugindir}" --loose-disable-plugin-file-key-management \
$args --max_allowed_packet=8M \
--net_buffer_length=16K
}
@@ -559,6 +575,7 @@ cat_sql()
s_echo "Installing MariaDB/MySQL system tables in '$ldata' ..."
if cat_sql | eval "$filter_cmd_line" | mysqld_install_cmd_line > /dev/null
then
printf "@VERSION@-MariaDB" > "$ldata/mysql_upgrade_info"
s_echo "OK"
else
log_file_place=$ldata

View File

@@ -20,9 +20,10 @@
use Getopt::Long;
use POSIX qw(strftime getcwd);
use File::Path qw(mkpath);
$|=1;
$VER="2.20";
$VER="3.0";
my @defaults_options; # Leading --no-defaults, --defaults-file, etc.
@@ -147,6 +148,7 @@ sub main
usage() if (!defined($ARGV[0]) ||
(!($ARGV[0] =~ m/^start$/i) &&
!($ARGV[0] =~ m/^stop$/i) &&
!($ARGV[0] =~ m/^reload$/i) &&
!($ARGV[0] =~ m/^report$/i)));
if (!$opt_no_log)
@@ -160,7 +162,7 @@ sub main
print strftime "%a %b %e %H:%M:%S %Y", localtime;
print "\n";
}
if ($ARGV[0] =~ m/^start$/i)
if (($ARGV[0] =~ m/^start$/i) || ($ARGV[0] =~ m/^reload$/i))
{
if (!defined(($mysqld= my_which($opt_mysqld))) && $opt_verbose)
{
@@ -169,7 +171,11 @@ sub main
print "This is OK, if you are using option \"mysqld=...\" in ";
print "groups [mysqldN] separately for each.\n\n";
}
start_mysqlds();
if ($ARGV[0] =~ m/^start$/i) {
start_mysqlds();
} elsif ($ARGV[0] =~ m/^reload$/i) {
reload_mysqlds();
}
}
else
{
@@ -332,6 +338,39 @@ sub start_mysqlds()
for ($j = 0, $tmp= ""; defined($options[$j]); $j++)
{
if ("--datadir=" eq substr($options[$j], 0, 10)) {
$datadir = $options[$j];
$datadir =~ s/\-\-datadir\=//;
eval { mkpath($datadir) };
if ($@) {
print "FATAL ERROR: Cannot create data directory $datadir: $!\n";
exit(1);
}
if (! -d $datadir."/mysql") {
if (-w $datadir) {
print "\n\nInstalling new database in $datadir\n\n";
$install_cmd="@bindir@/mysql_install_db ";
$install_cmd.="--user=mysql ";
$install_cmd.="--datadir=$datadir";
system($install_cmd);
} else {
print "\n";
print "FATAL ERROR: Tried to create mysqld under group [$groups[$i]],\n";
print "but the data directory is not writable.\n";
print "data directory used: $datadir\n";
exit(1);
}
}
if (! -d $datadir."/mysql") {
print "\n";
print "FATAL ERROR: Tried to start mysqld under group [$groups[$i]],\n";
print "but no data directory was found or could be created.\n";
print "data directory used: $datadir\n";
exit(1);
}
}
if ("--mysqladmin=" eq substr($options[$j], 0, 13))
{
# catch this and ignore
@@ -412,6 +451,58 @@ sub start_mysqlds()
}
####
#### reload multiple servers
####
sub reload_mysqlds()
{
my (@groups, $com, $tmp, $i, @options, $j);
if (!$opt_no_log)
{
w2log("\nReloading MySQL servers\n","$opt_log",0,0);
}
else
{
print "\nReloading MySQL servers\n";
}
@groups = &find_groups($groupids);
for ($i = 0; defined($groups[$i]); $i++)
{
$mysqld_server = $mysqld;
@options = defaults_for_group($groups[$i]);
for ($j = 0, $tmp= ""; defined($options[$j]); $j++)
{
if ("--mysqladmin=" eq substr($options[$j], 0, 13))
{
# catch this and ignore
}
elsif ("--mysqld=" eq substr($options[$j], 0, 9))
{
$options[$j] =~ s/\-\-mysqld\=//;
$mysqld_server = $options[$j];
}
elsif ("--pid-file=" eq substr($options[$j], 0, 11))
{
$options[$j] =~ s/\-\-pid-file\=//;
$pid_file = $options[$j];
}
}
$com = "killproc -p $pid_file -HUP $mysqld_server";
system($com);
$com = "touch $pid_file";
system($com);
}
if (!$i && !$opt_no_log)
{
w2log("No MySQL servers to be reloaded (check your GNRs)",
"$opt_log", 0, 0);
}
}
###
#### stop multiple servers
####
@@ -793,7 +884,7 @@ sub usage
$my_progname version $VER by Jani Tolonen
Description:
$my_progname can be used to start, or stop any number of separate
$my_progname can be used to start, reload, or stop any number of separate
mysqld processes running in different TCP/IP ports and UNIX sockets.
$my_progname can read group [mysqld_multi] from my.cnf file. You may
@@ -811,16 +902,16 @@ integer starting from 1. These groups should be the same as the regular
[mysqld] group, but with those port, socket and any other options
that are to be used with each separate mysqld process. The number
in the group name has another function; it can be used for starting,
stopping, or reporting any specific mysqld server.
reloading, stopping, or reporting any specific mysqld server.
Usage: $my_progname [OPTIONS] {start|stop|report} [GNR,GNR,GNR...]
or $my_progname [OPTIONS] {start|stop|report} [GNR-GNR,GNR,GNR-GNR,...]
Usage: $my_progname [OPTIONS] {start|reload|stop|report} [GNR,GNR,GNR...]
or $my_progname [OPTIONS] {start|reload|stop|report} [GNR-GNR,GNR,GNR-GNR,...]
The GNR means the group number. You can start, stop or report any GNR,
The GNR means the group number. You can start, reload, stop or report any GNR,
or several of them at the same time. (See --example) The GNRs list can
be comma separated or a dash combined. The latter means that all the
GNRs between GNR1-GNR2 will be affected. Without GNR argument all the
groups found will either be started, stopped, or reported. Note that
groups found will either be started, reloaded, stopped, or reported. Note that
syntax for specifying GNRs must appear without spaces.
Options:

View File

@@ -29,6 +29,7 @@ logging=init
want_syslog=0
syslog_tag=
user='@MYSQLD_USER@'
group='@MYSQLD_GROUP@'
pid_file=
err_log=
err_log_base=
@@ -299,6 +300,7 @@ parse_arguments() {
--pid[-_]file=*) pid_file="$val" ;;
--plugin[-_]dir=*) PLUGIN_DIR="$val" ;;
--user=*) user="$val"; SET_USER=1 ;;
--group=*) group="$val"; SET_USER=1 ;;
--log[-_]basename=*|--hostname=*|--loose[-_]log[-_]basename=*)
pid_file="$val.pid";
err_log_base="$val";
@@ -701,6 +703,7 @@ then
if test "$user" != "root" -o $SET_USER = 1
then
USER_OPTION="--user=$user"
GROUP_OPTION="--group=$group"
fi
if test -n "$open_files"
then
@@ -723,7 +726,12 @@ then
log_error "Fatal error Can't create database directory '$mysql_unix_port'"
exit 1
fi
chown $user $mysql_unix_port_dir
if [ "$user" -a "$group" ]; then
chown $user:$group $mysql_unix_port_dir
else
[ "$user" ] && chown $user $mysql_unix_port_dir
[ "$group" ] && chgrp $group $mysql_unix_port_dir
fi
chmod 755 $mysql_unix_port_dir
fi