2
--echo # BUG#18985760 - "FAST" ALTER TABLE CHANGE ON ENUM COLUMN
3
--echo # TRIGGERS FULL TABLE REBUILD.
5
--echo # Test case below ensures that the columns with old temporal
6
--echo # format are not upgraded on the slave since the global variable
7
--echo # 'avoid_temporal_upgrade' is enabled on the slave.
9
--source include/master-slave.inc
12
--let MASTER_DATADIR=`select @@datadir`
14
--let SLAVE_DATADIR=`select @@datadir`
16
--echo # Copy the table containing the old Mysql-5.5 temporal format
17
--echo # to the master and slave.
19
--copy_file std_data/55_temporal.frm $MASTER_DATADIR/test/t1.frm
20
--copy_file std_data/55_temporal.MYD $MASTER_DATADIR/test/t1.MYD
21
--copy_file std_data/55_temporal.MYI $MASTER_DATADIR/test/t1.MYI
23
--copy_file std_data/55_temporal.frm $SLAVE_DATADIR/test/t1.frm
24
--copy_file std_data/55_temporal.MYD $SLAVE_DATADIR/test/t1.MYD
25
--copy_file std_data/55_temporal.MYI $SLAVE_DATADIR/test/t1.MYI
27
--echo # Enable the 'avoid_temporal_column' global variable on slave.
30
SET @@global.avoid_temporal_upgrade= ON;
33
--echo # ALTER TABLE on the master.
35
SELECT f_time, f_datetime, f_timestamp, HEX(WEIGHT_STRING(f_time)),
36
HEX(WEIGHT_STRING(f_datetime)), HEX(WEIGHT_STRING(f_timestamp)) FROM t1;
37
ALTER TABLE t1 ADD COLUMN fld1 INT;
38
INSERT INTO t1 VALUES ('22:22:22','2011-11-21 22:22:22','2011-11-21 22:22:22', 0);
39
--echo # Since the global variable 'avoid_temporal_upgrade' is disabled on
40
--echo # the master, the temporal columns of old format are upgraded to the
42
SELECT f_time, f_datetime, f_timestamp, HEX(WEIGHT_STRING(f_time)),
43
HEX(WEIGHT_STRING(f_datetime)), HEX(WEIGHT_STRING(f_timestamp)) FROM t1;
44
--source include/sync_slave_sql_with_master.inc
46
--echo # Since 'avoid_temporal_upgrade' is enabled on the slave,
47
--echo # the old temporal will not be upgraded on the slave.
49
SET @saved_show_old_temporals= @@session.show_old_temporals;
50
SELECT f_time, f_datetime, f_timestamp, HEX(WEIGHT_STRING(f_time)),
51
HEX(WEIGHT_STRING(f_datetime)), HEX(WEIGHT_STRING(f_timestamp)) FROM t1;
52
SET SESSION show_old_temporals= ON;
54
SELECT COLUMN_TYPE FROM information_schema.columns WHERE table_name='t1';
55
SET @@session.show_old_temporals= @saved_show_old_temporals;
60
--source include/sync_slave_sql_with_master.inc
62
--echo # Testcase to ensure that the temporal columns of old format
63
--echo # are upgraded on the slave since 'avoid_temporal_column'
64
--echo # global variable is not enabled on the slave.
66
--echo # Copy the table containing the old Mysql-5.5 temporal format
67
--echo # to the master and slave.
69
--copy_file std_data/55_temporal.frm $MASTER_DATADIR/test/t1.frm
70
--copy_file std_data/55_temporal.MYD $MASTER_DATADIR/test/t1.MYD
71
--copy_file std_data/55_temporal.MYI $MASTER_DATADIR/test/t1.MYI
73
--copy_file std_data/55_temporal.frm $SLAVE_DATADIR/test/t1.frm
74
--copy_file std_data/55_temporal.MYD $SLAVE_DATADIR/test/t1.MYD
75
--copy_file std_data/55_temporal.MYI $SLAVE_DATADIR/test/t1.MYI
77
--echo # Disable the 'avoid_temporal_column' global variable on slave.
80
SET @@global.avoid_temporal_upgrade= 0;
83
--echo # ALTER TABLE on the master.
85
SELECT f_time, f_datetime, f_timestamp, HEX(WEIGHT_STRING(f_time)),
86
HEX(WEIGHT_STRING(f_datetime)), HEX(WEIGHT_STRING(f_timestamp)) FROM t1;
87
ALTER TABLE t1 ADD COLUMN fld1 INT;
88
INSERT INTO t1 VALUES ('22:22:22','2011-11-21 22:22:22','2011-11-21 22:22:22', 0);
90
--echo # Since the default value of 'avoid_temporal_upgrade' is FALSE,
91
--echo # the old temporal will be upgraded on the master.
92
SELECT f_time, f_datetime, f_timestamp, HEX(WEIGHT_STRING(f_time)),
93
HEX(WEIGHT_STRING(f_datetime)), HEX(WEIGHT_STRING(f_timestamp)) FROM t1;
95
SELECT COLUMN_TYPE FROM information_schema.columns WHERE table_name='t1';
97
--source include/sync_slave_sql_with_master.inc
99
--echo # Since the default value of 'avoid_temporal_upgrade' is FALSE,
100
--echo # the old temporal will be upgraded on the slave.
102
SET @saved_show_old_temporals= @@session.show_old_temporals;
103
SET SESSION show_old_temporals= ON;
104
SELECT f_time, f_datetime, f_timestamp, HEX(WEIGHT_STRING(f_time)),
105
HEX(WEIGHT_STRING(f_datetime)), HEX(WEIGHT_STRING(f_timestamp)) FROM t1;
106
SHOW CREATE TABLE t1;
107
SELECT COLUMN_TYPE FROM information_schema.columns WHERE table_name='t1';
108
SET @@session.show_old_temporals= @saved_show_old_temporals;
113
--source include/sync_slave_sql_with_master.inc
116
--source include/rpl_end.inc