From d605bc56087145d6ffc3139f5ffcf32c6701fa5c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 30 Jul 2007 12:55:26 -0400 Subject: [PATCH] WL#3915 : (NDB) master's cols > slave Corrective patch to fix test failures in pushbuild and add assertions to help debug rpl_extraColmaster test failures. mysql-test/extra/rpl_tests/rpl_row_tabledefs.test: WL#3915 : (NDB) master's cols > slave Change test to omit the port numbers in the result file. mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result: WL#3915 : (NDB) master's cols > slave Corrected result file. mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result: WL#3915 : (NDB) master's cols > slave Corrected result file. sql/rpl_utility.cc: WL#3915 : (NDB) master's cols > slave Added assertions to assist in debugging. --- mysql-test/extra/rpl_tests/rpl_row_tabledefs.test | 12 ++++++------ .../suite/rpl/r/rpl_row_tabledefs_2myisam.result | 12 ++++++------ .../suite/rpl/r/rpl_row_tabledefs_3innodb.result | 12 ++++++------ sql/rpl_utility.cc | 9 +++++++++ 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test index 4a081a02de4..23ac16d24ae 100644 --- a/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test +++ b/mysql-test/extra/rpl_tests/rpl_row_tabledefs.test @@ -115,7 +115,7 @@ INSERT INTO t1_nodef VALUES (1,2); connection slave; --source include/wait_for_slave_sql_to_stop.inc --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # --query_vertical SHOW SLAVE STATUS SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -135,7 +135,7 @@ sync_slave_with_master; --echo **** On Slave **** SELECT * FROM t2; --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # --query_vertical SHOW SLAVE STATUS connection master; @@ -147,7 +147,7 @@ INSERT INTO t4 VALUES (4); connection slave; --source include/wait_for_slave_sql_to_stop.inc --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # --query_vertical SHOW SLAVE STATUS SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -161,7 +161,7 @@ INSERT INTO t5 VALUES (5,10,25); connection slave; --source include/wait_for_slave_sql_to_stop.inc --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # --query_vertical SHOW SLAVE STATUS SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -175,7 +175,7 @@ INSERT INTO t6 VALUES (6,12,36); connection slave; --source include/wait_for_slave_sql_to_stop.inc --replace_result $MASTER_MYPORT MASTER_PORT ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # --query_vertical SHOW SLAVE STATUS SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2; START SLAVE; @@ -184,7 +184,7 @@ connection master; INSERT INTO t9 VALUES (6); sync_slave_with_master; --replace_result $SLAVE_MYPORT SLAVE_PORT ---replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 # +--replace_column 1 # 4 # 7 # 8 # 9 # 22 # 23 # 33 # --query_vertical SHOW SLAVE STATUS # Testing some tables extra field that can be null and cannot be null diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result index 8c8b5235124..816fba54bd8 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_2myisam.result @@ -107,7 +107,7 @@ SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 Master_User root -Master_Port MASTER_PORT +Master_Port # Connect_Retry 1 Master_Log_File master-bin.000001 Read_Master_Log_Pos # @@ -158,7 +158,7 @@ SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 Master_User root -Master_Port MASTER_PORT +Master_Port # Connect_Retry 1 Master_Log_File master-bin.000001 Read_Master_Log_Pos # @@ -199,7 +199,7 @@ SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 Master_User root -Master_Port MASTER_PORT +Master_Port # Connect_Retry 1 Master_Log_File master-bin.000001 Read_Master_Log_Pos # @@ -242,7 +242,7 @@ SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 Master_User root -Master_Port MASTER_PORT +Master_Port # Connect_Retry 1 Master_Log_File master-bin.000001 Read_Master_Log_Pos # @@ -285,7 +285,7 @@ SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 Master_User root -Master_Port MASTER_PORT +Master_Port # Connect_Retry 1 Master_Log_File master-bin.000001 Read_Master_Log_Pos # @@ -327,7 +327,7 @@ SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 Master_User root -Master_Port 9306 +Master_Port # Connect_Retry 1 Master_Log_File master-bin.000001 Read_Master_Log_Pos # diff --git a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result index d3934d595a7..0c5d57c1d00 100644 --- a/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result +++ b/mysql-test/suite/rpl/r/rpl_row_tabledefs_3innodb.result @@ -107,7 +107,7 @@ SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 Master_User root -Master_Port MASTER_PORT +Master_Port # Connect_Retry 1 Master_Log_File master-bin.000001 Read_Master_Log_Pos # @@ -158,7 +158,7 @@ SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 Master_User root -Master_Port MASTER_PORT +Master_Port # Connect_Retry 1 Master_Log_File master-bin.000001 Read_Master_Log_Pos # @@ -199,7 +199,7 @@ SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 Master_User root -Master_Port MASTER_PORT +Master_Port # Connect_Retry 1 Master_Log_File master-bin.000001 Read_Master_Log_Pos # @@ -242,7 +242,7 @@ SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 Master_User root -Master_Port MASTER_PORT +Master_Port # Connect_Retry 1 Master_Log_File master-bin.000001 Read_Master_Log_Pos # @@ -285,7 +285,7 @@ SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 Master_User root -Master_Port MASTER_PORT +Master_Port # Connect_Retry 1 Master_Log_File master-bin.000001 Read_Master_Log_Pos # @@ -327,7 +327,7 @@ SHOW SLAVE STATUS; Slave_IO_State # Master_Host 127.0.0.1 Master_User root -Master_Port 9306 +Master_Port # Connect_Retry 1 Master_Log_File master-bin.000001 Read_Master_Log_Pos # diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index 2a124c7b14e..279575f33ce 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -48,8 +48,12 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data) else { length= m_field_metadata[col] & 0x00ff; + DBUG_ASSERT(length > 0); if (length > 255) + { + DBUG_ASSERT(uint2korr(master_data) > 0); length= uint2korr(master_data) + 2; + } else length= (uint) *master_data + 1; } @@ -93,13 +97,17 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data) { uint from_len= (m_field_metadata[col] >> 8U) & 0x00ff; uint from_bit_len= m_field_metadata[col] & 0x00ff; + DBUG_ASSERT(from_len >= 0 && from_bit_len >= 0 && from_bit_len <= 7); length= from_len + ((from_bit_len > 0) ? 1 : 0); break; } case MYSQL_TYPE_VARCHAR: + { length= m_field_metadata[col] > 255 ? 2 : 1; // c&p of Field_varstring::data_length() + DBUG_ASSERT(uint2korr(master_data) > 0); length+= length == 1 ? (uint32) *master_data : uint2korr(master_data); break; + } case MYSQL_TYPE_TINY_BLOB: case MYSQL_TYPE_MEDIUM_BLOB: case MYSQL_TYPE_LONG_BLOB: @@ -113,6 +121,7 @@ uint32 table_def::calc_field_size(uint col, uchar *master_data) default: length= -1; } + DBUG_ASSERT(length >= 0); return length; }