403Webshell
Server IP : 172.67.216.182  /  Your IP : 162.158.88.21
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_savepoint_crash_on_rollback.test
################################################################################
# This test verifies the impact when a server is crashed during a incomplete
# transaction when 'rollback to savepoint' is in progress
#
# Test:
# 0. The test requires two servers: M1, M2
# 1. Create a table on M1.
# 2. Start a transaction t1 on M1, crash the server when 'rollback [work] to
#    savepoint' in progress.
# 3. Check that incomplete transaction t1 is rolled back.
# 4. Clean up
################################################################################

# This test does crashes servers, thence we skip it on asan and valgrind.
--source include/not_asan.inc
--source include/not_valgrind.inc
--source include/big_test.inc
--source include/force_restart.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc

--source ../inc/have_group_replication_plugin.inc
--source ../inc/group_replication.inc

--let $member1_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`
--let $group_replication_group_seeds= `SELECT @@GLOBAL.group_replication_group_seeds`
--let $member1_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
SET @debug_save= @@GLOBAL.DEBUG;

--let $rpl_connection_name= server2
--source include/rpl_connection.inc
--let $member2_group_replication_local_address= `SELECT @@GLOBAL.group_replication_local_address`

--let $rpl_connection_name= server1
--source include/rpl_connection.inc

--echo #1. Create table t1 on M1
CREATE TABLE table1(a int primary key);
# Insert some values
INSERT INTO table1 values (1),(2);

--source include/rpl_sync.inc

--echo #2. Start a transaction t1 on M1, crash the server when 'rollback [work] to savepoint' in progress
--let $rpl_connection_name= server1
--source include/rpl_connection.inc

--source include/rpl_sync.inc

connect(server1_1,localhost,root,,test,$SERVER_MYPORT_1,$SERVER_MYSOCK_1);
--echo [connection M1]
--connection server1_1
--enable_reconnect

# Set sync point such that M1 waits during rollback
SET @@GLOBAL.DEBUG='d,transaction_write_set_savepoint_block_before_rollback';

# Transaction t1.
BEGIN;
INSERT INTO table1 VALUES (3);
SAVEPOINT s1;
UPDATE table1 SET a= -1 where a=1;
SAVEPOINT s2;
--send ROLLBACK TO SAVEPOINT s1

# Crash server
--let $rpl_connection_name= server1
--source include/rpl_connection.inc

--let $wait_condition=SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE State = 'debug sync point: now'
--source include/wait_condition.inc
--let $_group_replication_group_whitelist= `SELECT @@GLOBAL.group_replication_ip_whitelist`
--replace_result $member1_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS1 $group_replication_group_seeds GROUP_REPLICATION_GROUP_SEEDS $group_replication_group_name GROUP_REPLICATION_GROUP_NAME $_group_replication_group_whitelist GROUP_REPLICATION_GROUP_WHITELIST
--let $restart_parameters=restart:--group_replication_local_address=$member1_group_replication_local_address --group_replication_group_seeds=$group_replication_group_seeds --group_replication_group_name=$group_replication_group_name --group_replication_ip_whitelist=$_group_replication_group_whitelist
--source ../inc/kill_and_restart_mysqld.inc

#reconnect clients
--disconnect server1_1
--let $rpl_server_number= 1
--source include/rpl_reconnect.inc

# unblock group
--let $rpl_connection_name= server2
--source include/rpl_connection.inc

--let $group_replication_member_state= UNREACHABLE
--let $group_replication_member_id= $member1_uuid
--source ../inc/gr_wait_for_member_state.inc

--replace_result $member2_group_replication_local_address GROUP_REPLICATION_LOCAL_ADDRESS1
eval SET GLOBAL group_replication_force_members= "$member2_group_replication_local_address";

# rejoin M1 to group
--let $rpl_connection_name= server1
--source include/rpl_connection.inc
--source include/start_group_replication.inc

# Upon start wait until server M1 comes online.
let $wait_condition= SELECT COUNT(*)=2 FROM performance_schema.replication_group_members where member_state= "ONLINE";
--source include/wait_condition.inc

--echo #3. check that incomplete transaction t1 is rolled back, table1 should have only 2 tuples.
--let $assert_text= 'There should be two values in table1'
--let $assert_cond= [SELECT COUNT(*) AS count FROM table1, count, 1] = 2
--source include/assert.inc

--echo #4. Clean-up
DROP TABLE table1;
SET @@GLOBAL.DEBUG=@debug_save;

--source ../inc/group_replication_end.inc

Youez - 2016 - github.com/yon3zu
LinuXploit