MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alfranio Correia Date:February 8 2011 3:56pm
Subject:Re: bzr commit into mysql-trunk branch (luis.soares:3595) Bug#58584
View as plain text  
Hi Luis,

Patch approved. Just one minor request.

Please, add a comment whenever you define an expected error through
numbers:

--let $slave_io_errno= 1236 # ER_MASTER_FATAL_ERROR_READING_BINLOG

Cheers.

On 02/07/2011 03:31 PM, Luis Soares wrote:
> #At file:///home/lsoares/Workspace/bzr/work/bugfixing/58584/mysql-trunk/ based on
> revid:dmitry.lenev@stripped
> 
>  3595 Luis Soares	2011-02-07
>       BUG#58584: Move timestamps in Slave_[SQL|IO]_Error to separate
>                  columns
>       
>       In BUG 43535, we added timestamps to errors in reported in SHOW
>       SLAVE STATUS. However, it was decided that the timestamp should
>       not be embedded in the error message and, instead, moved it into
>       its own field in SHOW SLAVE STATUS output. This is exactly what
>       this patch fixes.
> 
>     modified:
>       mysql-test/extra/rpl_tests/rpl_conflicts.test
>       mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test
>       mysql-test/extra/rpl_tests/rpl_stop_middle_group.test
>       mysql-test/include/check-testcase.test
>       mysql-test/include/wait_for_slave_io_error.inc
>       mysql-test/include/wait_for_slave_sql_error.inc
>       mysql-test/suite/rpl/r/rpl_binlog_corruption.result
>       mysql-test/suite/rpl/r/rpl_checksum.result
>       mysql-test/suite/rpl/r/rpl_row_conflicts.result
>       mysql-test/suite/rpl/r/rpl_show_errors.result
>       mysql-test/suite/rpl/r/rpl_stm_EE_err2.result
>       mysql-test/suite/rpl/r/rpl_stm_conflicts.result
>       mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result
>       mysql-test/suite/rpl/t/rpl_binlog_corruption.test
>       mysql-test/suite/rpl/t/rpl_checksum.test
>       mysql-test/suite/rpl/t/rpl_show_errors.test
>       sql/rpl_slave.cc
> === modified file 'mysql-test/extra/rpl_tests/rpl_conflicts.test'
> --- a/mysql-test/extra/rpl_tests/rpl_conflicts.test	2010-12-19 17:22:30 +0000
> +++ b/mysql-test/extra/rpl_tests/rpl_conflicts.test	2011-02-07 15:31:01 +0000
> @@ -93,7 +93,6 @@ if (`SELECT @@global.binlog_format != 'R
>    source include/wait_for_slave_sql_error.inc;
>  
>    --let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1)
> -  --let $err= `SELECT SUBSTRING("$err" FROM 17)`
>    --replace_regex /end_log_pos [0-9]+/end_log_pos END_LOG_POS/
>    --disable_query_log
>    --eval SELECT "$err" as 'Last_SQL_Error (expected "duplicate key" error)'
> @@ -109,9 +108,7 @@ if (`SELECT @@global.binlog_format != 'R
>  
>  --echo ---- Sync slave and verify that there is no error ----
>  sync_with_master;
> -let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
> -let $err= `SELECT SUBSTRING("$err" FROM 17)`;
> ---echo Last_SQL_Error = '$err' (expected no error)
> +--source include/check_slave_no_error.inc
>  SELECT * FROM t1;
>  
>  
> @@ -148,7 +145,6 @@ if (`SELECT @@global.binlog_format = 'RO
>    source include/wait_for_slave_sql_error.inc;
>  
>    --let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1)
> -  --let $err= `SELECT SUBSTRING("$err" FROM 17)`
>    --replace_regex /end_log_pos [0-9]+/end_log_pos END_LOG_POS/
>    --disable_query_log
>    --eval SELECT "$err" as 'Last_SQL_Error (expected "duplicate key" error)'
> @@ -166,9 +162,7 @@ if (`SELECT @@global.binlog_format = 'RO
>  # The slave should sync ok, and SHOW SLAVE STATUS should give no
>  # error.
>  sync_with_master;
> -let $err= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
> -let $err= `SELECT SUBSTRING("$err" FROM 17)`;
> ---echo Last_SQL_Error = $err (expected no error)
> +--source include/check_slave_no_error.inc
>  SELECT * FROM t1;
>  
>  
> 
> === modified file 'mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test'
> --- a/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test	2010-12-19 17:22:30 +0000
> +++ b/mysql-test/extra/rpl_tests/rpl_stm_EE_err2.test	2011-02-07 15:31:01 +0000
> @@ -24,12 +24,10 @@ insert into t1 values(1),(2);
>  drop table t1;
>  
>  connection slave;
> ---source include/wait_for_slave_sql_to_stop.inc
> -let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
> -let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
> -let $error= `SELECT SUBSTRING("$error" FROM 17)`;
> ---echo Error: "$error" (expected different error codes on master and slave)
> ---echo Errno: "$errno" (expected 0)
> +--echo (expect different error codes on master and slave)
> +--let $slave_sql_errno= 0
> +--let $show_slave_sql_error= 1
> +--source include/wait_for_slave_sql_error.inc
>  drop table t1;
>  --source include/stop_slave.inc
>  # Clear error messages.
> 
> === modified file 'mysql-test/extra/rpl_tests/rpl_stop_middle_group.test'
> --- a/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test	2010-12-19 17:22:30
> +0000
> +++ b/mysql-test/extra/rpl_tests/rpl_stop_middle_group.test	2011-02-07 15:31:01
> +0000
> @@ -31,16 +31,19 @@ source include/wait_for_slave_sql_to_sto
>  
>  # checking: no error and the group is finished
>  
> -let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
> -let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
> -let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
> ---disable_query_log
> -eval SELECT $read = $exec into @check;
> -let $error= `SELECT SUBSTRING("$error" FROM 17)`;
> ---enable_query_log
> -eval SELECT "NO$error" AS Last_SQL_Error, @check as `true`;
> -select count(*) as one from tm;
> -select count(*) as one from ti;
> +--source include/check_slave_no_error.inc
> +
> +--let $assert_text= Everything that was read, was executed
> +--let $assert_cond= [SHOW SLAVE STATUS, Read_Master_Log_Pos, 1] = [SHOW SLAVE
> STATUS, Exec_Master_Log_Pos, 1]
> +--source include/assert.inc
> +
> +--let $assert_text= There is one row in table tm
> +--let $assert_cond= [SELECT COUNT(*) AS Val FROM tm, Val, 1] = 1
> +--source include/assert.inc
> +
> +--let $assert_text= There is one row in table ti
> +--let $assert_cond= [SELECT COUNT(*) AS Val FROM ti, Val, 1] = 1
> +--source include/assert.inc
>  
>  set @@global.debug="-d";
>  
> @@ -81,20 +84,23 @@ connection slave;
>  # slave will catch the killed status, won't shut down immediately
>  # but does it eventually having the whole group unfinished (not committed)
>  
> -source include/wait_for_slave_sql_to_stop.inc;
> +--let $slave_sql_errno= 1593
> +--let $show_slave_sql_error= 1
> +--source include/wait_for_slave_sql_error.inc
>  
>  # checking: the error and group unfinished
>  
> -let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
> -let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
> -let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
> ---disable_query_log
> -eval SELECT $read - $exec > 0 into @check;
> -let $error= `SELECT SUBSTRING("$error" FROM 17)`;
> ---enable_query_log
> -eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
> -select count(*) as one  from tm;
> -select count(*) as zero from ti;
> +--let $assert_text= Not everything that was read, was executed
> +--let $assert_cond= [SHOW SLAVE STATUS, Read_Master_Log_Pos, 1] > [SHOW SLAVE
> STATUS, Exec_Master_Log_Pos, 1]
> +--source include/assert.inc
> +
> +--let $assert_text= There is one row in table tm
> +--let $assert_cond= [SELECT COUNT(*) AS Val FROM tm, Val, 1] = 1
> +--source include/assert.inc
> +
> +--let $assert_text= There is no row in table ti
> +--let $assert_cond= [SELECT COUNT(*) AS Val FROM ti, Val, 1] = 0
> +--source include/assert.inc
>  
>  set @@global.debug="-d";
>  
> @@ -121,20 +127,22 @@ connection slave;
>  # but does it eventually having the whole group unfinished (not committed)
>  # 
>  
> -source include/wait_for_slave_sql_to_stop.inc;
> -
>  # checking: the error and group unfinished 
> -
> -let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
> -let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1);
> -let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1);
> ---disable_query_log
> -eval SELECT $read - $exec > 0 into @check;
> -let $error= `SELECT SUBSTRING("$error" FROM 17)`;
> ---enable_query_log
> -eval SELECT "$error" AS Last_SQL_Error, @check as `true`;
> -select max(a) as two from tm;
> -select max(a) as one from ti;
> +--let $slave_sql_errno= 1593
> +--let $show_slave_sql_error= 1
> +--source include/wait_for_slave_sql_error.inc
> +
> +--let $assert_text= Not everything that was read, was executed
> +--let $assert_cond= [SHOW SLAVE STATUS, Read_Master_Log_Pos, 1] > [SHOW SLAVE
> STATUS, Exec_Master_Log_Pos, 1]
> +--source include/assert.inc
> +
> +--let $assert_text= The max value for field 'a' is 2
> +--let $assert_cond= [SELECT MAX(a) AS Val FROM tm, Val, 1] = 2
> +--source include/assert.inc
> +
> +--let $assert_text= The max value for field 'a' is 1
> +--let $assert_cond= [SELECT MAX(a) AS Val FROM ti, Val, 1] = 1
> +--source include/assert.inc
>  
>  set @@global.debug="-d";
>  
> 
> === modified file 'mysql-test/include/check-testcase.test'
> --- a/mysql-test/include/check-testcase.test	2010-12-19 17:22:30 +0000
> +++ b/mysql-test/include/check-testcase.test	2011-02-07 15:31:01 +0000
> @@ -67,6 +67,8 @@ if ($tmp)
>    --echo Slave_SQL_Running_State	
>    --echo Master_Retry_Count	#
>    --echo Master_Bind	
> +  --echo Last_IO_Error_Timestamp	
> +  --echo Last_SQL_Error_Timestamp	
>  }
>  if (!$tmp) {
>    # Note: after WL#5177, fields 13-18 shall not be filtered-out.
> 
> === modified file 'mysql-test/include/wait_for_slave_io_error.inc'
> --- a/mysql-test/include/wait_for_slave_io_error.inc	2010-12-19 17:22:30 +0000
> +++ b/mysql-test/include/wait_for_slave_io_error.inc	2011-02-07 15:31:01 +0000
> @@ -72,7 +72,7 @@ if ($show_slave_io_error)
>  {
>    --let $_wait_for_slave_io_error_error= query_get_value("SHOW SLAVE STATUS",
> Last_IO_Error, 1)
>    # remove timestamp and mask absolute path
> -  --let $_wait_for_slave_io_error_error= `SELECT
> REPLACE(SUBSTR("$_wait_for_slave_io_error_error", 17), '$MYSQL_TEST_DIR',
> 'MYSQL_TEST_DIR')`
> +  --let $_wait_for_slave_io_error_error= `SELECT
> REPLACE("$_wait_for_slave_io_error_error", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
>    --echo Last_IO_Error = '$_wait_for_slave_io_error_error'
>  }
>  
> 
> === modified file 'mysql-test/include/wait_for_slave_sql_error.inc'
> --- a/mysql-test/include/wait_for_slave_sql_error.inc	2010-12-19 17:22:30 +0000
> +++ b/mysql-test/include/wait_for_slave_sql_error.inc	2011-02-07 15:31:01 +0000
> @@ -61,7 +61,7 @@ if ($show_slave_sql_error)
>  {
>    --let $_wait_for_slave_sql_error_error= query_get_value("SHOW SLAVE STATUS",
> Last_SQL_Error, 1)
>    # remove timestamp and mask absolute path
> -  --let $_wait_for_slave_sql_error_error= `SELECT
> REPLACE(SUBSTR("$_wait_for_slave_sql_error_error", 17), '$MYSQL_TEST_DIR',
> 'MYSQL_TEST_DIR')`
> +  --let $_wait_for_slave_sql_error_error= `SELECT
> REPLACE("$_wait_for_slave_sql_error_error", '$MYSQL_TEST_DIR', 'MYSQL_TEST_DIR')`
>    --echo Last_SQL_Error = '$_wait_for_slave_sql_error_error'
>  }
>  
> 
> === modified file 'mysql-test/suite/rpl/r/rpl_binlog_corruption.result'
> --- a/mysql-test/suite/rpl/r/rpl_binlog_corruption.result	2010-12-19 17:07:28 +0000
> +++ b/mysql-test/suite/rpl/r/rpl_binlog_corruption.result	2011-02-07 15:31:01 +0000
> @@ -9,7 +9,7 @@ Setting up fake replication from MYSQL_T
>  ==== Test ====
>  START SLAVE SQL_THREAD;
>  include/wait_for_slave_sql_error.inc [errno=1594]
> -Last_SQL_Error = Relay log read failure: Could not parse relay log event entry. The
> possible reasons are: the master's binary log is corrupted (you can check this by running
> 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this
> by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or
> slave's MySQL code. If you want to check the master's binary log or slave's relay log, you
> will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.
> +Last_SQL_Error = 'Relay log read failure: Could not parse relay log event entry. The
> possible reasons are: the master's binary log is corrupted (you can check this by running
> 'mysqlbinlog' on the binary log), the slave's relay log is corrupted (you can check this
> by running 'mysqlbinlog' on the relay log), a network problem, or a bug in the master's or
> slave's MySQL code. If you want to check the master's binary log or slave's relay log, you
> will be able to know their names by issuing 'SHOW SLAVE STATUS' on this slave.'
>  ==== Clean up ====
>  include/cleanup_fake_relay_log.inc
>  include/rpl_end.inc
> 
> === modified file 'mysql-test/suite/rpl/r/rpl_checksum.result'
> --- a/mysql-test/suite/rpl/r/rpl_checksum.result	2010-12-21 10:53:10 +0000
> +++ b/mysql-test/suite/rpl/r/rpl_checksum.result	2011-02-07 15:31:01 +0000
> @@ -61,8 +61,8 @@ set @@global.binlog_checksum = CRC32;
>  insert into t1 values (1) /* will not be applied on slave due to simulation */;
>  set @@global.debug='d,simulate_slave_unaware_checksum';
>  start slave;
> -include/wait_for_slave_io_to_stop.inc
> -*** Got IO thread error code: 1236, text: Got fatal error 1236 from master when
> reading data from binary log: 'Slave can not handle replication events with the checksum
> that master is configured to log' ***
> +include/wait_for_slave_io_error.inc [errno=1236]
> +Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log:
> 'Slave can not handle replication events with the checksum that master is configured to
> log''
>  select count(*) as zero from t1;
>  zero
>  0
> @@ -78,16 +78,16 @@ include/stop_slave.inc
>  create table t2 (a int);
>  set @@global.debug='d,simulate_checksum_test_failure';
>  start slave io_thread;
> -include/wait_for_slave_io_to_stop.inc
> -*** Got IO thread error code: 1595, text: Relay log write failure: could not queue
> event from master ***
> +include/wait_for_slave_io_error.inc [errno=1595]
> +Last_IO_Error = 'Relay log write failure: could not queue event from master'
>  set @@global.debug='';
>  start slave io_thread;
>  include/wait_for_slave_param.inc [Read_Master_Log_Pos]
>  set @@global.slave_sql_verify_checksum = 1;
>  set @@global.debug='d,simulate_checksum_test_failure';
>  start slave sql_thread;
> -include/wait_for_slave_sql_to_stop.inc
> -*** Got SQL thread error code: 1593, text: Error initializing relay log position:
> I/O error reading event at position 4 ***
> +include/wait_for_slave_sql_error.inc [errno=1593]
> +Last_SQL_Error = 'Error initializing relay log position: I/O error reading event at
> position 4'
>  set @@global.debug='';
>  include/start_slave.inc
>  select count(*) as 'must be zero' from t2;
> 
> === modified file 'mysql-test/suite/rpl/r/rpl_row_conflicts.result'
> --- a/mysql-test/suite/rpl/r/rpl_row_conflicts.result	2010-12-19 17:22:30 +0000
> +++ b/mysql-test/suite/rpl/r/rpl_row_conflicts.result	2011-02-07 15:31:01 +0000
> @@ -31,7 +31,7 @@ DELETE FROM t1 WHERE a = 1;
>  START SLAVE SQL_THREAD;
>  include/wait_for_slave_sql_to_start.inc
>  ---- Sync slave and verify that there is no error ----
> -Last_SQL_Error = '' (expected no error)
> +include/check_slave_no_error.inc
>  SELECT * FROM t1;
>  a
>  1
> @@ -59,7 +59,7 @@ INSERT INTO t1 VALUES (1);
>  START SLAVE SQL_THREAD;
>  include/wait_for_slave_sql_to_start.inc
>  ---- Sync slave and verify that there is no error ----
> -Last_SQL_Error =  (expected no error)
> +include/check_slave_no_error.inc
>  SELECT * FROM t1;
>  a
>  ==== Clean up ====
> @@ -84,7 +84,7 @@ a
>  1
>  [on slave]
>  ---- Sync slave and verify that there is no error ----
> -Last_SQL_Error = '' (expected no error)
> +include/check_slave_no_error.inc
>  SELECT * FROM t1;
>  a
>  1
> @@ -102,7 +102,7 @@ SELECT * FROM t1;
>  a
>  [on slave]
>  ---- Sync slave and verify that there is no error ----
> -Last_SQL_Error =  (expected no error)
> +include/check_slave_no_error.inc
>  SELECT * FROM t1;
>  a
>  ==== Clean up ====
> 
> === modified file 'mysql-test/suite/rpl/r/rpl_show_errors.result'
> --- a/mysql-test/suite/rpl/r/rpl_show_errors.result	2010-12-19 17:22:30 +0000
> +++ b/mysql-test/suite/rpl/r/rpl_show_errors.result	2011-02-07 15:31:01 +0000
> @@ -3,10 +3,10 @@ include/master-slave.inc
>  CREATE TABLE t1 (a INT, b blob, PRIMARY KEY(b(512)));
>  DROP TABLE t1;
>  DROP TABLE t1;
> -include/wait_for_slave_sql_to_stop.inc
> -# assertion: timestamp should be filled
> +include/wait_for_slave_sql_error.inc [errno=1051]
> +include/assert.inc [Last_SQL_Error_Timestamp is not null and matches the expected
> format]
>  include/stop_slave.inc
> -# assertion: show that error is preserved after stop slave as well as the timestamp
> +include/assert.inc [Last_SQL_Error_Timestamp matches the one reported before
> stopping slave threads]
>  CREATE TABLE  t1 (a INT, b blob, PRIMARY KEY(b(512)));
>  Last_SQL_Errno: 1051
>  include/start_slave.inc
> @@ -19,9 +19,9 @@ change master to master_port=SLAVE_PORT;
>  START SLAVE;
>  include/wait_for_slave_param.inc [Last_IO_Errno]
>  *** must be having the replicate-same-server-id IO thread error ***
> -# assertion: assert that error has been reported as well as a timestamp
> +include/assert.inc [Last_IO_Error_Timestamp is not null and matches the expected
> format]
>  include/stop_slave.inc
> -# assertion: show that error is preserved after stop slave as well as the timestamp
> +include/assert.inc [Last_IO_Error_Timestamp matches the one reported before stopping
> slave threads]
>  change master to master_port=MASTER_PORT;
>  Last_IO_Errno: 1593
>  include/start_slave.inc
> 
> === modified file 'mysql-test/suite/rpl/r/rpl_stm_EE_err2.result'
> --- a/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result	2010-12-19 17:07:28 +0000
> +++ b/mysql-test/suite/rpl/r/rpl_stm_EE_err2.result	2011-02-07 15:31:01 +0000
> @@ -7,9 +7,9 @@ set sql_log_bin=1;
>  insert into t1 values(1),(2);
>  ERROR 23000: Duplicate entry '2' for key 'a'
>  drop table t1;
> -include/wait_for_slave_sql_to_stop.inc
> -Error: "Query caused different errors on master and slave.     Error on master:
> message (format)='Duplicate entry '%-.192s' for key %d' error code=1062 ; Error on slave:
> actual message='no error', error code=0. Default database: 'test'. Query: 'insert into t1
> values(1),(2)'" (expected different error codes on master and slave)
> -Errno: "0" (expected 0)
> +(expect different error codes on master and slave)
> +include/wait_for_slave_sql_error.inc [errno=0]
> +Last_SQL_Error = 'Query caused different errors on master and slave.     Error on
> master: message (format)='Duplicate entry '%-.192s' for key %d' error code=1062 ; Error on
> slave: actual message='no error', error code=0. Default database: 'test'. Query: 'insert
> into t1 values(1),(2)''
>  drop table t1;
>  include/stop_slave.inc
>  RESET SLAVE;
> 
> === modified file 'mysql-test/suite/rpl/r/rpl_stm_conflicts.result'
> --- a/mysql-test/suite/rpl/r/rpl_stm_conflicts.result	2010-12-19 17:22:30 +0000
> +++ b/mysql-test/suite/rpl/r/rpl_stm_conflicts.result	2011-02-07 15:31:01 +0000
> @@ -26,7 +26,7 @@ DELETE FROM t1 WHERE a = 1;
>  START SLAVE SQL_THREAD;
>  include/wait_for_slave_sql_to_start.inc
>  ---- Sync slave and verify that there is no error ----
> -Last_SQL_Error = '' (expected no error)
> +include/check_slave_no_error.inc
>  SELECT * FROM t1;
>  a
>  1
> @@ -44,7 +44,7 @@ SELECT * FROM t1;
>  a
>  [on slave]
>  ---- Sync slave and verify that there is no error ----
> -Last_SQL_Error =  (expected no error)
> +include/check_slave_no_error.inc
>  SELECT * FROM t1;
>  a
>  ==== Clean up ====
> 
> === modified file 'mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result'
> --- a/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result	2010-12-19 17:22:30
> +0000
> +++ b/mysql-test/suite/rpl/r/rpl_stm_stop_middle_group.result	2011-02-07 15:31:01
> +0000
> @@ -12,15 +12,10 @@ Warnings:
>  Note	1592	Unsafe statement written to the binary log using statement format since
> BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional
> table after accessing a transactional table within the same transaction.
>  commit;
>  include/wait_for_slave_sql_to_stop.inc
> -SELECT "NO" AS Last_SQL_Error, @check as `true`;
> -Last_SQL_Error	true
> -NO	1
> -select count(*) as one from tm;
> -one
> -1
> -select count(*) as one from ti;
> -one
> -1
> +include/check_slave_no_error.inc
> +include/assert.inc [Everything that was read, was executed]
> +include/assert.inc [There is one row in table tm]
> +include/assert.inc [There is one row in table ti]
>  set @@global.debug="-d";
>  include/start_slave.inc
>  truncate table tm;
> @@ -33,16 +28,11 @@ insert into tm set a=null;
>  Warnings:
>  Note	1592	Unsafe statement written to the binary log using statement format since
> BINLOG_FORMAT = STATEMENT. Statement is unsafe because it accesses a non-transactional
> table after accessing a transactional table within the same transaction.
>  commit;
> -include/wait_for_slave_sql_to_stop.inc
> -SELECT "Fatal error: ... The slave SQL is stopped, leaving the current group of
> events unfinished with a non-transaction table changed. If the group consists solely of
> Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT,
> which ignores duplicate key, key not found, and similar errors (see documentation for
> details)." AS Last_SQL_Error, @check as `true`;
> -Last_SQL_Error	true
> -Fatal error: ... The slave SQL is stopped, leaving the current group of events
> unfinished with a non-transaction table changed. If the group consists solely of Row-based
> events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores
> duplicate key, key not found, and similar errors (see documentation for details).	1
> -select count(*) as one  from tm;
> -one
> -1
> -select count(*) as zero from ti;
> -zero
> -0
> +include/wait_for_slave_sql_error.inc [errno=1593]
> +Last_SQL_Error = 'Fatal error: ... The slave SQL is stopped, leaving the current
> group of events unfinished with a non-transaction table changed. If the group consists
> solely of Row-based events, you can try restarting the slave with
> --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar
> errors (see documentation for details).'
> +include/assert.inc [Not everything that was read, was executed]
> +include/assert.inc [There is one row in table tm]
> +include/assert.inc [There is no row in table ti]
>  set @@global.debug="-d";
>  stop slave;
>  truncate table tm;
> @@ -50,16 +40,11 @@ include/start_slave.inc
>  set @@global.debug="+d,stop_slave_middle_group";
>  set @@global.debug="+d,incomplete_group_in_relay_log";
>  update tm as t1, ti as t2 set t1.a=t1.a * 2, t2.a=t2.a * 2;
> -include/wait_for_slave_sql_to_stop.inc
> -SELECT "Fatal error: ... The slave SQL is stopped, leaving the current group of
> events unfinished with a non-transaction table changed. If the group consists solely of
> Row-based events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT,
> which ignores duplicate key, key not found, and similar errors (see documentation for
> details)." AS Last_SQL_Error, @check as `true`;
> -Last_SQL_Error	true
> -Fatal error: ... The slave SQL is stopped, leaving the current group of events
> unfinished with a non-transaction table changed. If the group consists solely of Row-based
> events, you can try restarting the slave with --slave-exec-mode=IDEMPOTENT, which ignores
> duplicate key, key not found, and similar errors (see documentation for details).	1
> -select max(a) as two from tm;
> -two
> -2
> -select max(a) as one from ti;
> -one
> -1
> +include/wait_for_slave_sql_error.inc [errno=1593]
> +Last_SQL_Error = 'Fatal error: ... The slave SQL is stopped, leaving the current
> group of events unfinished with a non-transaction table changed. If the group consists
> solely of Row-based events, you can try restarting the slave with
> --slave-exec-mode=IDEMPOTENT, which ignores duplicate key, key not found, and similar
> errors (see documentation for details).'
> +include/assert.inc [Not everything that was read, was executed]
> +include/assert.inc [The max value for field 'a' is 2]
> +include/assert.inc [The max value for field 'a' is 1]
>  set @@global.debug="-d";
>  include/rpl_reset.inc
>  drop table tm, ti;
> 
> === modified file 'mysql-test/suite/rpl/t/rpl_binlog_corruption.test'
> --- a/mysql-test/suite/rpl/t/rpl_binlog_corruption.test	2010-12-19 17:22:30 +0000
> +++ b/mysql-test/suite/rpl/t/rpl_binlog_corruption.test	2011-02-07 15:31:01 +0000
> @@ -40,10 +40,8 @@ source include/setup_fake_relay_log.inc;
>  --echo ==== Test ====
>  START SLAVE SQL_THREAD;
>  let $slave_sql_errno= 1594; # ER_SLAVE_RELAY_LOG_READ_FAILURE
> +let $show_slave_sql_error= 1;
>  source include/wait_for_slave_sql_error.inc;
> -let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
> -let $error= `SELECT SUBSTRING("$error" FROM 17)`;
> ---echo Last_SQL_Error = $error
>  
>  --echo ==== Clean up ====
>  source include/cleanup_fake_relay_log.inc;
> 
> === modified file 'mysql-test/suite/rpl/t/rpl_checksum.test'
> --- a/mysql-test/suite/rpl/t/rpl_checksum.test	2010-12-21 10:53:10 +0000
> +++ b/mysql-test/suite/rpl/t/rpl_checksum.test	2011-02-07 15:31:01 +0000
> @@ -99,14 +99,9 @@ insert into t1 values (1) /* will not be
>  connection slave;
>  set @@global.debug='d,simulate_slave_unaware_checksum';
>  start slave;
> -source include/wait_for_slave_io_to_stop.inc;
> -
> -let $slave_error_date_col= 17;
> -let $errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
> -let $error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
> -let $error= `select substring("$error", $slave_error_date_col)`;
> -
> ---echo *** Got IO thread error code: $errno, text: $error ***
> +--let $slave_io_errno= 1236
> +--let $show_slave_io_error= 1
> +source include/wait_for_slave_io_error.inc;
>  
>  select count(*) as zero from t1;
>  
> @@ -145,11 +140,9 @@ connection slave;
>  # instruction to io thread
>  set @@global.debug='d,simulate_checksum_test_failure';
>  start slave io_thread;
> -source include/wait_for_slave_io_to_stop.inc;
> -let $errno= query_get_value(SHOW SLAVE STATUS, Last_IO_Errno, 1);
> -let $error= query_get_value(SHOW SLAVE STATUS, Last_IO_Error, 1);
> -let $error= `select substring("$error", 17)`;
> ---echo *** Got IO thread error code: $errno, text: $error ***
> +--let $slave_io_errno= 1595
> +--let $show_slave_io_error= 1
> +source include/wait_for_slave_io_error.inc;
>  set @@global.debug='';
>  
>  # to make IO thread re-read it again w/o the failure
> @@ -165,11 +158,9 @@ set @@global.slave_sql_verify_checksum =
>  set @@global.debug='d,simulate_checksum_test_failure';
>  
>  start slave sql_thread;
> -source include/wait_for_slave_sql_to_stop.inc;
> -let $errno= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1);
> -let $error= query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1);
> -let $error= `select substring("$error", 17)`;
> ---echo *** Got SQL thread error code: $errno, text: $error ***
> +--let $slave_sql_errno= 1593
> +--let $show_slave_sql_error= 1
> +source include/wait_for_slave_sql_error.inc;
>  
>  # resuming SQL thread to parse out the event w/o the failure
>  
> 
> === modified file 'mysql-test/suite/rpl/t/rpl_show_errors.test'
> --- a/mysql-test/suite/rpl/t/rpl_show_errors.test	2010-12-19 17:22:30 +0000
> +++ b/mysql-test/suite/rpl/t/rpl_show_errors.test	2011-02-07 15:31:01 +0000
> @@ -8,7 +8,12 @@
>  # BUG#43535: last_io_error in show slave status is confusing
>  #
>  
> +--let $ts_regexp= [0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]
> +
>  ############# CHECKS SQL ERRORS #############
> +
> +--let $field= Last_SQL_Error_Timestamp
> +
>  -- connection master
>  CREATE TABLE t1 (a INT, b blob, PRIMARY KEY(b(512)));
>  -- sync_slave_with_master
> @@ -22,27 +27,19 @@ DROP TABLE t1;
>  -- connection slave
>  # action: now  wait for the slave to stop because it cannot
>  #         remove a table that does not exist
> --- source include/wait_for_slave_sql_to_stop.inc
> +-- let $slave_sql_errno=1051
> +-- source include/wait_for_slave_sql_error.inc
>  
> --- echo # assertion: timestamp should be filled
> --- let $errmsg0= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1)
> --- let $errts0= `SELECT SUBSTRING("$errmsg0" FROM 1 FOR 15)`
> -if (`SELECT (NOT STRCMP("$errts0", "") OR NOT ("$errts0" REGEXP
> "[0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]"))`)
> -{
> -  -- echo Timestamp does not match the expected one: expected '#### ##:##:##', got:
> '$errts0' 
> -  -- die
> -}
> +--let $errts0= query_get_value("SHOW SLAVE STATUS", $field, 1)
> +--let $assert_text= $field is not null and matches the expected format
> +--let $assert_cond= `SELECT ("$errts0" REGEXP "$ts_regexp")`
> +--source include/assert.inc
>  
>  # action: stop the slave (this should preserve the error)
>  -- source include/stop_slave.inc
> --- let $errmsg1= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1)
> --- echo # assertion: show that error is preserved after stop slave as well as the
> timestamp
> -if (`SELECT (STRCMP("$errmsg0", "$errmsg1"))`)
> -{
> -  -- let $errts1= `SELECT SUBSTRING("$errmsg1" FROM 1 FOR 15)`
> -  -- echo timestamp { got: "$errts1", expected: "$errts0" }, message { got:
> "$errmsg1", expected: "$errmsg0" }
> -  -- die
> -}
> +--let $assert_cond= "$errts0" = "[SHOW SLAVE STATUS, $field, 1]"
> +--let $assert_text= $field matches the one reported before stopping slave threads
> +--source include/assert.inc
>  
>  -- connection slave
>  # action: create the table again on the slave so that it resumes replication
> @@ -65,6 +62,7 @@ source include/wait_for_slave_param.inc;
>  
>  --let $rpl_only_running_threads= 1
>  --source include/rpl_reset.inc
> +--let $field= Last_IO_Error_Timestamp
>  
>  # mostly copied and extended from rpl_server_id1.test
>  -- connection slave
> @@ -80,26 +78,17 @@ START SLAVE;
>  -- source include/wait_for_slave_param.inc
>  -- echo *** must be having the replicate-same-server-id IO thread error ***
>  
> --- echo # assertion: assert that error has been reported as well as a timestamp
> --- let $errmsg0= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1)
> --- let $errts0= `SELECT SUBSTRING("$errmsg0" FROM 1 FOR 15)`
> -if (`SELECT (NOT STRCMP("$errts0", "") OR NOT ("$errts0" REGEXP
> "[0-9][0-9][0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]"))`)
> -{
> -  -- echo Timestamp does not match the expected one: expected '#### ##:##:##', got:
> '$errts0' 
> -  -- die
> -}
> +--let $errts0= query_get_value("SHOW SLAVE STATUS", $field, 1)
> +--let $assert_text= $field is not null and matches the expected format
> +--let $assert_cond= `SELECT ("$errts0" REGEXP "$ts_regexp")`
> +--source include/assert.inc
>  
>  # action: stop the slave
>  -- source include/stop_slave.inc
>  
> --- let $errmsg1= query_get_value("SHOW SLAVE STATUS", Last_IO_Error, 1)
> --- echo # assertion: show that error is preserved after stop slave as well as the
> timestamp
> -if (`SELECT (STRCMP("$errmsg0", "$errmsg1"))`)
> -{
> -  -- let $errts1= `SELECT SUBSTRING("$errmsg1" FROM 1 FOR 15)`
> -  -- echo timestamp { got: "$errts1", expected: "$errts0" }, message { got:
> "$errmsg1", expected: "$errmsg0" }
> -  -- die
> -}
> +--let $assert_cond= "$errts0" = "[SHOW SLAVE STATUS, $field, 1]"
> +--let $assert_text= $field matches the one reported before stopping slave threads
> +--source include/assert.inc
>  
>  # action: restore correct settings
>  -- replace_result $MASTER_MYPORT MASTER_PORT
> 
> === modified file 'sql/rpl_slave.cc'
> --- a/sql/rpl_slave.cc	2011-01-24 03:58:22 +0000
> +++ b/sql/rpl_slave.cc	2011-02-07 15:31:01 +0000
> @@ -2067,6 +2067,9 @@ bool show_master_info(THD* thd, Master_i
>                                             MYSQL_TYPE_LONGLONG));
>    field_list.push_back(new Item_empty_string("Master_Bind",
>                                               sizeof(mi->bind_addr)));
> +  field_list.push_back(new Item_empty_string("Last_IO_Error_Timestamp", 20));
> +  field_list.push_back(new Item_empty_string("Last_SQL_Error_Timestamp", 20));
> +
>  
>    if (protocol->send_result_set_metadata(&field_list,
>                              Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
> @@ -2185,30 +2188,11 @@ bool show_master_info(THD* thd, Master_i
>      // Last_IO_Errno
>      protocol->store(mi->last_error().number);
>      // Last_IO_Error
> -    if (*mi->last_error().message != '\0')
> -    {
> -      String msg_buf;
> -      msg_buf.append(mi->last_error().timestamp);
> -      msg_buf.append(" ");
> -      msg_buf.append(mi->last_error().message);
> -      protocol->store(msg_buf.c_ptr_safe(), &my_charset_bin);
> -    }
> -    else
> -      protocol->store(mi->last_error().message, &my_charset_bin);
> +    protocol->store(mi->last_error().message, &my_charset_bin);
>      // Last_SQL_Errno
>      protocol->store(mi->rli->last_error().number);
>      // Last_SQL_Error
> -    if (*mi->rli->last_error().message != '\0')
> -    {
> -      String msg_buf;
> -      msg_buf.append(mi->rli->last_error().timestamp);
> -      msg_buf.append(" ");
> -      msg_buf.append(mi->rli->last_error().message);
> -      protocol->store(msg_buf.c_ptr_safe(), &my_charset_bin);
> -    }
> -    else
> -      protocol->store(mi->rli->last_error().message, &my_charset_bin);
> -
> +    protocol->store(mi->rli->last_error().message, &my_charset_bin);
>      // Replicate_Ignore_Server_Ids
>      {
>        char buff[FN_REFLEN];
> @@ -2257,6 +2241,10 @@ bool show_master_info(THD* thd, Master_i
>      protocol->store((ulonglong) mi->retry_count);
>      // Master_Bind
>      protocol->store(mi->bind_addr, &my_charset_bin);
> +    // Last_IO_Error_Timestamp
> +    protocol->store(mi->last_error().timestamp, &my_charset_bin);
> +    // Last_SQL_Error_Timestamp
> +    protocol->store(mi->rli->last_error().timestamp, &my_charset_bin);
>  
>      mysql_mutex_unlock(&mi->rli->err_lock);
>      mysql_mutex_unlock(&mi->err_lock);
> 
> 
> 
> 
> 

Thread
bzr commit into mysql-trunk branch (luis.soares:3595) Bug#58584Luis Soares7 Feb
  • Re: bzr commit into mysql-trunk branch (luis.soares:3595) Bug#58584Sven Sandberg7 Feb
  • Re: bzr commit into mysql-trunk branch (luis.soares:3595) Bug#58584Alfranio Correia8 Feb
    • Re: bzr commit into mysql-trunk branch (luis.soares:3595) Bug#58584Luís Soares14 Feb