Merge remote-tracking branch 'origin/5.5-galera' into 10.0-galera

This commit is contained in:
Jan Lindström 2018-05-07 13:49:14 +03:00
commit 648cf7176c
118 changed files with 1536 additions and 473 deletions

1
.gitignore vendored
View File

@ -114,6 +114,7 @@ scripts/mytop
scripts/wsrep_sst_common
scripts/wsrep_sst_mysqldump
scripts/wsrep_sst_rsync
scripts/wsrep_sst_rsync_wan
scripts/wsrep_sst_xtrabackup
scripts/wsrep_sst_xtrabackup-v2
sql-bench/bench-count-distinct

View File

@ -788,6 +788,16 @@ int DoProcessReply(SSL& ssl)
needHdr = true;
else {
buffer >> hdr;
/*
According to RFC 4346 (see "7.4.1.3. Server Hello"), the Server Hello
packet needs to specify the highest supported TLS version, but not
higher than what client requests. YaSSL highest supported version is
TLSv1.1 (=3.2) - if the client requests a higher version, downgrade it
here to 3.2.
See also Appendix E of RFC 5246 (TLS 1.2)
*/
if (hdr.version_.major_ == 3 && hdr.version_.minor_ > 2)
hdr.version_.minor_ = 2;
ssl.verifyState(hdr);
}

View File

@ -144,6 +144,7 @@ typedef struct st_heap_share
uint key_version; /* Updated on key change */
uint file_version; /* Update on clear */
uint reclength; /* Length of one record */
uint visible; /* Offset to the visible/deleted mark */
uint changed;
uint keys,max_key_length;
uint currently_disabled_keys; /* saved value from "keys" when disabled */

View File

@ -35,6 +35,8 @@
# define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
#elif defined(__SANITIZE_ADDRESS__)
# include <sanitizer/asan_interface.h>
/* How to do manual poisoning:
https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
# define MEM_UNDEFINED(a,len) ASAN_UNPOISON_MEMORY_REGION(a,len)
# define MEM_NOACCESS(a,len) ASAN_POISON_MEMORY_REGION(a,len)
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
Copyright (c) 2010, 2013, Monty Program Ab
Copyright (c) 2010, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,7 +1,7 @@
#ifndef SQL_COMMON_INCLUDED
#define SQL_COMMON_INCLUDED
/* Copyright (c) 2003, 2012, Oracle and/or its affiliates.
Copyright (c) 2010, 2012, Monty Program Ab
Copyright (c) 2010, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2,7 +2,7 @@
# -*- cperl -*-
# Copyright (c) 2004, 2014, Oracle and/or its affiliates.
# Copyright (c) 2009, 2017, MariaDB Corporation
# Copyright (c) 2009, 2018, MariaDB Corporation
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -0,0 +1,5 @@
set @old_dbug=@@global.debug_dbug;
set global debug_dbug='+d,auth_disconnect';
create user 'bad' identified by 'worse';
set global debug_dbug=@old_dbug;
drop user bad;

View File

@ -4590,6 +4590,37 @@ Field Type Null Key Default Extra
c1 mediumtext YES NULL
DROP TABLE t1;
#
# MDEV-15624 Changing the default character set to utf8mb4 changes query evaluation in a very surprising way
#
SET NAMES utf8;
CREATE TABLE t1 (id INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT COUNT(DISTINCT c) FROM (SELECT id, REPLACE(uuid_short(), '0', CAST('o' AS CHAR CHARACTER SET ucs2)) AS c FROM t1) AS d1;
COUNT(DISTINCT c)
3
SELECT DISTINCT REPLACE(uuid_short(), '0', CAST('o' AS CHAR CHARACTER SET ucs2)) AS c FROM t1;
c
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx
SELECT COUNT(DISTINCT c) FROM (SELECT id, INSERT(uuid_short(), 1, 1, CAST('0' AS CHAR CHARACTER SET ucs2)) AS c FROM t1) AS d1;
COUNT(DISTINCT c)
3
SELECT DISTINCT INSERT(uuid_short(), 1, 1, CAST('0' AS CHAR CHARACTER SET ucs2)) AS c FROM t1;
c
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx
SELECT COUNT(DISTINCT c) FROM (SELECT id, CONCAT(uuid_short(), CAST('0' AS CHAR CHARACTER SET ucs2)) AS c FROM t1) AS d1;
COUNT(DISTINCT c)
3
SELECT DISTINCT CONCAT(uuid_short(), CAST('0' AS CHAR CHARACTER SET ucs2)) AS c FROM t1;
c
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx
DROP TABLE t1;
#
# End of 5.5 tests
#
#

View File

@ -2859,6 +2859,29 @@ SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65536) AS data ) AS sub;
len
196608
#
# MDEV-15624 Changing the default character set to utf8mb4 changes query evaluation in a very surprising way
#
SET NAMES utf8mb4;
CREATE TABLE t1 (id INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT COUNT(DISTINCT c) FROM (SELECT id, REPLACE(UUID(), "-", "") AS c FROM t1) AS d1;
COUNT(DISTINCT c)
3
SELECT DISTINCT INSERT(uuid(), 9, 1, "X") AS c FROM t1;
c
xxxxxxxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx
xxxxxxxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx
xxxxxxxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx
SELECT COUNT(DISTINCT c) FROM (SELECT id, INSERT(UUID(), 9, 1, "X") AS c FROM t1) AS d1;
COUNT(DISTINCT c)
3
SELECT DISTINCT INSERT(UUID(), 9, 1, "X") AS c FROM t1;
c
xxxxxxxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx
xxxxxxxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx
xxxxxxxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx
DROP TABLE t1;
#
# End of 5.5 tests
#
#

View File

@ -571,6 +571,17 @@ AND 57813X540X1723 = 'Test';
N AVG
0 NULL
drop table t1;
#
# MDEV-15630 uuid() function evaluates at wrong time in query
#
CREATE TABLE t1 (id INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT COUNT(1), UUID() as uid FROM t1 GROUP BY uid;
COUNT(1) uid
1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
DROP TABLE t1;
SELECT NAME_CONST('a', -(1 OR 2)) OR 1;
ERROR HY000: Incorrect arguments to NAME_CONST
SELECT NAME_CONST('a', -(1 AND 2)) OR 1;

View File

@ -2349,11 +2349,27 @@ CREATE TABLE t1 (b1 BIT NOT NULL);
INSERT INTO t1 VALUES (0),(1);
CREATE TABLE t2 (b2 BIT NOT NULL);
INSERT INTO t2 VALUES (0),(1);
SET SESSION JOIN_CACHE_LEVEL = 3;
set @save_join_cache_level= @@join_cache_level;
SET @@join_cache_level = 3;
SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2;
t1.b1+'0' t2.b2 + '0'
0 0
1 1
DROP TABLE t1, t2;
set @join_cache_level= @save_join_cache_level;
#
# MDEV-14779: using left join causes incorrect results with materialization and derived tables
#
create table t1(id int);
insert into t1 values (1),(2);
create table t2(sid int, id int);
insert into t2 values (1,1),(2,2);
select * from t1 t
left join (select * from t2 where sid in (select max(sid) from t2 where 0=1 group by id)) r
on t.id=r.id ;
id sid id
1 NULL NULL
2 NULL NULL
drop table t1, t2;
# end of 5.5 tests
SET optimizer_switch=@save_optimizer_switch;

View File

@ -2360,12 +2360,28 @@ CREATE TABLE t1 (b1 BIT NOT NULL);
INSERT INTO t1 VALUES (0),(1);
CREATE TABLE t2 (b2 BIT NOT NULL);
INSERT INTO t2 VALUES (0),(1);
SET SESSION JOIN_CACHE_LEVEL = 3;
set @save_join_cache_level= @@join_cache_level;
SET @@join_cache_level = 3;
SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2;
t1.b1+'0' t2.b2 + '0'
0 0
1 1
DROP TABLE t1, t2;
set @join_cache_level= @save_join_cache_level;
#
# MDEV-14779: using left join causes incorrect results with materialization and derived tables
#
create table t1(id int);
insert into t1 values (1),(2);
create table t2(sid int, id int);
insert into t2 values (1,1),(2,2);
select * from t1 t
left join (select * from t2 where sid in (select max(sid) from t2 where 0=1 group by id)) r
on t.id=r.id ;
id sid id
1 NULL NULL
2 NULL NULL
drop table t1, t2;
# end of 5.5 tests
SET optimizer_switch=@save_optimizer_switch;
set join_cache_level=default;

View File

@ -1147,8 +1147,8 @@ The following options may be given as the first argument:
--wsrep-sync-wait[=#]
Ensure "synchronous" read view before executing an
operation of the type specified by bitmask: 1 -
READ(includes SELECT, SHOW and BEGIN/START TRANSACTION);
2 - UPDATE and DELETE; 4 - INSERT and REPLACE
READ(includes SELECT and BEGIN/START TRANSACTION); 2 -
UPDATE and DELETE; 4 - INSERT and REPLACE; 8 - SHOW
Variables (--variable-name=value)
allow-suspicious-udfs FALSE

View File

@ -672,3 +672,10 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
PREPARE stmt FROM 'CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\\';
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '\' at line 1
DROP TABLE t1;
#
# MDEV-15620 Crash when using "SET @@NEW.a=expr" inside a trigger
#
CREATE TABLE t1 (a INT);
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @@NEW.a=0;
ERROR HY000: Unknown system variable 'NEW'
DROP TABLE t1;

View File

@ -0,0 +1,23 @@
#
# MDEV-15492: Subquery crash similar to MDEV-10050
#
SET @qcs.save= @@global.query_cache_size, @qct.save= @@global.query_cache_type;
SET GLOBAL query_cache_size= 512*1024*1024, query_cache_type= ON;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (b INT) ENGINE=InnoDB;
CREATE VIEW v AS select a from t1 join t2;
PREPARE stmt1 FROM "SELECT * FROM t1 WHERE a in (SELECT a FROM v)";
PREPARE stmt2 FROM "SELECT * FROM t1 WHERE a in (SELECT a FROM v)";
EXECUTE stmt2;
a
EXECUTE stmt1;
a
INSERT INTO t2 VALUES (0);
EXECUTE stmt1;
a
START TRANSACTION;
EXECUTE stmt1;
a
DROP VIEW v;
DROP TABLE t1, t2;
SET GLOBAL query_cache_size= @qcs.save, query_cache_type= @qct.save;

View File

@ -1043,7 +1043,7 @@ EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
f1 f2
SET @@optimizer_switch = 'materialization=off,in_to_exists=on,semijoin=off';
@ -1134,7 +1134,7 @@ EXPLAIN
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL No matching min/max row
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
SELECT * FROM t1 WHERE (2, 0) NOT IN (SELECT min(f3)+f3, min(f4)+f3+max(f4) FROM t2 WHERE f3 > 10);
f1 f2
set @@optimizer_switch=@save_optimizer_switch;
@ -2485,5 +2485,36 @@ FROM t2 WHERE b <= 'quux' GROUP BY field;
field COUNT(DISTINCT c)
0 1
drop table t1,t2;
#
# MDEV-15555: select from DUAL where false yielding wrong result when in a IN
#
explain
SELECT 2 IN (SELECT 2 from DUAL WHERE 1 != 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
SELECT 2 IN (SELECT 2 from DUAL WHERE 1 != 1);
2 IN (SELECT 2 from DUAL WHERE 1 != 1)
0
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;
#
# mfrv-14515: Wrong results for tableless query with subquery in WHERE
# and implicit aggregation
#
create table t1 (i1 int, i2 int);
insert into t1 values (1314, 1084),(1330, 1084),(1401, 1084),(580, 1084);
create table t2 (cd int);
insert into t2 values
(1330), (1330), (1330), (1330), (1330), (1330), (1330), (1330),
(1330), (1330), (1330), (1330), (1330), (1330), (1330), (1330);
select max(10) from dual
where exists (select 1 from t2 join t1 on t1.i1 = t2.cd and t1.i2 = 345);
max(10)
NULL
insert into t2 select * from t2;
select max(10) from dual
where exists (select 1 from t2 join t1 on t1.i1 = t2.cd and t1.i2 = 345);
max(10)
NULL
DROP TABLE t1,t2;

View File

@ -2714,3 +2714,18 @@ a b sq
4 4 1
4 2 1
drop table t1, t2;
#
# MDEV-15235: Assertion `length > 0' failed in create_ref_for_key
#
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f CHAR(1));
INSERT INTO t2 VALUES ('a'),('b');
explain
SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2
SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
f
DROP TABLE t1, t2;

View File

@ -5236,114 +5236,6 @@ execute stmt1;
deallocate prepare stmt1;
drop view v1,v2;
drop table t1,t2;
#
# MDEV-6251: SIGSEGV in query optimizer (in set_check_materialized
# with MERGE view)
#
CREATE TABLE t1 (a1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t2 (b1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t3 (c1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t4 (d1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t5 (e1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t6 (f1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE OR REPLACE view v1 AS
SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
;
SELECT 1
FROM (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t1)
LEFT OUTER JOIN (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t2) ON 1=1
LEFT OUTER JOIN (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t3) ON 1=1
LEFT OUTER JOIN (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t4) ON 1=1
LEFT OUTER JOIN (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t5) ON 1=1
LEFT OUTER JOIN (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t6) ON 1=1
LEFT OUTER JOIN (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t7) ON 1=1
LEFT OUTER JOIN (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t8) ON 1=1
;
1
SELECT 1
FROM (v1 t1)
LEFT OUTER JOIN (v1 t2) ON 1=1
LEFT OUTER JOIN (v1 t3) ON 1=1
LEFT OUTER JOIN (v1 t4) ON 1=1
LEFT OUTER JOIN (v1 t5) ON 1=1
LEFT OUTER JOIN (v1 t6) ON 1=1
LEFT OUTER JOIN (v1 t7) ON 1=1
LEFT OUTER JOIN (v1 t8) ON 1=1
;
1
drop view v1;
drop table t1,t2,t3,t4,t5,t6;
# -----------------------------------------------------------------
# -- End of 5.3 tests.
# -----------------------------------------------------------------
@ -5644,6 +5536,203 @@ View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select group_concat(`t1`.`str` separator '\\') AS `GROUP_CONCAT(str SEPARATOR '\\')` from `t1` latin1 latin1_swedish_ci
drop view v1;
drop table t1;
CREATE TABLE IF NOT EXISTS t0 (f0 INT);
CREATE TABLE IF NOT EXISTS t1 (f1 INT);
CREATE TABLE IF NOT EXISTS t2 (f2 INT);
CREATE TABLE IF NOT EXISTS t3 (f3 INT);
CREATE TABLE IF NOT EXISTS t4 (f4 INT);
CREATE TABLE IF NOT EXISTS t5 (f5 INT);
CREATE TABLE IF NOT EXISTS t6 (f6 INT);
CREATE TABLE IF NOT EXISTS t7 (f7 INT);
CREATE TABLE IF NOT EXISTS t8 (f8 INT);
CREATE TABLE IF NOT EXISTS t9 (f9 INT);
CREATE TABLE IF NOT EXISTS t10 (f10 INT);
CREATE TABLE IF NOT EXISTS t11 (f11 INT);
CREATE TABLE IF NOT EXISTS t12 (f12 INT);
CREATE TABLE IF NOT EXISTS t13 (f13 INT);
CREATE TABLE IF NOT EXISTS t14 (f14 INT);
CREATE TABLE IF NOT EXISTS t15 (f15 INT);
CREATE TABLE IF NOT EXISTS t16 (f16 INT);
CREATE TABLE IF NOT EXISTS t17 (f17 INT);
CREATE TABLE IF NOT EXISTS t18 (f18 INT);
CREATE TABLE IF NOT EXISTS t19 (f19 INT);
CREATE TABLE IF NOT EXISTS t20 (f20 INT);
CREATE TABLE IF NOT EXISTS t21 (f21 INT);
CREATE TABLE IF NOT EXISTS t22 (f22 INT);
CREATE TABLE IF NOT EXISTS t23 (f23 INT);
CREATE TABLE IF NOT EXISTS t24 (f24 INT);
CREATE TABLE IF NOT EXISTS t25 (f25 INT);
CREATE TABLE IF NOT EXISTS t26 (f26 INT);
CREATE TABLE IF NOT EXISTS t27 (f27 INT);
CREATE TABLE IF NOT EXISTS t28 (f28 INT);
CREATE TABLE IF NOT EXISTS t29 (f29 INT);
CREATE TABLE IF NOT EXISTS t30 (f30 INT);
CREATE TABLE IF NOT EXISTS t31 (f31 INT);
CREATE TABLE IF NOT EXISTS t32 (f32 INT);
CREATE TABLE IF NOT EXISTS t33 (f33 INT);
CREATE TABLE IF NOT EXISTS t34 (f34 INT);
CREATE TABLE IF NOT EXISTS t35 (f35 INT);
CREATE TABLE IF NOT EXISTS t36 (f36 INT);
CREATE TABLE IF NOT EXISTS t37 (f37 INT);
CREATE TABLE IF NOT EXISTS t38 (f38 INT);
CREATE TABLE IF NOT EXISTS t39 (f39 INT);
CREATE TABLE IF NOT EXISTS t40 (f40 INT);
CREATE TABLE IF NOT EXISTS t41 (f41 INT);
CREATE TABLE IF NOT EXISTS t42 (f42 INT);
CREATE TABLE IF NOT EXISTS t43 (f43 INT);
CREATE TABLE IF NOT EXISTS t44 (f44 INT);
CREATE TABLE IF NOT EXISTS t45 (f45 INT);
CREATE TABLE IF NOT EXISTS t46 (f46 INT);
CREATE TABLE IF NOT EXISTS t47 (f47 INT);
CREATE TABLE IF NOT EXISTS t48 (f48 INT);
CREATE TABLE IF NOT EXISTS t49 (f49 INT);
CREATE TABLE IF NOT EXISTS t50 (f50 INT);
CREATE TABLE IF NOT EXISTS t51 (f51 INT);
CREATE TABLE IF NOT EXISTS t52 (f52 INT);
CREATE TABLE IF NOT EXISTS t53 (f53 INT);
CREATE TABLE IF NOT EXISTS t54 (f54 INT);
CREATE TABLE IF NOT EXISTS t55 (f55 INT);
CREATE TABLE IF NOT EXISTS t56 (f56 INT);
CREATE TABLE IF NOT EXISTS t57 (f57 INT);
CREATE TABLE IF NOT EXISTS t58 (f58 INT);
CREATE TABLE IF NOT EXISTS t59 (f59 INT);
CREATE TABLE IF NOT EXISTS t60 (f60 INT);
CREATE OR REPLACE VIEW v60 AS SELECT * FROM t60;
EXPLAIN
SELECT t0.*
FROM t0
JOIN t1
ON t1.f1 = t0.f0
LEFT JOIN t2
ON t0.f0 = t2.f2
LEFT JOIN t3
ON t0.f0 = t3.f3
LEFT JOIN t4
ON t0.f0 = t4.f4
LEFT JOIN t5
ON t4.f4 = t5.f5
LEFT JOIN t6
ON t0.f0 = t6.f6
LEFT JOIN t7
ON t0.f0 = t7.f7
LEFT JOIN t8
ON t0.f0 = t8.f8
LEFT JOIN t9
ON t0.f0 = t9.f9
LEFT JOIN t10
ON t0.f0 = t10.f10
LEFT JOIN t11
ON t0.f0 = t11.f11
LEFT JOIN t12
ON t0.f0 = t12.f12
LEFT JOIN t13
ON t0.f0 = t13.f13
LEFT JOIN t14
ON t0.f0 = t14.f14
LEFT JOIN t15
ON t0.f0 = t15.f15
LEFT JOIN t16
ON t0.f0 = t16.f16
LEFT JOIN t17
ON t0.f0 = t17.f17
LEFT JOIN t18
ON t0.f0 = t18.f18
LEFT JOIN t19
ON t18.f18 = t19.f19
LEFT JOIN t20
ON t20.f20 = t19.f19
LEFT JOIN t21
ON t20.f20 = t21.f21
LEFT JOIN t22
ON t19.f19 = t22.f22
LEFT JOIN t23
ON t23.f23 = t0.f0
LEFT JOIN t24
ON t24.f24 = t23.f23
LEFT JOIN t25
ON t0.f0 = t25.f25
LEFT JOIN t26
ON t26.f26 = t0.f0
LEFT JOIN t27
ON t27.f27 = t0.f0
LEFT JOIN t28
ON t0.f0 = t28.f28
LEFT JOIN t29
ON t0.f0 = t29.f29
LEFT JOIN t30
ON t30.f30 = t0.f0
LEFT JOIN t31
ON t0.f0 = t31.f31
LEFT JOIN t32
ON t32.f32 = t31.f31
LEFT JOIN t33
ON t33.f33 = t0.f0
LEFT JOIN t34
ON t33.f33 = t34.f34
LEFT JOIN t35
ON t33.f33 = t35.f35
LEFT JOIN t36
ON t36.f36 = t0.f0
LEFT JOIN t37
ON t32.f32 = t37.f37
LEFT JOIN t38
ON t31.f31 = t38.f38
LEFT JOIN t39
ON t39.f39 = t0.f0
LEFT JOIN t40
ON t40.f40 = t39.f39
LEFT JOIN t41
ON t41.f41 = t0.f0
LEFT JOIN t42
ON t42.f42 = t41.f41
LEFT JOIN t43
ON t43.f43 = t41.f41
LEFT JOIN t44
ON t44.f44 = t0.f0
LEFT JOIN t45
ON t45.f45 = t0.f0
LEFT JOIN t46
ON t46.f46 = t0.f0
LEFT JOIN t47
ON t47.f47 = t0.f0
LEFT JOIN t48
ON t48.f48 = t0.f0
LEFT JOIN t49
ON t0.f0 = t49.f49
LEFT JOIN t50
ON t0.f0 = t50.f50
LEFT JOIN t51
ON t0.f0 = t51.f51
LEFT JOIN t52
ON t52.f52 = t0.f0
LEFT JOIN t53
ON t53.f53 = t0.f0
LEFT JOIN t54
ON t54.f54 = t0.f0
LEFT JOIN t55
ON t55.f55 = t0.f0
LEFT JOIN t56
ON t56.f56 = t0.f0
LEFT JOIN t57
ON t57.f57 = t0.f0
LEFT JOIN t58
ON t58.f58 = t57.f57
LEFT JOIN t59
ON t36.f36 = t59.f59
LEFT JOIN v60
ON t36.f36 = v60.f60
;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9,
t10, t11, t12, t13, t14, t15, t16, t17, t18,
t19, t20, t21, t22, t23, t24, t25, t26, t27,
t28, t29, t30, t31, t32, t33, t34, t35, t36,
t37, t38, t39, t40, t41, t42, t43, t44, t45,
t46, t47, t48, t49, t50, t51, t52, t53, t54,
t55, t56, t57, t58, t59,t60;
drop view v60;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------

View File

@ -9,6 +9,7 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
MW-336 : MDEV-13549 Galera test failures
galera_gra_log : MDEV-13549 Galera test failures
galera_flush_local : MDEV-13549 Galera test failures
@ -47,3 +48,4 @@ lp1376747 : MDEV-13549 Galera test failures
galera_toi_ddl_nonconflicting : MDEV-13549 Galera test failures
galera_parallel_simple : MDEV-13549 Galera test failures
galera_admin : MDEV-13549 Galera test failures
MW-416 : MDEV-13549 Galera test failures

View File

@ -0,0 +1,114 @@
CREATE USER 'userMW416'@'localhost';
GRANT SELECT, INSERT, UPDATE ON test.* TO 'userMW416'@'localhost';
SHOW GLOBAL STATUS LIKE 'wsrep_replicated';
Variable_name Value
wsrep_replicated 2
ALTER DATABASE db CHARACTER SET = utf8;
ERROR 42000: Access denied for user 'userMW416'@'localhost' to database 'db'
ALTER EVENT ev1 RENAME TO ev2;
ERROR 42000: Access denied for user 'userMW416'@'localhost' to database 'test'
ALTER FUNCTION fun1 COMMENT 'foo';
ERROR 42000: alter routine command denied to user 'userMW416'@'localhost' for routine 'test.fun1'
ALTER LOGFILE GROUP lfg ADD UNDOFILE 'file' ENGINE=InnoDB;
Got one of the listed errors
ALTER PROCEDURE proc1 COMMENT 'foo';
Got one of the listed errors
ALTER SERVER srv OPTIONS (USER 'sally');
Got one of the listed errors
ALTER TABLE tbl DROP COLUMN col;
Got one of the listed errors
ALTER TABLESPACE tblspc DROP DATAFILE 'file' ENGINE=innodb;
Got one of the listed errors
ALTER VIEW vw AS SELECT 1;
Got one of the listed errors
CREATE DATABASE db;
Got one of the listed errors
CREATE EVENT ev1 ON SCHEDULE AT CURRENT_TIMESTAMP DO SELECT 1;
Got one of the listed errors
CREATE FUNCTION fun1() RETURNS int RETURN(1);
Got one of the listed errors
CREATE FUNCTION fun1 RETURNS STRING SONAME 'funlib.so';
Got one of the listed errors
CREATE PROCEDURE proc1() BEGIN END;
Got one of the listed errors
CREATE INDEX idx ON tbl(id);
Got one of the listed errors
CREATE LOGFILE GROUP lfg ADD UNDOFILE 'undofile' ENGINE innodb;
Got one of the listed errors
CREATE SERVER srv FOREIGN DATA WRAPPER 'fdw' OPTIONS (USER 'user');
Got one of the listed errors
CREATE TABLE t (i int);
Got one of the listed errors
CREATE TABLESPACE tblspc ADD DATAFILE 'file' ENGINE=innodb;
Got one of the listed errors
CREATE TRIGGER trg BEFORE UPDATE ON t FOR EACH ROW BEGIN END;
Got one of the listed errors
CREATE VIEW vw AS SELECT 1;
Got one of the listed errors
DROP DATABASE db;
Got one of the listed errors
DROP EVENT ev;
Got one of the listed errors
DROP FUNCTION fun1;
Got one of the listed errors
DROP INDEX idx ON t0;
Got one of the listed errors
DROP LOGFILE GROUP lfg;
Got one of the listed errors
DROP PROCEDURE proc1;
Got one of the listed errors
DROP SERVEr srv;
Got one of the listed errors
DROP TABLE t0;
Got one of the listed errors
DROP TABLESPACE tblspc;
Got one of the listed errors
DROP TRIGGER trg;
Got one of the listed errors
DROP VIEW vw;
Got one of the listed errors
RENAME TABLE t0 TO t1;
Got one of the listed errors
TRUNCATE TABLE t0;
Got one of the listed errors
ALTER USER myuser PASSWORD EXPIRE;
Got one of the listed errors
CREATE USER myuser IDENTIFIED BY 'pass';
Got one of the listed errors
DROP USER myuser;
Got one of the listed errors
GRANT ALL ON *.* TO 'myuser';
Got one of the listed errors
RENAME USER myuser TO mariauser;
Got one of the listed errors
REVOKE SELECT ON test FROM myuser;
Got one of the listed errors
REVOKE ALL, GRANT OPTION FROM myuser;
Got one of the listed errors
REVOKE PROXY ON myuser FROM myuser;
Got one of the listed errors
ANALYZE TABLE db.tbl;
Got one of the listed errors
CHECK TABLE db.tbl;
Got one of the listed errors
CHECKSUM TABLE db.tbl;
Got one of the listed errors
OPTIMIZE TABLE db.tbl;
Got one of the listed errors
REPAIR TABLE db.tbl;
Got one of the listed errors
INSTALL PLUGIN plg SONAME 'plg.so';
Got one of the listed errors
UNINSTALL PLUGIN plg;
Got one of the listed errors
DROP USER 'userMW416'@'localhost';
SHOW DATABASES;
Database
information_schema
mtr
mysql
performance_schema
test
SHOW GLOBAL STATUS LIKE 'wsrep_replicated';
Variable_name Value
wsrep_replicated 3

View File

@ -48,7 +48,7 @@ WSREP_SST_DONOR
WSREP_SST_DONOR_REJECTS_QUERIES OFF
WSREP_SST_METHOD rsync
WSREP_SYNC_WAIT 15
<BASE_DIR>; <BASE_HOST>; <BASE_PORT>; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.causal_keepalive_period = PT1S; evs.debug_log_mask = 0x1; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT15S; evs.info_log_mask = 0; evs.install_timeout = PT7.5S; evs.join_retrans_period = PT1S; evs.keepalive_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT10S; evs.use_aggregate = true; evs.user_send_window = 2; evs.version = 0; evs.view_forget_timeout = P1D; <GCACHE_DIR>; gcache.keep_pages_size = 0; gcache.mem_size = 0; <GCACHE_NAME>; gcache.page_size = 128M; gcache.recover = no; gcache.size = 10M; gcomm.thread_prio = ; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; <GCS_RECV_Q_HARD_LIMIT>; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; <GMCAST_LISTEN_ADDR>; gmcast.mcast_addr = ; gmcast.mcast_ttl = 1; gmcast.peer_timeout = PT3S; gmcast.segment = 0; gmcast.time_wait = PT5S; gmcast.version = 0; <IST_RECV_ADDR>; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.linger = PT20S; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = PT30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT90S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; repl.proto_max = 7; socket.checksum = 2; socket.recv_buf_size = 212992;
<BASE_DIR>; <BASE_HOST>; <BASE_PORT>; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.causal_keepalive_period = PT1S; evs.debug_log_mask = 0x1; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT15S; evs.info_log_mask = 0; evs.install_timeout = PT7.5S; evs.join_retrans_period = PT1S; evs.keepalive_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT10S; evs.use_aggregate = true; evs.user_send_window = 2; evs.version = 0; evs.view_forget_timeout = P1D; <GCACHE_DIR>; gcache.keep_pages_size = 0; gcache.mem_size = 0; <GCACHE_NAME>; gcache.page_size = 128M; gcache.recover = no; gcache.size = 10M; gcomm.thread_prio = ; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; <GCS_RECV_Q_HARD_LIMIT>; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; <GMCAST_LISTEN_ADDR>; gmcast.mcast_addr = ; gmcast.mcast_ttl = 1; gmcast.peer_timeout = PT3S; gmcast.segment = 0; gmcast.time_wait = PT5S; gmcast.version = 0; <IST_RECV_ADDR>; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.linger = PT20S; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = PT30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT90S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; repl.proto_max = 8; socket.checksum = 2; socket.recv_buf_size = 212992;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE 'wsrep_%'
AND VARIABLE_NAME != 'wsrep_debug_sync_waiters';

View File

@ -42,6 +42,4 @@ SELECT * FROM t1;
i
1
DROP TABLE t1;
set GLOBAL auto_increment_offset = 1;
set GLOBAL auto_increment_offset = 2;
# End of test

View File

@ -0,0 +1,134 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/wait_until_ready.inc
CREATE USER 'userMW416'@'localhost';
GRANT SELECT, INSERT, UPDATE ON test.* TO 'userMW416'@'localhost';
SHOW GLOBAL STATUS LIKE 'wsrep_replicated';
--connect userMW416, localhost, userMW416,, test, $NODE_MYPORT_1
--connection userMW416
# DDL
--error 1044
ALTER DATABASE db CHARACTER SET = utf8;
--error 1044
ALTER EVENT ev1 RENAME TO ev2;
--error 1370
ALTER FUNCTION fun1 COMMENT 'foo';
#--error 1044,1227
#ALTER INSTANCE ROTATE INNODB MASTER KEY;
--error 1044,1227
ALTER LOGFILE GROUP lfg ADD UNDOFILE 'file' ENGINE=InnoDB;
--error 1044,1227,1370
ALTER PROCEDURE proc1 COMMENT 'foo';
--error 1044,1227,1370
ALTER SERVER srv OPTIONS (USER 'sally');
--error 1044,1142,1227,1370
ALTER TABLE tbl DROP COLUMN col;
--error 1044,1227,1370
ALTER TABLESPACE tblspc DROP DATAFILE 'file' ENGINE=innodb;
--error 1044,1142,1227,1370
ALTER VIEW vw AS SELECT 1;
--error 1044,1227,1370
CREATE DATABASE db;
--error 1044,1227,1370
CREATE EVENT ev1 ON SCHEDULE AT CURRENT_TIMESTAMP DO SELECT 1;
--error 1044,1227,1370
CREATE FUNCTION fun1() RETURNS int RETURN(1);
--error 1044,1227,1370
CREATE FUNCTION fun1 RETURNS STRING SONAME 'funlib.so';
--error 1044,1227,1370
CREATE PROCEDURE proc1() BEGIN END;
--error 1044,1142,1227,1370
CREATE INDEX idx ON tbl(id);
--error 1044,1142,1227,1370
CREATE LOGFILE GROUP lfg ADD UNDOFILE 'undofile' ENGINE innodb;
--error 1044,1142,1227,1370
CREATE SERVER srv FOREIGN DATA WRAPPER 'fdw' OPTIONS (USER 'user');
--error 1044,1142,1227,1370
CREATE TABLE t (i int);
--error 1044,1142,1227,1370
CREATE TABLESPACE tblspc ADD DATAFILE 'file' ENGINE=innodb;
--error 1044,1142,1227,1370
CREATE TRIGGER trg BEFORE UPDATE ON t FOR EACH ROW BEGIN END;
--error 1044,1142,1227,1370
CREATE VIEW vw AS SELECT 1;
--error 1044,1142,1227,1370
DROP DATABASE db;
--error 1044,1142,1227,1370
DROP EVENT ev;
--error 1044,1142,1227,1370
DROP FUNCTION fun1;
--error 1044,1142,1227,1370
DROP INDEX idx ON t0;
--error 1044,1142,1227,1370,1064
DROP LOGFILE GROUP lfg;
--error 1044,1142,1227,1370
DROP PROCEDURE proc1;
--error 1044,1142,1227,1370
DROP SERVEr srv;
--error 1044,1142,1227,1370
DROP TABLE t0;
--error 1044,1142,1227,1370,1064
DROP TABLESPACE tblspc;
--error 1044,1142,1227,1360,1370
DROP TRIGGER trg;
--error 1044,1142,1227,1370
DROP VIEW vw;
--error 1044,1142,1227,1370
RENAME TABLE t0 TO t1;
--error 1044,1142,1227,1370
TRUNCATE TABLE t0;
# DCL
# account management
--error 1044,1142,1227,1370,1064
ALTER USER myuser PASSWORD EXPIRE;
--error 1044,1142,1227,1370
CREATE USER myuser IDENTIFIED BY 'pass';
--error 1044,1142,1227,1370
DROP USER myuser;
--error 1044,1045,1142,1227,1370
GRANT ALL ON *.* TO 'myuser';
--error 1044,1142,1227,1370
RENAME USER myuser TO mariauser;
--error 1044,1142,1227,1370
REVOKE SELECT ON test FROM myuser;
--error 1044,1142,1227,1370,1698
REVOKE ALL, GRANT OPTION FROM myuser;
--error 1044,1142,1227,1370,1698
REVOKE PROXY ON myuser FROM myuser;
# table maintenance
--error 1044,1142,1227,1370
ANALYZE TABLE db.tbl;
--error 1044,1142,1227,1370
CHECK TABLE db.tbl;
--error 1044,1142,1227,1370
CHECKSUM TABLE db.tbl;
--error 1044,1142,1227,1370
OPTIMIZE TABLE db.tbl;
--error 1044,1142,1227,1370
REPAIR TABLE db.tbl;
# plugin and user defined functions
--error 1044,1142,1227,1370
INSTALL PLUGIN plg SONAME 'plg.so';
--error 1044,1142,1227,1370
UNINSTALL PLUGIN plg;
--connection node_1
DROP USER 'userMW416'@'localhost';
SHOW DATABASES;
SHOW GLOBAL STATUS LIKE 'wsrep_replicated';

View File

@ -43,10 +43,10 @@ let $run=10;
while($run)
{
--error 0,1
exec $MYSQL --user=root --host=127.0.0.1 --port=$NODE_MYPORT_1 test
< $MYSQLTEST_VARDIR/tmp/galera_concurrent.sql &
$MYSQL --user=root --host=127.0.0.1 --port=$NODE_MYPORT_2 test
< $MYSQLTEST_VARDIR/tmp/galera_concurrent.sql;
exec $MYSQL --user=root --host=127.0.0.1 --port=$NODE_MYPORT_1 test \
< $MYSQLTEST_VARDIR/tmp/galera_concurrent.sql & \
$MYSQL --user=root --host=127.0.0.1 --port=$NODE_MYPORT_2 test \
< $MYSQLTEST_VARDIR/tmp/galera_concurrent.sql;
dec $run;
}

View File

@ -5,6 +5,11 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_2
--let $wsrep_cluster_address_saved = `SELECT @@global.wsrep_cluster_address`
@ -64,10 +69,8 @@ USE test;
SELECT * FROM t1;
# Cleanup
DROP TABLE t1;
set GLOBAL auto_increment_offset = 1;
--connection node_2
set GLOBAL auto_increment_offset = 2;
--source include/auto_increment_offset_restore.inc
--source include/galera_end.inc
--echo # End of test

View File

@ -4,10 +4,11 @@
create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2),
key k2(f3)) engine=innodb;
insert into t1 values (14, 24, 34);
set @@debug_dbug = '+d,row_ins_sec_index_entry_timeout';
set @old_dbug= @@session.debug_dbug;
set debug_dbug = '+d,row_ins_sec_index_entry_timeout';
replace into t1 values (14, 25, 34);
select * from t1;
f1 f2 f3
14 25 34
drop table t1;
set @@debug_dbug = '-d,row_ins_sec_index_entry_timeout';
set debug_dbug = @old_dbug;

View File

@ -8,8 +8,9 @@
create table t1 (f1 int primary key, f2 int, f3 int, unique key k1(f2),
key k2(f3)) engine=innodb;
insert into t1 values (14, 24, 34);
set @@debug_dbug = '+d,row_ins_sec_index_entry_timeout';
set @old_dbug= @@session.debug_dbug;
set debug_dbug = '+d,row_ins_sec_index_entry_timeout';
replace into t1 values (14, 25, 34);
select * from t1;
drop table t1;
set @@debug_dbug = '-d,row_ins_sec_index_entry_timeout';
set debug_dbug = @old_dbug;

View File

@ -0,0 +1,4 @@
create table t1 (a blob, b varchar(20000)) engine=aria row_format=dynamic;
insert t1 (b) values (repeat('a', 20000));
update t1 set b='b';
drop table t1;

View File

@ -0,0 +1,7 @@
#
# MDEV-13748 Assertion `status_var.local_memory_used == 0 || !debug_assert_on_not_freed_memory' failed in virtual THD::~THD after query with INTERSECT
#
create table t1 (a blob, b varchar(20000)) engine=aria row_format=dynamic;
insert t1 (b) values (repeat('a', 20000));
update t1 set b='b';
drop table t1;

View File

@ -16,6 +16,15 @@ select * from t1;
pk dt
1 2017-09-28 15:12:00
drop table t1;
create table t1 (a int) engine=Aria transactional=1 partition by hash(a) partitions 2;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL
) ENGINE=Aria DEFAULT CHARSET=latin1 TRANSACTIONAL=1
/*!50100 PARTITION BY HASH (a)
PARTITIONS 2 */
drop table t1;
#
# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
#

View File

@ -17,5 +17,12 @@ alter table t1 drop partition p20181231;
select * from t1;
drop table t1;
#
# MDEV-13982 Server crashes in in ha_partition::engine_name
#
create table t1 (a int) engine=Aria transactional=1 partition by hash(a) partitions 2;
show create table t1;
drop table t1;
--let $engine=Aria
--source inc/part_alter_values.inc

View File

@ -42,8 +42,10 @@ select 1,
3;
insert into t2 values (1), (2);
select * from t2;
--disable_ps_protocol
--error ER_NO_SUCH_TABLE
select * from t_doesnt_exist;
--enable_ps_protocol
--error 1064
syntax_error_query;
drop table renamed_t1, t2;

View File

@ -206,6 +206,13 @@ Threads_connected 1
SHOW STATUS LIKE 'wsrep_thread_count';
Variable_name Value
wsrep_thread_count 11
set wsrep_on=0;
set wsrep_on=1;
create user test@localhost;
set auto_increment_increment=10;
set wsrep_on=0;
ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
drop user test@localhost;
#
# MDEV#6411: Setting set @@global.wsrep_sst_auth=NULL causes crash
#

View File

@ -117,6 +117,20 @@ sleep 3;
SHOW STATUS LIKE 'threads_connected';
SHOW STATUS LIKE 'wsrep_thread_count';
#
# privileges for wsrep_on
#
set wsrep_on=0;
set wsrep_on=1;
create user test@localhost;
connect con1,localhost,test;
set auto_increment_increment=10;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
set wsrep_on=0;
disconnect con1;
connection default;
drop user test@localhost;
--echo #
--echo # MDEV#6411: Setting set @@global.wsrep_sst_auth=NULL causes crash
--echo #

View File

@ -0,0 +1,12 @@
source include/have_debug.inc;
set @old_dbug=@@global.debug_dbug;
#
# use after free if need plugin change and auth aborted
#
set global debug_dbug='+d,auth_disconnect';
create user 'bad' identified by 'worse';
--error 1
--exec $MYSQL --default-auth=mysql_old_password --user=bad --password=worse
set global debug_dbug=@old_dbug;
drop user bad;

View File

@ -843,6 +843,28 @@ DESCRIBE t1;
DROP TABLE t1;
--echo #
--echo # MDEV-15624 Changing the default character set to utf8mb4 changes query evaluation in a very surprising way
--echo #
SET NAMES utf8;
CREATE TABLE t1 (id INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT COUNT(DISTINCT c) FROM (SELECT id, REPLACE(uuid_short(), '0', CAST('o' AS CHAR CHARACTER SET ucs2)) AS c FROM t1) AS d1;
--replace_column 1 xxxxxxxxxxxxxxxxx
SELECT DISTINCT REPLACE(uuid_short(), '0', CAST('o' AS CHAR CHARACTER SET ucs2)) AS c FROM t1;
SELECT COUNT(DISTINCT c) FROM (SELECT id, INSERT(uuid_short(), 1, 1, CAST('0' AS CHAR CHARACTER SET ucs2)) AS c FROM t1) AS d1;
--replace_column 1 xxxxxxxxxxxxxxxxx
SELECT DISTINCT INSERT(uuid_short(), 1, 1, CAST('0' AS CHAR CHARACTER SET ucs2)) AS c FROM t1;
SELECT COUNT(DISTINCT c) FROM (SELECT id, CONCAT(uuid_short(), CAST('0' AS CHAR CHARACTER SET ucs2)) AS c FROM t1) AS d1;
--replace_column 1 xxxxxxxxxxxxxxxxx
SELECT DISTINCT CONCAT(uuid_short(), CAST('0' AS CHAR CHARACTER SET ucs2)) AS c FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #

View File

@ -1841,6 +1841,25 @@ SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 21846) AS data ) AS sub;
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65535) AS data ) AS sub;
SELECT LENGTH(data) AS len FROM (SELECT REPEAT('☃', 65536) AS data ) AS sub;
--echo #
--echo # MDEV-15624 Changing the default character set to utf8mb4 changes query evaluation in a very surprising way
--echo #
SET NAMES utf8mb4;
CREATE TABLE t1 (id INT);
INSERT INTO t1 VALUES (1),(2),(3);
SELECT COUNT(DISTINCT c) FROM (SELECT id, REPLACE(UUID(), "-", "") AS c FROM t1) AS d1;
--replace_column 1 xxxxxxxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx
SELECT DISTINCT INSERT(uuid(), 9, 1, "X") AS c FROM t1;
SELECT COUNT(DISTINCT c) FROM (SELECT id, INSERT(UUID(), 9, 1, "X") AS c FROM t1) AS d1;
--replace_column 1 xxxxxxxxxxxxx-xxxx-xxxx-xxxxxxxxxxxx
SELECT DISTINCT INSERT(UUID(), 9, 1, "X") AS c FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 5.5 tests
--echo #

View File

@ -596,6 +596,18 @@ AND 57813X540X1723 = 'Test';
drop table t1;
--echo #
--echo # MDEV-15630 uuid() function evaluates at wrong time in query
--echo #
CREATE TABLE t1 (id INT);
INSERT INTO t1 VALUES (1),(2),(3);
--replace_column 2 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
SELECT COUNT(1), UUID() as uid FROM t1 GROUP BY uid;
DROP TABLE t1;
#
# Bug#12735545 - PARSER STACK OVERFLOW WITH NAME_CONST
# CONTAINING OR EXPRESSION

View File

@ -1891,9 +1891,25 @@ INSERT INTO t1 VALUES (0),(1);
CREATE TABLE t2 (b2 BIT NOT NULL);
INSERT INTO t2 VALUES (0),(1);
SET SESSION JOIN_CACHE_LEVEL = 3;
set @save_join_cache_level= @@join_cache_level;
SET @@join_cache_level = 3;
SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2;
DROP TABLE t1, t2;
set @join_cache_level= @save_join_cache_level;
--echo #
--echo # MDEV-14779: using left join causes incorrect results with materialization and derived tables
--echo #
create table t1(id int);
insert into t1 values (1),(2);
create table t2(sid int, id int);
insert into t2 values (1,1),(2,2);
select * from t1 t
left join (select * from t2 where sid in (select max(sid) from t2 where 0=1 group by id)) r
on t.id=r.id ;
drop table t1, t2;
--echo # end of 5.5 tests

View File

@ -780,3 +780,12 @@ CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\;
--error ER_PARSE_ERROR
PREPARE stmt FROM 'CREATE TRIGGER tr AFTER DELETE ON t1 FOR EACH ROW SET @a = 1\\';
DROP TABLE t1;
--echo #
--echo # MDEV-15620 Crash when using "SET @@NEW.a=expr" inside a trigger
--echo #
CREATE TABLE t1 (a INT);
--error ER_UNKNOWN_SYSTEM_VARIABLE
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @@NEW.a=0;
DROP TABLE t1;

View File

@ -0,0 +1,35 @@
--source include/have_query_cache.inc
--source include/have_innodb.inc
--echo #
--echo # MDEV-15492: Subquery crash similar to MDEV-10050
--echo #
SET @qcs.save= @@global.query_cache_size, @qct.save= @@global.query_cache_type;
SET GLOBAL query_cache_size= 512*1024*1024, query_cache_type= ON;
--connect (con1,localhost,root,,test)
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
CREATE TABLE t2 (b INT) ENGINE=InnoDB;
CREATE VIEW v AS select a from t1 join t2;
PREPARE stmt1 FROM "SELECT * FROM t1 WHERE a in (SELECT a FROM v)";
--connect (con2,localhost,root,,test)
PREPARE stmt2 FROM "SELECT * FROM t1 WHERE a in (SELECT a FROM v)";
EXECUTE stmt2;
--connection con1
EXECUTE stmt1;
INSERT INTO t2 VALUES (0);
EXECUTE stmt1;
START TRANSACTION;
EXECUTE stmt1;
# Cleanup
--disconnect con1
--disconnect con2
--connection default
DROP VIEW v;
DROP TABLE t1, t2;
SET GLOBAL query_cache_size= @qcs.save, query_cache_type= @qct.save;

View File

@ -2032,5 +2032,36 @@ SELECT ( SELECT COUNT(*) FROM t1 WHERE a = c ) AS field, COUNT(DISTINCT c)
FROM t2 WHERE b <= 'quux' GROUP BY field;
drop table t1,t2;
--echo #
--echo # MDEV-15555: select from DUAL where false yielding wrong result when in a IN
--echo #
explain
SELECT 2 IN (SELECT 2 from DUAL WHERE 1 != 1);
SELECT 2 IN (SELECT 2 from DUAL WHERE 1 != 1);
SET optimizer_switch= @@global.optimizer_switch;
set @@tmp_table_size= @@global.tmp_table_size;
--echo #
--echo # mfrv-14515: Wrong results for tableless query with subquery in WHERE
--echo # and implicit aggregation
--echo #
create table t1 (i1 int, i2 int);
insert into t1 values (1314, 1084),(1330, 1084),(1401, 1084),(580, 1084);
create table t2 (cd int);
insert into t2 values
(1330), (1330), (1330), (1330), (1330), (1330), (1330), (1330),
(1330), (1330), (1330), (1330), (1330), (1330), (1330), (1330);
select max(10) from dual
where exists (select 1 from t2 join t1 on t1.i1 = t2.cd and t1.i2 = 345);
insert into t2 select * from t2;
select max(10) from dual
where exists (select 1 from t2 join t1 on t1.i1 = t2.cd and t1.i2 = 345);
DROP TABLE t1,t2;

View File

@ -254,3 +254,16 @@ SELECT a, b, (a, b) NOT IN (SELECT a, b FROM t2) as sq
FROM t1;
drop table t1, t2;
--echo #
--echo # MDEV-15235: Assertion `length > 0' failed in create_ref_for_key
--echo #
CREATE TABLE t1 (i INT);
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (f CHAR(1));
INSERT INTO t2 VALUES ('a'),('b');
explain
SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
DROP TABLE t1, t2;

View File

@ -5170,118 +5170,6 @@ deallocate prepare stmt1;
drop view v1,v2;
drop table t1,t2;
--echo #
--echo # MDEV-6251: SIGSEGV in query optimizer (in set_check_materialized
--echo # with MERGE view)
--echo #
CREATE TABLE t1 (a1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t2 (b1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t3 (c1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t4 (d1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t5 (e1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE TABLE t6 (f1 INT(11) NOT NULL DEFAULT NULL AUTO_INCREMENT PRIMARY KEY);
CREATE OR REPLACE view v1 AS
SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
;
SELECT 1
FROM (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t1)
LEFT OUTER JOIN (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t2) ON 1=1
LEFT OUTER JOIN (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t3) ON 1=1
LEFT OUTER JOIN (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t4) ON 1=1
LEFT OUTER JOIN (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t5) ON 1=1
LEFT OUTER JOIN (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t6) ON 1=1
LEFT OUTER JOIN (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t7) ON 1=1
LEFT OUTER JOIN (( SELECT 1
FROM t1 a_alias_1
LEFT JOIN (t2 b_alias_1 JOIN t1 a_alias_2) ON b_alias_1.b1 = a_alias_1.a1 AND a_alias_2.a1 = a_alias_1.a1
LEFT JOIN t3 c_alias_1 ON c_alias_1.c1 = a_alias_1.a1
LEFT JOIN t4 d_alias_1 ON d_alias_1.d1 = a_alias_1.a1
LEFT JOIN t3 c_alias_2 ON c_alias_2.c1 = a_alias_1.a1
LEFT JOIN t5 e_alias_1 ON e_alias_1.e1 = a_alias_1.a1
LEFT JOIN t6 f_alias_1 ON f_alias_1.f1 = a_alias_1.a1
) t8) ON 1=1
;
SELECT 1
FROM (v1 t1)
LEFT OUTER JOIN (v1 t2) ON 1=1
LEFT OUTER JOIN (v1 t3) ON 1=1
LEFT OUTER JOIN (v1 t4) ON 1=1
LEFT OUTER JOIN (v1 t5) ON 1=1
LEFT OUTER JOIN (v1 t6) ON 1=1
LEFT OUTER JOIN (v1 t7) ON 1=1
LEFT OUTER JOIN (v1 t8) ON 1=1
;
drop view v1;
drop table t1,t2,t3,t4,t5,t6;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.3 tests.
--echo # -----------------------------------------------------------------
@ -5591,6 +5479,202 @@ SHOW CREATE VIEW v1;
drop view v1;
drop table t1;
CREATE TABLE IF NOT EXISTS t0 (f0 INT);
CREATE TABLE IF NOT EXISTS t1 (f1 INT);
CREATE TABLE IF NOT EXISTS t2 (f2 INT);
CREATE TABLE IF NOT EXISTS t3 (f3 INT);
CREATE TABLE IF NOT EXISTS t4 (f4 INT);
CREATE TABLE IF NOT EXISTS t5 (f5 INT);
CREATE TABLE IF NOT EXISTS t6 (f6 INT);
CREATE TABLE IF NOT EXISTS t7 (f7 INT);
CREATE TABLE IF NOT EXISTS t8 (f8 INT);
CREATE TABLE IF NOT EXISTS t9 (f9 INT);
CREATE TABLE IF NOT EXISTS t10 (f10 INT);
CREATE TABLE IF NOT EXISTS t11 (f11 INT);
CREATE TABLE IF NOT EXISTS t12 (f12 INT);
CREATE TABLE IF NOT EXISTS t13 (f13 INT);
CREATE TABLE IF NOT EXISTS t14 (f14 INT);
CREATE TABLE IF NOT EXISTS t15 (f15 INT);
CREATE TABLE IF NOT EXISTS t16 (f16 INT);
CREATE TABLE IF NOT EXISTS t17 (f17 INT);
CREATE TABLE IF NOT EXISTS t18 (f18 INT);
CREATE TABLE IF NOT EXISTS t19 (f19 INT);
CREATE TABLE IF NOT EXISTS t20 (f20 INT);
CREATE TABLE IF NOT EXISTS t21 (f21 INT);
CREATE TABLE IF NOT EXISTS t22 (f22 INT);
CREATE TABLE IF NOT EXISTS t23 (f23 INT);
CREATE TABLE IF NOT EXISTS t24 (f24 INT);
CREATE TABLE IF NOT EXISTS t25 (f25 INT);
CREATE TABLE IF NOT EXISTS t26 (f26 INT);
CREATE TABLE IF NOT EXISTS t27 (f27 INT);
CREATE TABLE IF NOT EXISTS t28 (f28 INT);
CREATE TABLE IF NOT EXISTS t29 (f29 INT);
CREATE TABLE IF NOT EXISTS t30 (f30 INT);
CREATE TABLE IF NOT EXISTS t31 (f31 INT);
CREATE TABLE IF NOT EXISTS t32 (f32 INT);
CREATE TABLE IF NOT EXISTS t33 (f33 INT);
CREATE TABLE IF NOT EXISTS t34 (f34 INT);
CREATE TABLE IF NOT EXISTS t35 (f35 INT);
CREATE TABLE IF NOT EXISTS t36 (f36 INT);
CREATE TABLE IF NOT EXISTS t37 (f37 INT);
CREATE TABLE IF NOT EXISTS t38 (f38 INT);
CREATE TABLE IF NOT EXISTS t39 (f39 INT);
CREATE TABLE IF NOT EXISTS t40 (f40 INT);
CREATE TABLE IF NOT EXISTS t41 (f41 INT);
CREATE TABLE IF NOT EXISTS t42 (f42 INT);
CREATE TABLE IF NOT EXISTS t43 (f43 INT);
CREATE TABLE IF NOT EXISTS t44 (f44 INT);
CREATE TABLE IF NOT EXISTS t45 (f45 INT);
CREATE TABLE IF NOT EXISTS t46 (f46 INT);
CREATE TABLE IF NOT EXISTS t47 (f47 INT);
CREATE TABLE IF NOT EXISTS t48 (f48 INT);
CREATE TABLE IF NOT EXISTS t49 (f49 INT);
CREATE TABLE IF NOT EXISTS t50 (f50 INT);
CREATE TABLE IF NOT EXISTS t51 (f51 INT);
CREATE TABLE IF NOT EXISTS t52 (f52 INT);
CREATE TABLE IF NOT EXISTS t53 (f53 INT);
CREATE TABLE IF NOT EXISTS t54 (f54 INT);
CREATE TABLE IF NOT EXISTS t55 (f55 INT);
CREATE TABLE IF NOT EXISTS t56 (f56 INT);
CREATE TABLE IF NOT EXISTS t57 (f57 INT);
CREATE TABLE IF NOT EXISTS t58 (f58 INT);
CREATE TABLE IF NOT EXISTS t59 (f59 INT);
CREATE TABLE IF NOT EXISTS t60 (f60 INT);
CREATE OR REPLACE VIEW v60 AS SELECT * FROM t60;
EXPLAIN
SELECT t0.*
FROM t0
JOIN t1
ON t1.f1 = t0.f0
LEFT JOIN t2
ON t0.f0 = t2.f2
LEFT JOIN t3
ON t0.f0 = t3.f3
LEFT JOIN t4
ON t0.f0 = t4.f4
LEFT JOIN t5
ON t4.f4 = t5.f5
LEFT JOIN t6
ON t0.f0 = t6.f6
LEFT JOIN t7
ON t0.f0 = t7.f7
LEFT JOIN t8
ON t0.f0 = t8.f8
LEFT JOIN t9
ON t0.f0 = t9.f9
LEFT JOIN t10
ON t0.f0 = t10.f10
LEFT JOIN t11
ON t0.f0 = t11.f11
LEFT JOIN t12
ON t0.f0 = t12.f12
LEFT JOIN t13
ON t0.f0 = t13.f13
LEFT JOIN t14
ON t0.f0 = t14.f14
LEFT JOIN t15
ON t0.f0 = t15.f15
LEFT JOIN t16
ON t0.f0 = t16.f16
LEFT JOIN t17
ON t0.f0 = t17.f17
LEFT JOIN t18
ON t0.f0 = t18.f18
LEFT JOIN t19
ON t18.f18 = t19.f19
LEFT JOIN t20
ON t20.f20 = t19.f19
LEFT JOIN t21
ON t20.f20 = t21.f21
LEFT JOIN t22
ON t19.f19 = t22.f22
LEFT JOIN t23
ON t23.f23 = t0.f0
LEFT JOIN t24
ON t24.f24 = t23.f23
LEFT JOIN t25
ON t0.f0 = t25.f25
LEFT JOIN t26
ON t26.f26 = t0.f0
LEFT JOIN t27
ON t27.f27 = t0.f0
LEFT JOIN t28
ON t0.f0 = t28.f28
LEFT JOIN t29
ON t0.f0 = t29.f29
LEFT JOIN t30
ON t30.f30 = t0.f0
LEFT JOIN t31
ON t0.f0 = t31.f31
LEFT JOIN t32
ON t32.f32 = t31.f31
LEFT JOIN t33
ON t33.f33 = t0.f0
LEFT JOIN t34
ON t33.f33 = t34.f34
LEFT JOIN t35
ON t33.f33 = t35.f35
LEFT JOIN t36
ON t36.f36 = t0.f0
LEFT JOIN t37
ON t32.f32 = t37.f37
LEFT JOIN t38
ON t31.f31 = t38.f38
LEFT JOIN t39
ON t39.f39 = t0.f0
LEFT JOIN t40
ON t40.f40 = t39.f39
LEFT JOIN t41
ON t41.f41 = t0.f0
LEFT JOIN t42
ON t42.f42 = t41.f41
LEFT JOIN t43
ON t43.f43 = t41.f41
LEFT JOIN t44
ON t44.f44 = t0.f0
LEFT JOIN t45
ON t45.f45 = t0.f0
LEFT JOIN t46
ON t46.f46 = t0.f0
LEFT JOIN t47
ON t47.f47 = t0.f0
LEFT JOIN t48
ON t48.f48 = t0.f0
LEFT JOIN t49
ON t0.f0 = t49.f49
LEFT JOIN t50
ON t0.f0 = t50.f50
LEFT JOIN t51
ON t0.f0 = t51.f51
LEFT JOIN t52
ON t52.f52 = t0.f0
LEFT JOIN t53
ON t53.f53 = t0.f0
LEFT JOIN t54
ON t54.f54 = t0.f0
LEFT JOIN t55
ON t55.f55 = t0.f0
LEFT JOIN t56
ON t56.f56 = t0.f0
LEFT JOIN t57
ON t57.f57 = t0.f0
LEFT JOIN t58
ON t58.f58 = t57.f57
LEFT JOIN t59
ON t36.f36 = t59.f59
LEFT JOIN v60
ON t36.f36 = v60.f60
;
drop table t0, t1, t2, t3, t4, t5, t6, t7, t8, t9,
t10, t11, t12, t13, t14, t15, t16, t17, t18,
t19, t20, t21, t22, t23, t24, t25, t26, t27,
t28, t29, t30, t31, t32, t33, t34, t35, t36,
t37, t38, t39, t40, t41, t42, t43, t44, t45,
t46, t47, t48, t49, t50, t51, t52, t53, t54,
t55, t56, t57, t58, t59,t60;
drop view v60;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2006, 2010, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB
/* Copyright (c) 2006, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -84,7 +84,8 @@ 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 (my_atomic_loadptr((void**)cursor->prev) != cursor->curr &&
LF_BACKOFF);
for (;;)
{
if (unlikely(!cursor->curr))
@ -98,7 +99,7 @@ retry:
cur_hashnr= cursor->curr->hashnr;
cur_key= cursor->curr->key;
cur_keylen= cursor->curr->keylen;
if (*cursor->prev != (intptr)cursor->curr)
if (my_atomic_loadptr((void**)cursor->prev) != cursor->curr)
{
(void)LF_BACKOFF;
goto retry;

View File

@ -258,7 +258,7 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize,
else
{
/* Clear mutex so that safe_mutex will notice that it's not initialized */
bzero((char*) &info->append_buffer_lock, sizeof(info));
bzero((char*) &info->append_buffer_lock, sizeof(info->append_buffer_lock));
}
#endif

View File

@ -204,7 +204,7 @@ int my_addr_resolve(void *ptr, my_addr_loc *loc)
strnmov(addr2line_binary, info.dli_fname, sizeof(addr2line_binary));
}
offset = info.dli_fbase;
len= my_snprintf(input, sizeof(input), "%p\n", ptr - offset);
len= my_snprintf(input, sizeof(input), "%08x\n", (ulonglong)(ptr - offset));
if (write(in[1], input, len) <= 0)
return 1;
if (read(out[0], output, sizeof(output)) <= 0)

View File

@ -244,7 +244,7 @@ const char *my_open_parent_dir_nosymlinks(const char *pathname, int *pdfd)
return pathname + (s - buf);
}
fd = openat(dfd, s, O_NOFOLLOW | O_PATH);
fd = openat(dfd, s, O_NOFOLLOW | O_PATH | O_CLOEXEC);
if (fd < 0)
goto err;

View File

@ -1,4 +1,4 @@
# This SELinux file contexts (.fc) file has been copied under BSD License from
# This SELinux file contexts (.fc) file has been copied under New BSD License from
# Percona XtraDB Cluster.
/etc/init\.d/rc\.d/mysql -- gen_context(system_u:object_r:mysqld_initrc_exec_t,s0)

View File

@ -1,4 +1,4 @@
# This SELinux type enforcement (.te) file has been copied under BSD License
# This SELinux type enforcement (.te) file has been copied under New BSD License
# from Percona XtraDB Cluster, along with some additions.
module mariadb-server 1.0;

View File

@ -384,6 +384,22 @@ ELSE()
COMPONENT ${${file}_COMPONENT}
)
ENDFOREACH()
SET (wsrep_sst_rsync_wan ${CMAKE_CURRENT_BINARY_DIR}/wsrep_sst_rsync_wan)
ADD_CUSTOM_COMMAND(
OUTPUT ${wsrep_sst_rsync_wan}
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink
wsrep_sst_rsync
wsrep_sst_rsync_wan
)
ADD_CUSTOM_TARGET(symlink_wsrep_sst_rsync
ALL
DEPENDS ${wsrep_sst_rsync_wan}
)
INSTALL(
FILES ${wsrep_sst_rsync_wan}
DESTINATION ${INSTALL_BINDIR}
COMPONENT Server
)
ENDIF()
# Install libgcc as mylibgcc.a

View File

@ -1045,7 +1045,7 @@ then
wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories"
find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -regex $cpat -prune -o -exec rm -rfv {} 1>&2 \+
find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
tempdir=$(parse_cnf --mysqld log-bin "")
if [[ -n ${tempdir:-} ]];then

View File

@ -1503,7 +1503,7 @@ MYSQL_DATA *cli_read_rows(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
else
{
cur->data[field] = to;
if (len > (ulong) (end_to - to))
if (unlikely(len > (ulong)(end_to-to) || to > end_to))
{
free_rows(result);
set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
@ -1575,7 +1575,7 @@ read_one_row(MYSQL *mysql,uint fields,MYSQL_ROW row, ulong *lengths)
}
else
{
if (len > (ulong) (end_pos - pos))
if (unlikely(len > (ulong)(end_pos - pos) || pos > end_pos))
{
set_mysql_error(mysql, CR_UNKNOWN_ERROR, unknown_sqlstate);
return -1;
@ -2509,10 +2509,10 @@ static int send_client_reply_packet(MCPVIO_EXT *mpvio,
if (mysql->client_flag & CLIENT_MULTI_STATEMENTS)
mysql->client_flag|= CLIENT_MULTI_RESULTS;
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
#ifdef HAVE_OPENSSL
if (mysql->options.use_ssl)
mysql->client_flag|= CLIENT_SSL;
#endif /* HAVE_OPENSSL && !EMBEDDED_LIBRARY*/
#endif /* HAVE_OPENSSL */
if (mpvio->db)
mysql->client_flag|= CLIENT_CONNECT_WITH_DB;
@ -2735,7 +2735,7 @@ static int client_mpvio_read_packet(struct st_plugin_vio *mpv, uchar **buf)
*buf= mysql->net.read_pos;
/* was it a request to change plugins ? */
if (**buf == 254)
if (pkt_len == packet_error || **buf == 254)
return (int)packet_error; /* if yes, this plugin shan't continue */
/*
@ -2920,7 +2920,7 @@ int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
compile_time_assert(CR_OK == -1);
compile_time_assert(CR_ERROR == 0);
if (res > CR_OK && mysql->net.read_pos[0] != 254)
if (res > CR_OK && (mysql->net.last_errno || mysql->net.read_pos[0] != 254))
{
/*
the plugin returned an error. write it down in mysql,

View File

@ -1473,23 +1473,22 @@ end:
thd->tx_read_only= false;
#ifdef WITH_WSREP
if (WSREP(thd)) {
// sql_print_information("sizeof(LEX) = %d", sizeof(struct LEX));
// sizeof(LEX) = 4512, so it's relatively safe to allocate it on stack.
LEX lex;
LEX* saved = thd->lex;
lex.sql_command = SQLCOM_DROP_EVENT;
thd->lex = &lex;
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
thd->lex = saved;
const bool sql_command_set= WSREP(thd);
const enum_sql_command sql_command_save= thd->lex->sql_command;
if (sql_command_set) {
thd->lex->sql_command = SQLCOM_DROP_EVENT;
}
#endif
ret= Events::drop_event(thd, dbname, name, FALSE);
#ifdef WITH_WSREP
WSREP_TO_ISOLATION_END;
error:
if (sql_command_set)
{
WSREP_TO_ISOLATION_END;
thd->lex->sql_command = sql_command_save;
}
#endif
thd->tx_read_only= save_tx_read_only;
thd->security_ctx->master_access= saved_master_access;

View File

@ -1,5 +1,6 @@
/*
Copyright (c) 2006, 2011, Oracle and/or its affiliates.
Copyright (c) 2006, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -177,6 +178,8 @@ protected:
error_log_print(ERROR_LEVEL, fmt, args);
va_end(args);
}
public:
Event_db_intact() { has_keys= TRUE; }
};
/** In case of an error, a message is printed to the error log. */

View File

@ -331,6 +331,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
if (check_access(thd, EVENT_ACL, parse_data->dbname.str, NULL, NULL, 0, 0))
DBUG_RETURN(TRUE);
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
if (check_db_dir_existence(parse_data->dbname.str))
{
@ -409,6 +410,10 @@ Events::create_event(THD *thd, Event_parse_data *parse_data,
thd->restore_stmt_binlog_format(save_binlog_format);
DBUG_RETURN(ret);
#ifdef WITH_WSREP
error:
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
}
@ -449,6 +454,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
if (check_access(thd, EVENT_ACL, parse_data->dbname.str, NULL, NULL, 0, 0))
DBUG_RETURN(TRUE);
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
if (new_dbname) /* It's a rename */
{
@ -520,6 +526,10 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
thd->restore_stmt_binlog_format(save_binlog_format);
DBUG_RETURN(ret);
#ifdef WITH_WSREP
error:
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
}
@ -559,6 +569,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
if (check_access(thd, EVENT_ACL, dbname.str, NULL, NULL, 0, 0))
DBUG_RETURN(TRUE);
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
/*
Turn off row binlogging of this statement and use statement-based so
@ -581,6 +592,10 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
thd->restore_stmt_binlog_format(save_binlog_format);
DBUG_RETURN(ret);
#ifdef WITH_WSREP
error:
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
}

View File

@ -4463,6 +4463,7 @@ handler::ha_create_partitioning_metadata(const char *name, const char *old_name,
*/
DBUG_ASSERT(m_lock_type == F_UNLCK ||
(!old_name && strcmp(name, table_share->path.str)));
mark_trx_read_write();
return create_partitioning_metadata(name, old_name, action_flag);
@ -6364,6 +6365,11 @@ void ha_wsrep_fake_trx_id(THD *thd)
DBUG_VOID_RETURN;
}
if (thd->wsrep_ws_handle.trx_id != WSREP_UNDEFINED_TRX_ID)
{
WSREP_DEBUG("fake trx id skipped: %lu", thd->wsrep_ws_handle.trx_id);
DBUG_VOID_RETURN;
}
handlerton *hton= installed_htons[DB_TYPE_INNODB];
if (hton && hton->wsrep_fake_trx_id)
{

View File

@ -260,6 +260,7 @@ public:
bool is_null();
longlong val_int();
void cleanup();
enum Functype functype() const { return IN_OPTIMIZER_FUNC; }
const char *func_name() const { return "<in_optimizer>"; }
Item_cache **get_cache() { return &cache; }
void keep_top_level_cache();
@ -277,6 +278,10 @@ public:
void reset_cache() { cache= NULL; }
virtual void print(String *str, enum_query_type query_type);
void restore_first_argument();
Item* get_wrapped_in_subselect_item()
{
return args[1];
}
};
class Comp_creator

View File

@ -73,7 +73,7 @@ public:
NOW_FUNC, TRIG_COND_FUNC,
SUSERVAR_FUNC, GUSERVAR_FUNC, COLLATE_FUNC,
EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP, UDF_FUNC,
NEG_FUNC, GSYSVAR_FUNC, DYNCOL_FUNC };
NEG_FUNC, GSYSVAR_FUNC, IN_OPTIMIZER_FUNC, DYNCOL_FUNC };
enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL,
OPTIMIZE_EQUAL };
enum Type type() const { return FUNC_ITEM; }
@ -2201,6 +2201,8 @@ public:
Item_func_uuid_short() :Item_int_func() {}
const char *func_name() const { return "uuid_short"; }
longlong val_int();
bool const_item() const { return false; }
table_map used_tables() const { return RAND_TABLE_BIT; }
void fix_length_and_dec()
{ max_length= 21; unsigned_flag=1; }
bool check_vcol_func_processor(uchar *int_arg)

View File

@ -1134,6 +1134,8 @@ public:
DERIVATION_COERCIBLE, MY_REPERTOIRE_ASCII);
fix_char_length(MY_UUID_STRING_LENGTH);
}
bool const_item() const { return false; }
table_map used_tables() const { return RAND_TABLE_BIT; }
const char *func_name() const{ return "uuid"; }
String *val_str(String *);
bool check_vcol_func_processor(uchar *int_arg)

View File

@ -1763,7 +1763,7 @@ Item_in_subselect::single_value_transformer(JOIN *join)
Item* join_having= join->having ? join->having : join->tmp_having;
if (!(join_having || select_lex->with_sum_func ||
select_lex->group_list.elements) &&
select_lex->table_list.elements == 0 &&
select_lex->table_list.elements == 0 && !join->conds &&
!select_lex->master_unit()->is_union())
{
Item *where_item= (Item*) select_lex->item_list.head();

View File

@ -2631,7 +2631,7 @@ bool MYSQL_LOG::open(
File file= -1;
my_off_t seek_offset;
bool is_fifo = false;
int open_flags= O_CREAT | O_BINARY;
int open_flags= O_CREAT | O_BINARY | O_CLOEXEC;
DBUG_ENTER("MYSQL_LOG::open");
DBUG_PRINT("enter", ("log_type: %d", (int) log_type_arg));
@ -3316,7 +3316,7 @@ bool MYSQL_BIN_LOG::open_index_file(const char *index_file_name_arg,
".index", opt);
if ((index_file_nr= mysql_file_open(m_key_file_log_index,
index_file_name,
O_RDWR | O_CREAT | O_BINARY,
O_RDWR | O_CREAT | O_BINARY | O_CLOEXEC,
MYF(MY_WME))) < 0 ||
mysql_file_sync(index_file_nr, MYF(MY_WME)) ||
init_io_cache(&index_file, index_file_nr,
@ -8591,14 +8591,14 @@ int TC_LOG_MMAP::open(const char *opt_name)
tc_log_page_size= my_getpagesize();
fn_format(logname,opt_name,mysql_data_home,"",MY_UNPACK_FILENAME);
if ((fd= mysql_file_open(key_file_tclog, logname, O_RDWR, MYF(0))) < 0)
if ((fd= mysql_file_open(key_file_tclog, logname, O_RDWR | O_CLOEXEC, MYF(0))) < 0)
{
if (my_errno != ENOENT)
goto err;
if (using_heuristic_recover())
return 1;
if ((fd= mysql_file_create(key_file_tclog, logname, CREATE_MODE,
O_RDWR, MYF(MY_WME))) < 0)
O_RDWR | O_CLOEXEC, MYF(MY_WME))) < 0)
goto err;
inited=1;
file_length= opt_tc_log_size;

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB
Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -3674,6 +3674,25 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
db= (char *)start;
query= (char *)(start + db_len + 1);
q_len= data_len - db_len -1;
if (data_len && (data_len < db_len ||
data_len < q_len ||
data_len != (db_len + q_len + 1)))
{
q_len= 0;
query= NULL;
DBUG_VOID_RETURN;
}
unsigned int max_length;
max_length= (event_len - ((const char*)(end + db_len + 1) -
(buf - common_header_len)));
if (q_len != max_length)
{
q_len= 0;
query= NULL;
DBUG_VOID_RETURN;
}
/**
Append the db length at the end of the buffer. This will be used by
Query_cache::send_result_to_client() in case the query cache is On.
@ -4144,6 +4163,20 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
you.
*/
thd->catalog= catalog_len ? (char *) catalog : (char *)"";
int len_error;
size_t valid_len= system_charset_info->cset->well_formed_len(system_charset_info,
db, db + db_len, db_len, &len_error);
if (valid_len != db_len)
{
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
ER_THD(thd, ER_SLAVE_FATAL_ERROR),
"Invalid database name in Query event.");
thd->is_slave_error= true;
goto end;
}
new_db.length= db_len;
new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length);
thd->set_db(new_db.str, new_db.length); /* allocates a copy of 'db' */
@ -4314,7 +4347,7 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
}
else
thd->variables.collation_database= thd->db_charset;
/*
Record any GTID in the same transaction, so slave state is
transactionally consistent.
@ -4860,7 +4893,13 @@ int Start_log_event_v3::do_apply_event(rpl_group_info *rgi)
*/
break;
default:
/* this case is impossible */
/*
This case is not expected. It can be either an event corruption or an
unsupported binary log version.
*/
rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
ER_THD(thd, ER_SLAVE_FATAL_ERROR),
"Binlog version not supported");
DBUG_RETURN(1);
}
DBUG_RETURN(error);
@ -5698,6 +5737,9 @@ int Load_log_event::copy_log_event(const char *buf, ulong event_len,
fields = (char*)field_lens + num_fields;
table_name = fields + field_block_len;
if (strlen(table_name) > NAME_LEN)
goto err;
db = table_name + table_name_len + 1;
DBUG_EXECUTE_IF ("simulate_invalid_address",
db_len = data_len;);
@ -7647,6 +7689,13 @@ User_var_log_event(const char* buf, uint event_len,
buf+= description_event->common_header_len +
description_event->post_header_len[USER_VAR_EVENT-1];
name_len= uint4korr(buf);
/* Avoid reading out of buffer */
if ((buf - buf_start) + UV_NAME_LEN_SIZE + name_len > event_len)
{
error= true;
goto err;
}
name= (char *) buf + UV_NAME_LEN_SIZE;
/*
@ -7704,6 +7753,11 @@ User_var_log_event(const char* buf, uint event_len,
we keep the flags set to UNDEF_F.
*/
uint bytes_read= ((val + val_len) - buf_start);
if (bytes_read > event_len)
{
error= true;
goto err;
}
if ((data_written - bytes_read) > 0)
{
flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
@ -9513,7 +9567,12 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
const uchar* const ptr_rows_data= (const uchar*) ptr_after_width;
size_t const data_size= event_len - (ptr_rows_data - (const uchar *) buf);
size_t const read_size= ptr_rows_data - (const unsigned char *) buf;
if (read_size > event_len)
{
DBUG_VOID_RETURN;
}
size_t const data_size= event_len - read_size;
DBUG_PRINT("info",("m_table_id: %lu m_flags: %d m_width: %lu data_size: %lu",
m_table_id, m_flags, m_width, (ulong) data_size));

View File

@ -1,4 +1,5 @@
/* Copyright (c) 2007, 2016, Oracle and/or its affiliates.
/* Copyright (c) 2007, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2016, MariaDB
Copyright (c) 2008, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -1051,7 +1051,7 @@ PSI_cond_key key_BINLOG_COND_xid_list, key_BINLOG_update_cond,
key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache,
key_BINLOG_COND_queue_busy;
#ifdef WITH_WSREP
PSI_cond_key key_COND_wsrep_rollback,
PSI_cond_key key_COND_wsrep_rollback, key_COND_wsrep_thd,
key_COND_wsrep_replaying, key_COND_wsrep_ready, key_COND_wsrep_sst,
key_COND_wsrep_sst_init, key_COND_wsrep_sst_thread;
#endif /* WITH_WSREP */
@ -1110,6 +1110,7 @@ static PSI_cond_info all_server_conds[]=
{ &key_COND_wsrep_sst_init, "COND_wsrep_sst_init", PSI_FLAG_GLOBAL},
{ &key_COND_wsrep_sst_thread, "wsrep_sst_thread", 0},
{ &key_COND_wsrep_rollback, "COND_wsrep_rollback", PSI_FLAG_GLOBAL},
{ &key_COND_wsrep_thd, "THD::COND_wsrep_thd", 0},
{ &key_COND_wsrep_replaying, "COND_wsrep_replaying", PSI_FLAG_GLOBAL},
#endif
{ &key_COND_flush_thread_cache, "COND_flush_thread_cache", PSI_FLAG_GLOBAL},

View File

@ -250,7 +250,8 @@ extern PSI_mutex_key key_PAGE_lock, key_LOCK_sync, key_LOCK_active,
#ifdef WITH_WSREP
extern PSI_mutex_key key_LOCK_wsrep_thd;
#endif /* WITH_WSREP */
extern PSI_cond_key key_COND_wsrep_thd;
#endif /* HAVE_WSREP */
#ifdef HAVE_OPENSSL
extern PSI_mutex_key key_LOCK_des_key_file;

View File

@ -873,8 +873,10 @@ bool subquery_types_allow_materialization(Item_in_subselect *in_subs)
Make sure that create_tmp_table will not fail due to too long keys.
See MDEV-7122. This check is performed inside create_tmp_table also and
we must do it so that we know the table has keys created.
Make sure that the length of the key for the temp_table is atleast
greater than 0.
*/
if (total_key_length > tmp_table_max_key_length() ||
if (!total_key_length || total_key_length > tmp_table_max_key_length() ||
elements > tmp_table_max_key_parts())
DBUG_RETURN(FALSE);
@ -1004,6 +1006,10 @@ bool check_for_outer_joins(List<TABLE_LIST> *join_list)
void find_and_block_conversion_to_sj(Item *to_find,
List_iterator_fast<Item_in_subselect> &li)
{
if (to_find->type() == Item::FUNC_ITEM &&
((Item_func*)to_find)->functype() == Item_func::IN_OPTIMIZER_FUNC)
to_find= ((Item_in_optimizer*)to_find)->get_wrapped_in_subselect_item();
if (to_find->type() != Item::SUBSELECT_ITEM ||
((Item_subselect *) to_find)->substype() != Item_subselect::IN_SUBS)
return;
@ -5954,5 +5960,6 @@ bool JOIN::choose_tableless_subquery_plan()
tmp_having= having;
}
}
exec_const_cond= conds;
return FALSE;
}

View File

@ -4950,7 +4950,7 @@ err_during_init:
*/
if (wsrep_node_dropped && wsrep_restart_slave)
{
if (wsrep_ready)
if (wsrep_ready_get())
{
WSREP_INFO("Slave error due to node temporarily non-primary"
"SQL slave will continue");

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2002, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, MariaDB
Copyright (c) 2002, 2018, Oracle and/or its affiliates.
Copyright (c) 2009, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -356,7 +356,7 @@ private:
bool m_print_once;
public:
Proc_table_intact() : m_print_once(TRUE) {}
Proc_table_intact() : m_print_once(TRUE) { has_keys= TRUE; }
protected:
void report_error(uint code, const char *fmt, ...);

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB
Copyright (c) 2009, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -11212,6 +11212,7 @@ static bool send_plugin_request_packet(MPVIO_EXT *mpvio,
const char *client_auth_plugin=
((st_mysql_auth *) (plugin_decl(mpvio->plugin)->info))->client_auth_plugin;
DBUG_EXECUTE_IF("auth_disconnect", { vio_close(net->vio); DBUG_RETURN(1); });
DBUG_ASSERT(client_auth_plugin);
/*

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates.
Copyright (c) 2011, 2016, MariaDB
Copyright (c) 2011, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,4 +1,6 @@
/* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2011, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -2559,6 +2559,7 @@ void Query_cache::init()
*/
if (global_system_variables.query_cache_type == 0)
{
m_cache_status= DISABLE_REQUEST;
free_cache();
m_cache_status= DISABLED;
}

View File

@ -1199,6 +1199,7 @@ THD::THD()
#ifdef WITH_WSREP
mysql_mutex_init(key_LOCK_wsrep_thd, &LOCK_wsrep_thd, MY_MUTEX_INIT_FAST);
mysql_cond_init(key_COND_wsrep_thd, &COND_wsrep_thd, NULL);
wsrep_ws_handle.trx_id = WSREP_UNDEFINED_TRX_ID;
wsrep_ws_handle.opaque = NULL;
wsrep_retry_counter = 0;
@ -2730,15 +2731,19 @@ void THD::check_and_register_item_tree_change(Item **place, Item **new_value,
void THD::rollback_item_tree_changes()
{
DBUG_ENTER("THD::rollback_item_tree_changes");
I_List_iterator<Item_change_record> it(change_list);
Item_change_record *change;
while ((change= it++))
{
DBUG_PRINT("info", ("Rollback: %p (%p) <- %p",
*change->place, change->place, change->old_value));
*change->place= change->old_value;
}
/* We can forget about changes memory: it's allocated in runtime memroot */
change_list.empty();
DBUG_VOID_RETURN;
}
@ -4785,7 +4790,7 @@ extern "C" int thd_binlog_format(const MYSQL_THD thd)
if (mysql_bin_log.is_open() && (thd->variables.option_bits & OPTION_BIN_LOG))
return (int) thd->variables.binlog_format;
else
return BINLOG_FORMAT_UNSPEC;
return BINLOG_FORMAT_UNSPEC;
}
extern "C" void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all)

View File

@ -2854,6 +2854,7 @@ public:
query_id_t first_query_id;
} binlog_evt_union;
mysql_cond_t COND_wsrep_thd;
/**
Internal parser state.
Note that since the parser is not re-entrant, we keep only one parser

View File

@ -4332,10 +4332,39 @@ bool select_create::send_eof()
*/
if (!table->s->tmp_table)
{
#ifdef WITH_WSREP
/*
append table level exclusive key for CTAS
*/
wsrep_key_arr_t key_arr= {0, 0};
wsrep_prepare_keys_for_isolation(thd,
create_table->db,
create_table->table_name,
table_list,
&key_arr);
int rcode = wsrep->append_key(
wsrep,
&thd->wsrep_ws_handle,
key_arr.keys, //&wkey,
key_arr.keys_len,
WSREP_KEY_EXCLUSIVE,
false);
wsrep_keys_free(&key_arr);
if (rcode) {
DBUG_PRINT("wsrep", ("row key failed: %d", rcode));
WSREP_ERROR("Appending table key for CTAS failed: %s, %d",
(wsrep_thd_query(thd)) ?
wsrep_thd_query(thd) : "void", rcode);
return true;
}
/* If commit fails, we should be able to reset the OK status. */
thd->get_stmt_da()->set_overwrite_status(TRUE);
#endif /* WITH_WSREP */
trans_commit_stmt(thd);
if (!(thd->variables.option_bits & OPTION_GTID_BEGIN))
trans_commit_implicit(thd);
#ifdef WITH_WSREP
thd->get_stmt_da()->set_overwrite_status(FALSE);
mysql_mutex_lock(&thd->LOCK_wsrep_thd);
if (thd->wsrep_conflict_state != NO_CONFLICT)
{

View File

@ -1053,7 +1053,7 @@ bool do_command(THD *thd)
* bail out if DB snapshot has not been installed. We however,
* allow queries "SET" and "SHOW", they are trapped later in execute_command
*/
if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready &&
if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready_get() &&
command != COM_QUERY &&
command != COM_PING &&
command != COM_QUIT &&
@ -2630,7 +2630,7 @@ mysql_execute_command(THD *thd)
We additionally allow all other commands that do not change data in
case wsrep_dirty_reads is enabled.
*/
if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready &&
if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready_get() &&
lex->sql_command != SQLCOM_SET_OPTION &&
!(thd->variables.wsrep_dirty_reads &&
!is_update_query(lex->sql_command)) &&
@ -2750,6 +2750,7 @@ mysql_execute_command(THD *thd)
{
WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_SHOW);
execute_show_status(thd, all_tables);
break;
}
case SQLCOM_SHOW_EXPLAIN:
@ -3782,7 +3783,7 @@ end_with_restore_list:
case SQLCOM_INSERT_SELECT:
{
WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE);
select_result *sel_result;
select_insert *sel_result;
bool explain= MY_TEST(lex->describe);
DBUG_ASSERT(first_table == all_tables && first_table != 0);
if ((res= insert_precheck(thd, all_tables)))
@ -4350,7 +4351,6 @@ end_with_restore_list:
if (res)
break;
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
switch (lex->sql_command) {
case SQLCOM_CREATE_EVENT:
{
@ -4386,7 +4386,6 @@ end_with_restore_list:
lex->spname->m_name);
break;
case SQLCOM_DROP_EVENT:
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
if (!(res= Events::drop_event(thd,
lex->spname->m_db, lex->spname->m_name,
lex->check_exists)))
@ -5395,7 +5394,6 @@ create_sp_error:
Note: SQLCOM_CREATE_VIEW also handles 'ALTER VIEW' commands
as specified through the thd->lex->create_view_mode flag.
*/
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
res= mysql_create_view(thd, first_table, thd->lex->create_view_mode);
break;
}
@ -5411,7 +5409,6 @@ create_sp_error:
case SQLCOM_CREATE_TRIGGER:
{
/* Conditionally writes to binlog. */
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
res= mysql_create_or_drop_trigger(thd, all_tables, 1);
break;
@ -5419,7 +5416,6 @@ create_sp_error:
case SQLCOM_DROP_TRIGGER:
{
/* Conditionally writes to binlog. */
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
res= mysql_create_or_drop_trigger(thd, all_tables, 0);
break;
}
@ -5484,13 +5480,11 @@ create_sp_error:
my_ok(thd);
break;
case SQLCOM_INSTALL_PLUGIN:
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
if (! (res= mysql_install_plugin(thd, &thd->lex->comment,
&thd->lex->ident)))
my_ok(thd);
break;
case SQLCOM_UNINSTALL_PLUGIN:
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL)
if (! (res= mysql_uninstall_plugin(thd, &thd->lex->comment,
&thd->lex->ident)))
my_ok(thd);

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2005, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2017, SkySQL Ab.
Copyright (c) 2009, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2005, 2013, Oracle and/or its affiliates.
Copyright (c) 2010, 2017, MariaDB Corporation.
Copyright (c) 2005, 2018, Oracle and/or its affiliates.
Copyright (c) 2010, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -2082,11 +2082,14 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name,
bool error;
int argc=orig_argc;
char **argv=orig_argv;
unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE] =
{ MYSQL_AUDIT_GENERAL_CLASSMASK };
DBUG_ENTER("mysql_install_plugin");
tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
if (!opt_noacl && check_table_access(thd, INSERT_ACL, &tables, FALSE, 1, FALSE))
DBUG_RETURN(TRUE);
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
/* need to open before acquiring LOCK_plugin or it will deadlock */
if (! (table = open_ltable(thd, &tables, TL_WRITE,
@ -2120,8 +2123,7 @@ bool mysql_install_plugin(THD *thd, const LEX_STRING *name,
See also mysql_uninstall_plugin() and initialize_audit_plugin()
*/
unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE] =
{ MYSQL_AUDIT_GENERAL_CLASSMASK };
mysql_audit_acquire_plugins(thd, event_class_mask);
mysql_mutex_lock(&LOCK_plugin);
@ -2152,6 +2154,10 @@ err:
if (argv)
free_defaults(argv);
DBUG_RETURN(error);
#ifdef WITH_WSREP
error:
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
}
@ -2218,17 +2224,30 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
TABLE_LIST tables;
LEX_STRING dl= *dl_arg;
bool error= false;
unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE] =
{ MYSQL_AUDIT_GENERAL_CLASSMASK };
DBUG_ENTER("mysql_uninstall_plugin");
tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
if (!opt_noacl && check_table_access(thd, DELETE_ACL, &tables, FALSE, 1, FALSE))
DBUG_RETURN(TRUE);
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
/* need to open before acquiring LOCK_plugin or it will deadlock */
if (! (table= open_ltable(thd, &tables, TL_WRITE, MYSQL_LOCK_IGNORE_TIMEOUT)))
DBUG_RETURN(TRUE);
if (!table->key_info)
{
my_printf_error(ER_UNKNOWN_ERROR,
"The table %s.%s has no primary key. "
"Please check the table definition and "
"create the primary key accordingly.", MYF(0),
table->s->db.str, table->s->table_name.str);
DBUG_RETURN(TRUE);
}
/*
Pre-acquire audit plugins for events that may potentially occur
during [UN]INSTALL PLUGIN.
@ -2250,8 +2269,6 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
See also mysql_install_plugin() and initialize_audit_plugin()
*/
unsigned long event_class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE] =
{ MYSQL_AUDIT_GENERAL_CLASSMASK };
mysql_audit_acquire_plugins(thd, event_class_mask);
mysql_mutex_lock(&LOCK_plugin);
@ -2281,6 +2298,10 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
mysql_mutex_unlock(&LOCK_plugin);
DBUG_RETURN(error);
#ifdef WITH_WSREP
error:
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
}

View File

@ -3269,9 +3269,9 @@ void Prepared_statement::cleanup_stmt()
DBUG_ENTER("Prepared_statement::cleanup_stmt");
DBUG_PRINT("enter",("stmt: 0x%lx", (long) this));
thd->rollback_item_tree_changes();
cleanup_items(free_list);
thd->cleanup_after_query();
thd->rollback_item_tree_changes();
DBUG_VOID_RETURN;
}
@ -3880,6 +3880,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
Statement stmt_backup;
Query_arena *old_stmt_arena;
bool error= TRUE;
bool qc_executed= FALSE;
char saved_cur_db_name_buf[SAFE_NAME_LEN+1];
LEX_STRING saved_cur_db_name=
@ -4002,6 +4003,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
thd->lex->sql_command= SQLCOM_SELECT;
status_var_increment(thd->status_var.com_stat[SQLCOM_SELECT]);
thd->update_stats();
qc_executed= TRUE;
}
}
@ -4040,7 +4042,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
thd->set_statement(&stmt_backup);
thd->stmt_arena= old_stmt_arena;
if (state == Query_arena::STMT_PREPARED)
if (state == Query_arena::STMT_PREPARED && !qc_executed)
state= Query_arena::STMT_EXECUTED;
if (error == 0 && this->lex->sql_command == SQLCOM_CALL)

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
Copyright (c) 2010, 2014, Monty Program Ab.
/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
Copyright (c) 2010, 2018, Monty Program Ab.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,6 +1,6 @@
/*
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2010, 2016, MariaDB
Copyright (c) 2010, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,6 @@
/*
Copyright (c) 2004, 2012, Oracle and/or its affiliates.
Copyright (c) 2010, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -507,6 +508,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
if (err_status)
goto end;
}
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
/* We should have only one table in table list. */
DBUG_ASSERT(tables->next_global == 0);
@ -611,6 +613,10 @@ end:
my_ok(thd);
DBUG_RETURN(result);
#ifdef WITH_WSREP
error:
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
}

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates.
Copyright (c) 2013, 2015, MariaDB
Copyright (c) 2012, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View File

@ -689,6 +689,8 @@ int mysql_update(THD *thd,
if (reinit_io_cache(&tempfile,READ_CACHE,0L,0,0))
error=1; /* purecov: inspected */
select->file=tempfile; // Read row ptrs from this file
// select->file was copied, update self-references.
setup_io_cache(&select->file);
if (error >= 0)
goto err;
}

View File

@ -429,6 +429,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
lex->link_first_table_back(view, link_to_local);
view->open_type= OT_BASE_ONLY;
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
/*
ignore lock specs for CREATE statement
@ -686,6 +687,10 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
lex->link_first_table_back(view, link_to_local);
DBUG_RETURN(0);
#ifdef WITH_WSREP
error:
res= TRUE;
#endif /* WITH_WSREP */
err:
THD_STAGE_INFO(thd, stage_end);
lex->link_first_table_back(view, link_to_local);

View File

@ -14576,6 +14576,11 @@ option_value_no_option_type:
| '@' '@' opt_var_ident_type internal_variable_name equal set_expr_or_default
{
struct sys_var_with_base tmp= $4;
if (tmp.var == trg_new_row_fake_var)
{
my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0), "NEW");
MYSQL_YYABORT;
}
/* Lookup if necessary: must be a system variable. */
if (tmp.var == NULL)
{

View File

@ -4646,7 +4646,7 @@ static Sys_var_mybool Sys_wsrep_on (
"wsrep_on", "To enable wsrep replication ",
SESSION_VAR(wsrep_on),
CMD_LINE(OPT_ARG), DEFAULT(TRUE),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(check_has_super),
ON_UPDATE(wsrep_on_update));
static Sys_var_charptr Sys_wsrep_start_position (
@ -4690,8 +4690,8 @@ static Sys_var_mybool Sys_wsrep_causal_reads(
static Sys_var_uint Sys_wsrep_sync_wait(
"wsrep_sync_wait", "Ensure \"synchronous\" read view before executing "
"an operation of the type specified by bitmask: 1 - READ(includes "
"SELECT, SHOW and BEGIN/START TRANSACTION); 2 - UPDATE and DELETE; 4 - "
"INSERT and REPLACE",
"SELECT and BEGIN/START TRANSACTION); 2 - UPDATE and DELETE; 4 - "
"INSERT and REPLACE; 8 - SHOW",
SESSION_VAR(wsrep_sync_wait), CMD_LINE(OPT_ARG),
VALID_RANGE(WSREP_SYNC_WAIT_NONE, WSREP_SYNC_WAIT_MAX),
DEFAULT(WSREP_SYNC_WAIT_NONE), BLOCK_SIZE(1),

View File

@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2015, Oracle and/or its affiliates.
Copyright (c) 2008, 2015, MariaDB
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2008, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -3640,7 +3640,7 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def)
/* Whether the table definition has already been validated. */
if (table->s->table_field_def_cache == table_def)
DBUG_RETURN(FALSE);
goto end;
if (table->s->fields != table_def->count)
{
@ -3803,6 +3803,16 @@ Table_check_intact::check(TABLE *table, const TABLE_FIELD_DEF *table_def)
if (! error)
table->s->table_field_def_cache= table_def;
end:
if (has_keys && !error && !table->key_info)
{
report_error(0, "Incorrect definition of table %s.%s: "
"indexes are missing",
table->s->db.str, table->alias.c_ptr());
error= TRUE;
}
DBUG_RETURN(error);
}

View File

@ -1,7 +1,7 @@
#ifndef TABLE_INCLUDED
#define TABLE_INCLUDED
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
Copyright (c) 2009, 2014, SkySQL Ab.
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2018, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -511,10 +511,11 @@ typedef struct st_table_field_def
class Table_check_intact
{
protected:
bool has_keys;
virtual void report_error(uint code, const char *fmt, ...)= 0;
public:
Table_check_intact() {}
Table_check_intact() : has_keys(FALSE) {}
virtual ~Table_check_intact() {}
/** Checks whether a table is intact. */
@ -2224,6 +2225,7 @@ struct TABLE_LIST
DBUG_PRINT("enter", ("Alias: '%s' Unit: %p",
(alias ? alias : "<NULL>"),
get_unit()));
derived= get_unit();
derived_type= ((derived_type & (derived ? DTYPE_MASK : DTYPE_VIEW)) |
DTYPE_TABLE | DTYPE_MATERIALIZE);
set_check_materialized();

View File

@ -119,10 +119,10 @@ void wsrep_post_commit(THD* thd, bool all)
switch (thd->wsrep_exec_mode)
{
case LOCAL_COMMIT:
case LOCAL_COMMIT:
{
DBUG_ASSERT(thd->wsrep_trx_meta.gtid.seqno != WSREP_SEQNO_UNDEFINED);
if (wsrep->post_commit(wsrep, &thd->wsrep_ws_handle))
if (wsrep && wsrep->post_commit(wsrep, &thd->wsrep_ws_handle))
{
DBUG_PRINT("wsrep", ("set committed fail"));
WSREP_WARN("set committed fail: %llu %d",
@ -131,18 +131,30 @@ void wsrep_post_commit(THD* thd, bool all)
wsrep_cleanup_transaction(thd);
break;
}
case LOCAL_STATE:
{
/*
Non-InnoDB statements may have populated events in stmt cache => cleanup
*/
WSREP_DEBUG("cleanup transaction for LOCAL_STATE: %s", thd->query());
wsrep_cleanup_transaction(thd);
break;
}
default: break;
case LOCAL_STATE:
{
/* non-InnoDB statements may have populated events in stmt cache
=> cleanup
*/
WSREP_DEBUG("cleanup transaction for LOCAL_STATE");
/*
Run post-rollback hook to clean up in the case if
some keys were populated for the transaction in provider
but during commit time there was no write set to replicate.
This may happen when client sets the SAVEPOINT and immediately
rolls back to savepoint after first operation.
*/
if (all && thd->wsrep_conflict_state != MUST_REPLAY &&
wsrep && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
{
WSREP_WARN("post_rollback fail: %llu %d",
(long long)thd->thread_id, thd->get_stmt_da()->status());
}
wsrep_cleanup_transaction(thd);
break;
}
default: break;
}
}
/*

View File

@ -13,6 +13,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <sql_plugin.h> // SHOW_MY_BOOL
#include <mysqld.h>
#include <sql_class.h>
#include <sql_parse.h>
@ -205,8 +206,7 @@ wsrep_view_handler_cb (void* app_ctx,
if (memcmp(&cluster_uuid, &view->state_id.uuid, sizeof(wsrep_uuid_t)))
{
memcpy((wsrep_uuid_t*)&cluster_uuid, &view->state_id.uuid,
sizeof(cluster_uuid));
memcpy(&cluster_uuid, &view->state_id.uuid, sizeof(cluster_uuid));
wsrep_uuid_print (&cluster_uuid, cluster_uuid_str,
sizeof(cluster_uuid_str));
@ -252,7 +252,7 @@ wsrep_view_handler_cb (void* app_ctx,
// version change
if (view->proto_ver != wsrep_protocol_version)
{
my_bool wsrep_ready_saved= wsrep_ready;
my_bool wsrep_ready_saved= wsrep_ready_get();
wsrep_ready_set(FALSE);
WSREP_INFO("closing client connections for "
"protocol change %ld -> %d",
@ -367,16 +367,34 @@ out:
return WSREP_CB_SUCCESS;
}
void wsrep_ready_set (my_bool x)
my_bool wsrep_ready_set (my_bool x)
{
WSREP_DEBUG("Setting wsrep_ready to %d", x);
if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort();
if (wsrep_ready != x)
my_bool ret= (wsrep_ready != x);
if (ret)
{
wsrep_ready= x;
mysql_cond_signal (&COND_wsrep_ready);
}
mysql_mutex_unlock (&LOCK_wsrep_ready);
return ret;
}
my_bool wsrep_ready_get (void)
{
if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort();
my_bool ret= wsrep_ready;
mysql_mutex_unlock (&LOCK_wsrep_ready);
return ret;
}
int wsrep_show_ready(THD *thd, SHOW_VAR *var, char *buff)
{
var->type= SHOW_MY_BOOL;
var->value= buff;
*((my_bool *)buff)= wsrep_ready_get();
return 0;
}
// Wait until wsrep has reached ready state
@ -395,17 +413,8 @@ void wsrep_ready_wait ()
static void wsrep_synced_cb(void* app_ctx)
{
WSREP_INFO("Synchronized with group, ready for connections");
bool signal_main= false;
if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort();
if (!wsrep_ready)
{
wsrep_ready= TRUE;
mysql_cond_signal (&COND_wsrep_ready);
signal_main= true;
}
my_bool signal_main= wsrep_ready_set(TRUE);
local_status.set(WSREP_MEMBER_SYNCED);
mysql_mutex_unlock (&LOCK_wsrep_ready);
if (signal_main)
{
@ -809,6 +818,8 @@ bool wsrep_must_sync_wait (THD* thd, uint mask)
{
return (thd->variables.wsrep_sync_wait & mask) &&
thd->variables.wsrep_on &&
!(thd->variables.wsrep_dirty_reads &&
!is_update_query(thd->lex->sql_command)) &&
!thd->in_active_multi_stmt_transaction() &&
thd->wsrep_conflict_state != REPLAYING &&
thd->wsrep_sync_wait_gtid.seqno == WSREP_SEQNO_UNDEFINED;
@ -856,17 +867,7 @@ bool wsrep_sync_wait (THD* thd, uint mask)
return false;
}
/*
* Helpers to deal with TOI key arrays
*/
typedef struct wsrep_key_arr
{
wsrep_key_t* keys;
size_t keys_len;
} wsrep_key_arr_t;
static void wsrep_keys_free(wsrep_key_arr_t* key_arr)
void wsrep_keys_free(wsrep_key_arr_t* key_arr)
{
for (size_t i= 0; i < key_arr->keys_len; ++i)
{
@ -931,11 +932,11 @@ static bool wsrep_prepare_key_for_isolation(const char* db,
}
/* Prepare key list from db/table and table_list */
static bool wsrep_prepare_keys_for_isolation(THD* thd,
const char* db,
const char* table,
const TABLE_LIST* table_list,
wsrep_key_arr_t* ka)
bool wsrep_prepare_keys_for_isolation(THD* thd,
const char* db,
const char* table,
const TABLE_LIST* table_list,
wsrep_key_arr_t* ka)
{
ka->keys= 0;
ka->keys_len= 0;
@ -1680,7 +1681,7 @@ wsrep_grant_mdl_exception(MDL_context *requestor_ctx,
}
else if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE)
{
WSREP_DEBUG("DROP caused BF abort");
WSREP_DEBUG("DROP caused BF abort, conf %d", granted_thd->wsrep_conflict_state);
ticket->wsrep_report(wsrep_debug);
mysql_mutex_unlock(&granted_thd->LOCK_wsrep_thd);
wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1);

View File

@ -140,6 +140,7 @@ extern const char* wsrep_provider_version;
extern const char* wsrep_provider_vendor;
int wsrep_show_status(THD *thd, SHOW_VAR *var, char *buff);
int wsrep_show_ready(THD *thd, SHOW_VAR *var, char *buff);
void wsrep_free_status(THD *thd);
int wsrep_init();
@ -257,6 +258,7 @@ extern wsrep_seqno_t wsrep_locked_seqno;
#define WSREP_QUERY(thd) (thd->query())
extern my_bool wsrep_ready_get();
extern void wsrep_ready_wait();
enum wsrep_trx_status {
@ -339,4 +341,15 @@ void wsrep_init_sidno(const wsrep_uuid_t&);
bool wsrep_node_is_donor();
bool wsrep_node_is_synced();
typedef struct wsrep_key_arr
{
wsrep_key_t* keys;
size_t keys_len;
} wsrep_key_arr_t;
bool wsrep_prepare_keys_for_isolation(THD* thd,
const char* db,
const char* table,
const TABLE_LIST* table_list,
wsrep_key_arr_t* ka);
void wsrep_keys_free(wsrep_key_arr_t* key_arr);
#endif /* WSREP_MYSQLD_H */

View File

@ -26,7 +26,7 @@
#include <pthread.h>
#include <cstdio>
void wsrep_ready_set (my_bool x);
my_bool wsrep_ready_set (my_bool x);
ssize_t wsrep_sst_prepare (void** msg);
wsrep_cb_status wsrep_sst_donate_cb (void* app_ctx,

View File

@ -1169,7 +1169,6 @@ wsrep_cb_status_t wsrep_sst_donate_cb (void* app_ctx, void* recv_ctx,
{
/* This will be reset when sync callback is called.
* Should we set wsrep_ready to FALSE here too? */
// wsrep_notify_status(WSREP_MEMBER_DONOR);
local_status.set(WSREP_MEMBER_DONOR);
const char* method = (char*)msg;

View File

@ -381,7 +381,7 @@ static void wsrep_replication_process(THD *thd)
case WSREP_TRX_MISSING:
/* these suggests a bug in provider code */
WSREP_WARN("bad return from recv() call: %d", rcode);
/* fall through to node shutdown */
/* fall through */
case WSREP_FATAL:
/* Cluster connectivity is lost.
*

View File

@ -264,7 +264,6 @@ process::process (const char* cmd, const char* type, char** env)
err_ = posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETSIGDEF |
POSIX_SPAWN_SETSIGMASK |
/* start a new process group */ POSIX_SPAWN_SETPGROUP |
POSIX_SPAWN_USEVFORK);
if (err_)
{

View File

@ -79,7 +79,7 @@ int heap_check_heap(HP_INFO *info, my_bool print_status)
}
hp_find_record(info,pos);
if (!info->current_ptr[share->reclength])
if (!info->current_ptr[share->visible])
deleted++;
else
records++;

View File

@ -91,15 +91,6 @@ ha_heap::ha_heap(handlerton *hton, TABLE_SHARE *table_arg)
int ha_heap::open(const char *name, int mode, uint test_if_locked)
{
if (table->s->reclength < sizeof (char*))
{
MEM_UNDEFINED(table->s->default_values + table->s->reclength,
sizeof(char*) - table->s->reclength);
table->s->reclength= sizeof(char*);
MEM_UNDEFINED(table->record[0], table->s->reclength);
MEM_UNDEFINED(table->record[1], table->s->reclength);
}
internal_table= MY_TEST(test_if_locked & HA_OPEN_INTERNAL_TABLE);
if (internal_table || (!(file= heap_open(name, mode)) && my_errno == ENOENT))
{
@ -723,7 +714,7 @@ heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table,
}
}
}
mem_per_row+= MY_ALIGN(share->reclength + 1, sizeof(char*));
mem_per_row+= MY_ALIGN(MY_MAX(share->reclength, sizeof(char*)) + 1, sizeof(char*));
if (table_arg->found_next_number_field)
{
keydef[share->next_number_index].flag|= HA_AUTO_KEY;

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