GIF89a;
Direktori : /usr/share/mysql-test/suite/ndb_rpl/t/ |
Current File : //usr/share/mysql-test/suite/ndb_rpl/t/ndb_rpl_add_column.test |
--source include/have_ndb.inc --source include/ndb_have_online_alter.inc --source suite/ndb_rpl/ndb_master-slave.inc # # Test add column # --connection master CREATE TABLE t1 (c1 INT KEY) ROW_FORMAT=DYNAMIC ENGINE=NDB; INSERT INTO t1 VALUES (1),(2),(3); ALTER TABLE t1 ADD c2 INT; --sync_slave_with_master connection slave; SELECT * FROM t1 ORDER BY c1; connection master; INSERT INTO t1 VALUES (6,6),(7,7),(8,8); SELECT * FROM t1 ORDER BY c1; --sync_slave_with_master connection slave; SELECT * FROM t1 ORDER BY c1; # # Test online alter table for various types # connection master; ALTER ONLINE TABLE t1 ADD c CHAR(19); INSERT INTO t1 values (11,1,"a"); ALTER ONLINE TABLE t1 ADD d FLOAT; INSERT INTO t1 VALUES(12, 2,'b', -3.402823466E+38); #FOR BUG#32095 SO COMMNET THE DOUBLE TYPE DATA. # ALTER ONLINE TABLE t1 ADD e DOUBLE UNSIGNED; # INSERT INTO t1 VALUES(13, 3,'c', -3.402823466E+38, 1.7976931348623157E+308); ALTER ONLINE TABLE t1 ADD f DECIMAL(5,2); INSERT INTO t1 VALUES(14, 4,'d', -3.402823466E+38, 456.78); ALTER ONLINE TABLE t1 ADD g DATETIME; INSERT INTO t1 VALUES(15, 5,'e', -3.402823466E+38, 456.78, '2007-10-26 12:00:00'); ALTER ONLINE TABLE t1 ADD h BINARY(4); INSERT INTO t1 VALUES(16, 6,'f', -3.402823466E+38, 456.78, '2007-10-26 12:00:00',"abcd"); --echo ********************** --echo "Master data" --echo ********************** SELECT * FROM t1 ORDER BY c1; --sync_slave_with_master connection slave; --echo ********************** --echo "Slave data" --echo ********************** SELECT * FROM t1 ORDER BY c1; # # Update the new added column # connection master; UPDATE t1 SET c = "abcdef", d = 3.402823466E+38, f = 987.65, g = '2007-10-22 22:22:22', h = "aaaa"; --echo *************************** --echo "Master Data After Update" --echo *************************** SELECT * FROM t1 ORDER BY c1; --sync_slave_with_master connection slave; --echo ************************* --echo "Slave Data After Update" --echo ************************* SELECT * FROM t1 ORDER BY c1; connection master; DROP TABLE t1; --echo ************************************************* --echo * Insert And Update New Added Columns With Commit --echo ************************************************* connection master; CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB; INSERT INTO t1 VALUES(1,1),(2,2); BEGIN; ALTER ONLINE TABLE t1 ADD c CHAR(19), ADD d VARCHAR(255), ADD e char(255); INSERT INTO t1 VALUES (3,0,'3','3','3'),(4,0,'4','4','4'),(5,0,null,null,null); UPDATE t1 SET c = 'aaa', d = 'bbb', e = 'ccc' WHERE a = 4; COMMIT; SELECT * FROM t1 ORDER BY a; --sync_slave_with_master connection slave; --echo ************************* --echo "Slave Data With Commit --echo ************************* SELECT * FROM t1 ORDER BY a; --echo *************************************************** --echo * Insert And Update New Added Columns With Rollback --echo *************************************************** connection master; DROP TABLE t1; CREATE TABLE t1 (a INT UNSIGNED KEY, b INT UNSIGNED) ROW_FORMAT=DYNAMIC ENGINE NDB; INSERT INTO t1 VALUES(1,1),(2,2); ALTER TABLE t1 ADD c CHAR(19), ADD d VARCHAR(255), ADD e char(255); BEGIN; INSERT INTO t1 VALUES (3,0,'3','3','3'),(4,0,'4','4','4'),(5,0,null,null,null); UPDATE t1 SET c = 'aaa', d = 'bbb', e = 'ccc' WHERE a = 4; ROLLBACK; SHOW CREATE TABLE t1; SELECT * FROM t1 ORDER BY a; --sync_slave_with_master connection slave; --echo ************************* --echo "Slave Data With Rollback --echo ************************* SHOW CREATE TABLE t1; SELECT * FROM t1 ORDER BY a; # cleanup --connection master DROP TABLE t1; -- source include/rpl_end.inc