403Webshell
Server IP : 88.99.149.37  /  Your IP : 216.73.216.141
Web Server : nginx/1.31.2
System : Linux server-88-99-149-37 6.12.0-124.56.5.el10_1.x86_64 #1 SMP PREEMPT_DYNAMIC Fri May 15 06:12:08 EDT 2026 x86_64
User : muralimurth ( 1015)
PHP Version : 8.4.23
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/mysql/mysql-test/suite/galera/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/mysql/mysql-test/suite/galera/t/galera_sequences_recovery.test
#
# Test sequences crash recovery.
#

--source include/galera_cluster.inc
--source include/have_sequence.inc
--source include/big_test.inc

--disable_ps2_protocol

#
# Case 1: Crash a node during a transaction, bring the
# sequence in sync by receiving higher current value
#
--connection node_1
CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB;
CREATE TABLE t1 (f1 INT PRIMARY KEY DEFAULT NEXTVAL(s), f2 INT) ENGINE=InnoDB;

--connection node_1
BEGIN;
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);

--connection node_2
BEGIN;
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);

# Crash and restart the node, losing the transaciton
--source include/kill_galera.inc
--let $start_mysqld_params =
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc

# Check and update the last written sequence value
SELECT NEXTVAL(s);

--connection node_1
# Update the sequence value further
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);

COMMIT;
SELECT LASTVAL(s);
SELECT * FROM t1;

--connection node_2
# The next value should be in sync now, but the last
# value is still the same
SELECT LASTVAL(s);
SELECT NEXTVAL(s);
SELECT * FROM t1;

--connection node_1
DROP TABLE t1;
DROP SEQUENCE s;

#
# Case 2: Crash a node during a transaction, bring the
# sequence in sync by sending higher current value
#
--connection node_1
CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB;
CREATE TABLE t1 (f1 INT PRIMARY KEY DEFAULT NEXTVAL(s), f2 INT) ENGINE=InnoDB;

--connection node_1
BEGIN;
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);

--connection node_2
# Exhaust the cached values once, but no replication happens even
# though the sequnce table is updated
BEGIN;
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);

# Crash and restart the node, losing the transaciton
--source include/kill_galera.inc
--let $start_mysqld_params =
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc

--connection node_1
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);

COMMIT;
SELECT LASTVAL(s);
SELECT * FROM t1;

--connection node_2
# Check and update the last written sequence value, it's still
# higher than the one from the other node
SELECT NEXTVAL(s);
SELECT * FROM t1;

--connection node_1
# The next value should be in sync now, but the last
# value is still the same
SELECT LASTVAL(s);
SELECT NEXTVAL(s);

--connection node_1
DROP TABLE t1;
DROP SEQUENCE s;

Youez - 2016 - github.com/yon3zu
LinuXploit