summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2011-03-23 19:22:38 +0200
committerMichael Widenius <monty@askmonty.org>2011-03-23 19:22:38 +0200
commiteaed26053da306109d93cbce42b3d275c3e62471 (patch)
tree8055d6ee835d938d153d0b66caa2bfd55f120ca8
parent3e46f488e5034da1557b2d6c18442dd9fdb40138 (diff)
parent7de98f2ffbb273b105321fc88bf536a1fd55114a (diff)
downloadmariadb-git-eaed26053da306109d93cbce42b3d275c3e62471.tar.gz
Merge with base 5.2
-rw-r--r--client/mysql.cc3
-rw-r--r--client/mysql_upgrade.c6
-rw-r--r--client/mysqladmin.cc3
-rw-r--r--client/mysqlbinlog.cc3
-rw-r--r--client/mysqlcheck.c3
-rw-r--r--client/mysqldump.c3
-rw-r--r--client/mysqlimport.c3
-rw-r--r--client/mysqlshow.c3
-rw-r--r--client/mysqlslap.c3
-rw-r--r--client/mysqltest.cc3
-rw-r--r--extra/my_print_defaults.c2
-rw-r--r--mysql-test/Makefile.am2
-rw-r--r--mysql-test/lib/My/ConfigFactory.pm3
-rw-r--r--mysql-test/r/variables-notembedded.result8
-rw-r--r--mysql-test/suite/binlog/t/binlog_delete_and_flush_index-master.opt1
-rw-r--r--mysql-test/suite/binlog/t/binlog_index-master.opt2
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt2
-rw-r--r--mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test4
-rw-r--r--mysql-test/suite/rpl/r/rpl_flushlog_loop.result2
-rw-r--r--mysql-test/suite/rpl/rpl_1slave_base.cnf8
-rw-r--r--scripts/mysql_fix_privilege_tables.sh2
-rw-r--r--scripts/mysql_install_db.pl.in4
-rw-r--r--scripts/mysql_install_db.sh36
-rw-r--r--scripts/mysql_secure_installation.sh4
-rw-r--r--scripts/mysqld_multi.sh2
-rw-r--r--scripts/mysqld_safe.sh26
-rw-r--r--scripts/mysqldumpslow.sh59
-rw-r--r--sql-common/client.c8
-rw-r--r--sql/log.cc21
-rw-r--r--sql/mysql_priv.h3
-rw-r--r--sql/mysqld.cc173
-rw-r--r--sql/rpl_rli.cc3
-rw-r--r--sql/set_var.cc2
-rw-r--r--tests/mysql_client_test.c3
-rw-r--r--tests/thread_test.c3
35 files changed, 286 insertions, 130 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 0e1d9362df5..983953cfbea 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1030,7 +1030,8 @@ static COMMANDS commands[] = {
{ (char *)NULL, 0, 0, 0, ""}
};
-static const char *load_default_groups[]= { "mysql","client",0 };
+static const char *load_default_groups[]=
+{ "mysql", "client", "client-server", "client-mariadb", 0 };
static int embedded_server_arg_count= 0;
static char *embedded_server_args[MAX_SERVER_ARGS];
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index c72f13eded6..b67ca5456d7 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -816,8 +816,10 @@ static int run_sql_fix_privilege_tables(void)
static const char *load_default_groups[]=
{
- "client", /* Read settings how to connect to server */
- "mysql_upgrade", /* Read special settings for mysql_upgrade*/
+ "client", /* Read settings how to connect to server */
+ "mysql_upgrade", /* Read special settings for mysql_upgrade */
+ "client-server", /* Reads settings common between client & server */
+ "client-mariadb", /* Read mariadb unique client settings */
0
};
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index 9e6a1513af6..5f3175f3ed6 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -223,7 +223,8 @@ static struct my_option my_long_options[] =
};
-static const char *load_default_groups[]= { "mysqladmin","client",0 };
+static const char *load_default_groups[]=
+{ "mysqladmin", "client", "client-server", "client-mariadb", 0 };
my_bool
get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index 266160890f6..b6668161ce5 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -65,7 +65,8 @@ static FILE *result_file;
#ifndef DBUG_OFF
static const char* default_dbug_option = "d:t:o,/tmp/mysqlbinlog.trace";
#endif
-static const char *load_default_groups[]= { "mysqlbinlog","client",0 };
+static const char *load_default_groups[]=
+{ "mysqlbinlog", "client", "client-server", "client-mariadb", 0 };
static void error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
static void warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 41249949633..14e02bbb328 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -187,7 +187,8 @@ static struct my_option my_long_options[] =
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-static const char *load_default_groups[] = { "mysqlcheck", "client", 0 };
+static const char *load_default_groups[]=
+{ "mysqlcheck", "client", "client-server", "client-mariadb", 0 };
static void print_version(void);
diff --git a/client/mysqldump.c b/client/mysqldump.c
index bb09af4a3c2..7a1590f8a95 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -480,7 +480,8 @@ static struct my_option my_long_options[] =
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-static const char *load_default_groups[]= { "mysqldump","client",0 };
+static const char *load_default_groups[]=
+{ "mysqldump", "client", "client-server", "client-mariadb", 0 };
static void maybe_exit(int error);
static void die(int error, const char* reason, ...);
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 43994a4f514..3367eb77cbc 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -183,7 +183,8 @@ static struct my_option my_long_options[] =
};
-static const char *load_default_groups[]= { "mysqlimport","client",0 };
+static const char *load_default_groups[]=
+{ "mysqlimport","client", "client-server", "client-mariadb", 0 };
#include <help_start.h>
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index 698516e0794..fafb07cfcbb 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -53,7 +53,8 @@ static void print_res_header(MYSQL_RES *result);
static void print_res_top(MYSQL_RES *result);
static void print_res_row(MYSQL_RES *result,MYSQL_ROW cur);
-static const char *load_default_groups[]= { "mysqlshow","client",0 };
+static const char *load_default_groups[]=
+{ "mysqlshow","client", "client-server", "client-mariadb", 0 };
static char * opt_mysql_unix_port=0;
int main(int argc, char **argv)
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index 0b3ea2a0065..8a45b567e84 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -178,7 +178,8 @@ static uint opt_protocol= 0;
static int get_options(int *argc,char ***argv);
static uint opt_mysql_port= 0;
-static const char *load_default_groups[]= { "mysqlslap","client",0 };
+static const char *load_default_groups[]=
+{ "mysqlslap", "client", "client-server", "client-mariadb", 0 };
typedef struct statement statement;
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 1fecd4fa7ac..65ae93696ea 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -118,7 +118,8 @@ static my_bool abort_on_error= 1;
static my_bool server_initialized= 0;
static my_bool is_windows= 0;
static char **default_argv;
-static const char *load_default_groups[]= { "mysqltest", "client", 0 };
+static const char *load_default_groups[]=
+{ "mysqltest", "client", "client-server", "client-mariadb", 0 };
static char line_buffer[MAX_DELIMITER_LENGTH], *line_buffer_pos= line_buffer;
static uint start_lineno= 0; /* Start line of current command */
diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c
index 847738951dd..3f0f2e00ed5 100644
--- a/extra/my_print_defaults.c
+++ b/extra/my_print_defaults.c
@@ -104,7 +104,7 @@ static void usage(my_bool version)
my_print_help(my_long_options);
my_print_default_files(config_file);
my_print_variables(my_long_options);
- printf("\nExample usage:\n%s --defaults-file=example.cnf client mysql\n", my_progname);
+ printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname);
}
#include <help_end.h>
diff --git a/mysql-test/Makefile.am b/mysql-test/Makefile.am
index 515f7faf5e7..cbfef2b2af2 100644
--- a/mysql-test/Makefile.am
+++ b/mysql-test/Makefile.am
@@ -88,7 +88,7 @@ TEST_DIRS = t r include std_data std_data/parts collections \
suite/federated \
suite/pbxt/t suite/pbxt/r suite/pbxt \
suite/vcol suite/vcol/t suite/vcol/r suite/vcol/inc \
- suite/oqgraph suite/oqgraph/t suite/oqgraph/r suite/oqgraph/include \
+ suite/oqgraph suite/oqgraph/t suite/oqgraph/r \
suite/percona suite/sphinx \
suite/funcs_1 suite/funcs_1/bitdata \
suite/funcs_1/include suite/funcs_1/lib suite/funcs_1/r \
diff --git a/mysql-test/lib/My/ConfigFactory.pm b/mysql-test/lib/My/ConfigFactory.pm
index e9571670f8c..e6497e8866a 100644
--- a/mysql-test/lib/My/ConfigFactory.pm
+++ b/mysql-test/lib/My/ConfigFactory.pm
@@ -209,6 +209,7 @@ my @mysqld_rules=
(
{ 'basedir' => sub { return shift->{ARGS}->{basedir}; } },
{ 'tmpdir' => \&fix_tmpdir },
+ { 'log-basename' => sub { return "mysqld" } },
{ 'character-sets-dir' => \&fix_charset_dir },
{ 'language' => \&fix_language },
{ 'datadir' => \&fix_datadir },
@@ -217,6 +218,7 @@ my @mysqld_rules=
{ 'port' => \&fix_port },
{ '#extra-port' => \&fix_port },
{ 'socket' => \&fix_socket },
+ { 'log-error' => \&fix_log_error },
{ '#log-error' => \&fix_log_error },
{ 'general-log' => sub { return 1; } },
{ 'general-log-file' => \&fix_log },
@@ -225,6 +227,7 @@ my @mysqld_rules=
{ '#user' => sub { return shift->{ARGS}->{user} || ""; } },
{ '#password' => sub { return shift->{ARGS}->{password} || ""; } },
{ 'server-id' => \&fix_server_id, },
+ { 'sync-sys' => sub { return 1; } },
# By default, prevent the started mysqld to access files outside of vardir
{ 'secure-file-priv' => sub { return shift->{ARGS}->{vardir}; } },
{ 'ssl-ca' => \&fix_ssl_ca },
diff --git a/mysql-test/r/variables-notembedded.result b/mysql-test/r/variables-notembedded.result
index 8c6d54757ed..c9a1d64cdd0 100644
--- a/mysql-test/r/variables-notembedded.result
+++ b/mysql-test/r/variables-notembedded.result
@@ -33,12 +33,12 @@ ERROR HY000: Variable 'log_slave_updates' is a read only variable
#
SHOW VARIABLES like 'relay_log';
Variable_name Value
-relay_log
+relay_log mysqld-relay-bin
SELECT @@session.relay_log;
ERROR HY000: Variable 'relay_log' is a GLOBAL variable
SELECT @@global.relay_log;
@@global.relay_log
-NULL
+mysqld-relay-bin
SET @@session.relay_log= 'x';
ERROR HY000: Variable 'relay_log' is a read only variable
SET @@global.relay_log= 'x';
@@ -46,12 +46,12 @@ ERROR HY000: Variable 'relay_log' is a read only variable
#
SHOW VARIABLES like 'relay_log_index';
Variable_name Value
-relay_log_index
+relay_log_index mysqld-relay-bin.index
SELECT @@session.relay_log_index;
ERROR HY000: Variable 'relay_log_index' is a GLOBAL variable
SELECT @@global.relay_log_index;
@@global.relay_log_index
-NULL
+mysqld-relay-bin.index
SET @@session.relay_log_index= 'x';
ERROR HY000: Variable 'relay_log_index' is a read only variable
SET @@global.relay_log_index= 'x';
diff --git a/mysql-test/suite/binlog/t/binlog_delete_and_flush_index-master.opt b/mysql-test/suite/binlog/t/binlog_delete_and_flush_index-master.opt
new file mode 100644
index 00000000000..434bd66d696
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_delete_and_flush_index-master.opt
@@ -0,0 +1 @@
+--log-bin=master-bin --log-bin-index=master-bin
diff --git a/mysql-test/suite/binlog/t/binlog_index-master.opt b/mysql-test/suite/binlog/t/binlog_index-master.opt
index ff2ad57a9e9..35b2dc04cd1 100644
--- a/mysql-test/suite/binlog/t/binlog_index-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_index-master.opt
@@ -1 +1 @@
---force-restart --skip-stack-trace --test-expect-abort --log-warnings=0
+--force-restart --skip-stack-trace --test-expect-abort --log-warnings=0 --log-bin=master-bin --log-bin-index=master-bin
diff --git a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt
index 91466bcdea3..2dda40e61c3 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt
+++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning-master.opt
@@ -1 +1 @@
---binlog-ignore-db=b42851 --log-error
+--binlog-ignore-db=b42851 --log-error --log-bin=master-bin --log-bin-index=master-bin
diff --git a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
index d09f4e433ac..809b03691c7 100644
--- a/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
+++ b/mysql-test/suite/binlog/t/binlog_stm_unsafe_warning.test
@@ -101,6 +101,7 @@ if(!`select LENGTH('$log_error_')`)
# does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
}
+
# Assign env variable LOG_ERROR
let LOG_ERROR=$log_error_;
@@ -109,8 +110,9 @@ let LOG_ERROR=$log_error_;
perl;
use strict;
+ use Cwd;
my $log_error= $ENV{'LOG_ERROR'} or die "LOG_ERROR not set";
- open(FILE, "$log_error") or die("Unable to open $log_error: $!\n");
+ open(FILE, "$log_error") or die("Unable to open '$log_error' from directory " . cwd() . "\n");
my $count = () = grep(/Bug#46265/g,<FILE>);
print "Occurrences: $count\n";
close(FILE);
diff --git a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
index 26b7640ccbc..d53d057b470 100644
--- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
+++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result
@@ -2,7 +2,7 @@ include/rpl_init.inc [topology=1->2->1]
show variables like 'relay_log%';
Variable_name Value
relay_log master-relay-bin
-relay_log_index
+relay_log_index master-relay-bin.index
relay_log_info_file relay-log.info
relay_log_purge ON
relay_log_space_limit 0
diff --git a/mysql-test/suite/rpl/rpl_1slave_base.cnf b/mysql-test/suite/rpl/rpl_1slave_base.cnf
index 2e2ae79888e..e1d2d026acb 100644
--- a/mysql-test/suite/rpl/rpl_1slave_base.cnf
+++ b/mysql-test/suite/rpl/rpl_1slave_base.cnf
@@ -6,8 +6,9 @@
# Run the master.sh script before starting this process
#!run-master-sh
-log-bin= master-bin
-relay-log= master-relay-bin
+log-basename= master
+# log-bin= master-bin
+# relay-log= master-relay-bin
[mysqld.2]
# Run the slave.sh script before starting this process
@@ -17,7 +18,8 @@ relay-log= master-relay-bin
# starting the mysqld
#!use-slave-opt
-relay-log= slave-relay-bin
+log-basename= slave
+# relay-log= slave-relay-bin
init-rpl-role= slave
log-slave-updates
diff --git a/scripts/mysql_fix_privilege_tables.sh b/scripts/mysql_fix_privilege_tables.sh
index aaf0553151f..f0147b22878 100644
--- a/scripts/mysql_fix_privilege_tables.sh
+++ b/scripts/mysql_fix_privilege_tables.sh
@@ -103,7 +103,7 @@ do
fi
done
-parse_arguments `$print_defaults $defaults mysql_install_db mysql_fix_privilege_tables`
+parse_arguments `$print_defaults $defaults mysql_install_db client client-server client-mariadb mysql_fix_privilege_tables`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
if test -z "$password"
diff --git a/scripts/mysql_install_db.pl.in b/scripts/mysql_install_db.pl.in
index 0985c27f0ec..2119a1b650a 100644
--- a/scripts/mysql_install_db.pl.in
+++ b/scripts/mysql_install_db.pl.in
@@ -116,7 +116,7 @@ sub parse_arguments
"basedir=s",
"builddir=s", # FIXME not documented
"srcdir=s",
- "ldata|datadir=s",
+ "ldata|datadir|data=s",
# Note that the user will be passed to mysqld so that it runs
# as 'user' (crucial e.g. if log-bin=/some_other_path/
@@ -274,7 +274,7 @@ else
my @default_options;
my $cmd = quote_options($print_defaults,$opt->{'defaults-file'},
- "mysqld","mysql_install_db");
+ "mysqld","mariadb","mysql_install_db","server","client-server");
open(PIPE, "$cmd |") or error($opt,"can't run $cmd: $!");
while ( <PIPE> )
{
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 2d3775afb3a..6b1b1e6f121 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -50,6 +50,8 @@ Usage: $0 [OPTIONS]
use hostnames will use IP addresses.
--ldata=path The path to the MariaDB data directory. Same as
--datadir.
+ --no-defaults Don't read any configuration files (my.cnf).
+ --defaults-file=path Read only this configuration file.
--rpm For internal use. This option is used by RPM files
during the MariaDB installation process.
--skip-name-resolve Use IP addresses rather than hostnames when creating
@@ -79,6 +81,13 @@ s_echo()
fi
}
+link_to_help()
+{
+ echo
+ echo "The latest information about mysql_install_db is available at"
+ echo "http://kb.askmonty.org/v/installing-system-tables-mysql_install_db."
+}
+
parse_arg()
{
echo "$1" | sed -e 's/^[^=]*=//'
@@ -103,7 +112,7 @@ parse_arguments()
--basedir=*) basedir=`parse_arg "$arg"` ;;
--builddir=*) builddir=`parse_arg "$arg"` ;;
--srcdir=*) srcdir=`parse_arg "$arg"` ;;
- --ldata=*|--datadir=*) ldata=`parse_arg "$arg"` ;;
+ --ldata=*|--datadir=*|--data=*) ldata=`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/
@@ -194,7 +203,7 @@ cannot_find_file()
echo "If you are using a binary release, you must either be at the top"
echo "level of the extracted archive, or pass the --basedir option"
echo "pointing to that location."
- echo
+ link_to_help
}
# Ok, let's go. We first need to parse arguments which are required by
@@ -213,6 +222,7 @@ parse_arguments PICK-ARGS-FROM-ARGV "$@"
if test -n "$srcdir" && test -n "$basedir"
then
echo "ERROR: Specify either --basedir or --srcdir, not both."
+ link_to_help
exit 1
fi
if test -n "$srcdir"
@@ -242,7 +252,7 @@ fi
# Now we can get arguments from the groups [mysqld] and [mysql_install_db]
# in the my.cfg file, then re-run to merge with command line arguments.
-parse_arguments `$print_defaults $defaults mysqld mysql_install_db`
+parse_arguments `$print_defaults $defaults mysqld mariadb mysql_install_db client-server`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
# Configure paths to support files
@@ -335,6 +345,7 @@ then
echo "hostname."
echo "If you want to solve this at a later stage, restart this script"
echo "with the --force option"
+ link_to_help
exit 1
fi
echo "WARNING: The host '$hostname' could not be looked up with resolveip."
@@ -356,7 +367,12 @@ for dir in $ldata $ldata/mysql $ldata/test
do
if test ! -d $dir
then
- mkdir -p $dir
+ if ! `mkdir -p $dir`
+ then
+ echo "Fatal error Can't create database directory '$dir'"
+ link_to_help
+ exit 1
+ fi
chmod 700 $dir
fi
if test -w / -a ! -z "$user"
@@ -384,12 +400,12 @@ fi
mysqld_bootstrap="${MYSQLD_BOOTSTRAP-$mysqld}"
mysqld_install_cmd_line="$mysqld_bootstrap $defaults $mysqld_opt --bootstrap \
--basedir=$basedir --datadir=$ldata --log-warnings=0 --loose-skip-innodb \
- --loose-skip-ndbcluster $args --max_allowed_packet=8M \
+ --loose-skip-ndbcluster --loose-skip-pbxt $args --max_allowed_packet=8M \
--default-storage-engine=myisam \
--net_buffer_length=16K"
# Create the system and help tables by passing them to "mysqld --bootstrap"
-s_echo "Installing MariaDB/MySQL system tables..."
+s_echo "Installing MariaDB/MySQL system tables in '$ldata' ..."
if { echo "use mysql;"; cat $create_system_tables $fill_system_tables; } | eval "$filter_cmd_line" | $mysqld_install_cmd_line > /dev/null
then
s_echo "OK"
@@ -410,9 +426,7 @@ else
echo
echo "Try 'mysqld --help' if you have problems with paths. Using"
echo "--general-log gives you a log in $ldata that may be helpful."
- echo
- echo "The latest information about mysql_install_db is available at"
- echo "http://kb.askmonty.org/v/installing-system-tables-mysql_install_db."
+ link_to_help
echo "MariaDB is hosted on launchpad; You can find the latest source and"
echo "email lists at http://launchpad.net/maria"
echo
@@ -454,13 +468,13 @@ then
echo "databases and anonymous user created by default. This is"
echo "strongly recommended for production servers."
echo
- echo "See the MySQL manual for more instructions."
+ echo "See the MariaDB knowledge or the MySQL manual for more instructions."
if test "$in_rpm" -eq 0
then
echo
echo "You can start the MariaDB daemon with:"
- echo "cd $basedir ; $bindir/mysqld_safe &"
+ echo "cd $basedir ; $bindir/mysqld_safe --datadir=$ldata"
echo
echo "You can test the MariaDB daemon with mysql-test-run.pl"
echo "cd $basedir/mysql-test ; perl mysql-test-run.pl"
diff --git a/scripts/mysql_secure_installation.sh b/scripts/mysql_secure_installation.sh
index fe93522aa87..d59f1ac8565 100644
--- a/scripts/mysql_secure_installation.sh
+++ b/scripts/mysql_secure_installation.sh
@@ -165,9 +165,9 @@ then
exit 1
fi
-# Now we can get arguments from the group [client]
+# Now we can get arguments from the group [client] and [client-server]
# in the my.cfg file, then re-run to merge with command line arguments.
-parse_arguments `$print_defaults $defaults client`
+parse_arguments `$print_defaults $defaults client client-server client-mariadb`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
# Configure paths to support files
diff --git a/scripts/mysqld_multi.sh b/scripts/mysqld_multi.sh
index 3d3853bcb22..d420eb4c13c 100644
--- a/scripts/mysqld_multi.sh
+++ b/scripts/mysqld_multi.sh
@@ -200,7 +200,7 @@ sub defaults_for_group
sub init_log
{
- foreach my $opt (defaults_for_group('mysqld'))
+ foreach my $opt (defaults_for_group('mysqld mariadb'))
{
if ($opt =~ m/^--datadir=(.*)/ && -d "$1" && -w "$1")
{
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh
index e4e5f1a1510..cae63343cfc 100644
--- a/scripts/mysqld_safe.sh
+++ b/scripts/mysqld_safe.sh
@@ -159,9 +159,13 @@ parse_arguments() {
case "$arg" in
# these get passed explicitly to mysqld
--basedir=*) MY_BASEDIR_VERSION="$val" ;;
- --datadir=*) DATADIR="$val" ;;
+ --datadir=*|--data=*) DATADIR="$val" ;;
--pid-file=*) pid_file="$val" ;;
--user=*) user="$val"; SET_USER=1 ;;
+ --log-basename=*|--hostname=*|--loose-log-basename=*)
+ pid_file="$val.pid";
+ err_log="$val.err";
+ ;;
# these might have been set in a [mysqld_safe] section of my.cnf
# they are added to mysqld command line to override settings from my.cnf
@@ -313,7 +317,7 @@ append_arg_to_args () {
args=
SET_USER=2
-parse_arguments `$print_defaults $defaults --loose-verbose mysqld server`
+parse_arguments `$print_defaults $defaults --loose-verbose mysqld mariadb server client-server`
if test $SET_USER -eq 2
then
SET_USER=0
@@ -411,7 +415,11 @@ safe_mysql_unix_port=${mysql_unix_port:-${MYSQL_UNIX_PORT:-@MYSQL_UNIX_ADDR@}}
mysql_unix_port_dir=`dirname $safe_mysql_unix_port`
if [ ! -d $mysql_unix_port_dir ]
then
- mkdir $mysql_unix_port_dir
+ if ! `mkdir -p $mysql_unix_port_dir`
+ then
+ echo "Fatal error Can't create database directory '$mysql_unix_port'"
+ exit 1
+ fi
chown $user $mysql_unix_port_dir
chmod 755 $mysql_unix_port_dir
fi
@@ -434,14 +442,14 @@ fi
if test -z "$pid_file"
then
- pid_file="$DATADIR/`@HOSTNAME@`.pid"
-else
- case "$pid_file" in
- /* ) ;;
- * ) pid_file="$DATADIR/$pid_file" ;;
- esac
+ pid_file="`@HOSTNAME@`.pid"
fi
+# MariaDB wants pid file without datadir
append_arg_to_args "--pid-file=$pid_file"
+case "$pid_file" in
+ /* ) ;;
+ * ) pid_file="$DATADIR/$pid_file" ;;
+esac
if test -n "$mysql_unix_port"
then
diff --git a/scripts/mysqldumpslow.sh b/scripts/mysqldumpslow.sh
index 8580b8e6203..de565678f9b 100644
--- a/scripts/mysqldumpslow.sh
+++ b/scripts/mysqldumpslow.sh
@@ -20,13 +20,13 @@ GetOptions(\%opt,
'v|verbose+',# verbose
'help+', # write usage info
'd|debug+', # debug
- 's=s', # what to sort by (al, at, ar, c, t, l, r)
+ 's=s', # what to sort by (al, at, ar, ae, c, t, l, r, e)
'r!', # reverse the sort order (largest last instead of first)
't=i', # just show the top n queries
'a!', # don't abstract all numbers to N and strings to 'S'
'n=i', # abstract numbers with at least n digits within names
'g=s', # grep: only consider stmts that include this string
- 'h=s', # hostname of db server for *-slow.log filename (can be wildcard)
+ 'h=s', # hostname/basename of db server for *-slow.log filename (can be wildcard)
'i=s', # name of server instance (if using mysql.server startup script)
'l!', # don't subtract lock time from total time
) or usage("bad option");
@@ -34,34 +34,42 @@ GetOptions(\%opt,
$opt{'help'} and usage();
unless (@ARGV) {
- my $defaults = `my_print_defaults mysqld`;
- my $basedir = ($defaults =~ m/--basedir=(.*)/)[0]
- or die "Can't determine basedir from 'my_print_defaults mysqld' output: $defaults";
- warn "basedir=$basedir\n" if $opt{v};
+ my $defaults = `my_print_defaults mysqld mariadb`;
- my $datadir = ($defaults =~ m/--datadir=(.*)/)[0];
- my $slowlog = ($defaults =~ m/--log-slow-queries=(.*)/)[0];
+ my $datadir = ($defaults =~ m/--datadir=(.*)/g)[-1];
if (!$datadir or $opt{i}) {
# determine the datadir from the instances section of /etc/my.cnf, if any
my $instances = `my_print_defaults instances`;
- die "Can't determine datadir from 'my_print_defaults mysqld' output: $defaults"
+ die "Can't determine datadir from 'my_print_defaults instances' output: $defaults"
unless $instances;
my @instances = ($instances =~ m/^--(\w+)-/mg);
die "No -i 'instance_name' specified to select among known instances: @instances.\n"
unless $opt{i};
die "Instance '$opt{i}' is unknown (known instances: @instances)\n"
unless grep { $_ eq $opt{i} } @instances;
- $datadir = ($instances =~ m/--$opt{i}-datadir=(.*)/)[0]
+ $datadir = ($instances =~ m/--$opt{i}-datadir=(.*)/g)[-1]
or die "Can't determine --$opt{i}-datadir from 'my_print_defaults instances' output: $instances";
warn "datadir=$datadir\n" if $opt{v};
}
- if ( -f $slowlog ) {
+ my $slowlog = ($defaults =~ m/--log[-_]slow[-_]queries=(.*)/g)[-1];
+ if (!$slowlog)
+ {
+ $slowlog = ($defaults =~ m/--slow[-_]query[-_]log[-_]file=(.*)/g)[-1];
+ }
+ if ( $slowlog )
+ {
@ARGV = ($slowlog);
die "Can't find '$slowlog'\n" unless @ARGV;
- } else {
- @ARGV = <$datadir/$opt{h}-slow.log>;
- die "Can't find '$datadir/$opt{h}-slow.log'\n" unless @ARGV;
+ }
+ else
+ {
+ if (!$opt{h})
+ {
+ $opt{h}= ($defaults =~ m/--log[-_]basename=(.*)/g)[-1];
+ }
+ @ARGV = <$datadir/$opt{h}-slow.log>;
+ die "Can't find '$datadir/$opt{h}-slow.log'\n" unless @ARGV;
}
}
@@ -83,8 +91,10 @@ while ( defined($_ = shift @pending) or defined($_ = <>) ) {
s/^#? Time: \d{6}\s+\d+:\d+:\d+.*\n//;
my ($user,$host) = s/^#? User\@Host:\s+(\S+)\s+\@\s+(\S+).*\n// ? ($1,$2) : ('','');
- s/^# Query_time: ([0-9.]+)\s+Lock_time: ([0-9.]+)\s+Rows_sent: ([0-9.]+).*\n//;
- my ($t, $l, $r) = ($1, $2, $3);
+ s/^# Thread_id: [0-9]+\s+Schema: [^\n]+\n//;
+ s/^# Query_time: ([0-9.]+)\s+Lock_time: ([0-9.]+)\s+Rows_sent: ([0-9.]+)\s+Rows_examined: ([0-9.]+).*\n//;
+ my ($t, $l, $r, $e) = ($1, $2, $3, $4);
+
$t -= $l unless $opt{l};
# remove fluff that mysqld writes to log when it (re)starts:
@@ -92,6 +102,11 @@ while ( defined($_ = shift @pending) or defined($_ = <>) ) {
s!^Tcp port: \d+ Unix socket: \S+\n!!mg;
s!^Time.*Id.*Command.*Argument.*\n!!mg;
+ # Remove optimizer info
+ s!^# QC_Hit: \S+\s+Full_scan: \S+\s+Full_join: \S+\s+Tmp_table: \S+\s+Tmp_table_on_disk: \S+[^\n]+\n!!mg;
+ s!^# Filesort: \S+\s+Filesort_on_disk: \S+[^\n]+\n!!mg;
+ s!^# Full_scan: \S+\s+Full_join: \S+[^\n]+\n!!mg;
+
s/^use \w+;\n//; # not consistently added
s/^SET timestamp=\d+;\n//;
@@ -121,6 +136,7 @@ while ( defined($_ = shift @pending) or defined($_ = <>) ) {
$s->{t} += $t;
$s->{l} += $l;
$s->{r} += $r;
+ $s->{e} += $e;
$s->{users}->{$user}++ if $user;
$s->{hosts}->{$host}++ if $host;
@@ -129,10 +145,11 @@ while ( defined($_ = shift @pending) or defined($_ = <>) ) {
foreach (keys %stmt) {
my $v = $stmt{$_} || die;
- my ($c, $t, $l, $r) = @{ $v }{qw(c t l r)};
+ my ($c, $t, $l, $r, $e) = @{ $v }{qw(c t l r e)};
$v->{at} = $t / $c;
$v->{al} = $l / $c;
$v->{ar} = $r / $c;
+ $v->{ae} = $e / $c;
}
my @sorted = sort { $stmt{$b}->{$opt{s}} <=> $stmt{$a}->{$opt{s}} } keys %stmt;
@@ -141,13 +158,13 @@ my @sorted = sort { $stmt{$b}->{$opt{s}} <=> $stmt{$a}->{$opt{s}} } keys %stmt;
foreach (@sorted) {
my $v = $stmt{$_} || die;
- my ($c, $t,$at, $l,$al, $r,$ar) = @{ $v }{qw(c t at l al r ar)};
+ my ($c, $t,$at, $l,$al, $r,$ar,$e, $ae) = @{ $v }{qw(c t at l al r ar e ae)};
my @users = keys %{$v->{users}};
my $user = (@users==1) ? $users[0] : sprintf "%dusers",scalar @users;
my @hosts = keys %{$v->{hosts}};
my $host = (@hosts==1) ? $hosts[0] : sprintf "%dhosts",scalar @hosts;
- printf "Count: %d Time=%.2fs (%ds) Lock=%.2fs (%ds) Rows=%.1f (%d), $user\@$host\n%s\n\n",
- $c, $at,$t, $al,$l, $ar,$r, $_;
+ printf "Count: %d Time=%.2fs (%ds) Lock=%.2fs (%ds) Rows_sent=%.1f (%d), Rows_examined=%.1f (%d), $user\@$host\n%s\n\n",
+ $c, $at,$t, $al,$l, $ar,$r, $ae, $e, $_;
}
sub usage {
@@ -163,7 +180,7 @@ Parse and summarize the MySQL slow query log. Options are
-v verbose
-d debug
- -s ORDER what to sort by (al, at, ar, c, l, r, t), 'at' is default
+ -s ORDER what to sort by (al, at, ar, ae, c, l, r, e, t), 'at' is default
al: average lock time
ar: average rows sent
at: average query time
diff --git a/sql-common/client.c b/sql-common/client.c
index d361d35b7a8..28b3cf274bc 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -1064,12 +1064,16 @@ void mysql_read_default_options(struct st_mysql_options *options,
{
int argc;
char *argv_buff[1],**argv;
- const char *groups[3];
+ const char *groups[5];
DBUG_ENTER("mysql_read_default_options");
DBUG_PRINT("enter",("file: %s group: %s",filename,group ? group :"NULL"));
argc=1; argv=argv_buff; argv_buff[0]= (char*) "client";
- groups[0]= (char*) "client"; groups[1]= (char*) group; groups[2]=0;
+ groups[0]= (char*) "client";
+ groups[1]= (char*) "client-server";
+ groups[2]= (char*) "client-mariadb";
+ groups[3]= (char*) group;
+ groups[4]=0;
my_load_defaults(filename, groups, &argc, &argv, NULL);
if (argc != 1) /* If some default option */
diff --git a/sql/log.cc b/sql/log.cc
index 5c72ce96890..becddf7bfdc 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -112,6 +112,27 @@ char *make_default_log_name(char *buff,const char* log_ext)
MYF(MY_UNPACK_FILENAME|MY_REPLACE_EXT));
}
+
+/*
+ Create a filename from a base with a given suffix.
+ The name is allocated trough my_once_alloc(), so one should only
+ use this for startup options that can all be freed at once.
+*/
+
+char *make_once_alloced_filename(const char *basename, const char *ext)
+{
+ char buff[FN_REFLEN+10], *end, *res;
+ size_t length;
+ strmake(buff, basename, sizeof(buff)-10);
+ end= strmov(fn_ext(buff), ext);
+ length= (size_t) (end - buff) + 1;
+
+ if ((res= (char*) my_once_alloc(length, MYF(MY_WME))))
+ memcpy(res, buff, length);
+ return res;
+}
+
+
/*
Helper class to hold a mutex for the duration of the
block.
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 46e202df071..68d678eecdf 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -1625,6 +1625,7 @@ void remove_db_from_cache(const char *db);
void flush_tables();
bool is_equal(const LEX_STRING *a, const LEX_STRING *b);
char *make_default_log_name(char *buff,const char* log_ext);
+char *make_once_alloced_filename(const char *basename, const char *ext);
#ifdef WITH_PARTITION_STORAGE_ENGINE
uint fast_alter_partition_table(THD *thd, TABLE *table,
@@ -1966,7 +1967,7 @@ extern MYSQL_PLUGIN_IMPORT uint reg_ext_length;
#ifdef MYSQL_SERVER
extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
-extern char log_error_file[FN_REFLEN], *opt_tc_log_file;
+extern char log_error_file[FN_REFLEN], *opt_tc_log_file, *opt_log_basename;
extern ulonglong log_10_int[20];
extern ulonglong keybuff_size;
extern ulonglong thd_startup_options;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 047534e6173..8bb173fda70 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1,6 +1,6 @@
/* Copyright (C) 2000-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc.
2010 Oracle and/or its affiliates
- 2009-2010 Monty Program Ab
+ 2009-2011 Monty Program Ab
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -626,7 +626,7 @@ time_t server_start_time, flush_status_time;
char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30];
char *default_tz_name;
-char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN];
+char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN], *opt_log_basename;
char mysql_real_data_home[FN_REFLEN],
language[FN_REFLEN], reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN],
*opt_init_file, *opt_tc_log_file,
@@ -1407,8 +1407,6 @@ void clean_up(bool print_message)
#ifdef HAVE_REPLICATION
my_free(slave_load_tmpdir,MYF(MY_ALLOW_ZERO_PTR));
#endif
- x_free(opt_bin_logname);
- x_free(opt_relay_logname);
x_free(opt_secure_file_priv);
bitmap_free(&temp_pool);
free_max_user_conn();
@@ -3447,15 +3445,21 @@ static int init_common_variables(const char *conf_file_name, int argc,
*/
mysql_bin_log.init_pthread_objects();
- if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0)
{
- strmake(glob_hostname, STRING_WITH_LEN("localhost"));
- sql_print_warning("gethostname failed, using '%s' as hostname",
- glob_hostname);
- strmake(pidfile_name, STRING_WITH_LEN("mysql"));
+ /*
+ Get hostname of computer (used by 'show variables') and as default
+ basename for the pid file if --log-basename is not given.
+ */
+ const char *basename= glob_hostname;
+ if (gethostname(glob_hostname,sizeof(glob_hostname)) < 0)
+ {
+ strmake(glob_hostname, STRING_WITH_LEN("localhost"));
+ sql_print_warning("gethostname failed, using '%s' as hostname",
+ glob_hostname);
+ basename= "mysql";
+ }
+ strmake(pidfile_name, basename, sizeof(pidfile_name)-5);
}
- else
- strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
/*
@@ -4060,7 +4064,7 @@ version 5.0 and above. It is replaced by the binary log.");
if (opt_update_logname)
{
/* as opt_bin_log==0, no need to free opt_bin_logname */
- if (!(opt_bin_logname= my_strdup(opt_update_logname, MYF(MY_WME))))
+ if (!(opt_bin_logname= my_once_strdup(opt_update_logname, MYF(MY_WME))))
{
sql_print_error("Out of memory");
return EXIT_OUT_OF_MEMORY;
@@ -4160,8 +4164,7 @@ a file name for --log-bin-index option", opt_binlog_index_name);
}
if (ln == buf)
{
- my_free(opt_bin_logname, MYF(MY_ALLOW_ZERO_PTR));
- opt_bin_logname=my_strdup(buf, MYF(0));
+ opt_bin_logname= my_once_strdup(buf, MYF(MY_WME));
}
if (mysql_bin_log.open_index_file(opt_binlog_index_name, ln, TRUE))
{
@@ -5993,7 +5996,7 @@ enum options_mysqld
OPT_PROFILING,
OPT_KEEP_FILES_ON_CREATE,
OPT_GENERAL_LOG,
- OPT_SLOW_LOG,
+ OPT_SLOW_LOG, OPT_LOG_BASENAME,
OPT_THREAD_HANDLING,
OPT_INNODB_ROLLBACK_ON_TIMEOUT,
OPT_SECURE_FILE_PRIV,
@@ -6260,8 +6263,8 @@ struct my_option my_long_options[] =
&opt_debugging, &opt_debugging,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"general_log", OPT_GENERAL_LOG,
- "Enable/disable general log.", &opt_log,
- &opt_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
+ "Enable/disable general log. Filename can be specified with --general-log-file or --log-basename. Is 'hostname.err' by default.",
+ &opt_log, &opt_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef HAVE_LARGE_PAGES
{"large-pages", OPT_ENABLE_LARGE_PAGES, "Enable support for large pages. "
"Disable with --skip-large-pages.", &opt_large_pages, &opt_large_pages,
@@ -6301,16 +6304,32 @@ each time the SQL thread starts.",
"--general_log/--general_log_file instead).", &opt_logname,
&opt_logname, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"general_log_file", OPT_GENERAL_LOG_FILE,
- "Log connections and queries to given file.", &opt_logname,
- &opt_logname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ "Log connections and queries to given file. Defaults to "
+ "'datadir'/'log-basename'.log or 'datadir'/'hostname'.log if not "
+ "specified.",
+ &opt_logname, &opt_logname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"log-basename", OPT_LOG_BASENAME,
+ "Basename for all log files and the .pid file. This sets all log file "
+ "names at once (in 'datadir') and is normally the only option you need "
+ "for specifying log files. This is especially recommend to be set if you "
+ "are using replication as it ensures that your log file names are not "
+ "depending on your host name. Sets names for --log-bin, --log-bin-index, "
+ "--relay-log, --relay-log-index, --general-log-file, "
+ "--log-slow-query-log-file, --log-error-file and --pid-file",
+ &opt_log_basename, &opt_log_basename, 0, GET_STR, REQUIRED_ARG,
+ 0, 0, 0, 0, 0, 0},
{"log-bin", OPT_BIN_LOG,
- "Log update queries in binary format. Optional (but strongly recommended "
- "to avoid replication problems if server's hostname changes) argument "
- "should be the chosen location for the binary log files.",
- &opt_bin_logname, &opt_bin_logname, 0, GET_STR_ALLOC,
+ "Log update queries in binary format. Optional argument should be name for "
+ "binary log. If not given "
+ "datadir/'log-basename'-bin or 'datadir'/mysql-bin will be used (the later if "
+ "--log-basename is not specified). We strongly recommend you to use either "
+ "--log-basename or specify a filename to ensure that replication doesn't "
+ "stop if the real hostname of the computer changes'.",
+ &opt_bin_logname, &opt_bin_logname, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-bin-index", OPT_BIN_LOG_INDEX,
- "File that holds the names for last binary log files.",
+ "File that holds the names for last binary log files. If not specified, "
+ "defaults to 'datadir/log-basename'-bin.index or 'datadir/mysql-bin.index'",
&opt_binlog_index_name, &opt_binlog_index_name, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#ifndef TO_BE_REMOVED_IN_5_1_OR_6_0
@@ -6339,7 +6358,10 @@ each time the SQL thread starts.",
"break, so you can safely set this to 1."
,&trust_function_creators, &trust_function_creators, 0,
GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"log-error", OPT_ERROR_LOG_FILE, "Error log file.",
+ {"log-error", OPT_ERROR_LOG_FILE,
+ "Log errors to file (instead of stdout). If file name is not specified "
+ "then 'datadir'/'log-basename'.err or the pid-file path with extension "
+ ".err is used.",
&log_error_file_ptr, &log_error_file_ptr, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
{"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file.",
@@ -6377,15 +6399,20 @@ each time the SQL thread starts.",
&opt_log_slow_slave_statements,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
{"log-slow-queries", OPT_SLOW_QUERY_LOG,
- "Log slow queries to a table or log file. Defaults logging to table "
- "mysql.slow_log or hostname-slow.log if --log-output=file is used. "
- "Must be enabled to activate other slow log options. "
- "(deprecated option, use --slow_query_log/--slow_query_log_file instead)",
+ "Enable logging of slow queries (longer than --log-slow-time) to log file "
+ "or table. Optional argument is file name for slow log. If not given, "
+ "'log-basename'-slow.log will be used. Use --log-output=TABLE if you want "
+ "to have the log in the table 'mysql.slow_log'",
&opt_slow_logname, &opt_slow_logname, 0, GET_STR, OPT_ARG,
0, 0, 0, 0, 0, 0},
{"slow_query_log_file", OPT_SLOW_QUERY_LOG_FILE,
- "Log slow queries to given log file. Defaults logging to hostname-slow.log. "
- "Must be enabled to activate other slow log options.",
+ "Specify name for slow query log. Defaults to 'log-basename'-slow.log if "
+ "not given",
+ &opt_slow_logname, &opt_slow_logname, 0, GET_STR,
+ REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ {"log-slow-file", OPT_SLOW_QUERY_LOG_FILE,
+ "Specify name for slow query log. Defaults to 'log-basename'-slow.log if "
+ "not given",
&opt_slow_logname, &opt_slow_logname, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"log-tc", OPT_LOG_TC,
@@ -6404,7 +6431,8 @@ each time the SQL thread starts.",
"log and this option just turns on --log-bin instead.",
&opt_update_logname, &opt_update_logname, 0, GET_STR,
OPT_ARG, 0, 0, 0, 0, 0, 0},
- {"log-warnings", 'W', "Log some not critical warnings to the log file.",
+ {"log-warnings", 'W', "Log some not critical warnings to the general log "
+ "file.",
&global_system_variables.log_warnings,
&max_system_variables.log_warnings, 0, GET_ULONG, OPT_ARG, 1, 0, 0,
0, 0, 0},
@@ -6427,7 +6455,8 @@ each time the SQL thread starts.",
0, 0, 0, 0},
{"master-info-file", OPT_MASTER_INFO_FILE,
"The location and name of the file that remembers the master and where "
- "the I/O replication thread is in the master's binlogs.",
+ "the I/O replication thread is in the master's binlogs. Defaults to "
+ "master.info. Is not affected by --log-basename.",
&master_info_file, &master_info_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"master-password", OPT_MASTER_PASSWORD,
@@ -6629,7 +6658,9 @@ each time the SQL thread starts.",
"per each user+host vs. per account).",
&opt_old_style_user_limits, &opt_old_style_user_limits,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
- {"pid-file", OPT_PID_FILE, "Pid file used by safe_mysqld.",
+ {"pid-file", OPT_PID_FILE,
+ "Pid file used by safe_mysqld. If not set, defaults to "
+ "'datadir'/'log-basename'.pid or 'datadir'/'hostname'.pid'.",
&pidfile_name_ptr, &pidfile_name_ptr, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"port", 'P', "Port number to use for connection or 0 for default to, in "
@@ -6651,17 +6682,19 @@ each time the SQL thread starts.",
0, GET_ULONG, REQUIRED_ARG, 15, 0, 100, 0, 0, 0},
#endif
{"relay-log", OPT_RELAY_LOG,
- "The location and name to use for relay logs.",
+ "The location and name to use for relay logs. If not specified "
+ "'datadir'/'log-basename' will be used.",
&opt_relay_logname, &opt_relay_logname, 0,
- GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+ GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relay-log-index", OPT_RELAY_LOG_INDEX,
- "The location and name to use for the file that keeps a list of the last \
-relay logs.",
+ "The location and name to use for the file that keeps a list of the last "
+ "relay logs. If not specified 'datadir'/'log-basename' will be used.",
&opt_relaylog_index_name, &opt_relaylog_index_name, 0,
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"relay-log-info-file", OPT_RELAY_LOG_INFO_FILE,
- "The location and name of the file that remembers where the SQL replication \
-thread is in the relay logs.",
+ "The location and name of the file that remembers where the SQL "
+ "replication thread is in the relay logs. Defaults to relay-log.info. "
+ "Is not affected by '--log-basename'.",
&relay_log_info_file, &relay_log_info_file, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"replicate-do-db", OPT_REPLICATE_DO_DB,
@@ -6841,7 +6874,8 @@ thread is in the relay logs.",
&slave_exec_mode_str, &slave_exec_mode_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
#endif
{"slow-query-log", OPT_SLOW_LOG,
- "Enable/disable slow query log.", &opt_slow_log,
+ "Enable/disable slow query log. See also '--log-slow-queries'",
+ &opt_slow_log,
&opt_slow_log, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0},
{"socket", OPT_SOCKET, "Socket file to use for connection.",
&mysqld_unix_port, &mysqld_unix_port, 0, GET_STR,
@@ -7099,19 +7133,16 @@ thread is in the relay logs.",
"Choose how verbose the messages to your slow log will be. Multiple flags "
"allowed in a comma-separated string. [query_plan, innodb]",
0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- {"log-slow-file", OPT_SLOW_QUERY_LOG_FILE,
- "Log slow queries to given log file. Defaults logging to hostname-slow.log",
- &opt_slow_logname, &opt_slow_logname, 0, GET_STR,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"long_query_time", OPT_LONG_QUERY_TIME,
- "Log all queries that have taken more than long_query_time seconds to "
- "execute. The argument will be treated as a decimal value with "
- "microsecond precision.",
+ {"log-slow-time", OPT_LONG_QUERY_TIME,
+ "Log all queries that have taken more than log-slow-time seconds to "
+ "execute to file. The argument will be treated as a decimal value with "
+ "microsecond precission. Same as --log-query-time.",
&long_query_time, &long_query_time, 0, GET_DOUBLE,
REQUIRED_ARG, 10, 0, LONG_TIMEOUT, 0, 0, 0},
- {"log-slow-time", OPT_LONG_QUERY_TIME,
- "Log all queries that have taken more than long_query_time seconds to execute to file. "
- "The argument will be treated as a decimal value with microsecond precission.",
+ {"long_query_time", OPT_LONG_QUERY_TIME,
+ "Log all queries that have taken more than long-query-time seconds to "
+ "execute to file. The argument will be treated as a decimal value with "
+ "microsecond precission. Same as --log-slow-time.",
&long_query_time, &long_query_time, 0, GET_DOUBLE,
REQUIRED_ARG, 10, 0, LONG_TIMEOUT, 0, 0, 0},
{"lower_case_table_names", OPT_LOWER_CASE_TABLE_NAMES,
@@ -8214,6 +8245,7 @@ static int mysql_init_variables(void)
opt_skip_name_resolve= 0;
opt_ignore_builtin_innodb= 0;
opt_logname= opt_update_logname= opt_binlog_index_name= opt_slow_logname= 0;
+ opt_log_basename= 0;
opt_tc_log_file= (char *)"tc.log"; // no hostname in tc_log file name !
opt_secure_auth= 0;
opt_secure_file_priv= 0;
@@ -8622,6 +8654,42 @@ mysqld_get_one_option(int optid,
case (int) OPT_BIN_LOG:
opt_bin_log= test(argument != disabled_my_option);
break;
+ case (int) OPT_LOG_BASENAME:
+ {
+ if (opt_log_basename[0] == 0 || strchr(opt_log_basename, FN_EXTCHAR) ||
+ strchr(opt_log_basename,FN_LIBCHAR))
+ {
+ sql_print_error("Wrong argument for --log-basename. It can't be empty or contain '.' or '" FN_DIRSEP "'");
+ return 1;
+ }
+ log_error_file_ptr= argument;
+
+ /*
+ The following file named needs explicite extensions (should be fixed in
+ future by having the creating code do this).
+ */
+ opt_logname= make_once_alloced_filename(argument, ".log");
+ opt_slow_logname= make_once_alloced_filename(argument, "-slow.log");
+ opt_bin_logname= make_once_alloced_filename(argument, "-bin");
+ opt_binlog_index_name= make_once_alloced_filename(argument, "-bin.index");
+ opt_relay_logname= make_once_alloced_filename(argument, "-relay-bin");
+ opt_relaylog_index_name=make_once_alloced_filename(argument,
+ "-relay-bin.index");
+
+ pidfile_name_ptr= pidfile_name;
+ strmake(pidfile_name, argument, sizeof(pidfile_name)-5);
+ strmov(fn_ext(pidfile_name),".pid");
+
+ /* The following is depricated so don't set it by default */
+ if (opt_update_logname)
+ opt_update_logname= argument;
+
+ /* check for errors */
+ if (!opt_bin_logname || !opt_relaylog_index_name || ! opt_logname ||
+ ! opt_slow_logname)
+ return 1; // out of memory error
+ break;
+ }
case (int) OPT_ERROR_LOG_FILE:
opt_error_log= 1;
break;
@@ -8738,7 +8806,6 @@ mysqld_get_one_option(int optid,
}
#endif /* HAVE_REPLICATION */
case (int) OPT_SLOW_QUERY_LOG:
- WARN_DEPRECATED(NULL, "7.0", "--log_slow_queries", "'--slow_query_log'/'--log-slow-file'");
opt_slow_log= 1;
break;
case OPT_LOG_OUTPUT:
diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc
index c37c4735e37..45bc406f1d5 100644
--- a/sql/rpl_rli.cc
+++ b/sql/rpl_rli.cc
@@ -170,7 +170,8 @@ a file name for --relay-log-index option", opt_relaylog_index_name);
" so replication "
"may break when this MySQL server acts as a "
"slave and has his hostname changed!! Please "
- "use '--relay-log=%s' to avoid this problem.", ln);
+ "use '--log-basename=%' or '--relay-log=%s' to avoid "
+ "this problem.", ln);
name_warning_sent= 1;
}
/*
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 5a30bd1c0f4..9c977d770a1 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -895,6 +895,8 @@ static sys_var_thd_set sys_log_slow_verbosity(&vars,
/* Global read-only variable containing hostname */
static sys_var_const_str sys_hostname(&vars, "hostname", glob_hostname);
+static sys_var_const_str_ptr sys_log_basename(&vars, "log_basename",
+ &opt_log_basename);
#ifndef EMBEDDED_LIBRARY
static sys_var_const_str_ptr sys_repl_report_host(&vars, "report_host", &report_host);
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index d1224a7f724..759eac04fa3 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -18446,7 +18446,8 @@ static void test_bug47485()
Read and parse arguments and MySQL options from my.cnf
*/
-static const char *client_test_load_default_groups[]= { "client", 0 };
+static const char *client_test_load_default_groups[]=
+{ "client", "client-server", "client-mariadb", 0 };
static char **defaults_argv;
static struct my_option client_test_long_options[] =
diff --git a/tests/thread_test.c b/tests/thread_test.c
index 8e1c58ebbec..0944cbc0970 100644
--- a/tests/thread_test.c
+++ b/tests/thread_test.c
@@ -123,7 +123,8 @@ static struct my_option my_long_options[] =
};
-static const char *load_default_groups[]= { "client",0 };
+static const char *load_default_groups[]=
+{ "client", "client-server", "client-mariadb", 0 };
static void usage()
{