403Webshell
Server IP : 172.67.216.182  /  Your IP : 162.158.106.108
Web Server : Apache
System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/server/mysql/mysql-test/suite/group_replication/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/server/mysql/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

Youez - 2016 - github.com/yon3zu
LinuXploit