Merge branch '10.0' into bb-10.1-merge
This commit is contained in:
commit
0896d7ebc3
@ -50,7 +50,7 @@ IF(CMAKE_C_COMPILER MATCHES "icl")
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
ADD_DEFINITIONS(-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE)
|
ADD_DEFINITIONS(-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE)
|
||||||
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0600)
|
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0A00)
|
||||||
# We do not want the windows.h macros min/max
|
# We do not want the windows.h macros min/max
|
||||||
ADD_DEFINITIONS(-DNOMINMAX)
|
ADD_DEFINITIONS(-DNOMINMAX)
|
||||||
# Speed up build process excluding unused header files
|
# Speed up build process excluding unused header files
|
||||||
|
@ -1048,6 +1048,7 @@ INSERT INTO t2 VALUES (NULL),(NULL);
|
|||||||
CREATE TABLE t3 (c VARCHAR(1024) CHARACTER SET utf8, d INT) ENGINE=MyISAM;
|
CREATE TABLE t3 (c VARCHAR(1024) CHARACTER SET utf8, d INT) ENGINE=MyISAM;
|
||||||
CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3;
|
CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3;
|
||||||
INSERT INTO t3 VALUES ('abc',NULL),('def',4);
|
INSERT INTO t3 VALUES ('abc',NULL),('def',4);
|
||||||
|
set @save_join_cache_level= @@join_cache_level;
|
||||||
SET join_cache_level= 8;
|
SET join_cache_level= 8;
|
||||||
explain
|
explain
|
||||||
SELECT * FROM v1, t2, v3 WHERE a = c AND b = d;
|
SELECT * FROM v1, t2, v3 WHERE a = c AND b = d;
|
||||||
@ -1077,6 +1078,38 @@ i
|
|||||||
drop procedure pr;
|
drop procedure pr;
|
||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
set @@join_cache_level= @save_join_cache_level;
|
||||||
|
#
|
||||||
|
# MDEV-16307: Incorrect results when using BNLH join instead of BNL join with views
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (c1 text, c2 int);
|
||||||
|
INSERT INTO t1 VALUES ('a',1), ('c',3), ('g',7), ('d',4), ('c',3);
|
||||||
|
CREATE TABLE t2 (c1 text, c2 int);
|
||||||
|
INSERT INTO t2 VALUES ('b',2), ('c',3);
|
||||||
|
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
|
||||||
|
explain SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2
|
||||||
|
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join)
|
||||||
|
2 DERIVED t1 ALL NULL NULL NULL NULL 5
|
||||||
|
SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
|
||||||
|
c1 c2 c1 c2
|
||||||
|
c 3 c 3
|
||||||
|
c 3 c 3
|
||||||
|
set @save_join_cache_level= @@join_cache_level;
|
||||||
|
set @@join_cache_level=4;
|
||||||
|
explain SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
|
||||||
|
1 PRIMARY <derived2> hash_ALL NULL #hash#$hj 3 test.t2.c1 5 Using where; Using join buffer (flat, BNLH join)
|
||||||
|
2 DERIVED t1 ALL NULL NULL NULL NULL 5
|
||||||
|
SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
|
||||||
|
c1 c2 c1 c2
|
||||||
|
c 3 c 3
|
||||||
|
c 3 c 3
|
||||||
|
drop table t1,t2;
|
||||||
|
drop view v1;
|
||||||
|
set @@join_cache_level= @save_join_cache_level;
|
||||||
# end of 5.5
|
# end of 5.5
|
||||||
#
|
#
|
||||||
# Start of 10.1 tests
|
# Start of 10.1 tests
|
||||||
|
@ -1503,6 +1503,46 @@ DROP VIEW v2;
|
|||||||
DROP TABLE t1,t2;
|
DROP TABLE t1,t2;
|
||||||
SET optimizer_switch=@save_optimizer_switch;
|
SET optimizer_switch=@save_optimizer_switch;
|
||||||
#
|
#
|
||||||
|
# MDEV-16512
|
||||||
|
# Server crashes in find_field_in_table_ref on 2nd execution of SP referring to
|
||||||
|
# non-existing field
|
||||||
|
#
|
||||||
|
CREATE TABLE t (i INT);
|
||||||
|
CREATE PROCEDURE p() SELECT t1.f FROM t AS t1 JOIN t AS t2 USING (f);
|
||||||
|
CALL p;
|
||||||
|
ERROR 42S22: Unknown column 'f' in 'from clause'
|
||||||
|
CALL p;
|
||||||
|
ERROR 42S22: Unknown column 'f' in 'from clause'
|
||||||
|
FLUSH TABLES;
|
||||||
|
CALL p;
|
||||||
|
ERROR 42S22: Unknown column 'f' in 'from clause'
|
||||||
|
DROP TABLE t;
|
||||||
|
CREATE TABLE t (f INT);
|
||||||
|
CALL p;
|
||||||
|
ERROR 42S22: Unknown column 'f' in 'from clause'
|
||||||
|
DROP TABLE t;
|
||||||
|
CREATE TABLE t (i INT);
|
||||||
|
CALL p;
|
||||||
|
ERROR 42S22: Unknown column 'f' in 'from clause'
|
||||||
|
DROP PROCEDURE p;
|
||||||
|
DROP TABLE t;
|
||||||
|
CREATE TABLE t1 (a INT, b INT);
|
||||||
|
CREATE TABLE t2 (a INT);
|
||||||
|
CREATE TABLE t3 (a INT, c INT);
|
||||||
|
CREATE TABLE t4 (a INT, c INT);
|
||||||
|
CREATE TABLE t5 (a INT, c INT);
|
||||||
|
CREATE PROCEDURE p1() SELECT c FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a)
|
||||||
|
LEFT JOIN t5 USING (a)) USING (a);
|
||||||
|
CALL p1;
|
||||||
|
ERROR 23000: Column 'c' in field list is ambiguous
|
||||||
|
CALL p1;
|
||||||
|
ERROR 23000: Column 'c' in field list is ambiguous
|
||||||
|
DROP PROCEDURE p1;
|
||||||
|
DROP TABLE t1,t2,t3,t4,t5;
|
||||||
|
#
|
||||||
|
# End of MariaDB 5.5 tests
|
||||||
|
#
|
||||||
|
#
|
||||||
# Bug #35268: Parser can't handle STRAIGHT_JOIN with USING
|
# Bug #35268: Parser can't handle STRAIGHT_JOIN with USING
|
||||||
#
|
#
|
||||||
CREATE TABLE t1 (a int);
|
CREATE TABLE t1 (a int);
|
||||||
|
@ -5922,6 +5922,39 @@ SET join_buffer_space_limit= default;
|
|||||||
set optimizer_switch=@save_optimizer_switch;
|
set optimizer_switch=@save_optimizer_switch;
|
||||||
DROP TABLE t1,t4,t5,t2;
|
DROP TABLE t1,t4,t5,t2;
|
||||||
#
|
#
|
||||||
|
# MDEV-16603: BNLH for query with materialized semi-join
|
||||||
|
#
|
||||||
|
set join_cache_level=4;
|
||||||
|
CREATE TABLE t1 ( i1 int, v1 varchar(1)) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES (7,'x');
|
||||||
|
CREATE TABLE t2 (i1 int, v1 varchar(1), KEY v1 (v1,i1)) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t2 VALUES
|
||||||
|
(NULL,'x'),(1,'x'),(3,'x'),(5,'x'),(8,'x'),(48,'x'),
|
||||||
|
(228,'x'),(3,'y'),(1,'z'),(9,'z');
|
||||||
|
CREATE TABLE temp
|
||||||
|
SELECT t1.i1 AS f1, t1.v1 AS f2 FROM (t2 JOIN t1 ON (t1.v1 = t2.v1));
|
||||||
|
SELECT * FROM temp
|
||||||
|
WHERE (f1,f2) IN (SELECT t1.i1, t1.v1 FROM (t2 JOIN t1 ON (t1.v1 = t2.v1)));
|
||||||
|
f1 f2
|
||||||
|
7 x
|
||||||
|
7 x
|
||||||
|
7 x
|
||||||
|
7 x
|
||||||
|
7 x
|
||||||
|
7 x
|
||||||
|
7 x
|
||||||
|
EXPLAIN EXTENDED SELECT * FROM temp
|
||||||
|
WHERE (f1,f2) IN (SELECT t1.i1, t1.v1 FROM (t2 JOIN t1 ON (t1.v1 = t2.v1)));
|
||||||
|
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||||
|
1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 1 100.00
|
||||||
|
1 PRIMARY temp hash_ALL NULL #hash#$hj 9 test.t1.i1,test.t1.v1 7 100.00 Using where; Using join buffer (flat, BNLH join)
|
||||||
|
2 MATERIALIZED t1 ALL NULL NULL NULL NULL 1 100.00 Using where
|
||||||
|
2 MATERIALIZED t2 hash_index v1 #hash#v1:v1 4:9 test.t1.v1 10 10.00 Using join buffer (flat, BNLH join)
|
||||||
|
Warnings:
|
||||||
|
Note 1003 select `test`.`temp`.`f1` AS `f1`,`test`.`temp`.`f2` AS `f2` from `test`.`temp` semi join (`test`.`t2` join `test`.`t1`) where ((`test`.`temp`.`f1` = `test`.`t1`.`i1`) and (`test`.`t2`.`v1` = `test`.`t1`.`v1`) and (`test`.`temp`.`f2` = `test`.`t1`.`v1`))
|
||||||
|
DROP TABLE t1,t2,temp;
|
||||||
|
SET join_cache_level = default;
|
||||||
|
#
|
||||||
# MDEV-5123 Remove duplicated conditions pushed both to join_tab->select_cond and join_tab->cache_select->cond for blocked joins.
|
# MDEV-5123 Remove duplicated conditions pushed both to join_tab->select_cond and join_tab->cache_select->cond for blocked joins.
|
||||||
#
|
#
|
||||||
set join_cache_level=default;
|
set join_cache_level=default;
|
||||||
|
@ -516,6 +516,66 @@ use test;
|
|||||||
drop database db1;
|
drop database db1;
|
||||||
drop database db2;
|
drop database db2;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-16552: [10.0] ASAN global-buffer-overflow in is_stat_table / statistics_for_tables_is_needed
|
||||||
|
#
|
||||||
|
SET use_stat_tables = PREFERABLY;
|
||||||
|
SELECT CONVERT_TZ( '1991-09-20 10:11:02', '+00:00', 'GMT' );
|
||||||
|
CONVERT_TZ( '1991-09-20 10:11:02', '+00:00', 'GMT' )
|
||||||
|
NULL
|
||||||
|
set use_stat_tables=@save_use_stat_tables;
|
||||||
|
#
|
||||||
|
# MDEV-16757: manual addition of min/max statistics for BLOB
|
||||||
|
#
|
||||||
|
SET use_stat_tables= PREFERABLY;
|
||||||
|
CREATE TABLE t1 (pk INT PRIMARY KEY, t TEXT);
|
||||||
|
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
|
||||||
|
ANALYZE TABLE t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status Engine-independent statistics collected
|
||||||
|
test.t1 analyze Warning Engine-independent statistics are not collected for column 't'
|
||||||
|
test.t1 analyze status OK
|
||||||
|
SELECT * FROM mysql.column_stats;
|
||||||
|
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
|
||||||
|
test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL
|
||||||
|
DELETE FROM mysql.column_stats
|
||||||
|
WHERE db_name='test' AND table_name='t1' AND column_name='t';
|
||||||
|
INSERT INTO mysql.column_stats VALUES
|
||||||
|
('test','t1','t','bar','foo', 0.0, 3.0, 1.0, 0, NULL, NULL);
|
||||||
|
SELECT * FROM mysql.column_stats;
|
||||||
|
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
|
||||||
|
test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL
|
||||||
|
test t1 t bar foo 0.0000 3.0000 1.0000 0 NULL NULL
|
||||||
|
SELECT pk FROM t1;
|
||||||
|
pk
|
||||||
|
1
|
||||||
|
2
|
||||||
|
DROP TABLE t1;
|
||||||
|
set use_stat_tables=@save_use_stat_tables;
|
||||||
|
#
|
||||||
|
# MDEV-16760: CREATE OR REPLACE TABLE after ANALYZE TABLE
|
||||||
|
#
|
||||||
|
SET use_stat_tables= PREFERABLY;
|
||||||
|
CREATE TABLE t1 (pk int PRIMARY KEY, c varchar(32));
|
||||||
|
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
|
||||||
|
ANALYZE TABLE t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status Engine-independent statistics collected
|
||||||
|
test.t1 analyze status OK
|
||||||
|
SELECT * FROM t1;
|
||||||
|
pk c
|
||||||
|
1 foo
|
||||||
|
2 bar
|
||||||
|
SELECT * FROM mysql.column_stats;
|
||||||
|
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
|
||||||
|
test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL
|
||||||
|
test t1 c bar foo 0.0000 3.0000 1.0000 0 NULL NULL
|
||||||
|
CREATE OR REPLACE TABLE t1 (pk int PRIMARY KEY, a char(7));
|
||||||
|
SELECT * FROM t1;
|
||||||
|
pk a
|
||||||
|
SELECT * FROM mysql.column_stats;
|
||||||
|
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
|
||||||
|
DROP TABLE t1;
|
||||||
set use_stat_tables=@save_use_stat_tables;
|
set use_stat_tables=@save_use_stat_tables;
|
||||||
#
|
#
|
||||||
# MDEV-16757: manual addition of min/max statistics for BLOB
|
# MDEV-16757: manual addition of min/max statistics for BLOB
|
||||||
|
@ -543,6 +543,66 @@ use test;
|
|||||||
drop database db1;
|
drop database db1;
|
||||||
drop database db2;
|
drop database db2;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
#
|
||||||
|
# MDEV-16552: [10.0] ASAN global-buffer-overflow in is_stat_table / statistics_for_tables_is_needed
|
||||||
|
#
|
||||||
|
SET use_stat_tables = PREFERABLY;
|
||||||
|
SELECT CONVERT_TZ( '1991-09-20 10:11:02', '+00:00', 'GMT' );
|
||||||
|
CONVERT_TZ( '1991-09-20 10:11:02', '+00:00', 'GMT' )
|
||||||
|
NULL
|
||||||
|
set use_stat_tables=@save_use_stat_tables;
|
||||||
|
#
|
||||||
|
# MDEV-16757: manual addition of min/max statistics for BLOB
|
||||||
|
#
|
||||||
|
SET use_stat_tables= PREFERABLY;
|
||||||
|
CREATE TABLE t1 (pk INT PRIMARY KEY, t TEXT);
|
||||||
|
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
|
||||||
|
ANALYZE TABLE t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status Engine-independent statistics collected
|
||||||
|
test.t1 analyze Warning Engine-independent statistics are not collected for column 't'
|
||||||
|
test.t1 analyze status OK
|
||||||
|
SELECT * FROM mysql.column_stats;
|
||||||
|
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
|
||||||
|
test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL
|
||||||
|
DELETE FROM mysql.column_stats
|
||||||
|
WHERE db_name='test' AND table_name='t1' AND column_name='t';
|
||||||
|
INSERT INTO mysql.column_stats VALUES
|
||||||
|
('test','t1','t','bar','foo', 0.0, 3.0, 1.0, 0, NULL, NULL);
|
||||||
|
SELECT * FROM mysql.column_stats;
|
||||||
|
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
|
||||||
|
test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL
|
||||||
|
test t1 t bar foo 0.0000 3.0000 1.0000 0 NULL NULL
|
||||||
|
SELECT pk FROM t1;
|
||||||
|
pk
|
||||||
|
1
|
||||||
|
2
|
||||||
|
DROP TABLE t1;
|
||||||
|
set use_stat_tables=@save_use_stat_tables;
|
||||||
|
#
|
||||||
|
# MDEV-16760: CREATE OR REPLACE TABLE after ANALYZE TABLE
|
||||||
|
#
|
||||||
|
SET use_stat_tables= PREFERABLY;
|
||||||
|
CREATE TABLE t1 (pk int PRIMARY KEY, c varchar(32));
|
||||||
|
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
|
||||||
|
ANALYZE TABLE t1;
|
||||||
|
Table Op Msg_type Msg_text
|
||||||
|
test.t1 analyze status Engine-independent statistics collected
|
||||||
|
test.t1 analyze status OK
|
||||||
|
SELECT * FROM t1;
|
||||||
|
pk c
|
||||||
|
1 foo
|
||||||
|
2 bar
|
||||||
|
SELECT * FROM mysql.column_stats;
|
||||||
|
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
|
||||||
|
test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL
|
||||||
|
test t1 c bar foo 0.0000 3.0000 1.0000 0 NULL NULL
|
||||||
|
CREATE OR REPLACE TABLE t1 (pk int PRIMARY KEY, a char(7));
|
||||||
|
SELECT * FROM t1;
|
||||||
|
pk a
|
||||||
|
SELECT * FROM mysql.column_stats;
|
||||||
|
db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram
|
||||||
|
DROP TABLE t1;
|
||||||
set use_stat_tables=@save_use_stat_tables;
|
set use_stat_tables=@save_use_stat_tables;
|
||||||
#
|
#
|
||||||
# MDEV-16757: manual addition of min/max statistics for BLOB
|
# MDEV-16757: manual addition of min/max statistics for BLOB
|
||||||
|
@ -1713,6 +1713,57 @@ id
|
|||||||
13
|
13
|
||||||
drop table t1;
|
drop table t1;
|
||||||
#
|
#
|
||||||
|
# MDEV-15982: Incorrect results when subquery is materialized
|
||||||
|
#
|
||||||
|
CREATE TABLE `t1` (`id` int(32) NOT NULL primary key);
|
||||||
|
INSERT INTO `t1` VALUES
|
||||||
|
(45), (46), (47), (48), (49), (50), (51), (52), (53), (54), (55), (56), (57), (58), (59), (60), (61), (62),
|
||||||
|
(63), (64), (65), (66), (67), (68), (69), (70), (71), (72), (73), (74), (75), (76), (77), (78), (79), (80),
|
||||||
|
(81), (82), (83), (84), (85), (86), (87), (88), (89), (90), (91), (92),(93),(94),(95),(96), (97), (98),
|
||||||
|
(99), (100), (101), (102), (103), (104), (105), (106), (107), (108), (109), (110), (111), (112), (113),
|
||||||
|
(114), (115), (116), (117), (118), (119), (120), (121), (122), (123), (124), (125), (126), (127), (128),
|
||||||
|
(129), (130), (131), (132), (133), (134), (135), (136), (137), (138), (139), (140), (141), (142), (143), (144), (145), (146),
|
||||||
|
(147), (148), (149), (150), (151), (152), (153), (154), (155), (156), (157), (158), (159), (160), (161),
|
||||||
|
(162), (163), (164), (165), (166), (167), (168), (169), (170), (171), (172), (173),
|
||||||
|
(174), (175), (176), (177), (178), (179), (180), (181), (182), (183), (2), (3), (4), (5), (6), (19), (35),
|
||||||
|
(7), (20), (8), (36), (219), (22), (10), (23), (37), (11), (24);
|
||||||
|
CREATE TABLE `t2` (`type` int , `id` int(32) NOT NULL primary key);
|
||||||
|
INSERT INTO `t2` VALUES
|
||||||
|
(2,2),(2,3),(1,4),(2,5),(1,6),(1,19),(5,7),(1,20),(1,8),(1,21),(1,9),
|
||||||
|
(1,22),(2,10),(1,23),(2,11),(1,24),(1,12),(1,25),(2,13),(2,26),(2,14),
|
||||||
|
(2,27),(1,15),(1,28),(3,16),(1,29),(2,17),(1,30),(5,18),(2,1);
|
||||||
|
CREATE TABLE `t3` (`ref_id` int(32) unsigned ,`type` varchar(80),`id` int(32) NOT NULL );
|
||||||
|
INSERT INTO `t3` VALUES
|
||||||
|
(1,'incident',31),(2,'faux pas',32),
|
||||||
|
(5,'oopsies',33),(3,'deniable',34),
|
||||||
|
(11,'wasntme',35),(10,'wasntme',36),
|
||||||
|
(17,'faux pas',37),(13,'unlikely',38),
|
||||||
|
(13,'improbable',39),(14,'incident',40),
|
||||||
|
(26,'problem',41),(14,'problem',42),
|
||||||
|
(26,'incident',43),(27,'incident',44);
|
||||||
|
explain
|
||||||
|
SELECT t2.id FROM t2,t1
|
||||||
|
WHERE t2.id IN (SELECT t3.ref_id FROM t3,t1 where t3.id = t1.id) and t2.id = t1.id;
|
||||||
|
id select_type table type possible_keys key key_len ref rows Extra
|
||||||
|
1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 30 Using index
|
||||||
|
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 Using where
|
||||||
|
1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.id 1 Using index
|
||||||
|
2 MATERIALIZED t3 ALL NULL NULL NULL NULL 14
|
||||||
|
2 MATERIALIZED t1 eq_ref PRIMARY PRIMARY 4 test.t3.id 1 Using index
|
||||||
|
SELECT t2.id FROM t2,t1
|
||||||
|
WHERE t2.id IN (SELECT t3.ref_id FROM t3,t1 where t3.id = t1.id) and t2.id = t1.id;
|
||||||
|
id
|
||||||
|
10
|
||||||
|
11
|
||||||
|
set optimizer_switch='materialization=off';
|
||||||
|
SELECT t2.id FROM t2,t1
|
||||||
|
WHERE t2.id IN (SELECT t3.ref_id FROM t3,t1 where t3.id = t1.id) and t2.id = t1.id;
|
||||||
|
id
|
||||||
|
11
|
||||||
|
10
|
||||||
|
set optimizer_switch='materialization=on';
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
|
#
|
||||||
# MDEV-15247: Crash when SET NAMES 'utf8' is set
|
# MDEV-15247: Crash when SET NAMES 'utf8' is set
|
||||||
#
|
#
|
||||||
CREATE TABLE t1 (
|
CREATE TABLE t1 (
|
||||||
|
31
mysql-test/suite/binlog/include/check_binlog_size.inc
Normal file
31
mysql-test/suite/binlog/include/check_binlog_size.inc
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# This file runs the query and checks
|
||||||
|
# whether the size of binlog is increased or not
|
||||||
|
# If size is changed it issue die command
|
||||||
|
# Parameters
|
||||||
|
# $sql_query = query to run
|
||||||
|
|
||||||
|
#Only last row of show binlog events matter
|
||||||
|
--let $tmp= 0
|
||||||
|
--let $counter= 1
|
||||||
|
while ($tmp != "No such row")
|
||||||
|
{
|
||||||
|
--let $initial_binlog_size= $tmp
|
||||||
|
--let $tmp= query_get_value(show binary logs, File_size, $counter)
|
||||||
|
--inc $counter
|
||||||
|
}
|
||||||
|
|
||||||
|
--eval $sql_query
|
||||||
|
|
||||||
|
--let $tmp= 0
|
||||||
|
--let $counter= 1
|
||||||
|
while ($tmp != "No such row")
|
||||||
|
{
|
||||||
|
--let $current_binlog_size= $tmp
|
||||||
|
--let $tmp= query_get_value(show binary logs, File_size, $counter)
|
||||||
|
--inc $counter
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($initial_binlog_size != $current_binlog_size)
|
||||||
|
{
|
||||||
|
die "Binlog size changed";
|
||||||
|
}
|
7
mysql-test/suite/binlog/r/binlog_tmp_table_row.result
Normal file
7
mysql-test/suite/binlog/r/binlog_tmp_table_row.result
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
RESET MASTER;
|
||||||
|
#Create table test
|
||||||
|
create temporary table t1(a int, b int);
|
||||||
|
#Add index test
|
||||||
|
create index index_a on t1(a);
|
||||||
|
#drop index test
|
||||||
|
drop index index_a on t1;
|
30
mysql-test/suite/binlog/t/binlog_tmp_table_row.test
Normal file
30
mysql-test/suite/binlog/t/binlog_tmp_table_row.test
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# ==== Purpose ====
|
||||||
|
#
|
||||||
|
# Test if statements used temporary tables are not binlogged in the case of
|
||||||
|
# binlog_format=row
|
||||||
|
#
|
||||||
|
# ==== Method ====
|
||||||
|
#
|
||||||
|
# We will see if binlog file size is increased or not, It should be constant for the
|
||||||
|
# entire period of test.
|
||||||
|
#
|
||||||
|
# ==== Related bugs ====
|
||||||
|
#
|
||||||
|
# Mdev-9266
|
||||||
|
#
|
||||||
|
source include/have_log_bin.inc;
|
||||||
|
source include/have_binlog_format_row.inc;
|
||||||
|
|
||||||
|
RESET MASTER;
|
||||||
|
|
||||||
|
--echo #Create table test
|
||||||
|
--let $sql_query= create temporary table t1(a int, b int)
|
||||||
|
--source suite/binlog/include/check_binlog_size.inc
|
||||||
|
|
||||||
|
--echo #Add index test
|
||||||
|
--let $sql_query= create index index_a on t1(a)
|
||||||
|
--source suite/binlog/include/check_binlog_size.inc
|
||||||
|
|
||||||
|
--echo #drop index test
|
||||||
|
--let $sql_query= drop index index_a on t1
|
||||||
|
--source suite/binlog/include/check_binlog_size.inc
|
@ -327,8 +327,10 @@ SET sql_mode=DEFAULT;
|
|||||||
|
|
||||||
--copy_file std_data/frm/t1.frm $MYSQLD_DATADIR/test/t1.frm
|
--copy_file std_data/frm/t1.frm $MYSQLD_DATADIR/test/t1.frm
|
||||||
SHOW TABLES;
|
SHOW TABLES;
|
||||||
|
--replace_result $MYSQLD_DATADIR ./
|
||||||
--error ER_NOT_FORM_FILE
|
--error ER_NOT_FORM_FILE
|
||||||
SHOW CREATE TABLE t1;
|
SHOW CREATE TABLE t1;
|
||||||
|
--replace_result $MYSQLD_DATADIR ./
|
||||||
--error ER_NOT_FORM_FILE
|
--error ER_NOT_FORM_FILE
|
||||||
ALTER TABLE t1;
|
ALTER TABLE t1;
|
||||||
--remove_file $MYSQLD_DATADIR/test/t1.frm
|
--remove_file $MYSQLD_DATADIR/test/t1.frm
|
||||||
|
@ -913,6 +913,7 @@ CREATE TABLE t3 (c VARCHAR(1024) CHARACTER SET utf8, d INT) ENGINE=MyISAM;
|
|||||||
CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3;
|
CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3;
|
||||||
INSERT INTO t3 VALUES ('abc',NULL),('def',4);
|
INSERT INTO t3 VALUES ('abc',NULL),('def',4);
|
||||||
|
|
||||||
|
set @save_join_cache_level= @@join_cache_level;
|
||||||
SET join_cache_level= 8;
|
SET join_cache_level= 8;
|
||||||
explain
|
explain
|
||||||
SELECT * FROM v1, t2, v3 WHERE a = c AND b = d;
|
SELECT * FROM v1, t2, v3 WHERE a = c AND b = d;
|
||||||
@ -935,7 +936,27 @@ call pr(2);
|
|||||||
drop procedure pr;
|
drop procedure pr;
|
||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
set @@join_cache_level= @save_join_cache_level;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-16307: Incorrect results when using BNLH join instead of BNL join with views
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (c1 text, c2 int);
|
||||||
|
INSERT INTO t1 VALUES ('a',1), ('c',3), ('g',7), ('d',4), ('c',3);
|
||||||
|
CREATE TABLE t2 (c1 text, c2 int);
|
||||||
|
INSERT INTO t2 VALUES ('b',2), ('c',3);
|
||||||
|
CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
|
||||||
|
|
||||||
|
explain SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
|
||||||
|
SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
|
||||||
|
set @save_join_cache_level= @@join_cache_level;
|
||||||
|
set @@join_cache_level=4;
|
||||||
|
explain SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
|
||||||
|
SELECT v1.c1, v1.c2, t2.c1, t2.c2 FROM v1, t2 WHERE v1.c1=t2.c1;
|
||||||
|
drop table t1,t2;
|
||||||
|
drop view v1;
|
||||||
|
set @@join_cache_level= @save_join_cache_level;
|
||||||
--echo # end of 5.5
|
--echo # end of 5.5
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -1160,6 +1160,59 @@ DROP TABLE t1,t2;
|
|||||||
|
|
||||||
SET optimizer_switch=@save_optimizer_switch;
|
SET optimizer_switch=@save_optimizer_switch;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-16512
|
||||||
|
--echo # Server crashes in find_field_in_table_ref on 2nd execution of SP referring to
|
||||||
|
--echo # non-existing field
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t (i INT);
|
||||||
|
CREATE PROCEDURE p() SELECT t1.f FROM t AS t1 JOIN t AS t2 USING (f);
|
||||||
|
--error ER_BAD_FIELD_ERROR
|
||||||
|
CALL p;
|
||||||
|
--error ER_BAD_FIELD_ERROR
|
||||||
|
CALL p;
|
||||||
|
FLUSH TABLES;
|
||||||
|
--error ER_BAD_FIELD_ERROR
|
||||||
|
CALL p;
|
||||||
|
DROP TABLE t;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Fix the table definition to match the using
|
||||||
|
#
|
||||||
|
|
||||||
|
CREATE TABLE t (f INT);
|
||||||
|
#
|
||||||
|
# The following shouldn't fail as the table is now matching the using
|
||||||
|
#
|
||||||
|
--error ER_BAD_FIELD_ERROR
|
||||||
|
CALL p;
|
||||||
|
DROP TABLE t;
|
||||||
|
CREATE TABLE t (i INT);
|
||||||
|
--error ER_BAD_FIELD_ERROR
|
||||||
|
CALL p;
|
||||||
|
DROP PROCEDURE p;
|
||||||
|
DROP TABLE t;
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT, b INT);
|
||||||
|
CREATE TABLE t2 (a INT);
|
||||||
|
CREATE TABLE t3 (a INT, c INT);
|
||||||
|
CREATE TABLE t4 (a INT, c INT);
|
||||||
|
CREATE TABLE t5 (a INT, c INT);
|
||||||
|
CREATE PROCEDURE p1() SELECT c FROM t1 JOIN (t2 LEFT JOIN t3 USING (a) LEFT JOIN t4 USING (a)
|
||||||
|
LEFT JOIN t5 USING (a)) USING (a);
|
||||||
|
--error ER_NON_UNIQ_ERROR
|
||||||
|
CALL p1;
|
||||||
|
--error ER_NON_UNIQ_ERROR
|
||||||
|
CALL p1;
|
||||||
|
DROP PROCEDURE p1;
|
||||||
|
DROP TABLE t1,t2,t3,t4,t5;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # End of MariaDB 5.5 tests
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Bug #35268: Parser can't handle STRAIGHT_JOIN with USING
|
--echo # Bug #35268: Parser can't handle STRAIGHT_JOIN with USING
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -3869,6 +3869,37 @@ set optimizer_switch=@save_optimizer_switch;
|
|||||||
|
|
||||||
DROP TABLE t1,t4,t5,t2;
|
DROP TABLE t1,t4,t5,t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-16603: BNLH for query with materialized semi-join
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
|
set join_cache_level=4;
|
||||||
|
|
||||||
|
CREATE TABLE t1 ( i1 int, v1 varchar(1)) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t1 VALUES (7,'x');
|
||||||
|
|
||||||
|
CREATE TABLE t2 (i1 int, v1 varchar(1), KEY v1 (v1,i1)) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
INSERT INTO t2 VALUES
|
||||||
|
(NULL,'x'),(1,'x'),(3,'x'),(5,'x'),(8,'x'),(48,'x'),
|
||||||
|
(228,'x'),(3,'y'),(1,'z'),(9,'z');
|
||||||
|
|
||||||
|
CREATE TABLE temp
|
||||||
|
SELECT t1.i1 AS f1, t1.v1 AS f2 FROM (t2 JOIN t1 ON (t1.v1 = t2.v1));
|
||||||
|
|
||||||
|
let $q =
|
||||||
|
SELECT * FROM temp
|
||||||
|
WHERE (f1,f2) IN (SELECT t1.i1, t1.v1 FROM (t2 JOIN t1 ON (t1.v1 = t2.v1)));
|
||||||
|
|
||||||
|
eval $q;
|
||||||
|
eval EXPLAIN EXTENDED $q;
|
||||||
|
|
||||||
|
DROP TABLE t1,t2,temp;
|
||||||
|
|
||||||
|
SET join_cache_level = default;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # MDEV-5123 Remove duplicated conditions pushed both to join_tab->select_cond and join_tab->cache_select->cond for blocked joins.
|
--echo # MDEV-5123 Remove duplicated conditions pushed both to join_tab->select_cond and join_tab->cache_select->cond for blocked joins.
|
||||||
--echo #
|
--echo #
|
||||||
@ -3946,5 +3977,4 @@ SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user WHERE password_expired =
|
|||||||
set join_cache_level=default;
|
set join_cache_level=default;
|
||||||
|
|
||||||
# The following command must be the last one the file
|
# The following command must be the last one the file
|
||||||
# this must be the last command in the file
|
|
||||||
set @@optimizer_switch=@save_optimizer_switch;
|
set @@optimizer_switch=@save_optimizer_switch;
|
||||||
|
@ -305,6 +305,56 @@ drop database db1;
|
|||||||
drop database db2;
|
drop database db2;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-16552: [10.0] ASAN global-buffer-overflow in is_stat_table / statistics_for_tables_is_needed
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
SET use_stat_tables = PREFERABLY;
|
||||||
|
SELECT CONVERT_TZ( '1991-09-20 10:11:02', '+00:00', 'GMT' );
|
||||||
|
set use_stat_tables=@save_use_stat_tables;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-16757: manual addition of min/max statistics for BLOB
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
SET use_stat_tables= PREFERABLY;
|
||||||
|
|
||||||
|
CREATE TABLE t1 (pk INT PRIMARY KEY, t TEXT);
|
||||||
|
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
|
||||||
|
ANALYZE TABLE t1;
|
||||||
|
--sorted_result
|
||||||
|
SELECT * FROM mysql.column_stats;
|
||||||
|
DELETE FROM mysql.column_stats
|
||||||
|
WHERE db_name='test' AND table_name='t1' AND column_name='t';
|
||||||
|
INSERT INTO mysql.column_stats VALUES
|
||||||
|
('test','t1','t','bar','foo', 0.0, 3.0, 1.0, 0, NULL, NULL);
|
||||||
|
--sorted_result
|
||||||
|
SELECT * FROM mysql.column_stats;
|
||||||
|
|
||||||
|
SELECT pk FROM t1;
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
set use_stat_tables=@save_use_stat_tables;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-16760: CREATE OR REPLACE TABLE after ANALYZE TABLE
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
SET use_stat_tables= PREFERABLY;
|
||||||
|
|
||||||
|
CREATE TABLE t1 (pk int PRIMARY KEY, c varchar(32));
|
||||||
|
INSERT INTO t1 VALUES (1,'foo'),(2,'bar');
|
||||||
|
ANALYZE TABLE t1;
|
||||||
|
SELECT * FROM t1;
|
||||||
|
SELECT * FROM mysql.column_stats;
|
||||||
|
|
||||||
|
CREATE OR REPLACE TABLE t1 (pk int PRIMARY KEY, a char(7));
|
||||||
|
SELECT * FROM t1;
|
||||||
|
SELECT * FROM mysql.column_stats;
|
||||||
|
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
set use_stat_tables=@save_use_stat_tables;
|
set use_stat_tables=@save_use_stat_tables;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -346,6 +346,55 @@ WHERE (
|
|||||||
);
|
);
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-15982: Incorrect results when subquery is materialized
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE `t1` (`id` int(32) NOT NULL primary key);
|
||||||
|
INSERT INTO `t1` VALUES
|
||||||
|
(45), (46), (47), (48), (49), (50), (51), (52), (53), (54), (55), (56), (57), (58), (59), (60), (61), (62),
|
||||||
|
(63), (64), (65), (66), (67), (68), (69), (70), (71), (72), (73), (74), (75), (76), (77), (78), (79), (80),
|
||||||
|
(81), (82), (83), (84), (85), (86), (87), (88), (89), (90), (91), (92),(93),(94),(95),(96), (97), (98),
|
||||||
|
(99), (100), (101), (102), (103), (104), (105), (106), (107), (108), (109), (110), (111), (112), (113),
|
||||||
|
(114), (115), (116), (117), (118), (119), (120), (121), (122), (123), (124), (125), (126), (127), (128),
|
||||||
|
(129), (130), (131), (132), (133), (134), (135), (136), (137), (138), (139), (140), (141), (142), (143), (144), (145), (146),
|
||||||
|
(147), (148), (149), (150), (151), (152), (153), (154), (155), (156), (157), (158), (159), (160), (161),
|
||||||
|
(162), (163), (164), (165), (166), (167), (168), (169), (170), (171), (172), (173),
|
||||||
|
(174), (175), (176), (177), (178), (179), (180), (181), (182), (183), (2), (3), (4), (5), (6), (19), (35),
|
||||||
|
(7), (20), (8), (36), (219), (22), (10), (23), (37), (11), (24);
|
||||||
|
|
||||||
|
CREATE TABLE `t2` (`type` int , `id` int(32) NOT NULL primary key);
|
||||||
|
INSERT INTO `t2` VALUES
|
||||||
|
(2,2),(2,3),(1,4),(2,5),(1,6),(1,19),(5,7),(1,20),(1,8),(1,21),(1,9),
|
||||||
|
(1,22),(2,10),(1,23),(2,11),(1,24),(1,12),(1,25),(2,13),(2,26),(2,14),
|
||||||
|
(2,27),(1,15),(1,28),(3,16),(1,29),(2,17),(1,30),(5,18),(2,1);
|
||||||
|
|
||||||
|
CREATE TABLE `t3` (`ref_id` int(32) unsigned ,`type` varchar(80),`id` int(32) NOT NULL );
|
||||||
|
INSERT INTO `t3` VALUES
|
||||||
|
(1,'incident',31),(2,'faux pas',32),
|
||||||
|
(5,'oopsies',33),(3,'deniable',34),
|
||||||
|
(11,'wasntme',35),(10,'wasntme',36),
|
||||||
|
(17,'faux pas',37),(13,'unlikely',38),
|
||||||
|
(13,'improbable',39),(14,'incident',40),
|
||||||
|
(26,'problem',41),(14,'problem',42),
|
||||||
|
(26,'incident',43),(27,'incident',44);
|
||||||
|
|
||||||
|
explain
|
||||||
|
SELECT t2.id FROM t2,t1
|
||||||
|
WHERE t2.id IN (SELECT t3.ref_id FROM t3,t1 where t3.id = t1.id) and t2.id = t1.id;
|
||||||
|
|
||||||
|
SELECT t2.id FROM t2,t1
|
||||||
|
WHERE t2.id IN (SELECT t3.ref_id FROM t3,t1 where t3.id = t1.id) and t2.id = t1.id;
|
||||||
|
|
||||||
|
set optimizer_switch='materialization=off';
|
||||||
|
|
||||||
|
SELECT t2.id FROM t2,t1
|
||||||
|
WHERE t2.id IN (SELECT t3.ref_id FROM t3,t1 where t3.id = t1.id) and t2.id = t1.id;
|
||||||
|
set optimizer_switch='materialization=on';
|
||||||
|
|
||||||
|
DROP TABLE t1,t2,t3;
|
||||||
|
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # MDEV-15247: Crash when SET NAMES 'utf8' is set
|
--echo # MDEV-15247: Crash when SET NAMES 'utf8' is set
|
||||||
--echo #
|
--echo #
|
||||||
|
@ -628,6 +628,19 @@
|
|||||||
fun:dlopen*
|
fun:dlopen*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Warning caused by small memory leak in _dl_init
|
||||||
|
#
|
||||||
|
|
||||||
|
{
|
||||||
|
dl_init memory leak
|
||||||
|
Memcheck:Leak
|
||||||
|
fun:malloc
|
||||||
|
obj:*/libstdc++.so*
|
||||||
|
fun:call_init.part*
|
||||||
|
fun:_dl_init
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# In glibc (checked version 2.7), inet_ntoa allocates an 18-byte
|
# In glibc (checked version 2.7), inet_ntoa allocates an 18-byte
|
||||||
# per-thread static buffer for the return value. That memory is freed
|
# per-thread static buffer for the return value. That memory is freed
|
||||||
|
@ -241,6 +241,11 @@ cannot_find_file()
|
|||||||
echo "If you don't want to do a full install, you can use the --srcddir"
|
echo "If you don't want to do a full install, you can use the --srcddir"
|
||||||
echo "option to only install the mysql database and privilege tables"
|
echo "option to only install the mysql database and privilege tables"
|
||||||
echo
|
echo
|
||||||
|
echo "If you compiled from source, you need to either run 'make install' to"
|
||||||
|
echo "copy the software into the correct location ready for operation."
|
||||||
|
echo "If you don't want to do a full install, you can use the --srcdir"
|
||||||
|
echo "option to only install the mysql database and privilege tables"
|
||||||
|
echo
|
||||||
echo "If you are using a binary release, you must either be at the top"
|
echo "If you are using a binary release, you must either be at the top"
|
||||||
echo "level of the extracted archive, or pass the --basedir option"
|
echo "level of the extracted archive, or pass the --basedir option"
|
||||||
echo "pointing to that location."
|
echo "pointing to that location."
|
||||||
|
11
sql/log.cc
11
sql/log.cc
@ -2717,14 +2717,14 @@ void MYSQL_LOG::close(uint exiting)
|
|||||||
if (log_type == LOG_BIN && mysql_file_sync(log_file.file, MYF(MY_WME)) && ! write_error)
|
if (log_type == LOG_BIN && mysql_file_sync(log_file.file, MYF(MY_WME)) && ! write_error)
|
||||||
{
|
{
|
||||||
write_error= 1;
|
write_error= 1;
|
||||||
sql_print_error(ER_THD_OR_DEFAULT(current_thd, ER_ERROR_ON_WRITE), name, errno);
|
sql_print_error(ER_DEFAULT(ER_ERROR_ON_WRITE), name, errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(exiting & LOG_CLOSE_DELAYED_CLOSE) &&
|
if (!(exiting & LOG_CLOSE_DELAYED_CLOSE) &&
|
||||||
mysql_file_close(log_file.file, MYF(MY_WME)) && ! write_error)
|
mysql_file_close(log_file.file, MYF(MY_WME)) && ! write_error)
|
||||||
{
|
{
|
||||||
write_error= 1;
|
write_error= 1;
|
||||||
sql_print_error(ER_THD_OR_DEFAULT(current_thd, ER_ERROR_ON_WRITE), name, errno);
|
sql_print_error(ER_DEFAULT(ER_ERROR_ON_WRITE), name, errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2912,7 +2912,7 @@ err:
|
|||||||
if (!write_error)
|
if (!write_error)
|
||||||
{
|
{
|
||||||
write_error= 1;
|
write_error= 1;
|
||||||
sql_print_error(ER(ER_ERROR_ON_WRITE), name, errno);
|
sql_print_error(ER_DEFAULT(ER_ERROR_ON_WRITE), name, errno);
|
||||||
}
|
}
|
||||||
mysql_mutex_unlock(&LOCK_log);
|
mysql_mutex_unlock(&LOCK_log);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -3098,7 +3098,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time,
|
|||||||
if (! write_error)
|
if (! write_error)
|
||||||
{
|
{
|
||||||
write_error= 1;
|
write_error= 1;
|
||||||
sql_print_error(ER_THD(thd, ER_ERROR_ON_WRITE), name, tmp_errno);
|
sql_print_error(ER_DEFAULT(ER_ERROR_ON_WRITE), name, tmp_errno);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8426,8 +8426,7 @@ void MYSQL_BIN_LOG::close(uint exiting)
|
|||||||
if (mysql_file_close(index_file.file, MYF(0)) < 0 && ! write_error)
|
if (mysql_file_close(index_file.file, MYF(0)) < 0 && ! write_error)
|
||||||
{
|
{
|
||||||
write_error= 1;
|
write_error= 1;
|
||||||
sql_print_error(ER_THD_OR_DEFAULT(current_thd, ER_ERROR_ON_WRITE),
|
sql_print_error(ER_DEFAULT(ER_ERROR_ON_WRITE), index_file_name, errno);
|
||||||
index_file_name, errno);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log_state= (exiting & LOG_CLOSE_TO_BE_OPENED) ? LOG_TO_BE_OPENED : LOG_CLOSED;
|
log_state= (exiting & LOG_CLOSE_TO_BE_OPENED) ? LOG_TO_BE_OPENED : LOG_CLOSED;
|
||||||
|
@ -5505,6 +5505,11 @@ int win_main(int argc, char **argv)
|
|||||||
int mysqld_main(int argc, char **argv)
|
int mysqld_main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifndef _WIN32
|
||||||
|
/* We can't close stdin just now, because it may be booststrap mode. */
|
||||||
|
bool please_close_stdin= fcntl(STDIN_FILENO, F_GETFD) >= 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Perform basic thread library and malloc initialization,
|
Perform basic thread library and malloc initialization,
|
||||||
to be able to read defaults files and parse options.
|
to be able to read defaults files and parse options.
|
||||||
@ -5892,7 +5897,7 @@ int mysqld_main(int argc, char **argv)
|
|||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
// try to keep fd=0 busy
|
// try to keep fd=0 busy
|
||||||
if (!freopen("/dev/null", "r", stdin))
|
if (please_close_stdin && !freopen("/dev/null", "r", stdin))
|
||||||
{
|
{
|
||||||
// fall back on failure
|
// fall back on failure
|
||||||
fclose(stdin);
|
fclose(stdin);
|
||||||
|
@ -3548,7 +3548,8 @@ void fix_semijoin_strategies_for_picked_join_order(JOIN *join)
|
|||||||
first= tablenr - sjm->tables + 1;
|
first= tablenr - sjm->tables + 1;
|
||||||
join->best_positions[first].n_sj_tables= sjm->tables;
|
join->best_positions[first].n_sj_tables= sjm->tables;
|
||||||
join->best_positions[first].sj_strategy= SJ_OPT_MATERIALIZE;
|
join->best_positions[first].sj_strategy= SJ_OPT_MATERIALIZE;
|
||||||
join->sjm_lookup_tables|= s->table->map;
|
for (uint i= first; i < first+ sjm->tables; i++)
|
||||||
|
join->sjm_lookup_tables |= join->best_positions[i].table->table->map;
|
||||||
}
|
}
|
||||||
else if (pos->sj_strategy == SJ_OPT_MATERIALIZE_SCAN)
|
else if (pos->sj_strategy == SJ_OPT_MATERIALIZE_SCAN)
|
||||||
{
|
{
|
||||||
|
@ -7435,6 +7435,7 @@ store_natural_using_join_columns(THD *thd, TABLE_LIST *natural_using_join,
|
|||||||
Query_arena *arena, backup;
|
Query_arena *arena, backup;
|
||||||
bool result= TRUE;
|
bool result= TRUE;
|
||||||
List<Natural_join_column> *non_join_columns;
|
List<Natural_join_column> *non_join_columns;
|
||||||
|
List<Natural_join_column> *join_columns;
|
||||||
DBUG_ENTER("store_natural_using_join_columns");
|
DBUG_ENTER("store_natural_using_join_columns");
|
||||||
|
|
||||||
DBUG_ASSERT(!natural_using_join->join_columns);
|
DBUG_ASSERT(!natural_using_join->join_columns);
|
||||||
@ -7442,7 +7443,7 @@ store_natural_using_join_columns(THD *thd, TABLE_LIST *natural_using_join,
|
|||||||
arena= thd->activate_stmt_arena_if_needed(&backup);
|
arena= thd->activate_stmt_arena_if_needed(&backup);
|
||||||
|
|
||||||
if (!(non_join_columns= new List<Natural_join_column>) ||
|
if (!(non_join_columns= new List<Natural_join_column>) ||
|
||||||
!(natural_using_join->join_columns= new List<Natural_join_column>))
|
!(join_columns= new List<Natural_join_column>))
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
/* Append the columns of the first join operand. */
|
/* Append the columns of the first join operand. */
|
||||||
@ -7451,7 +7452,7 @@ store_natural_using_join_columns(THD *thd, TABLE_LIST *natural_using_join,
|
|||||||
nj_col_1= it_1.get_natural_column_ref();
|
nj_col_1= it_1.get_natural_column_ref();
|
||||||
if (nj_col_1->is_common)
|
if (nj_col_1->is_common)
|
||||||
{
|
{
|
||||||
natural_using_join->join_columns->push_back(nj_col_1, thd->mem_root);
|
join_columns->push_back(nj_col_1, thd->mem_root);
|
||||||
/* Reset the common columns for the next call to mark_common_columns. */
|
/* Reset the common columns for the next call to mark_common_columns. */
|
||||||
nj_col_1->is_common= FALSE;
|
nj_col_1->is_common= FALSE;
|
||||||
}
|
}
|
||||||
@ -7472,7 +7473,7 @@ store_natural_using_join_columns(THD *thd, TABLE_LIST *natural_using_join,
|
|||||||
{
|
{
|
||||||
const char *using_field_name_ptr= using_field_name->c_ptr();
|
const char *using_field_name_ptr= using_field_name->c_ptr();
|
||||||
List_iterator_fast<Natural_join_column>
|
List_iterator_fast<Natural_join_column>
|
||||||
it(*(natural_using_join->join_columns));
|
it(*join_columns);
|
||||||
Natural_join_column *common_field;
|
Natural_join_column *common_field;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
@ -7505,7 +7506,8 @@ store_natural_using_join_columns(THD *thd, TABLE_LIST *natural_using_join,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (non_join_columns->elements > 0)
|
if (non_join_columns->elements > 0)
|
||||||
natural_using_join->join_columns->append(non_join_columns);
|
join_columns->append(non_join_columns);
|
||||||
|
natural_using_join->join_columns= join_columns;
|
||||||
natural_using_join->is_join_columns_complete= TRUE;
|
natural_using_join->is_join_columns_complete= TRUE;
|
||||||
|
|
||||||
result= FALSE;
|
result= FALSE;
|
||||||
@ -7737,7 +7739,6 @@ static bool setup_natural_join_row_types(THD *thd,
|
|||||||
DBUG_PRINT("info", ("using cached setup_natural_join_row_types"));
|
DBUG_PRINT("info", ("using cached setup_natural_join_row_types"));
|
||||||
DBUG_RETURN(false);
|
DBUG_RETURN(false);
|
||||||
}
|
}
|
||||||
context->select_lex->first_natural_join_processing= false;
|
|
||||||
|
|
||||||
List_iterator_fast<TABLE_LIST> table_ref_it(*from_clause);
|
List_iterator_fast<TABLE_LIST> table_ref_it(*from_clause);
|
||||||
TABLE_LIST *table_ref; /* Current table reference. */
|
TABLE_LIST *table_ref; /* Current table reference. */
|
||||||
@ -7782,6 +7783,7 @@ static bool setup_natural_join_row_types(THD *thd,
|
|||||||
change on re-execution
|
change on re-execution
|
||||||
*/
|
*/
|
||||||
context->natural_join_first_table= context->first_name_resolution_table;
|
context->natural_join_first_table= context->first_name_resolution_table;
|
||||||
|
context->select_lex->first_natural_join_processing= false;
|
||||||
DBUG_RETURN (false);
|
DBUG_RETURN (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,6 +482,9 @@ void init_update_queries(void)
|
|||||||
sql_command_flags[SQLCOM_TRUNCATE]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT;
|
sql_command_flags[SQLCOM_TRUNCATE]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT;
|
||||||
/* We don't want to replicate DROP for temp tables in row format */
|
/* We don't want to replicate DROP for temp tables in row format */
|
||||||
sql_command_flags[SQLCOM_DROP_TABLE]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT;
|
sql_command_flags[SQLCOM_DROP_TABLE]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT;
|
||||||
|
/* We don't want to replicate CREATE/DROP INDEX for temp tables in row format */
|
||||||
|
sql_command_flags[SQLCOM_CREATE_INDEX]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT;
|
||||||
|
sql_command_flags[SQLCOM_DROP_INDEX]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT;
|
||||||
/* One can change replication mode with SET */
|
/* One can change replication mode with SET */
|
||||||
sql_command_flags[SQLCOM_SET_OPTION]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT;
|
sql_command_flags[SQLCOM_SET_OPTION]|= CF_FORCE_ORIGINAL_BINLOG_FORMAT;
|
||||||
|
|
||||||
|
@ -8896,7 +8896,6 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
|
|||||||
if (first_keyuse)
|
if (first_keyuse)
|
||||||
{
|
{
|
||||||
key_parts++;
|
key_parts++;
|
||||||
first_keyuse= FALSE;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -8906,7 +8905,7 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
|
|||||||
if (curr->keypart == keyuse->keypart &&
|
if (curr->keypart == keyuse->keypart &&
|
||||||
!(~used_tables & curr->used_tables) &&
|
!(~used_tables & curr->used_tables) &&
|
||||||
join_tab->keyuse_is_valid_for_access_in_chosen_plan(join,
|
join_tab->keyuse_is_valid_for_access_in_chosen_plan(join,
|
||||||
keyuse) &&
|
curr) &&
|
||||||
are_tables_local(join_tab, curr->used_tables))
|
are_tables_local(join_tab, curr->used_tables))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -8914,6 +8913,7 @@ static bool create_hj_key_for_table(JOIN *join, JOIN_TAB *join_tab,
|
|||||||
key_parts++;
|
key_parts++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
first_keyuse= FALSE;
|
||||||
keyuse++;
|
keyuse++;
|
||||||
} while (keyuse->table == table && keyuse->is_for_hash_join());
|
} while (keyuse->table == table && keyuse->is_for_hash_join());
|
||||||
if (!key_parts)
|
if (!key_parts)
|
||||||
|
19
sql/table.cc
19
sql/table.cc
@ -5665,7 +5665,7 @@ Field_iterator_table_ref::get_or_create_column_ref(THD *thd, TABLE_LIST *parent_
|
|||||||
nj_col= natural_join_it.column_ref();
|
nj_col= natural_join_it.column_ref();
|
||||||
DBUG_ASSERT(nj_col);
|
DBUG_ASSERT(nj_col);
|
||||||
}
|
}
|
||||||
DBUG_ASSERT(!nj_col->table_field ||
|
DBUG_ASSERT(!nj_col->table_field || !nj_col->table_field->field ||
|
||||||
nj_col->table_ref->table == nj_col->table_field->field->table);
|
nj_col->table_ref->table == nj_col->table_field->field->table);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5714,7 +5714,7 @@ Field_iterator_table_ref::get_or_create_column_ref(THD *thd, TABLE_LIST *parent_
|
|||||||
|
|
||||||
RETURN
|
RETURN
|
||||||
# Pointer to a column of a natural join (or its operand)
|
# Pointer to a column of a natural join (or its operand)
|
||||||
NULL No memory to allocate the column
|
NULL We didn't originally have memory to allocate the column
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Natural_join_column *
|
Natural_join_column *
|
||||||
@ -5730,7 +5730,7 @@ Field_iterator_table_ref::get_natural_column_ref()
|
|||||||
*/
|
*/
|
||||||
nj_col= natural_join_it.column_ref();
|
nj_col= natural_join_it.column_ref();
|
||||||
DBUG_ASSERT(nj_col &&
|
DBUG_ASSERT(nj_col &&
|
||||||
(!nj_col->table_field ||
|
(!nj_col->table_field || !nj_col->table_field->field ||
|
||||||
nj_col->table_ref->table == nj_col->table_field->field->table));
|
nj_col->table_ref->table == nj_col->table_field->field->table));
|
||||||
return nj_col;
|
return nj_col;
|
||||||
}
|
}
|
||||||
@ -6410,6 +6410,14 @@ void TABLE::create_key_part_by_field(KEY_PART_INFO *key_part_info,
|
|||||||
The function checks whether a possible key satisfies the constraints
|
The function checks whether a possible key satisfies the constraints
|
||||||
imposed on the keys of any temporary table.
|
imposed on the keys of any temporary table.
|
||||||
|
|
||||||
|
We need to filter out BLOB columns here, because ref access optimizer creates
|
||||||
|
KEYUSE objects for equalities for non-key columns for two puproses:
|
||||||
|
1. To discover possible keys for derived_with_keys optimization
|
||||||
|
2. To do hash joins
|
||||||
|
For the purpose of #1, KEYUSE objects are not created for "blob_column=..." .
|
||||||
|
However, they might be created for #2. In order to catch that case, we filter
|
||||||
|
them out here.
|
||||||
|
|
||||||
@return TRUE if the key is valid
|
@return TRUE if the key is valid
|
||||||
@return FALSE otherwise
|
@return FALSE otherwise
|
||||||
*/
|
*/
|
||||||
@ -6425,11 +6433,12 @@ bool TABLE::check_tmp_key(uint key, uint key_parts,
|
|||||||
{
|
{
|
||||||
uint fld_idx= next_field_no(arg);
|
uint fld_idx= next_field_no(arg);
|
||||||
reg_field= field + fld_idx;
|
reg_field= field + fld_idx;
|
||||||
|
if ((*reg_field)->type() == MYSQL_TYPE_BLOB)
|
||||||
|
return FALSE;
|
||||||
uint fld_store_len= (uint16) (*reg_field)->key_length();
|
uint fld_store_len= (uint16) (*reg_field)->key_length();
|
||||||
if ((*reg_field)->real_maybe_null())
|
if ((*reg_field)->real_maybe_null())
|
||||||
fld_store_len+= HA_KEY_NULL_LENGTH;
|
fld_store_len+= HA_KEY_NULL_LENGTH;
|
||||||
if ((*reg_field)->type() == MYSQL_TYPE_BLOB ||
|
if ((*reg_field)->real_type() == MYSQL_TYPE_VARCHAR ||
|
||||||
(*reg_field)->real_type() == MYSQL_TYPE_VARCHAR ||
|
|
||||||
(*reg_field)->type() == MYSQL_TYPE_GEOMETRY)
|
(*reg_field)->type() == MYSQL_TYPE_GEOMETRY)
|
||||||
fld_store_len+= HA_KEY_BLOB_LENGTH;
|
fld_store_len+= HA_KEY_BLOB_LENGTH;
|
||||||
key_len+= fld_store_len;
|
key_len+= fld_store_len;
|
||||||
|
@ -1875,6 +1875,33 @@ os_file_set_atomic_writes(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
/** Check that IO of specific size is possible for the file
|
||||||
|
opened with FILE_FLAG_NO_BUFFERING.
|
||||||
|
|
||||||
|
The requirement is that IO is multiple of the disk sector size.
|
||||||
|
|
||||||
|
@param[in] file file handle
|
||||||
|
@param[in] io_size expected io size
|
||||||
|
@return true - unbuffered io of requested size is possible, false otherwise.
|
||||||
|
|
||||||
|
@note: this function only works correctly with Windows 8 or later,
|
||||||
|
(GetFileInformationByHandleEx with FileStorageInfo is only supported there).
|
||||||
|
It will return true on earlier Windows version.
|
||||||
|
*/
|
||||||
|
static bool unbuffered_io_possible(HANDLE file, size_t io_size)
|
||||||
|
{
|
||||||
|
FILE_STORAGE_INFO info;
|
||||||
|
if (GetFileInformationByHandleEx(
|
||||||
|
file, FileStorageInfo, &info, sizeof(info))) {
|
||||||
|
ULONG sector_size = info.LogicalBytesPerSector;
|
||||||
|
if (sector_size)
|
||||||
|
return io_size % sector_size == 0;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/****************************************************************//**
|
/****************************************************************//**
|
||||||
NOTE! Use the corresponding macro os_file_create(), not directly
|
NOTE! Use the corresponding macro os_file_create(), not directly
|
||||||
this function!
|
this function!
|
||||||
@ -2041,7 +2068,19 @@ os_file_create_func(
|
|||||||
(LPCTSTR) name, access, share_mode, NULL,
|
(LPCTSTR) name, access, share_mode, NULL,
|
||||||
create_flag, attributes, NULL);
|
create_flag, attributes, NULL);
|
||||||
|
|
||||||
if (file == INVALID_HANDLE_VALUE) {
|
/* If FILE_FLAG_NO_BUFFERING was set, check if this can work at all,
|
||||||
|
for expected IO sizes. Reopen without the unbuffered flag, if it is won't work*/
|
||||||
|
if ((file.m_file != INVALID_HANDLE_VALUE)
|
||||||
|
&& (attributes & FILE_FLAG_NO_BUFFERING)
|
||||||
|
&& (type == OS_LOG_FILE)
|
||||||
|
&& !unbuffered_io_possible(file.m_file, OS_FILE_LOG_BLOCK_SIZE)) {
|
||||||
|
ut_a(CloseHandle(file.m_file));
|
||||||
|
attributes &= ~FILE_FLAG_NO_BUFFERING;
|
||||||
|
create_flag = OPEN_ALWAYS;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file.m_file == INVALID_HANDLE_VALUE) {
|
||||||
const char* operation;
|
const char* operation;
|
||||||
|
|
||||||
operation = (create_mode == OS_FILE_CREATE
|
operation = (create_mode == OS_FILE_CREATE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user