1 # Helper file to perform one insert of a value into a table with
2 # different types on master and slave. The file will insert the
3 # result into the type_conversions table *on the slave* to get a
4 # summary of failing and succeeding tests.
7 # $source_type Type on the master
8 # $target_type Type on the slave
9 # $source_value Value on the master (inserted into the table)
10 # $target_value Value on the slave (expected value in the table
12 # $can_convert True if conversion shall work, false if it
13 # shall generate an error
14 # $engine_type The storage engine to be used for storing table
15 # on both master and slave
19 # Use the default storage engine
20 let $engine_type=`SELECT @@storage_engine`;
25 DROP
TABLE IF EXISTS t1;
28 pk INT NOT NULL PRIMARY
KEY,
30 ) ENGINE=$engine_type;
31 sync_slave_with_master;
32 eval ALTER
TABLE t1 MODIFY a $target_type;
35 eval INSERT INTO t1 VALUES(1, $source_value);
37 sync_slave_with_master;
38 eval SELECT a = $target_value into @
compare FROM t1;
39 eval INSERT INTO type_conversions SET
40 Source =
"$source_type",
42 Flags = @@slave_type_conversions,
43 On_Master = $source_value,
44 Expected = $target_value,
46 UPDATE type_conversions
47 SET On_Slave = (SELECT a FROM t1)
48 WHERE TestNo = LAST_INSERT_ID();
52 wait_for_slave_to_stop;
53 let $error = query_get_value(
"SHOW SLAVE STATUS", Last_SQL_Error, 1);
54 eval INSERT INTO type_conversions SET
55 Source =
"$source_type",
57 Flags = @@slave_type_conversions,
58 On_Master = $source_value,
60 SET GLOBAL SQL_SLAVE_SKIP_COUNTER = 1;