#At file:///data/z/mysql-6.0-runtime-fix33693/ based on revid:davi.arnaut@stripped
2746 Magne Mahre 2009-03-18
Bug #33693 general log name and location depend on PID file, not on predefined values
The default name of the PID file was constructed, as documented,
based on the hostname. This name was subsequently used as the
base for the general log file name. If the name of the PID
file was overridden in the configuration, and no explicit name
was set for the general log file, the path location for the
PID file was used also for the general log file.
A new variable, 'basefile_name', has been introduced. This name
is constructed based on the hostname, and is then used to
construct both the PID file and the general log file.
The general log file will now, unless explicitly set, be
located in the server data directory (as documentated in
the server docs)
modified:
mysql-test/t/log_state.test
sql/log.cc
sql/mysql_priv.h
sql/mysqld.cc
=== modified file 'mysql-test/t/log_state.test'
--- a/mysql-test/t/log_state.test 2009-01-26 16:32:29 +0000
+++ b/mysql-test/t/log_state.test 2009-03-18 22:01:47 +0000
@@ -391,7 +391,6 @@ if(!$fixed_bug38124)
--enable_query_log
}
-# Remove the log files that was created in the "default location"
+# Remove the log file that was created in the "default location"
# i.e var/run
---remove_file $MYSQLTEST_VARDIR/run/mysqld.log
--remove_file $MYSQLTEST_VARDIR/tmp/log.master
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2009-03-04 10:04:58 +0000
+++ b/sql/log.cc 2009-03-18 22:01:47 +0000
@@ -119,10 +119,12 @@ sql_print_message_func sql_print_message
sql_print_error
};
-
+/*
+ Create the name of the default general log file
+*/
char *make_default_log_name(char *buff,const char* log_ext)
{
- strmake(buff, pidfile_name, FN_REFLEN-5);
+ strmake(buff, basefile_name, FN_REFLEN-5);
return fn_format(buff, buff, mysql_data_home, log_ext,
MYF(MY_UNPACK_FILENAME|MY_REPLACE_EXT));
}
=== modified file 'sql/mysql_priv.h'
--- a/sql/mysql_priv.h 2009-03-06 22:17:00 +0000
+++ b/sql/mysql_priv.h 2009-03-18 22:01:47 +0000
@@ -1933,6 +1933,7 @@ extern uint reg_ext_length;
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
+extern char basefile_name[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 const double log_10[309];
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2009-02-23 14:53:18 +0000
+++ b/sql/mysqld.cc 2009-03-18 22:01:47 +0000
@@ -627,6 +627,7 @@ const double log_10[] = {
time_t server_start_time, flush_status_time;
char mysql_home[FN_REFLEN], pidfile_name[FN_REFLEN], system_time_zone[30];
+char basefile_name[FN_REFLEN];
char *default_tz_name;
char log_error_file[FN_REFLEN], glob_hostname[FN_REFLEN];
char mysql_real_data_home[FN_REFLEN],
@@ -3343,10 +3344,12 @@ static int init_common_variables(const c
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"));
+ strmake(basefile_name, STRING_WITH_LEN("mysql"));
}
else
- strmake(pidfile_name, glob_hostname, sizeof(pidfile_name)-5);
+ strmake(basefile_name, glob_hostname, sizeof(pidfile_name)-5);
+
+ strmake(pidfile_name, basefile_name, sizeof(basefile_name)-5);
strmov(fn_ext(pidfile_name),".pid"); // Add proper extension
/*
Attachment: [text/bzr-bundle] bzr/magne.mahre@sun.com-20090318220147-5tbmzu094960ojhv.bundle
| Thread |
|---|
| • bzr commit into mysql-6.0 branch (magne.mahre:2746) Bug#33693 | Magne Mahre | 18 Mar |