List:Commits« Previous MessageNext Message »
From:Mats Kindahl Date:November 7 2010 8:13pm
Subject:bzr push into mysql-5.5 branch (mats.kindahl:3086 to 3087) WL#5465
View as plain text  
 3087 Mats Kindahl	2010-11-04
      WL#5465: System variables: paths to relay log and binary log files
      
      Adding new variables with paths to where the binary log files
      and the relay log files are located. Three new global read-only
      variables are added and one has changed contents.
      
      log_bin_basename
        This variable hold the full path and name used for the binary
        logs: not including the extension of the files.
      
      log_bin_index
        This variable contain the full path to the binary log index
        file.
      
      relay_log_basename
        This variable hold the full path and name used for the relay
        logs: not including the extension of the files.
      
      relay_log_index
        This variable now contain the full path to the relay log
        index file.  Previously, it just contained the value supplied
        to mysqld option relay-log-index,  which was then used to
        compute the path to the index file.
     @ mysql-test/suite/binlog/t/binlog_variables_log_bin.test
        Adding test to check values of log_bin% variables
        when just --log-bin is used.
     @ mysql-test/suite/binlog/t/binlog_variables_log_bin_index.test
        Adding test to check values of log_bin% variables
        when --log-bin and --log-bin-index is used.
     @ mysql-test/suite/binlog/t/binlog_variables_relay_log.test
        Adding test to check values of relay_log% variables
        when just --relay-log is used.
     @ mysql-test/suite/binlog/t/binlog_variables_relay_log_index.test
        Adding test to check values of relay_log% variables
        when --relay-log and --relay-log-index is used.
     @ mysql-test/suite/rpl/t/rpl_variables.test
        Extending test to print value of replication file variables.
     @ mysql-test/t/flush2.test
        Extending test to also check relay_log* variables.
     @ mysql-test/t/variables-notembedded.test
        Adding check for relay_log_basename, log_bin_basename,
        and log_bin_index.
     @ sql/mysqld.cc
        Exporting opt_binlog_index_name.
     @ sql/slave.cc
        Adding variables relay_log_index and
        relay_log_basename for storing system
        variable values.
     @ sql/slave.h
        Exporting variable storing the value of log_bin_index,
        relay_log_basename, and relay_log_index.
     @ sql/sys_vars.cc
        Adding variables relay_log_basename, relay_log_index, log_bin_basename,
        and log_bin_index as non-option variables.

    added:
      mysql-test/suite/binlog/r/binlog_variables_log_bin.result
      mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result
      mysql-test/suite/binlog/r/binlog_variables_relay_log.result
      mysql-test/suite/binlog/r/binlog_variables_relay_log_index.result
      mysql-test/suite/binlog/t/binlog_variables_log_bin-master.opt
      mysql-test/suite/binlog/t/binlog_variables_log_bin.test
      mysql-test/suite/binlog/t/binlog_variables_log_bin_index-master.opt
      mysql-test/suite/binlog/t/binlog_variables_log_bin_index.test
      mysql-test/suite/binlog/t/binlog_variables_relay_log-master.opt
      mysql-test/suite/binlog/t/binlog_variables_relay_log.test
      mysql-test/suite/binlog/t/binlog_variables_relay_log_index-master.opt
      mysql-test/suite/binlog/t/binlog_variables_relay_log_index.test
    modified:
      mysql-test/r/flush2.result
      mysql-test/r/mysqld--help-notwin.result
      mysql-test/r/mysqld--help-win.result
      mysql-test/r/variables-notembedded.result
      mysql-test/suite/rpl/r/rpl_flushlog_loop.result
      mysql-test/suite/rpl/r/rpl_variables.result
      mysql-test/suite/rpl/t/rpl_variables.test
      mysql-test/suite/sys_vars/r/all_vars.result
      mysql-test/t/flush2.test
      mysql-test/t/variables-notembedded.test
      sql/log.cc
      sql/log.h
      sql/mysqld.cc
      sql/slave.cc
      sql/slave.h
      sql/sys_vars.cc
 3086 Joerg Bruehe	2010-09-19 [merge]
      Merge 5.5.6-rc to the main tree.

    modified:
      include/atomic/x86-gcc.h
      storage/perfschema/ha_perfschema.cc
=== modified file 'mysql-test/r/flush2.result'
--- a/mysql-test/r/flush2.result	2009-11-04 12:28:20 +0000
+++ b/mysql-test/r/flush2.result	2010-11-04 14:43:52 +0000
@@ -3,10 +3,32 @@ set global expire_logs_days = 3;
 show variables like 'log_bin%';
 Variable_name	Value
 log_bin	OFF
+log_bin_basename	
+log_bin_index	
 log_bin_trust_function_creators	ON
+show variables like 'relay_log%';
+Variable_name	Value
+relay_log	
+relay_log_basename	
+relay_log_index	
+relay_log_info_file	relay-log.info
+relay_log_purge	ON
+relay_log_recovery	OFF
+relay_log_space_limit	0
 flush logs;
 show variables like 'log_bin%';
 Variable_name	Value
 log_bin	OFF
+log_bin_basename	
+log_bin_index	
 log_bin_trust_function_creators	ON
+show variables like 'relay_log%';
+Variable_name	Value
+relay_log	
+relay_log_basename	
+relay_log_index	
+relay_log_info_file	relay-log.info
+relay_log_purge	ON
+relay_log_recovery	OFF
+relay_log_space_limit	0
 set global expire_logs_days = 0;

=== modified file 'mysql-test/r/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result	2010-08-30 14:07:40 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result	2010-11-04 14:43:52 +0000
@@ -218,7 +218,7 @@ The following options may be given as th
  server's hostname changes) argument should be the chosen
  location for the binary log files.
  --log-bin-index=name 
- File that holds the names for last binary log files.
+ File that holds the names for binary log files.
  --log-bin-trust-function-creators 
  If set to FALSE (the default), then when --log-bin is
  used, creation of a stored function (or trigger) is
@@ -487,8 +487,7 @@ The following options may be given as th
  are read through this buffer to avoid a disk seeks
  --relay-log=name    The location and name to use for relay logs
  --relay-log-index=name 
- The location and name to use for the file that keeps a
- list of the last relay logs
+ File that holds the names for relay log files.
  --relay-log-info-file=name 
  The location and name of the file that remembers where
  the SQL replication thread is in the relay logs

=== modified file 'mysql-test/r/mysqld--help-win.result'
--- a/mysql-test/r/mysqld--help-win.result	2010-08-30 14:07:40 +0000
+++ b/mysql-test/r/mysqld--help-win.result	2010-11-04 14:43:52 +0000
@@ -217,7 +217,7 @@ The following options may be given as th
  server's hostname changes) argument should be the chosen
  location for the binary log files.
  --log-bin-index=name 
- File that holds the names for last binary log files.
+ File that holds the names for binary log files.
  --log-bin-trust-function-creators 
  If set to FALSE (the default), then when --log-bin is
  used, creation of a stored function (or trigger) is
@@ -487,8 +487,7 @@ The following options may be given as th
  are read through this buffer to avoid a disk seeks
  --relay-log=name    The location and name to use for relay logs
  --relay-log-index=name 
- The location and name to use for the file that keeps a
- list of the last relay logs
+ File that holds the names for relay log files.
  --relay-log-info-file=name 
  The location and name of the file that remembers where
  the SQL replication thread is in the relay logs

=== modified file 'mysql-test/r/variables-notembedded.result'
--- a/mysql-test/r/variables-notembedded.result	2009-04-06 11:42:33 +0000
+++ b/mysql-test/r/variables-notembedded.result	2010-11-04 14:43:52 +0000
@@ -44,6 +44,32 @@ ERROR HY000: Variable 'relay_log' is a r
 SET @@global.relay_log= 'x';
 ERROR HY000: Variable 'relay_log' is a read only variable
 #
+SHOW VARIABLES like 'relay_log_basename';
+Variable_name	Value
+relay_log_basename	
+SELECT @@session.relay_log_basename;
+ERROR HY000: Variable 'relay_log_basename' is a GLOBAL variable
+SELECT @@global.relay_log_basename;
+@@global.relay_log_basename
+NULL
+SET @@session.relay_log_basename= 'x';
+ERROR HY000: Variable 'relay_log_basename' is a read only variable
+SET @@global.relay_log_basename= 'x';
+ERROR HY000: Variable 'relay_log_basename' is a read only variable
+#
+SHOW VARIABLES like 'log_bin_basename';
+Variable_name	Value
+log_bin_basename	
+SELECT @@session.log_bin_basename;
+ERROR HY000: Variable 'log_bin_basename' is a GLOBAL variable
+SELECT @@global.log_bin_basename;
+@@global.log_bin_basename
+NULL
+SET @@session.log_bin_basename= 'x';
+ERROR HY000: Variable 'log_bin_basename' is a read only variable
+SET @@global.log_bin_basename= 'x';
+ERROR HY000: Variable 'log_bin_basename' is a read only variable
+#
 SHOW VARIABLES like 'relay_log_index';
 Variable_name	Value
 relay_log_index	
@@ -57,6 +83,19 @@ ERROR HY000: Variable 'relay_log_index' 
 SET @@global.relay_log_index= 'x';
 ERROR HY000: Variable 'relay_log_index' is a read only variable
 #
+SHOW VARIABLES like 'log_bin_index';
+Variable_name	Value
+log_bin_index	
+SELECT @@session.log_bin_index;
+ERROR HY000: Variable 'log_bin_index' is a GLOBAL variable
+SELECT @@global.log_bin_index;
+@@global.log_bin_index
+NULL
+SET @@session.log_bin_index= 'x';
+ERROR HY000: Variable 'log_bin_index' is a read only variable
+SET @@global.log_bin_index= 'x';
+ERROR HY000: Variable 'log_bin_index' is a read only variable
+#
 SHOW VARIABLES like 'relay_log_info_file';
 Variable_name	Value
 relay_log_info_file	relay-log.info

=== added file 'mysql-test/suite/binlog/r/binlog_variables_log_bin.result'
--- a/mysql-test/suite/binlog/r/binlog_variables_log_bin.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/r/binlog_variables_log_bin.result	2010-11-04 14:43:52 +0000
@@ -0,0 +1,9 @@
+SHOW VARIABLES LIKE 'log_bin%';
+Variable_name	log_bin
+Value	ON
+Variable_name	log_bin_basename
+Value	MYSQLTEST_VARDIR/mysqld.1/data/other
+Variable_name	log_bin_index
+Value	MYSQLTEST_VARDIR/mysqld.1/data/other.index
+Variable_name	log_bin_trust_function_creators
+Value	ON

=== added file 'mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result'
--- a/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/r/binlog_variables_log_bin_index.result	2010-11-04 14:43:52 +0000
@@ -0,0 +1,9 @@
+SHOW VARIABLES LIKE 'log_bin%';
+Variable_name	log_bin
+Value	ON
+Variable_name	log_bin_basename
+Value	MYSQLTEST_VARDIR/mysqld.1/data/other
+Variable_name	log_bin_index
+Value	MYSQLTEST_VARDIR/tmp/something.index
+Variable_name	log_bin_trust_function_creators
+Value	ON

=== added file 'mysql-test/suite/binlog/r/binlog_variables_relay_log.result'
--- a/mysql-test/suite/binlog/r/binlog_variables_relay_log.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/r/binlog_variables_relay_log.result	2010-11-04 14:43:52 +0000
@@ -0,0 +1,15 @@
+SHOW VARIABLES LIKE 'relay_log%';
+Variable_name	relay_log
+Value	other-relay
+Variable_name	relay_log_basename
+Value	MYSQLTEST_VARDIR/mysqld.1/data/other-relay
+Variable_name	relay_log_index
+Value	MYSQLTEST_VARDIR/mysqld.1/data/other-relay.index
+Variable_name	relay_log_info_file
+Value	relay-log.info
+Variable_name	relay_log_purge
+Value	ON
+Variable_name	relay_log_recovery
+Value	OFF
+Variable_name	relay_log_space_limit
+Value	0

=== added file 'mysql-test/suite/binlog/r/binlog_variables_relay_log_index.result'
--- a/mysql-test/suite/binlog/r/binlog_variables_relay_log_index.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/r/binlog_variables_relay_log_index.result	2010-11-04 14:43:52 +0000
@@ -0,0 +1,15 @@
+SHOW VARIABLES LIKE 'relay_log%';
+Variable_name	relay_log
+Value	other-relay
+Variable_name	relay_log_basename
+Value	MYSQLTEST_VARDIR/mysqld.1/data/other-relay
+Variable_name	relay_log_index
+Value	MYSQLTEST_VARDIR/tmp/something-relay.index
+Variable_name	relay_log_info_file
+Value	relay-log.info
+Variable_name	relay_log_purge
+Value	ON
+Variable_name	relay_log_recovery
+Value	OFF
+Variable_name	relay_log_space_limit
+Value	0

=== added file 'mysql-test/suite/binlog/t/binlog_variables_log_bin-master.opt'
--- a/mysql-test/suite/binlog/t/binlog_variables_log_bin-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_variables_log_bin-master.opt	2010-11-04 14:43:52 +0000
@@ -0,0 +1 @@
+--log-bin=other
\ No newline at end of file

=== added file 'mysql-test/suite/binlog/t/binlog_variables_log_bin.test'
--- a/mysql-test/suite/binlog/t/binlog_variables_log_bin.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_variables_log_bin.test	2010-11-04 14:43:52 +0000
@@ -0,0 +1,4 @@
+--source include/not_embedded.inc
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--query_vertical SHOW VARIABLES LIKE 'log_bin%'

=== added file 'mysql-test/suite/binlog/t/binlog_variables_log_bin_index-master.opt'
--- a/mysql-test/suite/binlog/t/binlog_variables_log_bin_index-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_variables_log_bin_index-master.opt	2010-11-04 14:43:52 +0000
@@ -0,0 +1,2 @@
+--log-bin=other
+--log-bin-index=$MYSQLTEST_VARDIR/tmp/something.index

=== added file 'mysql-test/suite/binlog/t/binlog_variables_log_bin_index.test'
--- a/mysql-test/suite/binlog/t/binlog_variables_log_bin_index.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_variables_log_bin_index.test	2010-11-04 14:43:52 +0000
@@ -0,0 +1,4 @@
+--source include/not_embedded.inc
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--query_vertical SHOW VARIABLES LIKE 'log_bin%'

=== added file 'mysql-test/suite/binlog/t/binlog_variables_relay_log-master.opt'
--- a/mysql-test/suite/binlog/t/binlog_variables_relay_log-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_variables_relay_log-master.opt	2010-11-04 14:43:52 +0000
@@ -0,0 +1 @@
+--relay-log=other-relay
\ No newline at end of file

=== added file 'mysql-test/suite/binlog/t/binlog_variables_relay_log.test'
--- a/mysql-test/suite/binlog/t/binlog_variables_relay_log.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_variables_relay_log.test	2010-11-04 14:43:52 +0000
@@ -0,0 +1,4 @@
+--source include/not_embedded.inc
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--query_vertical SHOW VARIABLES LIKE 'relay_log%'

=== added file 'mysql-test/suite/binlog/t/binlog_variables_relay_log_index-master.opt'
--- a/mysql-test/suite/binlog/t/binlog_variables_relay_log_index-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_variables_relay_log_index-master.opt	2010-11-04 14:43:52 +0000
@@ -0,0 +1,2 @@
+--relay-log=other-relay
+--relay-log-index=$MYSQLTEST_VARDIR/tmp/something-relay.index
\ No newline at end of file

=== added file 'mysql-test/suite/binlog/t/binlog_variables_relay_log_index.test'
--- a/mysql-test/suite/binlog/t/binlog_variables_relay_log_index.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/binlog/t/binlog_variables_relay_log_index.test	2010-11-04 14:43:52 +0000
@@ -0,0 +1,4 @@
+--source include/not_embedded.inc
+
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--query_vertical SHOW VARIABLES LIKE 'relay_log%'

=== modified file 'mysql-test/suite/rpl/r/rpl_flushlog_loop.result'
--- a/mysql-test/suite/rpl/r/rpl_flushlog_loop.result	2010-05-26 14:34:25 +0000
+++ b/mysql-test/suite/rpl/r/rpl_flushlog_loop.result	2010-11-04 14:43:52 +0000
@@ -7,7 +7,8 @@ start slave;
 show variables like 'relay_log%';
 Variable_name	Value
 relay_log	MYSQLD_DATADIR/relay-log
-relay_log_index	
+relay_log_basename	MYSQLD_DATADIR/relay-log
+relay_log_index	MYSQLD_DATADIR/relay-log.index
 relay_log_info_file	relay-log.info
 relay_log_purge	ON
 relay_log_recovery	OFF

=== modified file 'mysql-test/suite/rpl/r/rpl_variables.result'
--- a/mysql-test/suite/rpl/r/rpl_variables.result	2008-08-14 09:38:22 +0000
+++ b/mysql-test/suite/rpl/r/rpl_variables.result	2010-11-04 14:43:52 +0000
@@ -47,6 +47,34 @@ include/start_slave.inc
 [on slave]
 SET @@global.init_slave = 'SELECT 1';
 [on master]
+SELECT @@pid_file, @@datadir;
+@@pid_file	MYSQLTEST_VARDIR/run/mysqld.1.pid
+@@datadir	MYSQLTEST_VARDIR/mysqld.1/data/
+**** Relay log variables
+SELECT @@relay_log, @@relay_log_index, @@relay_log_basename;
+@@relay_log	NULL
+@@relay_log_index	NULL
+@@relay_log_basename	NULL
+**** Binary log variables
+SELECT @@log_bin, @@log_bin_index, @@log_bin_basename;
+@@log_bin	1
+@@log_bin_index	MYSQLTEST_VARDIR/mysqld.1/data/master-bin.index
+@@log_bin_basename	MYSQLTEST_VARDIR/mysqld.1/data/master-bin
+[on slave]
+SELECT @@pid_file, @@datadir;
+@@pid_file	MYSQLTEST_VARDIR/run/mysqld.2.pid
+@@datadir	MYSQLTEST_VARDIR/mysqld.2/data/
+**** Relay log variables
+SELECT @@relay_log, @@relay_log_index, @@relay_log_basename;
+@@relay_log	slave-relay-bin
+@@relay_log_index	MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin.index
+@@relay_log_basename	MYSQLTEST_VARDIR/mysqld.2/data/slave-relay-bin
+**** Binary log variables
+SELECT @@log_bin, @@log_bin_index, @@log_bin_basename;
+@@log_bin	1
+@@log_bin_index	MYSQLTEST_VARDIR/mysqld.2/data/slave-bin.index
+@@log_bin_basename	MYSQLTEST_VARDIR/mysqld.2/data/slave-bin
+[on master]
 CREATE TABLE tstmt (id INT AUTO_INCREMENT PRIMARY KEY,
 truth BOOLEAN,
 num INT,

=== modified file 'mysql-test/suite/rpl/t/rpl_variables.test'
--- a/mysql-test/suite/rpl/t/rpl_variables.test	2008-07-17 16:26:59 +0000
+++ b/mysql-test/suite/rpl/t/rpl_variables.test	2010-11-04 14:43:52 +0000
@@ -122,6 +122,30 @@ SET @@global.init_slave = 'SELECT 1';
 
 --echo [on master]
 connection master;
+# checking values of read-only variables
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+query_vertical SELECT @@pid_file, @@datadir;
+--echo **** Relay log variables
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+query_vertical SELECT @@relay_log, @@relay_log_index, @@relay_log_basename;
+--echo **** Binary log variables
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+query_vertical SELECT @@log_bin, @@log_bin_index, @@log_bin_basename;
+
+--echo [on slave]
+connection slave;
+# checking values of read-only variables
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+query_vertical SELECT @@pid_file, @@datadir;
+--echo **** Relay log variables
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+query_vertical SELECT @@relay_log, @@relay_log_index, @@relay_log_basename;
+--echo **** Binary log variables
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+query_vertical SELECT @@log_bin, @@log_bin_index, @@log_bin_basename;
+
+--echo [on master]
+connection master;
 
 # Tables where everything happens.
 CREATE TABLE tstmt (id INT AUTO_INCREMENT PRIMARY KEY,

=== modified file 'mysql-test/suite/sys_vars/r/all_vars.result'
--- a/mysql-test/suite/sys_vars/r/all_vars.result	2010-06-17 09:13:53 +0000
+++ b/mysql-test/suite/sys_vars/r/all_vars.result	2010-11-04 14:43:52 +0000
@@ -10,7 +10,13 @@ There should be *no* long test name list
 select variable_name as `There should be *no* variables listed below:` from t2
 left join t1 on variable_name=test_name where test_name is null;
 There should be *no* variables listed below:
+RELAY_LOG_BASENAME
+LOG_BIN_BASENAME
+LOG_BIN_INDEX
 INNODB_FILE_FORMAT_MAX
+RELAY_LOG_BASENAME
+LOG_BIN_BASENAME
+LOG_BIN_INDEX
 INNODB_FILE_FORMAT_MAX
 drop table t1;
 drop table t2;

=== modified file 'mysql-test/t/flush2.test'
--- a/mysql-test/t/flush2.test	2007-03-23 11:36:07 +0000
+++ b/mysql-test/t/flush2.test	2010-11-04 14:43:52 +0000
@@ -4,6 +4,8 @@
 flush logs;
 set global expire_logs_days = 3;
 show variables like 'log_bin%';
+show variables like 'relay_log%';
 flush logs;
 show variables like 'log_bin%';
+show variables like 'relay_log%';
 set global expire_logs_days = 0;

=== modified file 'mysql-test/t/variables-notembedded.test'
--- a/mysql-test/t/variables-notembedded.test	2008-12-13 19:42:12 +0000
+++ b/mysql-test/t/variables-notembedded.test	2010-11-04 14:43:52 +0000
@@ -58,6 +58,26 @@ SET @@session.relay_log= 'x';
 SET @@global.relay_log= 'x';
 #
 --echo #
+SHOW VARIABLES like 'relay_log_basename';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.relay_log_basename;
+SELECT @@global.relay_log_basename;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.relay_log_basename= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.relay_log_basename= 'x';
+#
+--echo #
+SHOW VARIABLES like 'log_bin_basename';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.log_bin_basename;
+SELECT @@global.log_bin_basename;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.log_bin_basename= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.log_bin_basename= 'x';
+#
+--echo #
 SHOW VARIABLES like 'relay_log_index';
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 SELECT @@session.relay_log_index;
@@ -68,6 +88,16 @@ SET @@session.relay_log_index= 'x';
 SET @@global.relay_log_index= 'x';
 #
 --echo #
+SHOW VARIABLES like 'log_bin_index';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.log_bin_index;
+SELECT @@global.log_bin_index;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@session.log_bin_index= 'x';
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@global.log_bin_index= 'x';
+#
+--echo #
 SHOW VARIABLES like 'relay_log_info_file';
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 SELECT @@session.relay_log_info_file;

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2010-08-30 08:36:02 +0000
+++ b/sql/log.cc	2010-11-04 14:43:52 +0000
@@ -59,6 +59,9 @@
 
 LOGGER logger;
 
+const char *log_bin_index= 0;
+const char *log_bin_basename= 0;
+
 MYSQL_BIN_LOG mysql_bin_log(&sync_binlog_period);
 
 static bool test_if_number(const char *str,

=== modified file 'sql/log.h'
--- a/sql/log.h	2010-08-20 11:22:46 +0000
+++ b/sql/log.h	2010-11-04 14:43:52 +0000
@@ -31,6 +31,9 @@ bool ending_single_stmt_trans(THD* thd, 
 bool trans_has_updated_non_trans_table(const THD* thd);
 bool stmt_has_updated_non_trans_table(const THD* thd);
 
+extern const char *log_bin_index;
+extern const char *log_bin_basename;
+
 /*
   Transaction Coordinator log - a base abstract class
   for two different implementations

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2010-08-30 14:07:40 +0000
+++ b/sql/mysqld.cc	2010-11-04 14:43:52 +0000
@@ -656,7 +656,8 @@ static my_bool opt_do_pstack;
 static my_bool opt_bootstrap, opt_myisam_log;
 static int cleanup_done;
 static ulong opt_specialflag;
-static char *opt_update_logname, *opt_binlog_index_name;
+static char *opt_update_logname;
+char *opt_binlog_index_name;
 char *mysql_home_ptr, *pidfile_name_ptr;
 /** Initial command line arguments (count), after load_defaults().*/
 static int defaults_argc;
@@ -3080,6 +3081,34 @@ static inline char *make_default_log_nam
   return make_log_name(buff, default_logfile_name, log_ext);
 }
 
+/**
+  Create a replication file name or base for file names.
+
+  @param[in] opt Value of option, or NULL
+  @param[in] def Default value if option value is not set.
+  @param[in] ext Extension to use for the path
+
+  @returns Pointer to string containing the full file path, or NULL if
+  it was not possible to create the path.
+ */
+static inline const char *
+rpl_make_log_name(const char *opt,
+                  const char *def,
+                  const char *ext)
+{
+  DBUG_ENTER("rpl_make_log_name");
+  DBUG_PRINT("enter", ("opt: %s, def: %s, ext: %s", opt, def, ext));
+  char buff[FN_REFLEN];
+  const char *base= opt ? opt : def;
+  unsigned int options=
+    MY_REPLACE_EXT | MY_UNPACK_FILENAME | MY_SAFE_PATH;
+  if (fn_format(buff, base, mysql_real_data_home_ptr, ext, options))
+    DBUG_RETURN(strdup(buff));
+  else
+    DBUG_RETURN(NULL);
+}
+
+
 static int init_common_variables()
 {
   char buff[FN_REFLEN];
@@ -3147,6 +3176,7 @@ static int init_common_variables()
   strmake(pidfile_name, default_logfile_name, sizeof(pidfile_name)-5);
   strmov(fn_ext(pidfile_name),".pid");		// Add proper extension
 
+  
   /*
     The default-storage-engine entry in my_long_options should have a
     non-null default value. It was earlier intialized as
@@ -3865,6 +3895,45 @@ a file name for --log-bin-index option",
     }
   }
 
+  if (opt_bin_log)
+  {
+    log_bin_basename=
+      rpl_make_log_name(opt_bin_logname, pidfile_name,
+                        opt_bin_logname ? "" : "-bin");
+    log_bin_index=
+      rpl_make_log_name(opt_binlog_index_name, log_bin_basename, ".index");
+    if (log_bin_basename == NULL || log_bin_index == NULL)
+    {
+      sql_print_error("Unable to create replication path names:"
+                      " out of memory or path names too long"
+                      " (path name exceeds " STRINGIFY_ARG(FN_REFLEN)
+                      " or file name exceeds " STRINGIFY_ARG(FN_LEN) ").");
+      unireg_abort(1);
+    }
+  }
+
+#ifndef EMBEDDED_LIBRARY
+  DBUG_PRINT("debug",
+             ("opt_bin_logname: %s, opt_relay_logname: %s, pidfile_name: %s",
+              opt_bin_logname, opt_relay_logname, pidfile_name));
+  if (opt_relay_logname)
+  {
+    relay_log_basename=
+      rpl_make_log_name(opt_relay_logname, pidfile_name,
+                        opt_relay_logname ? "" : "-relay-bin");
+    relay_log_index=
+      rpl_make_log_name(opt_relaylog_index_name, relay_log_basename, ".index");
+    if (relay_log_basename == NULL || relay_log_index == NULL)
+    {
+      sql_print_error("Unable to create replication path names:"
+                      " out of memory or path names too long"
+                      " (path name exceeds " STRINGIFY_ARG(FN_REFLEN)
+                      " or file name exceeds " STRINGIFY_ARG(FN_LEN) ").");
+      unireg_abort(1);
+    }
+  }
+#endif /* !EMBEDDED_LIBRARY */
+
   /* call ha_init_key_cache() on all key caches to init them */
   process_key_caches(&ha_init_key_cache);
 
@@ -5778,9 +5847,13 @@ struct my_option my_long_options[]=
    &opt_bin_logname, &opt_bin_logname, 0, GET_STR_ALLOC,
    OPT_ARG, 0, 0, 0, 0, 0, 0},
   {"log-bin-index", 0,
-   "File that holds the names for last binary log files.",
+   "File that holds the names for binary log files.",
    &opt_binlog_index_name, &opt_binlog_index_name, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"relay-log-index", 0,
+   "File that holds the names for relay log files.",
+   &opt_relaylog_index_name, &opt_relaylog_index_name, 0, GET_STR,
+   REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"log-isam", OPT_ISAM_LOG, "Log all MyISAM changes to file.",
    &myisam_log_filename, &myisam_log_filename, 0, GET_STR,
    OPT_ARG, 0, 0, 0, 0, 0, 0},

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2010-07-29 12:32:11 +0000
+++ b/sql/slave.cc	2010-11-04 14:43:52 +0000
@@ -75,6 +75,9 @@ Master_info *active_mi= 0;
 my_bool replicate_same_server_id;
 ulonglong relay_log_space_limit = 0;
 
+const char *relay_log_index= 0;
+const char *relay_log_basename= 0;
+
 /*
   When slave thread exits, we need to remember the temporary tables so we
   can re-use them on slave start.

=== modified file 'sql/slave.h'
--- a/sql/slave.h	2010-03-31 14:05:33 +0000
+++ b/sql/slave.h	2010-11-04 14:43:52 +0000
@@ -113,11 +113,15 @@ extern bool use_slave_mask;
 extern char *slave_load_tmpdir;
 extern char *master_info_file, *relay_log_info_file;
 extern char *opt_relay_logname, *opt_relaylog_index_name;
+extern char *opt_binlog_index_name;
 extern my_bool opt_skip_slave_start, opt_reckless_slave;
 extern my_bool opt_log_slave_updates;
 extern char *opt_slave_skip_errors;
 extern ulonglong relay_log_space_limit;
 
+extern const char *relay_log_index;
+extern const char *relay_log_basename;
+
 /*
   3 possible values for Master_info::slave_running and
   Relay_log_info::slave_running.

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2010-08-30 14:07:40 +0000
+++ b/sql/sys_vars.cc	2010-11-04 14:43:52 +0000
@@ -2897,10 +2897,37 @@ static Sys_var_charptr Sys_relay_log(
        READ_ONLY GLOBAL_VAR(opt_relay_logname), CMD_LINE(REQUIRED_ARG),
        IN_FS_CHARSET, DEFAULT(0));
 
+/*
+  Uses NO_CMD_LINE since the --relay-log-index option set
+  opt_relaylog_index_name variable and computes a value for the
+  relay_log_index variable.
+*/
 static Sys_var_charptr Sys_relay_log_index(
        "relay_log_index", "The location and name to use for the file "
        "that keeps a list of the last relay logs",
-       READ_ONLY GLOBAL_VAR(opt_relaylog_index_name), CMD_LINE(REQUIRED_ARG),
+       READ_ONLY GLOBAL_VAR(relay_log_index), NO_CMD_LINE,
+       IN_FS_CHARSET, DEFAULT(0));
+
+/*
+  Uses NO_CMD_LINE since the --log-bin-index option set
+  opt_binlog_index_name variable and computes a value for the
+  log_bin_index variable.
+*/
+static Sys_var_charptr Sys_binlog_index(
+       "log_bin_index", "File that holds the names for last binary log files.",
+       READ_ONLY GLOBAL_VAR(log_bin_index), NO_CMD_LINE,
+       IN_FS_CHARSET, DEFAULT(0));
+
+static Sys_var_charptr Sys_relay_log_basename(
+       "relay_log_basename",
+       "The full path of the relay log file names, excluding the extension.",
+       READ_ONLY GLOBAL_VAR(relay_log_basename), NO_CMD_LINE,
+       IN_FS_CHARSET, DEFAULT(0));
+
+static Sys_var_charptr Sys_log_bin_basename(
+       "log_bin_basename",
+       "The full path of the binary log file names, excluding the extension.",
+       READ_ONLY GLOBAL_VAR(log_bin_basename), NO_CMD_LINE,
        IN_FS_CHARSET, DEFAULT(0));
 
 static Sys_var_charptr Sys_relay_log_info_file(


Attachment: [text/bzr-bundle] bzr/mats.kindahl@oracle.com-20101104144352-z7dy7e46jlexdfnw.bundle
Thread
bzr push into mysql-5.5 branch (mats.kindahl:3086 to 3087) WL#5465Mats Kindahl7 Nov