Merge 10.5 -> 10.6

Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
Kristian Nielsen 2024-12-05 09:20:36 +01:00
commit 0166c89e02
31 changed files with 578 additions and 48 deletions

View file

@ -9702,7 +9702,7 @@ void init_re(void)
//"[[:space:]]*CALL[[:space:]]|" // XXX run_query_stmt doesn't read multiple result sets
"[[:space:]]*CHANGE[[:space:]]|"
"[[:space:]]*CHECKSUM[[:space:]]|"
"[[:space:]]*COMMIT[[:space:]]|"
"[[:space:]]*COMMIT[[:space:]]*|"
"[[:space:]]*COMPOUND[[:space:]]|"
"[[:space:]]*CREATE[[:space:]]+DATABASE[[:space:]]|"
"[[:space:]]*CREATE[[:space:]]+INDEX[[:space:]]|"

View file

@ -70,6 +70,17 @@
# endif /* GNUC >= 3.1 */
#endif
/* gcc 7.5.0 does not support __attribute__((no_sanitize("undefined")) */
#ifndef ATTRIBUTE_NO_UBSAN
# if (GCC_VERSION >= 8000) || defined(__clang__)
# define ATTRIBUTE_NO_UBSAN __attribute__((no_sanitize("undefined")))
# elif (GCC_VERSION >= 6001)
# define ATTRIBUTE_NO_UBSAN __attribute__((no_sanitize_undefined))
# else
# define ATTRIBUTE_NO_UBSAN
# endif
#endif
/* Define pragmas to disable warnings for stack frame checking */
#if defined(__clang__)

View file

@ -91,12 +91,12 @@ while ($_rpl_server)
--echo **** SHOW BINLOG EVENTS on $CURRENT_CONNECTION ****
let $binlog_name= query_get_value("SHOW MASTER STATUS", File, 1);
--echo binlog_name = '$binlog_name'
eval SHOW BINLOG EVENTS IN '$binlog_name';
eval SHOW BINLOG EVENTS IN '$binlog_name' LIMIT 200;
--echo
--echo **** SHOW RELAYLOG EVENTS on $CURRENT_CONNECTION ****
let $relaylog_name= query_get_value(SHOW SLAVE STATUS, Relay_Log_File, 1);
--echo relaylog_name = '$relaylog_name'
eval SHOW RELAYLOG EVENTS IN '$relaylog_name';
eval SHOW RELAYLOG EVENTS IN '$relaylog_name' LIMIT 200;
--let $_rpl_is_first_server= 0

View file

@ -19080,4 +19080,58 @@ f a c
0 0 -1
DROP VIEW v;
DROP TABLE t1;
#
# MDEV-32395: update_depend_map_for_order: SEGV at
# /mariadb-11.3.0/sql/sql_select.cc:16583
#
create table t1 (c1 int);
insert into t1 values (1), (2);
create table t2 (c2 int);
insert into t2 values (1), (2);
create table t3 (c3 int);
insert into t3 values (1), (2);
set statement optimizer_switch='condition_pushdown_for_derived=off,condition_pushdown_for_subquery=off,condition_pushdown_from_having=off' for
select t1.c1 as a from t2, t1 where t1.c1=t2.c2
order by (select c3 from t3 group by a having a=2);
a
1
2
drop table t1, t2, t3;
# Test case 2
CREATE TABLE t1 ( x BOOLEAN NOT NULL );
INSERT INTO t1 ( x ) VALUES ( 1 ) ;
UPDATE t1 SET x = 1 WHERE x = 1 ;
INSERT INTO t1 ( x ) VALUES ( 1 ) , ( x IN ( SELECT x FROM ( SELECT ( SELECT EXISTS ( SELECT * FROM ( SELECT DISTINCT ( - CASE WHEN x = 1 THEN 1 ELSE x + 1 END >= x IS NOT NULL = 1 AND x = 1 ) OR x = x OR x = 'x' FROM t1 AS x GROUP BY x ) AS x WHERE 1 / x GROUP BY x HAVING ( 1 = 1 AND x = 1 ) ) FROM t1 GROUP BY EXISTS ( SELECT 1 ) ) FROM t1 UNION SELECT x FROM t1 ) AS x ) ) ;
DROP TABLE t1;
# Test case 3
CREATE TABLE t0 ( c6 INT , c21 INT ) ;
INSERT INTO t0 VALUES ( 55 , -95 ) , ( 9 , 90 ) ;
ALTER TABLE t0 ADD COLUMN c37 INT AFTER c6 ;
INSERT INTO t0 VALUES ( ) , ( ) ;
SELECT t0 . c6 AS c42 FROM ( SELECT t0 . c6 = TRIM( TRAILING FROM 96 ) SOUNDS LIKE CONVERT ( t0 . c6 , UNSIGNED ) >> PI ( ) AS c49 FROM t0 ) AS t1 JOIN t0 ON RTRIM ( - RAND ( -66 ) BETWEEN FIND_IN_SET ( 20 , UNHEX ( -80 ) IS NULL OR IF ( 85 , -83 , -113 ) ) AND -125 ) / EXP ( c21 ) = t1 . c49 ORDER BY c42 , ( c42 + ( SELECT c21 AS c61 FROM t0 WHERE t0 . c37 >= -19.601384 = RAND ( ) / TRIM( t0 . c21 FROM 'C@rG3D(#9*17(a.,rV' ) = -106 GROUP BY c21 , c42 HAVING c42 = -73 LIMIT 1 ) ) ;
c42
9
9
55
55
drop table t0;
#
# MDEV-32329 pushdown from having into where: Server crashes at sub_select
#
WITH RECURSIVE cte AS ( SELECT 1 as x UNION SELECT x FROM cte)
SELECT ( SELECT 1 FROM ( SELECT 1 FROM cte) dt GROUP BY x HAVING x= 1 )
FROM cte
GROUP BY 1 ;
( SELECT 1 FROM ( SELECT 1 FROM cte) dt GROUP BY x HAVING x= 1 )
1
# Test case 2
WITH
cte1 AS ( SELECT 1 as x UNION SELECT 1),
cte2 AS ( SELECT 1 as x UNION SELECT 1)
SELECT
( SELECT 1 FROM ( SELECT 1 FROM cte1) dt GROUP BY x HAVING x= 1 )
FROM cte2
GROUP BY 1 ;
( SELECT 1 FROM ( SELECT 1 FROM cte1) dt GROUP BY x HAVING x= 1 )
1
# End of 10.5 tests

View file

@ -4218,5 +4218,57 @@ SELECT * FROM v,t1 WHERE f = DEFAULT(c);
DROP VIEW v;
DROP TABLE t1;
--echo #
--echo # MDEV-32395: update_depend_map_for_order: SEGV at
--echo # /mariadb-11.3.0/sql/sql_select.cc:16583
--echo #
create table t1 (c1 int);
insert into t1 values (1), (2);
create table t2 (c2 int);
insert into t2 values (1), (2);
create table t3 (c3 int);
insert into t3 values (1), (2);
set statement optimizer_switch='condition_pushdown_for_derived=off,condition_pushdown_for_subquery=off,condition_pushdown_from_having=off' for
select t1.c1 as a from t2, t1 where t1.c1=t2.c2
order by (select c3 from t3 group by a having a=2);
drop table t1, t2, t3;
--echo # Test case 2
CREATE TABLE t1 ( x BOOLEAN NOT NULL );
INSERT INTO t1 ( x ) VALUES ( 1 ) ;
UPDATE t1 SET x = 1 WHERE x = 1 ;
INSERT INTO t1 ( x ) VALUES ( 1 ) , ( x IN ( SELECT x FROM ( SELECT ( SELECT EXISTS ( SELECT * FROM ( SELECT DISTINCT ( - CASE WHEN x = 1 THEN 1 ELSE x + 1 END >= x IS NOT NULL = 1 AND x = 1 ) OR x = x OR x = 'x' FROM t1 AS x GROUP BY x ) AS x WHERE 1 / x GROUP BY x HAVING ( 1 = 1 AND x = 1 ) ) FROM t1 GROUP BY EXISTS ( SELECT 1 ) ) FROM t1 UNION SELECT x FROM t1 ) AS x ) ) ;
DROP TABLE t1;
--echo # Test case 3
CREATE TABLE t0 ( c6 INT , c21 INT ) ;
INSERT INTO t0 VALUES ( 55 , -95 ) , ( 9 , 90 ) ;
ALTER TABLE t0 ADD COLUMN c37 INT AFTER c6 ;
INSERT INTO t0 VALUES ( ) , ( ) ;
SELECT t0 . c6 AS c42 FROM ( SELECT t0 . c6 = TRIM( TRAILING FROM 96 ) SOUNDS LIKE CONVERT ( t0 . c6 , UNSIGNED ) >> PI ( ) AS c49 FROM t0 ) AS t1 JOIN t0 ON RTRIM ( - RAND ( -66 ) BETWEEN FIND_IN_SET ( 20 , UNHEX ( -80 ) IS NULL OR IF ( 85 , -83 , -113 ) ) AND -125 ) / EXP ( c21 ) = t1 . c49 ORDER BY c42 , ( c42 + ( SELECT c21 AS c61 FROM t0 WHERE t0 . c37 >= -19.601384 = RAND ( ) / TRIM( t0 . c21 FROM 'C@rG3D(#9*17(a.,rV' ) = -106 GROUP BY c21 , c42 HAVING c42 = -73 LIMIT 1 ) ) ;
drop table t0;
--echo #
--echo # MDEV-32329 pushdown from having into where: Server crashes at sub_select
--echo #
WITH RECURSIVE cte AS ( SELECT 1 as x UNION SELECT x FROM cte)
SELECT ( SELECT 1 FROM ( SELECT 1 FROM cte) dt GROUP BY x HAVING x= 1 )
FROM cte
GROUP BY 1 ;
--echo # Test case 2
WITH
cte1 AS ( SELECT 1 as x UNION SELECT 1),
cte2 AS ( SELECT 1 as x UNION SELECT 1)
SELECT
( SELECT 1 FROM ( SELECT 1 FROM cte1) dt GROUP BY x HAVING x= 1 )
FROM cte2
GROUP BY 1 ;
--echo # End of 10.5 tests

View file

@ -1286,3 +1286,49 @@ ERROR: Bad syntax in rewrite-db: empty FROM db
ERROR: Bad syntax in rewrite-db: empty FROM db
#
# MDEV-31761: mariadb-binlog prints fractional timestamp part incorrectly
#
SET SESSION binlog_format= MIXED;
RESET MASTER;
SET time_zone= '+02:00';
CREATE TABLE t (a INT,
b TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6));
set SESSION timestamp= 1689978980.012345;
INSERT INTO t (a) VALUES (1);
SELECT * from t;
a b
1 2023-07-22 00:36:20.012345
FLUSH BINARY LOGS;
SET SESSION timestamp= 1689978980.567890;
SET SESSION binlog_format= ROW;
UPDATE t SET a = 2;
FLUSH BINARY LOGS;
SET SESSION binlog_format= STATEMENT;
DROP TABLE t;
SELECT * FROM t;
a b
1 2023-07-22 00:36:20.012345
SELECT * FROM t;
a b
2 2023-07-22 00:36:20.567890
DROP TABLE t;
SET time_zone= default;
#
# MDEV-24959: ER_BINLOG_ROW_LOGGING_FAILED (1534: Writing one row to the row-based binary log failed)
#
SET SESSION binlog_format= ROW;
SET SESSION binlog_row_image= MINIMAL;
RESET MASTER;
CREATE TABLE t1 (a INT NOT NULL DEFAULT 0 PRIMARY KEY);
REPLACE INTO t1 () VALUES (),();
DROP TABLE t1;
FLUSH BINARY LOGS;
SET SESSION binlog_format= STATEMENT;
SET SESSION binlog_row_image= default;
FOUND 1 /Number of rows: 2/ in mdev24959_1.txt
FOUND 1 /DROP TABLE/ in mdev24959_1.txt
FOUND 1 /Number of rows: 2/ in mdev24959_2.txt
FOUND 1 /DROP TABLE/ in mdev24959_2.txt
FOUND 1 /INSERT INTO .* VALUES/ in mdev24959_2.txt
FOUND 1 /SET /[*] no columns [*]// in mdev24959_2.txt

View file

@ -637,3 +637,82 @@ FLUSH LOGS;
--exec $MYSQL_BINLOG --rewrite-db=" ->" --short-form $MYSQLD_DATADIR/master-bin.000001 2>&1
--exec $MYSQL_BINLOG --rewrite-db=" test -> foo " --short-form $MYSQLD_DATADIR/master-bin.000001 > /dev/null 2> $MYSQLTEST_VARDIR/tmp/mysqlbinlog.warn
--echo #
--echo # MDEV-31761: mariadb-binlog prints fractional timestamp part incorrectly
--echo #
SET SESSION binlog_format= MIXED;
RESET MASTER;
SET time_zone= '+02:00';
CREATE TABLE t (a INT,
b TIMESTAMP(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6));
set SESSION timestamp= 1689978980.012345;
INSERT INTO t (a) VALUES (1);
SELECT * from t;
FLUSH BINARY LOGS;
SET SESSION timestamp= 1689978980.567890;
SET SESSION binlog_format= ROW;
UPDATE t SET a = 2;
FLUSH BINARY LOGS;
SET SESSION binlog_format= STATEMENT;
# Replay to see that timestamps are applied correctly.
# The bug was that leading zeros on the fractional part were not included in
# the mysqlbinlog output, so 1689978980.012345 was applied as 1689978980.12345.
DROP TABLE t;
--let $datadir= `select @@datadir`
--exec $MYSQL_BINLOG $datadir/master-bin.000001 | $MYSQL test
SELECT * FROM t;
--exec $MYSQL_BINLOG $datadir/master-bin.000002 | $MYSQL test
SELECT * FROM t;
DROP TABLE t;
SET time_zone= default;
--echo #
--echo # MDEV-24959: ER_BINLOG_ROW_LOGGING_FAILED (1534: Writing one row to the row-based binary log failed)
--echo #
SET SESSION binlog_format= ROW;
SET SESSION binlog_row_image= MINIMAL;
RESET MASTER;
CREATE TABLE t1 (a INT NOT NULL DEFAULT 0 PRIMARY KEY);
REPLACE INTO t1 () VALUES (),();
DROP TABLE t1;
FLUSH BINARY LOGS;
SET SESSION binlog_format= STATEMENT;
SET SESSION binlog_row_image= default;
--exec $MYSQL_BINLOG --base64-output=decode-rows $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mdev24959_1.txt
--exec $MYSQL_BINLOG --base64-output=decode-rows --verbose $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mdev24959_2.txt
--let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/mdev24959_1.txt
--let SEARCH_ABORT= NOT FOUND
--let SEARCH_PATTERN= Number of rows: 2
--source include/search_pattern_in_file.inc
# There was a bug that mysqlbinlog would get an error while decoding the
# update rows event with no after image and abort the dump; test that now
# the dump is complete and includes the final DROP TABLE.
--let SEARCH_PATTERN= DROP TABLE
--source include/search_pattern_in_file.inc
--let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/mdev24959_2.txt
--let SEARCH_PATTERN= Number of rows: 2
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= DROP TABLE
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= INSERT INTO .* VALUES
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= SET /[*] no columns [*]/
--source include/search_pattern_in_file.inc
--remove_file $MYSQLTEST_VARDIR/tmp/mdev24959_1.txt
--remove_file $MYSQLTEST_VARDIR/tmp/mdev24959_2.txt

View file

@ -0,0 +1,22 @@
connection node_2;
connection node_1;
connect bf_trx, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connect victim_trx, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connect node_2_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_2;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
connection victim_trx;
START TRANSACTION;
INSERT INTO t1 VALUES (2), (1);
connection node_2_ctrl;
SET GLOBAL debug_dbug = '+d,sync.wsrep_apply_cb';
connection bf_trx;
INSERT INTO t1 VALUES (1), (2);
connection node_2_ctrl;
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
SET GLOBAL debug_dbug = '';
connection victim_trx;
SET DEBUG_SYNC = "wsrep_at_dispatch_end_before_result SIGNAL signal.wsrep_apply_cb WAIT_FOR bf_abort";
COMMIT;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;

View file

@ -0,0 +1,22 @@
connection node_2;
connection node_1;
connect master, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connect node_1_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1;
START SLAVE;
connection master;
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
connection node_1;
SET GLOBAL debug_dbug = '+d,rpl_parallel_simulate_temp_err_xid,sync.wsrep_retry_event_group';
connection master;
INSERT INTO t1 VALUES (1);
connection node_1_ctrl;
SET debug_sync = 'now WAIT_FOR sync.wsrep_retry_event_group_reached';
SET GLOBAL debug_dbug = '';
SET debug_sync = 'now SIGNAL signal.wsrep_retry_event_group';
connection node_1;
SET debug_sync = 'RESET';
connection master;
DROP TABLE t1;
connection node_1;
STOP SLAVE;

View file

@ -0,0 +1,4 @@
!include ../galera_2nodes.cnf
[mysqltest]
ps-protocol

View file

@ -0,0 +1,57 @@
#
# MDEV-35446
#
# Test BF abort of a transaction under PS protocol, after
# a statement is prepared (and the diagnostics area is
# disabled).
#
--source include/have_debug_sync.inc
--source include/galera_cluster.inc
#
# Setup: bf_trx executes in node_1 and will BF abort victim_trx.
#
--connect bf_trx, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connect victim_trx, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connect node_2_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_2
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
--connection victim_trx
START TRANSACTION;
INSERT INTO t1 VALUES (2), (1);
--connection node_2_ctrl
SET GLOBAL debug_dbug = '+d,sync.wsrep_apply_cb';
--connection bf_trx
INSERT INTO t1 VALUES (1), (2);
--connection node_2_ctrl
SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
SET GLOBAL debug_dbug = '';
#
# COMMIT the victim_trx and expect a deadlock error.
# Here we park the client in a sync point at the end of prepare
# command (COM_STMT_PREPARE), where the diagnostics area of the
# client has already been disabled. The client signals the
# applier to continue and will be BF aborted.
# If bug is present, the transaction is aborted, but the COMMIT
# statement succeeds (instead of returning deadlock error).
#
--connection victim_trx
--disable_ps_protocol
SET DEBUG_SYNC = "wsrep_at_dispatch_end_before_result SIGNAL signal.wsrep_apply_cb WAIT_FOR bf_abort";
--enable_ps_protocol
--error ER_LOCK_DEADLOCK
COMMIT;
#
# Cleanup
#
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;

View file

@ -0,0 +1,10 @@
!include ../galera_2nodes_as_slave.cnf
[mysqld]
log-bin=mysqld-bin
log-slave-updates
binlog-format=ROW
[mysqld.1]
slave-parallel-threads=2
slave-parallel-mode=optimistic

View file

@ -0,0 +1,52 @@
# MDEV-35465 Async replication stops working on Galera async replica node
# when parallel replication is enabled
--source include/have_innodb.inc
--source include/have_log_bin.inc
--source include/galera_cluster.inc
--source include/have_debug_sync.inc
# Node 3 is not a Galera node, use it as a master
--connect master, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connect node_1_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3;
--enable_query_log
START SLAVE;
--connection master
CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB;
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
--source include/wait_condition.inc
#
--let debug_dbug_orig = `SELECT @@GLOBAL.debug_dbug`
SET GLOBAL debug_dbug = '+d,rpl_parallel_simulate_temp_err_xid,sync.wsrep_retry_event_group';
--connection master
INSERT INTO t1 VALUES (1);
--connection node_1_ctrl
SET debug_sync = 'now WAIT_FOR sync.wsrep_retry_event_group_reached';
--eval SET GLOBAL debug_dbug = '$debug_dbug_orig'
SET debug_sync = 'now SIGNAL signal.wsrep_retry_event_group';
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
--connection node_1
SET debug_sync = 'RESET';
--connection master
DROP TABLE t1;
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
--source include/wait_condition.inc
STOP SLAVE;

View file

@ -95,6 +95,33 @@ SELECT * FROM test.regular_tbl ORDER BY fkid LIMIT 2;
--replace_column 2 date-time 3 USER 4 UUID
SELECT * FROM test.regular_tbl ORDER BY fkid DESC LIMIT 2;
--echo *** MDEV-5798: Wrong errorcode for missing partition after TRUNCATE PARTITION
--connection master
eval CREATE TABLE t1 (a INT)
ENGINE=$engine_type
PARTITION BY LIST(a) (
PARTITION p0 VALUES IN (9, NULL),
PARTITION p1 VALUES IN (8, 2, 7),
PARTITION p2 VALUES IN (6, 4, 5),
PARTITION p3 VALUES IN (3, 1, 0)
);
ALTER TABLE t1 DROP PARTITION p0;
# This failed statement leaves ALTER_PARTITION_TRUNCATE set in
# thd->lex->alter_info.partition_flags
--error ER_NO_SUCH_TABLE
ALTER TABLE non_existent TRUNCATE PARTITION p1,p2;
# The bug was that the code would wrongly look at the (now stale) value of
# thd->lex->alter_info.partition_flags and give the wrong error code
# ER_WRONG_PARTITION_NAME.
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
INSERT INTO t1 PARTITION (p1,p2,p3) VALUES (0),(9);
--sync_slave_with_master
###### CLEAN UP SECTION ##############
connection master;
@ -102,3 +129,4 @@ DROP PROCEDURE test.proc_norm;
DROP PROCEDURE test.proc_byrange;
DROP TABLE test.regular_tbl;
DROP TABLE test.byrange_tbl;
DROP TABLE test.t1;

View file

@ -140,8 +140,26 @@ SELECT * FROM test.regular_tbl ORDER BY fkid DESC LIMIT 2;
id dt user uuidf fkid filler
1 date-time USER UUID 300 Partitioned table! Going to test replication for MySQL
2 date-time USER UUID 299 Partitioned table! Going to test replication for MySQL
*** MDEV-5798: Wrong errorcode for missing partition after TRUNCATE PARTITION
connection master;
CREATE TABLE t1 (a INT)
ENGINE='Archive'
PARTITION BY LIST(a) (
PARTITION p0 VALUES IN (9, NULL),
PARTITION p1 VALUES IN (8, 2, 7),
PARTITION p2 VALUES IN (6, 4, 5),
PARTITION p3 VALUES IN (3, 1, 0)
);
ALTER TABLE t1 DROP PARTITION p0;
ALTER TABLE non_existent TRUNCATE PARTITION p1,p2;
ERROR 42S02: Table 'test.non_existent' doesn't exist
INSERT INTO t1 PARTITION (p1,p2,p3) VALUES (0),(9);
ERROR HY000: Table has no partition for value 9
connection slave;
connection master;
DROP PROCEDURE test.proc_norm;
DROP PROCEDURE test.proc_byrange;
DROP TABLE test.regular_tbl;
DROP TABLE test.byrange_tbl;
DROP TABLE test.t1;
include/rpl_end.inc

View file

@ -142,9 +142,26 @@ SELECT * FROM test.regular_tbl ORDER BY fkid DESC LIMIT 2;
id dt user uuidf fkid filler
1 date-time USER UUID 300 Partitioned table! Going to test replication for MySQL
2 date-time USER UUID 299 Partitioned table! Going to test replication for MySQL
*** MDEV-5798: Wrong errorcode for missing partition after TRUNCATE PARTITION
connection master;
CREATE TABLE t1 (a INT)
ENGINE='InnoDB'
PARTITION BY LIST(a) (
PARTITION p0 VALUES IN (9, NULL),
PARTITION p1 VALUES IN (8, 2, 7),
PARTITION p2 VALUES IN (6, 4, 5),
PARTITION p3 VALUES IN (3, 1, 0)
);
ALTER TABLE t1 DROP PARTITION p0;
ALTER TABLE non_existent TRUNCATE PARTITION p1,p2;
ERROR 42S02: Table 'test.non_existent' doesn't exist
INSERT INTO t1 PARTITION (p1,p2,p3) VALUES (0),(9);
ERROR HY000: Table has no partition for value 9
connection slave;
connection master;
DROP PROCEDURE test.proc_norm;
DROP PROCEDURE test.proc_byrange;
DROP TABLE test.regular_tbl;
DROP TABLE test.byrange_tbl;
DROP TABLE test.t1;
include/rpl_end.inc

View file

@ -142,9 +142,26 @@ SELECT * FROM test.regular_tbl ORDER BY fkid DESC LIMIT 2;
id dt user uuidf fkid filler
1 date-time USER UUID 300 Partitioned table! Going to test replication for MySQL
2 date-time USER UUID 299 Partitioned table! Going to test replication for MySQL
*** MDEV-5798: Wrong errorcode for missing partition after TRUNCATE PARTITION
connection master;
CREATE TABLE t1 (a INT)
ENGINE='Memory'
PARTITION BY LIST(a) (
PARTITION p0 VALUES IN (9, NULL),
PARTITION p1 VALUES IN (8, 2, 7),
PARTITION p2 VALUES IN (6, 4, 5),
PARTITION p3 VALUES IN (3, 1, 0)
);
ALTER TABLE t1 DROP PARTITION p0;
ALTER TABLE non_existent TRUNCATE PARTITION p1,p2;
ERROR 42S02: Table 'test.non_existent' doesn't exist
INSERT INTO t1 PARTITION (p1,p2,p3) VALUES (0),(9);
ERROR HY000: Table has no partition for value 9
connection slave;
connection master;
DROP PROCEDURE test.proc_norm;
DROP PROCEDURE test.proc_byrange;
DROP TABLE test.regular_tbl;
DROP TABLE test.byrange_tbl;
DROP TABLE test.t1;
include/rpl_end.inc

View file

@ -142,9 +142,26 @@ SELECT * FROM test.regular_tbl ORDER BY fkid DESC LIMIT 2;
id dt user uuidf fkid filler
1 date-time USER UUID 300 Partitioned table! Going to test replication for MySQL
2 date-time USER UUID 299 Partitioned table! Going to test replication for MySQL
*** MDEV-5798: Wrong errorcode for missing partition after TRUNCATE PARTITION
connection master;
CREATE TABLE t1 (a INT)
ENGINE='MyISAM'
PARTITION BY LIST(a) (
PARTITION p0 VALUES IN (9, NULL),
PARTITION p1 VALUES IN (8, 2, 7),
PARTITION p2 VALUES IN (6, 4, 5),
PARTITION p3 VALUES IN (3, 1, 0)
);
ALTER TABLE t1 DROP PARTITION p0;
ALTER TABLE non_existent TRUNCATE PARTITION p1,p2;
ERROR 42S02: Table 'test.non_existent' doesn't exist
INSERT INTO t1 PARTITION (p1,p2,p3) VALUES (0),(9);
ERROR HY000: Table has no partition for value 9
connection slave;
connection master;
DROP PROCEDURE test.proc_norm;
DROP PROCEDURE test.proc_byrange;
DROP TABLE test.regular_tbl;
DROP TABLE test.byrange_tbl;
DROP TABLE test.t1;
include/rpl_end.inc

View file

@ -10307,7 +10307,8 @@ void ha_partition::print_error(int error, myf errflag)
/* Should probably look for my own errors first */
if ((error == HA_ERR_NO_PARTITION_FOUND) &&
! (thd->lex->alter_info.partition_flags & ALTER_PARTITION_TRUNCATE))
! (thd->lex->sql_command == SQLCOM_ALTER_TABLE &&
(thd->lex->alter_info.partition_flags & ALTER_PARTITION_TRUNCATE)))
{
m_part_info->print_no_partition_found(table, errflag);
DBUG_VOID_RETURN;

View file

@ -2719,12 +2719,6 @@ public:
*/
virtual void under_not(Item_func_not * upper
__attribute__((unused))) {};
/*
If Item_field is wrapped in Item_direct_wrep remove this Item_direct_ref
wrapper.
*/
virtual Item *remove_item_direct_ref() { return this; }
void register_in(THD *thd);
@ -6016,11 +6010,6 @@ public:
}
Item *field_transformer_for_having_pushdown(THD *thd, uchar *arg) override
{ return (*ref)->field_transformer_for_having_pushdown(thd, arg); }
Item *remove_item_direct_ref() override
{
*ref= (*ref)->remove_item_direct_ref();
return this;
}
};
@ -6068,8 +6057,6 @@ public:
Ref_Type ref_type() override { return DIRECT_REF; }
Item *do_get_copy(THD *thd) const override
{ return get_item_copy<Item_direct_ref>(thd, this); }
Item *remove_item_direct_ref() override
{ return (*ref)->remove_item_direct_ref(); }
/* Should be called if ref is changed */
inline void ref_changed()
@ -6453,7 +6440,6 @@ public:
{ return get_item_copy<Item_direct_view_ref>(thd, this); }
Item *field_transformer_for_having_pushdown(THD *, uchar *) override
{ return this; }
Item *remove_item_direct_ref() override { return this; }
};

View file

@ -7890,10 +7890,11 @@ bool Item_equal::create_pushable_equalities(THD *thd,
while ((item=it++))
{
left_item= item;
if (checker && !((item->*checker) (arg)))
continue;
break;
if (!checker || ((item->*checker)(arg)))
{
left_item= item;
break;
}
}
if (!left_item)

View file

@ -5136,7 +5136,7 @@ public:
*/
bool is_valid() const override
{
return m_rows_buf && m_cols.bitmap;
return m_cols.bitmap;
}
uint m_row_count; /* The number of rows added to the event */

View file

@ -1384,6 +1384,13 @@ void Rows_log_event::count_row_events(PRINT_EVENT_INFO *print_event_info)
switch (general_type_code) {
case WRITE_ROWS_EVENT:
/*
A write rows event containing no after image (can happen for REPLACE
INTO t() VALUES ()), count this correctly as 1 row and no 0.
*/
if (unlikely(m_rows_buf == m_rows_end))
print_event_info->row_events++;
/* Fall through. */
case DELETE_ROWS_EVENT:
row_events= 1;
break;
@ -1510,6 +1517,7 @@ bool Rows_log_event::print_verbose(IO_CACHE *file,
/* If the write rows event contained no values for the AI */
if (((general_type_code == WRITE_ROWS_EVENT) && (m_rows_buf==m_rows_end)))
{
print_event_info->row_events++;
if (my_b_printf(file, "### INSERT INTO %`s.%`s VALUES ()\n",
map->get_db_name(), map->get_table_name()))
goto err;
@ -1543,9 +1551,16 @@ bool Rows_log_event::print_verbose(IO_CACHE *file,
/* Print the second image (for UPDATE only) */
if (sql_clause2)
{
if (!(length= print_verbose_one_row(file, td, print_event_info,
&m_cols_ai, value,
(const uchar*) sql_clause2)))
/* If the update rows event contained no values for the AI */
if (unlikely(bitmap_is_clear_all(&m_cols_ai)))
{
length= (bitmap_bits_set(&m_cols_ai) + 7) / 8;
if (my_b_printf(file, "### SET /* no columns */\n"))
goto err;
}
else if (!(length= print_verbose_one_row(file, td, print_event_info,
&m_cols_ai, value,
(const uchar*) sql_clause2)))
goto err;
value+= length;
}
@ -1853,8 +1868,11 @@ bool Query_log_event::print_query_header(IO_CACHE* file,
end=int10_to_str((long) when, strmov(buff,"SET TIMESTAMP="),10);
if (when_sec_part && when_sec_part <= TIME_MAX_SECOND_PART)
{
*end++= '.';
end=int10_to_str(when_sec_part, end, 10);
char buff2[1 + 6 + 1];
/* Ensure values < 100000 are printed with leading zeros, MDEV-31761. */
snprintf(buff2, sizeof(buff2), ".%06lu", when_sec_part);
DBUG_ASSERT(strlen(buff2) == 1 + 6);
end= strmov(end, buff2);
}
end= strmov(end, print_event_info->delimiter);
*end++='\n';

View file

@ -5598,7 +5598,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
if (unlikely(open_and_lock_tables(thd, rgi->tables_to_lock, FALSE, 0)))
{
#ifdef WITH_WSREP
if (WSREP(thd))
if (WSREP(thd) && !thd->slave_thread)
{
WSREP_WARN("BF applier thread=%lu failed to open_and_lock_tables for "
"%s, fatal: %d "

View file

@ -832,8 +832,12 @@ do_retry:
err= 0;
errmsg= NULL;
#ifdef WITH_WSREP
thd->wsrep_cs().reset_error();
WSREP_DEBUG("retrying async replication event");
DBUG_EXECUTE_IF("sync.wsrep_retry_event_group", {
const char act[]= "now "
"SIGNAL sync.wsrep_retry_event_group_reached "
"WAIT_FOR signal.wsrep_retry_event_group";
debug_sync_set_action(thd, STRING_WITH_LEN(act));
};);
#endif /* WITH_WSREP */
/*
@ -983,15 +987,20 @@ do_retry:
*/
thd->reset_killed();
#ifdef WITH_WSREP
if (wsrep_before_command(thd))
if (WSREP(thd))
{
WSREP_WARN("Parallel slave worker failed at wsrep_before_command() hook");
err= 1;
goto err;
/* Exec after statement hook to make sure that the failed transaction
* gets cleared and reset error state. */
if (wsrep_after_statement(thd))
{
WSREP_WARN("Parallel slave worker failed at wsrep_after_statement() hook");
err= 1;
goto err;
}
thd->wsrep_cs().reset_error();
wsrep_start_trx_if_not_started(thd);
WSREP_DEBUG("parallel slave retry, after trx start");
}
wsrep_start_trx_if_not_started(thd);
WSREP_DEBUG("parallel slave retry, after trx start");
#endif /* WITH_WSREP */
strmake_buf(log_name, ir->name);
if ((fd= open_binlog(&rlog, log_name, &errmsg)) <0)

View file

@ -26,6 +26,7 @@
#endif
#include <my_getopt.h>
#include <my_attribute.h>
class sys_var;
class set_var;
@ -247,11 +248,11 @@ protected:
Typically it's the same as session_value_ptr(), but it's different,
for example, for ENUM, that is printed as a string, but stored as a number.
*/
__attribute__((no_sanitize("undefined")))
ATTRIBUTE_NO_UBSAN
uchar *session_var_ptr(THD *thd) const
{ return ((uchar*)&(thd->variables)) + offset; }
__attribute__((no_sanitize("undefined")))
ATTRIBUTE_NO_UBSAN
uchar *global_var_ptr() const
{ return ((uchar*)&global_system_variables) + offset; }

View file

@ -78,7 +78,7 @@ const char *safe_vio_type_name(Vio *vio)
return vio_type_name(vio_type(vio), &unused);
}
#include "sql_acl_getsort.ic"
#include "sql_acl_getsort.inl"
static LEX_CSTRING native_password_plugin_name= {
STRING_WITH_LEN("mysql_native_password")

View file

@ -1157,7 +1157,8 @@ static bool wsrep_command_no_result(char command)
{
return (command == COM_STMT_FETCH ||
command == COM_STMT_SEND_LONG_DATA ||
command == COM_STMT_CLOSE);
command == COM_STMT_CLOSE ||
command == COM_STMT_PREPARE);
}
#endif /* WITH_WSREP */
#ifndef EMBEDDED_LIBRARY
@ -2397,6 +2398,10 @@ resume:
{
WSREP_DEBUG("THD is killed at dispatch_end");
}
if (thd->lex->sql_command != SQLCOM_SET_OPTION)
{
DEBUG_SYNC(thd, "wsrep_at_dispatch_end_before_result");
}
wsrep_after_command_before_result(thd);
if (wsrep_current_error(thd) && !wsrep_command_no_result(command))
{

View file

@ -17390,9 +17390,7 @@ Item *eliminate_item_equal(THD *thd, COND *cond, COND_EQUAL *upper_levels,
*/
Item *head_item= (!item_const && current_sjm &&
current_sjm_head != field_item) ? current_sjm_head: head;
eq_item= new (thd->mem_root) Item_func_eq(thd,
field_item->remove_item_direct_ref(),
head_item->remove_item_direct_ref());
eq_item= new (thd->mem_root) Item_func_eq(thd, field_item, head_item);
if (!eq_item || eq_item->set_cmp_func(thd))
return 0;

View file

@ -3825,11 +3825,16 @@ enum wsrep::streaming_context::fragment_unit wsrep_fragment_unit(ulong unit)
bool THD::wsrep_parallel_slave_wait_for_prior_commit()
{
if (rgi_slave && rgi_slave->is_parallel_exec && wait_for_prior_commit())
if (rgi_slave && rgi_slave->is_parallel_exec)
{
return 1;
wait_for_pending_deadlock_kill(this, rgi_slave);
if (rgi_slave->killed_for_retry) {
my_error(ER_LOCK_DEADLOCK, MYF(0));
return true;
}
return wait_for_prior_commit();
}
return 0;
return false;
}
/***** callbacks for wsrep service ************/