revision-id: 47ddf342e37006db1763d9f6c80ff8d2658a3822 (mariadb-10.0.35-74-g47ddf342e37)
parent(s): c631060713a2af2890284feb7aea96c0cf4ba49f fceda2dab6f8ea6c042f910cbc1d07d5df0cbc3c
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2018-07-30 13:00:42 +0200
message:
Merge branch '5.5' into 10.0
include/sql_common.h | 2 +-
mysql-test/r/grant.result | 4 +-
mysql-test/r/subselect_mat.result | 93 ++++++++++++++++++++++++++++++++++++
mysql-test/r/subselect_sj_mat.result | 93 ++++++++++++++++++++++++++++++++++++
mysql-test/r/union.result | 16 +++++++
mysql-test/t/grant.test | 3 ++
mysql-test/t/subselect_sj_mat.test | 79 ++++++++++++++++++++++++++++++
mysql-test/t/union.test | 15 ++++++
sql-common/client.c | 4 ++
sql/item.cc | 3 +-
sql/opt_subselect.cc | 66 +++++++++++++++++++++++++
sql/sql_acl.cc | 13 ++---
sql/sql_select.cc | 9 +++-
storage/myisam/ha_myisam.cc | 6 ++-
storage/myisam/mi_check.c | 6 ++-
storage/myisam/mi_locking.c | 6 ++-
16 files changed, 400 insertions(+), 18 deletions(-)
diff --cc mysql-test/r/subselect_mat.result
index ff09da022b4,eca3b760b65..05c4efff920
--- a/mysql-test/r/subselect_mat.result
+++ b/mysql-test/r/subselect_mat.result
@@@ -2362,77 -2360,100 +2362,170 @@@ ec70316637232000158bbfc8bcbe5d6
ebb4620037332000158bbfc8bcbe5d89
DROP TABLE t1,t2,t3;
set optimizer_switch=@save_optimizer_switch;
+ #
+ # MDEV-16751: Server crashes in st_join_table::cleanup or
+ # TABLE_LIST::is_with_table_recursive_reference with join_cache_level>2
+ #
+ set @save_join_cache_level= @@join_cache_level;
+ set join_cache_level=4;
+ CREATE TABLE t1 ( id int NOT NULL);
+ INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19);
+ CREATE TABLE t2 (i1 int NOT NULL, i2 int NOT NULL) ;
+ INSERT INTO t2 VALUES (11,11),(12,12),(13,13);
+ explain
+ SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
+ id select_type table type possible_keys key key_len ref rows Extra
+ 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
+ 1 PRIMARY t1 hash_ALL NULL #hash#$hj 4 test.t2.i1 9 Using where; Using join buffer (flat, BNLH join)
+ 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
+ SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
+ 1
+ 1
+ 1
+ 1
+ set @@join_cache_level= @save_join_cache_level;
+ alter table t1 add key(id);
+ explain
+ SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
+ id select_type table type possible_keys key key_len ref rows Extra
+ 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
+ 1 PRIMARY t1 ref id id 4 test.t2.i1 2 Using index
+ 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
+ SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
+ 1
+ 1
+ 1
+ 1
+ drop table t1,t2;
+ #
+ # MDEV-15454: Nested SELECT IN returns wrong results
+ #
+ CREATE TABLE t1 ( a int NOT NULL PRIMARY KEY);
+ CREATE TABLE t2 ( a int, b int );
+ INSERT INTO t2 VALUES (7878, 96),(3465, 96),(1403, 96),(4189, 96),(8732, 96), (5,96);
+ CREATE TABLE t3 (c int unsigned NOT NULL, b int unsigned NOT NULL, PRIMARY KEY (c,b));
+ INSERT INTO t3 (c, b) VALUES (27, 96);
+ CREATE PROCEDURE prepare_data()
+ BEGIN
+ DECLARE i INT DEFAULT 1;
+ WHILE i < 1000 DO
+ INSERT INTO t1 (a) VALUES (i);
+ INSERT INTO t2 (a,b) VALUES (i,56);
+ INSERT INTO t3 (c,b) VALUES (i,i);
+ SET i = i + 1;
+ END WHILE;
+ END$$
+ CALL prepare_data();
+ SELECT t2.a FROM t2 WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.c= 27);
+ a
+ 7878
+ 3465
+ 1403
+ 4189
+ 8732
+ 5
+ set @save_optimizer_switch= @@optimizer_switch;
+ SET optimizer_switch='materialization=off';
+ SELECT t1.a FROM t1
+ WHERE t1.a IN (SELECT t2.a FROM t2 WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.c= 27)) LIMIT 5;
+ a
+ 5
+ SET optimizer_switch='materialization=on';
+ SELECT t1.a FROM t1
+ WHERE t1.a IN (SELECT t2.a FROM t2 WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.c= 27)) LIMIT 5;
+ a
+ 5
+ drop procedure prepare_data;
+ set @@optimizer_switch= @save_optimizer_switch;
+ drop table t1,t2,t3;
+ CREATE TABLE t1 ( id int NOT NULL, key(id));
+ INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19);
+ CREATE TABLE t2 (i1 int NOT NULL, i2 int NOT NULL);
+ INSERT INTO t2 VALUES (11,11),(12,12),(13,13);
+ CREATE VIEW v1 AS SELECT t2.i1 FROM t2 where t2.i1 = t2.i2;
+ explain SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1);
+ id select_type table type possible_keys key key_len ref rows Extra
+ 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
+ 1 PRIMARY t1 ref id id 4 test.t2.i1 2 Using index
+ 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
+ SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1);
+ 1
+ 1
+ 1
+ 1
+ drop table t1,t2;
+ drop view v1;
# End of 5.5 tests
+#
+# MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT
+#
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a int, b int, c int);
+insert into t1
+select A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100
+from t0 A, t0 B, t0 C;
+create table t2 (a int, b int, c int);
+insert into t2 select A.a, A.a, A.a from t1 A;
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+create table t3 as select * from t2 limit 1;
+# The testcase only makes sense if the following uses Materialization:
+explain
+select * from t1 where (a,b) in (select max(a),b from t2 group by b);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 1000 Using where
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4000 Using temporary
+flush status;
+replace into t3
+select * from t1 where (a,b) in (select max(a),b from t2 group by b);
+# Sequential reads:
+# 1K is read from t1
+# 4K is read from t2
+# 1K groups is read from the tmp. table
+#
+# Lookups:
+# 4K lookups in group by table
+# 1K lookups in temp.table
+#
+# Writes:
+# 2x 1K writes to temporary tables (grouping table and subquery materialization table
+#
+# The point is that neither counter should be in the millions (this
+# will happen if Materialization is not used
+show status where Variable_name like 'Handler_read%' or Variable_name like 'Handler_%write%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 5000
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 6003
+Handler_tmp_write 2000
+Handler_write 1000
+drop table t0,t1,t2,t3;
+#
+# MDEV-7971: Assertion `name != __null' failed in ACL_internal_schema_registry::lookup
+# on 2nd execution os PS with multi-table update
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f2 INT);
+INSERT INTO t2 VALUES (3),(4);
+CREATE TABLE t3 (f3 INT);
+INSERT INTO t3 VALUES (5),(6);
+PREPARE stmt FROM '
+ UPDATE t1, t2
+ SET f1 = 5
+ WHERE 8 IN ( SELECT MIN(f3) FROM t3 )
+';
+EXECUTE stmt;
+EXECUTE stmt;
+DROP TABLE t1,t2,t3;
set @subselect_mat_test_optimizer_switch_value=null;
set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off';
set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
diff --cc mysql-test/r/subselect_sj_mat.result
index 4feab0c78b0,180c182a51a..05d54c7086f
--- a/mysql-test/r/subselect_sj_mat.result
+++ b/mysql-test/r/subselect_sj_mat.result
@@@ -2402,74 -2400,97 +2402,167 @@@ ec70316637232000158bbfc8bcbe5d6
ebb4620037332000158bbfc8bcbe5d89
DROP TABLE t1,t2,t3;
set optimizer_switch=@save_optimizer_switch;
+ #
+ # MDEV-16751: Server crashes in st_join_table::cleanup or
+ # TABLE_LIST::is_with_table_recursive_reference with join_cache_level>2
+ #
+ set @save_join_cache_level= @@join_cache_level;
+ set join_cache_level=4;
+ CREATE TABLE t1 ( id int NOT NULL);
+ INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19);
+ CREATE TABLE t2 (i1 int NOT NULL, i2 int NOT NULL) ;
+ INSERT INTO t2 VALUES (11,11),(12,12),(13,13);
+ explain
+ SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
+ id select_type table type possible_keys key key_len ref rows Extra
+ 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
+ 1 PRIMARY t1 hash_ALL NULL #hash#$hj 4 test.t2.i1 9 Using where; Using join buffer (flat, BNLH join)
+ 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
+ SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
+ 1
+ 1
+ 1
+ 1
+ set @@join_cache_level= @save_join_cache_level;
+ alter table t1 add key(id);
+ explain
+ SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
+ id select_type table type possible_keys key key_len ref rows Extra
+ 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
+ 1 PRIMARY t1 ref id id 4 test.t2.i1 2 Using index
+ 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
+ SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
+ 1
+ 1
+ 1
+ 1
+ drop table t1,t2;
+ #
+ # MDEV-15454: Nested SELECT IN returns wrong results
+ #
+ CREATE TABLE t1 ( a int NOT NULL PRIMARY KEY);
+ CREATE TABLE t2 ( a int, b int );
+ INSERT INTO t2 VALUES (7878, 96),(3465, 96),(1403, 96),(4189, 96),(8732, 96), (5,96);
+ CREATE TABLE t3 (c int unsigned NOT NULL, b int unsigned NOT NULL, PRIMARY KEY (c,b));
+ INSERT INTO t3 (c, b) VALUES (27, 96);
+ CREATE PROCEDURE prepare_data()
+ BEGIN
+ DECLARE i INT DEFAULT 1;
+ WHILE i < 1000 DO
+ INSERT INTO t1 (a) VALUES (i);
+ INSERT INTO t2 (a,b) VALUES (i,56);
+ INSERT INTO t3 (c,b) VALUES (i,i);
+ SET i = i + 1;
+ END WHILE;
+ END$$
+ CALL prepare_data();
+ SELECT t2.a FROM t2 WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.c= 27);
+ a
+ 7878
+ 3465
+ 1403
+ 4189
+ 8732
+ 5
+ set @save_optimizer_switch= @@optimizer_switch;
+ SET optimizer_switch='materialization=off';
+ SELECT t1.a FROM t1
+ WHERE t1.a IN (SELECT t2.a FROM t2 WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.c= 27)) LIMIT 5;
+ a
+ 5
+ SET optimizer_switch='materialization=on';
+ SELECT t1.a FROM t1
+ WHERE t1.a IN (SELECT t2.a FROM t2 WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.c= 27)) LIMIT 5;
+ a
+ 5
+ drop procedure prepare_data;
+ set @@optimizer_switch= @save_optimizer_switch;
+ drop table t1,t2,t3;
+ CREATE TABLE t1 ( id int NOT NULL, key(id));
+ INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19);
+ CREATE TABLE t2 (i1 int NOT NULL, i2 int NOT NULL);
+ INSERT INTO t2 VALUES (11,11),(12,12),(13,13);
+ CREATE VIEW v1 AS SELECT t2.i1 FROM t2 where t2.i1 = t2.i2;
+ explain SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1);
+ id select_type table type possible_keys key key_len ref rows Extra
+ 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 3
+ 1 PRIMARY t1 ref id id 4 test.t2.i1 2 Using index
+ 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
+ SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1);
+ 1
+ 1
+ 1
+ 1
+ drop table t1,t2;
+ drop view v1;
# End of 5.5 tests
+#
+# MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT
+#
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (a int, b int, c int);
+insert into t1
+select A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100
+from t0 A, t0 B, t0 C;
+create table t2 (a int, b int, c int);
+insert into t2 select A.a, A.a, A.a from t1 A;
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+create table t3 as select * from t2 limit 1;
+# The testcase only makes sense if the following uses Materialization:
+explain
+select * from t1 where (a,b) in (select max(a),b from t2 group by b);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 1000 Using where
+1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1
+2 MATERIALIZED t2 ALL NULL NULL NULL NULL 4000 Using temporary
+flush status;
+replace into t3
+select * from t1 where (a,b) in (select max(a),b from t2 group by b);
+# Sequential reads:
+# 1K is read from t1
+# 4K is read from t2
+# 1K groups is read from the tmp. table
+#
+# Lookups:
+# 4K lookups in group by table
+# 1K lookups in temp.table
+#
+# Writes:
+# 2x 1K writes to temporary tables (grouping table and subquery materialization table
+#
+# The point is that neither counter should be in the millions (this
+# will happen if Materialization is not used
+show status where Variable_name like 'Handler_read%' or Variable_name like 'Handler_%write%';
+Variable_name Value
+Handler_read_first 0
+Handler_read_key 5000
+Handler_read_last 0
+Handler_read_next 0
+Handler_read_prev 0
+Handler_read_retry 0
+Handler_read_rnd 0
+Handler_read_rnd_deleted 0
+Handler_read_rnd_next 6003
+Handler_tmp_write 2000
+Handler_write 1000
+drop table t0,t1,t2,t3;
+#
+# MDEV-7971: Assertion `name != __null' failed in ACL_internal_schema_registry::lookup
+# on 2nd execution os PS with multi-table update
+#
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (f2 INT);
+INSERT INTO t2 VALUES (3),(4);
+CREATE TABLE t3 (f3 INT);
+INSERT INTO t3 VALUES (5),(6);
+PREPARE stmt FROM '
+ UPDATE t1, t2
+ SET f1 = 5
+ WHERE 8 IN ( SELECT MIN(f3) FROM t3 )
+';
+EXECUTE stmt;
+EXECUTE stmt;
+DROP TABLE t1,t2,t3;
diff --cc mysql-test/t/grant.test
index b51f37899b8,5de3328944a..156a55e0466
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@@ -1651,8 -1659,12 +1651,11 @@@ use test
#
# Bug#16470 crash on grant if old grant tables
#
+
+ call mtr.add_suppression("Can't open and lock privilege tables");
+
--echo FLUSH PRIVILEGES without procs_priv table.
RENAME TABLE mysql.procs_priv TO mysql.procs_gone;
---error ER_NO_SUCH_TABLE
FLUSH PRIVILEGES;
--echo Assigning privileges without procs_priv table.
CREATE DATABASE mysqltest1;
diff --cc mysql-test/t/subselect_sj_mat.test
index c626d88e6ff,c82c1e7acec..1e10505e9f5
--- a/mysql-test/t/subselect_sj_mat.test
+++ b/mysql-test/t/subselect_sj_mat.test
@@@ -2157,71 -2151,83 +2157,150 @@@ eval $q
DROP TABLE t1,t2,t3;
set optimizer_switch=@save_optimizer_switch;
+ --echo #
+ --echo # MDEV-16751: Server crashes in st_join_table::cleanup or
+ --echo # TABLE_LIST::is_with_table_recursive_reference with join_cache_level>2
+ --echo #
+
+ set @save_join_cache_level= @@join_cache_level;
+ set join_cache_level=4;
+ CREATE TABLE t1 ( id int NOT NULL);
+ INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19);
+
+ CREATE TABLE t2 (i1 int NOT NULL, i2 int NOT NULL) ;
+ INSERT INTO t2 VALUES (11,11),(12,12),(13,13);
+
+ explain
+ SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
+ SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
+
+ set @@join_cache_level= @save_join_cache_level;
+ alter table t1 add key(id);
+
+ explain
+ SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
+ SELECT 1 FROM t1 where t1.id IN (SELECT t2.i1 FROM t2 WHERE t2.i1 = t2.i2);
+
+ drop table t1,t2;
+
+ --echo #
+ --echo # MDEV-15454: Nested SELECT IN returns wrong results
+ --echo #
+
+ CREATE TABLE t1 ( a int NOT NULL PRIMARY KEY);
+
+ CREATE TABLE t2 ( a int, b int );
+ INSERT INTO t2 VALUES (7878, 96),(3465, 96),(1403, 96),(4189, 96),(8732, 96), (5,96);
+
+ CREATE TABLE t3 (c int unsigned NOT NULL, b int unsigned NOT NULL, PRIMARY KEY (c,b));
+ INSERT INTO t3 (c, b) VALUES (27, 96);
+
+ DELIMITER $$;
+ CREATE PROCEDURE prepare_data()
+ BEGIN
+ DECLARE i INT DEFAULT 1;
+ WHILE i < 1000 DO
+ INSERT INTO t1 (a) VALUES (i);
+ INSERT INTO t2 (a,b) VALUES (i,56);
+ INSERT INTO t3 (c,b) VALUES (i,i);
+ SET i = i + 1;
+ END WHILE;
+ END$$
+ DELIMITER ;$$
+
+ CALL prepare_data();
+
+ SELECT t2.a FROM t2 WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.c= 27);
+
+ set @save_optimizer_switch= @@optimizer_switch;
+ SET optimizer_switch='materialization=off';
+
+ SELECT t1.a FROM t1
+ WHERE t1.a IN (SELECT t2.a FROM t2 WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.c= 27)) LIMIT 5;
+
+ SET optimizer_switch='materialization=on';
+
+ SELECT t1.a FROM t1
+ WHERE t1.a IN (SELECT t2.a FROM t2 WHERE t2.b IN (SELECT t3.b FROM t3 WHERE t3.c= 27)) LIMIT 5;
+
+ drop procedure prepare_data;
+ set @@optimizer_switch= @save_optimizer_switch;
+ drop table t1,t2,t3;
+
+ CREATE TABLE t1 ( id int NOT NULL, key(id));
+ INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19);
+ CREATE TABLE t2 (i1 int NOT NULL, i2 int NOT NULL);
+ INSERT INTO t2 VALUES (11,11),(12,12),(13,13);
+ CREATE VIEW v1 AS SELECT t2.i1 FROM t2 where t2.i1 = t2.i2;
+ explain SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1);
+ SELECT 1 FROM t1 where t1.id IN (SELECT v1.i1 from v1);
+ drop table t1,t2;
+ drop view v1;
--echo # End of 5.5 tests
+--echo #
+--echo # MDEV-7220: Materialization strategy is not used for REPLACE ... SELECT
+--echo #
+create table t0(a int);
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+
+create table t1 (a int, b int, c int);
+insert into t1
+select A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100, A.a+B.a*10+C.a*100
+from t0 A, t0 B, t0 C;
+
+create table t2 (a int, b int, c int);
+insert into t2 select A.a, A.a, A.a from t1 A;
+insert into t2 select * from t2;
+insert into t2 select * from t2;
+
+create table t3 as select * from t2 limit 1;
+
+--echo # The testcase only makes sense if the following uses Materialization:
+explain
+select * from t1 where (a,b) in (select max(a),b from t2 group by b);
+
+flush status;
+replace into t3
+select * from t1 where (a,b) in (select max(a),b from t2 group by b);
+--echo # Sequential reads:
+--echo # 1K is read from t1
+--echo # 4K is read from t2
+--echo # 1K groups is read from the tmp. table
+--echo #
+--echo # Lookups:
+--echo # 4K lookups in group by table
+--echo # 1K lookups in temp.table
+--echo #
+--echo # Writes:
+--echo # 2x 1K writes to temporary tables (grouping table and subquery materialization table
+--echo #
+--echo # The point is that neither counter should be in the millions (this
+--echo # will happen if Materialization is not used
+show status where Variable_name like 'Handler_read%' or Variable_name like 'Handler_%write%';
+
+drop table t0,t1,t2,t3;
+
+--echo #
+--echo # MDEV-7971: Assertion `name != __null' failed in ACL_internal_schema_registry::lookup
+--echo # on 2nd execution os PS with multi-table update
+--echo #
+CREATE TABLE t1 (f1 INT);
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (f2 INT);
+INSERT INTO t2 VALUES (3),(4);
+
+CREATE TABLE t3 (f3 INT);
+INSERT INTO t3 VALUES (5),(6);
+
+PREPARE stmt FROM '
+ UPDATE t1, t2
+ SET f1 = 5
+ WHERE 8 IN ( SELECT MIN(f3) FROM t3 )
+';
+
+EXECUTE stmt;
+EXECUTE stmt;
+
+DROP TABLE t1,t2,t3;
+
diff --cc sql/item.cc
index 49973d48912,33c35f8c3e0..70f3e387b57
--- a/sql/item.cc
+++ b/sql/item.cc
@@@ -9649,10 -9655,11 +9649,11 @@@ bool Item_type_holder::join_types(THD *
if (Field::result_merge_type(fld_type) == DECIMAL_RESULT)
{
+ collation.set_numeric();
- decimals= min(max(decimals, item->decimals), DECIMAL_MAX_SCALE);
+ decimals= MY_MIN(MY_MAX(decimals, item->decimals), DECIMAL_MAX_SCALE);
int item_int_part= item->decimal_int_part();
- int item_prec = max(prev_decimal_int_part, item_int_part) + decimals;
- int precision= min(item_prec, DECIMAL_MAX_PRECISION);
+ int item_prec = MY_MAX(prev_decimal_int_part, item_int_part) + decimals;
+ int precision= MY_MIN(item_prec, DECIMAL_MAX_PRECISION);
unsigned_flag&= item->unsigned_flag;
max_length= my_decimal_precision_to_length_no_truncation(precision,
decimals,
diff --cc sql/sql_acl.cc
index b957b5713d2,24740a0695a..fa0f4ad1563
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@@ -9951,13 -7189,8 +9951,8 @@@ bool sp_grant_privileges(THD *thd, cons
mysql_mutex_lock(&acl_cache->lock);
- if ((au= find_user_wild(combo->host.str=(char*)sctx->host_or_ip, combo->user.str)))
- goto found_acl;
- if ((au= find_user_wild(combo->host.str=(char*)sctx->host, combo->user.str)))
- goto found_acl;
- if ((au= find_user_wild(combo->host.str=(char*)sctx->ip, combo->user.str)))
- goto found_acl;
- if ((au= find_user_wild(combo->host.str=(char*)"%", combo->user.str)))
- if ((au= find_acl_user(combo->host.str= (char *) sctx->priv_host,
- combo->user.str, FALSE)))
++ if ((au= find_user_wild(combo->host.str= (char *) sctx->priv_host,
++ combo->user.str)))
goto found_acl;
mysql_mutex_unlock(&acl_cache->lock);
1
0

29 Jul '18
revision-id: aee3d162d236412bd1b8146f62dca299ccd71017 (mariadb-10.3.6-57-gaee3d162d23)
parent(s): 2a3d3e052f63cca4548c5bf8ef48040ecc39c5cf
author: Galina Shalygina
committer: Galina Shalygina
timestamp: 2018-07-29 14:40:58 +0200
message:
MDEV-16730: Server crashes in Bitmap<64u>::merge
The problem appears because of the pushdown of a non-pushable condition 'cond'
into the materialized derived table/view. To prevent pushdown a map of
tables that are used in 'cond' should be updated. This call is missing
because of the MDEV-12387 changes. The call is added in the
setup_jtbm_semi_joins() method.
---
mysql-test/main/in_subq_cond_pushdown.result | 17 +++++++++++++++++
mysql-test/main/in_subq_cond_pushdown.test | 19 +++++++++++++++++++
sql/opt_subselect.cc | 1 +
3 files changed, 37 insertions(+)
diff --git a/mysql-test/main/in_subq_cond_pushdown.result b/mysql-test/main/in_subq_cond_pushdown.result
index 06b7de7a5ac..4ad4180ff52 100644
--- a/mysql-test/main/in_subq_cond_pushdown.result
+++ b/mysql-test/main/in_subq_cond_pushdown.result
@@ -3814,3 +3814,20 @@ FROM t2
WHERE t2.b IN (SELECT MIN(t1.a) from t1);
b
DROP TABLE t1, t2;
+#
+# MDEV-16730: server fault caused by pushdown into the derived table
+# condition that joins IN subquery and parent select
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+SELECT *
+FROM (SELECT DISTINCT * FROM t1) AS tbl
+WHERE tbl.a IN
+(
+SELECT COUNT(t1.a)
+FROM t1
+WHERE (t1.a!=1)
+);
+a
+2
+DROP TABLE t1;
diff --git a/mysql-test/main/in_subq_cond_pushdown.test b/mysql-test/main/in_subq_cond_pushdown.test
index fe317c3bf94..8f911ea2f19 100644
--- a/mysql-test/main/in_subq_cond_pushdown.test
+++ b/mysql-test/main/in_subq_cond_pushdown.test
@@ -773,3 +773,22 @@ FROM t2
WHERE t2.b IN (SELECT MIN(t1.a) from t1);
DROP TABLE t1, t2;
+
+--echo #
+--echo # MDEV-16730: server fault caused by pushdown into the derived table
+--echo # condition that joins IN subquery and parent select
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1), (2), (3);
+
+SELECT *
+FROM (SELECT DISTINCT * FROM t1) AS tbl
+WHERE tbl.a IN
+(
+ SELECT COUNT(t1.a)
+ FROM t1
+ WHERE (t1.a!=1)
+);
+
+DROP TABLE t1;
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index de8cf1e54a1..1b3e2973133 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -5924,6 +5924,7 @@ bool setup_jtbm_semi_joins(JOIN *join, List<TABLE_LIST> *join_list,
Item *item;
while ((item=li++))
{
+ item->update_used_tables();
if (eq_list.push_back(item, thd->mem_root))
DBUG_RETURN(TRUE);
}
1
0

[Commits] fceda2dab6f: Merge remote-tracking branch 'mysql/5.5' into 5.5
by Oleksandr Byelkin 29 Jul '18
by Oleksandr Byelkin 29 Jul '18
29 Jul '18
revision-id: fceda2dab6f8ea6c042f910cbc1d07d5df0cbc3c (mariadb-5.5.60-51-gfceda2dab6f)
parent(s): bd0b368119b48ffbb1e5ab3cd2887270c5c6840e e48d775c6f066add457fa8cfb2ebc4d5ff0c7613
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2018-07-29 13:10:29 +0200
message:
Merge remote-tracking branch 'mysql/5.5' into 5.5
We do not accept:
1. We did not have this problem (fixed earlier and better)
d982e717aba67227ec40761a21a4211db91aa0e2 Bug#27510150: MYSQLDUMP FAILS FOR SPECIFIC --WHERE CLAUSES
2. We do not have such options (an DBUG_ASSERT put just in case)
bbc2e37fe4e0ca3a7cfa1437a763dc43829e98e2 Bug#27759871: BACKRONYM ISSUE IS STILL IN MYSQL 5.7
3. Serg fixed it in other way in this release:
e48d775c6f066add457fa8cfb2ebc4d5ff0c7613 Bug#27980823: HEAP OVERFLOW VULNERABILITIES IN MYSQL CLIENT LIBRARY
include/sql_common.h | 2 +-
mysql-test/r/grant.result | 4 +-
mysql-test/r/union.result | 16 +++++++
mysql-test/t/grant.test | 3 ++
mysql-test/t/union.test | 15 +++++++
sql-common/client.c | 4 ++
sql/item.cc | 3 +-
sql/sql_acl.cc | 105 +++++++++++++++++++++++++++-----------------
storage/myisam/ha_myisam.cc | 6 ++-
storage/myisam/mi_check.c | 6 ++-
storage/myisam/mi_locking.c | 6 ++-
11 files changed, 123 insertions(+), 47 deletions(-)
diff --cc include/sql_common.h
index 5bfe5ba8969,9571dff9778..ba0e898d526
--- a/include/sql_common.h
+++ b/include/sql_common.h
@@@ -1,8 -1,8 +1,8 @@@
#ifndef SQL_COMMON_INCLUDED
#define SQL_COMMON_INCLUDED
- /* Copyright (c) 2003, 2012, Oracle and/or its affiliates.
++/* Copyright (c) 2003, 2018, Oracle and/or its affiliates.
+ Copyright (c) 2010, 2018, MariaDB
-/* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
-
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
the Free Software Foundation; version 2 of the License.
diff --cc mysql-test/r/union.result
index 83d889b7b73,c0b364d0fde..5ea0f975a91
--- a/mysql-test/r/union.result
+++ b/mysql-test/r/union.result
@@@ -1914,122 -1861,18 +1914,138 @@@ SET @@long_query_time= @old_long_query_
SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log;
#
+# lp:1010729: Unexpected syntax error from UNION
+# (bug #54382) with single-table join nest
+#
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (b int);
+CREATE TABLE t3 (c int);
+SELECT a FROM t1 UNION SELECT b FROM t2 JOIN (t3) ON ( t2.b = t3.c );
+a
+DROP TABLE t1, t2, t3;
+CREATE TABLE t1 (pk int NOT NULL);
+CREATE TABLE t2 (pk int NOT NULL, fk int NOT NULL);
+SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk)
+UNION
+SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk);
+pk
+DROP TABLE t1,t2;
+create table t1 (a int);
+insert t1 values (1),(2),(3),(1);
+explain select 1 from dual where exists (select max(a) from t1 group by a union select a+2 from t1);
+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 t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort
+3 UNION t1 ALL NULL NULL NULL NULL 4
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+drop table t1;
+#
+# MDEV-6868:MariaDB server crash ( select with union and order by
+# with subquery )
+#
+CREATE TABLE t1 ( id INTEGER, sample_name1 VARCHAR(100), sample_name2 VARCHAR(100), PRIMARY KEY(id) );
+INSERT INTO t1 ( id, sample_name1, sample_name2 ) VALUES ( 1, 'aaaa', 'bbbb' ), ( 2, 'cccc', 'dddd' );
+(
+SELECT sample_name1 AS testname FROM t1
+)
+UNION
+(
+SELECT sample_name2 AS testname FROM t1 C ORDER BY (SELECT T.sample_name1 FROM t1 T WHERE T.id = C.id)
+)
+;
+testname
+aaaa
+cccc
+bbbb
+dddd
+drop table t1;
+#
+# MDEV-10172: UNION query returns incorrect rows outside
+# conditional evaluation
+#
+create table t1 (d datetime not null primary key);
+insert into t1(d) values ('2016-06-01'),('2016-06-02'),('2016-06-03'),('2016-06-04');
+select * from
+(
+select * from t1 where d between '2016-06-02' and '2016-06-05'
+ union
+(select * from t1 where d < '2016-06-05' order by d desc limit 1)
+) onlyJun2toJun4
+order by d;
+d
+2016-06-02 00:00:00
+2016-06-03 00:00:00
+2016-06-04 00:00:00
+drop table t1;
+End of 5.0 tests
+create table t1 (a int, b int);
+insert into t1 values (1,1),(2,2),(3,3);
+create table t2 (c varchar(30), d varchar(30));
+insert into t1 values ('1','1'),('2','2'),('4','4');
+create table t3 (e int, f int);
+insert into t3 values (1,1),(2,2),(31,31),(32,32);
+select e,f, (e , f) in (select e,b from t1 union select c,d from t2) as sub from t3;
+e f sub
+1 1 1
+2 2 1
+31 31 0
+32 32 0
+select avg(f), (e , f) in (select e,b from t1 union select c,d from t2) as sub from t3 group by sub;
+avg(f) sub
+31.5000 0
+1.5000 1
+drop table t1,t2,t3;
+#
+# MDEV-14715 Assertion `!table || (!table->read_set ||
+# bitmap_is_set(table->read_set, field_index))'
+# failed in Field_num::val_decimal
+#
+CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
+CREATE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1, NULL),(3, 4);
+(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + sum(a))
+UNION
+(SELECT 2, 2);
+ERROR HY000: Invalid use of group function
+(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1)
+UNION
+(SELECT 2, 2);
+a f
+1 1
+3 3
+2 2
+SELECT a, b FROM t1
+UNION
+(SELECT a, VAR_POP(a) AS f FROM v1 GROUP BY a ORDER BY b/a );
+a b
+1 NULL
+3 4
+1 0
+3 0
+DROP TABLE t1;
+(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1)
+UNION
+(SELECT 2, 2);
+ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
+DROP VIEW v1;
+(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1)
+UNION
+(SELECT 2, 2);
+ERROR 42S02: Table 'test.v1' doesn't exist
++#
+ # Bug#27197235 USER VARIABLE + UINON + DECIMAL COLUMN RETURNS
+ # WRONG VALUES
+ #
+ SET NAMES utf8;
+ SET @advertAcctId = 1000003;
+ select @advertAcctId as a from dual union all select 1.0 from dual;
+ a
+ 1000003.0
+ 1.0
+ SET NAMES latin1;
+ SET @advertAcctId = 1000003;
+ select @advertAcctId as a from dual union all select 1.0 from dual;
+ a
+ 1000003.0
+ 1.0
+End of 5.5 tests
diff --cc mysql-test/t/union.test
index 55d09a7d5ac,d7e362558e3..240115837c7
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@@ -1304,121 -1256,17 +1304,136 @@@ SET @@long_query_time= @old_long_query_
SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log;
+--echo #
+--echo # lp:1010729: Unexpected syntax error from UNION
+--echo # (bug #54382) with single-table join nest
+--echo #
+CREATE TABLE t1 (a int);
+CREATE TABLE t2 (b int);
+CREATE TABLE t3 (c int);
+SELECT a FROM t1 UNION SELECT b FROM t2 JOIN (t3) ON ( t2.b = t3.c );
+
+DROP TABLE t1, t2, t3;
+
+CREATE TABLE t1 (pk int NOT NULL);
+CREATE TABLE t2 (pk int NOT NULL, fk int NOT NULL);
+SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk)
+UNION
+SELECT t1.pk FROM t1 LEFT JOIN (t2) ON (t1.pk = t2.fk);
+
+DROP TABLE t1,t2;
+
+#
+# Bug #18167356: EXPLAIN W/ EXISTS(SELECT* UNION SELECT*)
+# WHERE ONE OF SELECT* IS DISTINCT FAILS.
+#
+create table t1 (a int);
+insert t1 values (1),(2),(3),(1);
+explain select 1 from dual where exists (select max(a) from t1 group by a union select a+2 from t1);
+drop table t1;
+
+--echo #
+--echo # MDEV-6868:MariaDB server crash ( select with union and order by
+--echo # with subquery )
+--echo #
+
+CREATE TABLE t1 ( id INTEGER, sample_name1 VARCHAR(100), sample_name2 VARCHAR(100), PRIMARY KEY(id) );
+
+INSERT INTO t1 ( id, sample_name1, sample_name2 ) VALUES ( 1, 'aaaa', 'bbbb' ), ( 2, 'cccc', 'dddd' );
+
+(
+ SELECT sample_name1 AS testname FROM t1
+)
+UNION
+(
+ SELECT sample_name2 AS testname FROM t1 C ORDER BY (SELECT T.sample_name1 FROM t1 T WHERE T.id = C.id)
+)
+;
+
+drop table t1;
+
+
+--echo #
+--echo # MDEV-10172: UNION query returns incorrect rows outside
+--echo # conditional evaluation
+--echo #
+
+create table t1 (d datetime not null primary key);
+insert into t1(d) values ('2016-06-01'),('2016-06-02'),('2016-06-03'),('2016-06-04');
+select * from
+(
+ select * from t1 where d between '2016-06-02' and '2016-06-05'
+ union
+ (select * from t1 where d < '2016-06-05' order by d desc limit 1)
+) onlyJun2toJun4
+order by d;
+drop table t1;
+
+--echo End of 5.0 tests
+
+#
+# Bug #24595639: INCORRECT BEHAVIOR IN QUERY WITH UNION AND GROUP BY
+#
+create table t1 (a int, b int);
+insert into t1 values (1,1),(2,2),(3,3);
+create table t2 (c varchar(30), d varchar(30));
+insert into t1 values ('1','1'),('2','2'),('4','4');
+create table t3 (e int, f int);
+insert into t3 values (1,1),(2,2),(31,31),(32,32);
+select e,f, (e , f) in (select e,b from t1 union select c,d from t2) as sub from t3;
+select avg(f), (e , f) in (select e,b from t1 union select c,d from t2) as sub from t3 group by sub;
+drop table t1,t2,t3;
+
+--echo #
+--echo # MDEV-14715 Assertion `!table || (!table->read_set ||
+--echo # bitmap_is_set(table->read_set, field_index))'
+--echo # failed in Field_num::val_decimal
+--echo #
+
+CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
+CREATE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1, NULL),(3, 4);
+
+--error ER_INVALID_GROUP_FUNC_USE
+(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + sum(a))
+UNION
+(SELECT 2, 2);
+
+(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1)
+UNION
+(SELECT 2, 2);
+
+SELECT a, b FROM t1
+UNION
+(SELECT a, VAR_POP(a) AS f FROM v1 GROUP BY a ORDER BY b/a );
+
+DROP TABLE t1;
+
+--error ER_VIEW_INVALID
+(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1)
+UNION
+(SELECT 2, 2);
+
+DROP VIEW v1;
+
+--error ER_NO_SUCH_TABLE
+(SELECT a, sum(a) AS f FROM v1 group by a ORDER BY b + 1)
+UNION
+(SELECT 2, 2);
+
+ --echo #
+ --echo # Bug#27197235 USER VARIABLE + UINON + DECIMAL COLUMN RETURNS
+ --echo # WRONG VALUES
+ --echo #
+
+ let $old_charset= `SELECT @@character_set_client`;
+
+ SET NAMES utf8;
+ SET @advertAcctId = 1000003;
+ select @advertAcctId as a from dual union all select 1.0 from dual;
+
+ eval SET NAMES $old_charset;
+ SET @advertAcctId = 1000003;
+ select @advertAcctId as a from dual union all select 1.0 from dual;
++
+--echo End of 5.5 tests
diff --cc sql-common/client.c
index ec992f80e8d,7938403db59..952b6a199ee
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@@ -2602,6 -2679,6 +2603,9 @@@ static int send_client_reply_packet(MCP
enum enum_ssl_init_error ssl_init_error;
const char *cert_error;
unsigned long ssl_error;
++#ifdef EMBEDDED_LIBRARY
++ DBUG_ASSERT(0); // embedded should not do SSL connect
++#endif
/*
Send mysql->client_flag, max_packet_size - unencrypted otherwise
diff --cc sql/item.cc
index 135255ee21e,07d64881eeb..33c35f8c3e0
--- a/sql/item.cc
+++ b/sql/item.cc
@@@ -1,6 -1,5 +1,6 @@@
/*
- Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
++ Copyright (c) 2000, 2018, Oracle and/or its affiliates.
+ Copyright (c) 2010, 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
@@@ -9648,13 -8264,9 +9648,14 @@@ bool Item_type_holder::join_types(THD *
item_decimals= 0;
decimals= max(decimals, item_decimals);
}
+
+ if (fld_type == FIELD_TYPE_GEOMETRY)
+ geometry_type=
+ Field_geom::geometry_type_merge(geometry_type, item->get_geometry_type());
+
if (Field::result_merge_type(fld_type) == DECIMAL_RESULT)
{
+ collation.set_numeric();
decimals= min(max(decimals, item->decimals), DECIMAL_MAX_SCALE);
int item_int_part= item->decimal_int_part();
int item_prec = max(prev_decimal_int_part, item_int_part) + decimals;
diff --cc sql/sql_acl.cc
index 14f34db6ccc,64888f7308a..24740a0695a
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@@ -1,5 -1,4 +1,5 @@@
- /* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
-/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
++/* 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
diff --cc storage/myisam/ha_myisam.cc
index 4305fab1778,6eed1be1ba9..a9e70a7b536
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@@ -1,6 -1,5 +1,6 @@@
/*
- Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
++ Copyright (c) 2000, 2018, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2017, 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
diff --cc storage/myisam/mi_check.c
index 23e54966e2d,7134cfc265a..8c2411b693f
--- a/storage/myisam/mi_check.c
+++ b/storage/myisam/mi_check.c
@@@ -1,4 -1,5 +1,4 @@@
- /* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
-/*
- Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
++/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
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
diff --cc storage/myisam/mi_locking.c
index 17fb92702ff,dcfeaca5b8c..f34c43cae78
--- a/storage/myisam/mi_locking.c
+++ b/storage/myisam/mi_locking.c
@@@ -1,5 -1,4 +1,5 @@@
- /* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ /* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ 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
1
0

[Commits] 2a3d3e052f6: MDEV-16721: Assertion `ctx.compare_type_handler()->cmp_type() != STRING_RESULT'
by Galina 27 Jul '18
by Galina 27 Jul '18
27 Jul '18
revision-id: 2a3d3e052f63cca4548c5bf8ef48040ecc39c5cf (mariadb-10.3.6-56-g2a3d3e052f6)
parent(s): 998c97e865c4efecd36c57eccf3d900135a5709f
author: Galina Shalygina
committer: Galina Shalygina
timestamp: 2018-07-27 19:00:53 +0200
message:
MDEV-16721: Assertion `ctx.compare_type_handler()->cmp_type() != STRING_RESULT'
failed
The bug appeared as in MDEV-12387 setup_jtbm_semi_joins() procedure had been
devided into two functions, one called before optimization of WHERE clause
and another after this optimization. When the second function was called for
a degenerated jtbm semi join equalities connecting the subselect and
the parent select were created but invocation of fix_fields() for these
equalities was missing.
---
mysql-test/main/in_subq_cond_pushdown.result | 12 ++++++++++++
mysql-test/main/in_subq_cond_pushdown.test | 16 ++++++++++++++++
sql/opt_subselect.cc | 3 ++-
3 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/mysql-test/main/in_subq_cond_pushdown.result b/mysql-test/main/in_subq_cond_pushdown.result
index a6246ec17d1..06b7de7a5ac 100644
--- a/mysql-test/main/in_subq_cond_pushdown.result
+++ b/mysql-test/main/in_subq_cond_pushdown.result
@@ -3802,3 +3802,15 @@ EXPLAIN
}
DROP TABLE t1,t2,t3;
DROP VIEW v1,v2;
+#
+# MDEV-16721: IN-subquery defined with the AUTO-INCREMENT column
+# and used with the ZEROFILL column
+#
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY);
+CREATE TABLE t2 (b INT ZEROFILL);
+INSERT INTO t2 VALUES (2), (3);
+SELECT *
+FROM t2
+WHERE t2.b IN (SELECT MIN(t1.a) from t1);
+b
+DROP TABLE t1, t2;
diff --git a/mysql-test/main/in_subq_cond_pushdown.test b/mysql-test/main/in_subq_cond_pushdown.test
index b336f39a1c9..fe317c3bf94 100644
--- a/mysql-test/main/in_subq_cond_pushdown.test
+++ b/mysql-test/main/in_subq_cond_pushdown.test
@@ -757,3 +757,19 @@ EVAL EXPLAIN FORMAT=JSON $query;
DROP TABLE t1,t2,t3;
DROP VIEW v1,v2;
+
+--echo #
+--echo # MDEV-16721: IN-subquery defined with the AUTO-INCREMENT column
+--echo # and used with the ZEROFILL column
+--echo #
+
+CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY);
+CREATE TABLE t2 (b INT ZEROFILL);
+
+INSERT INTO t2 VALUES (2), (3);
+
+SELECT *
+FROM t2
+WHERE t2.b IN (SELECT MIN(t1.a) from t1);
+
+DROP TABLE t1, t2;
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index efc38e5fe66..de8cf1e54a1 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -5738,7 +5738,8 @@ bool execute_degenerate_jtbm_semi_join(THD *thd,
new (thd->mem_root) Item_func_eq(thd,
subq_pred->left_expr->element_index(i),
new_sink->row[i]);
- if (!eq_cond || eq_list.push_back(eq_cond, thd->mem_root))
+ if (!eq_cond || eq_cond->fix_fields(thd, NULL) ||
+ eq_list.push_back(eq_cond, thd->mem_root))
DBUG_RETURN(TRUE);
}
}
1
0

[Commits] 14306bcbec0: MDEV-16831: Galera test failure on galera_sst_mysqldump_with_key
by jan 27 Jul '18
by jan 27 Jul '18
27 Jul '18
revision-id: 14306bcbec0b6a999985008f3d33602c08058006 (mariadb-10.1.34-32-g14306bcbec0)
parent(s): 189157d0526044fa3890dccb9152884ee6e84599
author: Jan Lindström
committer: Jan Lindström
timestamp: 2018-07-27 10:05:26 +0300
message:
MDEV-16831: Galera test failure on galera_sst_mysqldump_with_key
Test case was not written correctly.
---
.../galera/r/galera_sst_mysqldump_with_key.result | 95 +++++++++++++++++++++-
.../galera/t/galera_sst_mysqldump_with_key.test | 7 +-
2 files changed, 97 insertions(+), 5 deletions(-)
diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result
index 074481afc2d..bdf3844f2c5 100644
--- a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result
+++ b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key.result
@@ -9,7 +9,7 @@ CREATE USER sslsst;
GRANT ALL PRIVILEGES ON *.* TO sslsst;
GRANT USAGE ON *.* TO sslsst REQUIRE SSL;
SET GLOBAL wsrep_sst_auth = 'sslsst:';
-Performing State Transfer on a server that has been temporarily disconnected
+Performing State Transfer on a server that has been shut down cleanly and restarted
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
@@ -27,8 +27,7 @@ INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
-Unloading wsrep provider ...
-SET GLOBAL wsrep_provider = 'none';
+Shutting down server ...
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_during');
@@ -50,7 +49,95 @@ INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
-Loading wsrep provider ...
+Starting server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+INSERT INTO t1 VALUES ('node2_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+INSERT INTO t1 VALUES ('node1_committed_after');
+COMMIT;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+ROLLBACK;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+COMMIT;
+SET AUTOCOMMIT=ON;
+SELECT COUNT(*) = 35 FROM t1;
+COUNT(*) = 35
+1
+SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1;
+COUNT(*) = 0
+1
+DROP TABLE t1;
+COMMIT;
+SET AUTOCOMMIT=ON;
+Performing State Transfer on a server that has been killed and restarted
+CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+INSERT INTO t1 VALUES ('node1_committed_before');
+COMMIT;
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+INSERT INTO t1 VALUES ('node2_committed_before');
+COMMIT;
+Killing server ...
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+INSERT INTO t1 VALUES ('node1_committed_during');
+COMMIT;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+INSERT INTO t1 VALUES ('node1_to_be_committed_after');
+SET AUTOCOMMIT=OFF;
+START TRANSACTION;
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after');
+Performing --wsrep-recover ...
+Starting server ...
+Using --wsrep-start-position when starting mysqld ...
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_after');
diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.test b/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.test
index 0dbc63b531c..57244cb50c7 100644
--- a/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.test
+++ b/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.test
@@ -19,7 +19,12 @@ GRANT USAGE ON *.* TO sslsst REQUIRE SSL;
SET GLOBAL wsrep_sst_auth = 'sslsst:';
---source suite/galera/include/galera_st_disconnect_slave.inc
+# We set the required mysqldump SST options here so that they are used every time the server is restarted during the test
+--let $start_mysqld_params = --wsrep_sst_auth=sst:'sslsst:' --wsrep_sst_method=mysqldump --wsrep-sst-receive-address=127.0.0.1:$NODE_MYPORT_2 --skip-grant-tables
+
+--source suite/galera/include/galera_st_shutdown_slave.inc
+--source suite/galera/include/galera_st_kill_slave.inc
+--source suite/galera/include/galera_st_kill_slave_ddl.inc
--source include/auto_increment_offset_restore.inc
--source suite/galera/include/galera_sst_restore.inc
1
0
revision-id: 96b0f3af3171b88dbc9328eb3a9e73c13f66d008 (mariadb-10.2.16-43-g96b0f3a)
parent(s): aad70e9b4cdd719c3f7a559764e37ba7eea7bc3e
author: Igor Babaev
committer: Igor Babaev
timestamp: 2018-07-25 23:28:31 -0700
message:
MDEV-15087 Item_func::fix_fields:
Assertion `used_tables_cache == 0' failed
This bug manifested itself when executing queries
over materialized derived tables /vies and with
conjunctive always true predicates containing
inexpensive single-row subqueries.
This bug disappeared after the patch mdev-15035
had been applied.
---
mysql-test/r/derived_cond_pushdown.result | 19 +++++++++++++++++++
mysql-test/t/derived_cond_pushdown.test | 25 +++++++++++++++++++++++++
sql/sql_select.cc | 14 +++++++-------
3 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result
index a2e84a1..3adfe0b 100644
--- a/mysql-test/r/derived_cond_pushdown.result
+++ b/mysql-test/r/derived_cond_pushdown.result
@@ -9808,3 +9808,22 @@ EXPLAIN
}
}
DROP TABLE t1;
+#
+# MDEV-15087: error from inexpensive subquery before check
+# for condition pushdown into derived
+#
+CREATE TABLE t1 (i1 int, v1 varchar(1));
+INSERT INTO t1 VALUES (7,'x');
+CREATE TABLE t2 (i1 int);
+INSERT INTO t2 VALUES (8);
+CREATE TABLE t3 (i1 int ,v1 varchar(1), v2 varchar(1));
+INSERT INTO t3 VALUES (4, 'v','v'),(62,'v','k'),(7, 'n', NULL);
+SELECT 1
+FROM (t1 AS a1
+JOIN (((SELECT DISTINCT t3.*
+FROM t3) AS a2
+JOIN t1 ON (t1.v1 = a2.v2))) ON (t1.v1 = a2.v1))
+WHERE (SELECT BIT_COUNT(t2.i1)
+FROM (t2 JOIN t3)) IS NULL;
+ERROR 21000: Subquery returns more than 1 row
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test
index 3103ddb..872acb5 100644
--- a/mysql-test/t/derived_cond_pushdown.test
+++ b/mysql-test/t/derived_cond_pushdown.test
@@ -1840,3 +1840,28 @@ EVAL $query;
EVAL EXPLAIN FORMAT=JSON $query;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-15087: error from inexpensive subquery before check
+--echo # for condition pushdown into derived
+--echo #
+
+CREATE TABLE t1 (i1 int, v1 varchar(1));
+INSERT INTO t1 VALUES (7,'x');
+
+CREATE TABLE t2 (i1 int);
+INSERT INTO t2 VALUES (8);
+
+CREATE TABLE t3 (i1 int ,v1 varchar(1), v2 varchar(1));
+INSERT INTO t3 VALUES (4, 'v','v'),(62,'v','k'),(7, 'n', NULL);
+
+--error ER_SUBQUERY_NO_1_ROW
+SELECT 1
+FROM (t1 AS a1
+ JOIN (((SELECT DISTINCT t3.*
+ FROM t3) AS a2
+ JOIN t1 ON (t1.v1 = a2.v2))) ON (t1.v1 = a2.v1))
+WHERE (SELECT BIT_COUNT(t2.i1)
+ FROM (t2 JOIN t3)) IS NULL;
+
+DROP TABLE t1, t2, t3;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 4cabf5c..47ca733 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1368,6 +1368,13 @@ JOIN::optimize_inner()
conds= optimize_cond(this, conds, join_list, FALSE,
&cond_value, &cond_equal, OPT_LINK_EQUAL_FIELDS);
+ if (thd->is_error())
+ {
+ error= 1;
+ DBUG_PRINT("error",("Error from optimize_cond"));
+ DBUG_RETURN(1);
+ }
+
if (thd->lex->sql_command == SQLCOM_SELECT &&
optimizer_flag(thd, OPTIMIZER_SWITCH_COND_PUSHDOWN_FOR_DERIVED))
{
@@ -1402,13 +1409,6 @@ JOIN::optimize_inner()
DBUG_RETURN(1);
}
- if (thd->is_error())
- {
- error= 1;
- DBUG_PRINT("error",("Error from optimize_cond"));
- DBUG_RETURN(1);
- }
-
{
having= optimize_cond(this, having, join_list, TRUE,
&having_value, &having_equal);
1
0
revision-id: 4f1527567845cb5a1c4445c1f08f8a4dc066757b (mariadb-10.2.16-43-g4f15275)
parent(s): aad70e9b4cdd719c3f7a559764e37ba7eea7bc3e
author: Igor Babaev
committer: Igor Babaev
timestamp: 2018-07-25 23:24:11 -0700
message:
MDEV-15087 Item_func::fix_fields:
Assertion `used_tables_cache == 0' failed
This bug manifested itself when executing queries
over materialized derived tables /vies and with
conjunctive always true predicates containing
inexpensive subqueries.
This bug disappeared after the patch mdev-15035
had been applied.
---
mysql-test/r/derived_cond_pushdown.result | 19 +++++++++++++++++++
mysql-test/t/derived_cond_pushdown.test | 25 +++++++++++++++++++++++++
sql/sql_select.cc | 14 +++++++-------
3 files changed, 51 insertions(+), 7 deletions(-)
diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result
index a2e84a1..3adfe0b 100644
--- a/mysql-test/r/derived_cond_pushdown.result
+++ b/mysql-test/r/derived_cond_pushdown.result
@@ -9808,3 +9808,22 @@ EXPLAIN
}
}
DROP TABLE t1;
+#
+# MDEV-15087: error from inexpensive subquery before check
+# for condition pushdown into derived
+#
+CREATE TABLE t1 (i1 int, v1 varchar(1));
+INSERT INTO t1 VALUES (7,'x');
+CREATE TABLE t2 (i1 int);
+INSERT INTO t2 VALUES (8);
+CREATE TABLE t3 (i1 int ,v1 varchar(1), v2 varchar(1));
+INSERT INTO t3 VALUES (4, 'v','v'),(62,'v','k'),(7, 'n', NULL);
+SELECT 1
+FROM (t1 AS a1
+JOIN (((SELECT DISTINCT t3.*
+FROM t3) AS a2
+JOIN t1 ON (t1.v1 = a2.v2))) ON (t1.v1 = a2.v1))
+WHERE (SELECT BIT_COUNT(t2.i1)
+FROM (t2 JOIN t3)) IS NULL;
+ERROR 21000: Subquery returns more than 1 row
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test
index 3103ddb..872acb5 100644
--- a/mysql-test/t/derived_cond_pushdown.test
+++ b/mysql-test/t/derived_cond_pushdown.test
@@ -1840,3 +1840,28 @@ EVAL $query;
EVAL EXPLAIN FORMAT=JSON $query;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-15087: error from inexpensive subquery before check
+--echo # for condition pushdown into derived
+--echo #
+
+CREATE TABLE t1 (i1 int, v1 varchar(1));
+INSERT INTO t1 VALUES (7,'x');
+
+CREATE TABLE t2 (i1 int);
+INSERT INTO t2 VALUES (8);
+
+CREATE TABLE t3 (i1 int ,v1 varchar(1), v2 varchar(1));
+INSERT INTO t3 VALUES (4, 'v','v'),(62,'v','k'),(7, 'n', NULL);
+
+--error ER_SUBQUERY_NO_1_ROW
+SELECT 1
+FROM (t1 AS a1
+ JOIN (((SELECT DISTINCT t3.*
+ FROM t3) AS a2
+ JOIN t1 ON (t1.v1 = a2.v2))) ON (t1.v1 = a2.v1))
+WHERE (SELECT BIT_COUNT(t2.i1)
+ FROM (t2 JOIN t3)) IS NULL;
+
+DROP TABLE t1, t2, t3;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 4cabf5c..47ca733 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1368,6 +1368,13 @@ JOIN::optimize_inner()
conds= optimize_cond(this, conds, join_list, FALSE,
&cond_value, &cond_equal, OPT_LINK_EQUAL_FIELDS);
+ if (thd->is_error())
+ {
+ error= 1;
+ DBUG_PRINT("error",("Error from optimize_cond"));
+ DBUG_RETURN(1);
+ }
+
if (thd->lex->sql_command == SQLCOM_SELECT &&
optimizer_flag(thd, OPTIMIZER_SWITCH_COND_PUSHDOWN_FOR_DERIVED))
{
@@ -1402,13 +1409,6 @@ JOIN::optimize_inner()
DBUG_RETURN(1);
}
- if (thd->is_error())
- {
- error= 1;
- DBUG_PRINT("error",("Error from optimize_cond"));
- DBUG_RETURN(1);
- }
-
{
having= optimize_cond(this, having, join_list, TRUE,
&having_value, &having_equal);
1
0

25 Jul '18
revision-id: cb5952b5060d089c021808fe1f1cf13f7eb88423 (mariadb-10.1.34-30-gcb5952b5060)
parent(s): 57cde8ccd19675dc98e3cbacf0ef5c72cb188e49 9fbe360e9f7d41d169eb5abed22dc15f26f6c749
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2018-07-25 22:24:40 +0200
message:
Merge branch '10.0' into bb-10.1-merge-sanja
CMakeLists.txt | 6 ++
cmake/install_macros.cmake | 9 ++
cmake/mysql_add_executable.cmake | 3 +
include/m_ctype.h | 28 +++---
mysql-test/include/ctype_mdev13118.inc | 15 ++++
mysql-test/r/ctype_binary.result | 23 +++++
mysql-test/r/ctype_eucjpms.result | 23 +++++
mysql-test/r/ctype_euckr.result | 29 ++++++
mysql-test/r/ctype_gbk.result | 23 +++++
mysql-test/r/ctype_latin1.result | 23 +++++
mysql-test/r/ctype_ucs.result | 23 +++++
mysql-test/r/ctype_ujis.result | 23 +++++
mysql-test/r/ctype_utf16.result | 23 +++++
mysql-test/r/ctype_utf16le.result | 29 ++++++
mysql-test/r/ctype_utf32.result | 23 +++++
mysql-test/r/ctype_utf8.result | 23 +++++
mysql-test/r/ctype_utf8mb4.result | 23 +++++
mysql-test/r/join_outer.result | 50 +++++++++++
mysql-test/r/join_outer_jcl6.result | 50 +++++++++++
mysql-test/r/rename.result | 4 +
mysql-test/r/subselect_mat_cost_bugs.result | 2 +-
mysql-test/suite/parts/r/truncate_locked.result | 7 ++
mysql-test/suite/parts/t/truncate_locked.test | 10 +++
mysql-test/suite/plugins/r/processlist.result | 4 +-
mysql-test/suite/plugins/t/processlist.test | 8 +-
mysql-test/t/bootstrap.test | 9 ++
mysql-test/t/ctype_binary.test | 3 +
mysql-test/t/ctype_eucjpms.test | 2 +
mysql-test/t/ctype_euckr.test | 11 +++
mysql-test/t/ctype_gbk.test | 3 +
mysql-test/t/ctype_latin1.test | 3 +
mysql-test/t/ctype_ucs.test | 4 +
mysql-test/t/ctype_ujis.test | 4 +
mysql-test/t/ctype_utf16.test | 5 ++
mysql-test/t/ctype_utf16le.test | 13 +++
mysql-test/t/ctype_utf32.test | 8 ++
mysql-test/t/ctype_utf8.test | 7 ++
mysql-test/t/ctype_utf8mb4.test | 8 ++
mysql-test/t/join_outer.test | 48 ++++++++++
mysql-test/t/rename.test | 7 ++
mysys/my_rename.c | 5 +-
scripts/CMakeLists.txt | 2 +
scripts/mysql_install_db.pl.in | 2 +-
scripts/mysql_install_db.sh | 2 +-
scripts/mysql_system_tables_fix.sql | 50 ++++++-----
scripts/mysqld_multi.sh | 2 +-
sql/item_strfunc.cc | 112 ++++++++++++------------
sql/share/CMakeLists.txt | 12 +--
sql/sql_select.cc | 4 +-
sql/sql_table.cc | 2 +
sql/sql_truncate.cc | 3 +-
sql/tztime.cc | 2 +-
storage/connect/filamvct.cpp | 5 --
strings/ctype-bin.c | 8 +-
strings/ctype-euc_kr.c | 4 +-
strings/ctype-mb.c | 100 +++------------------
strings/ctype-simple.c | 22 +++--
strings/ctype-ucs2.c | 78 +++++++++--------
strings/ctype-ujis.c | 8 +-
strings/ctype-utf8.c | 20 +++--
support-files/CMakeLists.txt | 2 +
61 files changed, 799 insertions(+), 265 deletions(-)
diff --cc CMakeLists.txt
index 8d2efac89cb,5a9ec265de0..0b48ca20485
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -177,11 -163,47 +177,17 @@@ IF(UNIX
OPTION(WITH_VALGRIND "Valgrind instrumentation" OFF)
ENDIF()
OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON)
-MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED)
+MARK_AS_ADVANCED(CYBOZU)
+ IF (WITHOUT_SERVER)
+ SET (SKIP_COMPONENTS "Server|IniFiles|SuportFiles|Readme")
+ ELSE()
+ SET (SKIP_COMPONENTS "N-O-N-E")
+ ENDIF()
+
OPTION(NOT_FOR_DISTRIBUTION "Allow linking with GPLv2-incompatible system libraries. Only set it you never plan to distribute the resulting binaries" OFF)
-include(CheckCSourceCompiles)
-include(CheckCXXSourceCompiles)
-# We need some extra FAIL_REGEX patterns
-# Note that CHECK_C_SOURCE_COMPILES is a misnomer, it will also link.
-MACRO (MY_CHECK_C_COMPILER_FLAG FLAG RESULT)
- SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
- SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}")
- CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${RESULT}
- FAIL_REGEX "argument unused during compilation"
- FAIL_REGEX "unsupported .*option"
- FAIL_REGEX "unknown .*option"
- FAIL_REGEX "unrecognized .*option"
- FAIL_REGEX "ignoring unknown option"
- FAIL_REGEX "[Ww]arning: [Oo]ption"
- )
- SET(CMAKE_REQUIRED_FLAGS "${SAVE_CMAKE_REQUIRED_FLAGS}")
-ENDMACRO()
-
-MACRO (MY_CHECK_CXX_COMPILER_FLAG FLAG RESULT)
- SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
- SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${FLAG}")
- CHECK_CXX_SOURCE_COMPILES("int main(void) { return 0; }" ${RESULT}
- FAIL_REGEX "argument unused during compilation"
- FAIL_REGEX "unsupported .*option"
- FAIL_REGEX "unknown .*option"
- FAIL_REGEX "unrecognized .*option"
- FAIL_REGEX "ignoring unknown option"
- FAIL_REGEX "[Ww]arning: [Oo]ption"
- )
- SET(CMAKE_REQUIRED_FLAGS "${SAVE_CMAKE_REQUIRED_FLAGS}")
-ENDMACRO()
+INCLUDE(check_compiler_flag)
OPTION(WITH_ASAN "Enable address sanitizer" OFF)
IF (WITH_ASAN)
diff --cc cmake/install_macros.cmake
index 121825f8f3c,ff4ba593415..b0263e63b7a
--- a/cmake/install_macros.cmake
+++ b/cmake/install_macros.cmake
@@@ -114,7 -115,17 +114,12 @@@ FUNCTION(INSTALL_SCRIPT
SET(COMP)
ENDIF()
+ IF (COMP MATCHES ${SKIP_COMPONENTS})
+ RETURN()
+ ENDIF()
+
- INSTALL(FILES
- ${script}
- DESTINATION ${ARG_DESTINATION}
- PERMISSIONS OWNER_READ OWNER_WRITE
- OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
- WORLD_READ WORLD_EXECUTE ${COMP}
- )
+ INSTALL(PROGRAMS ${script} DESTINATION ${ARG_DESTINATION} ${COMP})
++
INSTALL_MANPAGE(${script})
ENDFUNCTION()
diff --cc include/m_ctype.h
index ddb4c825e1b,eb2d760359b..74dd2a29984
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@@ -369,35 -365,8 +369,35 @@@ typedef int (*my_charset_conv_mb_wc)(CH
typedef int (*my_charset_conv_wc_mb)(CHARSET_INFO *, my_wc_t,
uchar *, uchar *);
typedef size_t (*my_charset_conv_case)(CHARSET_INFO *,
- char *, size_t, char *, size_t);
+ const char *, size_t, char *, size_t);
+/*
+ A structure to return the statistics of a native string copying,
+ when no Unicode conversion is involved.
+
+ The stucture is OK to be unitialized before calling a copying routine.
+ A copying routine must populate the structure as follows:
+ - m_source_end_pos must be set by to a non-NULL value
+ in the range of the input string.
+ - m_well_formed_error_pos must be set to NULL if the string was
+ well formed, or to the position of the leftmost bad byte sequence.
+*/
+typedef struct
+{
+ const char *m_source_end_pos; /* Position where reading stopped */
+ const char *m_well_formed_error_pos; /* Position where a bad byte was found*/
+} MY_STRCOPY_STATUS;
+
+
+/*
+ A structure to return the statistics of a Unicode string conversion.
+*/
+typedef struct
+{
+ MY_STRCOPY_STATUS m_native_copy_status;
+ const char *m_cannot_convert_error_pos;
+} MY_STRCONV_STATUS;
+
/* See strings/CHARSET_INFO.txt about information on this structure */
struct my_charset_handler_st
diff --cc mysql-test/r/ctype_binary.result
index 512368a2d26,b28d9040547..627ba8a35a5
--- a/mysql-test/r/ctype_binary.result
+++ b/mysql-test/r/ctype_binary.result
@@@ -3047,6 -3022,29 +3047,29 @@@ DROP TABLE t1
SELECT _binary 0x7E, _binary X'7E', _binary B'01111110';
_binary 0x7E _binary X'7E' _binary B'01111110'
~ ~ ~
+ SET NAMES utf8, character_set_connection=binary;
+ #
+ # MDEV-13118 Wrong results with LOWER and UPPER and subquery
+ #
+ SET @save_optimizer_switch=@@optimizer_switch;
+ SET optimizer_switch=_latin1'derived_merge=on';
+ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
- `t` varbinary(10) NOT NULL DEFAULT ''
++ `t` varbinary(10) NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI');
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub;
+ c2
+ ABCDEFGHI-ABCDEFGHI
+ abcdefghi-abcdefghi
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub;
+ c2
+ ABCDEFGHI-ABCDEFGHI
+ abcdefghi-abcdefghi
+ DROP TABLE t1;
+ SET optimizer_switch=@save_optimizer_switch;
#
# End of 10.0 tests
#
diff --cc mysql-test/r/ctype_eucjpms.result
index f9cb4f1eecc,1e2312638c9..160c4758122
--- a/mysql-test/r/ctype_eucjpms.result
+++ b/mysql-test/r/ctype_eucjpms.result
@@@ -33868,6 -33636,29 +33868,29 @@@ HEX(a) CHAR_LENGTH(a
DROP TABLE t1;
SELECT _eucjpms 0x8EA0;
ERROR HY000: Invalid eucjpms character string: '8EA0'
+ SET NAMES eucjpms;
+ #
+ # MDEV-13118 Wrong results with LOWER and UPPER and subquery
+ #
+ SET @save_optimizer_switch=@@optimizer_switch;
+ SET optimizer_switch=_latin1'derived_merge=on';
+ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
- `t` varchar(10) CHARACTER SET eucjpms NOT NULL DEFAULT ''
++ `t` varchar(10) CHARACTER SET eucjpms NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI');
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub;
+ c2
+ abcdefghi-abcdefghi
+ abcdefghi-abcdefghi
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub;
+ c2
+ ABCDEFGHI-ABCDEFGHI
+ ABCDEFGHI-ABCDEFGHI
+ DROP TABLE t1;
+ SET optimizer_switch=@save_optimizer_switch;
#
# End of 10.0 tests
#
diff --cc mysql-test/r/ctype_euckr.result
index 90353c6af2a,cea93b0c808..a23ced76df9
--- a/mysql-test/r/ctype_euckr.result
+++ b/mysql-test/r/ctype_euckr.result
@@@ -25428,3 -25274,32 +25428,32 @@@ A1A1A1A1A1A1202020202020202020202020202
#
# End of 5.6 tests
#
+ #
+ # Start of 10.0 tests
+ #
+ SET NAMES utf8, character_set_connection=euckr;
+ #
+ # MDEV-13118 Wrong results with LOWER and UPPER and subquery
+ #
+ SET @save_optimizer_switch=@@optimizer_switch;
+ SET optimizer_switch=_latin1'derived_merge=on';
+ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
- `t` varchar(10) CHARACTER SET euckr NOT NULL DEFAULT ''
++ `t` varchar(10) CHARACTER SET euckr NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI');
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub;
+ c2
+ abcdefghi-abcdefghi
+ abcdefghi-abcdefghi
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub;
+ c2
+ ABCDEFGHI-ABCDEFGHI
+ ABCDEFGHI-ABCDEFGHI
+ DROP TABLE t1;
+ SET optimizer_switch=@save_optimizer_switch;
+ #
+ # End of 10.0 tests
+ #
diff --cc mysql-test/r/ctype_gbk.result
index d10d5f4bf75,15f9bc6bfea..ac8de1e229c
--- a/mysql-test/r/ctype_gbk.result
+++ b/mysql-test/r/ctype_gbk.result
@@@ -5099,6 -4943,29 +5099,29 @@@ E05C5
E05B
DROP TABLE t1;
# Start of ctype_E05C.inc
+ SET NAMES utf8, character_set_connection=gbk;
+ #
+ # MDEV-13118 Wrong results with LOWER and UPPER and subquery
+ #
+ SET @save_optimizer_switch=@@optimizer_switch;
+ SET optimizer_switch=_latin1'derived_merge=on';
+ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
- `t` varchar(10) CHARACTER SET gbk NOT NULL DEFAULT ''
++ `t` varchar(10) CHARACTER SET gbk NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI');
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub;
+ c2
+ abcdefghi-abcdefghi
+ abcdefghi-abcdefghi
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub;
+ c2
+ ABCDEFGHI-ABCDEFGHI
+ ABCDEFGHI-ABCDEFGHI
+ DROP TABLE t1;
+ SET optimizer_switch=@save_optimizer_switch;
#
# MDEV-9886 Illegal mix of collations with a view comparing a field to a binary constant
#
diff --cc mysql-test/r/ctype_latin1.result
index 66c5a37750d,8913c8082c8..3b9b2633480
--- a/mysql-test/r/ctype_latin1.result
+++ b/mysql-test/r/ctype_latin1.result
@@@ -7989,6 -7939,29 +7989,29 @@@
0
DROP VIEW v1;
DROP TABLE t1;
+ SET NAMES latin1;
+ #
+ # MDEV-13118 Wrong results with LOWER and UPPER and subquery
+ #
+ SET @save_optimizer_switch=@@optimizer_switch;
+ SET optimizer_switch=_latin1'derived_merge=on';
+ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
- `t` varchar(10) NOT NULL DEFAULT ''
++ `t` varchar(10) NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI');
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub;
+ c2
+ abcdefghi-abcdefghi
+ abcdefghi-abcdefghi
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub;
+ c2
+ ABCDEFGHI-ABCDEFGHI
+ ABCDEFGHI-ABCDEFGHI
+ DROP TABLE t1;
+ SET optimizer_switch=@save_optimizer_switch;
#
# End of 10.0 tests
#
diff --cc mysql-test/r/ctype_ucs.result
index 55caabbaa12,58fd308c7e2..9c598780edf
--- a/mysql-test/r/ctype_ucs.result
+++ b/mysql-test/r/ctype_ucs.result
@@@ -5705,6 -5629,29 +5705,29 @@@ c
YWJjZGVmZ2hp-YWJjZGVmZ2hp
DROP TABLE t1;
SET optimizer_switch=@save_optimizer_switch;
+ SET NAMES utf8, character_set_connection=ucs2;
+ #
+ # MDEV-13118 Wrong results with LOWER and UPPER and subquery
+ #
+ SET @save_optimizer_switch=@@optimizer_switch;
+ SET optimizer_switch=_latin1'derived_merge=on';
+ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
- `t` varchar(10) CHARACTER SET ucs2 NOT NULL DEFAULT ''
++ `t` varchar(10) CHARACTER SET ucs2 NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI');
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub;
+ c2
+ abcdefghi-abcdefghi
+ abcdefghi-abcdefghi
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub;
+ c2
+ ABCDEFGHI-ABCDEFGHI
+ ABCDEFGHI-ABCDEFGHI
+ DROP TABLE t1;
+ SET optimizer_switch=@save_optimizer_switch;
#
# End of 10.0 tests
#
diff --cc mysql-test/r/ctype_ujis.result
index 61541ec7678,d4589f62ae5..9146356b5f9
--- a/mysql-test/r/ctype_ujis.result
+++ b/mysql-test/r/ctype_ujis.result
@@@ -26173,6 -25942,29 +26173,29 @@@ HEX(a) CHAR_LENGTH(a
DROP TABLE t1;
SELECT _ujis 0x8EA0;
ERROR HY000: Invalid ujis character string: '8EA0'
+ SET NAMES ujis;
+ #
+ # MDEV-13118 Wrong results with LOWER and UPPER and subquery
+ #
+ SET @save_optimizer_switch=@@optimizer_switch;
+ SET optimizer_switch=_latin1'derived_merge=on';
+ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
- `t` varchar(10) CHARACTER SET ujis NOT NULL DEFAULT ''
++ `t` varchar(10) CHARACTER SET ujis NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI');
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub;
+ c2
+ abcdefghi-abcdefghi
+ abcdefghi-abcdefghi
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub;
+ c2
+ ABCDEFGHI-ABCDEFGHI
+ ABCDEFGHI-ABCDEFGHI
+ DROP TABLE t1;
+ SET optimizer_switch=@save_optimizer_switch;
#
# End of 10.0 tests
#
diff --cc mysql-test/r/ctype_utf16.result
index c8ba1fedab8,e182432faec..ba72a859351
--- a/mysql-test/r/ctype_utf16.result
+++ b/mysql-test/r/ctype_utf16.result
@@@ -2138,6 -2134,29 +2138,29 @@@ EXECUTE stmt USING @arg00
CONCAT(_utf16'a' COLLATE utf16_unicode_ci, ?)
aÿ
DEALLOCATE PREPARE stmt;
+ SET NAMES utf8, character_set_connection=utf16;
+ #
+ # MDEV-13118 Wrong results with LOWER and UPPER and subquery
+ #
+ SET @save_optimizer_switch=@@optimizer_switch;
+ SET optimizer_switch=_latin1'derived_merge=on';
+ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
- `t` varchar(10) CHARACTER SET utf16 NOT NULL DEFAULT ''
++ `t` varchar(10) CHARACTER SET utf16 NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI');
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub;
+ c2
+ abcdefghi-abcdefghi
+ abcdefghi-abcdefghi
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub;
+ c2
+ ABCDEFGHI-ABCDEFGHI
+ ABCDEFGHI-ABCDEFGHI
+ DROP TABLE t1;
+ SET optimizer_switch=@save_optimizer_switch;
#
# End of 10.0 tests
#
diff --cc mysql-test/r/ctype_utf16le.result
index 93fce843dc8,f6a4d351ad4..c7c8c210014
--- a/mysql-test/r/ctype_utf16le.result
+++ b/mysql-test/r/ctype_utf16le.result
@@@ -2324,72 -2320,31 +2324,101 @@@ DFFFFFDFFFFF9CFFFF9DFFFF9EFFF
# End of 5.6 tests
#
#
+ # Start of 10.0 tests
+ #
+ SET NAMES utf8, character_set_connection=utf16le;
+ #
+ # MDEV-13118 Wrong results with LOWER and UPPER and subquery
+ #
+ SET @save_optimizer_switch=@@optimizer_switch;
+ SET optimizer_switch=_latin1'derived_merge=on';
+ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
- `t` varchar(10) CHARACTER SET utf16le NOT NULL DEFAULT ''
++ `t` varchar(10) CHARACTER SET utf16le NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI');
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub;
+ c2
+ abcdefghi-abcdefghi
+ abcdefghi-abcdefghi
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub;
+ c2
+ ABCDEFGHI-ABCDEFGHI
+ ABCDEFGHI-ABCDEFGHI
+ DROP TABLE t1;
+ SET optimizer_switch=@save_optimizer_switch;
+ #
+ # Start of 10.0 tests
+ #
++#
+# Start of 10.1 tests
+#
+#
+# MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
+#
+CREATE TABLE t1 (
+id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+a VARCHAR(10) CHARACTER SET utf16le, KEY(a,id)
+);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0x61);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF);
+SELECT id,HEX(a) FROM t1 ORDER BY a,id;
+id HEX(a)
+1 6100
+2 8000
+3 FF07
+4 0008
+6 00D800DC
+7 FFDBFFDF
+5 FFFF
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+id HEX(a)
+5 FFFF
+7 FFDBFFDF
+6 00D800DC
+4 0008
+3 FF07
+2 8000
+1 6100
+SELECT COUNT(DISTINCT a) FROM t1;
+COUNT(DISTINCT a)
+6
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16le COLLATE utf16le_bin;
+SELECT id,HEX(a) FROM t1 ORDER BY a;
+id HEX(a)
+1 6100
+2 8000
+3 FF07
+4 0008
+5 FFFF
+6 00D800DC
+7 FFDBFFDF
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+id HEX(a)
+7 FFDBFFDF
+6 00D800DC
+5 FFFF
+4 0008
+3 FF07
+2 8000
+1 6100
+SELECT COUNT(DISTINCT a) FROM t1;
+COUNT(DISTINCT a)
+7
+DROP TABLE t1;
+#
+# MDEV-9178 Wrong result for CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED)
+#
+SET NAMES utf8;
+SELECT CAST(CONVERT('1IJ3' USING utf16le) AS SIGNED);
+CAST(CONVERT('1IJ3' USING utf16le) AS SIGNED)
+1
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: '1IJ3'
+#
+# End of 10.1 tests
+#
diff --cc mysql-test/r/ctype_utf32.result
index 22b0e9c0fc0,91277cd5108..024f8aa7875
--- a/mysql-test/r/ctype_utf32.result
+++ b/mysql-test/r/ctype_utf32.result
@@@ -2237,6 -2231,29 +2237,29 @@@ EXECUTE stmt USING @arg00
CONCAT(_utf32'a' COLLATE utf32_unicode_ci, ?)
aÿ
DEALLOCATE PREPARE stmt;
+ SET NAMEs utf8, character_set_connection=utf32;
+ #
+ # MDEV-13118 Wrong results with LOWER and UPPER and subquery
+ #
+ SET @save_optimizer_switch=@@optimizer_switch;
+ SET optimizer_switch=_latin1'derived_merge=on';
+ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
- `t` varchar(10) CHARACTER SET utf32 NOT NULL DEFAULT ''
++ `t` varchar(10) CHARACTER SET utf32 NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI');
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub;
+ c2
+ abcdefghi-abcdefghi
+ abcdefghi-abcdefghi
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub;
+ c2
+ ABCDEFGHI-ABCDEFGHI
+ ABCDEFGHI-ABCDEFGHI
+ DROP TABLE t1;
+ SET optimizer_switch=@save_optimizer_switch;
#
# End of 10.0 tests
#
diff --cc mysql-test/r/ctype_utf8.result
index 3da74d12877,6a4001597c4..7b486f0f443
--- a/mysql-test/r/ctype_utf8.result
+++ b/mysql-test/r/ctype_utf8.result
@@@ -10278,6 -10127,29 +10278,29 @@@ SELECT * FROM v1
c
ß
DROP VIEW v1;
+ SET NAMES utf8;
+ #
+ # MDEV-13118 Wrong results with LOWER and UPPER and subquery
+ #
+ SET @save_optimizer_switch=@@optimizer_switch;
+ SET optimizer_switch=_latin1'derived_merge=on';
+ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
- `t` varchar(10) CHARACTER SET utf8 NOT NULL DEFAULT ''
++ `t` varchar(10) CHARACTER SET utf8 NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI');
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub;
+ c2
+ abcdefghi-abcdefghi
+ abcdefghi-abcdefghi
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub;
+ c2
+ ABCDEFGHI-ABCDEFGHI
+ ABCDEFGHI-ABCDEFGHI
+ DROP TABLE t1;
+ SET optimizer_switch=@save_optimizer_switch;
#
# End of 10.0 tests
#
diff --cc mysql-test/r/ctype_utf8mb4.result
index 904f432af20,4d91c42cf51..de9ba321ad9
--- a/mysql-test/r/ctype_utf8mb4.result
+++ b/mysql-test/r/ctype_utf8mb4.result
@@@ -3469,32 -3427,30 +3469,55 @@@ t1 CREATE TABLE `t1`
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
SET NAMES default;
+ SET NAMES utf8mb4;
+ #
+ # MDEV-13118 Wrong results with LOWER and UPPER and subquery
+ #
+ SET @save_optimizer_switch=@@optimizer_switch;
+ SET optimizer_switch=_latin1'derived_merge=on';
+ CREATE TABLE t1 AS SELECT REPEAT('a', 10) AS t LIMIT 0;
+ SHOW CREATE TABLE t1;
+ Table Create Table
+ t1 CREATE TABLE `t1` (
- `t` varchar(10) CHARACTER SET utf8mb4 NOT NULL DEFAULT ''
++ `t` varchar(10) CHARACTER SET utf8mb4 NOT NULL
+ ) ENGINE=MyISAM DEFAULT CHARSET=latin1
+ INSERT INTO t1 VALUES ('abcdefghi'),('ABCDEFGHI');
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT LOWER(t) t2 FROM t1) sub;
+ c2
+ abcdefghi-abcdefghi
+ abcdefghi-abcdefghi
+ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT UPPER(t) t2 FROM t1) sub;
+ c2
+ ABCDEFGHI-ABCDEFGHI
+ ABCDEFGHI-ABCDEFGHI
+ DROP TABLE t1;
+ SET optimizer_switch=@save_optimizer_switch;
+#
# End of 10.0 tests
#
-# End of tests
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-6572 "USE dbname" with a bad sequence erroneously connects to a wrong database
+#
+SET NAMES utf8mb4;
+SELECT * FROM `test😁😁test`;
+ERROR HY000: Invalid utf8mb4 character string: 'test\xF0\x9F\x98\x81\xF0\x9F\x98\x81test'
+#
+# MDEV-7231 Field ROUTINE_DEFINITION in INFORMATION_SCHEMA.`ROUTINES` contains broken procedure body when used shielding quotes inside.
+#
+SET NAMES utf8mb4;
+CREATE FUNCTION f1() RETURNS TEXT CHARACTER SET utf8mb4
+RETURN CONCAT('😎','x😎','😎y','x😎y');
+SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES
+WHERE ROUTINE_SCHEMA='test' AND SPECIFIC_NAME ='f1';
+ROUTINE_DEFINITION
+RETURN CONCAT('?','x?','?y','x?y')
+SELECT body_utf8 FROM mysql.proc WHERE name='f1';
+body_utf8
+RETURN CONCAT('?','x?','?y','x?y')
+DROP FUNCTION f1;
+#
+# End of 10.1 tests
#
diff --cc mysql-test/t/ctype_utf16le.test
index 42017f9a635,f5b89aa9dc4..5e29408cbd0
--- a/mysql-test/t/ctype_utf16le.test
+++ b/mysql-test/t/ctype_utf16le.test
@@@ -745,36 -745,15 +745,49 @@@ SET NAMES utf8, collation_connection=ut
--echo # End of 5.6 tests
--echo #
+
+ --echo #
+ --echo # Start of 10.0 tests
+ --echo #
+
+
+ SET NAMES utf8, character_set_connection=utf16le;
+ --source include/ctype_mdev13118.inc
+
+ --echo #
+ --echo # Start of 10.0 tests
+ --echo #
++
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8417 utf8mb4: compare broken bytes as "greater than any non-broken character"
+--echo #
+CREATE TABLE t1 (
+ id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ a VARCHAR(10) CHARACTER SET utf16le, KEY(a,id)
+);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0x61);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xC280),(_utf8mb4 0xDFBF);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xE0A080),(_utf8mb4 0xEFBFBF);
+INSERT INTO t1 (a) VALUES (_utf8mb4 0xF0908080),(_utf8mb4 0xF48FBFBF);
+SELECT id,HEX(a) FROM t1 ORDER BY a,id;
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+SELECT COUNT(DISTINCT a) FROM t1;
+ALTER TABLE t1 MODIFY a VARCHAR(10) CHARACTER SET utf16le COLLATE utf16le_bin;
+SELECT id,HEX(a) FROM t1 ORDER BY a;
+SELECT id,HEX(a) FROM t1 ORDER BY a DESC,id DESC;
+SELECT COUNT(DISTINCT a) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-9178 Wrong result for CAST(CONVERT('1IJ3' USING ucs2) AS SIGNED)
+--echo #
+SET NAMES utf8;
+SELECT CAST(CONVERT('1IJ3' USING utf16le) AS SIGNED);
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
diff --cc mysql-test/t/ctype_utf8mb4.test
index af4c169091a,89007546492..ffc098ff938
--- a/mysql-test/t/ctype_utf8mb4.test
+++ b/mysql-test/t/ctype_utf8mb4.test
@@@ -1950,33 -1913,16 +1950,41 @@@ DROP TABLE t1
SET NAMES default;
+
+ #
+ # MDEV-13118 Wrong results with LOWER and UPPER and subquery
+ #
+ SET NAMES utf8mb4;
+ --source include/ctype_mdev13118.inc
+
+
+--echo #
--echo # End of 10.0 tests
+--echo #
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-6572 "USE dbname" with a bad sequence erroneously connects to a wrong database
+--echo #
+SET NAMES utf8mb4;
+--error ER_INVALID_CHARACTER_STRING
+SELECT * FROM `test😁😁test`;
+
+--echo #
+--echo # MDEV-7231 Field ROUTINE_DEFINITION in INFORMATION_SCHEMA.`ROUTINES` contains broken procedure body when used shielding quotes inside.
+--echo #
+# Non-BMP characters should be replaced to '?' in ROUTINE_DEFINITION/body_utf8
+SET NAMES utf8mb4;
+CREATE FUNCTION f1() RETURNS TEXT CHARACTER SET utf8mb4
+RETURN CONCAT('😎','x😎','😎y','x😎y');
+SELECT ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES
+WHERE ROUTINE_SCHEMA='test' AND SPECIFIC_NAME ='f1';
+SELECT body_utf8 FROM mysql.proc WHERE name='f1';
+DROP FUNCTION f1;
--echo #
---echo # End of tests
+--echo # End of 10.1 tests
--echo #
diff --cc scripts/CMakeLists.txt
index b994c9f67b5,24b48e1920e..9f320ce6aa4
--- a/scripts/CMakeLists.txt
+++ b/scripts/CMakeLists.txt
@@@ -74,23 -74,7 +74,24 @@@ IF(UNIX
)
ENDIF()
+# Configure two scripts from one 'in' file.
+# The maria_add_gis_sp.sql - to be sent to 'mysql' tool
+# and the maria_add_gis_sp_bootstrap.sql, that can be sent to
+# the server as a bootstrap command.
+
+SET(ADD_GIS_SP_SET_DELIMITER "delimiter |")
+SET(ADD_GIS_SP_RESET_DELIMITER "delimiter ;")
+SET(ADD_GIS_SP_EOL "|")
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/maria_add_gis_sp.sql.in
+ ${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp.sql ESCAPE_QUOTES @ONLY)
+
+SET(ADD_GIS_SP_SET_DELIMITER "")
+SET(ADD_GIS_SP_RESET_DELIMITER "")
+SET(ADD_GIS_SP_EOL ";")
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/maria_add_gis_sp.sql.in
+ ${CMAKE_CURRENT_BINARY_DIR}/maria_add_gis_sp_bootstrap.sql ESCAPE_QUOTES @ONLY)
+
+ IF (NOT WITHOUT_SERVER)
INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_data.sql
diff --cc scripts/mysql_install_db.pl.in
index 9d2c1f6874a,2103afc1e63..68d47fed2ea
--- a/scripts/mysql_install_db.pl.in
+++ b/scripts/mysql_install_db.pl.in
@@@ -326,13 -323,12 +326,13 @@@ elsif ( $opt->{basedir}
}
else
{
- $opt->{basedir} = '@prefix@';
- $bindir = '@bindir@';
- $extra_bindir = $bindir;
- $mysqld = '@sbindir@/mysqld';
- $pkgdatadir = '@pkgdatadir@';
- $scriptdir = '@scriptdir@';
+ $opt->{basedir} = '@prefix@';
+ $bindir = '@bindir@';
+ $extra_bindir = $bindir;
- $mysqld = '@libexecdir@/mysqld';
++ $mysqld = '@sbindir@/mysqld';
+ $srcpkgdatadir = '@pkgdatadir@';
+ $buildpkgdatadir = '@pkgdatadir@';
+ $scriptdir = '@scriptdir@';
}
unless ( $opt->{ldata} )
diff --cc scripts/mysql_install_db.sh
index b57ac8bc85e,43ff4191e08..40fdf798d71
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@@ -343,9 -313,8 +343,9 @@@ els
basedir="@prefix@"
bindir="@bindir@"
resolveip="$bindir/resolveip"
- mysqld="@libexecdir@/mysqld"
+ mysqld="@sbindir@/mysqld"
- pkgdatadir="@pkgdatadir@"
+ srcpkgdatadir="@pkgdatadir@"
+ buildpkgdatadir="@pkgdatadir@"
fi
# Set up paths to SQL scripts required for bootstrap
diff --cc scripts/mysql_system_tables_fix.sql
index 47459d58bd2,194b1615c2b..a982fc87ec9
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@@ -26,9 -26,8 +26,9 @@@
set sql_mode='';
set storage_engine=MyISAM;
+set enforce_storage_engine=NULL;
- ALTER TABLE user add File_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
+ ALTER TABLE user add File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
# Detect whether or not we had the Grant_priv column
SET @hadGrantPriv:=0;
@@@ -633,12 -638,12 +641,14 @@@ ALTER TABLE user MODIFY Create_tablespa
UPDATE user SET Create_tablespace_priv = Super_priv WHERE @hadCreateTablespacePriv = 0;
- ALTER TABLE user ADD plugin char(64) DEFAULT '', ADD authentication_string TEXT;
+ ALTER TABLE user ADD plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL,
+ ADD authentication_string TEXT NOT NULL;
+ ALTER TABLE user MODIFY plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL,
+ MODIFY authentication_string TEXT NOT NULL;
ALTER TABLE user ADD password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
ALTER TABLE user ADD is_role enum('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
+ALTER TABLE user ADD default_role char(80) binary DEFAULT '' NOT NULL;
+ALTER TABLE user ADD max_statement_time decimal(12,6) DEFAULT 0 NOT NULL;
- ALTER TABLE user MODIFY plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL, MODIFY authentication_string TEXT NOT NULL;
-- Somewhere above, we ran ALTER TABLE user .... CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin.
-- we want password_expired column to have collation utf8_general_ci.
ALTER TABLE user MODIFY password_expired ENUM('N', 'Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL;
diff --cc support-files/CMakeLists.txt
index dff4610d490,cc9eed6c7be..4ad3810e082
--- a/support-files/CMakeLists.txt
+++ b/support-files/CMakeLists.txt
@@@ -41,116 -41,61 +41,118 @@@ ELSE(
SET(inst_location ${INSTALL_SUPPORTFILESDIR})
ENDIF()
+ IF (NOT WITHOUT_SERVER)
FOREACH(inifile my-huge my-innodb-heavy-4G my-large my-medium my-small)
- CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${inifile}.cnf.sh
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${inifile}.cnf.sh
${CMAKE_CURRENT_BINARY_DIR}/${inifile}.${ini_file_extension} @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${inifile}.${ini_file_extension}
DESTINATION ${inst_location} COMPONENT IniFiles)
ENDFOREACH()
+ ENDIF()
+IF(WITH_WSREP)
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/wsrep.cnf.sh
+ ${CMAKE_CURRENT_BINARY_DIR}/wsrep.${ini_file_extension} @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/wsrep.${ini_file_extension}
+ DESTINATION ${inst_location} COMPONENT IniFiles)
+ENDIF()
+
IF(UNIX)
SET(prefix ${CMAKE_INSTALL_PREFIX})
- FOREACH(script mysqld_multi.server mysql-log-rotate binary-configure)
+ FOREACH(script mysqld_multi.server mysql-log-rotate binary-configure wsrep_notify)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${script}.sh
${CMAKE_CURRENT_BINARY_DIR}/${script} @ONLY )
-
- IF(script MATCHES ".ini")
- SET(comp IniFiles)
- SET(permissions OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
- ELSE()
- SET(comp Server_Scripts)
- SET(permissions OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
- ENDIF()
- INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${script}
- DESTINATION ${inst_location} COMPONENT ${comp}
- PERMISSIONS ${permissions})
+ INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${script}
+ DESTINATION ${inst_location} COMPONENT Server_Scripts)
ENDFOREACH()
+
IF(INSTALL_SUPPORTFILESDIR)
INSTALL(FILES magic DESTINATION ${inst_location} COMPONENT SupportFiles)
- ADD_SUBDIRECTORY(SELinux)
+ INSTALL(DIRECTORY policy DESTINATION ${inst_location} COMPONENT SupportFiles)
+ FIND_PROGRAM(CHECKMODULE checkmodule)
+ FIND_PROGRAM(SEMODULE_PACKAGE semodule_package)
+ MARK_AS_ADVANCED(CHECKMODULE SEMODULE_PACKAGE)
+
+ # Build pp files in policy/selinux
+ IF(CHECKMODULE AND SEMODULE_PACKAGE)
+ FOREACH(pol mariadb)
+ SET(src ${CMAKE_CURRENT_SOURCE_DIR}/policy/selinux/${pol}.te)
+ SET(tmp ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${pol}-pp.dir/${pol}.mod)
+ SET(out ${CMAKE_CURRENT_BINARY_DIR}/${pol}.pp)
+ ADD_CUSTOM_COMMAND(OUTPUT ${out}
+ COMMAND ${CHECKMODULE} -M -m ${src} -o ${tmp}
+ COMMAND ${SEMODULE_PACKAGE} -m ${tmp} -o ${out}
+ DEPENDS ${src})
+ ADD_CUSTOM_TARGET(${pol}-pp ALL DEPENDS ${out})
+ INSTALL(FILES ${out} DESTINATION ${inst_location}/policy/selinux COMPONENT SupportFiles)
+ ENDFOREACH()
+ ENDIF()
ENDIF()
+ CONFIGURE_FILE(mariadb.pc.in ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb.pc DESTINATION ${INSTALL_SHAREDIR}/pkgconfig COMPONENT Development)
+
INSTALL(FILES mysql.m4 DESTINATION ${INSTALL_SHAREDIR}/aclocal COMPONENT Development)
- CONFIGURE_FILE(MySQL-shared-compat.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/MySQL-shared-compat.spec @ONLY)
- CONFIGURE_FILE(mysql.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/mysql.spec @ONLY)
-
- SET(SPECFILENAME "mysql.${VERSION}.spec")
- IF("${VERSION}" MATCHES "-ndb-")
- STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}")
- SET(SPECFILENAME "mysql-cluster-${NDBVERSION}.spec")
- ENDIF()
- CONFIGURE_FILE(mysql.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/${SPECFILENAME} @ONLY)
- CONFIGURE_FILE(MySQL-shared-compat.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/MySQL-shared-compat.spec @ONLY)
-
- SET(bindir ${prefix}/${INSTALL_BINDIR})
- SET(sbindir ${prefix}/${INSTALL_SBINDIR})
- SET(scriptdir ${prefix}/${INSTALL_SCRIPTDIR})
- SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
- SET(pkgdatadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
+ SET(bindir ${INSTALL_BINDIRABS})
+ SET(sbindir ${INSTALL_SBINDIRABS})
+ SET(scriptdir ${INSTALL_SCRIPTDIRABS})
+ SET(libexecdir ${INSTALL_SBINDIRABS})
+ SET(pkgdatadir ${INSTALL_MYSQLSHAREDIRABS})
+ SET(sysconfdir ${INSTALL_SYSCONFDIR})
+ SET(sysconf2dir ${INSTALL_SYSCONF2DIR})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql.server.sh
${CMAKE_CURRENT_BINARY_DIR}/mysql.server @ONLY)
- INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql.server
- DESTINATION ${inst_location} COMPONENT SupportFiles
- PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
- GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+ INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/mysql.server
+ DESTINATION ${inst_location} COMPONENT SupportFiles)
+
+ IF(HAVE_SYSTEMD)
+ CONFIGURE_FILE(mariadb.service.in
+ ${CMAKE_CURRENT_BINARY_DIR}/mariadb.service @ONLY)
+ INSTALL(FILES use_galera_new_cluster.conf
+ ${CMAKE_CURRENT_BINARY_DIR}/mariadb.service
+ DESTINATION ${inst_location}/systemd COMPONENT SupportFiles)
+
+ IF(INSTALL_SYSTEMD_SYSUSERSDIR)
+ CONFIGURE_FILE(sysusers.conf.in
+ ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sysusers.conf
+ DESTINATION ${INSTALL_SYSTEMD_SYSUSERSDIR} COMPONENT Server)
+ ENDIF()
+
+ IF(INSTALL_SYSTEMD_TMPFILESDIR)
+ get_filename_component(MYSQL_UNIX_DIR ${MYSQL_UNIX_ADDR} DIRECTORY)
+ CONFIGURE_FILE(tmpfiles.conf.in
+ ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tmpfiles.conf
+ DESTINATION ${INSTALL_SYSTEMD_TMPFILESDIR} COMPONENT Server)
+ ENDIF()
+
+ # @ in directory name broken between CMake version 2.8.12.2 and 3.3
+ # http://public.kitware.com/Bug/view.php?id=14782
+ IF(NOT CMAKE_VERSION VERSION_LESS 3.3.0 OR NOT RPM)
+ CONFIGURE_FILE(mariadb@.service.in
+ ${CMAKE_CURRENT_BINARY_DIR}/mariadb@.service @ONLY)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb@.service
+ DESTINATION ${inst_location}/systemd COMPONENT SupportFiles)
+ ENDIF()
+
+ IF(INSTALL_SYSTEMD_UNITDIR)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb.service
+ DESTINATION ${INSTALL_SYSTEMD_UNITDIR} COMPONENT Server)
+
+ # http://public.kitware.com/Bug/view.php?id=14782
+ IF(NOT CMAKE_VERSION VERSION_LESS 3.3.0 OR NOT RPM)
+ INSTALL(FILES use_galera_new_cluster.conf
+ DESTINATION
+ "${INSTALL_SYSTEMD_UNITDIR}/mariadb(a)bootstrap.service.d"
+ COMPONENT Server)
+ INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mariadb@.service
+ DESTINATION ${INSTALL_SYSTEMD_UNITDIR} COMPONENT Server)
+ ENDIF()
+
+ ENDIF()
+ ENDIF()
IF (INSTALL_SYSCONFDIR)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql-log-rotate DESTINATION ${INSTALL_SYSCONFDIR}/logrotate.d
1
0

[Commits] 32be26b: MDEV-16820 Lost 'Impossible where' from query with inexpensive subquery
by IgorBabaev 25 Jul '18
by IgorBabaev 25 Jul '18
25 Jul '18
revision-id: 32be26bdc419be8383fecf315e2c66f81646620a (mariadb-10.2.16-41-g32be26b)
parent(s): 969939e89c29bb3f3d91f8b4ab539601b5daa4d8
author: Igor Babaev
committer: Igor Babaev
timestamp: 2018-07-25 11:57:57 -0700
message:
MDEV-16820 Lost 'Impossible where' from query with inexpensive subquery
This patch fixes another problem introduced by the patch for mdev-4817.
The latter changed Item_cond::fix_fields() in such a way that it could
call the virtual method is_expensive(). With the first its call
the method saves the result in Item::is_expensive_cache. For all next
calls the method returns the result from this cache. So if the item
once was determined as expensive the method always returns true.
For subqueries it's not good, because non-optimized subqueries always
is considered as expensive.
It means that the cache should be invalidated after the call of
optimize_constant_subqueries().
---
mysql-test/r/subselect.result | 16 ++++++++++++++++
mysql-test/r/subselect_no_exists_to_in.result | 16 ++++++++++++++++
mysql-test/r/subselect_no_mat.result | 16 ++++++++++++++++
mysql-test/r/subselect_no_opts.result | 16 ++++++++++++++++
mysql-test/r/subselect_no_scache.result | 16 ++++++++++++++++
mysql-test/r/subselect_no_semijoin.result | 16 ++++++++++++++++
mysql-test/t/subselect.test | 15 +++++++++++++++
sql/item.h | 5 +++++
sql/sql_select.cc | 7 +++++++
9 files changed, 123 insertions(+)
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index e2ed431..1c75aa6 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -7240,6 +7240,22 @@ a
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
+#
+# MDEV-16820: impossible where with inexpensive subquery
+#
+create table t1 (a int) engine=myisam;
+insert into t1 values (3), (1), (7);
+create table t2 (b int, index idx(b));
+insert into t2 values (2), (5), (3), (2);
+explain select * from t1 where (select max(b) from t2) = 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 Select tables optimized away
+explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
+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 Select tables optimized away
+drop table t1,t2;
End of 5.5 tests
# End of 10.0 tests
#
diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result
index 6306cff..0bd14a5 100644
--- a/mysql-test/r/subselect_no_exists_to_in.result
+++ b/mysql-test/r/subselect_no_exists_to_in.result
@@ -7240,6 +7240,22 @@ a
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
+#
+# MDEV-16820: impossible where with inexpensive subquery
+#
+create table t1 (a int) engine=myisam;
+insert into t1 values (3), (1), (7);
+create table t2 (b int, index idx(b));
+insert into t2 values (2), (5), (3), (2);
+explain select * from t1 where (select max(b) from t2) = 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 Select tables optimized away
+explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
+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 Select tables optimized away
+drop table t1,t2;
End of 5.5 tests
# End of 10.0 tests
#
diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result
index 0db1b03..a3b7871 100644
--- a/mysql-test/r/subselect_no_mat.result
+++ b/mysql-test/r/subselect_no_mat.result
@@ -7233,6 +7233,22 @@ a
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
+#
+# MDEV-16820: impossible where with inexpensive subquery
+#
+create table t1 (a int) engine=myisam;
+insert into t1 values (3), (1), (7);
+create table t2 (b int, index idx(b));
+insert into t2 values (2), (5), (3), (2);
+explain select * from t1 where (select max(b) from t2) = 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 Select tables optimized away
+explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
+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 Select tables optimized away
+drop table t1,t2;
End of 5.5 tests
# End of 10.0 tests
#
diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result
index 1fa6f38..9dcc690 100644
--- a/mysql-test/r/subselect_no_opts.result
+++ b/mysql-test/r/subselect_no_opts.result
@@ -7231,6 +7231,22 @@ a
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
+#
+# MDEV-16820: impossible where with inexpensive subquery
+#
+create table t1 (a int) engine=myisam;
+insert into t1 values (3), (1), (7);
+create table t2 (b int, index idx(b));
+insert into t2 values (2), (5), (3), (2);
+explain select * from t1 where (select max(b) from t2) = 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 Select tables optimized away
+explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
+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 Select tables optimized away
+drop table t1,t2;
End of 5.5 tests
# End of 10.0 tests
#
diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result
index 986542b..7b3c001 100644
--- a/mysql-test/r/subselect_no_scache.result
+++ b/mysql-test/r/subselect_no_scache.result
@@ -7246,6 +7246,22 @@ a
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
+#
+# MDEV-16820: impossible where with inexpensive subquery
+#
+create table t1 (a int) engine=myisam;
+insert into t1 values (3), (1), (7);
+create table t2 (b int, index idx(b));
+insert into t2 values (2), (5), (3), (2);
+explain select * from t1 where (select max(b) from t2) = 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 Select tables optimized away
+explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
+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 Select tables optimized away
+drop table t1,t2;
End of 5.5 tests
# End of 10.0 tests
#
diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result
index d5fcc17..a062524 100644
--- a/mysql-test/r/subselect_no_semijoin.result
+++ b/mysql-test/r/subselect_no_semijoin.result
@@ -7231,6 +7231,22 @@ a
5
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
+#
+# MDEV-16820: impossible where with inexpensive subquery
+#
+create table t1 (a int) engine=myisam;
+insert into t1 values (3), (1), (7);
+create table t2 (b int, index idx(b));
+insert into t2 values (2), (5), (3), (2);
+explain select * from t1 where (select max(b) from t2) = 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 Select tables optimized away
+explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
+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 Select tables optimized away
+drop table t1,t2;
End of 5.5 tests
# End of 10.0 tests
#
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 7e9e5a7..1048e5a 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -6102,6 +6102,21 @@ and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
SET @@optimizer_switch= @optimiser_switch_save;
DROP TABLE t1, t2, t3;
+--echo #
+--echo # MDEV-16820: impossible where with inexpensive subquery
+--echo #
+
+create table t1 (a int) engine=myisam;
+insert into t1 values (3), (1), (7);
+
+create table t2 (b int, index idx(b));
+insert into t2 values (2), (5), (3), (2);
+
+explain select * from t1 where (select max(b) from t2) = 10;
+explain select * from t1 where (select max(b) from t2) = 10 and t1.a > 3;
+
+drop table t1,t2;
+
--echo End of 5.5 tests
--echo # End of 10.0 tests
diff --git a/sql/item.h b/sql/item.h
index ce07f99..8fad8da 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -1614,6 +1614,11 @@ class Item: public Value_source,
virtual bool limit_index_condition_pushdown_processor(void *arg) { return 0; }
virtual bool exists2in_processor(void *arg) { return 0; }
virtual bool find_selective_predicates_list_processor(void *arg) { return 0; }
+ bool cleanup_is_expensive_cache_processor(void *arg)
+ {
+ is_expensive_cache= (int8)(-1);
+ return 0;
+ }
/*
TRUE if the expression depends only on the table indicated by tab_map
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 1fa2143..4cabf5c 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1335,6 +1335,13 @@ JOIN::optimize_inner()
if (optimize_constant_subqueries())
DBUG_RETURN(1);
+ if (conds && conds->has_subquery())
+ (void) conds->walk(&Item::cleanup_is_expensive_cache_processor,
+ 0, (void *) 0);
+ if (having && having->has_subquery())
+ (void) having->walk(&Item::cleanup_is_expensive_cache_processor,
+ 0, (void *) 0);
+
if (setup_jtbm_semi_joins(this, join_list, &conds))
DBUG_RETURN(1);
1
0

[Commits] f949dd88fa3: MDEV-16812 Semisync slave io thread segfaults at STOP-SLAVE handling
by andrei.elkin@pp.inet.fi 25 Jul '18
by andrei.elkin@pp.inet.fi 25 Jul '18
25 Jul '18
revision-id: f949dd88fa375240308efe7216f0f73ab4d28202 (mariadb-10.3.7-96-gf949dd88fa3)
parent(s): f74d2a9faa4b4233433dfcb0d2d14a6b269c48ba
author: Andrei Elkin
committer: Andrei Elkin
timestamp: 2018-07-24 18:02:30 +0300
message:
MDEV-16812 Semisync slave io thread segfaults at STOP-SLAVE handling
When the semisync slave is being stopped with STOP SLAVE just after
the master was shut down it attempts to reconnect with the master
anyway per a semisync routine. Instead of an expected error the
io-thread segfauls in mysql_real_connect() execution at
!mysql->options.extension->async_context
check trying to reach the extension's member while mysql->options.extension is
actually and correctly NULL.
Apparently not-NULL check for mysql->options.extension was missed and
it's deployed by the patch to fix this issue.
As a bonus it also tackles an assert
Thread 0x7f16c72148c0 (LWP 24639) 0x00007f16c53b3bf2 in __GI___assert_fail (assertion=0x55a686117558 "global_status_var.global_memory_used == 0", file=0x55a6861171e8 "/home/andrei/MDB/WTs/10.3-clean/sql/mysqld.cc", line=2201, function=0x55a68611fa80 <mysqld_exit(int)::__PRETTY_FUNCTION__> "void mysqld_exit(int)") at assert.c:101
in a new test of the patch. The reason of the assert was insufficient cleanup
in Repl_semi_sync_slave::kill_connection() which has a branch where a MYSQL instance
was left out unfred.
---
.../rpl/r/rpl_semi_sync_master_shutdown.result | 33 ++++++++++++
.../suite/rpl/t/rpl_semi_sync_master_shutdown.test | 60 ++++++++++++++++++++++
sql-common/client.c | 2 +-
sql/semisync_slave.cc | 3 +-
4 files changed, 95 insertions(+), 3 deletions(-)
diff --git a/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result b/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result
new file mode 100644
index 00000000000..786e1682bb0
--- /dev/null
+++ b/mysql-test/suite/rpl/r/rpl_semi_sync_master_shutdown.result
@@ -0,0 +1,33 @@
+include/master-slave.inc
+[connection master]
+connection master;
+SET @@GLOBAL.rpl_semi_sync_master_enabled = 1;
+connection slave;
+include/stop_slave.inc
+SET @@GLOBAL. rpl_semi_sync_slave_enabled = 1;
+include/start_slave.inc
+connection master;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 SET a=1;
+connection slave;
+connection master;
+# Shutdown master
+include/rpl_stop_server.inc [server_number=1]
+connection slave;
+include/stop_slave.inc
+# Restart master
+include/rpl_start_server.inc [server_number=1]
+connection slave;
+include/stop_slave.inc
+Warnings:
+Note 1255 Slave already has been stopped
+include/start_slave.inc
+connection master;
+SET @@GLOBAL.debug_dbug="";
+SET @@GLOBAL. rpl_semi_sync_master_enabled = 0;
+connection master;
+DROP TABLE t1;
+connection slave;
+include/stop_slave.inc
+SET @@GLOBAL. rpl_semi_sync_slave_enabled = 0;
+include/rpl_end.inc
diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test b/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test
new file mode 100644
index 00000000000..2224f78d6d0
--- /dev/null
+++ b/mysql-test/suite/rpl/t/rpl_semi_sync_master_shutdown.test
@@ -0,0 +1,60 @@
+# MDEV-16812 Semisync slave io thread segfaults at STOP-SLAVE handling
+#
+# The test verifies that the semisync-enabled slave io thread
+# finishes off as specified in particular trying to connect even to a shut down
+# master for a semisync firewell routine.
+
+source include/not_embedded.inc;
+source include/have_debug.inc;
+source include/master-slave.inc;
+
+--connection master
+
+--let $sav_enabled_master=`SELECT @@GLOBAL.rpl_semi_sync_master_enabled `
+SET @@GLOBAL.rpl_semi_sync_master_enabled = 1;
+
+--connection slave
+source include/stop_slave.inc;
+--let $sav_enabled_slave=`SELECT @@GLOBAL.rpl_semi_sync_slave_enabled `
+SET @@GLOBAL. rpl_semi_sync_slave_enabled = 1;
+source include/start_slave.inc;
+
+--connection master
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 SET a=1;
+
+--sync_slave_with_master
+
+connection master;
+--echo # Shutdown master
+--let $rpl_server_number=1
+source include/rpl_stop_server.inc;
+
+--connection slave
+--source include/stop_slave.inc
+
+#connection master;
+--echo # Restart master
+--let $rpl_server_number=1
+source include/rpl_start_server.inc;
+
+#
+# Clean up
+#
+--connection slave
+--source include/stop_slave.inc
+--source include/start_slave.inc
+
+--connection master
+SET @@GLOBAL.debug_dbug="";
+--eval SET @@GLOBAL. rpl_semi_sync_master_enabled = $sav_enabled_master
+
+--connection master
+DROP TABLE t1;
+
+--sync_slave_with_master
+source include/stop_slave.inc;
+--eval SET @@GLOBAL. rpl_semi_sync_slave_enabled = $sav_enabled_slave
+
+--let $rpl_only_running_threads= 1
+--source include/rpl_end.inc
diff --git a/sql-common/client.c b/sql-common/client.c
index 088377f8c52..8bbe08a504a 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -3657,7 +3657,7 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
end_server(mysql);
mysql_close_free(mysql);
if (!(client_flag & CLIENT_REMEMBER_OPTIONS) &&
- !mysql->options.extension->async_context)
+ !(mysql->options.extension && mysql->options.extension->async_context))
mysql_close_free_options(mysql);
}
DBUG_RETURN(0);
diff --git a/sql/semisync_slave.cc b/sql/semisync_slave.cc
index 86d0176dac1..df8baf045ac 100644
--- a/sql/semisync_slave.cc
+++ b/sql/semisync_slave.cc
@@ -144,8 +144,7 @@ void Repl_semi_sync_slave::kill_connection(MYSQL *mysql)
{
sql_print_information("cannot connect to master to kill slave io_thread's "
"connection");
- if (!ret)
- mysql_close(kill_mysql);
+ mysql_close(kill_mysql);
return;
}
size_t kill_buffer_length = my_snprintf(kill_buffer, 30, "KILL %lu",
1
0