403Webshell
Server IP : 172.67.216.182  /  Your IP : 172.70.189.144
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_parallel_update.test
################################################################################
# Verify server behaviour when the same transaction is executed in parallel in
# two servers.
#
# Test:
# 0. The test requires two servers: M1 and M2.
# 1. With both members ONLINE, create initial data.
# 2. Executing the same update transaction on both server (almost) in parallel,
#    one will be committed, the other will be aborted.
# 3. Validate servers state is equal.
# 4. Clean up.
################################################################################
--let $group_replication_group_name= 8a94f357-aab4-11df-86ab-c80aa9429999
--source ../inc/have_group_replication_plugin.inc
--source ../inc/group_replication.inc

--connection server1
--echo ############################################################
--echo # 1. Execute some transactions on server1 and wait for group
--echo #    to be synchronized.
CREATE TABLE t1 (c1 INT NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (0);

--let $sync_slave_connection= server2
--source include/sync_slave_sql_with_master.inc

--echo ############################################################
--echo # 2. Executing the same transaction on both server (almost)
--echo #    in parallel, one will be committed, the other will be
--echo #    aborted.
--disable_query_log
--disable_result_log
--let $include_silent= 1

--let $value_old= 0
--let $value_new= 1
--let $transactions= 50
while ($transactions > 0)
{
  --let $query= UPDATE t1 SET c1=$value_new WHERE c1=$value_old

  --connection server1
  --send_eval $query
  --connection server2
  --send_eval $query

  --connection server1
  --error 0, ER_TRANSACTION_ROLLBACK_DURING_COMMIT, ER_ERROR_DURING_COMMIT, ER_LOCK_DEADLOCK, ER_LOCK_WAIT_TIMEOUT
  --reap
  --connection server2
  --error 0, ER_TRANSACTION_ROLLBACK_DURING_COMMIT, ER_ERROR_DURING_COMMIT, ER_LOCK_DEADLOCK, ER_LOCK_WAIT_TIMEOUT
  --reap

  # Sync both servers to ensure that next transaction does not fail
  # with mismatch where clause.
  --let $sync_slave_connection= server1
  --source include/sync_slave_sql_with_master.inc
  --let $sync_slave_connection= server2
  --source include/sync_slave_sql_with_master.inc

  --dec $transactions
  --inc $value_old
  --inc $value_new
}
--enable_query_log
--enable_result_log
--let $include_silent= 0

--echo ############################################################
--echo # 3. Validate servers state is equal.
--let $diff_tables= server1:t1, server2:t1
--source include/diff_tables.inc

--connection server1
--let $assert_text= 'There is only one row in table t1 on server 1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 50 in table t1 on server 1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 50, count, 1] = 1
--source include/assert.inc

--connection server2
--let $assert_text= 'There is only one row in table t1 on server 2'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1, count, 1] = 1
--source include/assert.inc
--let $assert_text= 'There is a value 50 in table t1 on server 2'
--let $assert_cond= [SELECT COUNT(*) AS count FROM t1 WHERE t1.c1 = 50, count, 1] = 1
--source include/assert.inc

--echo ############################################################
--echo # 4. Clean up.
DROP TABLE t1;
--source ../inc/group_replication_end.inc

Youez - 2016 - github.com/yon3zu
LinuXploit