Merge bb-10.2-ext into 10.3

This commit is contained in:
Marko Mäkelä 2017-12-12 09:35:18 +02:00
commit 34841d2305
147 changed files with 1782 additions and 980 deletions

View File

@ -34,9 +34,9 @@
char *host= NULL, *user= 0, *opt_password= 0,
*default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME;
char truncated_var_names[MAX_MYSQL_VAR][MAX_TRUNC_LENGTH];
char ex_var_names[MAX_MYSQL_VAR][FN_REFLEN];
ulonglong last_values[MAX_MYSQL_VAR];
char truncated_var_names[MAX_MYSQL_VAR+100][MAX_TRUNC_LENGTH];
char ex_var_names[MAX_MYSQL_VAR+100][FN_REFLEN];
ulonglong last_values[MAX_MYSQL_VAR+100];
static int interval=0;
static my_bool option_force=0,interrupted=0,new_line=0,
opt_compress= 0, opt_local= 0, opt_relative= 0, opt_verbose= 0,
@ -885,7 +885,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
return -1;
}
DBUG_ASSERT(mysql_num_rows(res) < MAX_MYSQL_VAR);
DBUG_ASSERT(mysql_num_rows(res) < MAX_MYSQL_VAR+100);
if (!opt_vertical)
print_header(res);

View File

@ -51,7 +51,7 @@ IF(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
ENDIF()
# Set warning flags for G++/Clang++
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
SET(MY_MAINTAINER_CXX_WARNINGS "${MY_CXX_WARNING_FLAGS}")
SET(MY_MAINTAINER_CXX_WARNINGS "${MY_CXX_WARNING_FLAGS} -Wnon-virtual-dtor")
ENDIF()
IF(MYSQL_MAINTAINER_MODE MATCHES "ON")

View File

@ -40,18 +40,18 @@
#define my_atomic_add64_explicit(P, A, O) __atomic_fetch_add((P), (A), (O))
#define my_atomic_cas32_weak_explicit(P, E, D, S, F) \
__atomic_compare_exchange_n((P), (E), (D), true, (S), (F))
__atomic_compare_exchange_n((P), (E), (D), 1, (S), (F))
#define my_atomic_cas64_weak_explicit(P, E, D, S, F) \
__atomic_compare_exchange_n((P), (E), (D), true, (S), (F))
__atomic_compare_exchange_n((P), (E), (D), 1, (S), (F))
#define my_atomic_casptr_weak_explicit(P, E, D, S, F) \
__atomic_compare_exchange_n((P), (E), (D), true, (S), (F))
__atomic_compare_exchange_n((P), (E), (D), 1, (S), (F))
#define my_atomic_cas32_strong_explicit(P, E, D, S, F) \
__atomic_compare_exchange_n((P), (E), (D), false, (S), (F))
__atomic_compare_exchange_n((P), (E), (D), 0, (S), (F))
#define my_atomic_cas64_strong_explicit(P, E, D, S, F) \
__atomic_compare_exchange_n((P), (E), (D), false, (S), (F))
__atomic_compare_exchange_n((P), (E), (D), 0, (S), (F))
#define my_atomic_casptr_strong_explicit(P, E, D, S, F) \
__atomic_compare_exchange_n((P), (E), (D), false, (S), (F))
__atomic_compare_exchange_n((P), (E), (D), 0, (S), (F))
#define my_atomic_store32(P, D) __atomic_store_n((P), (D), __ATOMIC_SEQ_CST)
#define my_atomic_store64(P, D) __atomic_store_n((P), (D), __ATOMIC_SEQ_CST)

View File

@ -137,30 +137,4 @@ static inline void my_atomic_storeptr(void * volatile *a, void *v)
*a= v;
}
/*
my_yield_processor (equivalent of x86 PAUSE instruction) should be used
to improve performance on hyperthreaded CPUs. Intel recommends to use it in
spin loops also on non-HT machines to reduce power consumption (see e.g
http://softwarecommunity.intel.com/articles/eng/2004.htm)
Running benchmarks for spinlocks implemented with InterlockedCompareExchange
and YieldProcessor shows that much better performance is achieved by calling
YieldProcessor in a loop - that is, yielding longer. On Intel boxes setting
loop count in the range 200-300 brought best results.
*/
#define YIELD_LOOPS 200
static inline int my_yield_processor()
{
int i;
for (i=0; i<YIELD_LOOPS; i++)
{
YieldProcessor();
}
return 1;
}
#define LF_BACKOFF my_yield_processor()
#endif /* ATOMIC_MSC_INCLUDED */

View File

@ -17,6 +17,7 @@
#define INCLUDE_LF_INCLUDED
#include <my_atomic.h>
#include <my_cpu.h>
C_MODE_START

View File

@ -116,16 +116,6 @@
#include "atomic/gcc_sync.h"
#endif
/*
the macro below defines (as an expression) the code that
will be run in spin-loops. Intel manuals recummend to have PAUSE there.
It is expected to be defined in include/atomic/ *.h files
*/
#ifndef LF_BACKOFF
#define LF_BACKOFF (1)
#endif
#if SIZEOF_LONG == 4
#define my_atomic_addlong(A,B) my_atomic_add32((int32*) (A), (B))
#define my_atomic_loadlong(A) my_atomic_load32((int32*) (A))

View File

@ -1,3 +1,5 @@
#ifndef MY_CPU_INCLUDED
#define MY_CPU_INCLUDED
/* Copyright (c) 2013, MariaDB foundation Ab and SkySQL
This program is free software; you can redistribute it and/or modify
@ -43,3 +45,58 @@
#define HMT_medium_high()
#define HMT_high()
#endif
static inline void MY_RELAX_CPU(void)
{
#ifdef HAVE_PAUSE_INSTRUCTION
/*
According to the gcc info page, asm volatile means that the
instruction has important side-effects and must not be removed.
Also asm volatile may trigger a memory barrier (spilling all registers
to memory).
*/
#ifdef __SUNPRO_CC
asm ("pause" );
#else
__asm__ __volatile__ ("pause");
#endif
#elif defined(HAVE_FAKE_PAUSE_INSTRUCTION)
__asm__ __volatile__ ("rep; nop");
#elif defined _WIN32
/*
In the Win32 API, the x86 PAUSE instruction is executed by calling
the YieldProcessor macro defined in WinNT.h. It is a CPU architecture-
independent way by using YieldProcessor.
*/
YieldProcessor();
#elif defined(_ARCH_PWR8)
__ppc_get_timebase();
#else
int32 var, oldval = 0;
my_atomic_cas32_strong_explicit(&var, &oldval, 1, MY_MEMORY_ORDER_RELAXED,
MY_MEMORY_ORDER_RELAXED);
#endif
}
/*
LF_BACKOFF should be used to improve performance on hyperthreaded CPUs. Intel
recommends to use it in spin loops also on non-HT machines to reduce power
consumption (see e.g http://softwarecommunity.intel.com/articles/eng/2004.htm)
Running benchmarks for spinlocks implemented with InterlockedCompareExchange
and YieldProcessor shows that much better performance is achieved by calling
YieldProcessor in a loop - that is, yielding longer. On Intel boxes setting
loop count in the range 200-300 brought best results.
*/
static inline int LF_BACKOFF(void)
{
int i;
for (i= 0; i < 200; i++)
MY_RELAX_CPU();
return 1;
}
#endif

View File

@ -0,0 +1,14 @@
--echo #
--echo # MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
--echo #
CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES ('111', '111');
INSERT INTO t1 VALUES ('222', '222');
INSERT INTO t1 VALUES ('333', '333');
INSERT INTO t1 VALUES ('444', '444');
SELECT * FROM t1 WHERE a LIKE '111%';
SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
DROP TABLE t1;

View File

@ -230,7 +230,7 @@ insert into t2 (a) values (1023);
do (f2(23));
Warnings:
Error 1062 Duplicate entry '23' for key 'a'
Note 4093 At line 4 in test.f2
Note 4094 At line 4 in test.f2
select * from t2;
a
1023

View File

@ -160,7 +160,7 @@ Note 1050 Table 'v1' already exists
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
Note 4091 Unknown VIEW: 'test.v1'
Note 4092 Unknown VIEW: 'test.v1'
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
# # Format_desc 1 # VER

View File

@ -55,5 +55,5 @@ id
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
Note 4091 Unknown VIEW: 'test.v1'
Note 4092 Unknown VIEW: 'test.v1'
DROP TABLE t1;

View File

@ -8804,6 +8804,31 @@ DROP TABLE t1;
# End of ctype_pad.inc
#
SET STORAGE_ENGINE=Default;
SET NAMES latin1;
#
# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
#
CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(50) DEFAULT NULL,
`b` varchar(50) DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('111', '111');
INSERT INTO t1 VALUES ('222', '222');
INSERT INTO t1 VALUES ('333', '333');
INSERT INTO t1 VALUES ('444', '444');
SELECT * FROM t1 WHERE a LIKE '111%';
a b
111 111
SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
a b
111 111
DROP TABLE t1;
#
# End of 10.2 tests
#

View File

@ -4430,5 +4430,50 @@ a_ 6100 61FF
a% 61000000000000000000 61FFFFFFFFFFFFFFFFFF
DROP TABLE t1;
#
# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
#
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
a HEX(LIKE_RANGE_MIN(a,200))
111% 313131
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
a HEX(LIKE_RANGE_MIN(a,200))
111% 313131
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
a HEX(LIKE_RANGE_MIN(a,200))
111% 313131
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
a HEX(LIKE_RANGE_MIN(a,200))
111% 313131
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2 COLLATE ucs2_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
a HEX(LIKE_RANGE_MIN(a,200))
111% 003100310031
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16 COLLATE utf16_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
a HEX(LIKE_RANGE_MIN(a,200))
111% 003100310031
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32 COLLATE utf32_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
a HEX(LIKE_RANGE_MIN(a,200))
111% 000000310000003100000031
DROP TABLE t1;
#
# End of 10.2 tests
#

View File

@ -559,6 +559,32 @@ DROP TABLE t1;
# End of ctype_pad.inc
#
SET STORAGE_ENGINE=Default;
SET NAMES utf8, collation_connection=ucs2_unicode_520_nopad_ci;
#
# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
#
CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(50) CHARACTER SET ucs2 COLLATE ucs2_unicode_520_nopad_ci DEFAULT NULL,
`b` varchar(50) CHARACTER SET ucs2 COLLATE ucs2_unicode_520_nopad_ci DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('111', '111');
INSERT INTO t1 VALUES ('222', '222');
INSERT INTO t1 VALUES ('333', '333');
INSERT INTO t1 VALUES ('444', '444');
SELECT * FROM t1 WHERE a LIKE '111%';
a b
111 111
SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
a b
111 111
DROP TABLE t1;
SET NAMES utf8;
#
# End of 10.2 tests
#

View File

@ -7866,6 +7866,32 @@ DROP TABLE t1;
# End of ctype_pad.inc
#
SET STORAGE_ENGINE=Default;
SET NAMES utf8, collation_connection=utf16_unicode_520_nopad_ci;
#
# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
#
CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(50) CHARACTER SET utf16 COLLATE utf16_unicode_520_nopad_ci DEFAULT NULL,
`b` varchar(50) CHARACTER SET utf16 COLLATE utf16_unicode_520_nopad_ci DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('111', '111');
INSERT INTO t1 VALUES ('222', '222');
INSERT INTO t1 VALUES ('333', '333');
INSERT INTO t1 VALUES ('444', '444');
SELECT * FROM t1 WHERE a LIKE '111%';
a b
111 111
SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
a b
111 111
DROP TABLE t1;
SET NAMES utf8;
#
# End of 10.2 tests
#

View File

@ -7886,6 +7886,32 @@ DROP TABLE t1;
# End of ctype_pad.inc
#
SET STORAGE_ENGINE=Default;
SET NAMES utf8, collation_connection=utf32_unicode_520_nopad_ci;
#
# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
#
CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(50) CHARACTER SET utf32 COLLATE utf32_unicode_520_nopad_ci DEFAULT NULL,
`b` varchar(50) CHARACTER SET utf32 COLLATE utf32_unicode_520_nopad_ci DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('111', '111');
INSERT INTO t1 VALUES ('222', '222');
INSERT INTO t1 VALUES ('333', '333');
INSERT INTO t1 VALUES ('444', '444');
SELECT * FROM t1 WHERE a LIKE '111%';
a b
111 111
SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
a b
111 111
DROP TABLE t1;
SET NAMES utf8;
#
# End of 10.2 tests
#

View File

@ -559,6 +559,31 @@ DROP TABLE t1;
# End of ctype_pad.inc
#
SET STORAGE_ENGINE=Default;
SET NAMES utf8 COLLATE utf8_unicode_nopad_ci;
#
# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
#
CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
`b` varchar(50) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('111', '111');
INSERT INTO t1 VALUES ('222', '222');
INSERT INTO t1 VALUES ('333', '333');
INSERT INTO t1 VALUES ('444', '444');
SELECT * FROM t1 WHERE a LIKE '111%';
a b
111 111
SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
a b
111 111
DROP TABLE t1;
#
# End of 10.2 tests
#

View File

@ -6576,6 +6576,32 @@ DROP TABLE t1;
# End of ctype_pad.inc
#
SET STORAGE_ENGINE=Default;
SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci;
#
# MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
#
CREATE OR REPLACE TABLE t1 AS SELECT SPACE(50) AS a, SPACE (50) AS b;
ALTER TABLE t1 ADD KEY(a), ADD KEY(b);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci DEFAULT NULL,
`b` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci DEFAULT NULL,
KEY `a` (`a`),
KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES ('111', '111');
INSERT INTO t1 VALUES ('222', '222');
INSERT INTO t1 VALUES ('333', '333');
INSERT INTO t1 VALUES ('444', '444');
SELECT * FROM t1 WHERE a LIKE '111%';
a b
111 111
SELECT * FROM t1 IGNORE INDEX (a) WHERE a LIKE '111%';
a b
111 111
DROP TABLE t1;
SET NAMES utf8mb4;
#
# End of 10.2 tests
#

View File

@ -15,9 +15,9 @@ select f1(sal) from t1 where id>= 1;
f1(sal)
0
Warnings:
Note 4093 At line 5 in test.f1
Note 4093 At line 5 in test.f1
Note 4093 At line 5 in test.f1
Note 4094 At line 5 in test.f1
Note 4094 At line 5 in test.f1
Note 4094 At line 5 in test.f1
select * from t2;
sal
5000
@ -802,9 +802,9 @@ select f5() from t2;
f5()
192000
Warnings:
Note 4093 At line 6 in test.f5
Note 4093 At line 6 in test.f5
Note 4093 At line 6 in test.f5
Note 4094 At line 6 in test.f5
Note 4094 At line 6 in test.f5
Note 4094 At line 6 in test.f5
create aggregate function f6(x INT) returns INT
begin
declare z int default 0;
@ -820,8 +820,8 @@ select f6(sal) from t2;
f6(sal)
128000
Warnings:
Note 4093 At line 6 in test.f6
Note 4093 At line 6 in test.f6
Note 4094 At line 6 in test.f6
Note 4094 At line 6 in test.f6
select id, f1(sal) from t1 where id>= 1 group by id;
id f1(sal)
1 7000
@ -913,19 +913,19 @@ select f7(sal) from t1;
f7(sal)
64000
Warnings:
Note 4093 At line 9 in test.f7
Note 4093 At line 9 in test.f7
Note 4093 At line 9 in test.f7
Note 4093 At line 9 in test.f7
Note 4093 At line 9 in test.f7
Note 4093 At line 9 in test.f7
Note 4093 At line 9 in test.f7
Note 4093 At line 9 in test.f7
Note 4093 At line 9 in test.f7
Note 4093 At line 9 in test.f7
Note 4093 At line 9 in test.f7
Note 4093 At line 9 in test.f7
Note 4093 At line 9 in test.f7
Note 4094 At line 9 in test.f7
Note 4094 At line 9 in test.f7
Note 4094 At line 9 in test.f7
Note 4094 At line 9 in test.f7
Note 4094 At line 9 in test.f7
Note 4094 At line 9 in test.f7
Note 4094 At line 9 in test.f7
Note 4094 At line 9 in test.f7
Note 4094 At line 9 in test.f7
Note 4094 At line 9 in test.f7
Note 4094 At line 9 in test.f7
Note 4094 At line 9 in test.f7
Note 4094 At line 9 in test.f7
drop table t1;
drop table t2;
drop table t3;

View File

@ -209,10 +209,10 @@ Note 1051 Unknown table 'test.table1'
Note 1051 Unknown table 'test.table2'
DROP VIEW IF EXISTS view1,view2,view3,view4;
Warnings:
Note 4091 Unknown VIEW: 'test.view1'
Note 4091 Unknown VIEW: 'test.view2'
Note 4091 Unknown VIEW: 'test.view3'
Note 4091 Unknown VIEW: 'test.view4'
Note 4092 Unknown VIEW: 'test.view1'
Note 4092 Unknown VIEW: 'test.view2'
Note 4092 Unknown VIEW: 'test.view3'
Note 4092 Unknown VIEW: 'test.view4'
# Test error message when trigger does not find table
CREATE TABLE table1(a int);

View File

@ -590,7 +590,7 @@ DROP PROCEDURE p1;
SHOW WARNINGS;
Level Code Message
Error 54321 MESSAGE_TEXT text
Note 4093 At line 16 in test.p1
Note 4094 At line 16 in test.p1
CREATE PROCEDURE p1()
BEGIN
DECLARE var INT;

View File

@ -1428,7 +1428,7 @@ Warnings:
Note 1305 FUNCTION test.test_function does not exist
drop view if exists v1;
Warnings:
Note 4091 Unknown VIEW: 'test.v1'
Note 4092 Unknown VIEW: 'test.v1'
create table test (col1 varchar(30));
create function test_function() returns varchar(30)
begin

View File

@ -415,7 +415,7 @@ select @@profiling;
drop table if exists t1, t2, t3;
drop view if exists v1;
Warnings:
Note 4091 Unknown VIEW: 'test.v1'
Note 4092 Unknown VIEW: 'test.v1'
drop function if exists f1;
set session profiling = OFF;
set global profiling_history_size= @start_value;

View File

@ -1715,7 +1715,7 @@ show warnings $$
Level Code Message
Warning 1012 Raising a warning
Error 5555 RESIGNAL to not found
Note 4093 At line 9 in test.test_resignal
Note 4094 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1740,7 +1740,7 @@ show warnings $$
Level Code Message
Warning 1012 Raising a warning
Error 5555 RESIGNAL to error
Note 4093 At line 9 in test.test_resignal
Note 4094 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1789,7 +1789,7 @@ show warnings $$
Level Code Message
Error 1012 Raising a not found
Error 5555 RESIGNAL to not found
Note 4093 At line 9 in test.test_resignal
Note 4094 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1814,7 +1814,7 @@ show warnings $$
Level Code Message
Error 1012 Raising a not found
Error 5555 RESIGNAL to error
Note 4093 At line 9 in test.test_resignal
Note 4094 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1863,7 +1863,7 @@ show warnings $$
Level Code Message
Error 1012 Raising an error
Error 5555 RESIGNAL to not found
Note 4093 At line 9 in test.test_resignal
Note 4094 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1888,7 +1888,7 @@ show warnings $$
Level Code Message
Error 1012 Raising an error
Error 5555 RESIGNAL to error
Note 4093 At line 9 in test.test_resignal
Note 4094 At line 9 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1931,7 +1931,7 @@ show warnings $$
Level Code Message
Warning 1264 Out of range value for column 'a' at row 1
Error 5555 RESIGNAL to a not found
Note 4093 At line 8 in test.test_resignal
Note 4094 At line 8 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -1953,7 +1953,7 @@ show warnings $$
Level Code Message
Warning 1264 Out of range value for column 'a' at row 1
Error 5555 RESIGNAL to an error
Note 4093 At line 8 in test.test_resignal
Note 4094 At line 8 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -2004,7 +2004,7 @@ show warnings $$
Level Code Message
Error 1329 No data - zero rows fetched, selected, or processed
Error 5555 RESIGNAL to a not found
Note 4093 At line 10 in test.test_resignal
Note 4094 At line 10 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -2030,7 +2030,7 @@ show warnings $$
Level Code Message
Error 1329 No data - zero rows fetched, selected, or processed
Error 5555 RESIGNAL to an error
Note 4093 At line 10 in test.test_resignal
Note 4094 At line 10 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -2073,7 +2073,7 @@ show warnings $$
Level Code Message
Error 1051 Unknown table 'test.no_such_table'
Error 5555 RESIGNAL to a not found
Note 4093 At line 8 in test.test_resignal
Note 4094 At line 8 in test.test_resignal
drop procedure test_resignal $$
create procedure test_resignal()
begin
@ -2095,7 +2095,7 @@ show warnings $$
Level Code Message
Error 1051 Unknown table 'test.no_such_table'
Error 5555 RESIGNAL to an error
Note 4093 At line 8 in test.test_resignal
Note 4094 At line 8 in test.test_resignal
drop procedure test_resignal $$
#
# More complex cases
@ -2142,7 +2142,7 @@ ERROR 42000: Hi, I am a useless error message
show warnings $$
Level Code Message
Error 9999 Hi, I am a useless error message
Note 4093 At line 7 in test.peter_p2
Note 4094 At line 7 in test.peter_p2
drop procedure peter_p1 $$
drop procedure peter_p2 $$
CREATE PROCEDURE peter_p1 ()
@ -2198,16 +2198,16 @@ Level Code Message
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
Note 4093 At line 8 in test.peter_p1
Note 4094 At line 8 in test.peter_p1
ERROR 42000: Hi, I am a useless error message
show warnings $$
Level Code Message
Error 1231 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 1232 Variable 'sql_mode' can't be set to the value of 'NULL'
Error 9999 Variable 'sql_mode' can't be set to the value of 'NULL'
Note 4093 At line 8 in test.peter_p1
Note 4094 At line 8 in test.peter_p1
Error 9999 Hi, I am a useless error message
Note 4093 At line 10 in test.peter_p2
Note 4094 At line 10 in test.peter_p2
drop procedure peter_p1 $$
drop procedure peter_p2 $$
drop procedure if exists peter_p3 $$
@ -2225,7 +2225,7 @@ show warnings $$
Level Code Message
Error 1 Original
Error 2 Original
Note 4093 At line 4 in test.peter_p3
Note 4094 At line 4 in test.peter_p3
drop procedure peter_p3 $$
drop table t_warn;
drop table t_cursor;

View File

@ -79,23 +79,23 @@ show warnings;
Level Code Message
Error 1051 Unknown table 'demo.oops_it_is_not_here'
Error 1644 Oops in proc_9
Note 4093 At line 4 in demo.proc_9
Note 4094 At line 4 in demo.proc_9
Error 1644 Oops in proc_8
Note 4093 At line 4 in demo.proc_8
Note 4094 At line 4 in demo.proc_8
Error 1644 Oops in proc_7
Note 4093 At line 4 in demo.proc_7
Note 4094 At line 4 in demo.proc_7
Error 1644 Oops in proc_6
Note 4093 At line 4 in demo.proc_6
Note 4094 At line 4 in demo.proc_6
Error 1644 Oops in proc_5
Note 4093 At line 4 in demo.proc_5
Note 4094 At line 4 in demo.proc_5
Error 1644 Oops in proc_4
Note 4093 At line 4 in demo.proc_4
Note 4094 At line 4 in demo.proc_4
Error 1644 Oops in proc_3
Note 4093 At line 4 in demo.proc_3
Note 4094 At line 4 in demo.proc_3
Error 1644 Oops in proc_2
Note 4093 At line 4 in demo.proc_2
Note 4094 At line 4 in demo.proc_2
Error 1644 Oops in proc_1
Note 4093 At line 4 in demo.proc_1
Note 4094 At line 4 in demo.proc_1
SET @@session.max_error_count = 5;
SELECT @@session.max_error_count;
@@session.max_error_count
@ -104,11 +104,11 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
Note 4093 At line 4 in demo.proc_3
Note 4094 At line 4 in demo.proc_3
Error 1644 Oops in proc_2
Note 4093 At line 4 in demo.proc_2
Note 4094 At line 4 in demo.proc_2
Error 1644 Oops in proc_1
Note 4093 At line 4 in demo.proc_1
Note 4094 At line 4 in demo.proc_1
SET @@session.max_error_count = 7;
SELECT @@session.max_error_count;
@@session.max_error_count
@ -117,13 +117,13 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
Note 4093 At line 4 in demo.proc_4
Note 4094 At line 4 in demo.proc_4
Error 1644 Oops in proc_3
Note 4093 At line 4 in demo.proc_3
Note 4094 At line 4 in demo.proc_3
Error 1644 Oops in proc_2
Note 4093 At line 4 in demo.proc_2
Note 4094 At line 4 in demo.proc_2
Error 1644 Oops in proc_1
Note 4093 At line 4 in demo.proc_1
Note 4094 At line 4 in demo.proc_1
SET @@session.max_error_count = 9;
SELECT @@session.max_error_count;
@@session.max_error_count
@ -132,15 +132,15 @@ call proc_1();
ERROR 45000: Oops in proc_1
show warnings;
Level Code Message
Note 4093 At line 4 in demo.proc_5
Note 4094 At line 4 in demo.proc_5
Error 1644 Oops in proc_4
Note 4093 At line 4 in demo.proc_4
Note 4094 At line 4 in demo.proc_4
Error 1644 Oops in proc_3
Note 4093 At line 4 in demo.proc_3
Note 4094 At line 4 in demo.proc_3
Error 1644 Oops in proc_2
Note 4093 At line 4 in demo.proc_2
Note 4094 At line 4 in demo.proc_2
Error 1644 Oops in proc_1
Note 4093 At line 4 in demo.proc_1
Note 4094 At line 4 in demo.proc_1
drop database demo;
SET @@global.max_error_count = @start_global_value;
SELECT @@global.max_error_count;

View File

@ -1990,8 +1990,8 @@ Warning 1264 Out of range value for column 'a' at row 1
Note 1292 Truncated incorrect INTEGER value: '222222 '
Warning 1264 Out of range value for column 'b' at row 1
Error 1048 Column 'c' cannot be null
Note 4093 At line 6 in test.t1_bi
Note 4093 At line 2 in test.p1
Note 4094 At line 6 in test.t1_bi
Note 4094 At line 2 in test.p1
DROP TABLE t1;
DROP TABLE t2;

View File

@ -3,7 +3,7 @@ Warnings:
Note 1051 Unknown table 'test.t1'
drop view if exists view_t1;
Warnings:
Note 4091 Unknown VIEW: 'test.view_t1'
Note 4092 Unknown VIEW: 'test.view_t1'
SET sql_mode=ONLY_FULL_GROUP_BY;
CREATE TABLE t1 (
pk INT,

View File

@ -210,7 +210,7 @@ SELECT a=1;
END;
$$
CALL p1();
ERROR 21000: Operand should contain 2 column(s)
ERROR HY000: Illegal parameter data types row and int for operation '='
DROP PROCEDURE p1;
CREATE PROCEDURE p1()
BEGIN
@ -219,7 +219,7 @@ SELECT 1=a;
END;
$$
CALL p1();
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types int and row for operation '='
DROP PROCEDURE p1;
#
# Passing the entire ROW to a stored function

View File

@ -3211,7 +3211,7 @@ drop procedure bug10961|
DROP PROCEDURE IF EXISTS bug6866|
DROP VIEW IF EXISTS tv|
Warnings:
Note 4091 Unknown VIEW: 'test.tv'
Note 4092 Unknown VIEW: 'test.tv'
DROP TABLE IF EXISTS tt1,tt2,tt3|
Warnings:
Note 1051 Unknown table 'test.tt1'
@ -7823,7 +7823,7 @@ ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
show warnings;
Level Code Message
Error 1062 Duplicate entry '2' for key 'PRIMARY'
Note 4093 At line 5 in test.p1
Note 4094 At line 5 in test.p1
select * from t1;
id
1
@ -8291,6 +8291,63 @@ rec=(10)
c
rec=(20)
DROP PROCEDURE p1;
#
# MDEV-14228 MariaDB crashes with function
#
CREATE TABLE t1 (c VARCHAR(16), KEY(c));
INSERT INTO t1 VALUES ('foo');
CREATE FUNCTION f1() RETURNS VARCHAR(16)
BEGIN
DECLARE v VARCHAR(16);
FOR v IN (SELECT DISTINCT c FROM t1)
DO
IF (v = 'bar') THEN
SELECT 1 INTO @a;
END IF;
END FOR;
RETURN 'qux';
END $$
SELECT f1();
ERROR HY000: Illegal parameter data types row and varchar for operation '='
DROP FUNCTION f1;
CREATE FUNCTION f1() RETURNS VARCHAR(16)
BEGIN
DECLARE v ROW TYPE OF t1;
IF v = 'bar' THEN
RETURN 'eq';
END IF;
RETURN 'ne';
END $$
SELECT f1();
ERROR HY000: Illegal parameter data types row and varchar for operation '='
DROP FUNCTION f1;
CREATE FUNCTION f1() RETURNS VARCHAR(16)
BEGIN
DECLARE v ROW(a INT);
IF v = 'bar' THEN
RETURN 'eq';
END IF;
RETURN 'ne';
END $$
SELECT f1();
ERROR HY000: Illegal parameter data types row and varchar for operation '='
DROP FUNCTION f1;
DROP TABLE t1;
BEGIN NOT ATOMIC
DECLARE v ROW(a INT);
SELECT v IN ('a','b');
END $$
ERROR HY000: Illegal parameter data types row and varchar for operation 'in'
BEGIN NOT ATOMIC
DECLARE v ROW(a INT);
SELECT 'a' IN (v,'b');
END $$
ERROR HY000: Illegal parameter data types varchar and row for operation 'in'
BEGIN NOT ATOMIC
DECLARE v ROW(a INT);
SELECT 'a' IN ('b',v);
END $$
ERROR HY000: Illegal parameter data types varchar and row for operation 'in'
# Test affected rows from an sp
create table t1 (a int);
create procedure p1()

View File

@ -384,10 +384,10 @@ Warnings:
Note 1003 /* select#1 */ select 'joce' AS `pseudo`,(/* select#2 */ select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types varchar and row for operation '='
SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE
pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types varchar and row for operation '='
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
pseudo
joce
@ -2865,13 +2865,13 @@ drop table t1, t2;
create table t1 (a int, b int);
insert into t1 values (1,2);
select 1 = (select * from t1);
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types int and row for operation '='
select (select * from t1) = 1;
ERROR 21000: Operand should contain 2 column(s)
ERROR HY000: Illegal parameter data types row and int for operation '='
select (1,2) = (select a from t1);
ERROR 21000: Operand should contain 2 column(s)
ERROR HY000: Illegal parameter data types row and int for operation '='
select (select a from t1) = (1,2);
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types int and row for operation '='
select (1,2,3) = (select * from t1);
ERROR 21000: Operand should contain 3 column(s)
select (select * from t1) = (1,2,3);

View File

@ -388,10 +388,10 @@ Warnings:
Note 1003 /* select#1 */ select 'joce' AS `pseudo`,(/* select#2 */ select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types varchar and row for operation '='
SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE
pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types varchar and row for operation '='
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
pseudo
joce
@ -2868,13 +2868,13 @@ drop table t1, t2;
create table t1 (a int, b int);
insert into t1 values (1,2);
select 1 = (select * from t1);
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types int and row for operation '='
select (select * from t1) = 1;
ERROR 21000: Operand should contain 2 column(s)
ERROR HY000: Illegal parameter data types row and int for operation '='
select (1,2) = (select a from t1);
ERROR 21000: Operand should contain 2 column(s)
ERROR HY000: Illegal parameter data types row and int for operation '='
select (select a from t1) = (1,2);
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types int and row for operation '='
select (1,2,3) = (select * from t1);
ERROR 21000: Operand should contain 3 column(s)
select (select * from t1) = (1,2,3);

View File

@ -391,10 +391,10 @@ Warnings:
Note 1003 /* select#1 */ select 'joce' AS `pseudo`,(/* select#2 */ select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types varchar and row for operation '='
SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE
pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types varchar and row for operation '='
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
pseudo
joce
@ -2871,13 +2871,13 @@ drop table t1, t2;
create table t1 (a int, b int);
insert into t1 values (1,2);
select 1 = (select * from t1);
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types int and row for operation '='
select (select * from t1) = 1;
ERROR 21000: Operand should contain 2 column(s)
ERROR HY000: Illegal parameter data types row and int for operation '='
select (1,2) = (select a from t1);
ERROR 21000: Operand should contain 2 column(s)
ERROR HY000: Illegal parameter data types row and int for operation '='
select (select a from t1) = (1,2);
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types int and row for operation '='
select (1,2,3) = (select * from t1);
ERROR 21000: Operand should contain 3 column(s)
select (select * from t1) = (1,2,3);

View File

@ -387,10 +387,10 @@ Warnings:
Note 1003 /* select#1 */ select 'joce' AS `pseudo`,(/* select#2 */ select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types varchar and row for operation '='
SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE
pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types varchar and row for operation '='
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
pseudo
joce
@ -2867,13 +2867,13 @@ drop table t1, t2;
create table t1 (a int, b int);
insert into t1 values (1,2);
select 1 = (select * from t1);
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types int and row for operation '='
select (select * from t1) = 1;
ERROR 21000: Operand should contain 2 column(s)
ERROR HY000: Illegal parameter data types row and int for operation '='
select (1,2) = (select a from t1);
ERROR 21000: Operand should contain 2 column(s)
ERROR HY000: Illegal parameter data types row and int for operation '='
select (select a from t1) = (1,2);
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types int and row for operation '='
select (1,2,3) = (select * from t1);
ERROR 21000: Operand should contain 3 column(s)
select (select * from t1) = (1,2,3);

View File

@ -390,10 +390,10 @@ Warnings:
Note 1003 /* select#1 */ select 'joce' AS `pseudo`,(/* select#2 */ select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types varchar and row for operation '='
SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE
pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types varchar and row for operation '='
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
pseudo
joce
@ -2871,13 +2871,13 @@ drop table t1, t2;
create table t1 (a int, b int);
insert into t1 values (1,2);
select 1 = (select * from t1);
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types int and row for operation '='
select (select * from t1) = 1;
ERROR 21000: Operand should contain 2 column(s)
ERROR HY000: Illegal parameter data types row and int for operation '='
select (1,2) = (select a from t1);
ERROR 21000: Operand should contain 2 column(s)
ERROR HY000: Illegal parameter data types row and int for operation '='
select (select a from t1) = (1,2);
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types int and row for operation '='
select (1,2,3) = (select * from t1);
ERROR 21000: Operand should contain 3 column(s)
select (select * from t1) = (1,2,3);

View File

@ -387,10 +387,10 @@ Warnings:
Note 1003 /* select#1 */ select 'joce' AS `pseudo`,(/* select#2 */ select 'test' from `test`.`t8` where 1) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where 1
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types varchar and row for operation '='
SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE
pseudo='joce');
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types varchar and row for operation '='
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
pseudo
joce
@ -2867,13 +2867,13 @@ drop table t1, t2;
create table t1 (a int, b int);
insert into t1 values (1,2);
select 1 = (select * from t1);
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types int and row for operation '='
select (select * from t1) = 1;
ERROR 21000: Operand should contain 2 column(s)
ERROR HY000: Illegal parameter data types row and int for operation '='
select (1,2) = (select a from t1);
ERROR 21000: Operand should contain 2 column(s)
ERROR HY000: Illegal parameter data types row and int for operation '='
select (select a from t1) = (1,2);
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types int and row for operation '='
select (1,2,3) = (select * from t1);
ERROR 21000: Operand should contain 3 column(s)
select (select * from t1) = (1,2,3);

View File

@ -5166,7 +5166,7 @@ CREATE TABLE t4 (i4 INT);
INSERT INTO t4 VALUES (1),(2);
DROP VIEW IF EXISTS v1;
Warnings:
Note 4091 Unknown VIEW: 'test.v1'
Note 4092 Unknown VIEW: 'test.v1'
CREATE VIEW v1 AS select coalesce(j1,i3) AS v1_field1 from t2 join t3 left join t1 on ( i1 = i2 );
CREATE VIEW v2 AS select v1_field1 from t4 join v1;
prepare my_stmt from "select v1_field1 from v2";

View File

@ -353,7 +353,7 @@ ERROR 23000: Duplicate entry '11' for key 'a'
SHOW WARNINGS;
Level Code Message
Note 4093 At line 4 in test.f1
Note 4094 At line 4 in test.f1
Error 1062 Duplicate entry '11' for key 'a'
DROP TABLE t1;

View File

@ -232,7 +232,7 @@ SELECT a=1;
END;
$$
CALL p1();
ERROR 21000: Operand should contain 2 column(s)
ERROR HY000: Illegal parameter data types row and int for operation '='
DROP PROCEDURE p1;
CREATE PROCEDURE p1()
AS
@ -242,7 +242,7 @@ SELECT 1=a;
END;
$$
CALL p1();
ERROR 21000: Operand should contain 1 column(s)
ERROR HY000: Illegal parameter data types int and row for operation '='
DROP PROCEDURE p1;
#
# Passing the entire ROW to a stored function

View File

@ -2432,3 +2432,66 @@ a b
DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
#
# MDEV-14228 MariaDB crashes with function
#
CREATE TABLE t1 (c VARCHAR(16), KEY(c));
INSERT INTO t1 VALUES ('foo');
CREATE FUNCTION f1() RETURN VARCHAR(16)
IS
v VARCHAR2(16);
BEGIN
FOR v IN (SELECT DISTINCT c FROM t1)
LOOP
IF (v = 'bar') THEN
SELECT 1 INTO @a;
END IF;
END LOOP;
RETURN 'qux';
END $$
SELECT f1();
ERROR HY000: Illegal parameter data types row and varchar for operation '='
DROP FUNCTION f1;
CREATE FUNCTION f1() RETURN VARCHAR(16)
IS
v t1%ROWTYPE;
BEGIN
IF v = 'bar' THEN
NULL;
END IF;
RETURN 'qux';
END $$
SELECT f1();
ERROR HY000: Illegal parameter data types row and varchar for operation '='
DROP FUNCTION f1;
CREATE FUNCTION f1() RETURN VARCHAR(16)
IS
v ROW(a INT);
BEGIN
IF v = 'bar' THEN
NULL;
END IF;
RETURN 'qux';
END $$
SELECT f1();
ERROR HY000: Illegal parameter data types row and varchar for operation '='
DROP FUNCTION f1;
DROP TABLE t1;
DECLARE
v ROW(a INT);
BEGIN
SELECT v IN ('a','b');
END $$
ERROR HY000: Illegal parameter data types row and varchar for operation 'in'
DECLARE
v ROW(a INT);
BEGIN
SELECT 'a' IN (v,'b');
END $$
ERROR HY000: Illegal parameter data types varchar and row for operation 'in'
DECLARE
v ROW(a INT);
BEGIN
SELECT 'a' IN ('b',v);
END $$
ERROR HY000: Illegal parameter data types varchar and row for operation 'in'

View File

@ -295,7 +295,7 @@ BEGIN
END;
$$
DELIMITER ;$$
--error ER_OPERAND_COLUMNS
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL p1();
DROP PROCEDURE p1;
@ -309,7 +309,7 @@ BEGIN
END;
$$
DELIMITER ;$$
--error ER_OPERAND_COLUMNS
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL p1();
DROP PROCEDURE p1;

View File

@ -2260,3 +2260,90 @@ CALL p1();
DROP PROCEDURE p1;
DROP VIEW v1;
DROP TABLE t1;
--echo #
--echo # MDEV-14228 MariaDB crashes with function
--echo #
CREATE TABLE t1 (c VARCHAR(16), KEY(c));
INSERT INTO t1 VALUES ('foo');
DELIMITER $$;
CREATE FUNCTION f1() RETURN VARCHAR(16)
IS
v VARCHAR2(16);
BEGIN
FOR v IN (SELECT DISTINCT c FROM t1)
LOOP
IF (v = 'bar') THEN
SELECT 1 INTO @a;
END IF;
END LOOP;
RETURN 'qux';
END $$
DELIMITER ;$$
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT f1();
DROP FUNCTION f1;
DELIMITER $$;
CREATE FUNCTION f1() RETURN VARCHAR(16)
IS
v t1%ROWTYPE;
BEGIN
IF v = 'bar' THEN
NULL;
END IF;
RETURN 'qux';
END $$
DELIMITER ;$$
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT f1();
DROP FUNCTION f1;
DELIMITER $$;
CREATE FUNCTION f1() RETURN VARCHAR(16)
IS
v ROW(a INT);
BEGIN
IF v = 'bar' THEN
NULL;
END IF;
RETURN 'qux';
END $$
DELIMITER ;$$
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT f1();
DROP FUNCTION f1;
DROP TABLE t1;
DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
DECLARE
v ROW(a INT);
BEGIN
SELECT v IN ('a','b');
END $$
DELIMITER ;$$
DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
DECLARE
v ROW(a INT);
BEGIN
SELECT 'a' IN (v,'b');
END $$
DELIMITER ;$$
DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
DECLARE
v ROW(a INT);
BEGIN
SELECT 'a' IN ('b',v);
END $$
DELIMITER ;$$

View File

@ -4314,7 +4314,7 @@ CREATE VIEW v2 AS Select * from test.v1;
ERROR 42S02: Table 'test.v1' doesn't exist
DROP VIEW IF EXISTS v2;
Warnings:
Note 4091 Unknown VIEW: 'test.v2'
Note 4092 Unknown VIEW: 'test.v2'
Testcase 3.3.1.25
--------------------------------------------------------------------------------
@ -7566,7 +7566,7 @@ Call sp1() ;
ERROR 42000: PROCEDURE test.sp1 does not exist
Drop view if exists test.v1 ;
Warnings:
Note 4091 Unknown VIEW: 'test.v1'
Note 4092 Unknown VIEW: 'test.v1'
Drop procedure sp1 ;
ERROR 42000: PROCEDURE test.sp1 does not exist
@ -21312,7 +21312,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
Note 4091 Unknown VIEW: 'test.v1'
Note 4092 Unknown VIEW: 'test.v1'
Testcase 3.3.1.68
--------------------------------------------------------------------------------

View File

@ -4315,7 +4315,7 @@ CREATE VIEW v2 AS Select * from test.v1;
ERROR 42S02: Table 'test.v1' doesn't exist
DROP VIEW IF EXISTS v2;
Warnings:
Note 4091 Unknown VIEW: 'test.v2'
Note 4092 Unknown VIEW: 'test.v2'
Testcase 3.3.1.25
--------------------------------------------------------------------------------
@ -7567,7 +7567,7 @@ Call sp1() ;
ERROR 42000: PROCEDURE test.sp1 does not exist
Drop view if exists test.v1 ;
Warnings:
Note 4091 Unknown VIEW: 'test.v1'
Note 4092 Unknown VIEW: 'test.v1'
Drop procedure sp1 ;
ERROR 42000: PROCEDURE test.sp1 does not exist
@ -21314,7 +21314,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
Note 4091 Unknown VIEW: 'test.v1'
Note 4092 Unknown VIEW: 'test.v1'
Testcase 3.3.1.68
--------------------------------------------------------------------------------

View File

@ -4784,7 +4784,7 @@ CREATE VIEW v2 AS Select * from test.v1;
ERROR 42S02: Table 'test.v1' doesn't exist
DROP VIEW IF EXISTS v2;
Warnings:
Note 4091 Unknown VIEW: 'test.v2'
Note 4092 Unknown VIEW: 'test.v2'
Testcase 3.3.1.25
--------------------------------------------------------------------------------
@ -8387,7 +8387,7 @@ Call sp1() ;
ERROR 42000: PROCEDURE test.sp1 does not exist
Drop view if exists test.v1 ;
Warnings:
Note 4091 Unknown VIEW: 'test.v1'
Note 4092 Unknown VIEW: 'test.v1'
Drop procedure sp1 ;
ERROR 42000: PROCEDURE test.sp1 does not exist
@ -22989,7 +22989,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
Note 4091 Unknown VIEW: 'test.v1'
Note 4092 Unknown VIEW: 'test.v1'
Testcase 3.3.1.68
--------------------------------------------------------------------------------

View File

@ -57,6 +57,8 @@ galera_as_slave : MDEV-13549 Galera test failures 10.1
galera_var_innodb_disallow_writes : MDEV-10949
galera_kill_applier : race condition at the start of the test
GAL-480 : "Lost connection to MySQL"
MW-328A : "Found wrong usage of mutex"
MW-328B : "Found wrong usage of mutex"
MW-328C : "Found wrong usage of mutex"
MW-328C: MDEV-13549 Galera test failures 10.1
MW-328A: MDEV-13549 Galera test failures 10.1
MW-328B: MDEV-13549 Galera test failures 10.1
MW-328: MDEV-13549 Galera test failures 10.1
galera_suspend_slave: MDEV-13549 Galera test failures 10.1

View File

@ -1,3 +1,4 @@
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(255)) Engine=InnoDB;
CREATE PROCEDURE insert_proc ()
BEGIN
@ -9,37 +10,40 @@ INSERT INTO t1 VALUES (1, 'node 1'),(2, 'node 1');
INSERT INTO t1 VALUES (3, 'node 1');
END|
SET GLOBAL wsrep_slave_threads = 2;
SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb";
Warnings:
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
connection node_2;
INSERT INTO t1 VALUES (1, 'node 2');;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1a;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
connection node_1;
SET SESSION wsrep_sync_wait = 0;
SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication_reached WAIT_FOR wsrep_after_replication_continue';
CALL insert_proc ();;
connection node_1a;
SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached";
SET GLOBAL DEBUG = "";
Warnings:
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET GLOBAL DEBUG_DBUG = "";
SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
connection node_2;
connection node_1;
SELECT @errno = 1213;
@errno = 1213
1
0
SELECT * FROM t1;
f1 f2
1 node 2
3 node 1
connection node_2;
SELECT * FROM t1;
f1 f2
1 node 2
3 node 1
connection node_1;
SET GLOBAL wsrep_slave_threads = DEFAULT;
DROP TABLE t1;
DROP PROCEDURE insert_proc;
SET GLOBAL debug = NULL;
Warnings:
Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead
SET GLOBAL debug_dbug = NULL;
SET debug_sync='RESET';
SELECT @@debug_sync;
@@debug_sync

View File

@ -0,0 +1,23 @@
CREATE TABLE t1 ENGINE=InnoDB select 1 as a, 1 as b union select 2, 2;
ALTER TABLE t1 add primary key(a);
CREATE PROCEDURE p1()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION rollback;
WHILE 1 DO
start transaction;
update t1 set b=connection_id() where a=1;
commit;
END WHILE;
END|
connect node_1_p1, 127.0.0.1, root, , test, $NODE_MYPORT_1;
call p1;
connect node_1_p2, 127.0.0.1, root, , test, $NODE_MYPORT_1;
call p1;
connect node_2_p1, 127.0.0.1, root, , test, $NODE_MYPORT_2;
call p1;
connect node_2_p2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
call p1;
connection default;
checking error log for 'BF lock wait long' message for 10 times every 10 seconds ...
drop table t1;
drop procedure p1;

View File

@ -30,7 +30,7 @@ DELIMITER ;|
# commit cut is not processed and therefore does not advance
# local monitor, and our INSERT remains stuck there.
SET GLOBAL wsrep_slave_threads = 2;
SET GLOBAL DEBUG = "d,sync.wsrep_apply_cb";
SET GLOBAL DEBUG_DBUG = "d,sync.wsrep_apply_cb";
--connection node_2
--send INSERT INTO t1 VALUES (1, 'node 2');
@ -48,7 +48,7 @@ SET SESSION DEBUG_SYNC = 'wsrep_after_replication SIGNAL wsrep_after_replication
SET SESSION DEBUG_SYNC = "now WAIT_FOR wsrep_after_replication_reached";
SET GLOBAL DEBUG = "";
SET GLOBAL DEBUG_DBUG = "";
SET DEBUG_SYNC = "now SIGNAL wsrep_after_replication_continue";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
@ -69,7 +69,7 @@ SET GLOBAL wsrep_slave_threads = DEFAULT;
DROP TABLE t1;
DROP PROCEDURE insert_proc;
SET GLOBAL debug = NULL;
SET GLOBAL debug_dbug = NULL;
SET debug_sync='RESET';
# Make sure no pending signals are leftover to surprise subsequent tests.

View File

@ -0,0 +1,52 @@
--source include/galera_cluster.inc
--source include/big_test.inc
CREATE TABLE t1 ENGINE=InnoDB select 1 as a, 1 as b union select 2, 2;
ALTER TABLE t1 add primary key(a);
DELIMITER |;
CREATE PROCEDURE p1()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION rollback;
WHILE 1 DO
start transaction;
update t1 set b=connection_id() where a=1;
commit;
END WHILE;
END|
DELIMITER ;|
--connect node_1_p1, 127.0.0.1, root, , test, $NODE_MYPORT_1
send call p1;
--connect node_1_p2, 127.0.0.1, root, , test, $NODE_MYPORT_1
send call p1;
--connect node_2_p1, 127.0.0.1, root, , test, $NODE_MYPORT_2
send call p1;
--connect node_2_p2, 127.0.0.1, root, , test, $NODE_MYPORT_2
send call p1;
connection default;
let $counter=10;
let $sleep_period=10;
echo checking error log for 'BF lock wait long' message for $counter times every $sleep_period seconds ...;
while($counter > 0)
{
--disable_query_log
--disable_result_log
eval do sleep($sleep_period);
--enable_query_log
--enable_result_log
# use error 0,1 instead if want test to continue
--error 1
exec grep 'BF lock wait long' $MYSQLTEST_VARDIR/log/mysqld.*.err;
dec $counter;
}
drop table t1;
drop procedure p1;

View File

@ -2,14 +2,7 @@ call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the
SELECT @@innodb_page_size;
@@innodb_page_size
32768
SET GLOBAL innodb_file_per_table=ON;
SET @@innodb_strict_mode=ON;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
SELECT @@innodb_strict_mode;
@@innodb_strict_mode
1
SET innodb_strict_mode=ON;
CREATE TABLE tab5(col1 CHAR (255), col2 CHAR (255), col3 CHAR(255),col4 CHAR(255), col5 CHAR(255),
col6 CHAR(255), col7 CHAR(255), col8 CHAR(255), col9 CHAR(255),col10 CHAR(255), col11 CHAR(255),
col12 CHAR(255), col13 CHAR(255),col14 CHAR(255),col15 CHAR(255),col16 CHAR(255), col17 CHAR(255),
@ -333,11 +326,9 @@ FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
test.t analyze status OK
SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
stat_value
6
SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
clustered_index_size
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
clust_index_size
7
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
@ -355,11 +346,9 @@ FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
test.t analyze status OK
SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
stat_value
4
SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
clustered_index_size
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
clust_index_size
5
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=COMPACT;
@ -377,11 +366,8 @@ FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
test.t analyze status OK
SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
stat_value
4
SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
clustered_index_size
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
clust_index_size
5
DROP TABLE t;
# Success

View File

@ -2,14 +2,7 @@ call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the
SELECT @@innodb_page_size;
@@innodb_page_size
65536
SET GLOBAL innodb_file_per_table=ON;
SET @@innodb_strict_mode=ON;
SELECT @@innodb_file_per_table;
@@innodb_file_per_table
1
SELECT @@innodb_strict_mode;
@@innodb_strict_mode
1
SET innodb_strict_mode=ON;
CREATE TABLE tab5(col1 CHAR (255), col2 CHAR (255), col3 CHAR(255),col4 CHAR(255), col5 CHAR(255),
col6 CHAR(255), col7 CHAR(255), col8 CHAR(255), col9 CHAR(255),col10 CHAR(255), col11 CHAR(255),
col12 CHAR(255), col13 CHAR(255),col14 CHAR(255),col15 CHAR(255),col16 CHAR(255), col17 CHAR(255),
@ -536,11 +529,9 @@ FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
test.t analyze status OK
SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
stat_value
4
SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
clustered_index_size
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
clust_index_size
5
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
@ -558,11 +549,9 @@ FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
test.t analyze status OK
SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
stat_value
3
SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
clustered_index_size
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
clust_index_size
4
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=COMPACT;
@ -580,11 +569,8 @@ FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
test.t analyze status OK
SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
stat_value
3
SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
clustered_index_size
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
clust_index_size
4
DROP TABLE t;
# Success

View File

@ -0,0 +1,57 @@
connect stop_purge, localhost, root,,;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connect delete, localhost, root,,;
connection default;
CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1,1);
DELETE FROM t1;
SET DEBUG_SYNC='row_ins_sec_index_unique SIGNAL inserted WAIT_FOR locked';
BEGIN;
INSERT INTO t1 VALUES(1,1);
connection delete;
SET DEBUG_SYNC='now WAIT_FOR inserted';
SET DEBUG_SYNC='innodb_row_search_for_mysql_exit SIGNAL locked';
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
DELETE FROM t1 WHERE b=1;
connection default;
connection delete;
COMMIT;
connection default;
SET DEBUG_SYNC='RESET';
ROLLBACK;
SET DEBUG_SYNC='row_ins_sec_index_unique SIGNAL inserted WAIT_FOR locked';
BEGIN;
INSERT INTO t1 VALUES(1,1);
connection delete;
SET DEBUG_SYNC='now WAIT_FOR inserted';
SET DEBUG_SYNC='innodb_row_search_for_mysql_exit SIGNAL locked';
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
BEGIN;
DELETE FROM t1 WHERE b=1;
connection default;
connection delete;
COMMIT;
connection default;
SET DEBUG_SYNC='RESET';
ROLLBACK;
SET DEBUG_SYNC='row_ins_sec_index_unique SIGNAL inserted WAIT_FOR locked';
BEGIN;
SET innodb_lock_wait_timeout=1;
INSERT INTO t1 VALUES(1,1);
connection delete;
SET DEBUG_SYNC='now WAIT_FOR inserted';
SET DEBUG_SYNC='innodb_row_search_for_mysql_exit SIGNAL locked';
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
DELETE FROM t1 WHERE b=1;
connection default;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
COMMIT;
SET DEBUG_SYNC='RESET';
connection delete;
COMMIT;
disconnect delete;
disconnect stop_purge;
connection default;
DROP TABLE t1;

View File

@ -1,3 +1,4 @@
--innodb-page-size=32K
--innodb_buffer_pool_size=32M
--innodb-stats-persistent=ON
--skip-innodb-stats-persistent
--innodb-sys-tablestats

View File

@ -6,16 +6,7 @@ call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the
# Check page size 32k
SELECT @@innodb_page_size;
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
let $innodb_strict_mode = `SELECT @@innodb_strict_mode`;
--disable_warnings
SET GLOBAL innodb_file_per_table=ON;
SET @@innodb_strict_mode=ON;
--enable_warnings
SELECT @@innodb_file_per_table;
SELECT @@innodb_strict_mode;
SET innodb_strict_mode=ON;
# Check the error when the max record length > 16K for innodb_page_size=32k
--error ER_TOO_BIG_ROWSIZE
@ -356,9 +347,8 @@ INSERT INTO t VALUES (REPEAT('a',65535));
SELECT LENGTH(col) FROM t;
FLUSH TABLE t;
ANALYZE TABLE t;
# retrieve the number of leaf pages
SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
@ -369,9 +359,8 @@ INSERT INTO t VALUES (REPEAT('a',65535));
SELECT LENGTH(col) FROM t;
FLUSH TABLE t;
ANALYZE TABLE t;
# retrieve the number of leaf pages
SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=COMPACT;
@ -382,18 +371,6 @@ INSERT INTO t VALUES (REPEAT('a',65535));
SELECT LENGTH(col) FROM t;
FLUSH TABLE t;
ANALYZE TABLE t;
# retrieve the number of leaf pages
SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
DROP TABLE t;
# cleanup
--disable_query_log
--disable_warnings
eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
eval SET GLOBAL INNODB_STRICT_MODE=$innodb_strict_mode;
--enable_warnings
--enable_query_log
--echo # Success

View File

@ -1,3 +1,4 @@
--innodb-page-size=64K
--innodb_buffer_pool_size=32M
--innodb-stats-persistent=ON
--skip-innodb-stats-persistent
--innodb-sys-tablestats

View File

@ -6,16 +6,7 @@ call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the
# Check page size 64k
SELECT @@innodb_page_size;
let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
let $innodb_strict_mode = `SELECT @@innodb_strict_mode`;
--disable_warnings
SET GLOBAL innodb_file_per_table=ON;
SET @@innodb_strict_mode=ON;
--enable_warnings
SELECT @@innodb_file_per_table;
SELECT @@innodb_strict_mode;
SET innodb_strict_mode=ON;
# Check the error when the max record length > 32K for innodb_page_size=64k
--error ER_TOO_BIG_ROWSIZE
@ -560,9 +551,8 @@ INSERT INTO t VALUES (REPEAT('a',65535));
SELECT LENGTH(col) FROM t;
FLUSH TABLE t;
ANALYZE TABLE t;
# retrieve the number of leaf pages
SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
@ -573,9 +563,8 @@ INSERT INTO t VALUES (REPEAT('a',65535));
SELECT LENGTH(col) FROM t;
FLUSH TABLE t;
ANALYZE TABLE t;
# retrieve the number of leaf pages
SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=COMPACT;
@ -586,18 +575,6 @@ INSERT INTO t VALUES (REPEAT('a',65535));
SELECT LENGTH(col) FROM t;
FLUSH TABLE t;
ANALYZE TABLE t;
# retrieve the number of leaf pages
SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name = 'test/t';
DROP TABLE t;
# cleanup
--disable_query_log
--disable_warnings
eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
eval SET GLOBAL INNODB_STRICT_MODE=$innodb_strict_mode;
--enable_warnings
--enable_query_log
--echo # Success

View File

@ -0,0 +1,72 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/count_sessions.inc
connect(stop_purge, localhost, root,,);
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connect(delete, localhost, root,,);
connection default;
CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1,1);
DELETE FROM t1;
let $i=2;
while ($i) {
let $iso= `SELECT CASE $i WHEN 1 THEN 'UNCOMMITTED' ELSE 'COMMITTED' END`;
SET DEBUG_SYNC='row_ins_sec_index_unique SIGNAL inserted WAIT_FOR locked';
BEGIN;
send INSERT INTO t1 VALUES(1,1);
connection delete;
SET DEBUG_SYNC='now WAIT_FOR inserted';
SET DEBUG_SYNC='innodb_row_search_for_mysql_exit SIGNAL locked';
eval SET SESSION TRANSACTION ISOLATION LEVEL READ $iso;
BEGIN;
send DELETE FROM t1 WHERE b=1;
connection default;
reap;
connection delete;
reap;
COMMIT;
connection default;
SET DEBUG_SYNC='RESET';
ROLLBACK;
dec $i;
}
SET DEBUG_SYNC='row_ins_sec_index_unique SIGNAL inserted WAIT_FOR locked';
BEGIN;
SET innodb_lock_wait_timeout=1;
send INSERT INTO t1 VALUES(1,1);
connection delete;
SET DEBUG_SYNC='now WAIT_FOR inserted';
SET DEBUG_SYNC='innodb_row_search_for_mysql_exit SIGNAL locked';
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
send DELETE FROM t1 WHERE b=1;
connection default;
--error ER_LOCK_WAIT_TIMEOUT
reap;
COMMIT;
SET DEBUG_SYNC='RESET';
connection delete;
reap;
COMMIT;
disconnect delete;
disconnect stop_purge;
connection default;
DROP TABLE t1;
--source include/wait_until_count_sessions.inc

View File

@ -125,7 +125,7 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re
15 15 stage/sql/Starting cleanup (stage) STATEMENT 0
16 16 stage/sql/Freeing items (stage) STATEMENT 0
17 17 wait/io/socket/sql/client_connection send STATEMENT 0
18 18 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 0
18 18 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 0
19 20 stage/sql/Reset for next command (stage) STATEMENT 0
20 20 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 19
21 21 idle idle NULL NULL
@ -147,7 +147,7 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re
37 37 stage/sql/Starting cleanup (stage) STATEMENT 22
38 38 stage/sql/Freeing items (stage) STATEMENT 22
39 39 wait/io/socket/sql/client_connection send STATEMENT 22
40 40 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 22
40 40 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 22
41 42 stage/sql/Reset for next command (stage) STATEMENT 22
42 42 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 41
43 43 idle idle NULL NULL
@ -169,7 +169,7 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re
59 59 stage/sql/Starting cleanup (stage) STATEMENT 44
60 60 stage/sql/Freeing items (stage) STATEMENT 44
61 61 wait/io/socket/sql/client_connection send STATEMENT 44
62 62 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 44
62 62 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 44
63 64 stage/sql/Reset for next command (stage) STATEMENT 44
64 64 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 63
65 65 idle idle NULL NULL
@ -194,7 +194,7 @@ select "With a third part to make things complete" as payload NULL NULL
82 82 stage/sql/Starting cleanup (stage) STATEMENT 66
83 85 stage/sql/Freeing items (stage) STATEMENT 66
84 84 wait/io/socket/sql/client_connection send STAGE 83
85 85 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 83
85 85 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 83
86 103 statement/sql/select select "And this is the second part of a multi query" as payload;
select "With a third part to make things complete" as payload NULL NULL
87 89 stage/sql/Init (stage) STATEMENT 86
@ -213,7 +213,7 @@ select "With a third part to make things complete" as payload NULL NULL
100 100 stage/sql/Starting cleanup (stage) STATEMENT 86
101 103 stage/sql/Freeing items (stage) STATEMENT 86
102 102 wait/io/socket/sql/client_connection send STAGE 101
103 103 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 101
103 103 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STAGE 101
104 122 statement/sql/select select "With a third part to make things complete" as payload NULL NULL
105 106 stage/sql/Init (stage) STATEMENT 104
106 106 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 105
@ -230,7 +230,7 @@ select "With a third part to make things complete" as payload NULL NULL
117 117 stage/sql/Starting cleanup (stage) STATEMENT 104
118 118 stage/sql/Freeing items (stage) STATEMENT 104
119 119 wait/io/socket/sql/client_connection send STATEMENT 104
120 120 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 104
120 120 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 104
121 122 stage/sql/Reset for next command (stage) STATEMENT 104
122 122 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 121
123 123 idle idle NULL NULL
@ -252,7 +252,7 @@ select "With a third part to make things complete" as payload NULL NULL
139 139 stage/sql/Starting cleanup (stage) STATEMENT 124
140 140 stage/sql/Freeing items (stage) STATEMENT 124
141 141 wait/io/socket/sql/client_connection send STATEMENT 124
142 142 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 124
142 142 wait/synch/mutex/sql/THD::LOCK_thd_kill lock STATEMENT 124
143 144 stage/sql/Reset for next command (stage) STATEMENT 124
144 144 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 143
disconnect con1;

View File

@ -39,6 +39,7 @@ update performance_schema.setup_instruments set enabled='YES', timed='YES'
'wait/io/socket/sql/client_connection',
'wait/synch/rwlock/sql/LOCK_grant',
'wait/synch/mutex/sql/THD::LOCK_thd_data',
'wait/synch/mutex/sql/THD::LOCK_thd_kill',
'wait/io/file/sql/query_log');
update performance_schema.setup_instruments set enabled='YES', timed='YES'

View File

@ -99,7 +99,7 @@ DROP VIEW v1;
ERROR 42S02: Unknown VIEW: 'test.v1'
DROP VIEW IF EXISTS v2;
Warnings:
Note 4091 Unknown VIEW: 'test.v2'
Note 4092 Unknown VIEW: 'test.v2'
# Syncing slave with master
connection slave;
SELECT * FROM v1;

View File

@ -128,7 +128,7 @@ show warnings;
Level Code Message
Error 1062 Duplicate entry '20' for key 'a'
Warning 1196 Some non-transactional changed tables couldn't be rolled back
Note 4093 At line 4 in mysqltest1.foo4
Note 4094 At line 4 in mysqltest1.foo4
select * from t2;
a
20
@ -291,7 +291,7 @@ end|
do fn1(100);
Warnings:
Error 1062 Duplicate entry '100' for key 'a'
Note 4093 At line 3 in mysqltest1.fn1
Note 4094 At line 3 in mysqltest1.fn1
Warning 1196 Some non-transactional changed tables couldn't be rolled back
select fn1(20);
ERROR 23000: Duplicate entry '20' for key 'a'

View File

@ -212,7 +212,7 @@ ERROR 42S02: 'test.t1' is not a SEQUENCE
drop table t1;
alter sequence if exists t1 minvalue=100;
Warnings:
Note 4090 Unknown SEQUENCE: 'test.t1'
Note 4091 Unknown SEQUENCE: 'test.t1'
alter sequence t1 minvalue=100;
ERROR 42S02: Table 'test.t1' doesn't exist
create sequence t1;

View File

@ -165,7 +165,7 @@ drop sequence t1;
ERROR 42S02: 'test.t1' is not a SEQUENCE
drop sequence if exists t1;
Warnings:
Note 4090 Unknown SEQUENCE: 'test.t1'
Note 4091 Unknown SEQUENCE: 'test.t1'
create sequence t1 start with 10 maxvalue=9;
ERROR HY000: Sequence 'test.t1' values are conflicting
create sequence t1 minvalue= 100 maxvalue=10;
@ -377,7 +377,7 @@ key key1 (next_not_cached_value)
ERROR HY000: Sequence 'test.t1' table structure is invalid (Sequence tables cannot have any keys)
drop sequence if exists t1;
Warnings:
Note 4090 Unknown SEQUENCE: 'test.t1'
Note 4091 Unknown SEQUENCE: 'test.t1'
create sequence t1;
create sequence t2;
create table t3 (a int) engine=myisam;
@ -387,8 +387,8 @@ CREATE SEQUENCE s1;
drop sequence s1;
drop sequence if exists t1,t2,t3,t4;
Warnings:
Note 4090 Unknown SEQUENCE: 'test.t3'
Note 4090 Unknown SEQUENCE: 'test.t4'
Note 4091 Unknown SEQUENCE: 'test.t3'
Note 4091 Unknown SEQUENCE: 'test.t4'
drop table if exists t1,t2,t3;
Warnings:
Note 1051 Unknown table 'test.t1'
@ -414,9 +414,9 @@ CREATE TABLE t2 (a int);
CREATE SEQUENCE s1;
drop sequence if exists t1,t2,s1,s2;
Warnings:
Note 4090 Unknown SEQUENCE: 'test.t1'
Note 4090 Unknown SEQUENCE: 'test.t2'
Note 4090 Unknown SEQUENCE: 'test.s2'
Note 4091 Unknown SEQUENCE: 'test.t1'
Note 4091 Unknown SEQUENCE: 'test.t2'
Note 4091 Unknown SEQUENCE: 'test.s2'
drop table if exists t1,t2;
CREATE TEMPORARY SEQUENCE s1;
DROP SEQUENCE s1;

View File

@ -69,7 +69,7 @@ INSERT INTO t1 (a,b,c,d) VALUES
(1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF);
EXPLAIN SELECT HEX(b+c) FROM t1 WHERE c > 1 OR HEX(b) < 0xFFFFFF;
id select_type table type possible_keys key key_len ref rows Extra
# # # # # b_c # # # #
# # # # # NULL # # # #
SELECT HEX(b+c) FROM t1 WHERE c > 1 OR HEX(b) < 0xFFFFFF;
HEX(b+c)
10
@ -98,7 +98,7 @@ INSERT INTO t1 (a,b,c,d) VALUES
(1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF);
EXPLAIN SELECT DISTINCT a+0 FROM t1 ORDER BY a;
id select_type table type possible_keys key key_len ref rows Extra
# # # # # a # # # #
# # # # # NULL # # # #
SELECT DISTINCT a+0 FROM t1 ORDER BY a;
a+0
0

View File

@ -1334,7 +1334,7 @@ NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST fcfs,vats
READ_ONLY NO
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME INNODB_LOCK_WAIT_TIMEOUT
SESSION_VALUE 50

View File

@ -0,0 +1 @@
--innodb-lock-schedule-algorithm=FCFS

View File

@ -411,6 +411,9 @@ let $coll='latin1_nopad_bin';
let $coll_pad='latin1_bin';
--source include/ctype_pad_all_engines.inc
SET NAMES latin1;
--source include/ctype_like_range_mdev14350.inc
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -154,6 +154,46 @@ INSERT INTO t1 (a) VALUES ('a'),('a_'),('a%');
SELECT a, HEX(mn), HEX(mx) FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-14350 Index use with collation utf8mb4_unicode_nopad_ci on LIKE pattern with wrong results
--echo #
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_swedish_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_general_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8 COLLATE utf8_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET ucs2 COLLATE ucs2_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf16 COLLATE utf16_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf32 COLLATE utf32_unicode_nopad_ci);
INSERT INTO t1 VALUES ('111%');
SELECT a, HEX(LIKE_RANGE_MIN(a,200)) FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -16,6 +16,10 @@ let $coll='ucs2_unicode_520_nopad_ci';
let $coll_pad='ucs2_unicode_520_ci';
--source include/ctype_pad_all_engines.inc
SET NAMES utf8, collation_connection=ucs2_unicode_520_nopad_ci;
--source include/ctype_like_range_mdev14350.inc
SET NAMES utf8;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -238,6 +238,11 @@ let $coll='utf16_unicode_520_nopad_ci';
let $coll_pad='utf16_unicode_520_ci';
--source include/ctype_pad_all_engines.inc
SET NAMES utf8, collation_connection=utf16_unicode_520_nopad_ci;
--source include/ctype_like_range_mdev14350.inc
SET NAMES utf8;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -260,6 +260,11 @@ let $coll='utf32_unicode_520_nopad_ci';
let $coll_pad='utf32_unicode_520_ci';
--source include/ctype_pad_all_engines.inc
SET NAMES utf8, collation_connection=utf32_unicode_520_nopad_ci;
--source include/ctype_like_range_mdev14350.inc
SET NAMES utf8;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -14,6 +14,9 @@ let $coll='utf8_unicode_520_nopad_ci';
let $coll_pad='utf8_unicode_520_ci';
--source include/ctype_pad_all_engines.inc
SET NAMES utf8 COLLATE utf8_unicode_nopad_ci;
--source include/ctype_like_range_mdev14350.inc
--echo #
--echo # End of 10.2 tests

View File

@ -100,6 +100,11 @@ let $coll='utf8mb4_unicode_520_nopad_ci';
let $coll_pad='utf8mb4_unicode_520_ci';
--source include/ctype_pad_all_engines.inc
SET NAMES utf8mb4 COLLATE utf8mb4_unicode_520_nopad_ci;
--source include/ctype_like_range_mdev14350.inc
SET NAMES utf8mb4;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -274,7 +274,7 @@ BEGIN
END;
$$
DELIMITER ;$$
--error ER_OPERAND_COLUMNS
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL p1();
DROP PROCEDURE p1;
@ -287,7 +287,7 @@ BEGIN
END;
$$
DELIMITER ;$$
--error ER_OPERAND_COLUMNS
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
CALL p1();
DROP PROCEDURE p1;

View File

@ -9774,6 +9774,85 @@ DELIMITER ;$$
CALL p1();
DROP PROCEDURE p1;
--echo #
--echo # MDEV-14228 MariaDB crashes with function
--echo #
CREATE TABLE t1 (c VARCHAR(16), KEY(c));
INSERT INTO t1 VALUES ('foo');
DELIMITER $$;
CREATE FUNCTION f1() RETURNS VARCHAR(16)
BEGIN
DECLARE v VARCHAR(16);
FOR v IN (SELECT DISTINCT c FROM t1)
DO
IF (v = 'bar') THEN
SELECT 1 INTO @a;
END IF;
END FOR;
RETURN 'qux';
END $$
DELIMITER ;$$
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT f1();
DROP FUNCTION f1;
DELIMITER $$;
CREATE FUNCTION f1() RETURNS VARCHAR(16)
BEGIN
DECLARE v ROW TYPE OF t1;
IF v = 'bar' THEN
RETURN 'eq';
END IF;
RETURN 'ne';
END $$
DELIMITER ;$$
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT f1();
DROP FUNCTION f1;
DELIMITER $$;
CREATE FUNCTION f1() RETURNS VARCHAR(16)
BEGIN
DECLARE v ROW(a INT);
IF v = 'bar' THEN
RETURN 'eq';
END IF;
RETURN 'ne';
END $$
DELIMITER ;$$
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT f1();
DROP FUNCTION f1;
DROP TABLE t1;
DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
BEGIN NOT ATOMIC
DECLARE v ROW(a INT);
SELECT v IN ('a','b');
END $$
DELIMITER ;$$
DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
BEGIN NOT ATOMIC
DECLARE v ROW(a INT);
SELECT 'a' IN (v,'b');
END $$
DELIMITER ;$$
DELIMITER $$;
--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
BEGIN NOT ATOMIC
DECLARE v ROW(a INT);
SELECT 'a' IN ('b',v);
END $$
DELIMITER ;$$
--echo # Test affected rows from an sp
create table t1 (a int);

View File

@ -188,10 +188,10 @@ INSERT INTO t8 (pseudo,email) VALUES ('joce','test');
INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
-- error ER_OPERAND_COLUMNS
-- error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
t8 WHERE pseudo='joce');
-- error ER_OPERAND_COLUMNS
-- error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
SELECT pseudo FROM t8 WHERE pseudo=(SELECT * FROM t8 WHERE
pseudo='joce');
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
@ -1834,13 +1834,13 @@ drop table t1, t2;
#
create table t1 (a int, b int);
insert into t1 values (1,2);
-- error ER_OPERAND_COLUMNS
-- error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
select 1 = (select * from t1);
-- error ER_OPERAND_COLUMNS
-- error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
select (select * from t1) = 1;
-- error ER_OPERAND_COLUMNS
-- error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
select (1,2) = (select a from t1);
-- error ER_OPERAND_COLUMNS
-- error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
select (select a from t1) = (1,2);
-- error ER_OPERAND_COLUMNS
select (1,2,3) = (select * from t1);

View File

@ -430,7 +430,7 @@ static void alloc_free(uchar *first,
{
anext_node(last)= tmp.node;
} while (!my_atomic_casptr((void **)(char *)&allocator->top,
(void **)&tmp.ptr, first) && LF_BACKOFF);
(void **)&tmp.ptr, first) && LF_BACKOFF());
}
/*
@ -501,7 +501,7 @@ void *lf_alloc_new(LF_PINS *pins)
{
node= allocator->top;
lf_pin(pins, 0, node);
} while (node != allocator->top && LF_BACKOFF);
} while (node != allocator->top && LF_BACKOFF());
if (!node)
{
node= (void *)my_malloc(allocator->element_size, MYF(MY_WME));

View File

@ -102,7 +102,7 @@ retry:
do { /* PTR() isn't necessary below, head is a dummy node */
cursor->curr= (LF_SLIST *)(*cursor->prev);
lf_pin(pins, 1, cursor->curr);
} while (*cursor->prev != (intptr)cursor->curr && LF_BACKOFF);
} while (*cursor->prev != (intptr)cursor->curr && LF_BACKOFF());
for (;;)
{
@ -117,7 +117,7 @@ retry:
link= cursor->curr->link;
cursor->next= PTR(link);
lf_pin(pins, 0, cursor->next);
} while (link != cursor->curr->link && LF_BACKOFF);
} while (link != cursor->curr->link && LF_BACKOFF());
if (!DELETED(link))
{
@ -145,7 +145,7 @@ retry:
and remove this deleted node
*/
if (my_atomic_casptr((void **) cursor->prev,
(void **) &cursor->curr, cursor->next) && LF_BACKOFF)
(void **) &cursor->curr, cursor->next) && LF_BACKOFF())
lf_alloc_free(pins, cursor->curr);
else
goto retry;

View File

@ -618,7 +618,7 @@ retry:
{
rc= *shared_ptr;
lf_pin(arg->thd->pins, 0, rc);
} while (rc != *shared_ptr && LF_BACKOFF);
} while (rc != *shared_ptr && LF_BACKOFF());
if (rc == 0)
{

View File

@ -648,14 +648,11 @@ Event_scheduler::stop()
state= STOPPING;
DBUG_PRINT("info", ("Scheduler thread has id %lu",
(ulong) scheduler_thd->thread_id));
/* Lock from delete */
mysql_mutex_lock(&scheduler_thd->LOCK_thd_data);
/* This will wake up the thread if it waits on Queue's conditional */
sql_print_information("Event Scheduler: Killing the scheduler thread, "
"thread id %lu",
(ulong) scheduler_thd->thread_id);
scheduler_thd->awake(KILL_CONNECTION);
mysql_mutex_unlock(&scheduler_thd->LOCK_thd_data);
/* thd could be 0x0, when shutting down */
sql_print_information("Event Scheduler: "

View File

@ -1154,6 +1154,16 @@ bool Item::check_type_can_return_text(const char *opname) const
bool Item::check_type_scalar(const char *opname) const
{
/*
fixed==true usually means than the Item has an initialized
and reliable data type handler and attributes.
Item_outer_ref is an exception. It copies the data type and the attributes
from the referenced Item in the constructor, but then sets "fixed" to false,
and re-fixes itself again in fix_inner_refs().
This hack in Item_outer_ref should probably be refactored eventually.
Discuss with Sanja.
*/
DBUG_ASSERT(fixed || type() == REF_ITEM);
const Type_handler *handler= type_handler();
if (handler->is_scalar_type())
return false;

View File

@ -153,12 +153,19 @@ void Item_func::sync_with_sum_func_and_with_field(List<Item> &list)
bool Item_func::check_argument_types_like_args0() const
{
uint cols;
if (arg_count == 0)
if (arg_count < 2)
return false;
cols= args[0]->cols();
uint cols= args[0]->cols();
bool is_scalar= args[0]->type_handler()->is_scalar_type();
for (uint i= 1; i < arg_count; i++)
{
if (is_scalar != args[i]->type_handler()->is_scalar_type())
{
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0),
args[0]->type_handler()->name().ptr(),
args[i]->type_handler()->name().ptr(), func_name());
return true;
}
if (args[i]->check_cols(cols))
return true;
}

View File

@ -35,7 +35,7 @@
void Apc_target::init(mysql_mutex_t *target_mutex)
{
DBUG_ASSERT(!enabled);
LOCK_thd_data_ptr= target_mutex;
LOCK_thd_kill_ptr= target_mutex;
#ifndef DBUG_OFF
n_calls_processed= 0;
#endif
@ -46,7 +46,7 @@ void Apc_target::init(mysql_mutex_t *target_mutex)
void Apc_target::enqueue_request(Call_request *qe)
{
mysql_mutex_assert_owner(LOCK_thd_data_ptr);
mysql_mutex_assert_owner(LOCK_thd_kill_ptr);
if (apc_calls)
{
Call_request *after= apc_calls->prev;
@ -72,7 +72,7 @@ void Apc_target::enqueue_request(Call_request *qe)
void Apc_target::dequeue_request(Call_request *qe)
{
mysql_mutex_assert_owner(LOCK_thd_data_ptr);
mysql_mutex_assert_owner(LOCK_thd_kill_ptr);
if (apc_calls == qe)
{
if ((apc_calls= apc_calls->next) == qe)
@ -146,14 +146,14 @@ bool Apc_target::make_apc_call(THD *caller_thd, Apc_call *call,
int wait_res= 0;
PSI_stage_info old_stage;
caller_thd->ENTER_COND(&apc_request.COND_request, LOCK_thd_data_ptr,
caller_thd->ENTER_COND(&apc_request.COND_request, LOCK_thd_kill_ptr,
&stage_show_explain, &old_stage);
/* todo: how about processing other errors here? */
while (!apc_request.processed && (wait_res != ETIMEDOUT))
{
/* We own LOCK_thd_data_ptr */
/* We own LOCK_thd_kill_ptr */
wait_res= mysql_cond_timedwait(&apc_request.COND_request,
LOCK_thd_data_ptr, &abstime);
LOCK_thd_kill_ptr, &abstime);
// &apc_request.LOCK_request, &abstime);
if (caller_thd->killed)
break;
@ -164,7 +164,7 @@ bool Apc_target::make_apc_call(THD *caller_thd, Apc_call *call,
/*
The wait has timed out, or this thread was KILLed.
Remove the request from the queue (ok to do because we own
LOCK_thd_data_ptr)
LOCK_thd_kill_ptr)
*/
apc_request.processed= TRUE;
dequeue_request(&apc_request);
@ -177,7 +177,7 @@ bool Apc_target::make_apc_call(THD *caller_thd, Apc_call *call,
res= FALSE;
}
/*
exit_cond() will call mysql_mutex_unlock(LOCK_thd_data_ptr) for us:
exit_cond() will call mysql_mutex_unlock(LOCK_thd_kill_ptr) for us:
*/
caller_thd->EXIT_COND(&old_stage);
@ -186,7 +186,7 @@ bool Apc_target::make_apc_call(THD *caller_thd, Apc_call *call,
}
else
{
mysql_mutex_unlock(LOCK_thd_data_ptr);
mysql_mutex_unlock(LOCK_thd_kill_ptr);
}
return res;
}
@ -203,11 +203,11 @@ void Apc_target::process_apc_requests()
{
Call_request *request;
mysql_mutex_lock(LOCK_thd_data_ptr);
mysql_mutex_lock(LOCK_thd_kill_ptr);
if (!(request= get_first_in_queue()))
{
/* No requests in the queue */
mysql_mutex_unlock(LOCK_thd_data_ptr);
mysql_mutex_unlock(LOCK_thd_kill_ptr);
break;
}
@ -226,7 +226,7 @@ void Apc_target::process_apc_requests()
n_calls_processed++;
#endif
mysql_cond_signal(&request->COND_request);
mysql_mutex_unlock(LOCK_thd_data_ptr);
mysql_mutex_unlock(LOCK_thd_kill_ptr);
}
}

View File

@ -44,7 +44,7 @@ class THD;
*/
class Apc_target
{
mysql_mutex_t *LOCK_thd_data_ptr;
mysql_mutex_t *LOCK_thd_kill_ptr;
public:
Apc_target() : enabled(0), apc_calls(NULL) {}
~Apc_target() { DBUG_ASSERT(!enabled && !apc_calls);}
@ -66,9 +66,9 @@ public:
void disable()
{
DBUG_ASSERT(enabled);
mysql_mutex_lock(LOCK_thd_data_ptr);
mysql_mutex_lock(LOCK_thd_kill_ptr);
bool process= !--enabled && have_apc_requests();
mysql_mutex_unlock(LOCK_thd_data_ptr);
mysql_mutex_unlock(LOCK_thd_kill_ptr);
if (unlikely(process))
process_apc_requests();
}

View File

@ -1707,7 +1707,7 @@ static void close_connections(void)
#endif
tmp->set_killed(KILL_SERVER_HARD);
MYSQL_CALLBACK(thread_scheduler, post_kill_notification, (tmp));
mysql_mutex_lock(&tmp->LOCK_thd_data);
mysql_mutex_lock(&tmp->LOCK_thd_kill);
if (tmp->mysys_var)
{
tmp->mysys_var->abort=1;
@ -1730,7 +1730,7 @@ static void close_connections(void)
}
mysql_mutex_unlock(&tmp->mysys_var->mutex);
}
mysql_mutex_unlock(&tmp->LOCK_thd_data);
mysql_mutex_unlock(&tmp->LOCK_thd_kill);
}
mysql_mutex_unlock(&LOCK_thread_count); // For unlink from list

View File

@ -7750,6 +7750,9 @@ ER_NET_OK_PACKET_TOO_LARGE
ER_GEOJSON_EMPTY_COORDINATES
eng "Incorrect GeoJSON format - empty 'coordinates' array."
ER_MYROCKS_CANT_NOPAD_COLLATION
eng "MyRocks doesn't currently support collations with \"No pad\" attribute."
ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
eng "Illegal parameter data types %s and %s for operation '%s'"
ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION

View File

@ -516,9 +516,7 @@ handle_slave_background(void *arg __attribute__((unused)))
THD *to_kill= p->to_kill;
kill_list= p->next;
mysql_mutex_lock(&to_kill->LOCK_thd_data);
to_kill->awake(KILL_CONNECTION);
mysql_mutex_unlock(&to_kill->LOCK_thd_data);
mysql_mutex_lock(&to_kill->LOCK_wakeup_ready);
to_kill->rgi_slave->killed_for_retry=
rpl_group_info::RETRY_KILL_KILLED;
@ -1162,7 +1160,7 @@ terminate_slave_thread(THD *thd,
int error __attribute__((unused));
DBUG_PRINT("loop", ("killing slave thread"));
mysql_mutex_lock(&thd->LOCK_thd_data);
mysql_mutex_lock(&thd->LOCK_thd_kill);
#ifndef DONT_USE_THR_ALARM
/*
Error codes from pthread_kill are:
@ -1172,9 +1170,9 @@ terminate_slave_thread(THD *thd,
int err __attribute__((unused))= pthread_kill(thd->real_id, thr_client_alarm);
DBUG_ASSERT(err != EINVAL);
#endif
thd->awake(NOT_KILLED);
thd->awake_no_mutex(NOT_KILLED);
mysql_mutex_unlock(&thd->LOCK_thd_data);
mysql_mutex_unlock(&thd->LOCK_thd_kill);
/*
There is a small chance that slave thread might miss the first

View File

@ -555,8 +555,6 @@ char *thd_get_error_context_description(THD *thd, char *buffer,
char header[256];
int len;
mysql_mutex_lock(&LOCK_thread_count);
/*
The pointers thd->query and thd->proc_info might change since they are
being modified concurrently. This is acceptable for proc_info since its
@ -612,7 +610,6 @@ char *thd_get_error_context_description(THD *thd, char *buffer,
}
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
mysql_mutex_unlock(&LOCK_thread_count);
if (str.c_ptr_safe() == buffer)
return buffer;
@ -704,10 +701,8 @@ handle_condition(THD *thd,
extern "C" void thd_kill_timeout(THD* thd)
{
thd->status_var.max_statement_time_exceeded++;
mysql_mutex_lock(&thd->LOCK_thd_data);
/* Kill queries that can't cause data corruptions */
thd->awake(KILL_TIMEOUT);
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
@ -1363,7 +1358,7 @@ void THD::init(void)
session_tracker.enable(this);
#endif //EMBEDDED_LIBRARY
apc_target.init(&LOCK_thd_data);
apc_target.init(&LOCK_thd_kill);
DBUG_VOID_RETURN;
}
@ -1627,9 +1622,13 @@ THD::~THD()
if (!status_in_global)
add_status_to_global();
/* Ensure that no one is using THD */
mysql_mutex_lock(&LOCK_thd_data);
mysql_mutex_unlock(&LOCK_thd_data);
/*
Other threads may have a lock on LOCK_thd_kill to ensure that this
THD is not deleted while they access it. The following mutex_lock
ensures that no one else is using this THD and it's now safe to delete
*/
mysql_mutex_lock(&LOCK_thd_kill);
mysql_mutex_unlock(&LOCK_thd_kill);
#ifdef WITH_WSREP
mysql_mutex_lock(&LOCK_wsrep_thd);
@ -1811,17 +1810,17 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var,
This is normally called from another thread's THD object.
@note Do always call this while holding LOCK_thd_data.
@note Do always call this while holding LOCK_thd_kill.
NOT_KILLED is used to awake a thread for a slave
*/
void THD::awake(killed_state state_to_set)
void THD::awake_no_mutex(killed_state state_to_set)
{
DBUG_ENTER("THD::awake");
DBUG_PRINT("enter", ("this: %p current_thd: %p state: %d",
this, current_thd, (int) state_to_set));
THD_CHECK_SENTRY(this);
mysql_mutex_assert_owner(&LOCK_thd_data);
mysql_mutex_assert_owner(&LOCK_thd_kill);
print_aborted_warning(3, "KILLED");
@ -1832,8 +1831,6 @@ void THD::awake(killed_state state_to_set)
if (killed >= KILL_CONNECTION)
state_to_set= killed;
/* Set the 'killed' flag of 'this', which is the target THD object. */
mysql_mutex_lock(&LOCK_thd_kill);
set_killed_no_mutex(state_to_set);
if (state_to_set >= KILL_CONNECTION || state_to_set == NOT_KILLED)
@ -1920,7 +1917,6 @@ void THD::awake(killed_state state_to_set)
}
mysql_mutex_unlock(&mysys_var->mutex);
}
mysql_mutex_unlock(&LOCK_thd_kill);
DBUG_VOID_RETURN;
}
@ -1936,10 +1932,10 @@ void THD::disconnect()
{
Vio *vio= NULL;
mysql_mutex_lock(&LOCK_thd_data);
set_killed(KILL_CONNECTION);
mysql_mutex_lock(&LOCK_thd_data);
#ifdef SIGNAL_WITH_VIO_CLOSE
/*
Since a active vio might might have not been set yet, in
@ -1972,9 +1968,9 @@ bool THD::notify_shared_lock(MDL_context_owner *ctx_in_use,
{
/* This code is similar to kill_delayed_threads() */
DBUG_PRINT("info", ("kill delayed thread"));
mysql_mutex_lock(&in_use->LOCK_thd_data);
mysql_mutex_lock(&in_use->LOCK_thd_kill);
if (in_use->killed < KILL_CONNECTION)
in_use->set_killed(KILL_CONNECTION);
in_use->set_killed_no_mutex(KILL_CONNECTION);
if (in_use->mysys_var)
{
mysql_mutex_lock(&in_use->mysys_var->mutex);
@ -1985,7 +1981,7 @@ bool THD::notify_shared_lock(MDL_context_owner *ctx_in_use,
in_use->mysys_var->abort= 1;
mysql_mutex_unlock(&in_use->mysys_var->mutex);
}
mysql_mutex_unlock(&in_use->LOCK_thd_data);
mysql_mutex_unlock(&in_use->LOCK_thd_kill);
signalled= TRUE;
}
@ -2110,7 +2106,7 @@ bool THD::store_globals()
return 1;
/*
mysys_var is concurrently readable by a killer thread.
It is protected by LOCK_thd_data, it is not needed to lock while the
It is protected by LOCK_thd_kill, it is not needed to lock while the
pointer is changing from NULL not non-NULL. If the kill thread reads
NULL it doesn't refer to anything, but if it is non-NULL we need to
ensure that the thread doesn't proceed to assign another thread to
@ -2161,9 +2157,9 @@ bool THD::store_globals()
void THD::reset_globals()
{
mysql_mutex_lock(&LOCK_thd_data);
mysql_mutex_lock(&LOCK_thd_kill);
mysys_var= 0;
mysql_mutex_unlock(&LOCK_thd_data);
mysql_mutex_unlock(&LOCK_thd_kill);
/* Undocking the thread specific data. */
set_current_thd(0);
@ -5500,9 +5496,9 @@ void THD::set_query_and_id(char *query_arg, uint32 query_length_arg,
/** Assign a new value to thd->mysys_var. */
void THD::set_mysys_var(struct st_my_thread_var *new_mysys_var)
{
mysql_mutex_lock(&LOCK_thd_data);
mysql_mutex_lock(&LOCK_thd_kill);
mysys_var= new_mysys_var;
mysql_mutex_unlock(&LOCK_thd_data);
mysql_mutex_unlock(&LOCK_thd_kill);
}
/**
@ -5635,7 +5631,7 @@ public:
MY_MEMORY_ORDER_RELAXED))
{
old&= ACQUIRED | RECOVERED;
(void) LF_BACKOFF;
(void) LF_BACKOFF();
}
}
bool acquire_recovered()
@ -5648,7 +5644,7 @@ public:
if (!(old & RECOVERED) || (old & ACQUIRED))
return false;
old= RECOVERED;
(void) LF_BACKOFF;
(void) LF_BACKOFF();
}
return true;
}

View File

@ -2154,11 +2154,15 @@ public:
- thd->query and thd->query_length (used by SHOW ENGINE
INNODB STATUS and SHOW PROCESSLIST
- thd->db and thd->db_length (used in SHOW PROCESSLIST)
- thd->mysys_var (used by KILL statement and shutdown).
Is locked when THD is deleted.
*/
mysql_mutex_t LOCK_thd_data;
/* Protect kill information */
/*
Protects:
- kill information
- mysys_var (used by KILL statement and shutdown).
- Also ensures that THD is not deleted while mutex is hold
*/
mysql_mutex_t LOCK_thd_kill;
/* all prepared statements and cursors of this connection */
@ -3177,7 +3181,13 @@ public:
}
void close_active_vio();
#endif
void awake(killed_state state_to_set);
void awake_no_mutex(killed_state state_to_set);
void awake(killed_state state_to_set)
{
mysql_mutex_lock(&LOCK_thd_kill);
awake_no_mutex(state_to_set);
mysql_mutex_unlock(&LOCK_thd_kill);
}
/** Disconnect the associated communication endpoint. */
void disconnect();

View File

@ -2701,9 +2701,9 @@ void kill_delayed_threads(void)
Delayed_insert *di;
while ((di= it++))
{
mysql_mutex_lock(&di->thd.LOCK_thd_data);
mysql_mutex_lock(&di->thd.LOCK_thd_kill);
if (di->thd.killed < KILL_CONNECTION)
di->thd.set_killed(KILL_CONNECTION);
di->thd.set_killed_no_mutex(KILL_CONNECTION);
if (di->thd.mysys_var)
{
mysql_mutex_lock(&di->thd.mysys_var->mutex);
@ -2721,7 +2721,7 @@ void kill_delayed_threads(void)
}
mysql_mutex_unlock(&di->thd.mysys_var->mutex);
}
mysql_mutex_unlock(&di->thd.LOCK_thd_data);
mysql_mutex_unlock(&di->thd.LOCK_thd_kill);
}
mysql_mutex_unlock(&LOCK_delayed_insert); // For unlink from list
DBUG_VOID_RETURN;
@ -3075,9 +3075,9 @@ pthread_handler_t handle_delayed_insert(void *arg)
this.
*/
mysql_mutex_lock(&thd->LOCK_thd_data);
thd->set_killed(KILL_CONNECTION_HARD); // If error
thd->mdl_context.set_needs_thr_lock_abort(0);
mysql_mutex_unlock(&thd->LOCK_thd_data);
thd->set_killed(KILL_CONNECTION_HARD); // If error
close_thread_tables(thd); // Free the table
thd->mdl_context.release_transactional_locks();

View File

@ -5781,14 +5781,19 @@ end_with_restore_list:
thd->print_aborted_warning(3, "RELEASE");
}
#ifdef WITH_WSREP
if (WSREP(thd) && (thd->wsrep_conflict_state != NO_CONFLICT &&
thd->wsrep_conflict_state != REPLAYING))
{
DBUG_ASSERT(thd->is_error()); // the error is already issued
}
else
if (WSREP(thd)) {
if (thd->wsrep_conflict_state == NO_CONFLICT ||
thd->wsrep_conflict_state == REPLAYING)
{
my_ok(thd);
}
} else {
#endif /* WITH_WSREP */
my_ok(thd);
#ifdef WITH_WSREP
}
#endif /* WITH_WSREP */
my_ok(thd);
break;
}
case SQLCOM_ROLLBACK:
@ -5825,13 +5830,16 @@ end_with_restore_list:
if (tx_release)
thd->set_killed(KILL_CONNECTION);
#ifdef WITH_WSREP
if (WSREP(thd) && thd->wsrep_conflict_state != NO_CONFLICT)
{
DBUG_ASSERT(thd->is_error()); // the error is already issued
}
else
if (WSREP(thd)) {
if (thd->wsrep_conflict_state == NO_CONFLICT) {
my_ok(thd);
}
} else {
#endif /* WITH_WSREP */
my_ok(thd);
#ifdef WITH_WSREP
}
#endif /* WITH_WSREP */
my_ok(thd);
break;
}
case SQLCOM_RELEASE_SAVEPOINT:
@ -6288,8 +6296,9 @@ finish:
trans_rollback_stmt(thd);
}
#ifdef WITH_WSREP
else if (thd->spcont &&
if (thd->spcont &&
(thd->wsrep_conflict_state == MUST_ABORT ||
thd->wsrep_conflict_state == ABORTED ||
thd->wsrep_conflict_state == CERT_FAILURE))
{
/*
@ -8773,13 +8782,13 @@ void add_join_natural(TABLE_LIST *a, TABLE_LIST *b, List<String> *using_fields,
/**
Find a thread by id and return it, locking it LOCK_thd_data
Find a thread by id and return it, locking it LOCK_thd_kill
@param id Identifier of the thread we're looking for
@param query_id If true, search by query_id instead of thread_id
@return NULL - not found
pointer - thread found, and its LOCK_thd_data is locked.
pointer - thread found, and its LOCK_thd_kill is locked.
*/
THD *find_thread_by_id(longlong id, bool query_id)
@ -8793,7 +8802,7 @@ THD *find_thread_by_id(longlong id, bool query_id)
continue;
if (id == (query_id ? tmp->query_id : (longlong) tmp->thread_id))
{
mysql_mutex_lock(&tmp->LOCK_thd_data); // Lock from delete
mysql_mutex_lock(&tmp->LOCK_thd_kill); // Lock from delete
break;
}
}
@ -8849,13 +8858,13 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ
thd->security_ctx->user_matches(tmp->security_ctx)) &&
!wsrep_thd_is_BF(tmp, true))
{
tmp->awake(kill_signal);
tmp->awake_no_mutex(kill_signal);
error=0;
}
else
error= (type == KILL_TYPE_QUERY ? ER_KILL_QUERY_DENIED_ERROR :
ER_KILL_DENIED_ERROR);
mysql_mutex_unlock(&tmp->LOCK_thd_data);
mysql_mutex_unlock(&tmp->LOCK_thd_kill);
}
DBUG_PRINT("exit", ("%d", error));
DBUG_RETURN(error);
@ -8913,7 +8922,7 @@ static uint kill_threads_for_user(THD *thd, LEX_USER *user,
DBUG_RETURN(ER_KILL_DENIED_ERROR);
}
if (!threads_to_kill.push_back(tmp, thd->mem_root))
mysql_mutex_lock(&tmp->LOCK_thd_data); // Lock from delete
mysql_mutex_lock(&tmp->LOCK_thd_kill); // Lock from delete
}
}
mysql_mutex_unlock(&LOCK_thread_count);
@ -8924,17 +8933,17 @@ static uint kill_threads_for_user(THD *thd, LEX_USER *user,
THD *ptr= it2++;
do
{
ptr->awake(kill_signal);
ptr->awake_no_mutex(kill_signal);
/*
Careful here: The list nodes are allocated on the memroots of the
THDs to be awakened.
But those THDs may be terminated and deleted as soon as we release
LOCK_thd_data, which will make the list nodes invalid.
LOCK_thd_kill, which will make the list nodes invalid.
Since the operation "it++" dereferences the "next" pointer of the
previous list node, we need to do this while holding LOCK_thd_data.
previous list node, we need to do this while holding LOCK_thd_kill.
*/
next_ptr= it2++;
mysql_mutex_unlock(&ptr->LOCK_thd_data);
mysql_mutex_unlock(&ptr->LOCK_thd_kill);
(*rows)++;
} while ((ptr= next_ptr));
}

View File

@ -3344,7 +3344,7 @@ void kill_zombie_dump_threads(uint32 slave_server_id)
if (tmp->get_command() == COM_BINLOG_DUMP &&
tmp->variables.server_id == slave_server_id)
{
mysql_mutex_lock(&tmp->LOCK_thd_data); // Lock from delete
mysql_mutex_lock(&tmp->LOCK_thd_kill); // Lock from delete
break;
}
}
@ -3356,8 +3356,8 @@ void kill_zombie_dump_threads(uint32 slave_server_id)
it will be slow because it will iterate through the list
again. We just to do kill the thread ourselves.
*/
tmp->awake(KILL_SLAVE_SAME_ID);
mysql_mutex_unlock(&tmp->LOCK_thd_data);
tmp->awake_no_mutex(KILL_SLAVE_SAME_ID);
mysql_mutex_unlock(&tmp->LOCK_thd_kill);
}
}

View File

@ -137,6 +137,29 @@ static const LEX_CSTRING *view_algorithm(TABLE_LIST *table);
bool get_lookup_field_values(THD *, COND *, TABLE_LIST *, LOOKUP_FIELD_VALUES *);
/**
Try to lock a mutex, but give up after a short while to not cause deadlocks
The loop is short, as the mutex we are trying to lock are mutex the should
never be locked a long time, just over a few instructions.
@return 0 ok
@return 1 error
*/
static bool trylock_short(mysql_mutex_t *mutex)
{
uint i;
for (i= 0 ; i < 100 ; i++)
{
if (!mysql_mutex_trylock(mutex))
return 0;
LF_BACKOFF();
}
return 1;
}
/***************************************************************************
** List all table types supported
***************************************************************************/
@ -790,6 +813,57 @@ static void dispose_db_dir(void *ptr)
}
/*
Append an element into @@ignore_db_dirs
This is a function to be called after regular option processing has been
finalized.
*/
void ignore_db_dirs_append(const char *dirname_arg)
{
char *new_entry_buf;
LEX_STRING *new_entry;
size_t len= strlen(dirname_arg);
if (!my_multi_malloc(0,
&new_entry, sizeof(LEX_STRING),
&new_entry_buf, len + 1,
NullS))
return;
memcpy(new_entry_buf, dirname_arg, len+1);
new_entry->str = new_entry_buf;
new_entry->length= len;
if (my_hash_insert(&ignore_db_dirs_hash, (uchar *)new_entry))
{
// Either the name is already there or out-of-memory.
my_free(new_entry);
return;
}
// Append the name to the option string.
size_t curlen= strlen(opt_ignore_db_dirs);
// Add one for comma and one for \0.
size_t newlen= curlen + len + 1 + 1;
char *new_db_dirs;
if (!(new_db_dirs= (char*)my_malloc(newlen ,MYF(0))))
{
// This is not a critical condition
return;
}
memcpy(new_db_dirs, opt_ignore_db_dirs, curlen);
if (curlen != 0)
new_db_dirs[curlen]=',';
memcpy(new_db_dirs + (curlen + ((curlen!=0)?1:0)), dirname_arg, len+1);
if (opt_ignore_db_dirs)
my_free(opt_ignore_db_dirs);
opt_ignore_db_dirs= new_db_dirs;
}
bool
ignore_db_dirs_process_additions()
{
@ -2566,23 +2640,28 @@ static const char *thread_state_info(THD *tmp)
{
if (tmp->net.reading_or_writing == 2)
return "Writing to net";
else if (tmp->get_command() == COM_SLEEP)
if (tmp->get_command() == COM_SLEEP)
return "";
else
return "Reading from net";
return "Reading from net";
}
else
#endif
if (tmp->proc_info)
return tmp->proc_info;
/* Check if we are waiting on a condition */
if (!trylock_short(&tmp->LOCK_thd_kill))
{
if (tmp->proc_info)
return tmp->proc_info;
else if (tmp->mysys_var && tmp->mysys_var->current_cond)
/* mysys_var is protected by above mutex */
bool cond= tmp->mysys_var && tmp->mysys_var->current_cond;
mysql_mutex_unlock(&tmp->LOCK_thd_kill);
if (cond)
return "Waiting on cond";
else
return NULL;
}
return NULL;
}
void mysqld_list_processes(THD *thd,const char *user, bool verbose)
{
Item *field;
@ -2645,7 +2724,7 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
while ((tmp=it++))
{
Security_context *tmp_sctx= tmp->security_ctx;
struct st_my_thread_var *mysys_var;
bool got_thd_data;
if ((tmp->vio_ok() || tmp->system_thread) &&
(!user || (!tmp->system_thread &&
tmp_sctx->user && !strcmp(tmp_sctx->user, user))))
@ -2669,48 +2748,59 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
tmp_sctx->host_or_ip :
tmp_sctx->host ? tmp_sctx->host : "");
thd_info->command=(int) tmp->get_command();
mysql_mutex_lock(&tmp->LOCK_thd_data);
if ((thd_info->db= tmp->db)) // Safe test
thd_info->db= thd->strdup(thd_info->db);
if ((mysys_var= tmp->mysys_var))
mysql_mutex_lock(&mysys_var->mutex);
thd_info->proc_info= (char*) (tmp->killed >= KILL_QUERY ?
"Killed" : 0);
thd_info->state_info= thread_state_info(tmp);
if (mysys_var)
mysql_mutex_unlock(&mysys_var->mutex);
/* Lock THD mutex that protects its data when looking at it. */
if (tmp->query())
if ((got_thd_data= !trylock_short(&tmp->LOCK_thd_data)))
{
uint length= MY_MIN(max_query_length, tmp->query_length());
char *q= thd->strmake(tmp->query(),length);
/* Safety: in case strmake failed, we set length to 0. */
thd_info->query_string=
CSET_STRING(q, q ? length : 0, tmp->query_charset());
}
/* This is an approximation */
thd_info->proc_info= (char*) (tmp->killed >= KILL_QUERY ?
"Killed" : 0);
/*
The following variables are only safe to access under a lock
*/
/*
Progress report. We need to do this under a lock to ensure that all
is from the same stage.
*/
if (tmp->progress.max_counter)
{
uint max_stage= MY_MAX(tmp->progress.max_stage, 1);
thd_info->progress= (((tmp->progress.stage / (double) max_stage) +
((tmp->progress.counter /
(double) tmp->progress.max_counter) /
(double) max_stage)) *
100.0);
set_if_smaller(thd_info->progress, 100);
if ((thd_info->db= tmp->db)) // Safe test
thd_info->db= thd->strdup(thd_info->db);
if (tmp->query())
{
uint length= MY_MIN(max_query_length, tmp->query_length());
char *q= thd->strmake(tmp->query(),length);
/* Safety: in case strmake failed, we set length to 0. */
thd_info->query_string=
CSET_STRING(q, q ? length : 0, tmp->query_charset());
}
/*
Progress report. We need to do this under a lock to ensure that all
is from the same stage.
*/
if (tmp->progress.max_counter)
{
uint max_stage= MY_MAX(tmp->progress.max_stage, 1);
thd_info->progress= (((tmp->progress.stage / (double) max_stage) +
((tmp->progress.counter /
(double) tmp->progress.max_counter) /
(double) max_stage)) *
100.0);
set_if_smaller(thd_info->progress, 100);
}
else
thd_info->progress= 0.0;
}
else
{
thd_info->proc_info= "Busy";
thd_info->progress= 0.0;
}
thd_info->state_info= thread_state_info(tmp);
thd_info->start_time= tmp->start_utime;
ulonglong utime_after_query_snapshot= tmp->utime_after_query;
if (thd_info->start_time < utime_after_query_snapshot)
thd_info->start_time= utime_after_query_snapshot; // COM_SLEEP
mysql_mutex_unlock(&tmp->LOCK_thd_data);
if (got_thd_data)
mysql_mutex_unlock(&tmp->LOCK_thd_data);
thread_infos.append(thd_info);
}
}
@ -2921,13 +3011,13 @@ int fill_show_explain(THD *thd, TABLE_LIST *table, COND *cond)
tmp_sctx->user)))
{
my_error(ER_SPECIFIC_ACCESS_DENIED_ERROR, MYF(0), "PROCESS");
mysql_mutex_unlock(&tmp->LOCK_thd_data);
mysql_mutex_unlock(&tmp->LOCK_thd_kill);
DBUG_RETURN(1);
}
if (tmp == thd)
{
mysql_mutex_unlock(&tmp->LOCK_thd_data);
mysql_mutex_unlock(&tmp->LOCK_thd_kill);
my_error(ER_TARGET_NOT_EXPLAINABLE, MYF(0));
DBUG_RETURN(1);
}
@ -2935,7 +3025,7 @@ int fill_show_explain(THD *thd, TABLE_LIST *table, COND *cond)
bool bres;
/*
Ok we've found the thread of interest and it won't go away because
we're holding its LOCK_thd data. Post it a SHOW EXPLAIN request.
we're holding its LOCK_thd_kill. Post it a SHOW EXPLAIN request.
*/
bool timed_out;
int timeout_sec= 30;
@ -2949,7 +3039,7 @@ int fill_show_explain(THD *thd, TABLE_LIST *table, COND *cond)
explain_req.request_thd= thd;
explain_req.failed_to_produce= FALSE;
/* Ok, we have a lock on target->LOCK_thd_data, can call: */
/* Ok, we have a lock on target->LOCK_thd_kill, can call: */
bres= tmp->apc_target.make_apc_call(thd, &explain_req, timeout_sec, &timed_out);
if (bres || explain_req.failed_to_produce)
@ -3028,9 +3118,9 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
while ((tmp= it++))
{
Security_context *tmp_sctx= tmp->security_ctx;
struct st_my_thread_var *mysys_var;
const char *val, *db;
ulonglong max_counter;
bool got_thd_data;
if ((!tmp->vio_ok() && !tmp->system_thread) ||
(user && (tmp->system_thread || !tmp_sctx->user ||
@ -3056,23 +3146,26 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
else
table->field[2]->store(tmp_sctx->host_or_ip,
strlen(tmp_sctx->host_or_ip), cs);
/* DB */
mysql_mutex_lock(&tmp->LOCK_thd_data);
if ((db= tmp->db))
if ((got_thd_data= !trylock_short(&tmp->LOCK_thd_data)))
{
table->field[3]->store(db, strlen(db), cs);
table->field[3]->set_notnull();
/* DB */
if ((db= tmp->db))
{
table->field[3]->store(db, strlen(db), cs);
table->field[3]->set_notnull();
}
}
if ((mysys_var= tmp->mysys_var))
mysql_mutex_lock(&mysys_var->mutex);
/* COMMAND */
if ((val= (char *) ((tmp->killed >= KILL_QUERY ?
if ((val= (char *) (!got_thd_data ? "Busy" :
(tmp->killed >= KILL_QUERY ?
"Killed" : 0))))
table->field[4]->store(val, strlen(val), cs);
else
table->field[4]->store(command_name[tmp->get_command()].str,
command_name[tmp->get_command()].length, cs);
/* MYSQL_TIME */
ulonglong utime= tmp->start_utime;
ulonglong utime_after_query_snapshot= tmp->utime_after_query;
@ -3081,6 +3174,38 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
utime= utime && utime < unow ? unow - utime : 0;
table->field[5]->store(utime / HRTIME_RESOLUTION, TRUE);
if (got_thd_data)
{
if (tmp->query())
{
table->field[7]->store(tmp->query(),
MY_MIN(PROCESS_LIST_INFO_WIDTH,
tmp->query_length()), cs);
table->field[7]->set_notnull();
/* INFO_BINARY */
table->field[16]->store(tmp->query(),
MY_MIN(PROCESS_LIST_INFO_WIDTH,
tmp->query_length()),
&my_charset_bin);
table->field[16]->set_notnull();
}
/*
Progress report. We need to do this under a lock to ensure that all
is from the same stage.
*/
if ((max_counter= tmp->progress.max_counter))
{
table->field[9]->store((longlong) tmp->progress.stage + 1, 1);
table->field[10]->store((longlong) tmp->progress.max_stage, 1);
table->field[11]->store((double) tmp->progress.counter /
(double) max_counter*100.0);
}
mysql_mutex_unlock(&tmp->LOCK_thd_data);
}
/* STATE */
if ((val= thread_state_info(tmp)))
{
@ -3088,46 +3213,9 @@ int fill_schema_processlist(THD* thd, TABLE_LIST* tables, COND* cond)
table->field[6]->set_notnull();
}
if (mysys_var)
mysql_mutex_unlock(&mysys_var->mutex);
mysql_mutex_unlock(&tmp->LOCK_thd_data);
/* TIME_MS */
table->field[8]->store((double)(utime / (HRTIME_RESOLUTION / 1000.0)));
/* INFO */
/* Lock THD mutex that protects its data when looking at it. */
mysql_mutex_lock(&tmp->LOCK_thd_data);
if (tmp->query())
{
table->field[7]->store(tmp->query(),
MY_MIN(PROCESS_LIST_INFO_WIDTH,
tmp->query_length()), cs);
table->field[7]->set_notnull();
}
/* INFO_BINARY */
if (tmp->query())
{
table->field[16]->store(tmp->query(),
MY_MIN(PROCESS_LIST_INFO_WIDTH,
tmp->query_length()), &my_charset_bin);
table->field[16]->set_notnull();
}
/*
Progress report. We need to do this under a lock to ensure that all
is from the same stage.
*/
if ((max_counter= tmp->progress.max_counter))
{
table->field[9]->store((longlong) tmp->progress.stage + 1, 1);
table->field[10]->store((longlong) tmp->progress.max_stage, 1);
table->field[11]->store((double) tmp->progress.counter /
(double) max_counter*100.0);
}
mysql_mutex_unlock(&tmp->LOCK_thd_data);
/*
This may become negative if we free a memory allocated by another
thread in this thread. However it's better that we notice it eventually

View File

@ -5163,7 +5163,8 @@ static Sys_var_mybool Sys_wsrep_on (
"wsrep_on", "To enable wsrep replication ",
SESSION_VAR(wsrep_on),
CMD_LINE(OPT_ARG), DEFAULT(FALSE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_on_check),
ON_UPDATE(wsrep_on_update));
static Sys_var_charptr Sys_wsrep_start_position (

View File

@ -250,7 +250,7 @@ static THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data)
}
delete connect;
add_to_active_threads(thd);
thd->mysys_var= mysys_var;
thd->set_mysys_var(mysys_var);
thd->event_scheduler.data= scheduler_data;
/* Create new PSI thread for use with the THD. */
@ -477,11 +477,11 @@ void tp_timeout_handler(TP_connection *c)
if (c->state != TP_STATE_IDLE)
return;
THD *thd=c->thd;
mysql_mutex_lock(&thd->LOCK_thd_data);
mysql_mutex_lock(&thd->LOCK_thd_kill);
thd->set_killed(KILL_WAIT_TIMEOUT);
c->priority= TP_PRIORITY_HIGH;
post_kill_notification(thd);
mysql_mutex_unlock(&thd->LOCK_thd_data);
mysql_mutex_unlock(&thd->LOCK_thd_kill);
}

View File

@ -2492,9 +2492,7 @@ extern "C" void wsrep_thd_awake(THD *thd, my_bool signal)
{
if (signal)
{
mysql_mutex_lock(&thd->LOCK_thd_data);
thd->awake(KILL_QUERY);
mysql_mutex_unlock(&thd->LOCK_thd_data);
}
else
{

View File

@ -42,12 +42,28 @@ int wsrep_init_vars()
return 0;
}
extern ulong innodb_lock_schedule_algorithm;
bool wsrep_on_update (sys_var *self, THD* thd, enum_var_type var_type)
{
if (var_type == OPT_GLOBAL) {
// FIXME: this variable probably should be changed only per session
thd->variables.wsrep_on = global_system_variables.wsrep_on;
}
return false;
}
bool wsrep_on_check(sys_var *self, THD* thd, set_var* var)
{
bool new_wsrep_on= (bool)var->save_result.ulonglong_value;
if (new_wsrep_on && innodb_lock_schedule_algorithm != 0) {
my_message(ER_WRONG_ARGUMENTS, " WSREP (galera) can't be enabled "
"if innodb_lock_schedule_algorithm=VATS. Please configure"
" innodb_lock_schedule_algorithm=FCFS and restart.", MYF(0));
return true;
}
return false;
}

View File

@ -41,7 +41,8 @@ int wsrep_init_vars();
#define DEFAULT_ARGS (THD* thd, enum_var_type var_type)
#define INIT_ARGS (const char* opt)
extern bool wsrep_causal_reads_update UPDATE_ARGS;
extern bool wsrep_causal_reads_update UPDATE_ARGS;
extern bool wsrep_on_check CHECK_ARGS;
extern bool wsrep_on_update UPDATE_ARGS;
extern bool wsrep_sync_wait_update UPDATE_ARGS;
extern bool wsrep_start_position_check CHECK_ARGS;

View File

@ -831,6 +831,7 @@ DECLARE_THREAD(btr_defragment_thread)(void*)
mtr_commit(&mtr);
/* Reaching the end of the index. */
dict_stats_empty_defrag_stats(index);
trx->error_state = DB_SUCCESS;
ut_d(trx->persistent_stats = true);
++trx->will_lock;
dberr_t err = dict_stats_save_defrag_stats(index, trx);

View File

@ -213,6 +213,7 @@ dict_stats_process_entry_from_defrag_pool(trx_t* trx)
index_id_t index_id;
ut_ad(!srv_read_only_mode);
ut_ad(trx->persistent_stats);
/* pop the first index from the auto defrag pool */
if (!dict_stats_defrag_pool_get(&table_id, &index_id)) {
@ -242,6 +243,7 @@ dict_stats_process_entry_from_defrag_pool(trx_t* trx)
}
mutex_exit(&dict_sys->mutex);
trx->error_state = DB_SUCCESS;
++trx->will_lock;
dberr_t err = dict_stats_save_defrag_stats(index, trx);
@ -275,6 +277,8 @@ dict_defrag_process_entries_from_defrag_pool(trx_t* trx)
dberr_t
dict_stats_save_defrag_summary(dict_index_t* index, trx_t* trx)
{
ut_ad(trx->persistent_stats);
if (dict_index_is_ibuf(index)) {
return DB_SUCCESS;
}
@ -294,6 +298,9 @@ dict_stats_save_defrag_summary(dict_index_t* index, trx_t* trx)
dberr_t
dict_stats_save_defrag_stats(dict_index_t* index, trx_t* trx)
{
ut_ad(trx->error_state == DB_SUCCESS);
ut_ad(trx->persistent_stats);
if (dict_index_is_ibuf(index)) {
return DB_SUCCESS;
}
@ -318,7 +325,7 @@ dict_stats_save_defrag_stats(dict_index_t* index, trx_t* trx)
return DB_SUCCESS;
}
lint now = ut_time();
ib_time_t now = ut_time();
dberr_t err = dict_stats_save_index_stat(
index, now, "n_page_split",
index->stat_defrag_n_page_split,

Some files were not shown because too many files have changed in this diff Show More