Current Path : /usr/opt/mysql57/mysql-test/suite/group_replication/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 : //usr/opt/mysql57/mysql-test/suite/group_replication/t/gr_prepared_statements.test |
############################################################################ # WL#9053 : Group Replication: Push Group Replication Plugin to mysql-trunk # # This test does the basic check of prepared statements in # group replication environment # # 0. This test requires two servers # 1. Start Group Replication on two servers # 2. Execute the following prepared statements on the members of the group # a) "CREATE TABLE.." # b) "INSERT.." # c) "SELECT.." # d) "UPDATE.." # e) "DELETE.." # f) "DROP.." # 3. Verify the consistency of data across the group # 4. Clean-up ############################################################################ # Start GR with two servers --source ../inc/have_group_replication_plugin.inc --source ../inc/group_replication.inc # On server1 # Create a prepared statement to create table PREPARE stmt1 FROM "CREATE TABLE t1 (a INT PRIMARY KEY)"; EXECUTE stmt1; # Create a prepared statement to insert into table PREPARE stmt2 FROM "INSERT INTO t1(a) value (?)"; # Insert data SET @val=1; EXECUTE stmt2 USING @val; SET @val=2; EXECUTE stmt2 USING @val; SET @val=3; EXECUTE stmt2 USING @val; # Create a prepared statement to select PREPARE stmt3 FROM "SELECT * FROM t1 WHERE a>?"; SET @val=0; EXECUTE stmt3 USING @val; DEALLOCATE PREPARE stmt1; DEALLOCATE PREPARE stmt2; DEALLOCATE PREPARE stmt3; # Connect to server2 --echo --let $rpl_connection_name= server2 --source include/rpl_connection.inc # Wait for t1 to be available --let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.tables WHERE table_schema = 'test' AND table_name = 't1'; --source include/wait_condition.inc # Wait for the records to get synced --let $wait_condition= SELECT COUNT(*)=3 FROM test.t1; --source include/wait_condition.inc # Create a prepared statement to insert PREPARE stmt4 FROM "INSERT INTO t1(a) value (?)"; # Insert data SET @val=4; EXECUTE stmt4 USING @val; SET @val=5; EXECUTE stmt4 USING @val; SET @val=6; EXECUTE stmt4 USING @val; # Conflict testing --error ER_DUP_ENTRY EXECUTE stmt4 USING @val; # Create a prepared statement to update PREPARE stmt5 FROM "UPDATE t1 SET a=a+?"; SET @val=10; EXECUTE stmt5 USING@val; # Conflict testing PREPARE stmt FROM "UPDATE t1 SET a=11 WHERE a=?"; SET @val=12; --error ER_DUP_ENTRY EXECUTE stmt USING@val; # Create a prepared statement to delete PREPARE stmt6 FROM "DELETE from t1 WHERE a=?"; SET @val=11; EXECUTE stmt6 USING @val; SET @val=12; EXECUTE stmt6 USING @val; # Create a prepared statement to select PREPARE stmt7 FROM "SELECT * FROM t1 WHERE a>?"; SET @val=10; EXECUTE stmt7 USING @val; DEALLOCATE PREPARE stmt4; DEALLOCATE PREPARE stmt5; DEALLOCATE PREPARE stmt6; DEALLOCATE PREPARE stmt7; # Connect to server1 and verify the data with server2 --echo --let $rpl_connection_name= server1 --source include/rpl_connection.inc # Wait for the records to get synced --let $wait_condition= SELECT COUNT(*)=4 FROM test.t1; --source include/wait_condition.inc # Create a prepared statement to select PREPARE stmt8 FROM "SELECT * FROM t1"; EXECUTE stmt8; DEALLOCATE PREPARE stmt8; # Clean-up # Drop table PREPARE stmt9 FROM "DROP TABLE t1"; EXECUTE stmt9; DEALLOCATE PREPARE stmt9; --source ../inc/group_replication_end.inc