Skip to content

Commit

Permalink
Merge 10.4 into 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed May 20, 2020
2 parents db6e5bd + b8e694a commit 5ece215
Show file tree
Hide file tree
Showing 37 changed files with 470 additions and 316 deletions.
2 changes: 1 addition & 1 deletion extra/mariabackup/xtrabackup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5535,7 +5535,7 @@ static bool xtrabackup_prepare_func(char** argv)

error_cleanup:
xb_filters_free();
return ok;
return ok && !ib::error::was_logged();
}

/**************************************************************************
Expand Down
4 changes: 3 additions & 1 deletion mysql-test/lib/mtr_report.pm
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ sub mtr_report_stats ($$$$) {
$comment =~ s/[\"]//g;

# if a test case has to be retried it should have the result MTR_RES_FAILED in jUnit XML
if ($test->{'result'} eq "MTR_RES_FAILED" || $test->{'retries'}) {
if ($test->{'result'} eq "MTR_RES_FAILED" || $test->{'retries'} > 0) {
my $logcontents = $test->{'logfile-failed'} || $test->{'logfile'};

$xml_report .= qq(>\n\t\t\t<failure message="" type="MTR_RES_FAILED">\n<![CDATA[$logcontents]]>\n\t\t\t</failure>\n\t\t</testcase>\n);
Expand Down Expand Up @@ -649,6 +649,8 @@ sub mtr_error (@) {
}
else
{
use Carp qw(cluck);
cluck "Error happened" if $verbose > 0;
exit(1);
}
}
Expand Down
25 changes: 25 additions & 0 deletions mysql-test/main/ctype_utf16.result
Original file line number Diff line number Diff line change
Expand Up @@ -2815,6 +2815,31 @@ SET DEFAULT_STORAGE_ENGINE=Default;
# End of 10.2 tests
#
#
# Start of 10.3 tests
#
#
# MDEV-22391 Assertion `0' failed in Item_type_holder::val_str on utf16 charset table query
#
SET NAMES utf8;
CREATE TABLE t1 (a TEXT CHARACTER SET utf16);
SELECT * FROM (VALUES (1) UNION SELECT * FROM t1) AS t;
1
1
DROP TABLE t1;
VALUES (1) UNION SELECT _utf16 0x0020;
1
1

VALUES ('') UNION SELECT _utf16 0x0020 COLLATE utf16_bin;


VALUES ('') UNION VALUES ( _utf16 0x0020 COLLATE utf16_bin);


#
# End of 10.3 tests
#
#
# Start of 10.5 tests
#
#
Expand Down
21 changes: 21 additions & 0 deletions mysql-test/main/ctype_utf16.test
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,27 @@ let $coll_pad='utf16_bin';
--echo # End of 10.2 tests
--echo #

--echo #
--echo # Start of 10.3 tests
--echo #

--echo #
--echo # MDEV-22391 Assertion `0' failed in Item_type_holder::val_str on utf16 charset table query
--echo #

SET NAMES utf8;
CREATE TABLE t1 (a TEXT CHARACTER SET utf16);
SELECT * FROM (VALUES (1) UNION SELECT * FROM t1) AS t;
DROP TABLE t1;
VALUES (1) UNION SELECT _utf16 0x0020;
VALUES ('') UNION SELECT _utf16 0x0020 COLLATE utf16_bin;
VALUES ('') UNION VALUES ( _utf16 0x0020 COLLATE utf16_bin);


--echo #
--echo # End of 10.3 tests
--echo #


--echo #
--echo # Start of 10.5 tests
Expand Down
12 changes: 12 additions & 0 deletions mysql-test/main/ctype_utf8.result
Original file line number Diff line number Diff line change
Expand Up @@ -11324,6 +11324,18 @@ SELECT x AS 5天内最近一次登录时间 FROM t1;
1
DROP TABLE t1;
#
# MDEV-22391 Assertion `0' failed in Item_type_holder::val_str on utf16 charset table query
#
SET NAMES utf8;
VALUES (_latin1 0xDF) UNION SELECT _utf8'a' COLLATE utf8_bin;
_latin1 0xDF
ß
a
VALUES (_latin1 0xDF) UNION VALUES(_utf8'a' COLLATE utf8_bin);
_latin1 0xDF
ß
a
#
# End of 10.3 tests
#
#
Expand Down
7 changes: 7 additions & 0 deletions mysql-test/main/ctype_utf8.test
Original file line number Diff line number Diff line change
Expand Up @@ -2257,6 +2257,13 @@ INSERT INTO t1 VALUES (1);
SELECT x AS 5天内最近一次登录时间 FROM t1;
DROP TABLE t1;

--echo #
--echo # MDEV-22391 Assertion `0' failed in Item_type_holder::val_str on utf16 charset table query
--echo #

SET NAMES utf8;
VALUES (_latin1 0xDF) UNION SELECT _utf8'a' COLLATE utf8_bin;
VALUES (_latin1 0xDF) UNION VALUES(_utf8'a' COLLATE utf8_bin);

--echo #
--echo # End of 10.3 tests
Expand Down
17 changes: 17 additions & 0 deletions mysql-test/main/ps.result
Original file line number Diff line number Diff line change
Expand Up @@ -5472,6 +5472,23 @@ drop procedure p;
drop view v1;
drop table t1;
#
# MDEV-22591 Debug build crashes on EXECUTE IMMEDIATE '... WHERE ?' USING IGNORE
#
CREATE TABLE t1 (a INT);
EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE ?' USING IGNORE;
ERROR HY000: Default/ignore value is not supported for such parameter usage
EXECUTE IMMEDIATE 'SELECT * FROM t1 HAVING ?' USING IGNORE;
ERROR HY000: Default/ignore value is not supported for such parameter usage
EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE ?' USING 0;
a
EXECUTE IMMEDIATE 'SELECT * FROM t1 HAVING ?' USING 0;
a
DROP TABLE t1;
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING DEFAULT;
ERROR HY000: Default/ignore value is not supported for such parameter usage
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0;
Database
#
# End of 10.2 tests
#
#
Expand Down
17 changes: 17 additions & 0 deletions mysql-test/main/ps.test
Original file line number Diff line number Diff line change
Expand Up @@ -4914,6 +4914,23 @@ drop procedure p;
drop view v1;
drop table t1;


--echo #
--echo # MDEV-22591 Debug build crashes on EXECUTE IMMEDIATE '... WHERE ?' USING IGNORE
--echo #

CREATE TABLE t1 (a INT);
--error ER_INVALID_DEFAULT_PARAM
EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE ?' USING IGNORE;
--error ER_INVALID_DEFAULT_PARAM
EXECUTE IMMEDIATE 'SELECT * FROM t1 HAVING ?' USING IGNORE;
EXECUTE IMMEDIATE 'SELECT * FROM t1 WHERE ?' USING 0;
EXECUTE IMMEDIATE 'SELECT * FROM t1 HAVING ?' USING 0;
DROP TABLE t1;
--error ER_INVALID_DEFAULT_PARAM
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING DEFAULT;
EXECUTE IMMEDIATE 'SHOW DATABASES WHERE ?' USING 0;

--echo #
--echo # End of 10.2 tests
--echo #
Expand Down
20 changes: 20 additions & 0 deletions mysql-test/main/sp2.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
CREATE DATABASE test1;
CREATE PROCEDURE test1.sp3() BEGIN END;
SHOW PROCEDURE STATUS;
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
mtr add_suppression PROCEDURE root@localhost # # DEFINER utf8 utf8_general_ci latin1_swedish_ci
mtr check_testcase PROCEDURE root@localhost # # DEFINER utf8 utf8_general_ci latin1_swedish_ci
mtr check_warnings PROCEDURE root@localhost # # DEFINER utf8 utf8_general_ci latin1_swedish_ci
mysql AddGeometryColumn PROCEDURE mariadb.sys@localhost # # INVOKER latin1 latin1_swedish_ci latin1_swedish_ci
mysql DropGeometryColumn PROCEDURE mariadb.sys@localhost # # INVOKER latin1 latin1_swedish_ci latin1_swedish_ci
test sp2 PROCEDURE root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
test1 sp1 PROCEDURE root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
test1 sp3 PROCEDURE root@localhost # # DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
DROP PROCEDURE sp2;
DROP DATABASE test1;
select count(*) from mysql.event;
count(*)
416
flush tables;
show events;
truncate table mysql.event;
37 changes: 37 additions & 0 deletions mysql-test/main/sp2.test

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions mysql-test/mysql-test-run.pl
Original file line number Diff line number Diff line change
Expand Up @@ -785,8 +785,14 @@ ($$$)
if ( $result->is_failed() ) {
my $worker_logdir= $result->{savedir};
my $log_file_name=dirname($worker_logdir)."/".$result->{shortname}.".log";
$result->{'logfile-failed'} = mtr_lastlinesfromfile($log_file_name, 20);
rename $log_file_name,$log_file_name.".failed";

if (-e $log_file_name) {
$result->{'logfile-failed'} = mtr_lastlinesfromfile($log_file_name, 20);
} else {
$result->{'logfile-failed'} = "";
}

rename $log_file_name, $log_file_name.".failed";
}
delete($result->{result});
$result->{retries}= $retries+1;
Expand Down
3 changes: 3 additions & 0 deletions mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
SET @binlog_fragment_0='012345';
BINLOG @binlog_fragment_0, @binlog_fragment_not_exist;
ERROR 42000: Incorrect argument type to variable 'binlog_fragment_not_exist'
SET @a= '42';
BINLOG @a, @a;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use
# Cleanup
DROP TABLE t;
5 changes: 5 additions & 0 deletions mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ SET @binlog_fragment_0='012345';
--error ER_WRONG_TYPE_FOR_VAR
BINLOG @binlog_fragment_0, @binlog_fragment_not_exist;

# MDEV-22520
SET @a= '42';
--error ER_SYNTAX_ERROR
BINLOG @a, @a;

--echo # Cleanup
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
DROP TABLE t;
20 changes: 9 additions & 11 deletions mysql-test/suite/galera/r/galera_toi_truncate.result
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
connection node_2;
connection node_1;
connection node_1;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
connection node_2;
SET SESSION wsrep_retry_autocommit = 0;
INSERT INTO t1(f1) SELECT 1 FROM ten as a1, ten AS a2;
set debug_sync='ha_commit_trans_after_prepare WAIT_FOR go';
INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;;
INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6, ten AS a7, ten AS a8;
connection node_1;
TRUNCATE TABLE t1;;
connection node_1;
connection node_2;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_1;
connection node_2;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SELECT COUNT(*) AS EXPECT_0 FROM t1;
EXPECT_0
0
connection node_1;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
SELECT COUNT(*) AS EXPECT_0 FROM t1;
EXPECT_0
0
DROP TABLE t1;
DROP TABLE ten;
26 changes: 9 additions & 17 deletions mysql-test/suite/galera/t/galera_toi_truncate.test
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,42 @@
#

--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_debug_sync.inc
--source include/not_embedded.inc
--source include/have_debug.inc

#
# INSERT and TRUNCATE on different nodes
#

--connection node_1
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE ten (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);

CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;

# Insert 1m rows
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 10 FROM ten;
--source include/wait_condition.inc

# Prevent autocommit retring from masking the deadlock error we expect to get
SET SESSION wsrep_retry_autocommit = 0;
INSERT INTO t1(f1) SELECT 1 FROM ten as a1, ten AS a2;

set debug_sync='ha_commit_trans_after_prepare WAIT_FOR go';
--send INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;
--send INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6, ten AS a7, ten AS a8

--connection node_1
# Wait for a above insert to start
--let $wait_condition = SELECT COUNT(*) >= 100 from t1;
--source include/wait_condition.inc

--send TRUNCATE TABLE t1;

--connection node_1
--reap

--connection node_2
--error ER_LOCK_DEADLOCK
--reap

--connection node_1
--reap

--connection node_2
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) AS EXPECT_0 FROM t1;

--connection node_1
SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) AS EXPECT_0 FROM t1;

DROP TABLE t1;
DROP TABLE ten;
3 changes: 1 addition & 2 deletions mysql-test/suite/rpl/t/rpl_fail_register.test
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ set global debug_dbug=@old_dbug;

connection master;

### Dump thread is hanging despite slave has gracefully exited.
let $id=`SELECT id from information_schema.processlist where command='Binlog Dump'`;

if ($id) {
replace_result $id DUMP_THREAD;
eval kill $id;
let $wait_condition= SELECT count(*)=0 from information_schema.processlist where command='Binlog Dump';
let $wait_condition= SELECT count(*)=0 from information_schema.processlist where command='Killed';
source include/wait_condition.inc;
}

Expand Down
2 changes: 1 addition & 1 deletion mysql-test/suite/sys_vars/r/sysvars_innodb.result
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of threads performing background key rotation
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_MAX_VALUE 255
NUMERIC_BLOCK_SIZE 0
ENUM_VALUE_LIST NULL
READ_ONLY NO
Expand Down
17 changes: 17 additions & 0 deletions sql/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -7197,6 +7197,23 @@ class Item_type_holder: public Item,

enum Type type() const { return TYPE_HOLDER; }
const TYPELIB *get_typelib() const { return enum_set_typelib; }
/*
When handling a query like this:
VALUES ('') UNION VALUES( _utf16 0x0020 COLLATE utf16_bin);
Item_type_holder can be passed to
Type_handler_xxx::Item_hybrid_func_fix_attributes()
We don't want the latter to perform character set conversion of a
Item_type_holder by calling its val_str(), which calls DBUG_ASSERT(0).
Let's override const_item() and is_expensive() to avoid this.
Note, Item_hybrid_func_fix_attributes() could probably
have a new argument to distinguish what we need:
- (a) aggregate data type attributes only
- (b) install converters after attribute aggregation
So st_select_lex_unit::join_union_type_attributes() could
ask it to do (a) only, without (b).
*/
bool const_item() const { return false; }
bool is_expensive() { return true; }
double val_real();
longlong val_int();
my_decimal *val_decimal(my_decimal *);
Expand Down
3 changes: 2 additions & 1 deletion sql/sql_binlog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ int binlog_defragment(THD *thd)
memcpy(const_cast<char*>(thd->lex->comment.str) + gathered_length, entry[k]->value,
entry[k]->length);
gathered_length += entry[k]->length;
update_hash(entry[k], true, NULL, 0, STRING_RESULT, &my_charset_bin, 0);
}
for (uint k=0; k < 2; k++)
update_hash(entry[k], true, NULL, 0, STRING_RESULT, &my_charset_bin, 0);

DBUG_ASSERT(gathered_length == thd->lex->comment.length);

Expand Down
2 changes: 2 additions & 0 deletions storage/innobase/dict/dict0dict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2161,7 +2161,9 @@ dict_index_remove_from_cache_low(
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
ut_ad(mutex_own(&dict_sys.mutex));
ut_ad(table->id);
#ifdef BTR_CUR_HASH_ADAPT
ut_ad(!index->freed());
#endif /* BTR_CUR_HASH_ADAPT */

/* No need to acquire the dict_index_t::lock here because
there can't be any active operations on this index (or table). */
Expand Down
Loading

0 comments on commit 5ece215

Please sign in to comment.