Current Path : /home/usr.opt/mysql57/mysql-test/suite/ndb_rpl/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : /home/usr.opt/mysql57/mysql-test/suite/ndb_rpl/t/ndb_rpl_add_column.test |
# The include statement below is a temp one for tests that are yet to #be ported to run with InnoDB, #but needs to be kept for tests that would need MyISAM in future. --source include/force_myisam_default.inc --source include/have_ndb.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 TABLE t1 algorithm=inplace, ADD c CHAR(19); INSERT INTO t1 values (11,1,"a"); ALTER TABLE t1 algorithm=inplace, ADD d FLOAT; INSERT INTO t1 VALUES(12, 2,'b', -3.402823466E+38); #FOR BUG#32095 SO COMMNET THE DOUBLE TYPE DATA. # ALTER TABLE t1 algorithm=inplace, ADD e DOUBLE UNSIGNED; # INSERT INTO t1 VALUES(13, 3,'c', -3.402823466E+38, 1.7976931348623157E+308); ALTER TABLE t1 algorithm=inplace, ADD f DECIMAL(5,2); INSERT INTO t1 VALUES(14, 4,'d', -3.402823466E+38, 456.78); ALTER TABLE t1 algorithm=inplace, ADD g DATETIME; INSERT INTO t1 VALUES(15, 5,'e', -3.402823466E+38, 456.78, '2007-10-26 12:00:00'); ALTER TABLE t1 algorithm=inplace, 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 TABLE t1 algorithm=inplace, 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