Merge 10.9 into 10.10

This commit is contained in:
Marko Mäkelä 2022-12-07 09:49:38 +02:00
commit 3ff4eb07ed
68 changed files with 926 additions and 365 deletions

View File

@ -28,9 +28,12 @@ stages:
- test - test
- Salsa-CI - Salsa-CI
# Base image for builds and tests unless otherwise defined default:
# @TODO: Fedora 34 is latest, but fails to start on Gitlab.com with error "shell not found" # Base image for builds and tests unless otherwise defined
image: fedora:33 image: fedora:latest
# Extend build jobs to have longer timeout as the default GitLab
# timeout (1h) is often not enough
timeout: 3h
# Define common CMAKE_FLAGS for all builds. Skim down build by omitting all # Define common CMAKE_FLAGS for all builds. Skim down build by omitting all
# submodules (a commit in this repo does not affect their builds anyway) and # submodules (a commit in this repo does not affect their builds anyway) and
@ -427,14 +430,14 @@ fedora upgrade:
dependencies: dependencies:
- fedora - fedora
script: script:
- yum install -y mariadb-server - dnf install -y mariadb-server
# Fedora does not support running services in Docker (like Debian packages do) so start it manually # Fedora does not support running services in Docker (like Debian packages do) so start it manually
- /usr/libexec/mysql-check-socket - /usr/libexec/mariadb-check-socket
- /usr/libexec/mysql-prepare-db-dir - /usr/libexec/mariadb-prepare-db-dir
- sudo -u mysql /usr/libexec/mysqld --basedir=/usr & sleep 10 - sudo -u mysql /usr/libexec/mariadbd --basedir=/usr & sleep 10
# Dump database contents in installed state # Dump database contents in installed state
- mariadb-dump --all-databases --all-tablespaces --triggers --routines --events --skip-extended-insert > old-installed-database.sql - mariadb-dump --all-databases --all-tablespaces --triggers --routines --events --skip-extended-insert > old-installed-database.sql
- /usr/libexec/mysql-check-upgrade - /usr/libexec/mariadb-check-upgrade
# Dump database contents in upgraded state # Dump database contents in upgraded state
- mariadb-dump --all-databases --all-tablespaces --triggers --routines --events --skip-extended-insert > old-upgraded-database.sql - mariadb-dump --all-databases --all-tablespaces --triggers --routines --events --skip-extended-insert > old-upgraded-database.sql
- mariadb --skip-column-names -e "SELECT @@version, @@version_comment" # Show version - mariadb --skip-column-names -e "SELECT @@version, @@version_comment" # Show version

View File

@ -1165,7 +1165,10 @@ static int dbConnect(char *host, char *user, char *passwd)
opt_ssl_capath, opt_ssl_cipher); opt_ssl_capath, opt_ssl_cipher);
mysql_options(&mysql_connection, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(&mysql_connection, MYSQL_OPT_SSL_CRL, opt_ssl_crl);
mysql_options(&mysql_connection, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); mysql_options(&mysql_connection, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath);
mysql_options(&mysql_connection, MARIADB_OPT_TLS_VERSION, opt_tls_version);
} }
mysql_options(&mysql_connection, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
(char*)&opt_ssl_verify_server_cert);
#endif #endif
if (opt_protocol) if (opt_protocol)
mysql_options(&mysql_connection,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); mysql_options(&mysql_connection,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol);

View File

@ -304,7 +304,10 @@ void set_mysql_connect_options(MYSQL *mysql)
opt_ssl_capath, opt_ssl_cipher); opt_ssl_capath, opt_ssl_cipher);
mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl);
mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath);
mysql_options(mysql, MARIADB_OPT_TLS_VERSION, opt_tls_version);
} }
mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
(char*)&opt_ssl_verify_server_cert);
#endif #endif
if (opt_protocol) if (opt_protocol)
mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol);

View File

@ -9870,6 +9870,7 @@ int main(int argc, char **argv)
opt_ssl_capath, opt_ssl_cipher); opt_ssl_capath, opt_ssl_cipher);
mysql_options(con->mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(con->mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl);
mysql_options(con->mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); mysql_options(con->mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath);
mysql_options(con->mysql, MARIADB_OPT_TLS_VERSION, opt_tls_version);
mysql_options(con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, mysql_options(con->mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
&opt_ssl_verify_server_cert); &opt_ssl_verify_server_cert);
} }

View File

@ -3910,6 +3910,21 @@ func_exit:
return error; return error;
} }
/** Close all undo tablespaces while applying incremental delta */
static void xb_close_undo_tablespaces()
{
if (srv_undo_space_id_start == 0)
return;
for (uint32_t space_id= srv_undo_space_id_start;
space_id < srv_undo_space_id_start + srv_undo_tablespaces_open;
space_id++)
{
fil_space_t *space= fil_space_get(space_id);
ut_ad(space);
space->close();
}
}
/**************************************************************************** /****************************************************************************
Populates the tablespace memory cache by scanning for and opening data files. Populates the tablespace memory cache by scanning for and opening data files.
@returns DB_SUCCESS or error code.*/ @returns DB_SUCCESS or error code.*/
@ -3971,6 +3986,10 @@ xb_load_tablespaces()
return(err); return(err);
} }
if (srv_operation == SRV_OPERATION_RESTORE_DELTA) {
xb_close_undo_tablespaces();
}
DBUG_MARIABACKUP_EVENT("after_load_tablespaces", {}); DBUG_MARIABACKUP_EVENT("after_load_tablespaces", {});
return(DB_SUCCESS); return(DB_SUCCESS);
} }

View File

@ -39,10 +39,10 @@
{"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).", {"ssl-key", OPT_SSL_KEY, "X509 key in PEM format (implies --ssl).",
&opt_ssl_key, &opt_ssl_key, 0, GET_STR, REQUIRED_ARG, &opt_ssl_key, &opt_ssl_key, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"ssl-crl", OPT_SSL_KEY, "Certificate revocation list (implies --ssl).", {"ssl-crl", OPT_SSL_CRL, "Certificate revocation list (implies --ssl).",
&opt_ssl_crl, &opt_ssl_crl, 0, GET_STR, REQUIRED_ARG, &opt_ssl_crl, &opt_ssl_crl, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},
{"ssl-crlpath", OPT_SSL_KEY, {"ssl-crlpath", OPT_SSL_CRLPATH,
"Certificate revocation list path (implies --ssl).", "Certificate revocation list path (implies --ssl).",
&opt_ssl_crlpath, &opt_ssl_crlpath, 0, GET_STR, REQUIRED_ARG, &opt_ssl_crlpath, &opt_ssl_crlpath, 0, GET_STR, REQUIRED_ARG,
0, 0, 0, 0, 0, 0}, 0, 0, 0, 0, 0, 0},

View File

@ -4472,3 +4472,28 @@ HEX(WEIGHT_STRING(_tis620 'a\0b' COLLATE tis620_thai_nopad_ci))
# #
# End of 10.2 tests # End of 10.2 tests
# #
#
# Start of 10.4 tests
#
#
# MDEV-27670 Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
#
CREATE OR REPLACE TABLE t1
(
a VARCHAR(250) COLLATE tis620_thai_nopad_ci,
UNIQUE KEY(a(100)) USING HASH
) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('a'),('A');
ERROR 23000: Duplicate entry 'A' for key 'a'
DROP TABLE t1;
CREATE OR REPLACE TABLE t1
(
a CHAR(250) COLLATE tis620_thai_nopad_ci,
UNIQUE KEY(a(100)) USING HASH
) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('a'),('A');
ERROR 23000: Duplicate entry 'A' for key 'a'
DROP TABLE t1;
#
# End of 10.4 tests
#

View File

@ -223,3 +223,34 @@ SELECT HEX(WEIGHT_STRING(_tis620 'a\0b' COLLATE tis620_thai_nopad_ci));
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-27670 Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
--echo #
CREATE OR REPLACE TABLE t1
(
a VARCHAR(250) COLLATE tis620_thai_nopad_ci,
UNIQUE KEY(a(100)) USING HASH
) ENGINE=MyISAM;
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES ('a'),('A');
DROP TABLE t1;
CREATE OR REPLACE TABLE t1
(
a CHAR(250) COLLATE tis620_thai_nopad_ci,
UNIQUE KEY(a(100)) USING HASH
) ENGINE=MyISAM;
--error ER_DUP_ENTRY
INSERT INTO t1 VALUES ('a'),('A');
DROP TABLE t1;
--echo #
--echo # End of 10.4 tests
--echo #

View File

@ -2772,7 +2772,7 @@ ON p.id = g.p_random
ORDER BY gallery_name ASC ORDER BY gallery_name ASC
; ;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 10 Using temporary; Using filesort 1 PRIMARY <derived2> ALL NULL NULL NULL NULL 10 Using filesort
1 PRIMARY p eq_ref PRIMARY PRIMARY 4 g.p_random 1 Using where 1 PRIMARY p eq_ref PRIMARY PRIMARY 4 g.p_random 1 Using where
2 DERIVED gal ALL NULL NULL NULL NULL 10 2 DERIVED gal ALL NULL NULL NULL NULL 10
3 DEPENDENT SUBQUERY pi ref gallery_id gallery_id 4 test.gal.id 4 Using temporary; Using filesort 3 DEPENDENT SUBQUERY pi ref gallery_id gallery_id 4 test.gal.id 4 Using temporary; Using filesort

View File

@ -834,13 +834,13 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK test.t1 analyze status OK
explain SELECT t, next_seq_value() r FROM t1 FORCE INDEX(t) GROUP BY t HAVING r = 1 ORDER BY t1.u; explain SELECT t, next_seq_value() r FROM t1 FORCE INDEX(t) GROUP BY t HAVING r = 1 ORDER BY t1.u;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort 1 SIMPLE t1 index NULL t 5 NULL 8 Using temporary; Using filesort
SELECT t, next_seq_value() r FROM t1 FORCE INDEX(t) GROUP BY t HAVING r = 1 ORDER BY t1.u; SELECT t, next_seq_value() r FROM t1 FORCE INDEX(t) GROUP BY t HAVING r = 1 ORDER BY t1.u;
t r t r
10 1 10 1
12 1 12 1
14 1 15 1
16 1 17 1
DROP TABLE t1; DROP TABLE t1;
DROP FUNCTION next_seq_value; DROP FUNCTION next_seq_value;
DROP TABLE series; DROP TABLE series;

View File

@ -1117,7 +1117,7 @@ SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
ORDER BY b; ORDER BY b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using temporary; Using filesort 1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort
set @show_explain_probe_select_id=1; set @show_explain_probe_select_id=1;
SET debug_dbug='+d,show_explain_probe_join_exec_start'; SET debug_dbug='+d,show_explain_probe_join_exec_start';
SELECT a+SLEEP(0.01) FROM t1 SELECT a+SLEEP(0.01) FROM t1
@ -1126,7 +1126,7 @@ ORDER BY b;
connection default; connection default;
show explain for $thr2; show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using temporary; Using filesort 1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort
Warnings: Warnings:
Note 1003 SELECT a+SLEEP(0.01) FROM t1 Note 1003 SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129
@ -1149,7 +1149,7 @@ ORDER BY b;
connection default; connection default;
show explain for $thr2; show explain for $thr2;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using temporary; Using filesort 1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 8 Using sort_union(a,b); Using where; Using filesort
Warnings: Warnings:
Note 1003 SELECT a+SLEEP(0.01) FROM t1 Note 1003 SELECT a+SLEEP(0.01) FROM t1
WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129 WHERE a IN ( 255, 0 ) OR b BETWEEN 6 AND 129

View File

@ -8933,6 +8933,46 @@ DROP TABLE t1;
# End of 10.4 tests # End of 10.4 tests
# #
# #
# MDEV-29129: Performance regression starting in 10.6: unlimited "select order by limit"
#
CREATE TABLE t1 (
lookupId int primary key,
value varchar(255)
);
insert into t1 select seq, seq from seq_1_to_100;
# Note: the function is intentionally NOT declared as DETERMINISTIC
CREATE FUNCTION f1(LOOKUPID_IN INT) RETURNS varchar(255) CHARSET utf8
BEGIN
DECLARE LOOKUP_VALUE VARCHAR(255);
SET LOOKUP_VALUE = (SELECT value FROM t1 WHERE lookupId = LOOKUPID_IN);
set @counter=@counter+1;
RETURN LOOKUP_VALUE;
END;
//
create table t2 (
col1 int,
col2 int
);
insert into t2 select mod(seq,100), seq from seq_1_to_1000;
explain
select f1(col1) from t2 order by col2 desc limit 5;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 Using filesort
set @counter=0;
select f1(col1) from t2 order by col2 desc limit 5;
f1(col1)
NULL
99
98
97
96
# Must show 5, not 1000:
select @counter;
@counter
5
drop function f1;
drop table t1,t2;
#
# MDEV-28129: MariaDB UAF issue at lex_end_nops(LEX*) # MDEV-28129: MariaDB UAF issue at lex_end_nops(LEX*)
# #
CREATE PROCEDURE sp() SELECT 1 INTO @; CREATE PROCEDURE sp() SELECT 1 INTO @;

View File

@ -10520,6 +10520,43 @@ DROP TABLE t1;
--echo # End of 10.4 tests --echo # End of 10.4 tests
--echo # --echo #
--echo #
--echo # MDEV-29129: Performance regression starting in 10.6: unlimited "select order by limit"
--echo #
CREATE TABLE t1 (
lookupId int primary key,
value varchar(255)
);
insert into t1 select seq, seq from seq_1_to_100;
-- echo # Note: the function is intentionally NOT declared as DETERMINISTIC
delimiter //;
CREATE FUNCTION f1(LOOKUPID_IN INT) RETURNS varchar(255) CHARSET utf8
BEGIN
DECLARE LOOKUP_VALUE VARCHAR(255);
SET LOOKUP_VALUE = (SELECT value FROM t1 WHERE lookupId = LOOKUPID_IN);
set @counter=@counter+1;
RETURN LOOKUP_VALUE;
END;
//
delimiter ;//
create table t2 (
col1 int,
col2 int
);
insert into t2 select mod(seq,100), seq from seq_1_to_1000;
explain
select f1(col1) from t2 order by col2 desc limit 5;
set @counter=0;
select f1(col1) from t2 order by col2 desc limit 5;
--echo # Must show 5, not 1000:
select @counter;
drop function f1;
drop table t1,t2;
--echo # --echo #
--echo # MDEV-28129: MariaDB UAF issue at lex_end_nops(LEX*) --echo # MDEV-28129: MariaDB UAF issue at lex_end_nops(LEX*)
--echo # --echo #

View File

@ -372,14 +372,14 @@ insert into t1 (b) values (10), (30), (10), (10);
set @var := 0; set @var := 0;
explain select if(b=@var, 999, b) , @var := b from t1 order by b; explain select if(b=@var, 999, b) , @var := b from t1 order by b;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort 1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using filesort
set @var := 0; set @var := 0;
select if(b=@var, 999, b) , @var := b from t1 order by b; select if(b=@var, 999, b) , @var := b from t1 order by b;
if(b=@var, 999, b) @var := b if(b=@var, 999, b) @var := b
10 10 10 10
10 10
30 30 30 30
999 10 999 10
999 10
drop table t1; drop table t1;
create temporary table t1 (id int); create temporary table t1 (id int);
insert into t1 values (2), (3), (3), (4); insert into t1 values (2), (3), (3), (4);

View File

@ -4430,3 +4430,27 @@ row_number() OVER (order by a)
2 2
3 3
drop table t1; drop table t1;
#
# MDEV-28206 SIGSEGV in Item_field::fix_fields when using LEAD...OVER
#
CREATE TABLE t(c1 INT);
CREATE FUNCTION f() RETURNS INT READS SQL DATA BEGIN
DECLARE v INT;
SELECT 1 INTO v FROM (SELECT c1,COALESCE(LEAD(a2.c1) OVER (PARTITION BY a2.c1 ORDER BY a2.c1),a2.c1) AS a1 FROM (t a2 JOIN t a3 USING (c1))) a4;
RETURN 1;
END//
SELECT f(),f();
f() f()
1 1
EXECUTE IMMEDIATE "SELECT LEAD(c1) OVER (ORDER BY c1) FROM t NATURAL JOIN t AS a;";
LEAD(c1) OVER (ORDER BY c1)
EXECUTE IMMEDIATE "SELECT SUM(c1) OVER (ORDER BY c1) FROM t NATURAL JOIN t AS a;";
SUM(c1) OVER (ORDER BY c1)
EXECUTE IMMEDIATE "SELECT LEAD(c) OVER (ORDER BY c) FROM (SELECT 1 AS c) AS a NATURAL JOIN (SELECT 1 AS c) AS b;";
LEAD(c) OVER (ORDER BY c)
NULL
DROP FUNCTION f;
DROP TABLE t;
#
# End of 10.6 tests
#

View File

@ -2829,3 +2829,31 @@ create table t1 (a int);
insert into t1 values (1),(2),(3); insert into t1 values (1),(2),(3);
SELECT row_number() OVER (order by a) FROM t1 order by NAME_CONST('myname',NULL); SELECT row_number() OVER (order by a) FROM t1 order by NAME_CONST('myname',NULL);
drop table t1; drop table t1;
--echo #
--echo # MDEV-28206 SIGSEGV in Item_field::fix_fields when using LEAD...OVER
--echo #
CREATE TABLE t(c1 INT);
DELIMITER //;
CREATE FUNCTION f() RETURNS INT READS SQL DATA BEGIN
DECLARE v INT;
SELECT 1 INTO v FROM (SELECT c1,COALESCE(LEAD(a2.c1) OVER (PARTITION BY a2.c1 ORDER BY a2.c1),a2.c1) AS a1 FROM (t a2 JOIN t a3 USING (c1))) a4;
RETURN 1;
END//
DELIMITER ;//
SELECT f(),f();
EXECUTE IMMEDIATE "SELECT LEAD(c1) OVER (ORDER BY c1) FROM t NATURAL JOIN t AS a;";
EXECUTE IMMEDIATE "SELECT SUM(c1) OVER (ORDER BY c1) FROM t NATURAL JOIN t AS a;";
EXECUTE IMMEDIATE "SELECT LEAD(c) OVER (ORDER BY c) FROM (SELECT 1 AS c) AS a NATURAL JOIN (SELECT 1 AS c) AS b;";
DROP FUNCTION f;
DROP TABLE t;
--echo #
--echo # End of 10.6 tests
--echo #

View File

@ -4437,6 +4437,30 @@ row_number() OVER (order by a)
3 3
drop table t1; drop table t1;
# #
# MDEV-28206 SIGSEGV in Item_field::fix_fields when using LEAD...OVER
#
CREATE TABLE t(c1 INT);
CREATE FUNCTION f() RETURNS INT READS SQL DATA BEGIN
DECLARE v INT;
SELECT 1 INTO v FROM (SELECT c1,COALESCE(LEAD(a2.c1) OVER (PARTITION BY a2.c1 ORDER BY a2.c1),a2.c1) AS a1 FROM (t a2 JOIN t a3 USING (c1))) a4;
RETURN 1;
END//
SELECT f(),f();
f() f()
1 1
EXECUTE IMMEDIATE "SELECT LEAD(c1) OVER (ORDER BY c1) FROM t NATURAL JOIN t AS a;";
LEAD(c1) OVER (ORDER BY c1)
EXECUTE IMMEDIATE "SELECT SUM(c1) OVER (ORDER BY c1) FROM t NATURAL JOIN t AS a;";
SUM(c1) OVER (ORDER BY c1)
EXECUTE IMMEDIATE "SELECT LEAD(c) OVER (ORDER BY c) FROM (SELECT 1 AS c) AS a NATURAL JOIN (SELECT 1 AS c) AS b;";
LEAD(c) OVER (ORDER BY c)
NULL
DROP FUNCTION f;
DROP TABLE t;
#
# End of 10.6 tests
#
#
# MDEV-23867: select crash in compute_window_func # MDEV-23867: select crash in compute_window_func
# #
set @save_sort_buffer_size=@@sort_buffer_size; set @save_sort_buffer_size=@@sort_buffer_size;

View File

@ -0,0 +1,17 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_2;
call mtr.add_suppression("WSREP: Failed to create/initialize system thread");
SET GLOBAL debug_dbug='+d,wsrep_simulate_failed_connection_1';
SET GLOBAL wsrep_slave_threads=2;
ERROR HY000: Incorrect arguments to SET
SELECT @@wsrep_slave_threads;
@@wsrep_slave_threads
1
SET GLOBAL debug_dbug='';
SET GLOBAL wsrep_slave_threads=1;
SELECT @@wsrep_slave_threads;
@@wsrep_slave_threads
1

View File

@ -0,0 +1,40 @@
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 int, f3 varchar(2000));
INSERT INTO t1 VALUES (1, 0, REPEAT('1234567890', 200));
INSERT INTO t1 VALUES (3, 3, REPEAT('1234567890', 200));
SET SESSION wsrep_sync_wait=0;
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1a;
SET SESSION wsrep_sync_wait=0;
connection node_1;
begin;
select f1,f2 from t1;
f1 f2
1 0
3 3
connection node_2;
UPDATE t1 SET f2=2 WHERE f1=3;
connection node_1a;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
connection node_1;
UPDATE t1 SET f2=1 WHERE f1=3;
SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
COMMIT;
connection node_1a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
SET GLOBAL DEBUG_DBUG = "";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
SET GLOBAL debug_dbug = NULL;
SET debug_sync='RESET';
connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
select f1,f2 from t1;
f1 f2
1 0
3 2
DROP TABLE t1;

View File

@ -19,9 +19,9 @@ SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value Variable_name Value
wsrep_cluster_status Disconnected wsrep_cluster_status Disconnected
SELECT * FROM t1; SELECT * FROM t1;
Got one of the listed errors ERROR 08S01: WSREP has not yet prepared node for application use
SELECT 1 FROM t1; SELECT 1 FROM t1;
Got one of the listed errors ERROR 08S01: WSREP has not yet prepared node for application use
SET @@session.wsrep_dirty_reads=ON; SET @@session.wsrep_dirty_reads=ON;
SELECT * FROM t1; SELECT * FROM t1;
i i
@ -34,7 +34,7 @@ i variable_name variable_value
1 WSREP_DIRTY_READS ON 1 WSREP_DIRTY_READS ON
SET @@session.wsrep_dirty_reads=OFF; SET @@session.wsrep_dirty_reads=OFF;
SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1; SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;
Got one of the listed errors ERROR 08S01: WSREP has not yet prepared node for application use
SELECT 1; SELECT 1;
1 1
1 1

View File

@ -0,0 +1,24 @@
--source include/galera_cluster.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--let $node_1=node_1
--let $node_2=node_2
--source ../galera/include/auto_increment_offset_save.inc
--connection node_2
call mtr.add_suppression("WSREP: Failed to create/initialize system thread");
SET GLOBAL debug_dbug='+d,wsrep_simulate_failed_connection_1';
--error ER_WRONG_ARGUMENTS
SET GLOBAL wsrep_slave_threads=2;
SELECT @@wsrep_slave_threads;
SET GLOBAL debug_dbug='';
SET GLOBAL wsrep_slave_threads=1;
SELECT @@wsrep_slave_threads;
# MDEV-29878: this test caused a subsequent test to fail
# during shutdown. Do a restart here, to make sure the
# issue is fixed.
--source include/restart_mysqld.inc
--source ../galera/include/auto_increment_offset_restore.inc

View File

@ -0,0 +1,15 @@
!include ../galera_2nodes.cnf
[mysqld]
log-bin
log-slave-updates
[mysqld.1]
log_bin
log_slave_updates
max-binlog-size=4096
expire-logs-days=1
[mysqld.2]

View File

@ -0,0 +1,91 @@
#
# This test is for reproducing the issue in:
# https://jira.mariadb.org/browse/MDEV-29512
#
# The hanging in MDEV-29512 happens when binlog purging is attempted, and there is
# one local BF aborted transaction waiting for commit monitor.
#
# The test will launch two node cluster and enable binlogging with expire log days,
# to force binlog purging to happen.
# A local transaction is executed so that will become BF abort victim, and has advanced
# to replication stage waiting for commit monitor for final cleanup (to mark position in innodb)
# after that, applier is released to complete the BF abort and due to binlog configuration,
# starting the binlog purging. This is where the hanging would occur, if code is buggy
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/galera_have_debug_sync.inc
#
# binlog size is limited to 4096 bytes, we will create enough events to
# cause binlog rotation
#
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 int, f3 varchar(2000));
INSERT INTO t1 VALUES (1, 0, REPEAT('1234567890', 200));
INSERT INTO t1 VALUES (3, 3, REPEAT('1234567890', 200));
SET SESSION wsrep_sync_wait=0;
# set sync point for replication applier
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
# Control connection to manage sync points for appliers
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1a
SET SESSION wsrep_sync_wait=0;
# starting local transaction, only select so far,
# write will happen later and this will be ordered after the transaction in node_2
--connection node_1
begin;
select f1,f2 from t1;
# send from node 2 an UPDATE transaction, which will BF abort the transaction in node_1
--connection node_2
--let $wait_condition=select count(*)=2 from t1
--source include/wait_condition.inc
UPDATE t1 SET f2=2 WHERE f1=3;
--connection node_1a
# wait to see the UPDATE from node_2 in apply_cb sync point
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
--connection node_1
# now issuing conflicting update
UPDATE t1 SET f2=1 WHERE f1=3;
# Block the local commit, send final COMMIT and wait until it gets blocked
--let $galera_sync_point = commit_monitor_master_enter_sync
--source include/galera_set_sync_point.inc
--send COMMIT
--connection node_1a
# wait for the local commit to enter in commit monitor wait state
--let $galera_sync_point = commit_monitor_master_enter_sync
--source include/galera_wait_sync_point.inc
--source include/galera_clear_sync_point.inc
# release the local transaction to continue with commit
--let $galera_sync_point = commit_monitor_master_enter_sync
--source include/galera_signal_sync_point.inc
# and now release the applier, it should force local trx to abort
SET GLOBAL DEBUG_DBUG = "";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
SET GLOBAL debug_dbug = NULL;
SET debug_sync='RESET';
--connection node_1
--error ER_LOCK_DEADLOCK
--reap
# wait until applying is complete
--let $wait_condition = SELECT COUNT(*)=1 FROM t1 WHERE f2=2
--source include/wait_condition.inc
# final read to verify what we got
select f1,f2 from t1;
DROP TABLE t1;

View File

@ -31,10 +31,10 @@ SHOW STATUS LIKE 'wsrep_ready';
# Must return 'Disconnected' # Must return 'Disconnected'
SHOW STATUS LIKE 'wsrep_cluster_status'; SHOW STATUS LIKE 'wsrep_cluster_status';
--error ER_UNKNOWN_COM_ERROR,1047 --error ER_UNKNOWN_COM_ERROR
SELECT * FROM t1; SELECT * FROM t1;
--error ER_UNKNOWN_COM_ERROR,1047 --error ER_UNKNOWN_COM_ERROR
SELECT 1 FROM t1; SELECT 1 FROM t1;
SET @@session.wsrep_dirty_reads=ON; SET @@session.wsrep_dirty_reads=ON;
@ -46,7 +46,7 @@ SELECT i, variable_name, variable_value FROM t1, information_schema.session_vari
SET @@session.wsrep_dirty_reads=OFF; SET @@session.wsrep_dirty_reads=OFF;
--error ER_UNKNOWN_COM_ERROR,1047 --error ER_UNKNOWN_COM_ERROR
SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1; SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;

View File

@ -1,4 +1,3 @@
GCF-336 :
GCF-582 : GCF-582 :
GCF-810A : GCF-810A :
GCF-810B : GCF-810B :

View File

@ -1,11 +1,17 @@
connection node_2;
connection node_1;
connection node_2;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
SET SESSION wsrep_trx_fragment_size = 1; SET SESSION wsrep_trx_fragment_size = 1;
SET AUTOCOMMIT=OFF; SET AUTOCOMMIT=OFF;
START TRANSACTION; START TRANSACTION;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a;
SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
COUNT(*) > 0 COUNT(*) > 0
1 1
connection node_1;
SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
COUNT(*) > 0 COUNT(*) > 0
1 1
@ -13,14 +19,19 @@ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT COUNT(*) > 0 FROM t1; SELECT COUNT(*) > 0 FROM t1;
COUNT(*) > 0 COUNT(*) > 0
1 1
connection node_2a;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
SET SESSION wsrep_sync_wait=0; SET SESSION wsrep_sync_wait=0;
connection node_2;
INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (2);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT; COMMIT;
ERROR 08S01: WSREP has not yet prepared node for application use ERROR 08S01: WSREP has not yet prepared node for application use
connection node_2a;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
DROP TABLE t1; DROP TABLE t1;
CALL mtr.add_suppression("replication aborted"); CALL mtr.add_suppression("replication aborted");
CALL mtr.add_suppression("WSREP: fragment replication failed: 3"); CALL mtr.add_suppression("WSREP: fragment replication failed: 3");
CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_3;

View File

@ -26,3 +26,69 @@ DROP TABLE t1;
# #
# End of 10.2 tests # End of 10.2 tests
# #
#
# Start of 10.4 tests
#
#
# MDEV-27670 Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
#
CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(8), KEY(a)) ENGINE=InnoDB COLLATE tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
DROP TABLE t1;
#
# MDEV-27768 MDEV-25440: Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
#
CREATE TABLE t1 (a INT KEY,b INT,c CHAR,KEY(b),KEY(c)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
INSERT INTO t1 VALUES (3,4,4);
DROP TABLE t1;
CREATE TABLE t1 (C1 CHAR KEY,B1 BIT,B2 BIT,C2 CHAR DEFAULT'') ROW_FORMAT=DYNAMIC COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
SELECT HEX(c1),HEX (c2) FROM t1 WHERE c1>=''AND c1<''AND c2=''LIMIT 2;
HEX(c1) HEX (c2)
DROP TABLE t1;
SET sql_mode='';
CREATE TABLE t1 (a INT UNSIGNED,b INT,c CHAR(1),d BINARY (1),e VARCHAR(1),f VARBINARY(1),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
INSERT INTO t1 VALUES (4386060749083099108,157,0,0,0,0,0,0,12);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
INSERT INTO t1 VALUES (104,15158706241929488558,0,0,0,0,0,0,13);
Warnings:
Warning 1264 Out of range value for column 'b' at row 1
SELECT GROUP_CONCAT(DISTINCT a,b ORDER BY c,b) FROM t1;
GROUP_CONCAT(DISTINCT a,b ORDER BY c,b)
4294967295157,1042147483647
DROP TABLE t1;
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a CHAR(9),b CHAR(7)) COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0);
ALTER TABLE t1 ADD INDEX kb (b),ADD INDEX kab (a,b),ALGORITHM=INPLACE;
DROP TABLE t1;
SET sql_mode='';
CREATE TABLE t1 (a INT UNSIGNED,b INT UNSIGNED,c CHAR(1),d CHAR(1),e VARCHAR(1),f VARCHAR(1),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (15842995496588415350,5339224446865937973,0,0,0,0,0,0,4);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'b' at row 1
INSERT INTO t1 VALUES (8118894032862615316,5299008984764990929,0,0,0,0,0,0,1);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
Warning 1264 Out of range value for column 'b' at row 1
SELECT GROUP_CONCAT(DISTINCT a,c ORDER BY a) FROM t1;
GROUP_CONCAT(DISTINCT a,c ORDER BY a)
42949672950
DROP TABLE t1;
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a CHAR,b CHAR,KEY(a,b)) ROW_FORMAT=DYNAMIC COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
INSERT INTO t1 VALUES (0,0);
DROP TABLE t1;
CREATE TABLE t1 (a CHAR,b CHAR) COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (0,0);
SELECT a,SUM(DISTINCT a),MIN(b) FROM t1 GROUP BY a;
a SUM(DISTINCT a) MIN(b)
0 0 0
DROP TABLE t1;
CREATE TABLE t1 (a CHAR,KEY(a)) ENGINE=InnoDB COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (0);
DROP TABLE t1;
#
# End of 10.4 tests
#

View File

@ -27,3 +27,65 @@ DROP TABLE t1;
--echo # --echo #
--echo # End of 10.2 tests --echo # End of 10.2 tests
--echo # --echo #
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-27670 Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
--echo #
CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(8), KEY(a)) ENGINE=InnoDB COLLATE tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
DROP TABLE t1;
--echo #
--echo # MDEV-27768 MDEV-25440: Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
--echo #
CREATE TABLE t1 (a INT KEY,b INT,c CHAR,KEY(b),KEY(c)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
INSERT INTO t1 VALUES (3,4,4);
DROP TABLE t1;
CREATE TABLE t1 (C1 CHAR KEY,B1 BIT,B2 BIT,C2 CHAR DEFAULT'') ROW_FORMAT=DYNAMIC COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
SELECT HEX(c1),HEX (c2) FROM t1 WHERE c1>=''AND c1<''AND c2=''LIMIT 2;
DROP TABLE t1;
SET sql_mode='';
CREATE TABLE t1 (a INT UNSIGNED,b INT,c CHAR(1),d BINARY (1),e VARCHAR(1),f VARBINARY(1),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
INSERT INTO t1 VALUES (4386060749083099108,157,0,0,0,0,0,0,12);
INSERT INTO t1 VALUES (104,15158706241929488558,0,0,0,0,0,0,13);
SELECT GROUP_CONCAT(DISTINCT a,b ORDER BY c,b) FROM t1;
DROP TABLE t1;
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a CHAR(9),b CHAR(7)) COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0);
ALTER TABLE t1 ADD INDEX kb (b),ADD INDEX kab (a,b),ALGORITHM=INPLACE;
DROP TABLE t1;
SET sql_mode='';
CREATE TABLE t1 (a INT UNSIGNED,b INT UNSIGNED,c CHAR(1),d CHAR(1),e VARCHAR(1),f VARCHAR(1),g BLOB,h BLOB,id INT,KEY(b),KEY(e)) ROW_FORMAT=REDUNDANT COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (15842995496588415350,5339224446865937973,0,0,0,0,0,0,4);
INSERT INTO t1 VALUES (8118894032862615316,5299008984764990929,0,0,0,0,0,0,1);
SELECT GROUP_CONCAT(DISTINCT a,c ORDER BY a) FROM t1;
DROP TABLE t1;
SET sql_mode=DEFAULT;
CREATE TABLE t1 (a CHAR,b CHAR,KEY(a,b)) ROW_FORMAT=DYNAMIC COLLATE=tis620_thai_nopad_ci ENGINE=InnoDB;
INSERT INTO t1 VALUES (0,0);
DROP TABLE t1;
CREATE TABLE t1 (a CHAR,b CHAR) COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (0,0);
SELECT a,SUM(DISTINCT a),MIN(b) FROM t1 GROUP BY a;
DROP TABLE t1;
CREATE TABLE t1 (a CHAR,KEY(a)) ENGINE=InnoDB COLLATE=tis620_thai_nopad_ci;
INSERT INTO t1 VALUES (0);
DROP TABLE t1;
--echo #
--echo # End of 10.4 tests
--echo #

View File

@ -1,4 +1,5 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/innodb_undo_tablespaces.inc
call mtr.add_suppression("InnoDB: New log files created"); call mtr.add_suppression("InnoDB: New log files created");

View File

@ -1,5 +1,6 @@
--source include/have_aria.inc --source include/have_aria.inc
--source include/innodb_page_size.inc --source include/innodb_page_size.inc
--source include/innodb_undo_tablespaces.inc
# see suite.pm "check for exact values, in case the default changes to be small everywhere" # see suite.pm "check for exact values, in case the default changes to be small everywhere"
if (`select @@max_binlog_stmt_cache_size = 4294963200 and @@innodb_page_size = 65536`) { if (`select @@max_binlog_stmt_cache_size = 4294963200 and @@innodb_page_size = 65536`) {

View File

@ -1,5 +1,6 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_partition.inc --source include/have_partition.inc
--source include/innodb_undo_tablespaces.inc
let $basedir=$MYSQLTEST_VARDIR/tmp/backup; let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1; let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;

View File

@ -1,4 +1,5 @@
--source include/have_debug.inc --source include/have_debug.inc
--source include/innodb_undo_tablespaces.inc
call mtr.add_suppression("InnoDB: New log files created"); call mtr.add_suppression("InnoDB: New log files created");

View File

@ -1,4 +1,5 @@
--source include/have_debug.inc --source include/have_debug.inc
--source include/innodb_undo_tablespaces.inc
call mtr.add_suppression("InnoDB: New log files created"); call mtr.add_suppression("InnoDB: New log files created");

View File

@ -1,4 +1,5 @@
--source include/innodb_page_size.inc --source include/innodb_page_size.inc
--source include/innodb_undo_tablespaces.inc
if (!$EXAMPLE_KEY_MANAGEMENT_SO) if (!$EXAMPLE_KEY_MANAGEMENT_SO)
{ {

View File

@ -1,5 +1,6 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_debug.inc --source include/have_debug.inc
--source include/innodb_undo_tablespaces.inc
call mtr.add_suppression("InnoDB: New log files created"); call mtr.add_suppression("InnoDB: New log files created");

View File

@ -1,5 +1,6 @@
--source include/have_debug.inc --source include/have_debug.inc
--source include/no_valgrind_without_big.inc --source include/no_valgrind_without_big.inc
--source include/innodb_undo_tablespaces.inc
--echo ######## --echo ########
--echo # Test for generating "innodb_corrupted_pages" file during full and --echo # Test for generating "innodb_corrupted_pages" file during full and

View File

@ -1,4 +1,5 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/innodb_undo_tablespaces.inc
call mtr.add_suppression("InnoDB: New log files created"); call mtr.add_suppression("InnoDB: New log files created");
call mtr.add_suppression("InnoDB: Operating system error number .* in a file operation"); call mtr.add_suppression("InnoDB: Operating system error number .* in a file operation");
call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified"); call mtr.add_suppression("InnoDB: The error means the system cannot find the path specified");

View File

@ -1,5 +1,6 @@
#--source include/innodb_page_size.inc #--source include/innodb_page_size.inc
--source include/have_partition.inc --source include/have_partition.inc
--source include/innodb_undo_tablespaces.inc
CREATE TABLE t1(a INT) ENGINE=InnoDB; CREATE TABLE t1(a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (2), (3); INSERT INTO t1 VALUES (1), (2), (3);

View File

@ -0,0 +1,47 @@
#
# MDEV-27768 MDEV-25440: Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
#
CREATE TABLE t1 (
a CHAR
) COLLATE=tis620_thai_nopad_ci
PARTITION BY RANGE COLUMNS (a)
(
PARTITION p0 VALUES LESS THAN (''),
PARTITION p VALUES LESS THAN ('')
);
ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
CREATE TABLE t1 (
a CHAR
) COLLATE=tis620_thai_nopad_ci
PARTITION BY RANGE COLUMNS (a)
(
PARTITION p0 VALUES LESS THAN (''),
PARTITION p VALUES LESS THAN (' ')
);
ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
CREATE TABLE t1 (
a CHAR
) COLLATE=tis620_thai_nopad_ci
PARTITION BY RANGE COLUMNS (a)
(
PARTITION p0 VALUES LESS THAN (' '),
PARTITION p VALUES LESS THAN ('')
);
ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
CREATE TABLE t1
(
id INT NOT NULL,
data VARCHAR(2),
KEY data_id (data(1),id)
) COLLATE tis620_thai_nopad_ci ENGINE=MyISAM
PARTITION BY RANGE (id)
(
PARTITION p10 VALUES LESS THAN (10),
PARTITION p20 VALUES LESS THAN (20)
);
INSERT INTO t1 VALUES (4, 'ab'), (14, 'ab'), (19,''),(9,'') ;
SELECT id FROM t1 WHERE data='' ORDER BY id;
id
9
19
DROP TABLE t1;

View File

@ -0,0 +1,52 @@
--source include/have_partition.inc
--source include/have_tis620.inc
--echo #
--echo # MDEV-27768 MDEV-25440: Assertion `(cs->state & 0x20000) == 0' failed in my_strnncollsp_nchars_generic_8bit
--echo #
--error ER_RANGE_NOT_INCREASING_ERROR
CREATE TABLE t1 (
a CHAR
) COLLATE=tis620_thai_nopad_ci
PARTITION BY RANGE COLUMNS (a)
(
PARTITION p0 VALUES LESS THAN (''),
PARTITION p VALUES LESS THAN ('')
);
--error ER_RANGE_NOT_INCREASING_ERROR
CREATE TABLE t1 (
a CHAR
) COLLATE=tis620_thai_nopad_ci
PARTITION BY RANGE COLUMNS (a)
(
PARTITION p0 VALUES LESS THAN (''),
PARTITION p VALUES LESS THAN (' ')
);
--error ER_RANGE_NOT_INCREASING_ERROR
CREATE TABLE t1 (
a CHAR
) COLLATE=tis620_thai_nopad_ci
PARTITION BY RANGE COLUMNS (a)
(
PARTITION p0 VALUES LESS THAN (' '),
PARTITION p VALUES LESS THAN ('')
);
CREATE TABLE t1
(
id INT NOT NULL,
data VARCHAR(2),
KEY data_id (data(1),id)
) COLLATE tis620_thai_nopad_ci ENGINE=MyISAM
PARTITION BY RANGE (id)
(
PARTITION p10 VALUES LESS THAN (10),
PARTITION p20 VALUES LESS THAN (20)
);
INSERT INTO t1 VALUES (4, 'ab'), (14, 'ab'), (19,''),(9,'') ;
SELECT id FROM t1 WHERE data='' ORDER BY id;
DROP TABLE t1;

View File

@ -100,3 +100,14 @@ show status like "Feature_application_time_periods";
Variable_name Value Variable_name Value
Feature_application_time_periods 6 Feature_application_time_periods 6
drop table t; drop table t;
# MDEV-29387: Period name with more than 32 symbols crashes the server
#
# test 34 symbols
create table t2 (s date, e date,
period for `abcd123456789012345678901234567890` (s,e));
drop table t2;
# test 64 symbols
create table t2 (s date, e date, period for
`abcd123456789012345678901234567890123456789012345678901234567890`
(s,e));
drop table t2;

View File

@ -397,3 +397,27 @@ insert into t1 values (1,'2020-01-01','2020-02-20');
delete from t1 for portion of se from '2020-01-30' to '2020-01-31'; delete from t1 for portion of se from '2020-01-30' to '2020-01-31';
drop table t1; drop table t1;
# End of 10.5 tests # End of 10.5 tests
#
# MDEV-19190 Assertion `part_share->auto_inc_initialized` failed in
# ha_partition::get_auto_increment
#
create table t1 (id int, s date, e date, period for app(s,e))
partition by key(id);
insert into t1 (s,e) values ('2023-07-21','2024-06-07');
alter table t1 modify id int auto_increment key;
delete from t1 for portion of app from '2023-07-20' to '2024-05-23';
select * from t1;
id s e
2 2024-05-23 2024-06-07
drop table t1;
create table t1 (id int, s date, e date, period for app(s,e))
partition by key(id);
insert into t1 (s,e) values ('2023-07-21','2024-06-07');
alter table t1 modify id int auto_increment key;
delete from t1 for portion of app from '2023-07-20' to '2024-05-23';
select * from t1;
id s e
2 2024-05-23 2024-06-07
drop table t1;
drop table log_tbl;
drop procedure log;

View File

@ -85,3 +85,17 @@ insert t values (2, '2001-01-01', '2001-01-01');
show status like "Feature_application_time_periods"; show status like "Feature_application_time_periods";
drop table t; drop table t;
--echo # MDEV-29387: Period name with more than 32 symbols crashes the server
--echo #
--echo # test 34 symbols
create table t2 (s date, e date,
period for `abcd123456789012345678901234567890` (s,e));
drop table t2;
--echo # test 64 symbols
create table t2 (s date, e date, period for
`abcd123456789012345678901234567890123456789012345678901234567890`
(s,e));
drop table t2;

View File

@ -1,5 +1,6 @@
source suite/period/engines.inc; source suite/period/engines.inc;
source include/have_log_bin.inc; source include/have_log_bin.inc;
source include/have_partition.inc;
create table t (id int, s date, e date, period for apptime(s,e)); create table t (id int, s date, e date, period for apptime(s,e));
@ -240,3 +241,30 @@ delete from t1 for portion of se from '2020-01-30' to '2020-01-31';
drop table t1; drop table t1;
--echo # End of 10.5 tests --echo # End of 10.5 tests
--echo #
--echo # MDEV-19190 Assertion `part_share->auto_inc_initialized` failed in
--echo # ha_partition::get_auto_increment
--echo #
create table t1 (id int, s date, e date, period for app(s,e))
partition by key(id);
insert into t1 (s,e) values ('2023-07-21','2024-06-07');
alter table t1 modify id int auto_increment key;
delete from t1 for portion of app from '2023-07-20' to '2024-05-23';
select * from t1;
drop table t1;
create table t1 (id int, s date, e date, period for app(s,e))
partition by key(id);
insert into t1 (s,e) values ('2023-07-21','2024-06-07');
alter table t1 modify id int auto_increment key;
--let $trig_table=t1
--let $trig_cols=id, s, e
--disable_query_log
--source suite/period/create_triggers.inc
--enable_query_log
delete from t1 for portion of app from '2023-07-20' to '2024-05-23';
select * from t1;
drop table t1;
drop table log_tbl;
drop procedure log;

View File

@ -0,0 +1,12 @@
##############################################################################
#
# List the test cases that are to be disabled temporarily.
#
# Separate the test case name and the comment with ':'.
#
# <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
#
# Do not use any TAB characters for whitespace.
#
##############################################################################
pr_statement_performance_analyzer : MDEV-29822 perfschema specific and Windows specific problems.

View File

@ -4535,7 +4535,7 @@ void handler::print_error(int error, myf errflag)
break; break;
case HA_ERR_AUTOINC_ERANGE: case HA_ERR_AUTOINC_ERANGE:
textno= error; textno= error;
my_error(textno, errflag, table->next_number_field->field_name.str, my_error(textno, errflag, table->found_next_number_field->field_name.str,
table->in_use->get_stmt_da()->current_row_for_warning()); table->in_use->get_stmt_da()->current_row_for_warning());
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
break; break;

View File

@ -6141,6 +6141,7 @@ bool Item_field::fix_fields(THD *thd, Item **reference)
if (!thd->lex->current_select->no_wrap_view_item && if (!thd->lex->current_select->no_wrap_view_item &&
thd->lex->in_sum_func && thd->lex->in_sum_func &&
select &&
thd->lex == select->parent_lex && thd->lex == select->parent_lex &&
thd->lex->in_sum_func->nest_level == thd->lex->in_sum_func->nest_level ==
select->nest_level) select->nest_level)

View File

@ -7426,8 +7426,8 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
mi->ssl_ca[0]?mi->ssl_ca:0, mi->ssl_ca[0]?mi->ssl_ca:0,
mi->ssl_capath[0]?mi->ssl_capath:0, mi->ssl_capath[0]?mi->ssl_capath:0,
mi->ssl_cipher[0]?mi->ssl_cipher:0); mi->ssl_cipher[0]?mi->ssl_cipher:0);
mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, mysql_options(mysql, MYSQL_OPT_SSL_CRL,
&mi->ssl_verify_server_cert); mi->ssl_crl[0] ? mi->ssl_crl : 0);
mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH,
mi->ssl_crlpath[0] ? mi->ssl_crlpath : 0); mi->ssl_crlpath[0] ? mi->ssl_crlpath : 0);
mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT,

View File

@ -8004,6 +8004,8 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array,
thd->lex->current_select->select_list_tables|= item->used_tables(); thd->lex->current_select->select_list_tables|= item->used_tables();
thd->lex->used_tables|= item->used_tables(); thd->lex->used_tables|= item->used_tables();
thd->lex->current_select->cur_pos_in_select_list++; thd->lex->current_select->cur_pos_in_select_list++;
thd->lex->current_select->rownum_in_field_list |= item->with_rownum_func();
} }
thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup; thd->lex->current_select->is_item_list_lookup= save_is_item_list_lookup;
thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS; thd->lex->current_select->cur_pos_in_select_list= UNDEF_POS;

View File

@ -29,7 +29,7 @@
/* extra 4+4 bytes for slave tmp tables */ /* extra 4+4 bytes for slave tmp tables */
#define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4) #define MAX_DBKEY_LENGTH (NAME_LEN*2+1+1+4+4)
#define MAX_ALIAS_NAME 256 #define MAX_ALIAS_NAME 256
#define MAX_FIELD_NAME 34 /* Max colum name length +2 */ #define MAX_FIELD_NAME (NAME_LEN+1) /* Max colum name length +1 */
#define MAX_SYS_VAR_LENGTH 32 #define MAX_SYS_VAR_LENGTH 32
#define MAX_KEY MAX_INDEXES /* Max used keys */ #define MAX_KEY MAX_INDEXES /* Max used keys */
#define MAX_REF_PARTS 32 /* Max parts used as ref */ #define MAX_REF_PARTS 32 /* Max parts used as ref */

View File

@ -712,6 +712,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
{ {
table->use_all_columns(); table->use_all_columns();
table->rpl_write_set= table->write_set; table->rpl_write_set= table->write_set;
// Initialize autoinc.
// We don't set next_number_field here, as it is handled manually.
if (table->found_next_number_field)
table->file->info(HA_STATUS_AUTO);
} }
else else
{ {

View File

@ -2976,6 +2976,8 @@ void st_select_lex::init_query()
prep_leaf_list_state= UNINIT; prep_leaf_list_state= UNINIT;
bzero((char*) expr_cache_may_be_used, sizeof(expr_cache_may_be_used)); bzero((char*) expr_cache_may_be_used, sizeof(expr_cache_may_be_used));
select_list_tables= 0; select_list_tables= 0;
rownum_in_field_list= 0;
window_specs.empty(); window_specs.empty();
window_funcs.empty(); window_funcs.empty();
tvc= 0; tvc= 0;

View File

@ -1348,6 +1348,9 @@ public:
*/ */
table_map select_list_tables; table_map select_list_tables;
/* Set to 1 if any field in field list has ROWNUM() */
bool rownum_in_field_list;
/* namp of nesting SELECT visibility (for aggregate functions check) */ /* namp of nesting SELECT visibility (for aggregate functions check) */
nesting_map name_visibility_map; nesting_map name_visibility_map;
table_map with_dep; table_map with_dep;

View File

@ -1136,7 +1136,7 @@ static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables)
if (get_table_category(&db, &tn) < TABLE_CATEGORY_INFORMATION) if (get_table_category(&db, &tn) < TABLE_CATEGORY_INFORMATION)
return false; return false;
} }
return true; return tables != NULL;
} }
static bool wsrep_command_no_result(char command) static bool wsrep_command_no_result(char command)
@ -3687,6 +3687,8 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) && (sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) &&
!wsrep_tables_accessible_when_detached(all_tables) && !wsrep_tables_accessible_when_detached(all_tables) &&
lex->sql_command != SQLCOM_SET_OPTION && lex->sql_command != SQLCOM_SET_OPTION &&
lex->sql_command != SQLCOM_CHANGE_DB &&
!(lex->sql_command == SQLCOM_SELECT && !all_tables) &&
!wsrep_is_show_query(lex->sql_command)) !wsrep_is_show_query(lex->sql_command))
{ {
my_message(ER_UNKNOWN_COM_ERROR, my_message(ER_UNKNOWN_COM_ERROR,

View File

@ -460,7 +460,6 @@ void JOIN::init(THD *thd_arg, List<Item> &fields_arg,
no_order= 0; no_order= 0;
simple_order= 0; simple_order= 0;
simple_group= 0; simple_group= 0;
rand_table_in_field_list= 0;
ordered_index_usage= ordered_index_void; ordered_index_usage= ordered_index_void;
need_distinct= 0; need_distinct= 0;
skip_sort_order= 0; skip_sort_order= 0;
@ -1461,7 +1460,6 @@ JOIN::prepare(TABLE_LIST *tables_init, COND *conds_init, uint og_num,
&all_fields, &select_lex->pre_fix, 1)) &all_fields, &select_lex->pre_fix, 1))
DBUG_RETURN(-1); DBUG_RETURN(-1);
thd->lex->current_select->context_analysis_place= save_place; thd->lex->current_select->context_analysis_place= save_place;
rand_table_in_field_list= select_lex->select_list_tables & RAND_TABLE_BIT;
if (setup_without_group(thd, ref_ptrs, tables_list, if (setup_without_group(thd, ref_ptrs, tables_list,
select_lex->leaf_tables, fields_list, select_lex->leaf_tables, fields_list,
@ -15169,7 +15167,7 @@ remove_const(JOIN *join,ORDER *first_order, COND *cond,
and some wrong results so better to leave the code as it was and some wrong results so better to leave the code as it was
related to ROLLUP. related to ROLLUP.
*/ */
*simple_order= !join->rand_table_in_field_list; *simple_order= !join->select_lex->rownum_in_field_list;
if (join->only_const_tables()) if (join->only_const_tables())
return change_list ? 0 : first_order; // No need to sort return change_list ? 0 : first_order; // No need to sort

View File

@ -1441,11 +1441,6 @@ public:
GROUP/ORDER BY. GROUP/ORDER BY.
*/ */
bool simple_order, simple_group; bool simple_order, simple_group;
/*
Set to 1 if any field in field list has RAND_TABLE set. For example if
if one uses RAND() or ROWNUM() in field list
*/
bool rand_table_in_field_list;
/* /*
ordered_index_usage is set if an ordered index access ordered_index_usage is set if an ordered index access

View File

@ -9012,6 +9012,7 @@ int TABLE::update_generated_fields()
res= found_next_number_field->set_default(); res= found_next_number_field->set_default();
if (likely(!res)) if (likely(!res))
res= file->update_auto_increment(); res= file->update_auto_increment();
next_number_field= NULL;
} }
if (likely(!res) && vfield) if (likely(!res) && vfield)

View File

@ -128,6 +128,7 @@ ulong wsrep_trx_fragment_unit= WSREP_FRAG_BYTES;
ulong wsrep_SR_store_type= WSREP_SR_STORE_TABLE; ulong wsrep_SR_store_type= WSREP_SR_STORE_TABLE;
uint wsrep_ignore_apply_errors= 0; uint wsrep_ignore_apply_errors= 0;
std::atomic <bool> wsrep_thread_create_failed;
/* /*
* End configuration options * End configuration options
@ -3565,7 +3566,7 @@ int wsrep_create_trigger_query(THD *thd, uchar** buf, size_t* buf_len)
void* start_wsrep_THD(void *arg) void* start_wsrep_THD(void *arg)
{ {
THD *thd; THD *thd= NULL;
Wsrep_thd_args* thd_args= (Wsrep_thd_args*) arg; Wsrep_thd_args* thd_args= (Wsrep_thd_args*) arg;
@ -3596,6 +3597,7 @@ void* start_wsrep_THD(void *arg)
mysql_thread_set_psi_id(thd->thread_id); mysql_thread_set_psi_id(thd->thread_id);
thd->thr_create_utime= microsecond_interval_timer(); thd->thr_create_utime= microsecond_interval_timer();
DBUG_EXECUTE_IF("wsrep_simulate_failed_connection_1", goto error; );
// </5.1.17> // </5.1.17>
/* /*
handle_one_connection() is normally the only way a thread would handle_one_connection() is normally the only way a thread would
@ -3702,6 +3704,18 @@ void* start_wsrep_THD(void *arg)
error: error:
WSREP_ERROR("Failed to create/initialize system thread"); WSREP_ERROR("Failed to create/initialize system thread");
if (thd)
{
close_connection(thd, ER_OUT_OF_RESOURCES);
statistic_increment(aborted_connects, &LOCK_status);
server_threads.erase(thd);
delete thd;
my_thread_end();
}
delete thd_args;
// This will signal error to wsrep_slave_threads_update
wsrep_thread_create_failed.store(true, std::memory_order_relaxed);
/* Abort if its the first applier/rollbacker thread. */ /* Abort if its the first applier/rollbacker thread. */
if (!mysqld_server_initialized) if (!mysqld_server_initialized)
unireg_abort(1); unireg_abort(1);

View File

@ -90,6 +90,7 @@ extern ulong wsrep_running_rollbacker_threads;
extern bool wsrep_new_cluster; extern bool wsrep_new_cluster;
extern bool wsrep_gtid_mode; extern bool wsrep_gtid_mode;
extern uint32 wsrep_gtid_domain_id; extern uint32 wsrep_gtid_domain_id;
extern std::atomic <bool > wsrep_thread_create_failed;
extern ulonglong wsrep_mode; extern ulonglong wsrep_mode;
enum enum_wsrep_reject_types { enum enum_wsrep_reject_types {

View File

@ -23,8 +23,7 @@
#include "rpl_rli.h" #include "rpl_rli.h"
#include "log_event.h" #include "log_event.h"
#include "sql_parse.h" #include "sql_parse.h"
#include "mysqld.h" // start_wsrep_THD(); #include "wsrep_mysqld.h" // start_wsrep_THD();
#include "wsrep_applier.h" // start_wsrep_THD();
#include "mysql/service_wsrep.h" #include "mysql/service_wsrep.h"
#include "debug_sync.h" #include "debug_sync.h"
#include "slave.h" #include "slave.h"

View File

@ -789,18 +789,25 @@ bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type)
if (wsrep_slave_count_change > 0) if (wsrep_slave_count_change > 0)
{ {
WSREP_DEBUG("Creating %d applier threads, total %ld", wsrep_slave_count_change, wsrep_slave_threads); WSREP_DEBUG("Creating %d applier threads, total %ld", wsrep_slave_count_change, wsrep_slave_threads);
wsrep_thread_create_failed.store(false, std::memory_order_relaxed);
res= wsrep_create_appliers(wsrep_slave_count_change, true); res= wsrep_create_appliers(wsrep_slave_count_change, true);
mysql_mutex_unlock(&LOCK_global_system_variables); mysql_mutex_unlock(&LOCK_global_system_variables);
mysql_mutex_unlock(&LOCK_wsrep_slave_threads); mysql_mutex_unlock(&LOCK_wsrep_slave_threads);
// Thread creation and execution is asyncronous, therefore we need // Thread creation and execution is asyncronous, therefore we need
// wait them to be started or error produced // wait them to be started or error produced
while (wsrep_running_applier_threads != (ulong)wsrep_slave_threads) while (wsrep_running_applier_threads != (ulong)wsrep_slave_threads &&
!wsrep_thread_create_failed.load(std::memory_order_relaxed))
{ {
my_sleep(1000); my_sleep(1000);
} }
mysql_mutex_lock(&LOCK_global_system_variables); mysql_mutex_lock(&LOCK_global_system_variables);
if (wsrep_thread_create_failed.load(std::memory_order_relaxed)) {
wsrep_slave_threads= wsrep_running_applier_threads;
return true;
}
WSREP_DEBUG("Running %lu applier threads", wsrep_running_applier_threads); WSREP_DEBUG("Running %lu applier threads", wsrep_running_applier_threads);
wsrep_slave_count_change = 0; wsrep_slave_count_change = 0;
} }

View File

@ -2627,288 +2627,6 @@ dberr_t btr_cur_t::open_leaf(bool first, dict_index_t *index,
return err; return err;
} }
/**********************************************************************//**
Positions a cursor at a randomly chosen position within a B-tree.
@return true if the index is available and we have put the cursor, false
if the index is unavailable */
bool
btr_cur_open_at_rnd_pos(
dict_index_t* index, /*!< in: index */
btr_latch_mode latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_cur_t* cursor, /*!< in/out: B-tree cursor */
mtr_t* mtr) /*!< in: mtr */
{
page_cur_t* page_cursor;
ulint node_ptr_max_size = srv_page_size / 2;
ulint height;
rec_t* node_ptr;
btr_intention_t lock_intention;
buf_block_t* tree_blocks[BTR_MAX_LEVELS];
ulint tree_savepoints[BTR_MAX_LEVELS];
ulint n_blocks = 0;
ulint n_releases = 0;
mem_heap_t* heap = NULL;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
rec_offs_init(offsets_);
ut_ad(!index->is_spatial());
lock_intention = btr_cur_get_and_clear_intention(&latch_mode);
ulint savepoint = mtr_set_savepoint(mtr);
rw_lock_type_t upper_rw_latch;
switch (latch_mode) {
case BTR_MODIFY_TREE:
/* Most of delete-intended operations are purging.
Free blocks and read IO bandwidth should be prior
for them, when the history list is glowing huge. */
if (lock_intention == BTR_INTENTION_DELETE
&& buf_pool.n_pend_reads
&& trx_sys.history_size_approx()
> BTR_CUR_FINE_HISTORY_LENGTH) {
mtr_x_lock_index(index, mtr);
} else {
mtr_sx_lock_index(index, mtr);
}
upper_rw_latch = RW_X_LATCH;
break;
case BTR_SEARCH_PREV:
case BTR_MODIFY_PREV:
/* This function doesn't support left uncle
page lock for left leaf page lock, when
needed. */
case BTR_SEARCH_TREE:
case BTR_CONT_MODIFY_TREE:
case BTR_CONT_SEARCH_TREE:
ut_ad(0);
/* fall through */
default:
if (!srv_read_only_mode) {
mtr_s_lock_index(index, mtr);
upper_rw_latch = RW_S_LATCH;
} else {
upper_rw_latch = RW_NO_LATCH;
}
}
DBUG_EXECUTE_IF("test_index_is_unavailable",
return(false););
if (index->page == FIL_NULL) {
/* Since we don't hold index lock until just now, the index
could be modified by others, for example, if this is a
statistics updater for referenced table, it could be marked
as unavailable by 'DROP TABLE' in the mean time, since
we don't hold lock for statistics updater */
return(false);
}
const rw_lock_type_t root_leaf_rw_latch = btr_cur_latch_for_root_leaf(
latch_mode);
page_cursor = btr_cur_get_page_cur(cursor);
page_cursor->index = index;
page_id_t page_id(index->table->space_id, index->page);
const ulint zip_size = index->table->space->zip_size();
dberr_t err;
if (root_leaf_rw_latch == RW_X_LATCH) {
node_ptr_max_size = btr_node_ptr_max_size(index);
}
height = ULINT_UNDEFINED;
for (;;) {
page_t* page;
ut_ad(n_blocks < BTR_MAX_LEVELS);
tree_savepoints[n_blocks] = mtr_set_savepoint(mtr);
const rw_lock_type_t rw_latch = height
&& latch_mode != BTR_MODIFY_TREE
? upper_rw_latch : RW_NO_LATCH;
buf_block_t* block = buf_page_get_gen(page_id, zip_size,
rw_latch, NULL, BUF_GET,
mtr, &err,
height == 0
&& !index->is_clust());
tree_blocks[n_blocks] = block;
ut_ad((block != NULL) == (err == DB_SUCCESS));
if (!block) {
if (err == DB_DECRYPTION_FAILED) {
btr_decryption_failed(*index);
}
break;
}
page = buf_block_get_frame(block);
if (height == ULINT_UNDEFINED
&& page_is_leaf(page)
&& rw_latch != RW_NO_LATCH
&& rw_latch != root_leaf_rw_latch) {
/* We should retry to get the page, because the root page
is latched with different level as a leaf page. */
ut_ad(root_leaf_rw_latch != RW_NO_LATCH);
ut_ad(rw_latch == RW_S_LATCH);
ut_ad(n_blocks == 0);
mtr_release_block_at_savepoint(
mtr, tree_savepoints[n_blocks],
tree_blocks[n_blocks]);
upper_rw_latch = root_leaf_rw_latch;
continue;
}
ut_ad(fil_page_index_page_check(page));
ut_ad(index->id == btr_page_get_index_id(page));
if (height == ULINT_UNDEFINED) {
/* We are in the root node */
height = btr_page_get_level(page);
}
if (height == 0) {
if (rw_latch == RW_NO_LATCH
|| srv_read_only_mode) {
btr_cur_latch_leaves(block, latch_mode, cursor,
mtr);
}
/* btr_cur_t::open_leaf() and
btr_cur_search_to_nth_level() release
tree s-latch here.*/
switch (latch_mode) {
case BTR_MODIFY_TREE:
case BTR_CONT_MODIFY_TREE:
case BTR_CONT_SEARCH_TREE:
break;
default:
/* Release the tree s-latch */
if (!srv_read_only_mode) {
mtr_release_s_latch_at_savepoint(
mtr, savepoint,
&index->lock);
}
/* release upper blocks */
for (; n_releases < n_blocks; n_releases++) {
mtr_release_block_at_savepoint(
mtr,
tree_savepoints[n_releases],
tree_blocks[n_releases]);
}
}
}
page_cursor->block = block;
page_cur_open_on_rnd_user_rec(page_cursor);
if (height == 0) {
break;
}
ut_ad(height > 0);
height--;
node_ptr = page_cur_get_rec(page_cursor);
offsets = rec_get_offsets(node_ptr, page_cursor->index,
offsets, 0, ULINT_UNDEFINED, &heap);
/* If the rec is the first or last in the page for
pessimistic delete intention, it might cause node_ptr insert
for the upper level. We should change the intention and retry.
*/
if (latch_mode == BTR_MODIFY_TREE
&& btr_cur_need_opposite_intention(
page, lock_intention, node_ptr)) {
ut_ad(upper_rw_latch == RW_X_LATCH);
/* release all blocks */
for (; n_releases <= n_blocks; n_releases++) {
mtr_release_block_at_savepoint(
mtr, tree_savepoints[n_releases],
tree_blocks[n_releases]);
}
lock_intention = BTR_INTENTION_BOTH;
page_id.set_page_no(dict_index_get_page(index));
height = ULINT_UNDEFINED;
n_blocks = 0;
n_releases = 0;
continue;
}
if (latch_mode == BTR_MODIFY_TREE
&& !btr_cur_will_modify_tree(
page_cursor->index, page, lock_intention,
node_ptr, node_ptr_max_size, zip_size, mtr)) {
ut_ad(upper_rw_latch == RW_X_LATCH);
ut_ad(n_releases <= n_blocks);
/* we can release upper blocks */
for (; n_releases < n_blocks; n_releases++) {
if (n_releases == 0) {
/* we should not release root page
to pin to same block. */
continue;
}
/* release unused blocks to unpin */
mtr_release_block_at_savepoint(
mtr, tree_savepoints[n_releases],
tree_blocks[n_releases]);
}
}
if (height == 0
&& latch_mode == BTR_MODIFY_TREE) {
ut_ad(upper_rw_latch == RW_X_LATCH);
/* we should sx-latch root page, if released already.
It contains seg_header. */
if (n_releases > 0) {
mtr->sx_latch_at_savepoint(
tree_savepoints[0],
tree_blocks[0]);
}
/* x-latch the branch blocks not released yet. */
for (ulint i = n_releases; i <= n_blocks; i++) {
mtr->x_latch_at_savepoint(
tree_savepoints[i],
tree_blocks[i]);
}
}
/* Go to the child node */
page_id.set_page_no(
btr_node_ptr_get_child_page_no(node_ptr, offsets));
n_blocks++;
}
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
return err == DB_SUCCESS;
}
/*==================== B-TREE INSERT =========================*/ /*==================== B-TREE INSERT =========================*/
/*************************************************************//** /*************************************************************//**

View File

@ -1079,6 +1079,60 @@ btr_record_not_null_field_in_rec(
} }
} }
inline dberr_t
btr_cur_t::open_random_leaf(rec_offs *&offsets, mem_heap_t *&heap, mtr_t &mtr)
{
ut_ad(!index()->is_spatial());
ut_ad(!mtr.get_savepoint());
mtr_s_lock_index(index(), &mtr);
if (index()->page == FIL_NULL)
return DB_CORRUPTION;
dberr_t err;
auto offset= index()->page;
bool merge= false;
ulint height= ULINT_UNDEFINED;
while (buf_block_t *block=
btr_block_get(*index(), offset, RW_S_LATCH, merge, &mtr, &err))
{
page_cur.block= block;
if (height == ULINT_UNDEFINED)
{
height= btr_page_get_level(block->page.frame);
if (height > BTR_MAX_LEVELS)
return DB_CORRUPTION;
if (height == 0)
goto got_leaf;
}
if (height == 0)
{
mtr.rollback_to_savepoint(0, mtr.get_savepoint() - 1);
got_leaf:
page_cur.rec= page_get_infimum_rec(block->page.frame);
return DB_SUCCESS;
}
if (!--height)
merge= !index()->is_clust();
page_cur_open_on_rnd_user_rec(&page_cur);
offsets= rec_get_offsets(page_cur.rec, page_cur.index, offsets, 0,
ULINT_UNDEFINED, &heap);
/* Go to the child node */
offset= btr_node_ptr_get_child_page_no(page_cur.rec, offsets);
}
return err;
}
/** Estimated table level stats from sampled value. /** Estimated table level stats from sampled value.
@param value sampled stats @param value sampled stats
@param index index being sampled @param index index being sampled
@ -1107,7 +1161,6 @@ std::vector<index_field_stats_t>
btr_estimate_number_of_different_key_vals(dict_index_t* index, btr_estimate_number_of_different_key_vals(dict_index_t* index,
trx_id_t bulk_trx_id) trx_id_t bulk_trx_id)
{ {
btr_cur_t cursor;
page_t* page; page_t* page;
rec_t* rec; rec_t* rec;
ulint n_cols; ulint n_cols;
@ -1222,14 +1275,15 @@ btr_estimate_number_of_different_key_vals(dict_index_t* index,
ut_ad(n_sample_pages > 0 && n_sample_pages <= (index->stat_index_size <= 1 ? 1 : index->stat_index_size)); ut_ad(n_sample_pages > 0 && n_sample_pages <= (index->stat_index_size <= 1 ? 1 : index->stat_index_size));
/* We sample some pages in the index to get an estimate */ /* We sample some pages in the index to get an estimate */
btr_cur_t cursor;
cursor.page_cur.index = index;
for (ulint i = 0; i < n_sample_pages; i++) { for (ulint i = 0; i < n_sample_pages; i++) {
mtr.start(); mtr.start();
if (!btr_cur_open_at_rnd_pos(index, BTR_SEARCH_LEAF, if (cursor.open_random_leaf(offsets_rec, heap, mtr) !=
&cursor, &mtr) DB_SUCCESS
|| index->table->bulk_trx_id != bulk_trx_id || index->table->bulk_trx_id != bulk_trx_id) {
|| !index->is_readable()) {
mtr.commit(); mtr.commit();
goto exit_loop; goto exit_loop;
} }
@ -1242,9 +1296,8 @@ btr_estimate_number_of_different_key_vals(dict_index_t* index,
page = btr_cur_get_page(&cursor); page = btr_cur_get_page(&cursor);
rec = page_rec_get_next(page_get_infimum_rec(page)); rec = page_rec_get_next(cursor.page_cur.rec);
const ulint n_core = page_is_leaf(page) const ulint n_core = index->n_core_fields;
? index->n_core_fields : 0;
if (rec && !page_rec_is_supremum(rec)) { if (rec && !page_rec_is_supremum(rec)) {
not_empty_flag = 1; not_empty_flag = 1;

View File

@ -2418,36 +2418,26 @@ will be merged from ibuf trees to the pages read
ulint ibuf_contract() ulint ibuf_contract()
{ {
mtr_t mtr; mtr_t mtr;
btr_pcur_t pcur; btr_cur_t cur;
ulint sum_sizes; ulint sum_sizes;
uint32_t page_nos[IBUF_MAX_N_PAGES_MERGED]; uint32_t page_nos[IBUF_MAX_N_PAGES_MERGED];
uint32_t space_ids[IBUF_MAX_N_PAGES_MERGED]; uint32_t space_ids[IBUF_MAX_N_PAGES_MERGED];
ibuf_mtr_start(&mtr); ibuf_mtr_start(&mtr);
/* Open a cursor to a randomly chosen leaf of the tree, at a random if (cur.open_leaf(true, ibuf.index, BTR_SEARCH_LEAF, &mtr) !=
position within the leaf */ DB_SUCCESS) {
pcur.pos_state = BTR_PCUR_IS_POSITIONED;
pcur.old_rec = nullptr;
pcur.trx_if_known = nullptr;
pcur.search_mode = PAGE_CUR_G;
pcur.latch_mode = BTR_SEARCH_LEAF;
btr_pcur_init(&pcur);
if (!btr_cur_open_at_rnd_pos(ibuf.index, BTR_SEARCH_LEAF,
btr_pcur_get_btr_cur(&pcur), &mtr)) {
return 0; return 0;
} }
ut_ad(page_validate(btr_pcur_get_page(&pcur), ibuf.index)); ut_ad(page_validate(btr_cur_get_page(&cur), ibuf.index));
if (page_is_empty(btr_pcur_get_page(&pcur))) { if (page_is_empty(btr_cur_get_page(&cur))) {
/* If a B-tree page is empty, it must be the root page /* If a B-tree page is empty, it must be the root page
and the whole B-tree must be empty. InnoDB does not and the whole B-tree must be empty. InnoDB does not
allow empty B-tree pages other than the root. */ allow empty B-tree pages other than the root. */
ut_ad(ibuf.empty); ut_ad(ibuf.empty);
ut_ad(btr_pcur_get_block(&pcur)->page.id() ut_ad(btr_cur_get_block(&cur)->page.id()
== page_id_t(IBUF_SPACE_ID, FSP_IBUF_TREE_ROOT_PAGE_NO)); == page_id_t(IBUF_SPACE_ID, FSP_IBUF_TREE_ROOT_PAGE_NO));
ibuf_mtr_commit(&mtr); ibuf_mtr_commit(&mtr);
@ -2457,7 +2447,7 @@ ulint ibuf_contract()
ulint n_pages = 0; ulint n_pages = 0;
sum_sizes = ibuf_get_merge_page_nos(TRUE, sum_sizes = ibuf_get_merge_page_nos(TRUE,
btr_pcur_get_rec(&pcur), &mtr, btr_cur_get_rec(&cur), &mtr,
space_ids, space_ids,
page_nos, &n_pages); page_nos, &n_pages);
ibuf_mtr_commit(&mtr); ibuf_mtr_commit(&mtr);

View File

@ -172,17 +172,6 @@ dberr_t btr_cur_search_to_nth_level(ulint level,
btr_cur_t *cursor, mtr_t *mtr, btr_cur_t *cursor, mtr_t *mtr,
ib_uint64_t autoinc= 0); ib_uint64_t autoinc= 0);
/**********************************************************************//**
Positions a cursor at a randomly chosen position within a B-tree.
@return true if the index is available and we have put the cursor, false
if the index is unavailable */
bool
btr_cur_open_at_rnd_pos(
dict_index_t* index, /*!< in: index */
btr_latch_mode latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_cur_t* cursor, /*!< in/out: B-tree cursor */
mtr_t* mtr) /*!< in: mtr */
MY_ATTRIBUTE((nonnull,warn_unused_result));
/*************************************************************//** /*************************************************************//**
Tries to perform an insert to a page in an index tree, next to cursor. Tries to perform an insert to a page in an index tree, next to cursor.
It is assumed that mtr holds an x-latch on the page. The operation does It is assumed that mtr holds an x-latch on the page. The operation does
@ -813,6 +802,14 @@ struct btr_cur_t {
@return error code */ @return error code */
dberr_t open_leaf(bool first, dict_index_t *index, btr_latch_mode latch_mode, dberr_t open_leaf(bool first, dict_index_t *index, btr_latch_mode latch_mode,
mtr_t *mtr); mtr_t *mtr);
/** Open the cursor at a random leaf page record.
@param offsets temporary memory for rec_get_offsets()
@param heap memory heap for rec_get_offsets()
@param mtr mini-transaction
@return error code */
inline dberr_t open_random_leaf(rec_offs *&offsets, mem_heap_t *& heap,
mtr_t &mtr);
}; };
/** Modify the delete-mark flag of a record. /** Modify the delete-mark flag of a record.

View File

@ -589,6 +589,18 @@ ret:
} }
static int
my_strnncollsp_nchars_tis620(CHARSET_INFO * cs,
const uchar *a, size_t a_length,
const uchar *b, size_t b_length,
size_t nchars)
{
set_if_smaller(a_length, nchars);
set_if_smaller(b_length, nchars);
return my_strnncollsp_tis620(cs, a, a_length, b, b_length);
}
static static
int my_strnncollsp_tis620_nopad(CHARSET_INFO * cs __attribute__((unused)), int my_strnncollsp_tis620_nopad(CHARSET_INFO * cs __attribute__((unused)),
const uchar *a0, size_t a_length, const uchar *a0, size_t a_length,
@ -856,7 +868,7 @@ static MY_COLLATION_HANDLER my_collation_ci_handler =
NULL, /* init */ NULL, /* init */
my_strnncoll_tis620, my_strnncoll_tis620,
my_strnncollsp_tis620, my_strnncollsp_tis620,
my_strnncollsp_nchars_generic_8bit, my_strnncollsp_nchars_tis620,
my_strnxfrm_tis620, my_strnxfrm_tis620,
my_strnxfrmlen_simple, my_strnxfrmlen_simple,
my_like_range_simple, my_like_range_simple,
@ -876,7 +888,7 @@ static MY_COLLATION_HANDLER my_collation_nopad_ci_handler =
NULL, /* init */ NULL, /* init */
my_strnncoll_tis620, my_strnncoll_tis620,
my_strnncollsp_tis620_nopad, my_strnncollsp_tis620_nopad,
my_strnncollsp_nchars_generic_8bit, my_strnncollsp_nchars_tis620,
my_strnxfrm_tis620_nopad, my_strnxfrm_tis620_nopad,
my_strnxfrmlen_simple, my_strnxfrmlen_simple,
my_like_range_simple, my_like_range_simple,

View File

@ -1469,6 +1469,7 @@ test_strnncollsp_char()
#ifdef HAVE_CHARSET_tis620 #ifdef HAVE_CHARSET_tis620
failed+= strnncollsp_char_mbminlen1("tis620_thai_ci", NULL); failed+= strnncollsp_char_mbminlen1("tis620_thai_ci", NULL);
failed+= strnncollsp_char_mbminlen1("tis620_thai_nopad_ci", NULL);
#endif #endif
#ifdef HAVE_CHARSET_big5 #ifdef HAVE_CHARSET_big5

@ -1 +1 @@
Subproject commit 8bfce04189671eb1f06e0fa83dff8c880f31088f Subproject commit f8ff2cfdd4c6424ffd96fc53bcc0f2e1d9ffe137