1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge branch '12.0' into 12.1

This commit is contained in:
Sergei Golubchik
2025-06-05 12:00:59 +02:00
451 changed files with 15009 additions and 6955 deletions

View File

@@ -1,6 +1,7 @@
--source include/big_test.inc
# Valgrind is to slow for this test
# Valgrind and msan is to slow for this test
--source include/not_valgrind.inc
--source include/not_msan.inc
--source include/have_archive.inc
CREATE TABLE t1(a BLOB) ENGINE=ARCHIVE;
--disable_query_log

View File

@@ -3,7 +3,7 @@ the following:
- Add # before --exec echo "restart" ...
- Force $e (engine), $c (crash point) and $r (crash position) to the values
where things goes wrong. See comments in alter_table.test for how to do this.
where things goes wrong. See comments in alter_table.inc for how to do this.
- start mariadbd in a debugger
run the following in the debugger

View File

@@ -1,9 +1,7 @@
--source include/long_test.inc
--source include/have_debug.inc
--source include/have_innodb.inc
--source include/have_log_bin.inc
--source include/default_charset.inc
--source include/test_db_charset_latin1.inc
if (!$BIG_TEST)
{
@@ -13,6 +11,8 @@ if (!$BIG_TEST)
# Starting with 11.7, this will hit the 900-second timeout on WITH_MSAN=ON CMAKE_BUILD_TYPE=Debug
--source include/not_msan.inc
--source include/test_db_charset_latin1.inc
#
# Testing of atomic create table with crashes in a lot of different places
#

View File

@@ -4,4 +4,4 @@
let $engine_count=1;
let $engines='aria';
let $extra_engine=myisam;
--source alter_table.test
--source alter_table.inc

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,7 @@
#
# Test atomic alter table with InnoDB
--source include/have_innodb.inc
let $engine_count=1;
let $engines='innodb';
--source alter_table.inc

View File

@@ -0,0 +1,6 @@
#
# Test atomic alter table with MyISAM
let $engine_count=1;
let $engines='myisam';
--source alter_table.inc

View File

@@ -4,4 +4,4 @@ let $engine_count=1;
let $engines='rocksdb';
let $skip_vector=1;
set global rocksdb_flush_log_at_trx_commit=1;
--source alter_table.test
--source alter_table.inc

View File

@@ -7,7 +7,7 @@
#
# Testing of atomic create table with crashes in a lot of different places
#
# This is very similar to the alter_table.test, but includes testing of
# This is very similar to the alter_table.inc, but includes testing of
# triggers in with ALTER TABLE .. RENAME.
#

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,3 @@
let $skip_vector=1;
let $extra_fields=, v vector(5) not null default x'e360d63ebe554f3fcdbc523f4522193f5236083d', vector index(v);
--source alter_table.test
--source alter_table_innodb.test

View File

@@ -0,0 +1,3 @@
let $skip_vector=1;
let $extra_fields=, v vector(5) not null default x'e360d63ebe554f3fcdbc523f4522193f5236083d', vector index(v);
--source alter_table_myisam.test

View File

@@ -0,0 +1,116 @@
set @@session.gtid_domain_id=1;
set @save_gtid_stric_mode=@@global.gtid_strict_mode;
create table ta (a int) engine=aria;
create table ti (a int) engine=innodb;
create table ti_pk (a int primary key) engine=innodb;
create table t (a int) engine=innodb;
create function f_i()
returns integer
begin
insert into ti set a=1;
return 1;
end |
create function f_ia(arg int)
returns integer
begin
insert into ti_pk set a=1;
insert into ta set a=1;
insert into ti_pk set a=arg;
return 1;
end |
call mtr.add_suppression("Error writing file");
select count(*) as zero from t;
zero
0
select count(*) as zero from ta;
zero
0
select count(*) as zero from ti;
zero
0
# 1. simple Innodb test
set @@global.gtid_strict_mode=0;
set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
insert into t set a=1;
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled
# observe effective rollback
select count(*) as zero from t;
zero
0
# 2. simple Aira test
set @@global.gtid_strict_mode=0;
set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
insert into ta values (1),(2);
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled
# note no rollback
select count(*) as '*NON-zero*' from ta;
*NON-zero*
2
delete from ta;
# 3. multi-engine test
set @@global.gtid_strict_mode=0;
set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
insert into ta set a=f_i();
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled
# note no rollback..
select count(*) as one from ta;
one
1
# ..except transactional engine
select count(*) as zero from ti;
zero
0
delete from ta;
set @@global.gtid_strict_mode=0;
set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
insert into t set a=f_ia(0);
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled
# note no rollback..
select count(*) as one from ta;
one
1
# ..except transactional engine
select count(*) as zero from t;
zero
0
select count(*) as zero from ti_pk;
zero
0
delete from ta;
# 4. create-table-select-f()
set @@global.gtid_strict_mode=0;
set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
create table f_x (a int) select f_i() as a;
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled
# rollback indeed takes place in the pure transactional case
select count(*) as zero from ti;
zero
0
set @@global.gtid_strict_mode=0;
set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
create table t_x (a int) engine=aria select f_ia(0) as a;
ERROR HY000: An attempt was made to binlog GTID VALUE which would create an out-of-order sequence number with existing GTID VALUE, and gtid strict mode is enabled
select * from t_x;
ERROR 42S02: Table 'test.t_x' doesn't exist
# **TODO**: fix MDEV-36027
# **TODO**: the empty binlog is buggy ..
include/show_binlog_events.inc
# .. as non-transactional `ta` (and `t_x` sic!) are modified
select count(*) as one from ta;
one
1
select count(*) as zero from ti;
zero
0
delete from ta;
#.
set @@global.gtid_strict_mode=@save_gtid_stric_mode;
drop function f_i;
drop function f_ia;
drop table t, ta, ti, ti_pk;

View File

@@ -18,6 +18,51 @@ drop table t1;
# Ensuring file offset of binlog_f2_mid < binlog_f1_end
#
#
# Test using --read-from-remote-server
#
connection default;
#
# --stop-position tests
#
# Case 1.a) With one binlog file, a --stop-position before the end of
# the file should not result in a warning
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f1_pre_rotate binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
#
# Case 1.b) With one binlog file, a --stop-position at the exact end of
# the file should not result in a warning
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f1_end binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
#
# Case 1.c) With one binlog file, a --stop-position past the end of the
# file should(!) result in a warning
# MYSQL_BINLOG --read-from-remote-server --short-form --stop-position=binlog_f1_over_eof binlog_f1_full --result-file=tmp/warn_position_test_file.out 2>&1
WARNING: Did not reach stop position <BINLOG_F1_OVER_EOF> before end of input
#
# Case 2.a) With two binlog files, a --stop-position targeting b2 which
# exists in the size of b1 should:
# 1) not provide any warnings
# 2) not prevent b2 from outputting its desired events before the
# stop position
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f2_mid binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
include/assert_grep.inc [Ensure all intended GTIDs are present]
include/assert_grep.inc [Ensure the next GTID binlogged is _not_ present]
#
# Case 2.b) With two binlog files, a --stop-position targeting the end
# of binlog 2 should:
# 1) not provide any warnings
# 2) not prevent b2 from outputting its entire binary log
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f2_end binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
include/assert_grep.inc [Ensure a GTID exists for each transaction]
include/assert_grep.inc [Ensure the last GTID binlogged is present]
#
# Case 2.c) With two binlog files, a --stop-position targeting beyond
# the eof of binlog 2 should:
# 1) provide a warning that the stop position was not reached
# 2) not prevent b2 from outputting its entire binary log
# MYSQL_BINLOG --read-from-remote-server --stop-position=binlog_f2_over_eof binlog_f1_full binlog_f2_full --result-file=tmp/warn_position_test_file.out 2>&1
WARNING: Did not reach stop position <BINLOG_F2_OVER_EOF> before end of input
include/assert_grep.inc [Ensure a GTID exists for each transaction]
#
#
# Test using local binlog files
#
connection default;

View File

@@ -0,0 +1,135 @@
# Tests of commit time failures.
# At committing of an auto-commit statement a failure to commit in its
# binlog branch should rollback at least the transactional part of the statement.
#
# References:
# MDEV-35506 commit policy of one-phase-commit even at errored-out binlogging leads to assert
# MDEV-36027 Errored-out CREATE-SELECT does not binlog results of non-transactional table modification
source include/have_innodb.inc;
source include/have_binlog_format_row.inc;
set @@session.gtid_domain_id=1;
set @save_gtid_stric_mode=@@global.gtid_strict_mode;
create table ta (a int) engine=aria;
create table ti (a int) engine=innodb;
create table ti_pk (a int primary key) engine=innodb;
create table t (a int) engine=innodb;
delimiter |;
create function f_i()
returns integer
begin
insert into ti set a=1;
return 1;
end |
create function f_ia(arg int)
returns integer
begin
insert into ti_pk set a=1;
insert into ta set a=1;
insert into ti_pk set a=arg;
return 1;
end |
delimiter ;|
call mtr.add_suppression("Error writing file");
# Naturally all empty now
select count(*) as zero from t;
select count(*) as zero from ta;
select count(*) as zero from ti;
# Force manual value assignement to gtid::seq_no while in the strict mode
# so that the value is rejected. Despite the errorred out statement
# being at its commit phase it will eventually be rolled back.
# Side effects of non-transactional engines, like Aria, are displayed.
--echo # 1. simple Innodb test
set @@global.gtid_strict_mode=0; set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
# mask possible allowed seq_no shift
--replace_regex /GTID 1-1-[0-9]+/GTID VALUE/
--error ER_GTID_STRICT_OUT_OF_ORDER
insert into t set a=1;
--echo # observe effective rollback
select count(*) as zero from t;
--echo # 2. simple Aira test
set @@global.gtid_strict_mode=0; set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
--replace_regex /GTID 1-1-[0-9]+/GTID VALUE/
--error ER_GTID_STRICT_OUT_OF_ORDER
insert into ta values (1),(2);
--echo # note no rollback
select count(*) as '*NON-zero*' from ta;
# local cleanup
delete from ta;
--echo # 3. multi-engine test
# A. non-transactional top-level
set @@global.gtid_strict_mode=0; set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
--replace_regex /GTID 1-1-[0-9]+/GTID VALUE/
--error ER_GTID_STRICT_OUT_OF_ORDER
insert into ta set a=f_i();
--echo # note no rollback..
select count(*) as one from ta;
--echo # ..except transactional engine
select count(*) as zero from ti;
delete from ta;
# B. non-transactional in the leaf
set @@global.gtid_strict_mode=0; set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
--replace_regex /GTID 1-1-[0-9]+/GTID VALUE/
--error ER_GTID_STRICT_OUT_OF_ORDER
insert into t set a=f_ia(0);
--echo # note no rollback..
select count(*) as one from ta;
--echo # ..except transactional engine
select count(*) as zero from t;
select count(*) as zero from ti_pk;
delete from ta;
--echo # 4. create-table-select-f()
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
# A. two phase commit branch
set @@global.gtid_strict_mode=0; set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
--replace_regex /GTID 1-1-[0-9]+/GTID VALUE/
--error ER_GTID_STRICT_OUT_OF_ORDER
create table f_x (a int) select f_i() as a;
--echo # rollback indeed takes place in the pure transactional case
select count(*) as zero from ti;
# B. one phase commit branch
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
set @@global.gtid_strict_mode=0; set @@session.gtid_seq_no=1;
set @@global.gtid_strict_mode=1;
--replace_regex /GTID 1-1-[0-9]+/GTID VALUE/
--error ER_GTID_STRICT_OUT_OF_ORDER
create table t_x (a int) engine=aria select f_ia(0) as a;
--error ER_NO_SUCH_TABLE
select * from t_x;
--echo # **TODO**: fix MDEV-36027
--echo # **TODO**: the empty binlog is buggy ..
--source include/show_binlog_events.inc
--echo # .. as non-transactional `ta` (and `t_x` sic!) are modified
select count(*) as one from ta;
select count(*) as zero from ti;
delete from ta;
--echo #.
# cleanup
set @@global.gtid_strict_mode=@save_gtid_stric_mode;
drop function f_i;
drop function f_ia;
drop table t, ta, ti, ti_pk;

View File

@@ -64,13 +64,12 @@ if ($binlog_f2_mid > $binlog_f1_end)
--die Mid point chosen to end in binlog 2 does not exist in earlier binlog
}
#--echo #
#--echo #
#--echo # Test using --read-from-remote-server
#--echo #
#--let $read_from_remote_server= 1
#--emit warning is not supported by --read-from-remote-server now
#--source binlog_mysqlbinlog_warn_stop_position.inc
--echo #
--echo #
--echo # Test using --read-from-remote-server
--echo #
--let $read_from_remote_server= 1
--source binlog_mysqlbinlog_warn_stop_position.inc
--echo #
--echo #

View File

@@ -446,3 +446,239 @@ SELECT TO_CHAR((VALUES('2022-12-12','2020-10-10')));
SELECT TO_CHAR((VALUES('2022-12-12','2020-10-10')));
ERROR HY000: Illegal parameter data type row for operation 'to_char'
SELECT TO_CHAR((STR_TO_DATE('2023-01-01', '%d-%m-%Y'), 'YYYY-MM-DD') );
ERROR HY000: Illegal parameter data type row for operation 'to_char'
#
# MDEV-36216 TO_CHAR FM format not recognized in SQL_MODE=Oracle
#
SET NAMES utf8mb3;
CREATE TABLE t1 (fmt VARCHAR(256));
INSERT INTO t1 VALUES
/* Add the slash character before FM to see the position of FM in the results */
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('/FMYYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-/FMMM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-/FMDD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD /FMHH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:/FMMI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:/FMSS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS /FMDAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY /FMMONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; /FMYYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-/FMMM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-/FMDD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD /FMHH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:/FMMI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:/FMSS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS /FMDAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY /FMMONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH/FM;'),
/*Formats not covered above */
('YYY YY Y HH12; /FMYYY YY Y HH12;'),
/*FM specified multiple times*/
('FMFMFMFMFMFMFMFMYYYY-MM-DD [DAY] [MONTH]'),
('FMFMFMFMFMFMFMFMFMYYYY-MM-DD [DAY] [MONTH]'),
(
'YYYY-MM-DD [DAY] [MONTH]; FMYYYY-MM-DD [DAY] [MONTH]; '
'FMYYYY-MM-DD [DAY] [MONTH]; FMYYYY-MM-DD [DAY] [MONTH]; '
'FMYYYY-MM-DD [DAY] [MONTH];'
),
/*Corner cases*/
('FX') /*Unknown format starting with 'F'*/,
('F') /*Unexpected end of the format string*/;
SET lc_time_names='en_US';
SELECT TO_CHAR('0001-02-03 04:05:06', fmt) AS c1 FROM t1;
c1
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:06 Saturday February ;
/1-2-3 4:5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-/2-3 4:5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-/3 4:5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 /4:5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:/5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:/6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 /Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday /February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; /1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-/2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-/3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 /4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:/5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:/6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:06 /Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:06 Saturday /February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:06 Saturday February /;
001 01 1 04; /1 1 1 4;
0001-02-03 [Saturday ] [February ]
1-2-3 [Saturday] [February]
0001-02-03 [Saturday ] [February ]; 1-2-3 [Saturday] [February]; 0001-02-03 [Saturday ] [February ]; 1-2-3 [Saturday] [February]; 0001-02-03 [Saturday ] [February ];
NULL
NULL
Warnings:
Warning 3047 Invalid argument error: date format not recognized at FX in function to_char.
Warning 3047 Invalid argument error: date format not recognized at F in function to_char.
SET sql_mode=ORACLE;
CREATE VIEW v1 AS SELECT TO_CHAR('0001-02-03 04:05:06', fmt) AS c1 FROM t1;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE VIEW "v1" AS select to_char('0001-02-03 04:05:06',"t1"."fmt") AS "c1" from "t1" utf8mb3 utf8mb3_uca1400_ai_ci
SELECT * FROM v1;
c1
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:06 Saturday February ;
/1-2-3 4:5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-/2-3 4:5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-/3 4:5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 /4:5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:/5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:/6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 /Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday /February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; /1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-/2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-/3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 /4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:/5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:/6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:06 /Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:06 Saturday /February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:06 Saturday February /;
001 01 1 04; /1 1 1 4;
0001-02-03 [Saturday ] [February ]
1-2-3 [Saturday] [February]
0001-02-03 [Saturday ] [February ]; 1-2-3 [Saturday] [February]; 0001-02-03 [Saturday ] [February ]; 1-2-3 [Saturday] [February]; 0001-02-03 [Saturday ] [February ];
NULL
NULL
Warnings:
Warning 3047 Invalid argument error: date format not recognized at FX in function to_char.
Warning 3047 Invalid argument error: date format not recognized at F in function to_char.
SET sql_mode=DEFAULT;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select to_char('0001-02-03 04:05:06',`t1`.`fmt`) AS `c1` from `t1` utf8mb3 utf8mb3_uca1400_ai_ci
SELECT * FROM v1;
c1
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:06 Saturday February ;
/1-2-3 4:5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-/2-3 4:5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-/3 4:5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 /4:5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:/5:6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:/6 Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 /Saturday February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday /February; 1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; /1-2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-/2-3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-/3 4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 /4:5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:/5:6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:/6 Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:06 /Saturday February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:06 Saturday /February;
0001-02-03 04:05:06 Saturday February ; 0001-02-03 04:05:06 Saturday February /;
001 01 1 04; /1 1 1 4;
0001-02-03 [Saturday ] [February ]
1-2-3 [Saturday] [February]
0001-02-03 [Saturday ] [February ]; 1-2-3 [Saturday] [February]; 0001-02-03 [Saturday ] [February ]; 1-2-3 [Saturday] [February]; 0001-02-03 [Saturday ] [February ];
NULL
NULL
Warnings:
Warning 3047 Invalid argument error: date format not recognized at FX in function to_char.
Warning 3047 Invalid argument error: date format not recognized at F in function to_char.
DROP VIEW v1;
SET lc_time_names='zh_CN';
SELECT TO_CHAR('0001-02-03 04:05:06', fmt) AS c1 FROM t1;
c1
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:06 星期六 二月 ;
/1-2-3 4:5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-/2-3 4:5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-/3 4:5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 /4:5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:/5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:/6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 /星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 /二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; /1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-/2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-/3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 /4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:/5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:/6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:06 /星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:06 星期六 /二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:06 星期六 二月 /;
001 01 1 04; /1 1 1 4;
0001-02-03 [星期六] [二月 ]
1-2-3 [星期六] [二月]
0001-02-03 [星期六] [二月 ]; 1-2-3 [星期六] [二月]; 0001-02-03 [星期六] [二月 ]; 1-2-3 [星期六] [二月]; 0001-02-03 [星期六] [二月 ];
NULL
NULL
Warnings:
Warning 3047 Invalid argument error: date format not recognized at FX in function to_char.
Warning 3047 Invalid argument error: date format not recognized at F in function to_char.
SET sql_mode=ORACLE;
CREATE VIEW v1 AS SELECT TO_CHAR('0001-02-03 04:05:06', fmt) AS c1 FROM t1;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE VIEW "v1" AS select to_char('0001-02-03 04:05:06',"t1"."fmt") AS "c1" from "t1" utf8mb3 utf8mb3_uca1400_ai_ci
SELECT * FROM v1;
c1
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:06 星期六 二月 ;
/1-2-3 4:5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-/2-3 4:5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-/3 4:5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 /4:5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:/5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:/6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 /星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 /二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; /1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-/2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-/3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 /4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:/5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:/6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:06 /星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:06 星期六 /二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:06 星期六 二月 /;
001 01 1 04; /1 1 1 4;
0001-02-03 [星期六] [二月 ]
1-2-3 [星期六] [二月]
0001-02-03 [星期六] [二月 ]; 1-2-3 [星期六] [二月]; 0001-02-03 [星期六] [二月 ]; 1-2-3 [星期六] [二月]; 0001-02-03 [星期六] [二月 ];
NULL
NULL
Warnings:
Warning 3047 Invalid argument error: date format not recognized at FX in function to_char.
Warning 3047 Invalid argument error: date format not recognized at F in function to_char.
SET sql_mode=DEFAULT;
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select to_char('0001-02-03 04:05:06',`t1`.`fmt`) AS `c1` from `t1` utf8mb3 utf8mb3_uca1400_ai_ci
SELECT * FROM v1;
c1
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:06 星期六 二月 ;
/1-2-3 4:5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-/2-3 4:5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-/3 4:5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 /4:5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:/5:6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:/6 星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 /星期六 二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 /二月; 1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; /1-2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-/2-3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-/3 4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 /4:5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:/5:6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:/6 星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:06 /星期六 二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:06 星期六 /二月;
0001-02-03 04:05:06 星期六 二月 ; 0001-02-03 04:05:06 星期六 二月 /;
001 01 1 04; /1 1 1 4;
0001-02-03 [星期六] [二月 ]
1-2-3 [星期六] [二月]
0001-02-03 [星期六] [二月 ]; 1-2-3 [星期六] [二月]; 0001-02-03 [星期六] [二月 ]; 1-2-3 [星期六] [二月]; 0001-02-03 [星期六] [二月 ];
NULL
NULL
Warnings:
Warning 3047 Invalid argument error: date format not recognized at FX in function to_char.
Warning 3047 Invalid argument error: date format not recognized at F in function to_char.
DROP VIEW v1;
SET lc_time_names=DEFAULT;

View File

@@ -234,3 +234,74 @@ SELECT TO_CHAR((VALUES('2022-12-12','2020-10-10')));
--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION
SELECT TO_CHAR((STR_TO_DATE('2023-01-01', '%d-%m-%Y'), 'YYYY-MM-DD') );
--echo #
--echo # MDEV-36216 TO_CHAR FM format not recognized in SQL_MODE=Oracle
--echo #
SET NAMES utf8mb3;
CREATE TABLE t1 (fmt VARCHAR(256));
INSERT INTO t1 VALUES
/* Add the slash character before FM to see the position of FM in the results */
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('/FMYYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-/FMMM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-/FMDD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD /FMHH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:/FMMI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:/FMSS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS /FMDAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY /FMMONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; /FMYYYY-MM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-/FMMM-DD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-/FMDD HH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD /FMHH24:MI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:/FMMI:SS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:/FMSS DAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS /FMDAY MONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY /FMMONTH;'),
('YYYY-MM-DD HH24:MI:SS DAY MONTH; YYYY-MM-DD HH24:MI:SS DAY MONTH/FM;'),
/*Formats not covered above */
('YYY YY Y HH12; /FMYYY YY Y HH12;'),
/*FM specified multiple times*/
('FMFMFMFMFMFMFMFMYYYY-MM-DD [DAY] [MONTH]'),
('FMFMFMFMFMFMFMFMFMYYYY-MM-DD [DAY] [MONTH]'),
(
'YYYY-MM-DD [DAY] [MONTH]; FMYYYY-MM-DD [DAY] [MONTH]; '
'FMYYYY-MM-DD [DAY] [MONTH]; FMYYYY-MM-DD [DAY] [MONTH]; '
'FMYYYY-MM-DD [DAY] [MONTH];'
),
/*Corner cases*/
('FX') /*Unknown format starting with 'F'*/,
('F') /*Unexpected end of the format string*/;
SET lc_time_names='en_US';
SELECT TO_CHAR('0001-02-03 04:05:06', fmt) AS c1 FROM t1;
SET sql_mode=ORACLE;
CREATE VIEW v1 AS SELECT TO_CHAR('0001-02-03 04:05:06', fmt) AS c1 FROM t1;
SHOW CREATE VIEW v1;
SELECT * FROM v1;
SET sql_mode=DEFAULT;
SHOW CREATE VIEW v1;
SELECT * FROM v1;
DROP VIEW v1;
SET lc_time_names='zh_CN';
SELECT TO_CHAR('0001-02-03 04:05:06', fmt) AS c1 FROM t1;
SET sql_mode=ORACLE;
CREATE VIEW v1 AS SELECT TO_CHAR('0001-02-03 04:05:06', fmt) AS c1 FROM t1;
SHOW CREATE VIEW v1;
SELECT * FROM v1;
SET sql_mode=DEFAULT;
SHOW CREATE VIEW v1;
SELECT * FROM v1;
DROP VIEW v1;
SET lc_time_names=DEFAULT;
DROP TABLE t1;

View File

@@ -8,9 +8,6 @@ ALTER DATABASE federated CHARACTER SET latin1;
set global federated_pushdown=1;
#Enable after fix MDEV-31846 or in v. 10.5 and later
--disable_cursor_protocol
connection slave;
DROP TABLE IF EXISTS federated.t1;
@@ -860,6 +857,4 @@ connection default;
set global federated_pushdown=0;
--enable_cursor_protocol
source include/federated_cleanup.inc;

View File

@@ -12,7 +12,6 @@ connection node_1;
connection node_4;
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
connection node_2;
connection node_1;
expected_error
1
connection node_2;

View File

@@ -1,29 +1,69 @@
connection node_2;
connection node_1;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
INSERT INTO t1(f2) SELECT seq FROM seq_1_to_1000;
connection node_2a;
SET SESSION wsrep_sync_wait=0;
connection node_1a;
# Block the applier on node_1 and issue a ddl from node_2
SET SESSION wsrep_sync_wait=0;
SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync';
connection node_2;
ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 123);;
# DDL 1
ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 VALUES (NULL, 10000, 10000);;
connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
# This will block on acquiring total order isolation
connection node_1;
# DDL 2
CREATE UNIQUE INDEX i1 ON t1(f2);;
connection node_1a;
# Signal DDL 1
SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync';
connection node_2;
INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 234);
SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
COUNT(*) = 3
1
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
COUNT(*) = 2
1
SELECT COUNT(*) = 2 FROM t1;
COUNT(*) = 2
1
connection node_1;
SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
COUNT(*) = 3
1
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
COUNT(*) = 2
1
SELECT COUNT(*) = 2 FROM t1;
COUNT(*) = 2
1
connection node_2;
SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
EXPECT_3
3
SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
EXPECT_2
2
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL AUTO_INCREMENT,
`f2` int(11) DEFAULT NULL,
`f3` int(11) DEFAULT NULL,
PRIMARY KEY (`f1`),
UNIQUE KEY `i1` (`f2`)
) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
SELECT COUNT(*) AS EXPECT_1001 FROM t1;
EXPECT_1001
1001
connection node_1;
SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
EXPECT_3
3
SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
EXPECT_2
2
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL AUTO_INCREMENT,
`f2` int(11) DEFAULT NULL,
`f3` int(11) DEFAULT NULL,
PRIMARY KEY (`f1`),
UNIQUE KEY `i1` (`f2`)
) ENGINE=InnoDB AUTO_INCREMENT=2047 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
SELECT COUNT(*) AS EXPECT_1001 FROM t1;
EXPECT_1001
1001
DROP TABLE t1;

View File

@@ -203,6 +203,9 @@ id b
3 200
4 5
connection node_2;
SELECT COUNT(*) FROM t1;
COUNT(*)
10
SELECT * FROM t1 ORDER BY id;
id b
1 1
@@ -228,6 +231,9 @@ DROP TABLE t1, t2;
CREATE TABLE t1 (a INT, b INT, UNIQUE(a)) ENGINE=MyISAM;
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=1;
INSERT INTO t1 (a,b) VALUES (10,20);
SELECT * from t1;
a b
1 20
connection node_2;
SELECT * from t1;
a b

View File

@@ -0,0 +1,112 @@
connection node_4;
connection node_3;
connection node_2;
connection node_1;
# Correct Galera library found
connection node_1;
connection node_2;
connection node_3;
connection node_4;
connection node_1;
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
CALL p1(130);
connection node_4;
Shutting down server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
Server 4 left the cluster
connection node_1;
CALL p1(130);
connection node_1;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_2;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_3;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
INSERT INTO t2 VALUES (DEFAULT);
CALL p1(130);
connection node_1;
SET GLOBAL debug = "+d,sync.wsrep_sst_donor_after_donation";
Restarting server 4
Wait for server 1 to become a donor
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_sst_donor_after_donation_reached";
Server 1 got SST request from server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_sst_donor_after_donation_continue";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
Waiting for server 4 to leave the cluster
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_4;
Server 4 left the cluster, killing it...
Killed server 4...
Restarting server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SELECT count(*) AS expect1_390 FROM t1;
expect1_390
390
SELECT count(*) AS expect1_1 FROM t2;
expect1_1
1
connection node_2;
SELECT count(*) AS expect2_390 FROM t1;
expect2_390
390
SELECT count(*) AS expect2_1 FROM t2;
expect2_1
1
connection node_3;
SELECT count(*) AS expect3_390 FROM t1;
expect3_390
390
SELECT count(*) AS expect3_1 FROM t2;
expect3_1
1
connection node_4;
SELECT count(*) AS expect4_390 FROM t1;
expect4_390
390
SELECT count(*) AS expect4_1 FROM t2;
expect4_1
1
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Failed on preordered");
CALL mtr.add_suppression("Failed to apply write set");
CALL mtr.add_suppression("Sending JOIN failed: -103");
CALL mtr.add_suppression("Failed to JOIN the cluster after SST");

View File

@@ -0,0 +1,94 @@
connection node_4;
connection node_3;
connection node_2;
connection node_1;
# Correct Galera library found
connection node_1;
connection node_2;
connection node_3;
connection node_4;
connection node_1;
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
CALL p1(130);
connection node_4;
Shutting down server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
SET GLOBAL debug = "+d,sync.wsrep_donor_state";
connection node_4;
Restarting server 4...
connection node_1;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_donor_state_reached";
Tables on server 1 flushed and locked for SST to server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_donor_state";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
Wait for the state snapshot to be copied to server 4
SST script unlocked server 1
connection node_1;
CALL p1(130);
connection node_1;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_2;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
connection node_3;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
INSERT INTO t2 VALUES (DEFAULT);
CALL p1(130);
Waiting for server 4 to leave the cluster
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_4;
Server 4 left the cluster, killing it...
Killed server 4...
Restarting server 4...
DROP TABLE t2;
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SELECT count(*) AS expect1_390 FROM t1;
expect1_390
390
connection node_2;
SELECT count(*) AS expect2_390 FROM t1;
expect2_390
390
connection node_3;
SELECT count(*) AS expect3_390 FROM t1;
expect3_390
390
connection node_4;
SELECT count(*) AS expect4_390 FROM t1;
expect4_390
390
DROP TABLE t1;
DROP PROCEDURE p1;
connection node_4;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus");
CALL mtr.add_suppression("Failed to apply write set: gtid:");

View File

@@ -0,0 +1,102 @@
connection node_4;
connection node_3;
connection node_2;
connection node_1;
# Correct Galera library found
connection node_1;
connection node_2;
connection node_3;
connection node_4;
connection node_1;
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
CALL p1(130);
connection node_4;
Shutting down server 4...
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
SET GLOBAL debug = "+d,sync.wsrep_donor_state";
connection node_4;
Restarting server 4...
connection node_1;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_donor_state_reached";
Tables on server 1 flushed and locked for SST to server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_donor_state";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
Wait for the state snapshot to be copied to server 4
SST script unlocked server 1
connection node_1;
CALL p1(130);
connection node_3;
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
INSERT INTO t2 VALUES (DEFAULT);
SET SESSION wsrep_on = OFF;
connection node_1;
CALL p1(130);
Waiting for server 3 to leave the cluster
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_2;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_4;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
Server 3 left the cluster, killing it...
Killed server 3.
Restarting server 3...
Waiting for server 3 to rejoin the cluster
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_3;
sleeping for 20
Waiting ready
Server 3 restarted.
connection node_1;
SET SESSION wsrep_on = ON;
SET SESSION wsrep_sync_wait = 15;
connection node_1;
SELECT count(*) AS expect1_390 FROM t1;
expect1_390
390
connection node_2;
SELECT count(*) AS expect2_390 FROM t1;
expect2_390
390
connection node_3;
SELECT count(*) AS expect3_390 FROM t1;
expect3_390
390
connection node_4;
SELECT count(*) AS expect4_390 FROM t1;
expect4_390
390
DROP TABLE t1;
DROP PROCEDURE p1;
connection node_1;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
connection node_2;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
connection node_3;
CALL mtr.add_suppression("Vote 0 \\(success\\) on .+ is inconsistent with group");
connection node_4;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");

View File

@@ -2,7 +2,7 @@
# Test the behavior of a Galera async slave if it goes non-prim. Async replication
# should abort with an error but it should be possible to restart it.
#
# The galera/galera_2node_slave.cnf describes the setup of the nodes
# The galera_3nodes_as_slave.cnf describes the setup of the nodes
#
--source include/have_innodb.inc
@@ -45,9 +45,8 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
--connection node_2
--sleep 5
wait_for_slave_to_stop;
--let $value = query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1)
--connection node_1
--disable_query_log
--eval SELECT "$value" IN ("Error 'Unknown command' on query. Default database: 'test'. Query: 'BEGIN'", "Node has dropped from cluster") AS expected_error
--enable_query_log
@@ -75,7 +74,6 @@ START SLAVE;
--connection node_4
DROP TABLE t1;
--sleep 2
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc

View File

@@ -1,43 +1,81 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/galera_have_debug_sync.inc
#
# In this test, we simultaneously send two non-conflicting ALTER TABLE statements
#
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
INSERT INTO t1(f2) SELECT seq FROM seq_1_to_1000;
--connection node_2
--connection node_2a
SET SESSION wsrep_sync_wait=0;
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--send ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 123);
--let $wait_condition = SELECT COUNT(*) = 1000 FROM t1;
--source include/wait_condition.inc
--connection node_1a
--echo # Block the applier on node_1 and issue a ddl from node_2
SET SESSION wsrep_sync_wait=0;
--let $galera_sync_point = apply_monitor_slave_enter_sync
--source include/galera_set_sync_point.inc
--connection node_2
--echo # DDL 1
--send ALTER TABLE t1 ADD COLUMN f3 INTEGER; INSERT INTO t1 VALUES (NULL, 10000, 10000);
--connection node_1a
--source include/galera_wait_sync_point.inc
--source include/galera_clear_sync_point.inc
--echo # This will block on acquiring total order isolation
--connection node_1
--echo # DDL 2
--send CREATE UNIQUE INDEX i1 ON t1(f2);
--connection node_1a
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'acquiring total order%' or STATE LIKE 'Waiting for table metadata%'
--source include/wait_condition.inc
--echo # Signal DDL 1
--source include/galera_clear_sync_point.inc
--let $galera_sync_point = apply_monitor_slave_enter_sync
--source include/galera_signal_sync_point.inc
--connection node_2
--reap
INSERT INTO t1 (f1, f2) VALUES (DEFAULT, 234);
--let $wait_condition = SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 2 FROM t1;
--connection node_1
--reap
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) = 2 FROM t1;
SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
SHOW CREATE TABLE t1;
SELECT COUNT(*) AS EXPECT_1001 FROM t1;
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1';
SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_NAME = 't1';
SHOW CREATE TABLE t1;
SELECT COUNT(*) AS EXPECT_1001 FROM t1;
DROP TABLE t1;

View File

@@ -22,6 +22,8 @@ SET GLOBAL wsrep_on = ON;
DROP TABLE t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
SHOW TABLES;
# Drop schema that does not exist
@@ -33,6 +35,8 @@ SET GLOBAL wsrep_on = ON;
DROP SCHEMA s1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME LIKE 's1';
--source include/wait_condition.inc
SHOW SCHEMAS;
# Drop index that does not exist using DROP INDEX
@@ -45,6 +49,10 @@ SET GLOBAL wsrep_on = ON;
DROP INDEX idx1 ON t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE NAME LIKE 'idx1';
--source include/wait_condition.inc
SHOW CREATE TABLE t1;
DROP TABLE t1;
@@ -58,6 +66,10 @@ SET GLOBAL wsrep_on = ON;
ALTER TABLE t1 DROP INDEX idx1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE NAME LIKE 'idx1';
--source include/wait_condition.inc
SHOW CREATE TABLE t1;
DROP TABLE t1;
@@ -71,6 +83,11 @@ SET GLOBAL wsrep_on = ON;
ALTER TABLE t1 DROP COLUMN f2;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS WHERE NAME LIKE 'f2';
--source include/wait_condition.inc
SHOW CREATE TABLE t1;
DROP TABLE t1;
@@ -93,6 +110,10 @@ DELETE FROM t1 WHERE f1 = 1;
SELECT COUNT(*) AS expect_0 FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) AS expect_0 FROM t1;
DROP TABLE t1;
@@ -112,6 +133,10 @@ COMMIT;
SELECT COUNT(*) AS expect_1 FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) AS expect_1 FROM t1;
DROP TABLE t1;
@@ -136,6 +161,8 @@ DELETE FROM t1;
SELECT COUNT(*) AS expect_0 FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
--source include/wait_condition.inc
SELECT VARIABLE_VALUE expect_Primary FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_status';
@@ -171,6 +198,8 @@ SET AUTOCOMMIT=ON;
SELECT COUNT(*) AS expect_0 FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
--source include/wait_condition.inc
SELECT VARIABLE_VALUE expect_Primary FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_status';
@@ -202,6 +231,8 @@ DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1;
SELECT COUNT(*) expect_0 FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 'Primary' FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_status';
@@ -219,6 +250,10 @@ CREATE TABLE child (id INT, parent_id INT, INDEX par_ind (parent_id), FOREIGN KE
INSERT INTO child VALUES (1,1),(2,2),(3,3);
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/parent';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/child';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 3 FROM child;
--source include/wait_condition.inc
@@ -233,6 +268,10 @@ SELECT COUNT(*) AS expect_0 FROM parent;
SELECT COUNT(*) AS expect_0 FROM child;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/parent';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/child';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 0 FROM child;
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 'Primary' FROM performance_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_status';

View File

@@ -21,6 +21,11 @@ INSERT INTO t1 VALUES (2), (3);
INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_5 FROM t1;
DROP TABLE t1;
@@ -36,6 +41,13 @@ REPLACE INTO t1 VALUES (1, 'klm'), (2,'xyz');
REPLACE INTO t1 SELECT 3, 'yyy' FROM DUAL;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy';
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_3 FROM t1;
SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 1 AND f2 = 'klm';
SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz';
@@ -49,6 +61,9 @@ SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy';
UPDATE t1 SET f2 = 'zzz' WHERE f2 = 'yyy';
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'zzz';
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f2 = 'zzz';
#
@@ -59,6 +74,9 @@ SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f2 = 'zzz';
DELETE FROM t1 WHERE f2 = 'zzz';
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'zzz';
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_0 FROM t1 WHERE f2 = 'zzz';
#
@@ -69,6 +87,9 @@ SELECT COUNT(*) AS EXPECT_0 FROM t1 WHERE f2 = 'zzz';
TRUNCATE TABLE t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_0 FROM t1;
DROP TABLE t1;
@@ -86,6 +107,15 @@ INSERT INTO t2 VALUES (1);
COMMIT;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t2;
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_1 FROM t1;
SELECT COUNT(*) AS EXPECT_1 FROM t2;
@@ -100,6 +130,11 @@ INSERT INTO t2 VALUES (2);
ROLLBACK;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t2;
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_2 FROM t1;
SELECT COUNT(*) AS EXPECT_1 FROM t2;
@@ -119,7 +154,13 @@ INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1);
--connection node_2
# The MyISAM update is replicated immediately, so a duplicate key error happens even before the COMMIT
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
# The MyISAM update is replicated when executed, so a duplicate key error happens even before the COMMIT
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES (1);
@@ -147,6 +188,10 @@ EXECUTE rep;
SELECT * FROM t1 ORDER BY id;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 11 FROM t1;
--source include/wait_condition.inc
SELECT * FROM t1 ORDER BY id;
DROP TABLE t1;
@@ -173,6 +218,10 @@ CALL proc();
SELECT * FROM t1 ORDER BY id;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 11 FROM t1;
--source include/wait_condition.inc
SELECT * FROM t1 ORDER BY id;
DROP PROCEDURE proc;
@@ -196,6 +245,13 @@ SELECT * FROM t1 ORDER BY id;
SELECT * FROM t2 ORDER BY id;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
--source include/wait_condition.inc
SELECT COUNT(*) FROM t1;
--let $wait_condition = SELECT COUNT(*) = 10 FROM t1;
--source include/wait_condition.inc
SELECT * FROM t1 ORDER BY id;
SELECT * FROM t2 ORDER BY id;
DROP TRIGGER tr1;
@@ -206,8 +262,14 @@ DROP TABLE t1, t2;
CREATE TABLE t1 (a INT, b INT, UNIQUE(a)) ENGINE=MyISAM;
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=1;
INSERT INTO t1 (a,b) VALUES (10,20);
SELECT * from t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
SELECT * from t1;
--connection node_1
DROP TABLE t1;

View File

@@ -0,0 +1,20 @@
!include ../galera_4nodes.cnf
[mysqld]
wsrep-ignore-apply-errors=0
[mysqld.1]
wsrep_node_name='node_1'
[mysqld.2]
wsrep_node_name='node_2'
[mysqld.3]
wsrep_node_name='node_3'
[mysqld.4]
wsrep_node_name='node_4'
wsrep_sst_donor='node_1'
[ENV]
galera_cluster_size=4

View File

@@ -0,0 +1,165 @@
#
# Test a case where a joiner encounters an error during IST
# Instead of voting it should assume error and bail out.
#
--source include/galera_cluster.inc
--source include/big_test.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
# Make sure that the test is operating on the right version of galera library.
--let $galera_version=26.4.19
source ../wsrep/include/check_galera_version.inc;
--let $node_1=node_1
--let $node_2=node_2
--let $node_3=node_3
--let $node_4=node_4
--source ../include/auto_increment_offset_save.inc
# create table t1 and procedure p1 to generate wirtesets
--connection node_1
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
DELIMITER |;
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
DELIMITER ;|
CALL p1(130);
--connection node_4
--echo Shutting down server 4...
--let $node_4_server_id= `SELECT @@server_id`
--let $node_4_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$node_4_server_id.expect
--let $node_4_pid_file= `SELECT @@pid_file`
--source include/shutdown_mysqld.inc
# Wait for node #4 to leave cluster
--let $members = 3
--connection node_1
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_3
--source include/wsrep_wait_membership.inc
--echo Server 4 left the cluster
# Create some writesets for IST
--connection node_1
CALL p1(130);
# Create a writeset that node 4 won't be able to apply by creating a table
# that won't be present in the replication stream
--connection node_1
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_2
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_3
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
# This should cause error during IST
INSERT INTO t2 VALUES (DEFAULT);
# make sure nodes 1,2,3 progress far enough for commit cut update
CALL p1(130);
--connection node_1
# prepare to stop SST donor thread when it receives a request from starting node #4
SET GLOBAL debug = "+d,sync.wsrep_sst_donor_after_donation";
--echo Restarting server 4
# Need to use this form instead of start_mysqld.inc because the latter is blocking
--exec echo "restart:$start_mysqld_params" > $node_4_expect_file_name
--echo Wait for server 1 to become a donor
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_sst_donor_after_donation_reached";
--echo Server 1 got SST request from server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_sst_donor_after_donation_continue";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
#
# After this point node #4 shall proceed to IST and bail out
#
--echo Waiting for server 4 to leave the cluster
--let $members = 3
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_3
--source include/wsrep_wait_membership.inc
--connection node_4
--echo Server 4 left the cluster, killing it...
# Kill the connected server
--exec echo "wait" > $node_4_expect_file_name
--let KILL_NODE_PIDFILE = $node_4_pid_file
--perl
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
system("kill -9 $mysqld_pid");
exit(0);
EOF
--echo Killed server 4...
--source include/wait_until_disconnected.inc
--echo Restarting server 4...
--source include/start_mysqld.inc
--source include/galera_wait_ready.inc
# Confirm node #4 has rejoined
--connection node_1
--let $members = 4
--source include/wsrep_wait_membership.inc
# Confirm that all is good and all nodes have identical data
--connection node_1
SELECT count(*) AS expect1_390 FROM t1;
SELECT count(*) AS expect1_1 FROM t2;
--connection node_2
SELECT count(*) AS expect2_390 FROM t1;
SELECT count(*) AS expect2_1 FROM t2;
--connection node_3
SELECT count(*) AS expect3_390 FROM t1;
SELECT count(*) AS expect3_1 FROM t2;
--connection node_4
SELECT count(*) AS expect4_390 FROM t1;
SELECT count(*) AS expect4_1 FROM t2;
DROP TABLE t1;
DROP TABLE t2;
DROP PROCEDURE p1;
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Failed on preordered");
CALL mtr.add_suppression("Failed to apply write set");
CALL mtr.add_suppression("Sending JOIN failed: -103");
CALL mtr.add_suppression("Failed to JOIN the cluster after SST");
--source ../include/auto_increment_offset_restore.inc

View File

@@ -0,0 +1,21 @@
!include ../galera_4nodes.cnf
[mysqld]
wsrep-ignore-apply-errors=0
[mysqld.1]
wsrep_node_name='node_1'
[mysqld.2]
wsrep_node_name='node_2'
[mysqld.3]
wsrep_node_name='node_3'
[mysqld.4]
wsrep_node_name='node_4'
wsrep_sst_donor='node_1'
[ENV]
galera_cluster_size=4
MTR_SST_JOINER_DELAY=20

View File

@@ -0,0 +1,73 @@
#
# Test a case where a vote happens in JOINED state after SST on a writeset
# that should be applied.
#
--source galera_vote_joined_begin.inc
#
# At this point state snapshot has been copied, node 1 is operational and
# we have about 10 seconds while everything we do will go into the replication
# queue on node 4 which it will have to apply on top of the snapshot.
#
# Increase replication queue on node_4
--connection node_1
CALL p1(130);
# Create a writeset that node 4 won't be able to apply by creating a table
# that won't be present in the replication stream
--connection node_1
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_2
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
--connection node_3
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
# This should cause node #4 to initiate a vote and leave the cluster
INSERT INTO t2 VALUES (DEFAULT);
# make sure nodes 1,2,3 progress far enough for commit cut update
CALL p1(130);
--echo Waiting for server 4 to leave the cluster
--let $members = 3
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_1
--source include/wsrep_wait_membership.inc
--connection node_4
--echo Server 4 left the cluster, killing it...
# Kill the connected server
--exec echo "wait" > $node_4_expect_file_name
--let KILL_NODE_PIDFILE = $node_4_pid_file
--perl
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
system("kill -9 $mysqld_pid");
exit(0);
EOF
--echo Killed server 4...
--source include/wait_until_disconnected.inc
--echo Restarting server 4...
--source include/start_mysqld.inc
--source include/galera_wait_ready.inc
DROP TABLE t2;
--source galera_vote_joined_end.inc
--connection node_4
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus");
CALL mtr.add_suppression("Failed to apply write set: gtid:");

View File

@@ -0,0 +1,79 @@
# This file purpose is to set up node 4 to require SST which is artificaially
# prolonged and as a result accumulate sufficient relication queue.
# The contents of the qeuee are controlled in the sourcing test files.
--source include/galera_cluster.inc
--source include/big_test.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
# Make sure that the test is operating on the right version of galera library.
--let $galera_version=26.4.19
source ../wsrep/include/check_galera_version.inc;
--let $node_1=node_1
--let $node_2=node_2
--let $node_3=node_3
--let $node_4=node_4
--source ../include/auto_increment_offset_save.inc
# create table t1 and procedure p1 to generate wirtesets
--connection node_1
CREATE TABLE t1(pk INT AUTO_INCREMENT PRIMARY KEY);
DELIMITER |;
CREATE PROCEDURE p1(IN max INT)
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i < max DO
INSERT IGNORE INTO t1 VALUES (DEFAULT);
SET i = i + 1;
END WHILE;
END|
DELIMITER ;|
# 130 events move the commit cut, it is essential in voting
CALL p1(130);
--connection node_4
--echo Shutting down server 4...
--let $node_4_server_id= `SELECT @@server_id`
--let $node_4_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$node_4_server_id.expect
--let $node_4_pid_file= `SELECT @@pid_file`
--source include/shutdown_mysqld.inc
# enforce SST
--exec rm -rf $MYSQLTEST_VARDIR/mysqld.4/data/grastate.dat
# Wait for node #4 to leave cluster
--connection node_1
--let $members = 3
--source include/wsrep_wait_membership.inc
# prepare to stop SST donor thread when node is in donor state
SET GLOBAL debug = "+d,sync.wsrep_donor_state";
--connection node_4
--echo Restarting server 4...
# Need to use this form instead of start_mysqld.inc because the latter is blocking
--exec echo "restart:$start_mysqld_params" > $node_4_expect_file_name
# Wait for node #1 to become a donor
--connection node_1
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_donor_state_reached";
--echo Tables on server 1 flushed and locked for SST to server 4
SET SESSION DEBUG_SYNC = "now SIGNAL signal.wsrep_donor_state";
SET GLOBAL debug = "";
SET DEBUG_SYNC='RESET';
--echo Wait for the state snapshot to be copied to server 4
--source include/galera_wait_ready.inc
--echo SST script unlocked server 1
#
# At this point state snapshot has been copied, node 1 is operational and
# we have about 20 seconds while everything we do will go into the replication
# queue on node 4 which it will have to apply on top of the snapshot.
#

View File

@@ -0,0 +1,33 @@
# Confirm node #4 has rejoined
--connection node_1
--let $members = 4
--source include/wsrep_wait_membership.inc
#DROP TABLE IF EXISTS t2;
# Confirm that all is good and all nodes have identical data
--connection node_1
SELECT count(*) AS expect1_390 FROM t1;
#CALL mtr.add_suppression("Replica SQL: Could not execute Delete_rows");
#CALL mtr.add_suppression("Event 3 Delete_rows apply failed: 120, seqno [0-9]+");
--connection node_2
SELECT count(*) AS expect2_390 FROM t1;
#CALL mtr.add_suppression("mysqld: Can't find record in 't1'");
#CALL mtr.add_suppression("Replica SQL: Could not execute Delete_rows");
#CALL mtr.add_suppression("Event 3 Delete_rows apply failed: 120, seqno seqno [0-9]+");
--connection node_3
SELECT count(*) AS expect3_390 FROM t1;
--connection node_4
SELECT count(*) AS expect4_390 FROM t1;
DROP TABLE t1;
DROP PROCEDURE p1;
#CALL mtr.add_suppression("inconsistent with group");
--source ../include/auto_increment_offset_restore.inc

View File

@@ -0,0 +1,21 @@
!include ../galera_4nodes.cnf
[mysqld]
wsrep-ignore-apply-errors=0
[mysqld.1]
wsrep_node_name='node_1'
[mysqld.2]
wsrep_node_name='node_2'
[mysqld.3]
wsrep_node_name='node_3'
[mysqld.4]
wsrep_node_name='node_4'
wsrep_sst_donor='node_1'
[ENV]
galera_cluster_size=4
MTR_SST_JOINER_DELAY=20

View File

@@ -0,0 +1,100 @@
#
# Test a case where a vote happens in JOINED state after SST on a writeset
# that should be skipped. I.e. JOINED node should continue operation.
#
--source galera_vote_joined_begin.inc
#
# At this point state snapshot has been copied, node 1 is operational and
# we have about 10 seconds while everything we do will go into the replication
# queue on node 4 which it will have to apply on top of the snapshot.
#
# Increase replication queue on node_4
--connection node_1
CALL p1(130);
#
# Create a writeset that node 4 won't be able to apply by making node 3
# inconsisitent
#
--connection node_3
--let $node_3_server_id= `SELECT @@server_id`
--let $node_3_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$node_3_server_id.expect
--let $node_3_pid_file= `SELECT @@pid_file`
SET SESSION wsrep_on = OFF;
CREATE TABLE t2(pk INT AUTO_INCREMENT PRIMARY KEY);
SET SESSION wsrep_on = ON;
# This should cause nodes #1 and #2 to initiate a vote and kick node #3
# out of the cluster, node #4 should recover the vote when fails to apply
# the event and continue
INSERT INTO t2 VALUES (DEFAULT);
SET SESSION wsrep_on = OFF;
# make sure nodes 1,2 progress far enough for commit cut update
--connection node_1
CALL p1(130);
--let $members = 3
--echo Waiting for server 3 to leave the cluster
--connection node_1
--source include/wsrep_wait_membership.inc
--connection node_2
--source include/wsrep_wait_membership.inc
--connection node_4
# need to wait for extra SST delay on joiner
--sleep $MTR_SST_JOINER_DELAY
--sleep $MTR_SST_JOINER_DELAY
--enable_reconnect
--let $wait_timeout = 60
--source include/wsrep_wait_membership.inc
--connection node_3
--echo Server 3 left the cluster, killing it...
# Kill the connected server
--exec echo "wait" > $node_3_expect_file_name
--let KILL_NODE_PIDFILE = $node_3_pid_file
--perl
my $pid_filename = $ENV{'KILL_NODE_PIDFILE'};
my $mysqld_pid = `cat $pid_filename`;
chomp($mysqld_pid);
system("kill -9 $mysqld_pid");
exit(0);
EOF
--echo Killed server 3.
--source include/wait_until_disconnected.inc
--echo Restarting server 3...
--exec echo "restart:$start_mysqld_params" > $node_3_expect_file_name
--echo Waiting for server 3 to rejoin the cluster
--connection node_1
--let $members = 3
--source include/wsrep_wait_membership.inc
--connection node_3
--echo sleeping for $MTR_SST_JOINER_DELAY
# need to wait for extra SST delay on joiner
--sleep $MTR_SST_JOINER_DELAY
--sleep $MTR_SST_JOINER_DELAY
--echo Waiting ready
--enable_reconnect
--source include/galera_wait_ready.inc
--echo Server 3 restarted.
--source galera_vote_joined_end.inc
--connection node_1
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
--connection node_2
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");
--connection node_3
CALL mtr.add_suppression("Vote 0 \\(success\\) on .+ is inconsistent with group");
--connection node_4
CALL mtr.add_suppression("BF applier thread=.+ failed to open_and_lock_tables for Table ");
CALL mtr.add_suppression("Event 3 Write_rows_v1 apply failed: 1146");

View File

@@ -77,6 +77,8 @@ select @@gtid_binlog_state;
--echo cluster 2 node 1
--connection node_4
--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
@@ -85,11 +87,16 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 2
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
@@ -99,10 +106,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 3
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
@@ -112,10 +123,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 2 node 2
--connection node_5
--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 22, 2);
select @@gtid_binlog_state;
@@ -125,37 +140,55 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 2 node 3
--connection node_6
--let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 23, 3);
select @@gtid_binlog_state;
--echo #wait for sync cluster 2 and 1
--connection node_4
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo # check other nodes are consistent
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_5
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_6
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 1
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
drop table t1;
stop slave;
@@ -250,6 +283,8 @@ select @@gtid_binlog_state;
--sleep 2
--echo cluster 2 node 1
--connection node_4
--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1;
--source include/wait_condition.inc
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
@@ -258,11 +293,16 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 2
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
@@ -272,10 +312,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 3
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
@@ -285,10 +329,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 2 node 2
--connection node_5
--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 22, 2);
select @@gtid_binlog_state;
@@ -298,10 +346,14 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo cluster 2 node 3
--connection node_6
--let $wait_condition = SELECT COUNT(*) = 5 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
insert into t1 values (2, 23, 3);
select @@gtid_binlog_state;
@@ -311,24 +363,36 @@ select @@gtid_binlog_state;
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select * from t1 order by 1, 2, 3;
--echo # check other nodes are consistent
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_5
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--connection node_6
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
select * from t1 order by 1, 2, 3;
--echo cluster 1 node 1
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 6 FROM test.t1;
--source include/wait_condition.inc
select @@gtid_binlog_state;
drop table t1;
stop slave;

View File

@@ -87,6 +87,8 @@ delete from t where a =13;
DROP INDEX idx1 ON t;
DROP INDEX idx2 ON t;
DROP TABLE t;
# restart
set default_storage_engine=innodb;
/* Test large BLOB data */
CREATE TABLE `t` (
`a` BLOB,

View File

@@ -1,6 +1,6 @@
--source include/have_innodb.inc
--source include/have_partition.inc
--source include/big_test.inc
--source include/not_embedded.inc
call mtr.add_suppression("\\[Warning\\] InnoDB: Compute virtual");
@@ -67,6 +67,41 @@ DROP INDEX idx1 ON t;
DROP INDEX idx2 ON t;
DROP TABLE t;
let MYSQLD_DATADIR=`select @@datadir`;
let PAGE_SIZE=`select @@innodb_page_size`;
--source include/shutdown_mysqld.inc
perl;
do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl";
my $file = "$ENV{MYSQLD_DATADIR}/ibdata1";
open(FILE, "+<$file") || die "Unable to open $file";
binmode FILE;
my $ps= $ENV{PAGE_SIZE};
my $page;
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
my $full_crc32 = unpack("N",substr($page,54,4)) & 0x10; # FIL_SPACE_FLAGS
sysseek(FILE, 7*$ps, 0) || die "Unable to seek $file\n";
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
substr($page,54,4)=pack("N",0xc001cafe); # 32 MSB of 64-bit DICT_HDR_INDEX_ID
my $polynomial = 0x82f63b78; # CRC-32C
if ($full_crc32)
{
my $ck = mycrc32(substr($page, 0, $ps-4), 0, $polynomial);
substr($page, $ps-4, 4) = pack("N", $ck);
}
else
{
my $ck= pack("N",mycrc32(substr($page, 4, 22), 0, $polynomial) ^
mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial));
substr($page,0,4)=$ck;
substr($page,$ps-8,4)=$ck;
}
sysseek(FILE, 7*$ps, 0) || die "Unable to rewind $file\n";
syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
close(FILE) || die "Unable to close $file";
EOF
--source include/start_mysqld.inc
set default_storage_engine=innodb;
/* Test large BLOB data */
CREATE TABLE `t` (
`a` BLOB,

View File

@@ -92,3 +92,24 @@ INSERT INTO t1 VALUES
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
DROP TABLE t1;
SET GLOBAL innodb_stats_persistent=@default_stats_persistent;
#
# MDEV-36504 Memory leak after insert into empty table
#
CREATE TABLE t1 (k INT PRIMARY KEY)ENGINE=InnoDB;
INSERT INTO t1 SET k= 1;
START TRANSACTION;
INSERT INTO t1 SET k= 2;
SELECT COUNT(*) > 0 FROM mysql.innodb_index_stats LOCK IN SHARE MODE;
COUNT(*) > 0
1
connect con1,localhost,root,,,;
SET innodb_lock_wait_timeout=0;
CREATE TABLE t2(f1 INT DEFAULT 1 PRIMARY KEY)
STATS_PERSISTENT= 1 ENGINE=InnoDB as SELECT k FROM t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
disconnect con1;
connection default;
SET innodb_lock_wait_timeout=default;
DROP TABLE t1;
DROP TABLE IF EXISTS t2;
# restart

View File

@@ -155,7 +155,6 @@ INSERT INTO parent SET a=0;
FLUSH TABLES;
# restart
disconnect incomplete;
SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = 0;
INSERT INTO child SET a=0;
INSERT INTO child SET a=1;
@@ -1186,6 +1185,25 @@ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fail
ALTER TABLE t2 ADD KEY(b), ALGORITHM=NOCOPY;
DELETE FROM t1;
DROP TABLE t2, t1;
#
# MDEV-33167 ASAN errors after failing to load foreign key
# relation for the table
#
call mtr.add_suppression("InnoDB: Load table `test`.`t3` failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again.");
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t1(f1 VARCHAR(8),
FOREIGN KEY(f1) REFERENCES test.t3(f1))ENGINE=InnoDB;
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t2(f1 VARCHAR(8),
FOREIGN KEY(f1) REFERENCES test.t3(f1))
ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t3(f1 VARCHAR(8) PRIMARY KEY)
ENGINE=InnoDB DEFAULT CHARSET=latin1;
set GLOBAL innodb_fast_shutdown=0;
# restart
ALTER TABLE t2 FORCE;
DROP TABLE t2, t1, t3;
# End of 10.6 tests
CREATE TABLE t1
(
@@ -1208,5 +1226,4 @@ ALTER TABLE t2 ADD FOREIGN KEY (f2) REFERENCES t2 (f2),
ADD UNIQUE INDEX(f3);
ERROR HY000: Cannot delete rows from table which is parent in a foreign key constraint 't1_ibfk_1' of table 't1'
drop table t1, t2;
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
# End of 10.11 tests

View File

@@ -12,12 +12,19 @@ select @@innodb_buffer_pool_size;
10485760
create table t1 (id int primary key, val int not null)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
create table t2 (id int primary key, val int not null)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=$kbs;
SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR
INSERT INTO t1 SELECT seq*4,seq*4 FROM seq_1_to_262144;
SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR
INSERT INTO t2 SELECT seq*4,seq*4 FROM seq_1_to_16384;
set global innodb_buffer_pool_size = 7340032;
select count(val) from t1;
count(val)
262144
select count(val) from t2;
count(val)
16384
set global innodb_adaptive_hash_index=OFF;
set global innodb_buffer_pool_size = 24117248;
set global innodb_buffer_pool_size = 26214400;
@@ -29,7 +36,10 @@ select @@innodb_buffer_pool_size;
select count(val) from t1;
count(val)
262144
drop table t1;
select count(val) from t2;
count(val)
16384
drop table t1,t2;
SET GLOBAL innodb_max_purge_lag_wait = 0;
SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct;
SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm;

View File

@@ -19,7 +19,7 @@ connection default;
SET DEBUG_SYNC='now WAIT_FOR blocked';
SHOW STATUS LIKE 'innodb_buffer_pool_resize_status';
Variable_name Value
Innodb_buffer_pool_resize_status Withdrawing blocks. (506/506).
Innodb_buffer_pool_resize_status Withdrawing blocks. (505/505).
SET DEBUG_SYNC='now SIGNAL go';
connection con1;
disconnect con1;

View File

@@ -1,10 +1,11 @@
SET @save_innodb_timeout=@@innodb_lock_wait_timeout;
SET GLOBAL innodb_lock_wait_timeout=1;
set session transaction isolation level read committed;
create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key
(what, id)) engine=innodb;
insert into innodb_bug52663 values ('total', 0, 0);
begin;
connect addconroot, localhost, root,,;
connection addconroot;
set session transaction isolation level read committed;
begin;
connection default;
@@ -31,3 +32,4 @@ select * from innodb_bug52663;
what id count
total 0 2
drop table innodb_bug52663;
SET GLOBAL innodb_lock_wait_timeout=@save_innodb_timeout;

View File

@@ -1,8 +1,9 @@
@@ -527,6 +527,6 @@
@@ -576,7 +576,7 @@
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
-37
+38
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
# End of 10.6 tests
CREATE TABLE t1(f1 INT, f2 TEXT)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 'a');
ALTER TABLE t1 ADD COLUMN f3 TEXT FIRST;

View File

@@ -569,5 +569,16 @@ FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
instants
37
CREATE TABLE t1(f1 INT, f2 TEXT)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 'a');
ALTER TABLE t1 ADD COLUMN f3 TEXT FIRST;
SET STATEMENT DEBUG_DBUG="+d,instant_insert_fail" FOR
ALTER TABLE t1 DROP COLUMN f1;
ERROR HY000: Internal error: InnoDB: Insert into SYS_COLUMNS failed
ALTER TABLE t1 DROP COLUMN f1;
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
# End of 10.6 tests

View File

@@ -1,3 +1,6 @@
connect disable_purging,localhost,root;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
#
# MDEV-26642 Weird SELECT view when a record is
# modified to the same value by two transactions
@@ -53,15 +56,17 @@ DROP TABLE t;
# MDEV-26643 Inconsistent behaviors of UPDATE under
# READ UNCOMMITTED and READ COMMITTED isolation level
#
CREATE TABLE t(a INT, b INT) ENGINE=InnoDB;
CREATE TABLE t(a INT, b INT) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t VALUES(NULL, 1), (2, 2);
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
BEGIN;
UPDATE t SET a = 10;
connection consistent;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
UPDATE t SET b = 20 WHERE a;
connection default;
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
COMMIT;
connection consistent;
SELECT * FROM t;
@@ -75,8 +80,10 @@ BEGIN;
UPDATE t SET a = 10;
connection consistent;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
UPDATE t SET b = 20 WHERE a;
connection default;
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
COMMIT;
connection consistent;
SELECT * FROM t;
@@ -90,8 +97,10 @@ BEGIN;
UPDATE t SET a = 10;
connection con_weird;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
UPDATE t SET b = 20 WHERE a;
connection default;
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
SELECT * FROM t;
a b
10 1
@@ -114,8 +123,10 @@ UPDATE t SET b = 3;
connection consistent;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
UPDATE t SET b = 2 WHERE a;
connection default;
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
UPDATE t SET a = 1;
COMMIT;
connection consistent;
@@ -129,20 +140,25 @@ DROP TABLE t;
#
# MDEV-33802 Weird read view after ROLLBACK of other transactions
#
CREATE TABLE t(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
INSERT INTO t SET a=1;
BEGIN;
INSERT INTO t SET a=2;
CREATE TABLE t(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB STATS_PERSISTENT=0;
connection consistent;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
INSERT INTO t SET a=1;
connection consistent;
SAVEPOINT sp1;
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
ERROR HY000: Record has changed since last read in table 't'
SAVEPOINT sp1;
connection default;
BEGIN;
INSERT INTO t SET a=2;
connection con_weird;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
connection default;
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
ROLLBACK;
connection con_weird;
a b
@@ -150,12 +166,74 @@ a b
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
a b
1 NULL
COMMIT;
disconnect con_weird;
connection consistent;
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
a b
1 NULL
disconnect consistent;
COMMIT;
connection default;
TRUNCATE TABLE t;
#
# MDEV-36639 innodb_snapshot_isolation=1 gives error for not comitted row changes
#
INSERT INTO t VALUES (1,1),(2,2);
connection default;
# Case 1: Transaction A modifies a record, transaction B with snapshot
# isolation level is blocked by A, then A is committed.
# Expected behaviour: B gets ER_CHECKREAD.
BEGIN;
UPDATE t SET b=3 WHERE a = 1;
connection consistent;
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t;
a b
1 1
2 2
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
SELECT * FROM t WHERE a=1 FOR UPDATE;
connection default;
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
COMMIT;
connection consistent;
ERROR HY000: Record has changed since last read in table 't'
# Case 2: Transaction A modifies a record, transaction B with snapshot
# isolation level is blocked by A, then A is rolled back.
# Expected behaviour: B continues execution.
connection default;
BEGIN;
UPDATE t SET b=4 WHERE a=1;
connection consistent;
BEGIN;
SELECT * FROM t;
a b
2 2
1 3
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
SELECT * FROM t WHERE a=1 FOR UPDATE;
connection default;
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
ROLLBACK;
connection consistent;
a b
1 3
ROLLBACK;
# Case 3: Transaction B with snapshot isolation level started with
# consistent snapshot. Transaction A modifies a record and is committed.
# Both B tries to read modified by A record.
# Expected behavior: B gets ER_CHECKREAD.
connection consistent;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection default;
UPDATE t SET b=4 WHERE a=1;
connection consistent;
SELECT * FROM t WHERE a=1 FOR UPDATE;
ERROR HY000: Record has changed since last read in table 't'
disconnect consistent;
disconnect disable_purging;
connection default;
SET DEBUG_SYNC="RESET";
DROP TABLE t;
# End of 10.6 tests

View File

@@ -0,0 +1,25 @@
# restart
SET GLOBAL innodb_file_per_table= 0;
Warnings:
Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release
SET GLOBAL innodb_limit_optimistic_insert_debug = 2;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT NOT NULL)ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;
SET GLOBAL innodb_file_per_table= default;
Warnings:
Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release
CREATE TABLE t2(f1 INT NOT NULL PRIMARY KEY,f2 VARCHAR(40))ENGINE=InnoDB PARTITION BY KEY() PARTITIONS 256;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;
DROP TABLE t2, t1;
InnoDB 0 transactions not purged
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 205520896
set GLOBAL innodb_fast_shutdown= 0;
# restart
FOUND 1 /InnoDB: Moving the data from extents 4096 through 22016/ in mysqld.1.err
FOUND 1 /InnoDB: Defragmentation of system tablespace is successful/ in mysqld.1.err
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 14680064
# restart

View File

@@ -0,0 +1,52 @@
call mtr.add_suppression("InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed: Data structure corruption");
call mtr.add_suppression("InnoDB: Defragmentation of CLUST_IND in SYS_COLUMNS failed: Data structure corruption");
call mtr.add_suppression("InnoDB: Cannot free the unused segments in system tablespace");
# restart
set GLOBAL innodb_file_per_table = 0;
Warnings:
Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release
set GLOBAL innodb_limit_optimistic_insert_debug = 2;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL)ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
SET GLOBAL innodb_file_per_table= 1;
Warnings:
Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a future release
CREATE TABLE t2(f1 INT NOT NULL PRIMARY KEY,
f2 VARCHAR(40))ENGINE=InnoDB PARTITION BY KEY() PARTITIONS 256;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
DROP TABLE t2;
InnoDB 0 transactions not purged
# restart
FOUND 1 /InnoDB: User table exists in the system tablespace/ in mysqld.1.err
DROP TABLE t1;
InnoDB 0 transactions not purged
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 58720256
# restart: --debug_dbug=+d,fail_after_level_defragment
FOUND 1 /InnoDB: Defragmentation of CLUST_IND in SYS_COLUMNS failed./ in mysqld.1.err
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 58720256
# restart: --debug_dbug=d,allocation_prepare_fail
FOUND 1 /InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed./ in mysqld.1.err
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 58720256
# restart: --debug_dbug=d,relation_page_prepare_fail
FOUND 2 /InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed./ in mysqld.1.err
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 58720256
# restart: --debug_dbug=d,remover_prepare_fail
FOUND 3 /InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed./ in mysqld.1.err
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 58720256
# restart
FOUND 5 /InnoDB: Moving the data from extents 4096 through 8960/ in mysqld.1.err
FOUND 1 /InnoDB: Defragmentation of system tablespace is successful/ in mysqld.1.err
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
name file_size
innodb_system 15728640
# restart

View File

@@ -4,7 +4,7 @@ Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a fu
SET UNIQUE_CHECKS=0, FOREIGN_KEY_CHECKS=0;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
f3 INT NOT NULL, INDEX(f1),
INDEX(f2), INDEX(f3))ENGINE=InnoDB;
INDEX(f2), INDEX(f3))STATS_PERSISTENT=0 ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;

View File

@@ -9,7 +9,7 @@ Warning 1287 '@@innodb_file_per_table' is deprecated and will be removed in a fu
SET UNIQUE_CHECKS=0, FOREIGN_KEY_CHECKS=0;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
f3 INT NOT NULL, INDEX(f1),
INDEX(f2), INDEX(f3))ENGINE=InnoDB;
INDEX(f2), INDEX(f3))STATS_PERSISTENT=0 ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;

View File

@@ -110,3 +110,24 @@ INSERT INTO t1 VALUES
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
DROP TABLE t1;
SET GLOBAL innodb_stats_persistent=@default_stats_persistent;
--echo #
--echo # MDEV-36504 Memory leak after insert into empty table
--echo #
CREATE TABLE t1 (k INT PRIMARY KEY)ENGINE=InnoDB;
INSERT INTO t1 SET k= 1;
START TRANSACTION;
INSERT INTO t1 SET k= 2;
SELECT COUNT(*) > 0 FROM mysql.innodb_index_stats LOCK IN SHARE MODE;
connect(con1,localhost,root,,,);
SET innodb_lock_wait_timeout=0;
--error ER_LOCK_WAIT_TIMEOUT
CREATE TABLE t2(f1 INT DEFAULT 1 PRIMARY KEY)
STATS_PERSISTENT= 1 ENGINE=InnoDB as SELECT k FROM t1;
disconnect con1;
connection default;
SET innodb_lock_wait_timeout=default;
DROP TABLE t1;
DROP TABLE IF EXISTS t2;
--source include/restart_mysqld.inc

View File

@@ -133,7 +133,6 @@ FLUSH TABLES;
--let $shutdown_timeout=
disconnect incomplete;
SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent;
SET GLOBAL innodb_stats_persistent = 0;
INSERT INTO child SET a=0;
@@ -1245,6 +1244,33 @@ ALTER TABLE t2 ADD KEY(b), ALGORITHM=NOCOPY;
DELETE FROM t1;
DROP TABLE t2, t1;
--echo #
--echo # MDEV-33167 ASAN errors after failing to load foreign key
--echo # relation for the table
--echo #
call mtr.add_suppression("InnoDB: Load table `test`.`t3` failed, the table has missing foreign key indexes. Turn off 'foreign_key_checks' and try again.");
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t1(f1 VARCHAR(8),
FOREIGN KEY(f1) REFERENCES test.t3(f1))ENGINE=InnoDB;
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t2(f1 VARCHAR(8),
FOREIGN KEY(f1) REFERENCES test.t3(f1))
ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
SET STATEMENT FOREIGN_KEY_CHECKS = 0 FOR
CREATE TABLE t3(f1 VARCHAR(8) PRIMARY KEY)
ENGINE=InnoDB DEFAULT CHARSET=latin1;
set GLOBAL innodb_fast_shutdown=0;
--let $shutdown_timeout=
--source include/restart_mysqld.inc
# Error encountered while loading the foreign key
# constraint for t3. t1 wasn't loaded into memory yet
# t2 failed to find index for foreign key relation
ALTER TABLE t2 FORCE;
DROP TABLE t2, t1, t3;
--echo # End of 10.6 tests
CREATE TABLE t1
@@ -1270,7 +1296,5 @@ ALTER TABLE t1 ADD FOREIGN KEY (f1) REFERENCES t2 (f2);
ALTER TABLE t2 ADD FOREIGN KEY (f2) REFERENCES t2 (f2),
ADD UNIQUE INDEX(f3);
drop table t1, t2;
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
--echo # End of 10.11 tests
--source include/wait_until_count_sessions.inc

View File

@@ -21,6 +21,7 @@ set global innodb_buffer_pool_size = 9437184;
set global innodb_buffer_pool_size = 10485760;
select @@innodb_buffer_pool_size;
let $kbs=`SELECT CAST(@@innodb_page_size / 1024 AS INT)`;
# fill buffer pool
--disable_query_log
@@ -29,9 +30,13 @@ SET GLOBAL innodb_read_only_compressed=OFF;
--enable_query_log
create table t1 (id int primary key, val int not null)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
evalp create table t2 (id int primary key, val int not null)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=$kbs;
SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR
INSERT INTO t1 SELECT seq*4,seq*4 FROM seq_1_to_262144;
SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR
INSERT INTO t2 SELECT seq*4,seq*4 FROM seq_1_to_16384;
--disable_query_log
SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
@@ -42,6 +47,7 @@ SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed;
set global innodb_buffer_pool_size = 7340032;
select count(val) from t1;
select count(val) from t2;
set global innodb_adaptive_hash_index=OFF;
@@ -52,8 +58,9 @@ set global innodb_buffer_pool_size = 26214400;
select @@innodb_buffer_pool_size;
select count(val) from t1;
select count(val) from t2;
drop table t1;
drop table t1,t2;
SET GLOBAL innodb_max_purge_lag_wait = 0;
SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct;
@@ -66,8 +73,6 @@ SELECT variable_value = 0
FROM information_schema.global_status
WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY';
--source include/wait_condition.inc
# this may occasionally be aborted on a heavily loaded builder
--error 0,ER_WRONG_USAGE
SET GLOBAL innodb_buffer_pool_size = @old_innodb_buffer_pool_size;
SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index;
SET GLOBAL innodb_max_dirty_pages_pct = @save_pct;

View File

@@ -25,8 +25,8 @@ SET DEBUG_SYNC='buf_pool_shrink_before_wakeup SIGNAL blocked WAIT_FOR go';
send SET GLOBAL innodb_buffer_pool_size=8388608;
connection default;
SET DEBUG_SYNC='now WAIT_FOR blocked';
# adjust for 32-bit
--replace_result 504/504 505/505
# adjust for 32-bit and SUX_LOCK_GENERIC
--replace_regex /(5..)\/\1/505\/505/
SHOW STATUS LIKE 'innodb_buffer_pool_resize_status';
SET DEBUG_SYNC='now SIGNAL go';
connection con1;

View File

@@ -1,6 +1,7 @@
--source include/long_test.inc
--source include/have_innodb.inc
SET @save_innodb_timeout=@@innodb_lock_wait_timeout;
SET GLOBAL innodb_lock_wait_timeout=1;
set session transaction isolation level read committed;
create table innodb_bug52663 (what varchar(5), id integer, count integer, primary key
@@ -9,7 +10,6 @@ insert into innodb_bug52663 values ('total', 0, 0);
begin;
connect (addconroot, localhost, root,,);
connection addconroot;
set session transaction isolation level read committed;
begin;
@@ -33,3 +33,4 @@ select * from innodb_bug52663;
connection default;
select * from innodb_bug52663;
drop table innodb_bug52663;
SET GLOBAL innodb_lock_wait_timeout=@save_innodb_timeout;

View File

@@ -652,11 +652,19 @@ DROP TABLE t1;
SET DEBUG_SYNC=RESET;
--echo # End of 10.5 tests
SELECT variable_value-@old_instant instants
FROM information_schema.global_status
WHERE variable_name = 'innodb_instant_alter_column';
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
CREATE TABLE t1(f1 INT, f2 TEXT)ENGINE=InnoDB;
INSERT INTO t1 VALUES(1, 'a');
ALTER TABLE t1 ADD COLUMN f3 TEXT FIRST;
--error ER_INTERNAL_ERROR
SET STATEMENT DEBUG_DBUG="+d,instant_insert_fail" FOR
ALTER TABLE t1 DROP COLUMN f1;
ALTER TABLE t1 DROP COLUMN f1;
CHECK TABLE t1;
DROP TABLE t1;
SET GLOBAL innodb_stats_persistent = @save_stats_persistent;
--echo # End of 10.6 tests

View File

@@ -1,9 +1,16 @@
--source include/have_innodb.inc
--source include/count_sessions.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--disable_query_log
call mtr.add_suppression("InnoDB: Transaction was aborted due to ");
--enable_query_log
--connect disable_purging,localhost,root
START TRANSACTION WITH CONSISTENT SNAPSHOT;
--connection default
--echo #
--echo # MDEV-26642 Weird SELECT view when a record is
--echo # modified to the same value by two transactions
@@ -42,22 +49,18 @@ DROP TABLE t;
--echo # READ UNCOMMITTED and READ COMMITTED isolation level
--echo #
CREATE TABLE t(a INT, b INT) ENGINE=InnoDB;
CREATE TABLE t(a INT, b INT) ENGINE=InnoDB STATS_PERSISTENT=0;
INSERT INTO t VALUES(NULL, 1), (2, 2);
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
BEGIN; UPDATE t SET a = 10;
--connection consistent
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
--send UPDATE t SET b = 20 WHERE a
--connection default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = 'Updating'
and info = 'UPDATE t SET b = 20 WHERE a';
--source include/wait_condition.inc
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
COMMIT;
--connection consistent
@@ -71,14 +74,11 @@ BEGIN; UPDATE t SET a = 10;
--connection consistent
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
--send UPDATE t SET b = 20 WHERE a
--connection default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where info = 'UPDATE t SET b = 20 WHERE a';
--source include/wait_condition.inc
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
COMMIT;
--connection consistent
@@ -92,15 +92,11 @@ BEGIN; UPDATE t SET a = 10;
--connection con_weird
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
send UPDATE t SET b = 20 WHERE a;
--connection default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = 'Updating'
and info = 'UPDATE t SET b = 20 WHERE a';
--source include/wait_condition.inc
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
SELECT * FROM t;
COMMIT;
@@ -124,14 +120,11 @@ SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
# As semi-consistent read is disabled for innodb_snapshot_isolation=ON, the
# following UPDATE must be blocked on the first record.
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
--send UPDATE t SET b = 2 WHERE a
--connection default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = 'Updating' and info = 'UPDATE t SET b = 2 WHERE a';
--source include/wait_condition.inc
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
UPDATE t SET a = 1;
COMMIT;
--connection consistent
@@ -150,13 +143,15 @@ DROP TABLE t;
--echo # MDEV-33802 Weird read view after ROLLBACK of other transactions
--echo #
CREATE TABLE t(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
INSERT INTO t SET a=1;
BEGIN; INSERT INTO t SET a=2;
CREATE TABLE t(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB STATS_PERSISTENT=0;
--connection consistent
START TRANSACTION WITH CONSISTENT SNAPSHOT;
--connection default
INSERT INTO t SET a=1;
--connection consistent
SAVEPOINT sp1;
--disable_ps2_protocol
--error ER_CHECKREAD
@@ -164,29 +159,100 @@ SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
--enable_ps2_protocol
SAVEPOINT sp1;
--connection default
BEGIN; INSERT INTO t SET a=2;
--connection con_weird
START TRANSACTION WITH CONSISTENT SNAPSHOT;
send
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
--send SELECT * FROM t FORCE INDEX (b) FOR UPDATE
--connection default
let $wait_condition=
select count(*) = 1 from information_schema.processlist
where state = 'Sending data'
and info LIKE 'SELECT * FROM t %';
--source include/wait_condition.inc
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
ROLLBACK;
--connection con_weird
--reap
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
COMMIT;
--disconnect con_weird
--connection consistent
SELECT * FROM t FORCE INDEX (b) FOR UPDATE;
--disconnect consistent
COMMIT;
--connection default
TRUNCATE TABLE t;
--echo #
--echo # MDEV-36639 innodb_snapshot_isolation=1 gives error for not comitted row changes
--echo #
INSERT INTO t VALUES (1,1),(2,2);
--connection default
--echo # Case 1: Transaction A modifies a record, transaction B with snapshot
--echo # isolation level is blocked by A, then A is committed.
--echo # Expected behaviour: B gets ER_CHECKREAD.
BEGIN;
UPDATE t SET b=3 WHERE a = 1;
--connection consistent
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
--send SELECT * FROM t WHERE a=1 FOR UPDATE
--connection default
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
COMMIT;
--connection consistent
--error ER_CHECKREAD
--reap
--echo # Case 2: Transaction A modifies a record, transaction B with snapshot
--echo # isolation level is blocked by A, then A is rolled back.
--echo # Expected behaviour: B continues execution.
--connection default
BEGIN;
UPDATE t SET b=4 WHERE a=1;
--connection consistent
BEGIN;
SELECT * FROM t;
SET DEBUG_SYNC="lock_wait_before_suspend SIGNAL select_blocked";
--send SELECT * FROM t WHERE a=1 FOR UPDATE
--connection default
SET DEBUG_SYNC="now WAIT_FOR select_blocked";
ROLLBACK;
--connection consistent
--reap
ROLLBACK;
--echo # Case 3: Transaction B with snapshot isolation level started with
--echo # consistent snapshot. Transaction A modifies a record and is committed.
--echo # Both B tries to read modified by A record.
--echo # Expected behavior: B gets ER_CHECKREAD.
--connection consistent
START TRANSACTION WITH CONSISTENT SNAPSHOT;
--connection default
UPDATE t SET b=4 WHERE a=1;
--connection consistent
--error ER_CHECKREAD
SELECT * FROM t WHERE a=1 FOR UPDATE;
--disconnect consistent
--disconnect disable_purging
--connection default
SET DEBUG_SYNC="RESET";
DROP TABLE t;
--source include/wait_until_count_sessions.inc
--echo # End of 10.6 tests

View File

@@ -0,0 +1,6 @@
--innodb_page_size=4k
--innodb_data_file_path=ibdata1:1M:autoextend:autoshrink
--innodb_undo_tablespaces=0
--innodb_stats_persistent=0
--skip_partition=0
--innodb_sys_tablespaces

View File

@@ -0,0 +1,40 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
--source include/have_debug.inc
--let MYSQLD_DATADIR= `SELECT @@datadir`
--source include/shutdown_mysqld.inc
--copy_file $MYSQLD_DATADIR/ibdata1 $MYSQLD_DATADIR/ibdata1_copy
--copy_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile0_copy
--source include/start_mysqld.inc
SET GLOBAL innodb_file_per_table= 0;
SET GLOBAL innodb_limit_optimistic_insert_debug = 2;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, f3 INT NOT NULL)ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;
SET GLOBAL innodb_file_per_table= default;
CREATE TABLE t2(f1 INT NOT NULL PRIMARY KEY,f2 VARCHAR(40))ENGINE=InnoDB PARTITION BY KEY() PARTITIONS 256;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;
DROP TABLE t2, t1;
--source include/wait_all_purged.inc
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
set GLOBAL innodb_fast_shutdown= 0;
--source include/restart_mysqld.inc
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN=InnoDB: Moving the data from extents 4096 through 22016;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN=InnoDB: Defragmentation of system tablespace is successful;
--source include/search_pattern_in_file.inc
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
--source include/shutdown_mysqld.inc
--move_file $MYSQLD_DATADIR/ibdata1_copy $MYSQLD_DATADIR/ibdata1
--move_file $MYSQLD_DATADIR/ib_logfile0_copy $MYSQLD_DATADIR/ib_logfile0
--source include/start_mysqld.inc

View File

@@ -0,0 +1,6 @@
--innodb_page_size=4k
--innodb_data_file_path=ibdata1:15M:autoextend:autoshrink
--innodb_undo_tablespaces=0
--innodb_stats_persistent=0
--skip_partition=0
--innodb_sys_tablespaces

View File

@@ -0,0 +1,90 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_sequence.inc
call mtr.add_suppression("InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed: Data structure corruption");
call mtr.add_suppression("InnoDB: Defragmentation of CLUST_IND in SYS_COLUMNS failed: Data structure corruption");
call mtr.add_suppression("InnoDB: Cannot free the unused segments in system tablespace");
--let MYSQLD_DATADIR= `SELECT @@datadir`
--source include/shutdown_mysqld.inc
--copy_file $MYSQLD_DATADIR/ibdata1 $MYSQLD_DATADIR/ibdata1_copy
--copy_file $MYSQLD_DATADIR/ib_logfile0 $MYSQLD_DATADIR/ib_logfile0_copy
--source include/start_mysqld.inc
set GLOBAL innodb_file_per_table = 0;
set GLOBAL innodb_limit_optimistic_insert_debug = 2;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL)ENGINE=InnoDB;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
SET GLOBAL innodb_file_per_table= 1;
CREATE TABLE t2(f1 INT NOT NULL PRIMARY KEY,
f2 VARCHAR(40))ENGINE=InnoDB PARTITION BY KEY() PARTITIONS 256;
INSERT INTO t1 SELECT seq, seq FROM seq_1_to_4096;
DROP TABLE t2;
--source include/wait_all_purged.inc
let $restart_parameters=;
--source include/restart_mysqld.inc
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN=InnoDB: User table exists in the system tablespace;
--source include/search_pattern_in_file.inc
DROP TABLE t1;
--source include/wait_all_purged.inc
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
let $restart_parameters=--debug_dbug=+d,fail_after_level_defragment;
--source include/restart_mysqld.inc
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN=InnoDB: Defragmentation of CLUST_IND in SYS_COLUMNS failed.;
--source include/search_pattern_in_file.inc
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
let $restart_parameters=--debug_dbug=d,allocation_prepare_fail;
--source include/restart_mysqld.inc
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN=InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed.;
--source include/search_pattern_in_file.inc
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
let $restart_parameters=--debug_dbug=d,relation_page_prepare_fail;
--source include/restart_mysqld.inc
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN=InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed.;
--source include/search_pattern_in_file.inc
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
let $restart_parameters=--debug_dbug=d,remover_prepare_fail;
--source include/restart_mysqld.inc
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN=InnoDB: Defragmentation of CLUST_IND in SYS_INDEXES failed.;
--source include/search_pattern_in_file.inc
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
let $restart_parameters=;
--source include/restart_mysqld.inc
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN= InnoDB: Moving the data from extents 4096 through 8960;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN=InnoDB: Defragmentation of system tablespace is successful;
--source include/search_pattern_in_file.inc
select name, file_size from information_schema.innodb_sys_tablespaces where space = 0;
--source include/shutdown_mysqld.inc
--move_file $MYSQLD_DATADIR/ibdata1_copy $MYSQLD_DATADIR/ibdata1
--move_file $MYSQLD_DATADIR/ib_logfile0_copy $MYSQLD_DATADIR/ib_logfile0
--source include/start_mysqld.inc

View File

@@ -1,2 +1,3 @@
--innodb_data_file_path=ibdata1:10M:autoextend:autoshrink
--innodb_sys_tablespaces
--innodb_buffer_pool_size=75M

View File

@@ -1,10 +1,11 @@
--source include/have_innodb.inc
--source include/have_sequence.inc
SET GLOBAL INNODB_FILE_PER_TABLE= 0;
SET UNIQUE_CHECKS=0, FOREIGN_KEY_CHECKS=0;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
f3 INT NOT NULL, INDEX(f1),
INDEX(f2), INDEX(f3))ENGINE=InnoDB;
INDEX(f2), INDEX(f3))STATS_PERSISTENT=0 ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;

View File

@@ -1,3 +1,4 @@
--innodb_data_file_path=ibdata1:1M:autoextend:autoshrink
--innodb_sys_tablespaces
--innodb_page_size=4k
--innodb_buffer_pool_size=100M

View File

@@ -16,7 +16,7 @@ SET GLOBAL INNODB_FILE_PER_TABLE= 0;
SET UNIQUE_CHECKS=0, FOREIGN_KEY_CHECKS=0;
CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL,
f3 INT NOT NULL, INDEX(f1),
INDEX(f2), INDEX(f3))ENGINE=InnoDB;
INDEX(f2), INDEX(f3))STATS_PERSISTENT=0 ENGINE=InnoDB;
BEGIN;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;
INSERT INTO t1 SELECT seq, seq, seq FROM seq_1_to_16384;

View File

@@ -2886,7 +2886,7 @@ json_unquote(json_compact('["a", "b", "c"]'))
["a", "b", "c"]
select charset(json_unquote('"abc"'));
charset(json_unquote('"abc"'))
utf8mb3
utf8mb4
select json_quote(convert(X'e68891' using utf8));
json_quote(convert(X'e68891' using utf8))
"我"
@@ -3633,7 +3633,7 @@ JSON_UNQUOTE("String"),
COERCIBILITY(JSON_UNQUOTE("String")),
COLLATION(JSON_UNQUOTE("String"));
JSON_UNQUOTE("String") COERCIBILITY(JSON_UNQUOTE("String")) COLLATION(JSON_UNQUOTE("String"))
String 4 utf8mb3_general_ci
String 4 utf8mb4_bin
#
# End of 11.4 tests
#

View File

@@ -20,12 +20,12 @@ echo #;
# fails to connect, passwordless root
echo # tcp ssl ssl-verify-server-cert;
error 1;
exec $XTRABACKUP --protocol=tcp --user=root --port=$MASTER_MYPORT --backup --target-dir=$targetdir;
exec $XTRABACKUP --no-defaults --protocol=tcp --user=root --port=$MASTER_MYPORT --backup --target-dir=$targetdir;
--echo #
--echo # MDEV-32473 --disable-ssl doesn't disable it
--echo #
# connects fine
echo # tcp skip-ssl;
exec $XTRABACKUP --protocol=tcp --user=root --skip-ssl --port=$MASTER_MYPORT --backup --target-dir=$targetdir;
exec $XTRABACKUP --no-defaults --protocol=tcp --user=root --skip-ssl --port=$MASTER_MYPORT --backup --target-dir=$targetdir;
rmdir $targetdir;

View File

@@ -20,11 +20,11 @@ rmdir $targetdir;
echo # tcp, not self-signed cert with a wrong hostname: fails;
error 1;
exec $XTRABACKUP --protocol=tcp --user=root --port=$MASTER_MYPORT --backup --target-dir=$targetdir;
exec $XTRABACKUP --no-defaults --protocol=tcp --user=root --port=$MASTER_MYPORT --backup --target-dir=$targetdir;
echo # tcp, not self-signed cert with a wrong hostname: fails even with a password (no auto-verification);
error 1;
exec $XTRABACKUP --protocol=tcp --user=backup_user --password=x --port=$MASTER_MYPORT --backup --target-dir=$targetdir;
exec $XTRABACKUP --no-defaults --protocol=tcp --user=backup_user --password=x --port=$MASTER_MYPORT --backup --target-dir=$targetdir;
remove_file $MYSQL_TMP_DIR/ed1f42db.0;
DROP USER backup_user;

View File

@@ -3675,33 +3675,22 @@ insert into tmp (b) values (1);
insert into t1 (a) values (1);
insert into t3 (b) values (1);
insert into m1 (a) values ((select max(a) from m1));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from m2));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from t1));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from t2));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from t3, m1));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from t3, m2));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from t3, t1));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from t3, t2));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from tmp, m1));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from tmp, m2));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from tmp, t1));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from tmp, t2));
ERROR HY000: Table 'm1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into m1 (a) values ((select max(a) from v1));
ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'm1'
insert into m1 (a) values ((select max(a) from tmp, v1));
ERROR HY000: The definition of table 'v1' prevents operation INSERT on table 'm1'
select count(*) from m1;
count(*)
15
drop view v1;
drop temporary table tmp;
drop table t1, t2, t3, m1, m2;

View File

@@ -2672,37 +2672,24 @@ insert into tmp (b) values (1);
insert into t1 (a) values (1);
insert into t3 (b) values (1);
--error ER_UPDATE_TABLE_USED
insert into m1 (a) values ((select max(a) from m1));
--error ER_UPDATE_TABLE_USED
insert into m1 (a) values ((select max(a) from m2));
--error ER_UPDATE_TABLE_USED
insert into m1 (a) values ((select max(a) from t1));
--error ER_UPDATE_TABLE_USED
insert into m1 (a) values ((select max(a) from t2));
--error ER_UPDATE_TABLE_USED
insert into m1 (a) values ((select max(a) from t3, m1));
--error ER_UPDATE_TABLE_USED
insert into m1 (a) values ((select max(a) from t3, m2));
--error ER_UPDATE_TABLE_USED
insert into m1 (a) values ((select max(a) from t3, t1));
--error ER_UPDATE_TABLE_USED
insert into m1 (a) values ((select max(a) from t3, t2));
--error ER_UPDATE_TABLE_USED
insert into m1 (a) values ((select max(a) from tmp, m1));
--error ER_UPDATE_TABLE_USED
insert into m1 (a) values ((select max(a) from tmp, m2));
--error ER_UPDATE_TABLE_USED
insert into m1 (a) values ((select max(a) from tmp, t1));
--error ER_UPDATE_TABLE_USED
insert into m1 (a) values ((select max(a) from tmp, t2));
--error ER_VIEW_PREVENT_UPDATE
insert into m1 (a) values ((select max(a) from v1));
--error ER_VIEW_PREVENT_UPDATE
insert into m1 (a) values ((select max(a) from tmp, v1));
select count(*) from m1;
drop view v1;

View File

@@ -20,6 +20,9 @@ set global server_audit_file_path=null;
set global server_audit_incl_users=null;
set global server_audit_file_path='server_audit.log';
set global server_audit_output_type=file;
set global server_audit_file_path=REPEAT(REPEAT('new_file_name', 50), 50);
Warnings:
Warning 1 server_audit_file_path can't exceed FN_LEN characters.
set global server_audit_logging=on;
set global server_audit_incl_users= repeat("'root',", 10000);
ERROR 42000: Variable 'server_audit_incl_users' can't be set to the value of ''root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','root','...'

View File

@@ -22,6 +22,10 @@ set global server_audit_file_path=null;
set global server_audit_incl_users=null;
set global server_audit_file_path='server_audit.log';
set global server_audit_output_type=file;
--replace_regex /[1-9][0-9][0-9]+/FN_LEN/
set global server_audit_file_path=REPEAT(REPEAT('new_file_name', 50), 50);
set global server_audit_logging=on;
--error ER_WRONG_VALUE_FOR_VAR

View File

@@ -0,0 +1,158 @@
include/master-slave.inc
[connection master]
connection master;
set @max_binlog_cache_size = @@global.max_binlog_cache_size;
set @binlog_cache_size = @@global.binlog_cache_size;
set @@global.max_binlog_cache_size = 4096;
set @@global. binlog_cache_size = 4096;
#
# MDEV-35207 ignored error at binlogging by CREATE-TABLE-SELECT leads to assert
#
connect conn_err,localhost,root,,;
call mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage");
create table t engine=myisam select repeat ('a',4096*3) AS a;
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
create table t engine=innodb select repeat ('a',4096*3) AS a;
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
create table t (a int unique, b char) select 1 AS a, 'b' as b union select 1 as a, 'c' as b;
ERROR 23000: Duplicate entry '1' for key 'a'
select * from t;
ERROR 42S02: Table 'test.t' doesn't exist
disconnect conn_err;
connection master;
#
# MDEV-35499 errored CREATE-OR-REPLACE-SELECT does not DROP table in binlog
#
#
# Engine = innodb
#
set statement binlog_format=statement for create table t (a int) select 1 as a;
set statement binlog_format=row for create or replace table t (a int primary key, b char) engine=innodb select 1 AS a, 'b' as b union select 1 as a, 'c' as b;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t;
ERROR 42S02: Table 'test.t' doesn't exist
#
# Prove an expected lonely `DROP table t'
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
master-bin.000001 # Query # # ROLLBACK
set statement binlog_format=statement for create table t (a int) select 1 as a;
set statement binlog_format=row for create or replace table t (a text) engine=innodb select repeat ('a',1024) AS a union select repeat ('a',3*4096) AS a union select repeat ('a',3*4096) AS a;
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
select * from t;
ERROR 42S02: Table 'test.t' doesn't exist
#
# Prove an expected lonely `DROP table t'
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
master-bin.000001 # Query # # ROLLBACK
set statement binlog_format=statement for create table t (a int) select 1 as a;
set statement binlog_format=row for create or replace table t (a text) engine=innodb select repeat ('a',4096*3) AS a;;
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
select * from t;
ERROR 42S02: Table 'test.t' doesn't exist
#
# Prove an expected lonely `DROP table t'
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
master-bin.000001 # Query # # ROLLBACK
#
# Engine = myisam
#
set statement binlog_format=statement for create table t (a int) select 1 as a;
set statement binlog_format=row for create or replace table t (a int primary key, b char) engine=myisam select 1 AS a, 'b' as b union select 1 as a, 'c' as b;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t;
ERROR 42S02: Table 'test.t' doesn't exist
#
# Prove an expected lonely `DROP table t'
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
master-bin.000001 # Query # # ROLLBACK
set statement binlog_format=statement for create table t (a int) select 1 as a;
set statement binlog_format=row for create or replace table t (a text) engine=myisam select repeat ('a',1024) AS a union select repeat ('a',3*4096) AS a union select repeat ('a',3*4096) AS a;
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
select * from t;
ERROR 42S02: Table 'test.t' doesn't exist
#
# Prove an expected lonely `DROP table t'
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
master-bin.000001 # Query # # ROLLBACK
set statement binlog_format=statement for create table t (a int) select 1 as a;
set statement binlog_format=row for create or replace table t (a text) engine=myisam select repeat ('a',4096*3) AS a;;
ERROR HY000: Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage; increase this mariadbd variable and try again
select * from t;
ERROR 42S02: Table 'test.t' doesn't exist
#
# Prove an expected lonely `DROP table t'
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP TABLE IF EXISTS `test`.`t`/* Generated to handle failed CREATE OR REPLACE */
master-bin.000001 # Query # # ROLLBACK
create table ti_pk (a int primary key) engine=innodb;
create table ta (a int) engine=aria;
create function f_ia(arg int)
returns integer
begin
insert into ti_pk set a=1;
insert into ta set a=1;
insert into ti_pk set a=arg;
return 1;
end |
set statement binlog_format = ROW for create table t_y (a int) engine=aria select f_ia(1 /* err */) as a;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t_y;
ERROR 42S02: Table 'test.t_y' doesn't exist
# correct execution: `ta` is modified and its new record is binlogged
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # BEGIN GTID #-#-#
master-bin.000001 # Table_map # # table_id: # (test.ta)
master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F
master-bin.000001 # Query # # COMMIT
select * from ta;
a
1
select * from ti_pk;
a
connection slave;
include/diff_tables.inc [master:ta,slave:ta]
connection master;
delete from ta;
connection slave;
connection master;
set statement binlog_format = STATEMENT for create table t_y (a int) engine=aria select f_ia(1 /* err */) as a;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t_y;
ERROR 42S02: Table 'test.t_y' doesn't exist
# ***TODO: fix MDEV-36027***. As of now `ta` is modified but that's not binlogged
include/show_binlog_events.inc
select *,'on_master' from ta;
a on_master
1 on_master
select * from ti_pk;
a
connection slave;
select *,'on_slave' from ta;
a on_slave
connection master;
drop function f_ia;
drop table ti_pk, ta;
SET @@global.max_binlog_cache_size = @max_binlog_cache_size;
SET @@global. binlog_cache_size = @binlog_cache_size;
connection slave;
End of the tests
include/rpl_end.inc

View File

@@ -51,6 +51,11 @@ master_pos_wait('master-bin.000001',1000000,1,"my_slave")
-1
Warnings:
Note 1105 Timeout waiting for master-bin.000001:1000000. Current pos is master-bin.000001:329
select master_pos_wait('master-bin.000001',1000000,1,"MY_SLAVE");
master_pos_wait('master-bin.000001',1000000,1,"MY_SLAVE")
-1
Warnings:
Note 1105 Timeout waiting for master-bin.000001:1000000. Current pos is master-bin.000001:329
STOP SLAVE 'my_slave';
RESET SLAVE 'my_slave' ALL;
change master to master_port=MASTER_MYPORT, master_host='127.0.0.1', master_user='root';

View File

@@ -0,0 +1,41 @@
# Set up Semi-Sync with rpl_semi_sync_master_wait_no_slave=0
include/master-slave.inc
[connection master]
SET @@GLOBAL.rpl_semi_sync_master_enabled= 1;
SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 0;
connection slave;
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1;
include/start_slave.inc
connection master;
connection slave;
connection master;
SELECT ID INTO @binlog_dump_tid
FROM information_schema.PROCESSLIST WHERE COMMAND = 'Binlog Dump';
# Control State
SELECT STATE FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
STATE
Master has sent all binlog to slave; waiting for more updates
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
Variable_name Value
Rpl_semi_sync_master_clients 1
# Disable Semi-Sync while the dump thread is still connected to its slave
SET @@GLOBAL.rpl_semi_sync_master_enabled = 0;
SELECT STATE FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
STATE
Master has sent all binlog to slave; waiting for more updates
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
Variable_name Value
Rpl_semi_sync_master_clients 1
# Disconnect the slave and wait until the master's dump thread is gone
connection slave;
STOP SLAVE;
connection master;
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
Variable_name Value
Rpl_semi_sync_master_clients 0
# Cleanup
SET @@GLOBAL.rpl_semi_sync_master_enabled= 0;
SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 1;
connection slave;
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 0;
include/rpl_end.inc

View File

@@ -0,0 +1,53 @@
# Skip starting the slave because we manually start with SSL later
include/master-slave.inc
[connection master]
#
# Setup
connection master;
CREATE USER replssl@localhost;
GRANT REPLICATION SLAVE on *.* to replssl@localhost REQUIRE SSL;
set @orig_master_enabled= @@GLOBAL.rpl_semi_sync_master_enabled;
SET @@GLOBAL.rpl_semi_sync_master_enabled= 1;
connection slave;
CHANGE MASTER TO
master_user='replssl',
master_password='',
master_ssl=1,
master_ssl_ca='MYSQL_TEST_DIR/std_data/cacert.pem',
master_ssl_cert='MYSQL_TEST_DIR/std_data/client-cert.pem',
master_ssl_key='MYSQL_TEST_DIR/std_data/client-key.pem';
set @orig_slave_enabled= @@GLOBAL.rpl_semi_sync_slave_enabled;
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1;
include/start_slave.inc
connection master;
# Verify Semi-Sync is active
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
Variable_name Value
Rpl_semi_sync_master_clients 1
# Create some table so slave can be seen as up-to-date and working
connection master;
CREATE TABLE t1 (a INT);
connection slave;
# Disconnect the slave and wait until the master's dump thread is gone
connection slave;
STOP SLAVE;
connection master;
# MDEV-36663: Verifying dump thread connection is killed..
# ..done
# Cleanup
connection master;
SET @@GLOBAL.rpl_semi_sync_master_enabled= @orig_master_enabled;
DROP USER replssl@localhost;
DROP TABLE t1;
connection slave;
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @orig_slave_enabled;
CHANGE MASTER TO
master_user='root',
master_ssl=1,
master_ssl_ca='',
master_ssl_cert='',
master_ssl_key='';
connection slave;
include/start_slave.inc
include/rpl_end.inc
# End of rpl_semi_sync_ssl_stop.inc

View File

@@ -0,0 +1,161 @@
--source include/have_binlog_format_row.inc
--source include/have_innodb.inc
--source include/master-slave.inc
--connection master
set @max_binlog_cache_size = @@global.max_binlog_cache_size;
set @binlog_cache_size = @@global.binlog_cache_size;
set @@global.max_binlog_cache_size = 4096;
set @@global. binlog_cache_size = 4096;
--echo #
--echo # MDEV-35207 ignored error at binlogging by CREATE-TABLE-SELECT leads to assert
--echo #
# fix the current (write) binlog position
--let $binlog_file_0= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start_0 = query_get_value(SHOW MASTER STATUS, Position, 1)
# use a separate connection also to validate its close will be clean
connect (conn_err,localhost,root,,);
call mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage");
--error ER_TRANS_CACHE_FULL
create table t engine=myisam select repeat ('a',4096*3) AS a;
--error ER_TRANS_CACHE_FULL
create table t engine=innodb select repeat ('a',4096*3) AS a;
--error ER_DUP_ENTRY
create table t (a int unique, b char) select 1 AS a, 'b' as b union select 1 as a, 'c' as b;
--error ER_NO_SUCH_TABLE
select * from t;
--disconnect conn_err
--connection master
--let $binlog_file_1= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start_1= query_get_value(SHOW MASTER STATUS, Position, 1)
--let $cmp = `select strcmp('$binlog_file_1', '$binlog_file_0') <> 0 OR $binlog_start_1 <> $binlog_start_0`
if (!$cmp)
{
--echo *** Error: unexpected advance of binlog position
--die
}
--echo
--echo #
--echo # MDEV-35499 errored CREATE-OR-REPLACE-SELECT does not DROP table in binlog
--echo #
--let $i = 2
while ($i)
{
--let $engine=`select if($i % 2, "myisam", "innodb")`
--echo #
--echo # Engine = $engine
--echo #
set statement binlog_format=statement for create table t (a int) select 1 as a;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
--error ER_DUP_ENTRY
--eval set statement binlog_format=row for create or replace table t (a int primary key, b char) engine=$engine select 1 AS a, 'b' as b union select 1 as a, 'c' as b
--error ER_NO_SUCH_TABLE
select * from t;
--echo #
--echo # Prove an expected lonely `DROP table t'
--source include/show_binlog_events.inc
# error before stmt commit
set statement binlog_format=statement for create table t (a int) select 1 as a;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
--error ER_TRANS_CACHE_FULL
--eval set statement binlog_format=row for create or replace table t (a text) engine=$engine select repeat ('a',1024) AS a union select repeat ('a',3*4096) AS a union select repeat ('a',3*4096) AS a
--error ER_NO_SUCH_TABLE
select * from t;
--echo #
--echo # Prove an expected lonely `DROP table t'
--source include/show_binlog_events.inc
# error at stmt commit
set statement binlog_format=statement for create table t (a int) select 1 as a;
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
--error ER_TRANS_CACHE_FULL
--eval set statement binlog_format=row for create or replace table t (a text) engine=$engine select repeat ('a',4096*3) AS a;
--error ER_NO_SUCH_TABLE
select * from t;
--echo #
--echo # Prove an expected lonely `DROP table t'
--source include/show_binlog_events.inc
--dec $i
}
# Tests of mixed engines to demonstrate non-transaction table updates
# are binlogged or otherwise MDEV-36027.
create table ti_pk (a int primary key) engine=innodb;
create table ta (a int) engine=aria;
delimiter |;
create function f_ia(arg int)
returns integer
begin
insert into ti_pk set a=1;
insert into ta set a=1;
insert into ti_pk set a=arg;
return 1;
end |
delimiter ;|
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
--error ER_DUP_ENTRY
set statement binlog_format = ROW for create table t_y (a int) engine=aria select f_ia(1 /* err */) as a;
--error ER_NO_SUCH_TABLE
select * from t_y;
--echo # correct execution: `ta` is modified and its new record is binlogged
--source include/show_binlog_events.inc
select * from ta;
select * from ti_pk;
--sync_slave_with_master
--let $diff_tables=master:ta,slave:ta
--source include/diff_tables.inc
--connection master
delete from ta;
--sync_slave_with_master
--connection master
# MDEV-36027 Errored-out CREATE-SELECT does not binlog results of any function modifying non-transactional table
--let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_start = query_get_value(SHOW MASTER STATUS, Position, 1)
--error ER_DUP_ENTRY
set statement binlog_format = STATEMENT for create table t_y (a int) engine=aria select f_ia(1 /* err */) as a;
--error ER_NO_SUCH_TABLE
select * from t_y;
--echo # ***TODO: fix MDEV-36027***. As of now `ta` is modified but that's not binlogged
--source include/show_binlog_events.inc
select *,'on_master' from ta;
select * from ti_pk;
--sync_slave_with_master
select *,'on_slave' from ta;
# Cleanup
--connection master
drop function f_ia;
drop table ti_pk, ta;
SET @@global.max_binlog_cache_size = @max_binlog_cache_size;
SET @@global. binlog_cache_size = @binlog_cache_size;
# test that binlog replicates correctly to slave
# --connection slave
--sync_slave_with_master
--echo End of the tests
--source include/rpl_end.inc

View File

@@ -48,6 +48,7 @@ select master_pos_wait('master-bin.000001',1000000,1);
--echo # Call with a valid connection name -- hangs before MDEV-7130 fix (expected -1)
select master_pos_wait('master-bin.000001',1000000,1,"my_slave");
select master_pos_wait('master-bin.000001',1000000,1,"MY_SLAVE");
STOP SLAVE 'my_slave';
RESET SLAVE 'my_slave' ALL;

View File

@@ -0,0 +1,68 @@
# MDEV-36359: Master crashes when reverting to async after Semi-Sync disabled.
#
# Assert behavior of turning Semi-Sync off on
# the master when still connected to a slave
--source include/have_binlog_format_mixed.inc # format-agnostic
--echo # Set up Semi-Sync with rpl_semi_sync_master_wait_no_slave=0
--let $rpl_skip_start_slave= 1
--source include/master-slave.inc
--let $orig_master_enabled=`SELECT @@GLOBAL.rpl_semi_sync_master_enabled`
SET @@GLOBAL.rpl_semi_sync_master_enabled= 1;
--let $orig_wait_no_slave=`SELECT @@GLOBAL.rpl_semi_sync_master_wait_no_slave`
SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= 0;
--connection slave
--let $orig_slave_enabled=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled`
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1;
--source include/start_slave.inc
--connection master
# Make sure Semi-Sync is active
--let $status_var= Rpl_semi_sync_master_status
--let $status_var_value= ON
--source include/wait_for_status_var.inc
--sync_slave_with_master
--connection master
--disable_cursor_protocol
SELECT ID INTO @binlog_dump_tid
FROM information_schema.PROCESSLIST WHERE COMMAND = 'Binlog Dump';
--enable_cursor_protocol
--echo # Control State
SELECT STATE FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
--echo # Disable Semi-Sync while the dump thread is still connected to its slave
SET @@GLOBAL.rpl_semi_sync_master_enabled = 0;
--let $status_var_value= OFF
--source include/wait_for_status_var.inc
SELECT STATE FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid;
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
--echo # Disconnect the slave and wait until the master's dump thread is gone
--connection slave
STOP SLAVE;
# Starting with MDEV-13073,
# Semi-Sync STOP SLAVE also terminates its dump thread on the master.
--connection master
# MDEV-36359: The disconnection would crash the master and leave the wait with
# error 2013 'Lost connection to server during query'
--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.PROCESSLIST WHERE ID = @binlog_dump_tid
--source include/wait_condition.inc
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
--echo # Cleanup
--eval SET @@GLOBAL.rpl_semi_sync_master_enabled= $orig_master_enabled
--eval SET @@GLOBAL.rpl_semi_sync_master_wait_no_slave= $orig_wait_no_slave
--connection slave
--eval SET @@GLOBAL.rpl_semi_sync_slave_enabled= $orig_slave_enabled
--let $rpl_only_running_threads= 1
--source include/rpl_end.inc

View File

@@ -0,0 +1,100 @@
#
# This test verifies that semi-sync setups configured to use SSL can kill
# the replication connection when the IO thread is stopped (e.g. from
# STOP SLAVE). The way it should happen, is that the IO thread creates a new
# connection to the primary which issues KILL on the connection id of the
# replication connection. MDEV-36663 reported an issue where this new
# kill-oriented connection could not connect to a primary when it requires
# connections to use SSL.
#
# This test sets up a semi-sync SSL master-slave topology, and stops the
# slave IO thread. It then validates that the connection was killed by using
# the wait_condition.inc utility to wait for the binlog dump thread to die,
# and also validates that the status variable Rpl_semi_sync_master_clients
# reports as 0.
#
# References:
# MDEV-36663: Semi-sync Replica Can't Kill Dump Thread When Using SSL
#
--source include/have_binlog_format_mixed.inc # format-agnostic
--source include/have_ssl_communication.inc
--echo # Skip starting the slave because we manually start with SSL later
--let $rpl_skip_start_slave= 1
--source include/master-slave.inc
--echo #
--echo # Setup
--connection master
CREATE USER replssl@localhost;
GRANT REPLICATION SLAVE on *.* to replssl@localhost REQUIRE SSL;
set @orig_master_enabled= @@GLOBAL.rpl_semi_sync_master_enabled;
SET @@GLOBAL.rpl_semi_sync_master_enabled= 1;
--connection slave
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
eval CHANGE MASTER TO
master_user='replssl',
master_password='',
master_ssl=1,
master_ssl_ca='$MYSQL_TEST_DIR/std_data/cacert.pem',
master_ssl_cert='$MYSQL_TEST_DIR/std_data/client-cert.pem',
master_ssl_key='$MYSQL_TEST_DIR/std_data/client-key.pem';
set @orig_slave_enabled= @@GLOBAL.rpl_semi_sync_slave_enabled;
SET @@GLOBAL.rpl_semi_sync_slave_enabled= 1;
--source include/start_slave.inc
--connection master
--echo # Verify Semi-Sync is active
--let $status_var= Rpl_semi_sync_master_clients
--let $status_var_value= 1
--source include/wait_for_status_var.inc
SHOW STATUS LIKE 'Rpl_semi_sync_master_clients';
--echo # Create some table so slave can be seen as up-to-date and working
--connection master
CREATE TABLE t1 (a INT);
--sync_slave_with_master
--echo # Disconnect the slave and wait until the master's dump thread is gone
--connection slave
STOP SLAVE;
--connection master
--echo # MDEV-36663: Verifying dump thread connection is killed..
# Prior to MDEV-36663 fixes, this would time out and
# Rpl_semi_sync_master_clients would remain 1.
--let $wait_condition= SELECT COUNT(*)=0 FROM information_schema.PROCESSLIST WHERE USER = 'replssl'
--source include/wait_condition.inc
--let $n_master_clients= query_get_value(SHOW STATUS LIKE 'Rpl_semi_sync_master_clients', Value, 1)
if ($n_master_clients)
{
--echo # Rpl_semi_sync_master_clients: $n_master_clients
--die Semi-sync dump thread connection not killed
}
--echo # ..done
--echo # Cleanup
--connection master
SET @@GLOBAL.rpl_semi_sync_master_enabled= @orig_master_enabled;
DROP USER replssl@localhost;
DROP TABLE t1;
--connection slave
SET @@GLOBAL.rpl_semi_sync_slave_enabled= @orig_slave_enabled;
CHANGE MASTER TO
master_user='root',
master_ssl=1,
master_ssl_ca='',
master_ssl_cert='',
master_ssl_key='';
--connection slave
--source include/start_slave.inc
--source include/rpl_end.inc
--echo # End of rpl_semi_sync_ssl_stop.inc

View File

@@ -47,14 +47,57 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si
11 1 9223372036854775806 1 1 1000 0 0
connection only_alter;
select next value for s1;
ERROR 42000: INSERT command denied to user 'only_alter'@'localhost' for table `mysqltest_1`.`s1`
ERROR 42000: SELECT, INSERT command denied to user 'only_alter'@'localhost' for table `mysqltest_1`.`s1`
alter sequence s1 restart= 11;
select * from s1;
ERROR 42000: SELECT command denied to user 'only_alter'@'localhost' for table `mysqltest_1`.`s1`
connection default;
drop database mysqltest_1;
drop user 'normal'@'%';
drop user 'read_only'@'%';
drop user 'read_write'@'%';
drop user 'alter'@'%';
drop user 'only_alter'@'%';
drop sequence s1;
#
# MDEV-36413 User without any privileges to a sequence can read from
# it and modify it via column default
#
create sequence s1;
create sequence s2;
select * from s2;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
create table t2 (a int not null default(nextval(s1)));
insert into t2 values();
create user u;
grant create, insert, select, drop on mysqltest_1.t1 to u;
grant insert, select on mysqltest_1.s1 to u;
grant select on mysqltest_1.t2 to u;
connect con1,localhost,u,,mysqltest_1;
select nextval(s2);
ERROR 42000: SELECT, INSERT command denied to user 'u'@'localhost' for table `mysqltest_1`.`s2`
show create sequence s2;
ERROR 42000: SHOW command denied to user 'u'@'localhost' for table `mysqltest_1`.`s2`
create table t1 (a int not null default(nextval(s1)));
drop table t1;
create table t1 (a int not null default(nextval(s1))) select a from t2;
insert into t1 values();
select * from t1;
a
1
2
drop table t1;
create table t1 (a int not null default(nextval(s1))) select a from (select t2.a from t2,t2 as t3 where t2.a=t3.a) as t4;
drop table t1;
create table t1 (a int not null default(nextval(s2)));
ERROR 42000: SELECT, INSERT command denied to user 'u'@'localhost' for table `mysqltest_1`.`s2`
create table t1 (a int not null default(nextval(s1)),
b int not null default(nextval(s2)));
ERROR 42000: SELECT, INSERT command denied to user 'u'@'localhost' for table `mysqltest_1`.`s2`
disconnect con1;
connection default;
drop user u;
drop database mysqltest_1;
#
# End of 10.11 tests
#

View File

@@ -60,10 +60,58 @@ select * from s1;
#
connection default;
drop database mysqltest_1;
drop user 'normal'@'%';
drop user 'read_only'@'%';
drop user 'read_write'@'%';
drop user 'alter'@'%';
drop user 'only_alter'@'%';
drop sequence s1;
--echo #
--echo # MDEV-36413 User without any privileges to a sequence can read from
--echo # it and modify it via column default
--echo #
create sequence s1;
create sequence s2;
select * from s2;
create table t2 (a int not null default(nextval(s1)));
insert into t2 values();
create user u;
grant create, insert, select, drop on mysqltest_1.t1 to u;
grant insert, select on mysqltest_1.s1 to u;
grant select on mysqltest_1.t2 to u;
--connect(con1,localhost,u,,mysqltest_1)
--error ER_TABLEACCESS_DENIED_ERROR
select nextval(s2);
--error ER_TABLEACCESS_DENIED_ERROR
show create sequence s2;
create table t1 (a int not null default(nextval(s1)));
drop table t1;
create table t1 (a int not null default(nextval(s1))) select a from t2;
insert into t1 values();
select * from t1;
drop table t1;
create table t1 (a int not null default(nextval(s1))) select a from (select t2.a from t2,t2 as t3 where t2.a=t3.a) as t4;
drop table t1;
--error ER_TABLEACCESS_DENIED_ERROR
create table t1 (a int not null default(nextval(s2)));
--error ER_TABLEACCESS_DENIED_ERROR
create table t1 (a int not null default(nextval(s1)),
b int not null default(nextval(s2)));
--disconnect con1
--connection default
drop user u;
#
# Cleanup
#
drop database mysqltest_1;
--echo #
--echo # End of 10.11 tests
--echo #

View File

@@ -174,7 +174,7 @@ create sequence s_db.s2;
drop sequence s_db.s2;
connection m_normal_2;
select next value for s_db.s1;
ERROR 42000: INSERT command denied to user 'normal_2'@'localhost' for table `s_db`.`s1`
ERROR 42000: SELECT, INSERT command denied to user 'normal_2'@'localhost' for table `s_db`.`s1`
create sequence s_db.s2;
ERROR 42000: CREATE command denied to user 'normal_2'@'localhost' for table `s_db`.`s2`
connection m_normal_1;

View File

@@ -48,7 +48,6 @@ create sequence s2;
insert into s1 (next_not_cached_value, minimum_value) values (100,1000);
ERROR HY000: Field 'maximum_value' doesn't have a default value
insert into s1 values (next value for s1, 1,9223372036854775806,1,1,1000,0,0);
ERROR HY000: Table 's1' is specified twice, both as a target for 'INSERT' and as a separate source for data
insert into s1 values(1000,9223372036854775806,1,1,1,1000,0,0);
ERROR HY000: Sequence 'test.s1' has out of range value for options
insert into s1 values(0,9223372036854775806,1,1,1,1000,0,0);

View File

@@ -38,7 +38,6 @@ create sequence s1;
create sequence s2;
--error ER_NO_DEFAULT_FOR_FIELD
insert into s1 (next_not_cached_value, minimum_value) values (100,1000);
--error ER_UPDATE_TABLE_USED
insert into s1 values (next value for s1, 1,9223372036854775806,1,1,1000,0,0);
--error ER_SEQUENCE_INVALID_DATA
insert into s1 values(1000,9223372036854775806,1,1,1,1000,0,0);

View File

@@ -285,7 +285,7 @@ create sequence s_db.s2;
drop sequence s_db.s2;
connection m_normal_2;
select NEXT VALUE for s_db.s1;
ERROR 42000: INSERT command denied to user 'normal_2'@'localhost' for table `s_db`.`s1`
ERROR 42000: SELECT, INSERT command denied to user 'normal_2'@'localhost' for table `s_db`.`s1`
create sequence s_db.s2;
ERROR 42000: CREATE command denied to user 'normal_2'@'localhost' for table `s_db`.`s2`
connection m_normal_1;

View File

@@ -1,5 +1,4 @@
--source include/have_sequence.inc
--source include/have_innodb.inc
#
# Test sequences with views

View File

@@ -1008,7 +1008,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Delay between log buffer spin lock polls (0 to use a blocking latch)
VARIABLE_COMMENT Deprecated parameter with no effect
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 6000
NUMERIC_BLOCK_SIZE 0

View File

@@ -173,7 +173,7 @@ explain select * from t1 where cast(json_extract(js1,'$.size') as int)=5 ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref size1 size1 5 const 1
alter table t1 add
color varchar(100) COLLATE utf8mb3_general_ci
color varchar(100) COLLATE utf8mb4_bin
as (json_unquote(json_extract(js1, '$.color')));
alter table t1 add index(color);
select * from t1 limit 3;
@@ -184,14 +184,14 @@ a js1 size1 color
# Index is used:
explain select * from t1 where json_unquote(json_extract(js1, '$.color'))='hue5';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref color color 303 const 1 Using index condition
1 SIMPLE t1 ref color color 403 const 1 Using index condition
explain select * from t1 where json_unquote(json_extract(js1, '$.color')) IS NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref color color 303 const 1 Using index condition
1 SIMPLE t1 ref color color 403 const 1 Using index condition
explain select * from t1 force index(color)
where json_unquote(json_extract(js1, '$.color')) IS NOT NULL;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range color color 303 NULL 100 Using index condition
1 SIMPLE t1 range color color 403 NULL 100 Using index condition
alter table t1 drop column color;
alter table t1 add
color2 varchar(100)

View File

@@ -115,13 +115,12 @@ alter table t1 add index(size1);
explain select * from t1 where cast(json_extract(js1,'$.size') as int)=5 ;
#
# JSON_UNQUOTE() returns utf8mb3_unicode_ci, even if JSON_VALID() and other
# functions seem to accept utf8mb4 characters (This is a bug, MDEV-35496)
# JSON_UNQUOTE() returns utf8mb4_bin
#
# Without COLLATE clause, the default is utf8mb4_uca1400_ai_ci.
#
alter table t1 add
color varchar(100) COLLATE utf8mb3_general_ci
color varchar(100) COLLATE utf8mb4_bin
as (json_unquote(json_extract(js1, '$.color')));
alter table t1 add index(color);