~ubuntu-branches/ubuntu/wily/mysql-5.6/wily

« back to all changes in this revision

Viewing changes to mysql-test/suite/rpl/t/rpl_avoid_temporal_upgrade.test

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2015-04-16 20:07:10 UTC
  • mto: (1.3.9 vivid-proposed)
  • mto: This revision was merged to the branch mainline in revision 11.
  • Revision ID: package-import@ubuntu.com-20150416200710-pcrsa022082zj46k
Tags: upstream-5.6.24
ImportĀ upstreamĀ versionĀ 5.6.24

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--echo #
 
2
--echo # BUG#18985760 - "FAST" ALTER TABLE CHANGE ON ENUM COLUMN
 
3
--echo #                 TRIGGERS FULL TABLE REBUILD.
 
4
 
 
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.
 
8
 
 
9
--source include/master-slave.inc
 
10
 
 
11
--connection master
 
12
--let MASTER_DATADIR=`select @@datadir`
 
13
--connection slave
 
14
--let SLAVE_DATADIR=`select @@datadir`
 
15
 
 
16
--echo # Copy the table containing the old Mysql-5.5 temporal format
 
17
--echo # to the master and slave.
 
18
 
 
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
 
22
 
 
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
 
26
 
 
27
--echo # Enable the 'avoid_temporal_column' global variable on slave.
 
28
--connection slave
 
29
STOP SLAVE;
 
30
SET @@global.avoid_temporal_upgrade= ON;
 
31
START SLAVE;
 
32
 
 
33
--echo # ALTER TABLE on the master.
 
34
--connection 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
 
41
--echo # new format.
 
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
 
45
 
 
46
--echo # Since 'avoid_temporal_upgrade' is enabled on the slave,
 
47
--echo # the old temporal will not be upgraded on the slave.
 
48
--connection 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;
 
53
SHOW CREATE TABLE t1;
 
54
SELECT COLUMN_TYPE FROM information_schema.columns WHERE table_name='t1';
 
55
SET @@session.show_old_temporals= @saved_show_old_temporals;
 
56
 
 
57
--echo #Cleanup
 
58
--connection master
 
59
DROP TABLE t1;
 
60
--source include/sync_slave_sql_with_master.inc
 
61
 
 
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.
 
65
 
 
66
--echo # Copy the table containing the old Mysql-5.5 temporal format
 
67
--echo # to the master and slave.
 
68
 
 
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
 
72
 
 
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
 
76
 
 
77
--echo # Disable the 'avoid_temporal_column' global variable on slave.
 
78
--connection slave
 
79
STOP SLAVE;
 
80
SET @@global.avoid_temporal_upgrade= 0;
 
81
START SLAVE;
 
82
 
 
83
--echo # ALTER TABLE on the master.
 
84
--connection 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);
 
89
 
 
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;
 
94
SHOW CREATE TABLE t1;
 
95
SELECT COLUMN_TYPE FROM information_schema.columns WHERE table_name='t1';
 
96
 
 
97
--source include/sync_slave_sql_with_master.inc
 
98
 
 
99
--echo # Since the default value of 'avoid_temporal_upgrade' is FALSE,
 
100
--echo # the old temporal will be upgraded on the slave.
 
101
--connection 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;
 
109
 
 
110
--echo # cleanup
 
111
--connection master
 
112
DROP TABLE t1;
 
113
--source include/sync_slave_sql_with_master.inc
 
114
 
 
115
 
 
116
--source include/rpl_end.inc