|
| 1 | +# ==== Purpose ==== |
| 2 | +# |
| 3 | +# Test verifies that when slave side type conversion fails in row based |
| 4 | +# replication, more informative error message is displayed. It also verifies |
| 5 | +# that in the case of blob fields appropriate type name is displayed in error |
| 6 | +# message. |
| 7 | +# |
| 8 | +# ==== Implementation ==== |
| 9 | +# |
| 10 | +# Steps: |
| 11 | +# Test case1: |
| 12 | +# 1. Create a table on master with VARCHAR filed and charset |
| 13 | +# 'utf8mb3'. |
| 14 | +# 2. Create a table on slave with VARCHAR field and charset |
| 15 | +# 'utf8mb4'. |
| 16 | +# 3. Insert a tuple on master. |
| 17 | +# 4. Verify that slave provides more informative error message with |
| 18 | +# respect to difference in charsets. |
| 19 | +# Test case2: Repeat same steps as above for CHAR field |
| 20 | +# Test case3: |
| 21 | +# 1. Create a table on master with LONGBLOB field. |
| 22 | +# 2. Create a table on slave with TINYBLOB field. |
| 23 | +# 3. Insert a tuple on master. |
| 24 | +# 4. Verify that error message displayed on slave clearly states type |
| 25 | +# conversion failure from 'longblob' to 'tinyblob'. |
| 26 | +# 5. Also verify that error message doesn't show additional details |
| 27 | +# of charset when not required. |
| 28 | +# |
| 29 | +# ==== References ==== |
| 30 | +# |
| 31 | +# Bug#25135304: RBR: WRONG FIELD LENGTH IN ERROR MESSAGE |
| 32 | +# |
| 33 | + |
| 34 | +--source include/have_binlog_format_row.inc |
| 35 | +# Inorder to grep a specific error pattern in error log a fresh error log |
| 36 | +# needs to be generated. |
| 37 | +--source include/force_restart.inc |
| 38 | +--source include/master-slave.inc |
| 39 | + |
| 40 | +--echo #################################################################### |
| 41 | +--echo # Test Case1: Improved error message with charset information |
| 42 | +--echo #################################################################### |
| 43 | +--source include/rpl_connection_master.inc |
| 44 | +SET SQL_LOG_BIN=0; |
| 45 | +CREATE TABLE t1 (c1 VARCHAR(1) CHARACTER SET 'utf8mb3'); |
| 46 | +SET SQL_LOG_BIN=1; |
| 47 | + |
| 48 | +--source include/rpl_connection_slave.inc |
| 49 | +CREATE TABLE t1 (c1 VARCHAR(1) CHARACTER SET 'utf8mb4'); |
| 50 | + |
| 51 | +--source include/rpl_connection_master.inc |
| 52 | +INSERT INTO t1 VALUES ('a'); |
| 53 | + |
| 54 | +--source include/rpl_connection_slave.inc |
| 55 | +--let $slave_sql_errno= convert_error(ER_SLAVE_CONVERSION_FAILED); |
| 56 | +--source include/wait_for_slave_sql_error.inc |
| 57 | + |
| 58 | +# Error msg before: Column 0 of table 'test.t1' cannot be converted from type 'varchar(3)' to type 'varchar(1)' |
| 59 | +# Error msg after : Column 0 of table 'test.t1' cannot be converted from type 'varchar(3(bytes))' to type 'varchar(4(bytes) utf8mb4)' |
| 60 | +--replace_regex /[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][-+Z][0-9:]* *[0-9]* *\[/DATE_TIME [/ s/Worker .* end_log_pos [0-9]*; // |
| 61 | +--let $grep_file=$MYSQLTEST_VARDIR/tmp/slave.err |
| 62 | +--let $grep_pattern=\'varchar\(3\(bytes\)\)\' to type \'varchar\(4\(bytes\) utf8mb4\)\' |
| 63 | +--source include/grep_pattern.inc |
| 64 | + |
| 65 | +--source include/rpl_connection_master.inc |
| 66 | +DROP TABLE t1; |
| 67 | +--source include/rpl_connection_slave.inc |
| 68 | +DROP TABLE t1; |
| 69 | +--let $rpl_only_running_threads= 1 |
| 70 | +--source include/rpl_reset.inc |
| 71 | + |
| 72 | +--echo #################################################################### |
| 73 | +--echo # Test Case2: Improved error message with charset information for CHAR |
| 74 | +--echo # type |
| 75 | +--echo #################################################################### |
| 76 | +--source include/rpl_connection_master.inc |
| 77 | +SET SQL_LOG_BIN=0; |
| 78 | +CREATE TABLE t1 (c1 CHAR(1) CHARACTER SET 'utf8mb3'); |
| 79 | +SET SQL_LOG_BIN=1; |
| 80 | + |
| 81 | +--source include/rpl_connection_slave.inc |
| 82 | +CREATE TABLE t1 (c1 CHAR(1) CHARACTER SET 'utf8mb4'); |
| 83 | + |
| 84 | +--source include/rpl_connection_master.inc |
| 85 | +INSERT INTO t1 VALUES ('a'); |
| 86 | + |
| 87 | +--source include/rpl_connection_slave.inc |
| 88 | +--let $slave_sql_errno= convert_error(ER_SLAVE_CONVERSION_FAILED); |
| 89 | +--source include/wait_for_slave_sql_error.inc |
| 90 | + |
| 91 | +# Error msg before: Column 0 of table 'test.t1' cannot be converted from type 'char(0)' to type 'char(1)' |
| 92 | +# Error msg after : Column 0 of table 'test.t1' cannot be converted from type 'char(3(bytes))' to type 'char(4(bytes) utf8mb4)' |
| 93 | +--replace_regex /[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][-+Z][0-9:]* *[0-9]* *\[/DATE_TIME [/ s/Worker .* end_log_pos [0-9]*; // |
| 94 | +--let $grep_file=$MYSQLTEST_VARDIR/tmp/slave.err |
| 95 | +--let $grep_pattern=\'char\(3\(bytes\)\)\' to type \'char\(4\(bytes\) utf8mb4\)\' |
| 96 | +--source include/grep_pattern.inc |
| 97 | + |
| 98 | +--source include/rpl_connection_master.inc |
| 99 | +DROP TABLE t1; |
| 100 | +--source include/rpl_connection_slave.inc |
| 101 | +DROP TABLE t1; |
| 102 | +--let $rpl_only_running_threads= 1 |
| 103 | +--source include/rpl_reset.inc |
| 104 | + |
| 105 | +--echo #################################################################### |
| 106 | +--echo # Test Case3: For BLOB type fileds, when type conversion failed on |
| 107 | +--echo # slave, the errormessage had incorrect type names. |
| 108 | +--echo #################################################################### |
| 109 | +--source include/rpl_connection_master.inc |
| 110 | +SET SQL_LOG_BIN=0; |
| 111 | +CREATE TABLE t1 (c1 LONGBLOB); |
| 112 | +SET SQL_LOG_BIN=1; |
| 113 | + |
| 114 | +--source include/rpl_connection_slave.inc |
| 115 | +CREATE TABLE t1 (c1 TINYBLOB); |
| 116 | + |
| 117 | +--source include/rpl_connection_master.inc |
| 118 | +INSERT INTO t1 VALUES ('a'); |
| 119 | + |
| 120 | +--source include/rpl_connection_slave.inc |
| 121 | +--let $slave_sql_errno= convert_error(ER_SLAVE_CONVERSION_FAILED); |
| 122 | +--source include/wait_for_slave_sql_error.inc |
| 123 | + |
| 124 | +# Error msg before: Column 0 of table 'test.t1' cannot be converted from type 'tinyblob' to type 'tinyblob' |
| 125 | +# Error msg after : Column 0 of table 'test.t1' cannot be converted from type 'longblob' to type 'tinyblob' |
| 126 | +--replace_regex /[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]T[0-9][0-9]:[0-9][0-9]:[0-9][0-9]\.[0-9][0-9][0-9][0-9][0-9][0-9][-+Z][0-9:]* *[0-9]* *\[/DATE_TIME [/ s/Worker .* end_log_pos [0-9]*; // |
| 127 | +--let $grep_file=$MYSQLTEST_VARDIR/tmp/slave.err |
| 128 | +--let $grep_pattern=\'longblob\' to type \'tinyblob\' |
| 129 | +--source include/grep_pattern.inc |
| 130 | + |
| 131 | +--source include/rpl_connection_master.inc |
| 132 | +DROP TABLE t1; |
| 133 | +--source include/rpl_connection_slave.inc |
| 134 | +DROP TABLE t1; |
| 135 | +--let $rpl_only_running_threads= 1 |
| 136 | +--source include/rpl_reset.inc |
| 137 | +--source include/rpl_end.inc |
0 commit comments