List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:November 29 2010 2:39pm
Subject:bzr commit into mysql-5.5-telco-7.0 branch (magnus.blaudd:3128)
View as plain text  
#At file:///data0/magnus/mysql/5.5-telco-7.0/ based on revid:magnus.blaudd@stripped

 3128 Magnus Blåudd	2010-11-29 [merge]
      Merge 5.5-telco -> 5.5-telco-7.0

    added:
      mysql-test/suite/rpl/t/rpl_change_master_bind.inc
    modified:
      mysql-test/include/mysqld--help.inc
      mysql-test/suite/rpl/r/rpl_change_master.result
      mysql-test/suite/rpl/t/rpl_change_master.test
      mysql-test/suite/sys_vars/r/shared_memory_base_name_basic.result
      mysql-test/suite/sys_vars/t/shared_memory_base_name_basic.test
      sql/lex.h
      sql/mysqld.h
      sql/rpl_mi.cc
      sql/rpl_mi.h
      sql/slave.cc
      sql/sql_lex.h
      sql/sql_repl.cc
      sql/sql_show.cc
      sql/sql_yacc.yy
      sql/sys_vars.cc
=== modified file 'mysql-test/include/mysqld--help.inc'
--- a/mysql-test/include/mysqld--help.inc	2010-09-30 13:52:39 +0000
+++ b/mysql-test/include/mysqld--help.inc	2010-11-25 15:16:08 +0000
@@ -24,6 +24,8 @@ perl;
   @plugins=qw/innodb ndb archive blackhole federated partition ndbcluster debug temp-pool ssl des-key-file
               thread-concurrency super-large-pages mutex-deadlock-detector null-audit/;
 
+  push(@plugins, 'server-id-bits'); # MCP_BUG53205, variable may not be there
+
   # And substitute the content some environment variables with their
   # names:
   @env=qw/MYSQLTEST_VARDIR MYSQL_TEST_DIR MYSQL_LIBDIR MYSQL_CHARSETSDIR MYSQL_SHAREDIR/;

=== modified file 'mysql-test/suite/rpl/r/rpl_change_master.result'
--- a/mysql-test/suite/rpl/r/rpl_change_master.result	2010-10-27 11:32:32 +0000
+++ b/mysql-test/suite/rpl/r/rpl_change_master.result	2010-11-29 14:38:44 +0000
@@ -35,3 +35,31 @@ start slave sql_thread;
 start slave io_thread;
 set global relay_log_purge=1;
 drop table t1;
+include/stop_slave.inc
+create table t1(n int, b varchar(256));
+insert into t1 values(1, <master_bind>);
+change master to master_host=<master_bind>, master_bind=<master_bind>;
+start slave;
+drop table t1;
+include/stop_slave.inc
+create table t1(n int, b varchar(256));
+insert into t1 values(1, <master_bind>);
+change master to  master_bind=<master_bind>;
+start slave;
+got expected error 2003
+include/stop_slave.inc
+change master to master_bind='';
+start slave;
+drop table t1;
+include/stop_slave.inc
+create table t1(n int, b varchar(256));
+insert into t1 values(1, <master_bind>);
+change master to master_host=<master_bind>, master_bind=<master_bind>;
+start slave;
+drop table t1;
+include/stop_slave.inc
+create table t1(n int, b varchar(256));
+insert into t1 values(1, <master_bind>);
+change master to  master_bind=<master_bind>;
+start slave;
+drop table t1;

=== modified file 'mysql-test/suite/rpl/t/rpl_change_master.test'
--- a/mysql-test/suite/rpl/t/rpl_change_master.test	2010-10-27 11:32:32 +0000
+++ b/mysql-test/suite/rpl/t/rpl_change_master.test	2010-11-29 14:38:44 +0000
@@ -100,3 +100,53 @@ eval set global relay_log_purge=$relay_l
 connection master;
 drop table t1;
 sync_slave_with_master;
+
+#
+# WL#3127 slave side TCP address binding
+# - CHANGE MASTER ... MASTER_BIND='interface'
+# - SHOW SLAVE STATUS has new column Master_Bind
+#
+
+# Check if ipv6 is available.
+--disable_query_log
+--disable_result_log
+--disable_abort_on_error
+connect (checkcon123456789,::1,root,,test);
+let $check_ipv6_supported=1;
+let $_need_disconnect=1;
+if($mysql_errno)
+{
+  let $check_ipv6_supported=0;
+  let $_need_disconnect=0;
+}
+connection default;
+if ($_need_disconnect)
+{
+  disconnect checkcon123456789;
+}
+--enable_abort_on_error
+--enable_result_log
+--enable_query_log
+
+# Test valid IPv4 address
+let $master_bind='127.0.0.1';
+--source rpl_change_master_bind.inc
+
+# Test invalid IPv4 address
+let $master_bind='1.1.1.1';
+let $master_bind_error_expected=2003;
+--source rpl_change_master_bind.inc
+let $master_bind_error_expected=0;
+
+# Test valid IPv6 address
+let $master_bind='::1';
+if (!$check_ipv6_supported)
+{
+  # No IPv6 support, fallback to IPv4
+  let $master_bind='127.0.0.1';
+}
+--source rpl_change_master_bind.inc
+
+# Test with no bind address(check that reset works)
+let $master_bind='';
+--source rpl_change_master_bind.inc

=== added file 'mysql-test/suite/rpl/t/rpl_change_master_bind.inc'
--- a/mysql-test/suite/rpl/t/rpl_change_master_bind.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_change_master_bind.inc	2010-11-26 14:02:56 +0000
@@ -0,0 +1,78 @@
+#
+# Test CHANGE MASTER MASTER_BIND=xxx
+#
+# Parameters:
+#  $master_bind - the address to use for MASTER_BIND
+#  $master_bind_error_expected - expect an error when using the specified
+#                                master_bind address
+#
+#
+
+# Stop the slave
+connection slave;
+source include/stop_slave.inc;
+
+# Create table and insert one record with the bind address on master
+connection master;
+create table t1(n int, b varchar(256));
+--replace_result $master_bind <master_bind>
+eval insert into t1 values(1, $master_bind);
+
+# Configure slave to connect to master with the give bind address
+connection slave;
+let $_master_host=;
+if (!$master_bind_error_expected)
+{
+  if (`select $master_bind != ''`)
+  {
+    let $_master_host=master_host=$master_bind,;
+  }
+}
+
+--replace_result $master_bind <master_bind>
+eval change master to $_master_host master_bind=$master_bind;
+start slave;
+
+# Check that SHOW SLAVE STATUS has Master_bind column set to $master_bind
+let $master_bind_value= query_get_value(SHOW SLAVE STATUS, Master_Bind, 1);
+if (`select '$master_bind_value' != $master_bind`)
+{
+  source include/show_rpl_debug_info.inc;
+  echo 'master_bind_value: $master_bind_value' != 'master_bind: $master_bind';
+  die Master_bind in SHOW SLAVE STAUS not showing configured value;
+}
+
+if ($master_bind_error_expected)
+{
+  # The given master bind address is not valid
+  # and replication should fail
+  let $slave_io_errno= $master_bind_error_expected;
+  source include/wait_for_slave_io_error.inc;
+  echo got expected error $master_bind_error_expected;
+  source include/stop_slave.inc;
+
+  # Reset the master_bind so that cleanup can run
+  eval change master to master_bind='';
+  start slave;
+
+}
+
+source include/wait_for_slave_to_start.inc;
+
+connection master;
+sync_slave_with_master;
+
+connection slave;
+let $master_bind_repl= query_get_value(select b from t1, b, 1);
+if (`select '$master_bind_repl' != $master_bind`)
+{
+  select * from t1;
+  source include/show_rpl_debug_info.inc;
+  echo 'master_bind_repl: $master_bind_repl' != 'master_bind: $master_bind';
+  die The replicated value to show replication working was not correct;
+}
+
+# Clean up
+connection master;
+drop table t1;
+sync_slave_with_master;

=== modified file 'mysql-test/suite/sys_vars/r/shared_memory_base_name_basic.result'
--- a/mysql-test/suite/sys_vars/r/shared_memory_base_name_basic.result	2009-12-22 09:35:56 +0000
+++ b/mysql-test/suite/sys_vars/r/shared_memory_base_name_basic.result	2010-11-26 12:18:00 +0000
@@ -1,20 +1,20 @@
 select @@global.shared_memory_base_name;
 @@global.shared_memory_base_name
-MYSQLTEST_VARDIR/tmp/mysqld.1.sock
+MYSQL_TMP_DIR/mysqld.1.sock
 select @@session.shared_memory_base_name;
 ERROR HY000: Variable 'shared_memory_base_name' is a GLOBAL variable
 show global variables like 'shared_memory_base_name';
 Variable_name	Value
-shared_memory_base_name	MYSQLTEST_VARDIR/tmp/mysqld.1.sock
+shared_memory_base_name	MYSQL_TMP_DIR/mysqld.1.sock
 show session variables like 'shared_memory_base_name';
 Variable_name	Value
-shared_memory_base_name	MYSQLTEST_VARDIR/tmp/mysqld.1.sock
+shared_memory_base_name	MYSQL_TMP_DIR/mysqld.1.sock
 select * from information_schema.global_variables where variable_name='shared_memory_base_name';
 VARIABLE_NAME	VARIABLE_VALUE
-SHARED_MEMORY_BASE_NAME	MYSQLTEST_VARDIR/tmp/mysqld.1.sock
+SHARED_MEMORY_BASE_NAME	MYSQL_TMP_DIR/mysqld.1.sock
 select * from information_schema.session_variables where variable_name='shared_memory_base_name';
 VARIABLE_NAME	VARIABLE_VALUE
-SHARED_MEMORY_BASE_NAME	MYSQLTEST_VARDIR/tmp/mysqld.1.sock
+SHARED_MEMORY_BASE_NAME	MYSQL_TMP_DIR/mysqld.1.sock
 set global shared_memory_base_name=1;
 ERROR HY000: Variable 'shared_memory_base_name' is a read only variable
 set session shared_memory_base_name=1;

=== modified file 'mysql-test/suite/sys_vars/t/shared_memory_base_name_basic.test'
--- a/mysql-test/suite/sys_vars/t/shared_memory_base_name_basic.test	2010-02-21 14:10:52 +0000
+++ b/mysql-test/suite/sys_vars/t/shared_memory_base_name_basic.test	2010-11-26 12:18:00 +0000
@@ -3,17 +3,17 @@
 #
 # only global
 #
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
 select @@global.shared_memory_base_name;
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 select @@session.shared_memory_base_name;
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
 show global variables like 'shared_memory_base_name';
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
 show session variables like 'shared_memory_base_name';
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
 select * from information_schema.global_variables where variable_name='shared_memory_base_name';
---replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
 select * from information_schema.session_variables where variable_name='shared_memory_base_name';
 
 #

=== modified file 'sql/lex.h'
--- a/sql/lex.h	2010-11-16 12:37:26 +0000
+++ b/sql/lex.h	2010-11-29 14:38:44 +0000
@@ -315,6 +315,9 @@ static SYMBOL symbols[] = {
   { "LOOP",             SYM(LOOP_SYM)},
   { "LOW_PRIORITY",	SYM(LOW_PRIORITY)},
   { "MASTER",           SYM(MASTER_SYM)},
+#ifndef MCP_WL3127
+  { "MASTER_BIND",      SYM(MASTER_BIND_SYM)},
+#endif
   { "MASTER_CONNECT_RETRY",           SYM(MASTER_CONNECT_RETRY_SYM)},
   { "MASTER_HOST",           SYM(MASTER_HOST_SYM)},
   { "MASTER_LOG_FILE",           SYM(MASTER_LOG_FILE_SYM)},

=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h	2010-10-22 07:42:27 +0000
+++ b/sql/mysqld.h	2010-11-25 15:15:07 +0000
@@ -179,9 +179,6 @@ extern ulong rpl_recovery_rank, thread_c
 extern ulong back_log;
 extern char language[FN_REFLEN];
 extern ulong server_id, concurrency;
-#ifndef MCP_BUG53205
-extern uint opt_server_id_bits;
-#endif
 extern time_t server_start_time, flush_status_time;
 extern char *opt_mysql_tmpdir, mysql_charsets_dir[];
 extern int mysql_unpacked_real_data_home_len;

=== modified file 'sql/rpl_mi.cc'
--- a/sql/rpl_mi.cc	2010-10-27 11:32:32 +0000
+++ b/sql/rpl_mi.cc	2010-11-29 14:38:44 +0000
@@ -54,6 +54,9 @@ Master_info::Master_info(bool is_slave_r
 #ifndef MCP_WL4080
   master_epoch= 0;
 #endif
+#ifndef MCP_WL3127
+  bind_addr[0] = 0;
+#endif
 }
 
 Master_info::~Master_info()
@@ -268,7 +271,10 @@ file '%s')", fname);
     int ssl= 0, ssl_verify_server_cert= 0;
     float master_heartbeat_period= 0.0;
     char *first_non_digit;
+#ifndef MCP_WL3127
+#else
     char dummy_buf[HOSTNAME_LENGTH+1];
+#endif
 
     /*
        Starting from 4.1.x master.info has new format. Now its
@@ -362,7 +368,12 @@ file '%s')", fname);
 	(this is just a reservation to avoid future upgrade problems) 
        */
       if (lines >= LINE_FOR_MASTER_BIND &&
+#ifndef MCP_WL3127
+          init_strvar_from_file(mi->bind_addr, sizeof(mi->bind_addr),
+                                &mi->file, ""))
+#else
 	  init_strvar_from_file(dummy_buf, sizeof(dummy_buf), &mi->file, ""))
+#endif
 	  goto errwithmsg;
       /*
         Starting from 6.0 list of server_id of ignorable servers might be
@@ -520,7 +531,11 @@ int flush_master_info(Master_info* mi, 
               mi->password, mi->port, mi->connect_retry,
               (int)(mi->ssl), mi->ssl_ca, mi->ssl_capath, mi->ssl_cert,
               mi->ssl_cipher, mi->ssl_key, mi->ssl_verify_server_cert,
+#ifndef MCP_WL3127
+              heartbeat_buf, mi->bind_addr, ignore_server_ids_buf);
+#else
               heartbeat_buf, "", ignore_server_ids_buf);
+#endif
   my_free(ignore_server_ids_buf);
   err= flush_io_cache(file);
   if (sync_masterinfo_period && !err && 

=== modified file 'sql/rpl_mi.h'
--- a/sql/rpl_mi.h	2010-10-27 11:32:32 +0000
+++ b/sql/rpl_mi.h	2010-11-29 14:38:44 +0000
@@ -116,6 +116,9 @@ class Master_info : public Slave_reporti
 #ifndef MCP_WL4080
   uint64 master_epoch;
 #endif
+#ifndef MCP_WL3127
+  char bind_addr[HOSTNAME_LENGTH+1];
+#endif
 };
 void init_master_log_pos(Master_info* mi);
 int init_master_info(Master_info* mi, const char* master_info_fname,

=== modified file 'sql/slave.cc'
--- a/sql/slave.cc	2010-11-16 12:37:26 +0000
+++ b/sql/slave.cc	2010-11-29 14:38:44 +0000
@@ -1786,6 +1786,10 @@ bool show_master_info(THD* thd, Master_i
   field_list.push_back(new Item_empty_string("Last_IO_Error", 20));
   field_list.push_back(new Item_return_int("Last_SQL_Errno", 4, MYSQL_TYPE_LONG));
   field_list.push_back(new Item_empty_string("Last_SQL_Error", 20));
+#ifndef MCP_WL3127
+  field_list.push_back(new Item_empty_string("Master_Bind",
+                                             sizeof(mi->bind_addr)));
+#endif
   field_list.push_back(new Item_empty_string("Replicate_Ignore_Server_Ids",
                                              FN_REFLEN));
   field_list.push_back(new Item_return_int("Master_Server_Id", sizeof(ulong),
@@ -1912,6 +1916,9 @@ bool show_master_info(THD* thd, Master_i
     protocol->store(mi->rli.last_error().number);
     // Last_SQL_Error
     protocol->store(mi->rli.last_error().message, &my_charset_bin);
+#ifndef MCP_WL3127
+    protocol->store(mi->bind_addr, &my_charset_bin);
+#endif
     // Replicate_Ignore_Server_Ids
     {
       char buff[FN_REFLEN];
@@ -4181,6 +4188,14 @@ static int connect_to_master(THD* thd, M
   mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout);
   mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (char *) &slave_net_timeout);
 
+#ifndef MCP_WL3127
+  if (mi->bind_addr[0])
+  {
+    DBUG_PRINT("info",("BIND ADDR: %s",mi->bind_addr));
+    mysql_options(mysql, MYSQL_OPT_BIND, mi->bind_addr);
+  }
+#endif
+
 #ifdef HAVE_OPENSSL
   if (mi->ssl)
   {
@@ -4309,6 +4324,14 @@ MYSQL *rpl_connect_master(MYSQL *mysql)
   mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout);
   mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (char *) &slave_net_timeout);
 
+#ifndef MCP_WL3127
+  if (mi->bind_addr[0])
+  {
+    DBUG_PRINT("info",("BIND ADDR: %s",mi->bind_addr));
+    mysql_options(mysql, MYSQL_OPT_BIND, mi->bind_addr);
+  }
+#endif
+
 #ifdef HAVE_OPENSSL
   if (mi->ssl)
   {

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2010-11-16 12:37:26 +0000
+++ b/sql/sql_lex.h	2010-11-29 14:38:44 +0000
@@ -293,6 +293,9 @@ typedef struct st_lex_master_info
   char *relay_log_name;
   ulong relay_log_pos;
   DYNAMIC_ARRAY repl_ignore_server_ids;
+#ifndef MCP_WL3127
+  char *bind_addr;
+#endif
 } LEX_MASTER_INFO;
 
 

=== modified file 'sql/sql_repl.cc'
--- a/sql/sql_repl.cc	2010-10-27 11:32:32 +0000
+++ b/sql/sql_repl.cc	2010-11-29 14:38:44 +0000
@@ -1434,6 +1434,10 @@ bool change_master(THD* thd, Master_info
 
   if (lex_mi->host)
     strmake(mi->host, lex_mi->host, sizeof(mi->host)-1);
+#ifndef MCP_WL3127
+  if (lex_mi->bind_addr)
+    strmake(mi->bind_addr, lex_mi->bind_addr, sizeof(mi->bind_addr)-1);
+#endif
   if (lex_mi->user)
     strmake(mi->user, lex_mi->user, sizeof(mi->user)-1);
   if (lex_mi->password)

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2010-11-16 12:37:26 +0000
+++ b/sql/sql_show.cc	2010-11-29 14:38:44 +0000
@@ -600,11 +600,11 @@ public:
     return m_view_access_denied_message_ptr;
   }
 
-  bool handle_condition(THD *thd, uint sql_errno, const char */* sqlstate */,
+  bool handle_condition(THD *thd, uint sql_errno, const char * /* sqlstate */,
                         MYSQL_ERROR::enum_warning_level level,
-                        const char *message, MYSQL_ERROR **/* cond_hdl */)
+                        const char *message, MYSQL_ERROR ** /* cond_hdl */)
   {
-    /* 
+    /*
        The handler does not handle the errors raised by itself.
        At this point we know if top_view is really a view.
     */
@@ -614,7 +614,7 @@ public:
     m_handling= TRUE;
 
     bool is_handled;
-    
+
     switch (sql_errno)
     {
     case ER_TABLEACCESS_DENIED_ERROR:

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2010-11-16 12:37:26 +0000
+++ b/sql/sql_yacc.yy	2010-11-29 14:38:44 +0000
@@ -1071,6 +1071,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
 %token  LOOP_SYM
 %token  LOW_PRIORITY
 %token  LT                            /* OPERATOR */
+%token  MASTER_BIND_SYM /* MCP_WL3127 */
 %token  MASTER_CONNECT_RETRY_SYM
 %token  MASTER_HOST_SYM
 %token  MASTER_LOG_FILE_SYM
@@ -1883,6 +1884,14 @@ master_def:
           {
             Lex->mi.host = $3.str;
           }
+/* MCP_WL3127 -> */
+        | MASTER_BIND_SYM EQ TEXT_STRING_sys
+          {
+#ifndef MCP_WL3127
+            Lex->mi.bind_addr = $3.str;
+#endif
+          }
+/* MCP_WL3127 <- */
         | MASTER_USER_SYM EQ TEXT_STRING_sys
           {
             Lex->mi.user = $3.str;

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2010-11-12 11:08:14 +0000
+++ b/sql/sys_vars.cc	2010-11-25 15:15:07 +0000
@@ -1790,6 +1790,7 @@ static Sys_var_ulong Sys_server_id(
        NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_server_id));
 
 #ifndef MCP_BUG53205
+extern uint opt_server_id_bits;
 static Sys_var_uint Sys_server_id_bits(
        "server_id_bits",
        "Set number of significant bits in server-id",

No bundle (reason: revision is a merge).
Thread
bzr commit into mysql-5.5-telco-7.0 branch (magnus.blaudd:3128) Magnus Blåudd29 Nov