summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-12-27 21:17:16 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-12-27 21:17:16 +0200
commit8cc15c036dbc5fefb025eb957f4d312d41659163 (patch)
tree6c4d67d677e6bb9bc90b7e3f08d18c8a798680b6
parentcc28947315887f55814cb8bc4e68d4e2fe6c65e6 (diff)
parentb86e0f25f896285a34c999515ad50e50d879f3e7 (diff)
downloadmariadb-git-8cc15c036dbc5fefb025eb957f4d312d41659163.tar.gz
Merge 10.4 into 10.5
-rw-r--r--.clang-format2
-rw-r--r--extra/mariabackup/xtrabackup.cc4
-rw-r--r--mysql-test/include/binlog_parallel_replication_marks.test2
-rw-r--r--mysql-test/main/derived_cond_pushdown.result30
-rw-r--r--mysql-test/main/derived_cond_pushdown.test28
-rw-r--r--mysql-test/main/func_time.result17
-rw-r--r--mysql-test/main/func_time.test8
-rw-r--r--mysql-test/main/mysql_tzinfo_to_sql_symlink.result20
-rw-r--r--mysql-test/main/timezone2.result16
-rw-r--r--mysql-test/main/timezone2.test17
-rw-r--r--mysql-test/main/type_datetime.result81
-rw-r--r--mysql-test/main/type_datetime.test43
-rw-r--r--mysql-test/main/type_int.result13
-rw-r--r--mysql-test/main/type_int.test12
-rw-r--r--mysql-test/main/type_time.result66
-rw-r--r--mysql-test/main/type_time.test34
-rw-r--r--mysql-test/main/win.result81
-rw-r--r--mysql-test/main/win.test75
-rwxr-xr-xmysql-test/mysql-test-run.pl2
-rw-r--r--mysql-test/suite/funcs_1/r/is_check_constraint.result121
-rw-r--r--mysql-test/suite/funcs_1/r/is_check_constraints.result272
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is.result6
-rw-r--r--mysql-test/suite/funcs_1/r/is_columns_is_embedded.result6
-rw-r--r--mysql-test/suite/funcs_1/t/is_check_constraint.test92
-rw-r--r--mysql-test/suite/funcs_1/t/is_check_constraints.test103
-rw-r--r--mysql-test/suite/galera/disabled.def1
-rw-r--r--mysql-test/suite/galera/r/galera_gcs_fc_limit.result1
-rw-r--r--mysql-test/suite/galera/r/galera_partition.result16
-rw-r--r--mysql-test/suite/galera/t/galera_gcs_fc_limit.test8
-rw-r--r--mysql-test/suite/galera/t/galera_partition.test18
-rw-r--r--mysql-test/suite/wsrep/disabled.def3
-rw-r--r--mysql-test/suite/wsrep/my.cnf2
-rw-r--r--mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result16
-rw-r--r--mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result8
-rw-r--r--mysql-test/suite/wsrep/r/variables.result163
-rw-r--r--mysql-test/suite/wsrep/t/alter_table_innodb.cnf12
-rw-r--r--mysql-test/suite/wsrep/t/alter_table_innodb.opt1
-rw-r--r--mysql-test/suite/wsrep/t/mdev_10186.cnf15
-rw-r--r--mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt1
-rw-r--r--mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test1
-rw-r--r--mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt1
-rw-r--r--mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test1
-rw-r--r--mysql-test/suite/wsrep/t/plugin.opt1
-rw-r--r--mysql-test/suite/wsrep/t/plugin.test1
-rw-r--r--mysql-test/suite/wsrep/t/pool_of_threads.cnf8
-rw-r--r--mysql-test/suite/wsrep/t/pool_of_threads.opt2
-rw-r--r--mysql-test/suite/wsrep/t/trans.opt1
-rw-r--r--mysql-test/suite/wsrep/t/variables.opt1
-rw-r--r--mysql-test/suite/wsrep/t/variables.test7
-rw-r--r--sql/CMakeLists.txt19
-rw-r--r--sql/item.cc11
-rw-r--r--sql/item_sum.cc22
-rw-r--r--sql/item_sum.h77
-rw-r--r--sql/item_timefunc.cc16
-rw-r--r--sql/item_timefunc.h51
-rw-r--r--sql/item_windowfunc.h175
-rw-r--r--sql/sql_audit.h22
-rw-r--r--sql/sql_insert.cc41
-rw-r--r--sql/sql_lex.h22
-rw-r--r--sql/sql_select.cc36
-rw-r--r--sql/sql_select.h1
-rw-r--r--sql/sql_show.cc43
-rw-r--r--sql/sql_type.h9
-rw-r--r--sql/sql_window.cc6
-rw-r--r--sql/threadpool_generic.cc2
-rw-r--r--sql/tztime.cc10
-rw-r--r--sql/unireg.cc3
-rw-r--r--sql/wsrep_mysqld.cc1
-rw-r--r--storage/connect/CMakeLists.txt11
-rw-r--r--storage/innobase/buf/buf0buf.cc2
-rw-r--r--storage/innobase/dict/dict0crea.cc42
-rw-r--r--storage/innobase/include/buf0buf.h49
-rw-r--r--storage/innobase/include/buf0buf.ic12
-rw-r--r--storage/innobase/include/dict0crea.h10
-rw-r--r--storage/innobase/include/log0recv.h17
-rw-r--r--storage/innobase/include/mtr0log.h8
-rw-r--r--storage/innobase/include/mtr0log.ic24
-rw-r--r--storage/innobase/include/page0page.ic1
-rw-r--r--storage/innobase/innodb.cmake5
-rw-r--r--storage/innobase/log/log0recv.cc203
-rw-r--r--storage/innobase/os/os0proc.cc6
-rw-r--r--storage/rocksdb/CMakeLists.txt2
-rw-r--r--storage/rocksdb/build_rocksdb.cmake2
-rw-r--r--strings/ctype-simple.c3
-rw-r--r--strings/my_strtoll10.c17
-rw-r--r--support-files/mariadb.service.in7
-rw-r--r--support-files/mariadb@.service.in7
87 files changed, 1404 insertions, 1031 deletions
diff --git a/.clang-format b/.clang-format
index 7ad3d0dbddc..7ce45951173 100644
--- a/.clang-format
+++ b/.clang-format
@@ -85,7 +85,7 @@ PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
ReflowComments: true
-SortIncludes: true
+SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: true
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index bb066daaba6..4743ba25df6 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -2676,7 +2676,9 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last)
}
}
- if (more_data && recv_parse_log_recs(0, STORE_NO, false)) {
+ store_t store = STORE_NO;
+
+ if (more_data && recv_parse_log_recs(0, &store, 0, false)) {
msg("Error: copying the log failed");
diff --git a/mysql-test/include/binlog_parallel_replication_marks.test b/mysql-test/include/binlog_parallel_replication_marks.test
index 82fa997822d..3976088ca43 100644
--- a/mysql-test/include/binlog_parallel_replication_marks.test
+++ b/mysql-test/include/binlog_parallel_replication_marks.test
@@ -80,7 +80,7 @@ while (<F>) {
s/table id \d+/table id #/;
s/mapped to number \d+/mapped to number #/;
s/CRC32 0x[0-9a-f]+/CRC32 0x########/;
- print if /GTID|BEGIN|COMMIT|Table_map|Write_rows|Update_rows|Delete_rows|generated by server|40005 TEMPORARY/;
+ print if /\b(GTID|BEGIN|COMMIT|Table_map|Write_rows|Update_rows|Delete_rows|generated by server|40005 TEMPORARY)\b/;
}
close F;
EOF
diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result
index c044b79d953..9203a3ddf1b 100644
--- a/mysql-test/main/derived_cond_pushdown.result
+++ b/mysql-test/main/derived_cond_pushdown.result
@@ -10548,6 +10548,36 @@ EXPLAIN
}
DROP TABLE t1;
DROP VIEW v1;
+#
+# MDEV-21388 Wrong result of DAYNAME()=xxx in combination with condition_pushdown_for_derived=on
+#
+CREATE TABLE t1 (a INT, b DATE, c INT);
+INSERT INTO t1 VALUES
+(1,'2001-01-21',345),
+(6,'2001-01-20',315),
+(6,'2001-01-20',214);
+CREATE TABLE t2 (a INT, b INT);
+INSERT INTO t2 VALUES (2,19), (7,20);
+CREATE VIEW v1 AS SELECT a, b, max(c) AS max_c FROM t1
+GROUP BY a,b HAVING max_c < 707;
+SELECT *, dayname(v1.b) FROM v1,t2 WHERE (v1.max_c>214) AND (t2.a>v1.a);
+a b max_c a b dayname(v1.b)
+1 2001-01-21 345 2 19 Sunday
+1 2001-01-21 345 7 20 Sunday
+6 2001-01-20 315 7 20 Saturday
+SET optimizer_switch='condition_pushdown_for_derived=off';
+SELECT *, dayname(v1.b) FROM v1,t2 WHERE (v1.max_c>214) AND (t2.a>v1.a) AND dayname(v1.b)='Sunday';
+a b max_c a b dayname(v1.b)
+1 2001-01-21 345 2 19 Sunday
+1 2001-01-21 345 7 20 Sunday
+SET optimizer_switch='condition_pushdown_for_derived=on';
+SELECT *, dayname(v1.b) FROM v1,t2 WHERE (v1.max_c>214) AND (t2.a>v1.a) AND dayname(v1.b)='Sunday';
+a b max_c a b dayname(v1.b)
+1 2001-01-21 345 2 19 Sunday
+1 2001-01-21 345 7 20 Sunday
+DROP VIEW v1;
+DROP TABLE t1, t2;
+SET optimizer_switch=DEFAULT;
# End of 10.2 tests
#
# MDEV-14579: pushdown conditions into materialized views/derived tables
diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test
index 6d81d2ad80b..1441989e2cc 100644
--- a/mysql-test/main/derived_cond_pushdown.test
+++ b/mysql-test/main/derived_cond_pushdown.test
@@ -2140,6 +2140,34 @@ SELECT * FROM (SELECT 1 FROM v1 UNION (SELECT 1 FROM v1 WHERE @a := uuid())) dt;
DROP TABLE t1;
DROP VIEW v1;
+--echo #
+--echo # MDEV-21388 Wrong result of DAYNAME()=xxx in combination with condition_pushdown_for_derived=on
+--echo #
+
+CREATE TABLE t1 (a INT, b DATE, c INT);
+INSERT INTO t1 VALUES
+ (1,'2001-01-21',345),
+ (6,'2001-01-20',315),
+ (6,'2001-01-20',214);
+
+CREATE TABLE t2 (a INT, b INT);
+INSERT INTO t2 VALUES (2,19), (7,20);
+CREATE VIEW v1 AS SELECT a, b, max(c) AS max_c FROM t1
+ GROUP BY a,b HAVING max_c < 707;
+
+SELECT *, dayname(v1.b) FROM v1,t2 WHERE (v1.max_c>214) AND (t2.a>v1.a);
+
+SET optimizer_switch='condition_pushdown_for_derived=off';
+SELECT *, dayname(v1.b) FROM v1,t2 WHERE (v1.max_c>214) AND (t2.a>v1.a) AND dayname(v1.b)='Sunday';
+
+SET optimizer_switch='condition_pushdown_for_derived=on';
+SELECT *, dayname(v1.b) FROM v1,t2 WHERE (v1.max_c>214) AND (t2.a>v1.a) AND dayname(v1.b)='Sunday';
+
+DROP VIEW v1;
+DROP TABLE t1, t2;
+
+SET optimizer_switch=DEFAULT;
+
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result
index 4faf9731a29..59ad815b0e0 100644
--- a/mysql-test/main/func_time.result
+++ b/mysql-test/main/func_time.result
@@ -159,7 +159,9 @@ date_format('1999-12-31','%x-%v') date_format('2000-01-01','%x-%v')
1999-52 1999-52
select dayname("1962-03-03"),dayname("1962-03-03")+0;
dayname("1962-03-03") dayname("1962-03-03")+0
-Saturday 5
+Saturday 0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'Saturday'
select monthname("1972-03-04"),monthname("1972-03-04")+0;
monthname("1972-03-04") monthname("1972-03-04")+0
March 0
@@ -3512,6 +3514,19 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI
DROP VIEW v1,v2,v3;
DROP TABLE t1,t2;
#
+# MDEV-21388 Wrong result of DAYNAME()=xxx in combination with condition_pushdown_for_derived=on
+#
+SELECT DAYNAME('2019-01-05')+0;
+DAYNAME('2019-01-05')+0
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'Saturday'
+SELECT CAST(DAYNAME('2019-01-05') AS SIGNED);
+CAST(DAYNAME('2019-01-05') AS SIGNED)
+0
+Warnings:
+Warning 1292 Truncated incorrect INTEGER value: 'Saturday'
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test
index 2e44df5a0d0..71f82ddba7b 100644
--- a/mysql-test/main/func_time.test
+++ b/mysql-test/main/func_time.test
@@ -1973,6 +1973,14 @@ DROP VIEW v1,v2,v3;
DROP TABLE t1,t2;
--echo #
+--echo # MDEV-21388 Wrong result of DAYNAME()=xxx in combination with condition_pushdown_for_derived=on
+--echo #
+
+SELECT DAYNAME('2019-01-05')+0;
+SELECT CAST(DAYNAME('2019-01-05') AS SIGNED);
+
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
index 966cc1d123a..8997c404079 100644
--- a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
+++ b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
@@ -4,7 +4,7 @@
# Verbose run
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
@@ -36,7 +36,7 @@ ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=Aria;
ALTER TABLE time_zone_name ENGINE=Aria;
ALTER TABLE time_zone_transition ENGINE=Aria;
@@ -46,7 +46,7 @@ END IF|
# Silent run
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
@@ -75,7 +75,7 @@ ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=Aria;
ALTER TABLE time_zone_name ENGINE=Aria;
ALTER TABLE time_zone_transition ENGINE=Aria;
@@ -93,7 +93,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=Aria;
ALTER TABLE time_zone_name ENGINE=Aria;
ALTER TABLE time_zone_transition ENGINE=Aria;
@@ -105,21 +105,21 @@ END IF|
#
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone_leap_second ENGINE=InnoDB;
END IF|
\d ;
TRUNCATE TABLE time_zone_leap_second;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone_leap_second ENGINE=Aria;
END IF|
\d ;
ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=Aria;
ALTER TABLE time_zone_name ENGINE=Aria;
ALTER TABLE time_zone_transition ENGINE=Aria;
@@ -131,7 +131,7 @@ END IF|
#
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
@@ -146,7 +146,7 @@ ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=Aria;
ALTER TABLE time_zone_name ENGINE=Aria;
ALTER TABLE time_zone_transition ENGINE=Aria;
diff --git a/mysql-test/main/timezone2.result b/mysql-test/main/timezone2.result
index b858e761a81..f943e285951 100644
--- a/mysql-test/main/timezone2.result
+++ b/mysql-test/main/timezone2.result
@@ -574,6 +574,22 @@ a b
SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
a b
DROP TABLE t1;
+SET time_zone='Europe/Moscow';
+CREATE TABLE t1 (a TIMESTAMP);
+CREATE TABLE t2 (a TIMESTAMP);
+SET timestamp=1288479599 /*summer time in Mowcow*/;
+INSERT INTO t1 VALUES (CURRENT_TIMESTAMP);
+SET timestamp=1288479599+3600 /*winter time in Mowcow*/;
+INSERT INTO t2 VALUES (CURRENT_TIMESTAMP);
+SELECT t1.a, UNIX_TIMESTAMP(t1.a), t2.a, UNIX_TIMESTAMP(t2.a) FROM t1, t2;
+a UNIX_TIMESTAMP(t1.a) a UNIX_TIMESTAMP(t2.a)
+2010-10-31 02:59:59 1288479599 2010-10-31 02:59:59 1288483199
+SELECT NULLIF(t1.a, t2.a) FROM t1,t2;
+NULLIF(t1.a, t2.a)
+2010-10-31 02:59:59
+DROP TABLE t1, t2;
+SET time_zone=DEFAULT;
+SET timestamp=DEFAULT;
#
# MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY
#
diff --git a/mysql-test/main/timezone2.test b/mysql-test/main/timezone2.test
index 9d364224311..6a8c9f258e4 100644
--- a/mysql-test/main/timezone2.test
+++ b/mysql-test/main/timezone2.test
@@ -521,6 +521,23 @@ SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1);
SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1));
DROP TABLE t1;
+# NULLIF
+
+SET time_zone='Europe/Moscow';
+
+CREATE TABLE t1 (a TIMESTAMP);
+CREATE TABLE t2 (a TIMESTAMP);
+SET timestamp=1288479599 /*summer time in Mowcow*/;
+INSERT INTO t1 VALUES (CURRENT_TIMESTAMP);
+SET timestamp=1288479599+3600 /*winter time in Mowcow*/;
+INSERT INTO t2 VALUES (CURRENT_TIMESTAMP);
+SELECT t1.a, UNIX_TIMESTAMP(t1.a), t2.a, UNIX_TIMESTAMP(t2.a) FROM t1, t2;
+SELECT NULLIF(t1.a, t2.a) FROM t1,t2;
+DROP TABLE t1, t2;
+SET time_zone=DEFAULT;
+SET timestamp=DEFAULT;
+
+
--echo #
--echo # MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY
--echo #
diff --git a/mysql-test/main/type_datetime.result b/mysql-test/main/type_datetime.result
index 5afb0257757..b23fa762c73 100644
--- a/mysql-test/main/type_datetime.result
+++ b/mysql-test/main/type_datetime.result
@@ -1198,6 +1198,87 @@ Warning 1292 Incorrect datetime value: '2' for column `test`.`t1`.`pk` at row 2
DROP VIEW v1;
DROP TABLE t1;
#
+# MDEV-21319 COUNT(*) returns 1, actual SELECT returns no result in 10.3.21, but 1 result in 10.1.41
+#
+CREATE TABLE t1
+(
+id INT NOT NULL PRIMARY KEY,
+id2 INT,
+k TINYINT,
+j INT,
+t DATETIME,
+KEY k1 (id2,k,j,t)
+);
+INSERT INTO t1 VALUES
+(53,54,1,0,'2019-12-13 10:09:59'),
+(54,54,1,0,'2019-12-13 16:28:41'),
+(55,54,1,0,'2019-12-13 16:29:10'),
+(56,54,1,0,'2019-12-13 16:29:43'),
+(57,54,1,0,'2019-12-13 16:30:16'),
+(58,54,1,0,'2019-12-13 16:30:49'),
+(59,54,1,0,'2019-12-13 16:31:23'),
+(60,54,1,0,'2019-12-13 16:31:55'),
+(61,54,1,0,'2019-12-13 16:32:28'),
+(62,54,1,0,'2019-12-13 16:33:01'),
+(63,54,1,0,'2019-12-13 16:33:34'),
+(64,54,1,0,'2019-12-13 16:34:07'),
+(65,54,1,0,'2019-12-13 16:34:40'),
+(66,54,1,0,'2019-12-13 16:35:13'),
+(67,54,1,0,'2019-12-13 16:35:46'),
+(68,54,1,0,'2019-12-13 16:36:19');
+SELECT t FROM t1 GROUP BY t HAVING t=max(t);
+t
+2019-12-13 10:09:59
+2019-12-13 16:28:41
+2019-12-13 16:29:10
+2019-12-13 16:29:43
+2019-12-13 16:30:16
+2019-12-13 16:30:49
+2019-12-13 16:31:23
+2019-12-13 16:31:55
+2019-12-13 16:32:28
+2019-12-13 16:33:01
+2019-12-13 16:33:34
+2019-12-13 16:34:07
+2019-12-13 16:34:40
+2019-12-13 16:35:13
+2019-12-13 16:35:46
+2019-12-13 16:36:19
+SELECT t FROM t1 WHERE id2=54 and j=0 and k=1 GROUP BY t HAVING t=max(t);
+t
+2019-12-13 10:09:59
+2019-12-13 16:28:41
+2019-12-13 16:29:10
+2019-12-13 16:29:43
+2019-12-13 16:30:16
+2019-12-13 16:30:49
+2019-12-13 16:31:23
+2019-12-13 16:31:55
+2019-12-13 16:32:28
+2019-12-13 16:33:01
+2019-12-13 16:33:34
+2019-12-13 16:34:07
+2019-12-13 16:34:40
+2019-12-13 16:35:13
+2019-12-13 16:35:46
+2019-12-13 16:36:19
+DROP TABLE t1;
+CREATE TABLE t1 (pk INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1);
+SELECT pk<DATE'2001-01-01' FROM t1 GROUP BY pk;
+pk<DATE'2001-01-01'
+1
+Warnings:
+Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
+SELECT pk<DATE'2001-01-01' FROM v1 GROUP BY pk;
+pk<DATE'2001-01-01'
+1
+Warnings:
+Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`pk` at row 1
+DROP VIEW v1;
+DROP TABLE t1;
+#
# End of 10.1 tests
#
#
diff --git a/mysql-test/main/type_datetime.test b/mysql-test/main/type_datetime.test
index b4b5fe95bbf..e4b18a245f0 100644
--- a/mysql-test/main/type_datetime.test
+++ b/mysql-test/main/type_datetime.test
@@ -748,6 +748,49 @@ DROP TABLE t1;
--echo #
+--echo # MDEV-21319 COUNT(*) returns 1, actual SELECT returns no result in 10.3.21, but 1 result in 10.1.41
+--echo #
+
+CREATE TABLE t1
+(
+ id INT NOT NULL PRIMARY KEY,
+ id2 INT,
+ k TINYINT,
+ j INT,
+ t DATETIME,
+ KEY k1 (id2,k,j,t)
+);
+INSERT INTO t1 VALUES
+(53,54,1,0,'2019-12-13 10:09:59'),
+(54,54,1,0,'2019-12-13 16:28:41'),
+(55,54,1,0,'2019-12-13 16:29:10'),
+(56,54,1,0,'2019-12-13 16:29:43'),
+(57,54,1,0,'2019-12-13 16:30:16'),
+(58,54,1,0,'2019-12-13 16:30:49'),
+(59,54,1,0,'2019-12-13 16:31:23'),
+(60,54,1,0,'2019-12-13 16:31:55'),
+(61,54,1,0,'2019-12-13 16:32:28'),
+(62,54,1,0,'2019-12-13 16:33:01'),
+(63,54,1,0,'2019-12-13 16:33:34'),
+(64,54,1,0,'2019-12-13 16:34:07'),
+(65,54,1,0,'2019-12-13 16:34:40'),
+(66,54,1,0,'2019-12-13 16:35:13'),
+(67,54,1,0,'2019-12-13 16:35:46'),
+(68,54,1,0,'2019-12-13 16:36:19');
+SELECT t FROM t1 GROUP BY t HAVING t=max(t);
+SELECT t FROM t1 WHERE id2=54 and j=0 and k=1 GROUP BY t HAVING t=max(t);
+DROP TABLE t1;
+
+CREATE TABLE t1 (pk INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+INSERT INTO t1 VALUES (1);
+SELECT pk<DATE'2001-01-01' FROM t1 GROUP BY pk;
+SELECT pk<DATE'2001-01-01' FROM v1 GROUP BY pk;
+DROP VIEW v1;
+DROP TABLE t1;
+
+
+--echo #
--echo # End of 10.1 tests
--echo #
diff --git a/mysql-test/main/type_int.result b/mysql-test/main/type_int.result
index 3b1321d9a60..855341a2b59 100644
--- a/mysql-test/main/type_int.result
+++ b/mysql-test/main/type_int.result
@@ -20,6 +20,19 @@ COALESCE(@a)
1
DROP TABLE t1;
#
+# MDEV-21065 UNIQUE constraint causes a query with string comparison to omit a row in the result set
+#
+CREATE TABLE t1 (c0 INT UNIQUE);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL), (NULL), (1), (0);
+SELECT * FROM t1 WHERE c0 < '\n2';
+c0
+0
+1
+DROP TABLE t1;
+SELECT CAST('\n2' AS INT);
+CAST('\n2' AS INT)
+2
+#
# End of 5.5 tests
#
#
diff --git a/mysql-test/main/type_int.test b/mysql-test/main/type_int.test
index 77c532ff4ac..5d961724e59 100644
--- a/mysql-test/main/type_int.test
+++ b/mysql-test/main/type_int.test
@@ -15,6 +15,18 @@ SELECT COALESCE(@a) FROM t1 ORDER BY STRCMP(STDDEV_SAMP(a), 'bar');
DROP TABLE t1;
--echo #
+--echo # MDEV-21065 UNIQUE constraint causes a query with string comparison to omit a row in the result set
+--echo #
+
+CREATE TABLE t1 (c0 INT UNIQUE);
+INSERT INTO t1 VALUES (NULL), (NULL), (NULL), (NULL), (1), (0);
+SELECT * FROM t1 WHERE c0 < '\n2';
+DROP TABLE t1;
+
+SELECT CAST('\n2' AS INT);
+
+
+--echo #
--echo # End of 5.5 tests
--echo #
diff --git a/mysql-test/main/type_time.result b/mysql-test/main/type_time.result
index 673bed990a1..360746bb856 100644
--- a/mysql-test/main/type_time.result
+++ b/mysql-test/main/type_time.result
@@ -1258,6 +1258,72 @@ drop table t1;
SET @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity;
set @@old_mode= @save_old_mode;
#
+# MDEV-21319 COUNT(*) returns 1, actual SELECT returns no result in 10.3.21, but 1 result in 10.1.41
+#
+CREATE OR REPLACE TABLE t1
+(
+id INT NOT NULL PRIMARY KEY,
+id2 INT,
+k TINYINT,
+j INT,
+t TIME,
+KEY k1 (id2,k,j,t)
+);
+INSERT INTO t1 VALUES
+(53,54,1,0,'10:09:59'),
+(54,54,1,0,'16:28:41'),
+(55,54,1,0,'16:29:10'),
+(56,54,1,0,'16:29:43'),
+(57,54,1,0,'16:30:16'),
+(58,54,1,0,'16:30:49'),
+(59,54,1,0,'16:31:23'),
+(60,54,1,0,'16:31:55'),
+(61,54,1,0,'16:32:28'),
+(62,54,1,0,'16:33:01'),
+(63,54,1,0,'16:33:34'),
+(64,54,1,0,'16:34:07'),
+(65,54,1,0,'16:34:40'),
+(66,54,1,0,'16:35:13'),
+(67,54,1,0,'16:35:46'),
+(68,54,1,0,'16:36:19');
+SELECT t FROM t1 GROUP BY t HAVING t=MAX(t);
+t
+10:09:59
+16:28:41
+16:29:10
+16:29:43
+16:30:16
+16:30:49
+16:31:23
+16:31:55
+16:32:28
+16:33:01
+16:33:34
+16:34:07
+16:34:40
+16:35:13
+16:35:46
+16:36:19
+SELECT t FROM t1 WHERE id2=54 AND j=0 AND k=1 GROUP BY t HAVING t=MAX(t);
+t
+10:09:59
+16:28:41
+16:29:10
+16:29:43
+16:30:16
+16:30:49
+16:31:23
+16:31:55
+16:32:28
+16:33:01
+16:33:34
+16:34:07
+16:34:40
+16:35:13
+16:35:46
+16:36:19
+DROP TABLE t1;
+#
# End of 10.1 tests
#
#
diff --git a/mysql-test/main/type_time.test b/mysql-test/main/type_time.test
index 08e43041c76..13101f0e29d 100644
--- a/mysql-test/main/type_time.test
+++ b/mysql-test/main/type_time.test
@@ -752,6 +752,40 @@ SET @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selecti
set @@old_mode= @save_old_mode;
--echo #
+--echo # MDEV-21319 COUNT(*) returns 1, actual SELECT returns no result in 10.3.21, but 1 result in 10.1.41
+--echo #
+
+CREATE OR REPLACE TABLE t1
+(
+ id INT NOT NULL PRIMARY KEY,
+ id2 INT,
+ k TINYINT,
+ j INT,
+ t TIME,
+ KEY k1 (id2,k,j,t)
+);
+INSERT INTO t1 VALUES
+(53,54,1,0,'10:09:59'),
+(54,54,1,0,'16:28:41'),
+(55,54,1,0,'16:29:10'),
+(56,54,1,0,'16:29:43'),
+(57,54,1,0,'16:30:16'),
+(58,54,1,0,'16:30:49'),
+(59,54,1,0,'16:31:23'),
+(60,54,1,0,'16:31:55'),
+(61,54,1,0,'16:32:28'),
+(62,54,1,0,'16:33:01'),
+(63,54,1,0,'16:33:34'),
+(64,54,1,0,'16:34:07'),
+(65,54,1,0,'16:34:40'),
+(66,54,1,0,'16:35:13'),
+(67,54,1,0,'16:35:46'),
+(68,54,1,0,'16:36:19');
+SELECT t FROM t1 GROUP BY t HAVING t=MAX(t);
+SELECT t FROM t1 WHERE id2=54 AND j=0 AND k=1 GROUP BY t HAVING t=MAX(t);
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.1 tests
--echo #
diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result
index 79c7669f861..fd0efd917e6 100644
--- a/mysql-test/main/win.result
+++ b/mysql-test/main/win.result
@@ -3642,6 +3642,87 @@ x
foo
drop table t1;
#
+# MDEV-16579: Wrong result of query using DISTINCT COUNT(*) OVER (*)
+#
+CREATE TABLE t1 (i int) ;
+INSERT INTO t1 VALUES (1),(0),(1),(2),(0),(1),(2),(1),(2);
+SELECT DISTINCT COUNT(*) OVER (), MOD(MIN(i),2) FROM t1 GROUP BY i ;
+COUNT(*) OVER () MOD(MIN(i),2)
+3 0
+3 1
+drop table t1;
+#
+# MDEV-21318: Wrong results with window functions and implicit grouping
+#
+CREATE TABLE t1 (a INT);
+#
+# With empty const table
+# The expected result here is 1, NULL
+#
+explain
+SELECT row_number() over(), sum(1) FROM t1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found; Using temporary
+SELECT row_number() over(), sum(1) FROM t1;
+row_number() over() sum(1)
+1 NULL
+insert into t1 values (2);
+#
+# Const table has 1 row, but still impossible where
+# The expected result here is 1, NULL
+#
+EXPLAIN SELECT row_number() over(), sum(1) FROM t1 where a=1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
+SELECT row_number() over(), sum(1) FROM t1 where a=1;
+row_number() over() sum(1)
+1 NULL
+#
+# Impossible HAVING
+# Empty result is expected
+#
+EXPLAIN SELECT row_number() over(), sum(1) FROM t1 where a=1 having 1=0;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING
+SELECT row_number() over(), sum(1) FROM t1 where a=1 having 1=0;
+row_number() over() sum(1)
+#
+# const table has 1 row, no impossible where
+# The expected result here is 1, 2
+#
+EXPLAIN SELECT row_number() over(), sum(a) FROM t1 where a=2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 system NULL NULL NULL NULL 1 Using temporary
+SELECT row_number() over(), sum(a) FROM t1 where a=2;
+row_number() over() sum(a)
+1 2
+drop table t1;
+#
+# Impossible Where
+#
+create table t1(a int);
+insert into t1 values (1);
+#
+# Expected result is NULL, 0, NULL
+#
+EXPLAIN SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+MAX(a) OVER () COUNT(a) abs(a)
+NULL 0 NULL
+#
+# Expected result is 1, 0, NULL
+#
+EXPLAIN
+SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+MAX(1) OVER () COUNT(a) abs(a)
+1 0 NULL
+drop table t1;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test
index f6fdb479054..89a018ea374 100644
--- a/mysql-test/main/win.test
+++ b/mysql-test/main/win.test
@@ -2351,6 +2351,81 @@ SELECT (SELECT MIN('foo') OVER() FROM t1 LIMIT 1) as x;
drop table t1;
--echo #
+--echo # MDEV-16579: Wrong result of query using DISTINCT COUNT(*) OVER (*)
+--echo #
+
+CREATE TABLE t1 (i int) ;
+INSERT INTO t1 VALUES (1),(0),(1),(2),(0),(1),(2),(1),(2);
+
+SELECT DISTINCT COUNT(*) OVER (), MOD(MIN(i),2) FROM t1 GROUP BY i ;
+drop table t1;
+
+--echo #
+--echo # MDEV-21318: Wrong results with window functions and implicit grouping
+--echo #
+
+CREATE TABLE t1 (a INT);
+
+--echo #
+--echo # With empty const table
+--echo # The expected result here is 1, NULL
+--echo #
+
+explain
+SELECT row_number() over(), sum(1) FROM t1;
+SELECT row_number() over(), sum(1) FROM t1;
+
+insert into t1 values (2);
+
+--echo #
+--echo # Const table has 1 row, but still impossible where
+--echo # The expected result here is 1, NULL
+--echo #
+
+EXPLAIN SELECT row_number() over(), sum(1) FROM t1 where a=1;
+SELECT row_number() over(), sum(1) FROM t1 where a=1;
+
+--echo #
+--echo # Impossible HAVING
+--echo # Empty result is expected
+--echo #
+
+EXPLAIN SELECT row_number() over(), sum(1) FROM t1 where a=1 having 1=0;
+SELECT row_number() over(), sum(1) FROM t1 where a=1 having 1=0;
+
+--echo #
+--echo # const table has 1 row, no impossible where
+--echo # The expected result here is 1, 2
+--echo #
+
+EXPLAIN SELECT row_number() over(), sum(a) FROM t1 where a=2;
+SELECT row_number() over(), sum(a) FROM t1 where a=2;
+drop table t1;
+
+--echo #
+--echo # Impossible Where
+--echo #
+
+create table t1(a int);
+insert into t1 values (1);
+
+--echo #
+--echo # Expected result is NULL, 0, NULL
+--echo #
+EXPLAIN SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+SELECT MAX(a) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+
+--echo #
+--echo # Expected result is 1, 0, NULL
+--echo #
+
+EXPLAIN
+SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+SELECT MAX(1) OVER (), COUNT(a), abs(a) FROM t1 WHERE FALSE;
+
+drop table t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index f405d026e78..3c4c6f80940 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -4675,6 +4675,8 @@ sub extract_warning_lines ($$) {
qr/missing DBUG_RETURN/,
qr/Attempting backtrace/,
qr/Assertion .* failed/,
+ qr/Sanitizer/,
+ qr/runtime error:/,
);
# These are taken from the include/mtr_warnings.sql global suppression
# list. They occur delayed, so they can be parsed during shutdown rather
diff --git a/mysql-test/suite/funcs_1/r/is_check_constraint.result b/mysql-test/suite/funcs_1/r/is_check_constraint.result
deleted file mode 100644
index be44a8867e8..00000000000
--- a/mysql-test/suite/funcs_1/r/is_check_constraint.result
+++ /dev/null
@@ -1,121 +0,0 @@
-#
-# MDEV-17323: Backport INFORMATION_SCHEMA.CHECK_CONSTRAINTS to 10.2
-#
-CREATE user boo1;
-GRANT select,create,alter,drop on foo.* to boo1;
-SHOW GRANTS for boo1;
-Grants for boo1@%
-GRANT USAGE ON *.* TO 'boo1'@'%'
-GRANT SELECT, CREATE, DROP, ALTER ON `foo`.* TO 'boo1'@'%'
-CREATE user boo2;
-create database foo;
-CONNECT con1,localhost, boo1,, foo;
-SET check_constraint_checks=1;
-CREATE TABLE t0
-(
-t int, check (t>32) # table constraint
-) ENGINE=myisam;
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CONSTRAINT_1 t0 `t` > 32
-ALTER TABLE t0
-ADD CONSTRAINT CHK_t0_t CHECK(t<100);
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CHK_t0_t t0 `t` < 100
-def foo CONSTRAINT_1 t0 `t` > 32
-ALTER TABLE t0
-DROP CONSTRAINT CHK_t0_t;
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CONSTRAINT_1 t0 `t` > 32
-ALTER TABLE t0
-ADD CONSTRAINT CHECK(t<50);
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CONSTRAINT_1 t0 `t` > 32
-def foo CONSTRAINT_2 t0 `t` < 50
-CREATE TABLE t1
-( t int CHECK(t>2), # field constraint
-tt int,
-CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints
-CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint
-) ENGINE=InnoDB;
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CHK_tt t1 `tt` < 100
-def foo CONSTRAINT_1 t0 `t` > 32
-def foo CONSTRAINT_1 t1 `tt` > 32
-def foo CONSTRAINT_2 t0 `t` < 50
-def foo CONSTRAINT_2 t1 `tt` < 50
-def foo t t1 `t` > 2
-ALTER TABLE t1
-DROP CONSTRAINT CHK_tt;
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CONSTRAINT_1 t0 `t` > 32
-def foo CONSTRAINT_1 t1 `tt` > 32
-def foo CONSTRAINT_2 t0 `t` < 50
-def foo CONSTRAINT_2 t1 `tt` < 50
-def foo t t1 `t` > 2
-CREATE TABLE t2
-(
-name VARCHAR(30) CHECK(CHAR_LENGTH(name)>2), #field constraint
-start_date DATE,
-end_date DATE,
-CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint
-)ENGINE=Innodb;
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CHK_dates t2 `start_date` is null
-def foo CONSTRAINT_1 t0 `t` > 32
-def foo CONSTRAINT_1 t1 `tt` > 32
-def foo CONSTRAINT_2 t0 `t` < 50
-def foo CONSTRAINT_2 t1 `tt` < 50
-def foo name t2 char_length(`name`) > 2
-def foo t t1 `t` > 2
-ALTER TABLE t1
-ADD CONSTRAINT CHK_new_ CHECK(t>tt);
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CHK_dates t2 `start_date` is null
-def foo CHK_new_ t1 `t` > `tt`
-def foo CONSTRAINT_1 t0 `t` > 32
-def foo CONSTRAINT_1 t1 `tt` > 32
-def foo CONSTRAINT_2 t0 `t` < 50
-def foo CONSTRAINT_2 t1 `tt` < 50
-def foo name t2 char_length(`name`) > 2
-def foo t t1 `t` > 2
-CREATE TABLE t3
-(
-a int,
-b int check (b>0), # field constraint named 'b'
-CONSTRAINT b check (b>10) # table constraint
-) ENGINE=InnoDB;
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def foo CHK_dates t2 `start_date` is null
-def foo CHK_new_ t1 `t` > `tt`
-def foo CONSTRAINT_1 t0 `t` > 32
-def foo CONSTRAINT_1 t1 `tt` > 32
-def foo CONSTRAINT_2 t0 `t` < 50
-def foo CONSTRAINT_2 t1 `tt` < 50
-def foo b t3 `b` > 0
-def foo b t3 `b` > 10
-def foo name t2 char_length(`name`) > 2
-def foo t t1 `t` > 2
-disconnect con1;
-CONNECT con2, localhost, boo2,, test;
-SELECT * from information_schema.check_constraints;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-disconnect con2;
-CONNECT con1, localhost, boo1,,foo;
-DROP TABLE t0;
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-DROP DATABASE foo;
-disconnect con1;
-connection default;
-DROP USER boo1;
-DROP USER boo2;
diff --git a/mysql-test/suite/funcs_1/r/is_check_constraints.result b/mysql-test/suite/funcs_1/r/is_check_constraints.result
index eaf90f44544..307c14792a9 100644
--- a/mysql-test/suite/funcs_1/r/is_check_constraints.result
+++ b/mysql-test/suite/funcs_1/r/is_check_constraints.result
@@ -1,180 +1,148 @@
#
# MDEV-14474: Create INFORMATION_SCHEMA.CHECK_CONSTRAINTS
#
-set check_constraint_checks=1;
-use test;
-create table t0
+CREATE user boo1;
+GRANT select,create,alter,drop on foo.* to boo1;
+SHOW GRANTS for boo1;
+Grants for boo1@%
+GRANT USAGE ON *.* TO 'boo1'@'%'
+GRANT SELECT, CREATE, DROP, ALTER ON `foo`.* TO 'boo1'@'%'
+CREATE user boo2;
+create database foo;
+CONNECT con1,localhost, boo1,, foo;
+SET check_constraint_checks=1;
+CREATE TABLE t0
(
t int, check (t>32) # table constraint
) ENGINE=myisam;
-SELECT * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA mysql
-CONSTRAINT_NAME Priv
-TABLE_NAME global_priv
-CHECK_CLAUSE json_valid(`Priv`)
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CONSTRAINT_1
-TABLE_NAME t0
-CHECK_CLAUSE `t` > 32
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
ALTER TABLE t0
ADD CONSTRAINT CHK_t0_t CHECK(t<100);
-SELECT * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA mysql
-CONSTRAINT_NAME Priv
-TABLE_NAME global_priv
-CHECK_CLAUSE json_valid(`Priv`)
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CHK_t0_t
-TABLE_NAME t0
-CHECK_CLAUSE `t` < 100
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CONSTRAINT_1
-TABLE_NAME t0
-CHECK_CLAUSE `t` > 32
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CHK_t0_t `t` < 100
+def foo t0 CONSTRAINT_1 `t` > 32
ALTER TABLE t0
DROP CONSTRAINT CHK_t0_t;
-SELECT * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA mysql
-CONSTRAINT_NAME Priv
-TABLE_NAME global_priv
-CHECK_CLAUSE json_valid(`Priv`)
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CONSTRAINT_1
-TABLE_NAME t0
-CHECK_CLAUSE `t` > 32
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
+ALTER TABLE t0
+ADD CONSTRAINT CHECK(t<50);
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
+def foo t0 CONSTRAINT_2 `t` < 50
CREATE TABLE t1
( t int CHECK(t>2), # field constraint
-tt int, CONSTRAINT CHK_tt CHECK(tt<100) # table constraint
+tt int,
+CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints
+CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint
) ENGINE=InnoDB;
-SELECT * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA mysql
-CONSTRAINT_NAME Priv
-TABLE_NAME global_priv
-CHECK_CLAUSE json_valid(`Priv`)
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CHK_tt
-TABLE_NAME t1
-CHECK_CLAUSE `tt` < 100
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME t
-TABLE_NAME t1
-CHECK_CLAUSE `t` > 2
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CONSTRAINT_1
-TABLE_NAME t0
-CHECK_CLAUSE `t` > 32
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
+def foo t0 CONSTRAINT_2 `t` < 50
+def foo t1 CHK_tt `tt` < 100
+def foo t1 CONSTRAINT_1 `tt` > 32
+def foo t1 CONSTRAINT_2 `tt` < 50
+def foo t1 t `t` > 2
ALTER TABLE t1
DROP CONSTRAINT CHK_tt;
-SELECT * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA mysql
-CONSTRAINT_NAME Priv
-TABLE_NAME global_priv
-CHECK_CLAUSE json_valid(`Priv`)
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME t
-TABLE_NAME t1
-CHECK_CLAUSE `t` > 2
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CONSTRAINT_1
-TABLE_NAME t0
-CHECK_CLAUSE `t` > 32
-create table t2
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
+def foo t0 CONSTRAINT_2 `t` < 50
+def foo t1 CONSTRAINT_1 `tt` > 32
+def foo t1 CONSTRAINT_2 `tt` < 50
+def foo t1 t `t` > 2
+CREATE TABLE t2
(
name VARCHAR(30) CHECK(CHAR_LENGTH(name)>2), #field constraint
start_date DATE,
end_date DATE,
CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint
)ENGINE=Innodb;
-SELECT * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME name
-TABLE_NAME t2
-CHECK_CLAUSE char_length(`name`) > 2
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA mysql
-CONSTRAINT_NAME Priv
-TABLE_NAME global_priv
-CHECK_CLAUSE json_valid(`Priv`)
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CHK_dates
-TABLE_NAME t2
-CHECK_CLAUSE `start_date` is null
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME t
-TABLE_NAME t1
-CHECK_CLAUSE `t` > 2
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CONSTRAINT_1
-TABLE_NAME t0
-CHECK_CLAUSE `t` > 32
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
+def foo t0 CONSTRAINT_2 `t` < 50
+def foo t1 CONSTRAINT_1 `tt` > 32
+def foo t1 CONSTRAINT_2 `tt` < 50
+def foo t1 t `t` > 2
+def foo t2 CHK_dates `start_date` is null
+def foo t2 name char_length(`name`) > 2
ALTER TABLE t1
ADD CONSTRAINT CHK_new_ CHECK(t>tt);
-SELECT * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME name
-TABLE_NAME t2
-CHECK_CLAUSE char_length(`name`) > 2
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA mysql
-CONSTRAINT_NAME Priv
-TABLE_NAME global_priv
-CHECK_CLAUSE json_valid(`Priv`)
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CHK_dates
-TABLE_NAME t2
-CHECK_CLAUSE `start_date` is null
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME t
-TABLE_NAME t1
-CHECK_CLAUSE `t` > 2
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CONSTRAINT_1
-TABLE_NAME t0
-CHECK_CLAUSE `t` > 32
-CONSTRAINT_CATALOG def
-CONSTRAINT_SCHEMA test
-CONSTRAINT_NAME CHK_new_
-TABLE_NAME t1
-CHECK_CLAUSE `t` > `tt`
-create table t3
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
+def foo t0 CONSTRAINT_2 `t` < 50
+def foo t1 CHK_new_ `t` > `tt`
+def foo t1 CONSTRAINT_1 `tt` > 32
+def foo t1 CONSTRAINT_2 `tt` < 50
+def foo t1 t `t` > 2
+def foo t2 CHK_dates `start_date` is null
+def foo t2 name char_length(`name`) > 2
+CREATE TABLE t3
(
a int,
b int check (b>0), # field constraint named 'b'
CONSTRAINT b check (b>10) # table constraint
) ENGINE=InnoDB;
-select * from information_schema.check_constraints order by check_clause;
-CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE
-def test name t2 char_length(`name`) > 2
-def mysql Priv global_priv json_valid(`Priv`)
-def test b t3 `b` > 0
-def test b t3 `b` > 10
-def test CHK_dates t2 `start_date` is null
-def test t t1 `t` > 2
-def test CONSTRAINT_1 t0 `t` > 32
-def test CHK_new_ t1 `t` > `tt`
-drop table t0;
-drop table t1;
-drop table t2;
-drop table t3;
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def foo t0 CONSTRAINT_1 `t` > 32
+def foo t0 CONSTRAINT_2 `t` < 50
+def foo t1 CHK_new_ `t` > `tt`
+def foo t1 CONSTRAINT_1 `tt` > 32
+def foo t1 CONSTRAINT_2 `tt` < 50
+def foo t1 t `t` > 2
+def foo t2 CHK_dates `start_date` is null
+def foo t2 name char_length(`name`) > 2
+def foo t3 b `b` > 0
+def foo t3 b `b` > 10
+disconnect con1;
+CONNECT con2, localhost, boo2,, test;
+SELECT * from information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+disconnect con2;
+CONNECT con1, localhost, boo1,,foo;
+DROP TABLE t0;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP DATABASE foo;
+disconnect con1;
+connection default;
+DROP USER boo1;
+DROP USER boo2;
+#
+# MDEV-18440: Information_schema.check_constraints possible data leak
+#
+CREATE USER foo;
+CREATE DATABASE db;
+USE db;
+CREATE TABLE t1 (a int, b int, CONSTRAINT CHECK (b > 0));
+INSERT INTO t1 VALUES (1, 2), (2, 3);
+GRANT SELECT (a) ON t1 TO foo;
+SHOW GRANTS FOR foo;
+Grants for foo@%
+GRANT USAGE ON *.* TO 'foo'@'%'
+GRANT SELECT (a) ON `db`.`t1` TO 'foo'@'%'
+SELECT * FROM information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+def db t1 CONSTRAINT_1 `b` > 0
+def mysql global_priv Priv json_valid(`Priv`)
+CONNECT con1,localhost, foo,, db;
+SELECT a FROM t1;
+a
+1
+2
+SELECT * FROM information_schema.check_constraints;
+CONSTRAINT_CATALOG CONSTRAINT_SCHEMA TABLE_NAME CONSTRAINT_NAME CHECK_CLAUSE
+connection default;
+DROP USER foo;
+DROP DATABASE db;
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is.result b/mysql-test/suite/funcs_1/r/is_columns_is.result
index 27441bb4ebb..cd548f426e1 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is.result
@@ -26,9 +26,9 @@ def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NU
def information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) select NEVER NULL
def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select NEVER NULL
-def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
+def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
-def information_schema CHECK_CONSTRAINTS TABLE_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
+def information_schema CHECK_CONSTRAINTS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) select NEVER NULL
def information_schema CLIENT_STATISTICS ACCESS_DENIED 22 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL
def information_schema CLIENT_STATISTICS BINLOG_BYTES_WRITTEN 9 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select NEVER NULL
def information_schema CLIENT_STATISTICS BUSY_TIME 5 0 NO double NULL NULL 21 NULL NULL NULL NULL double select NEVER NULL
@@ -570,8 +570,8 @@ COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH C
NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint(3)
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CHECK_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CLIENT_STATISTICS CLIENT varchar 64 192 utf8 utf8_general_ci varchar(64)
NULL information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21)
diff --git a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
index 907bcb01cab..b86897af8a4 100644
--- a/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
@@ -26,9 +26,9 @@ def information_schema CHARACTER_SETS DESCRIPTION 3 '' NO varchar 60 180 NULL NU
def information_schema CHARACTER_SETS MAXLEN 4 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(3) NEVER NULL
def information_schema CHECK_CONSTRAINTS CHECK_CLAUSE 5 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
def information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG 1 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) NEVER NULL
-def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
+def information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
def information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA 2 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
-def information_schema CHECK_CONSTRAINTS TABLE_NAME 4 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
+def information_schema CHECK_CONSTRAINTS TABLE_NAME 3 '' NO varchar 64 192 NULL NULL NULL utf8 utf8_general_ci varchar(64) NEVER NULL
def information_schema CLIENT_STATISTICS ACCESS_DENIED 22 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL
def information_schema CLIENT_STATISTICS BINLOG_BYTES_WRITTEN 9 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL
def information_schema CLIENT_STATISTICS BUSY_TIME 5 0 NO double NULL NULL 21 NULL NULL NULL NULL double NEVER NULL
@@ -570,8 +570,8 @@ COL_CML TABLE_SCHEMA TABLE_NAME COLUMN_NAME DATA_TYPE CHARACTER_MAXIMUM_LENGTH C
NULL information_schema CHARACTER_SETS MAXLEN bigint NULL NULL NULL NULL bigint(3)
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_CATALOG varchar 512 1536 utf8 utf8_general_ci varchar(512)
3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_SCHEMA varchar 64 192 utf8 utf8_general_ci varchar(64)
-3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CHECK_CONSTRAINTS TABLE_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
+3.0000 information_schema CHECK_CONSTRAINTS CONSTRAINT_NAME varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CHECK_CONSTRAINTS CHECK_CLAUSE varchar 64 192 utf8 utf8_general_ci varchar(64)
3.0000 information_schema CLIENT_STATISTICS CLIENT varchar 64 192 utf8 utf8_general_ci varchar(64)
NULL information_schema CLIENT_STATISTICS TOTAL_CONNECTIONS bigint NULL NULL NULL NULL bigint(21)
diff --git a/mysql-test/suite/funcs_1/t/is_check_constraint.test b/mysql-test/suite/funcs_1/t/is_check_constraint.test
deleted file mode 100644
index 30a72d02b34..00000000000
--- a/mysql-test/suite/funcs_1/t/is_check_constraint.test
+++ /dev/null
@@ -1,92 +0,0 @@
---source include/have_innodb.inc
---source include/not_embedded.inc
---echo #
---echo # MDEV-17323: Backport INFORMATION_SCHEMA.CHECK_CONSTRAINTS to 10.2
---echo #
-CREATE user boo1;
-GRANT select,create,alter,drop on foo.* to boo1;
-SHOW GRANTS for boo1;
-CREATE user boo2;
-create database foo;
-# Connect with user boo1
-CONNECT(con1,localhost, boo1,, foo);
-
-SET check_constraint_checks=1;
-CREATE TABLE t0
-(
- t int, check (t>32) # table constraint
-) ENGINE=myisam;
---sorted_result
-SELECT * from information_schema.check_constraints;
-
-ALTER TABLE t0
-ADD CONSTRAINT CHK_t0_t CHECK(t<100);
---sorted_result
-SELECT * from information_schema.check_constraints;
-
-ALTER TABLE t0
-DROP CONSTRAINT CHK_t0_t;
---sorted_result
-SELECT * from information_schema.check_constraints;
-
-ALTER TABLE t0
-ADD CONSTRAINT CHECK(t<50);
---sorted_result
-SELECT * from information_schema.check_constraints;
-
-CREATE TABLE t1
-( t int CHECK(t>2), # field constraint
- tt int,
- CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints
- CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint
-) ENGINE=InnoDB;
- --sorted_result
-SELECT * from information_schema.check_constraints;
-
-ALTER TABLE t1
-DROP CONSTRAINT CHK_tt;
---sorted_result
-SELECT * from information_schema.check_constraints;
-
-CREATE TABLE t2
-(
-name VARCHAR(30) CHECK(CHAR_LENGTH(name)>2), #field constraint
-start_date DATE,
-end_date DATE,
-CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint
-)ENGINE=Innodb;
- --sorted_result
-SELECT * from information_schema.check_constraints;
-
-ALTER TABLE t1
-ADD CONSTRAINT CHK_new_ CHECK(t>tt);
---sorted_result
-SELECT * from information_schema.check_constraints;
-
-# Create table with same field and table check constraint name
-CREATE TABLE t3
-(
-a int,
-b int check (b>0), # field constraint named 'b'
-CONSTRAINT b check (b>10) # table constraint
-) ENGINE=InnoDB;
- --sorted_result
-SELECT * from information_schema.check_constraints;
-
-DISCONNECT con1;
-CONNECT(con2, localhost, boo2,, test);
- --sorted_result
-SELECT * from information_schema.check_constraints;
-
-DISCONNECT con2;
-CONNECT(con1, localhost, boo1,,foo);
-DROP TABLE t0;
-DROP TABLE t1;
-DROP TABLE t2;
-DROP TABLE t3;
-DROP DATABASE foo;
-
-DISCONNECT con1;
---CONNECTION default
-DROP USER boo1;
-DROP USER boo2;
diff --git a/mysql-test/suite/funcs_1/t/is_check_constraints.test b/mysql-test/suite/funcs_1/t/is_check_constraints.test
index b39abdc1b24..b539de67f73 100644
--- a/mysql-test/suite/funcs_1/t/is_check_constraints.test
+++ b/mysql-test/suite/funcs_1/t/is_check_constraints.test
@@ -1,69 +1,118 @@
--source include/have_innodb.inc
+--source include/not_embedded.inc
--echo #
--echo # MDEV-14474: Create INFORMATION_SCHEMA.CHECK_CONSTRAINTS
--echo #
-set check_constraint_checks=1;
+CREATE user boo1;
+GRANT select,create,alter,drop on foo.* to boo1;
+SHOW GRANTS for boo1;
+CREATE user boo2;
+create database foo;
+# Connect with user boo1
+CONNECT(con1,localhost, boo1,, foo);
-use test;
-create table t0
+SET check_constraint_checks=1;
+CREATE TABLE t0
(
t int, check (t>32) # table constraint
) ENGINE=myisam;
-
---vertical_results
-SELECT * from information_schema.check_constraints order by check_clause;
+--sorted_result
+SELECT * from information_schema.check_constraints;
ALTER TABLE t0
ADD CONSTRAINT CHK_t0_t CHECK(t<100);
-
-SELECT * from information_schema.check_constraints order by check_clause;
+--sorted_result
+SELECT * from information_schema.check_constraints;
ALTER TABLE t0
DROP CONSTRAINT CHK_t0_t;
+--sorted_result
+SELECT * from information_schema.check_constraints;
-SELECT * from information_schema.check_constraints order by check_clause;
+ALTER TABLE t0
+ADD CONSTRAINT CHECK(t<50);
+--sorted_result
+SELECT * from information_schema.check_constraints;
CREATE TABLE t1
( t int CHECK(t>2), # field constraint
- tt int, CONSTRAINT CHK_tt CHECK(tt<100) # table constraint
+ tt int,
+ CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints
+ CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint
) ENGINE=InnoDB;
-
-SELECT * from information_schema.check_constraints order by check_clause;
+--sorted_result
+SELECT * from information_schema.check_constraints;
ALTER TABLE t1
DROP CONSTRAINT CHK_tt;
+--sorted_result
+SELECT * from information_schema.check_constraints;
-SELECT * from information_schema.check_constraints order by check_clause;
-
-create table t2
+CREATE TABLE t2
(
name VARCHAR(30) CHECK(CHAR_LENGTH(name)>2), #field constraint
start_date DATE,
end_date DATE,
CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint
)ENGINE=Innodb;
-
-SELECT * from information_schema.check_constraints order by check_clause;
+--sorted_result
+SELECT * from information_schema.check_constraints;
ALTER TABLE t1
ADD CONSTRAINT CHK_new_ CHECK(t>tt);
-
-SELECT * from information_schema.check_constraints order by check_clause;
-
+--sorted_result
+SELECT * from information_schema.check_constraints;
# Create table with same field and table check constraint name
-create table t3
+CREATE TABLE t3
(
a int,
b int check (b>0), # field constraint named 'b'
CONSTRAINT b check (b>10) # table constraint
) ENGINE=InnoDB;
+--sorted_result
+SELECT * from information_schema.check_constraints;
+
+DISCONNECT con1;
+CONNECT(con2, localhost, boo2,, test);
+--sorted_result
+SELECT * from information_schema.check_constraints;
+
+DISCONNECT con2;
+CONNECT(con1, localhost, boo1,,foo);
+DROP TABLE t0;
+DROP TABLE t1;
+DROP TABLE t2;
+DROP TABLE t3;
+DROP DATABASE foo;
+
+DISCONNECT con1;
+--CONNECTION default
+DROP USER boo1;
+DROP USER boo2;
+
+--echo #
+--echo # MDEV-18440: Information_schema.check_constraints possible data leak
+--echo #
+
+CREATE USER foo;
+CREATE DATABASE db;
+USE db;
+CREATE TABLE t1 (a int, b int, CONSTRAINT CHECK (b > 0));
+INSERT INTO t1 VALUES (1, 2), (2, 3);
+GRANT SELECT (a) ON t1 TO foo;
+
+SHOW GRANTS FOR foo;
+--sorted_result
+SELECT * FROM information_schema.check_constraints;
+
+CONNECT(con1,localhost, foo,, db);
+SELECT a FROM t1;
+--sorted_result
+SELECT * FROM information_schema.check_constraints;
---horizontal_results
-select * from information_schema.check_constraints order by check_clause;
+--CONNECTION default
-drop table t0;
-drop table t1;
-drop table t2;
-drop table t3;
+DROP USER foo;
+DROP DATABASE db;
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index 40243ad556f..061697a7fd8 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -43,6 +43,5 @@ galera_var_reject_queries : assertion in inline_mysql_socket_send
galera_var_retry_autocommit: MDEV-18181 Galera test failure on galera.galera_var_retry_autocommit
galera_wan : MDEV-17259 Test failure on galera.galera_wan
mysql-wsrep#198 : MDEV-18935 Galera test mysql-wsrep#198 sporaric assertion transaction.cpp:362: int wsrep::transaction::before_commit(): Assertion `state() == s_executing || state() == s_committing || state() == s_must_abort || state() == s_replaying' failed.
-galera_partition : MDEV-21189 test timeout
partition : MDEV-19958 Galera test failure on galera.partition
query_cache: MDEV-15805 Test failure on galera.query_cache
diff --git a/mysql-test/suite/galera/r/galera_gcs_fc_limit.result b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result
index e96e512b61b..432cf87f66f 100644
--- a/mysql-test/suite/galera/r/galera_gcs_fc_limit.result
+++ b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result
@@ -3,7 +3,6 @@ connection node_1;
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,B INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,1);
connection node_2;
-SET SESSION wsrep_sync_wait=15;
SELECT COUNT(*) FROM t1;
COUNT(*)
1
diff --git a/mysql-test/suite/galera/r/galera_partition.result b/mysql-test/suite/galera/r/galera_partition.result
index d845de12c45..f09a0272eda 100644
--- a/mysql-test/suite/galera/r/galera_partition.result
+++ b/mysql-test/suite/galera/r/galera_partition.result
@@ -1,9 +1,10 @@
+connection node_2;
+connection node_1;
connection node_1;
call mtr.add_suppression("WSREP: RSU failed due to pending transactions, schema: test, query ALTER.*");
call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
-connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1;
CREATE TABLE t1(
id bigint unsigned NOT NULL AUTO_INCREMENT,
@@ -396,13 +397,14 @@ SELECT COUNT(*) FROM t1;
COUNT(*)
350
connection node_2;
-call p1(100);;
-connection node_1a;
-call p1(100);;
+call mtr.add_suppression("WSREP: Sending JOIN failed:");
+call p1(10);
connection node_3;
-call p1(100);;
+call mtr.add_suppression("WSREP: Sending JOIN failed:");
+call p1(10);
connection node_4;
-call p1(100);;
+call mtr.add_suppression("WSREP: Sending JOIN failed:");
+call p1(10);
connection node_1;
SET SESSION wsrep_OSU_method='RSU';
SELECT @@wsrep_OSU_method;
@@ -419,6 +421,6 @@ TOI
connection node_2;
connection node_3;
connection node_4;
-connection node_1a;
+connection node_1;
DROP TABLE t1;
DROP PROCEDURE p1;
diff --git a/mysql-test/suite/galera/t/galera_gcs_fc_limit.test b/mysql-test/suite/galera/t/galera_gcs_fc_limit.test
index e0626bd8946..d73286dcba2 100644
--- a/mysql-test/suite/galera/t/galera_gcs_fc_limit.test
+++ b/mysql-test/suite/galera/t/galera_gcs_fc_limit.test
@@ -3,13 +3,16 @@
#
--source include/galera_cluster.inc
---source include/have_innodb.inc
+--source include/big_test.inc
+--source include/force_restart.inc
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,B INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1,1);
--connection node_2
-SET SESSION wsrep_sync_wait=15;
+--let $wait_condition = SELECT COUNT(*)=1 FROM t1;
+--source include/wait_condition.inc
+
SELECT COUNT(*) FROM t1;
--let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options`
@@ -53,5 +56,6 @@ SELECT COUNT(*) FROM t1;
--disable_query_log
--eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig';
--enable_query_log
+--source include/wait_until_connected_again.inc
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_partition.test b/mysql-test/suite/galera/t/galera_partition.test
index a2044936cd1..bf3f02eaa92 100644
--- a/mysql-test/suite/galera/t/galera_partition.test
+++ b/mysql-test/suite/galera/t/galera_partition.test
@@ -1,5 +1,6 @@
--source include/galera_cluster.inc
--source include/have_partition.inc
+--source include/big_test.inc
--connection node_1
@@ -8,7 +9,6 @@ call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
---connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1
@@ -407,16 +407,16 @@ insert into t1 (id, dt) values (350, '2010-12-17 00:00:00');
SELECT COUNT(*) FROM t1;
--connection node_2
---send call p1(100);
-
---connection node_1a
---send call p1(100);
+call mtr.add_suppression("WSREP: Sending JOIN failed:");
+send call p1(10);
--connection node_3
---send call p1(100);
+call mtr.add_suppression("WSREP: Sending JOIN failed:");
+send call p1(10);
--connection node_4
---send call p1(100);
+call mtr.add_suppression("WSREP: Sending JOIN failed:");
+send call p1(10);
--connection node_1
SET SESSION wsrep_OSU_method='RSU';
@@ -445,9 +445,7 @@ reap;
--error 0,ER_LOCK_DEADLOCK
reap;
---connection node_1a
---error 0,ER_LOCK_DEADLOCK
-reap;
+--connection node_1
DROP TABLE t1;
DROP PROCEDURE p1;
diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def
index 466a6d1a081..bd8d4ecf33b 100644
--- a/mysql-test/suite/wsrep/disabled.def
+++ b/mysql-test/suite/wsrep/disabled.def
@@ -10,7 +10,4 @@
#
##############################################################################
-foreign_key : MENT-535 Galera test failures on wsrep suite
-wsrep.pool_of_threads : Sporadic failure "WSREP has not yet prepared node for application use"
variables : MDEV-20581 Crash on wsrep.variables test case
-pool_of_threads : MENT-535 Galera test failures on wsrep suite
diff --git a/mysql-test/suite/wsrep/my.cnf b/mysql-test/suite/wsrep/my.cnf
index e90686850a9..e35f73f46c1 100644
--- a/mysql-test/suite/wsrep/my.cnf
+++ b/mysql-test/suite/wsrep/my.cnf
@@ -2,7 +2,7 @@
!include include/default_mysqld.cnf
[mysqld.1]
-wsrep-on=OFF
+wsrep-on=ON
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
diff --git a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result
index 28fc332bb0a..ffd6c3cab1f 100644
--- a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result
+++ b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result
@@ -4,7 +4,7 @@
# Verbose run
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
@@ -36,7 +36,7 @@ ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=Aria;
ALTER TABLE time_zone_name ENGINE=Aria;
ALTER TABLE time_zone_transition ENGINE=Aria;
@@ -46,7 +46,7 @@ END IF|
# Silent run
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
@@ -75,7 +75,7 @@ ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=Aria;
ALTER TABLE time_zone_name ENGINE=Aria;
ALTER TABLE time_zone_transition ENGINE=Aria;
@@ -93,7 +93,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=Aria;
ALTER TABLE time_zone_name ENGINE=Aria;
ALTER TABLE time_zone_transition ENGINE=Aria;
@@ -105,21 +105,21 @@ END IF|
#
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone_leap_second ENGINE=InnoDB;
END IF|
\d ;
TRUNCATE TABLE time_zone_leap_second;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone_leap_second ENGINE=Aria;
END IF|
\d ;
ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
\d |
IF (select count(*) from information_schema.global_variables where
-variable_name='wsrep_on') = 1 THEN
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=Aria;
ALTER TABLE time_zone_name ENGINE=Aria;
ALTER TABLE time_zone_transition ENGINE=Aria;
diff --git a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result
index 4ce57c641b3..85c4d858be2 100644
--- a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result
+++ b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result
@@ -2,7 +2,7 @@
# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
#
# Verbose run
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
+set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
prepare set_wsrep_write_binlog from @prep1;
set @toggle=0; execute set_wsrep_write_binlog using @toggle;
TRUNCATE TABLE time_zone;
@@ -29,7 +29,7 @@ Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid in
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
# Silent run
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
+set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
prepare set_wsrep_write_binlog from @prep1;
set @toggle=0; execute set_wsrep_write_binlog using @toggle;
TRUNCATE TABLE time_zone;
@@ -55,7 +55,7 @@ ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
#
# Testing with explicit timezonefile
#
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
+set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
prepare set_wsrep_write_binlog from @prep1;
set @toggle=0; execute set_wsrep_write_binlog using @toggle;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
@@ -67,7 +67,7 @@ INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset,
#
# Testing --leap
#
-set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
+set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
prepare set_wsrep_write_binlog from @prep1;
set @toggle=0; execute set_wsrep_write_binlog using @toggle;
TRUNCATE TABLE time_zone_leap_second;
diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result
index ebd6c41d9bc..4cd8595177f 100644
--- a/mysql-test/suite/wsrep/r/variables.result
+++ b/mysql-test/suite/wsrep/r/variables.result
@@ -21,119 +21,123 @@ SET GLOBAL wsrep_provider=none;
CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*");
SHOW GLOBAL STATUS LIKE 'wsrep%';
Variable_name Value
-wsrep_applier_thread_count #
+wsrep_local_state_uuid #
+wsrep_protocol_version #
+wsrep_last_committed #
+wsrep_replicated #
+wsrep_replicated_bytes #
+wsrep_repl_keys #
+wsrep_repl_keys_bytes #
+wsrep_repl_data_bytes #
+wsrep_repl_other_bytes #
+wsrep_received #
+wsrep_received_bytes #
+wsrep_local_commits #
+wsrep_local_cert_failures #
+wsrep_local_replays #
+wsrep_local_send_queue #
+wsrep_local_send_queue_max #
+wsrep_local_send_queue_min #
+wsrep_local_send_queue_avg #
+wsrep_local_recv_queue #
+wsrep_local_recv_queue_max #
+wsrep_local_recv_queue_min #
+wsrep_local_recv_queue_avg #
+wsrep_local_cached_downto #
+wsrep_flow_control_paused_ns #
+wsrep_flow_control_paused #
+wsrep_flow_control_sent #
+wsrep_flow_control_recv #
+wsrep_cert_deps_distance #
wsrep_apply_oooe #
wsrep_apply_oool #
wsrep_apply_window #
-wsrep_causal_reads #
-wsrep_cert_deps_distance #
+wsrep_commit_oooe #
+wsrep_commit_oool #
+wsrep_commit_window #
+wsrep_local_state #
+wsrep_local_state_comment #
wsrep_cert_index_size #
+wsrep_causal_reads #
wsrep_cert_interval #
+wsrep_open_transactions #
+wsrep_open_connections #
+wsrep_incoming_addresses #
+wsrep_applier_thread_count #
+wsrep_cluster_capabilities #
wsrep_cluster_conf_id #
wsrep_cluster_size #
wsrep_cluster_state_uuid #
wsrep_cluster_status #
-wsrep_commit_oooe #
-wsrep_commit_oool #
-wsrep_commit_window #
wsrep_connected #
-wsrep_flow_control_paused #
-wsrep_flow_control_paused_ns #
-wsrep_flow_control_recv #
-wsrep_flow_control_sent #
-wsrep_incoming_addresses #
-wsrep_last_committed #
wsrep_local_bf_aborts #
-wsrep_local_cached_downto #
-wsrep_local_cert_failures #
-wsrep_local_commits #
wsrep_local_index #
-wsrep_local_recv_queue #
-wsrep_local_recv_queue_avg #
-wsrep_local_recv_queue_max #
-wsrep_local_recv_queue_min #
-wsrep_local_replays #
-wsrep_local_send_queue #
-wsrep_local_send_queue_avg #
-wsrep_local_send_queue_max #
-wsrep_local_send_queue_min #
-wsrep_local_state #
-wsrep_local_state_comment #
-wsrep_local_state_uuid #
-wsrep_open_connections #
-wsrep_open_transactions #
-wsrep_protocol_version #
+wsrep_provider_capabilities #
wsrep_provider_name #
wsrep_provider_vendor #
wsrep_provider_version #
wsrep_ready #
-wsrep_received #
-wsrep_received_bytes #
-wsrep_repl_data_bytes #
-wsrep_repl_keys #
-wsrep_repl_keys_bytes #
-wsrep_repl_other_bytes #
-wsrep_replicated #
-wsrep_replicated_bytes #
wsrep_rollbacker_thread_count #
wsrep_thread_count #
SHOW GLOBAL STATUS LIKE 'wsrep_%';
Variable_name Value
-wsrep_applier_thread_count #
+wsrep_local_state_uuid #
+wsrep_protocol_version #
+wsrep_last_committed #
+wsrep_replicated #
+wsrep_replicated_bytes #
+wsrep_repl_keys #
+wsrep_repl_keys_bytes #
+wsrep_repl_data_bytes #
+wsrep_repl_other_bytes #
+wsrep_received #
+wsrep_received_bytes #
+wsrep_local_commits #
+wsrep_local_cert_failures #
+wsrep_local_replays #
+wsrep_local_send_queue #
+wsrep_local_send_queue_max #
+wsrep_local_send_queue_min #
+wsrep_local_send_queue_avg #
+wsrep_local_recv_queue #
+wsrep_local_recv_queue_max #
+wsrep_local_recv_queue_min #
+wsrep_local_recv_queue_avg #
+wsrep_local_cached_downto #
+wsrep_flow_control_paused_ns #
+wsrep_flow_control_paused #
+wsrep_flow_control_sent #
+wsrep_flow_control_recv #
+wsrep_cert_deps_distance #
wsrep_apply_oooe #
wsrep_apply_oool #
wsrep_apply_window #
-wsrep_causal_reads #
-wsrep_cert_deps_distance #
+wsrep_commit_oooe #
+wsrep_commit_oool #
+wsrep_commit_window #
+wsrep_local_state #
+wsrep_local_state_comment #
wsrep_cert_index_size #
+wsrep_causal_reads #
wsrep_cert_interval #
+wsrep_open_transactions #
+wsrep_open_connections #
+wsrep_incoming_addresses #
+wsrep_applier_thread_count #
+wsrep_cluster_capabilities #
wsrep_cluster_conf_id #
wsrep_cluster_size #
wsrep_cluster_state_uuid #
wsrep_cluster_status #
-wsrep_commit_oooe #
-wsrep_commit_oool #
-wsrep_commit_window #
wsrep_connected #
-wsrep_flow_control_paused #
-wsrep_flow_control_paused_ns #
-wsrep_flow_control_recv #
-wsrep_flow_control_sent #
-wsrep_incoming_addresses #
-wsrep_last_committed #
wsrep_local_bf_aborts #
-wsrep_local_cached_downto #
-wsrep_local_cert_failures #
-wsrep_local_commits #
wsrep_local_index #
-wsrep_local_recv_queue #
-wsrep_local_recv_queue_avg #
-wsrep_local_recv_queue_max #
-wsrep_local_recv_queue_min #
-wsrep_local_replays #
-wsrep_local_send_queue #
-wsrep_local_send_queue_avg #
-wsrep_local_send_queue_max #
-wsrep_local_send_queue_min #
-wsrep_local_state #
-wsrep_local_state_comment #
-wsrep_local_state_uuid #
-wsrep_open_connections #
-wsrep_open_transactions #
-wsrep_protocol_version #
+wsrep_provider_capabilities #
wsrep_provider_name #
wsrep_provider_vendor #
wsrep_provider_version #
wsrep_ready #
-wsrep_received #
-wsrep_received_bytes #
-wsrep_repl_data_bytes #
-wsrep_repl_keys #
-wsrep_repl_keys_bytes #
-wsrep_repl_other_bytes #
-wsrep_replicated #
-wsrep_replicated_bytes #
wsrep_rollbacker_thread_count #
wsrep_thread_count #
SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment';
@@ -159,7 +163,7 @@ SET GLOBAL wsrep_provider=none;
call mtr.add_suppression("WSREP: Failed to get provider options");
SELECT @@global.wsrep_provider;
@@global.wsrep_provider
-libgalera_smm.so
+/usr/lib/libgalera_4_smm.so
SELECT @@global.wsrep_slave_threads;
@@global.wsrep_slave_threads
1
@@ -175,7 +179,7 @@ wsrep_thread_count 0
SELECT @@global.wsrep_provider;
@@global.wsrep_provider
-libgalera_smm.so
+/usr/lib/libgalera_4_smm.so
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
@@ -202,7 +206,7 @@ EXPECT_2
2
SELECT @@global.wsrep_provider;
@@global.wsrep_provider
-libgalera_smm.so
+/usr/lib/libgalera_4_smm.so
SELECT @@global.wsrep_cluster_address;
@@global.wsrep_cluster_address
gcomm://
@@ -256,7 +260,6 @@ SELECT @@global.wsrep_sst_auth;
NULL
SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved;
-SET GLOBAL wsrep_provider= none;
SET GLOBAL wsrep_cluster_address= @wsrep_cluster_address_saved;
SET GLOBAL wsrep_provider_options= @wsrep_provider_options_saved;
# End of test.
diff --git a/mysql-test/suite/wsrep/t/alter_table_innodb.cnf b/mysql-test/suite/wsrep/t/alter_table_innodb.cnf
new file mode 100644
index 00000000000..d8e27463cc1
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/alter_table_innodb.cnf
@@ -0,0 +1,12 @@
+!include include/default_mysqld.cnf
+
+[mysqld]
+wsrep-on=0
+
+[mysqld.1]
+wsrep-on=0
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
+wsrep_cluster_address='not empty but invalid'
diff --git a/mysql-test/suite/wsrep/t/alter_table_innodb.opt b/mysql-test/suite/wsrep/t/alter_table_innodb.opt
deleted file mode 100644
index 1e84570d7f6..00000000000
--- a/mysql-test/suite/wsrep/t/alter_table_innodb.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep-on=0
diff --git a/mysql-test/suite/wsrep/t/mdev_10186.cnf b/mysql-test/suite/wsrep/t/mdev_10186.cnf
index 3c4ca003f76..284c887648e 100644
--- a/mysql-test/suite/wsrep/t/mdev_10186.cnf
+++ b/mysql-test/suite/wsrep/t/mdev_10186.cnf
@@ -1,6 +1,15 @@
-!include ../my.cnf
+!include include/default_mysqld.cnf
+
+[mysqld]
+wsrep-on=0
[mysqld.1]
-wsrep-on=OFF
-wsrep-provider=@ENV.WSREP_PROVIDER
+wsrep-on=0
+#galera_port=@OPT.port
+#ist_port=@OPT.port
+#sst_port=@OPT.port
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
+wsrep_cluster_address='not empty but invalid'
+innodb_autoinc_lock_mode=2
+wsrep-provider=$WSREP_PROVIDER
wsrep-cluster-address=gcomm://
diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt
new file mode 100644
index 00000000000..a8b72174076
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt
@@ -0,0 +1 @@
+--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_on=1 --binlog_format=ROW
diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test
index 100e09d3afb..87554635666 100644
--- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test
+++ b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test
@@ -1,6 +1,7 @@
--source include/have_wsrep.inc
--source include/have_symlink.inc
--source include/not_windows.inc
+--source include/have_innodb.inc
--echo #
--echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt
new file mode 100644
index 00000000000..a8b72174076
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt
@@ -0,0 +1 @@
+--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_on=1 --binlog_format=ROW
diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test
index bb3009bd432..ab1f94cc1cf 100644
--- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test
+++ b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test
@@ -1,6 +1,7 @@
--source include/have_wsrep.inc
--source include/have_symlink.inc
--source include/not_windows.inc
+--source include/have_innodb.inc
--echo #
--echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
diff --git a/mysql-test/suite/wsrep/t/plugin.opt b/mysql-test/suite/wsrep/t/plugin.opt
new file mode 100644
index 00000000000..f043a4a21cf
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/plugin.opt
@@ -0,0 +1 @@
+--binlog_format=ROW --log-bin --wsrep-on=1 --innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm://
diff --git a/mysql-test/suite/wsrep/t/plugin.test b/mysql-test/suite/wsrep/t/plugin.test
index 60738440a55..73d605b0918 100644
--- a/mysql-test/suite/wsrep/t/plugin.test
+++ b/mysql-test/suite/wsrep/t/plugin.test
@@ -1,4 +1,5 @@
--source include/have_wsrep.inc
+--source include/have_innodb.inc
#
# MDEV-7604: wsrep plugin lists its status as Unknown
diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.cnf b/mysql-test/suite/wsrep/t/pool_of_threads.cnf
deleted file mode 100644
index b63e3324796..00000000000
--- a/mysql-test/suite/wsrep/t/pool_of_threads.cnf
+++ /dev/null
@@ -1,8 +0,0 @@
-!include ../my.cnf
-
-[mysqld.1]
-wsrep-on=ON
-wsrep-provider=@ENV.WSREP_PROVIDER
-wsrep-cluster-address=gcomm://
-thread_handling=pool-of-threads
-
diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.opt b/mysql-test/suite/wsrep/t/pool_of_threads.opt
index 6948011b21b..e75bba669e8 100644
--- a/mysql-test/suite/wsrep/t/pool_of_threads.opt
+++ b/mysql-test/suite/wsrep/t/pool_of_threads.opt
@@ -1 +1 @@
---innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --thread_handling=pool-of-threads wsrep-on=1
+--innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --thread_handling=pool-of-threads --wsrep-on=1
diff --git a/mysql-test/suite/wsrep/t/trans.opt b/mysql-test/suite/wsrep/t/trans.opt
new file mode 100644
index 00000000000..a8b72174076
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/trans.opt
@@ -0,0 +1 @@
+--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_on=1 --binlog_format=ROW
diff --git a/mysql-test/suite/wsrep/t/variables.opt b/mysql-test/suite/wsrep/t/variables.opt
new file mode 100644
index 00000000000..a8b72174076
--- /dev/null
+++ b/mysql-test/suite/wsrep/t/variables.opt
@@ -0,0 +1 @@
+--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep_on=1 --binlog_format=ROW
diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test
index 6caa5cff500..9209079871c 100644
--- a/mysql-test/suite/wsrep/t/variables.test
+++ b/mysql-test/suite/wsrep/t/variables.test
@@ -1,5 +1,6 @@
--source include/have_wsrep.inc
--source include/force_restart.inc
+--source include/have_innodb.inc
SET @wsrep_provider_options_saved= @@global.wsrep_provider_options;
SET @wsrep_cluster_address_saved= @@global.wsrep_cluster_address;
@@ -30,8 +31,6 @@ CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*")
--disable_query_log
eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
---let $galera_version=25.3.24
-source include/check_galera_version.inc;
--enable_query_log
--replace_column 2 #
@@ -158,9 +157,11 @@ SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
# Reset (for mtr internal checks)
SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved;
-SET GLOBAL wsrep_provider= none;
SET GLOBAL wsrep_cluster_address= @wsrep_cluster_address_saved;
SET GLOBAL wsrep_provider_options= @wsrep_provider_options_saved;
+--disable_query_log
+eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
+--enable_query_log
--echo # End of test.
diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt
index e3e2fba8c78..8465b5a6206 100644
--- a/sql/CMakeLists.txt
+++ b/sql/CMakeLists.txt
@@ -449,15 +449,18 @@ IF(WIN32 AND TARGET mysqld AND NOT CMAKE_CROSSCOMPILING)
ENDIF()
MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/data)
ADD_CUSTOM_COMMAND(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
- COMMAND ${CMAKE_COMMAND} ${CONFIG_PARAM}
- -DTOP_SRCDIR="${CMAKE_SOURCE_DIR}"
- -DBINDIR="${CMAKE_CURRENT_BINARY_DIR}"
- -DMYSQLD_EXECUTABLE="$<TARGET_FILE:mysqld>"
- -DCMAKE_CFG_INTDIR="${CMAKE_CFG_INTDIR}"
- -P ${CMAKE_SOURCE_DIR}/cmake/create_initial_db.cmake
+ OUTPUT initdb.dep
+ COMMAND ${CMAKE_COMMAND} -E remove_directory data
+ COMMAND ${CMAKE_COMMAND} -E make_directory data
+ COMMAND ${CMAKE_COMMAND} -E chdir data ${CMAKE_COMMAND}
+ ${CONFIG_PARAM}
+ -DTOP_SRCDIR="${CMAKE_SOURCE_DIR}"
+ -DBINDIR="${CMAKE_CURRENT_BINARY_DIR}"
+ -DMYSQLD_EXECUTABLE="$<TARGET_FILE:mysqld>"
+ -DCMAKE_CFG_INTDIR="${CMAKE_CFG_INTDIR}"
+ -P ${CMAKE_SOURCE_DIR}/cmake/create_initial_db.cmake
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/data
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/
DEPENDS mysqld
)
ADD_CUSTOM_TARGET(initial_database
diff --git a/sql/item.cc b/sql/item.cc
index 1ed178f1194..92b127cf773 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -3229,12 +3229,13 @@ bool Item_field::get_date(THD *thd, MYSQL_TIME *ltime,date_mode_t fuzzydate)
bool Item_field::get_date_result(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
- if (result_field->is_null() || result_field->get_date(ltime,fuzzydate))
+ if ((null_value= result_field->is_null()) ||
+ result_field->get_date(ltime, fuzzydate))
{
bzero((char*) ltime,sizeof(*ltime));
- return (null_value= 1);
+ return true;
}
- return (null_value= 0);
+ return false;
}
@@ -8238,7 +8239,7 @@ bool Item_ref::val_native(THD *thd, Native *to)
longlong Item_ref::val_datetime_packed(THD *thd)
{
DBUG_ASSERT(fixed);
- longlong tmp= (*ref)->val_datetime_packed(thd);
+ longlong tmp= (*ref)->val_datetime_packed_result(thd);
null_value= (*ref)->null_value;
return tmp;
}
@@ -8247,7 +8248,7 @@ longlong Item_ref::val_datetime_packed(THD *thd)
longlong Item_ref::val_time_packed(THD *thd)
{
DBUG_ASSERT(fixed);
- longlong tmp= (*ref)->val_time_packed(thd);
+ longlong tmp= (*ref)->val_time_packed_result(thd);
null_value= (*ref)->null_value;
return tmp;
}
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index a36bf4c140b..052ac173747 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1094,19 +1094,6 @@ void Aggregator_distinct::endup()
String *
-Item_sum_num::val_str(String *str)
-{
- return val_string_from_real(str);
-}
-
-
-my_decimal *Item_sum_num::val_decimal(my_decimal *decimal_value)
-{
- return val_decimal_from_real(decimal_value);
-}
-
-
-String *
Item_sum_int::val_str(String *str)
{
return val_string_from_int(str);
@@ -2185,7 +2172,7 @@ double Stddev::result(bool is_sample_variance)
Item_sum_variance::Item_sum_variance(THD *thd, Item_sum_variance *item):
- Item_sum_num(thd, item),
+ Item_sum_double(thd, item),
m_stddev(item->m_stddev), sample(item->sample),
prec_increment(item->prec_increment)
{ }
@@ -2309,13 +2296,6 @@ double Item_sum_variance::val_real()
}
-my_decimal *Item_sum_variance::val_decimal(my_decimal *dec_buf)
-{
- DBUG_ASSERT(fixed == 1);
- return val_decimal_from_real(dec_buf);
-}
-
-
void Item_sum_variance::reset_field()
{
double nr;
diff --git a/sql/item_sum.h b/sql/item_sum.h
index c18454f1506..7fccc4e24aa 100644
--- a/sql/item_sum.h
+++ b/sql/item_sum.h
@@ -588,6 +588,7 @@ public:
virtual void setup_caches(THD *thd) {};
bool with_sum_func() const { return true; }
+ virtual void set_partition_row_count(ulonglong count) { DBUG_ASSERT(0); }
};
@@ -734,13 +735,33 @@ public:
Item_sum_num(THD *thd, Item_sum_num *item):
Item_sum(thd, item) {}
bool fix_fields(THD *, Item **);
- longlong val_int() { return val_int_from_real(); /* Real as default */ }
- String *val_str(String*str);
- my_decimal *val_decimal(my_decimal *);
+};
+
+
+class Item_sum_double :public Item_sum_num
+{
+public:
+ Item_sum_double(THD *thd): Item_sum_num(thd) {}
+ Item_sum_double(THD *thd, Item *item_par): Item_sum_num(thd, item_par) {}
+ Item_sum_double(THD *thd, List<Item> &list): Item_sum_num(thd, list) {}
+ Item_sum_double(THD *thd, Item_sum_double *item) :Item_sum_num(thd, item) {}
+ longlong val_int()
+ {
+ return val_int_from_real();
+ }
+ String *val_str(String*str)
+ {
+ return val_string_from_real(str);
+ }
+ my_decimal *val_decimal(my_decimal *to)
+ {
+ return val_decimal_from_real(to);
+ }
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
{
- return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
+ return get_date_from_real(thd, ltime, fuzzydate);
}
+ const Type_handler *type_handler() const { return &type_handler_double; }
};
@@ -754,6 +775,10 @@ public:
double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
String *val_str(String*str);
my_decimal *val_decimal(my_decimal *);
+ bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
+ {
+ return get_date_from_int(thd, ltime, fuzzydate);
+ }
bool fix_length_and_dec()
{ decimals=0; max_length=21; maybe_null=null_value=0; return FALSE; }
};
@@ -794,6 +819,10 @@ public:
longlong val_int();
String *val_str(String*str);
my_decimal *val_decimal(my_decimal *);
+ bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
+ {
+ return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
+ }
const Type_handler *type_handler() const
{ return Type_handler_hybrid_field_type::type_handler(); }
void fix_length_and_dec_double();
@@ -986,7 +1015,7 @@ public:
-class Item_sum_variance : public Item_sum_num
+class Item_sum_variance : public Item_sum_double
{
Stddev m_stddev;
bool fix_length_and_dec();
@@ -996,7 +1025,7 @@ public:
uint prec_increment;
Item_sum_variance(THD *thd, Item *item_par, uint sample_arg):
- Item_sum_num(thd, item_par),
+ Item_sum_double(thd, item_par),
sample(sample_arg)
{}
Item_sum_variance(THD *thd, Item_sum_variance *item);
@@ -1006,7 +1035,6 @@ public:
void clear();
bool add();
double val_real();
- my_decimal *val_decimal(my_decimal *);
void reset_field();
void update_field();
Item *result_item(THD *thd, Field *field);
@@ -1015,11 +1043,10 @@ public:
{ return sample ? "var_samp(" : "variance("; }
Item *copy_or_same(THD* thd);
Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table);
- const Type_handler *type_handler() const { return &type_handler_double; }
void cleanup()
{
m_stddev= Stddev();
- Item_sum_num::cleanup();
+ Item_sum_double::cleanup();
}
Item *get_copy(THD *thd)
{ return get_item_copy<Item_sum_variance>(thd, this); }
@@ -1732,15 +1759,15 @@ public:
#else /* Dummy functions to get sql_yacc.cc compiled */
-class Item_sum_udf_float :public Item_sum_num
+class Item_sum_udf_float :public Item_sum_double
{
public:
Item_sum_udf_float(THD *thd, udf_func *udf_arg):
- Item_sum_num(thd) {}
+ Item_sum_double(thd) {}
Item_sum_udf_float(THD *thd, udf_func *udf_arg, List<Item> &list):
- Item_sum_num(thd) {}
+ Item_sum_double(thd) {}
Item_sum_udf_float(THD *thd, Item_sum_udf_float *item)
- :Item_sum_num(thd, item) {}
+ :Item_sum_double(thd, item) {}
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; }
void clear() {}
@@ -1750,15 +1777,15 @@ class Item_sum_udf_float :public Item_sum_num
};
-class Item_sum_udf_int :public Item_sum_num
+class Item_sum_udf_int :public Item_sum_double
{
public:
Item_sum_udf_int(THD *thd, udf_func *udf_arg):
- Item_sum_num(thd) {}
+ Item_sum_double(thd) {}
Item_sum_udf_int(THD *thd, udf_func *udf_arg, List<Item> &list):
- Item_sum_num(thd) {}
+ Item_sum_double(thd) {}
Item_sum_udf_int(THD *thd, Item_sum_udf_int *item)
- :Item_sum_num(thd, item) {}
+ :Item_sum_double(thd, item) {}
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
longlong val_int() { DBUG_ASSERT(fixed == 1); return 0; }
double val_real() { DBUG_ASSERT(fixed == 1); return 0; }
@@ -1769,15 +1796,15 @@ public:
};
-class Item_sum_udf_decimal :public Item_sum_num
+class Item_sum_udf_decimal :public Item_sum_double
{
public:
Item_sum_udf_decimal(THD *thd, udf_func *udf_arg):
- Item_sum_num(thd) {}
+ Item_sum_double(thd) {}
Item_sum_udf_decimal(THD *thd, udf_func *udf_arg, List<Item> &list):
- Item_sum_num(thd) {}
+ Item_sum_double(thd) {}
Item_sum_udf_decimal(THD *thd, Item_sum_udf_float *item)
- :Item_sum_num(thd, item) {}
+ :Item_sum_double(thd, item) {}
enum Sumfunctype sum_func () const { return UDF_SUM_FUNC; }
double val_real() { DBUG_ASSERT(fixed == 1); return 0.0; }
my_decimal *val_decimal(my_decimal *) { DBUG_ASSERT(fixed == 1); return 0; }
@@ -1788,15 +1815,15 @@ class Item_sum_udf_decimal :public Item_sum_num
};
-class Item_sum_udf_str :public Item_sum_num
+class Item_sum_udf_str :public Item_sum_double
{
public:
Item_sum_udf_str(THD *thd, udf_func *udf_arg):
- Item_sum_num(thd) {}
+ Item_sum_double(thd) {}
Item_sum_udf_str(THD *thd, udf_func *udf_arg, List<Item> &list):
- Item_sum_num(thd) {}
+ Item_sum_double(thd) {}
Item_sum_udf_str(THD *thd, Item_sum_udf_str *item)
- :Item_sum_num(thd, item) {}
+ :Item_sum_double(thd, item) {}
String *val_str(String *)
{ DBUG_ASSERT(fixed == 1); null_value=1; return 0; }
double val_real() { DBUG_ASSERT(fixed == 1); null_value=1; return 0.0; }
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 8639edf2944..c73db2f7ed1 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -1101,9 +1101,10 @@ longlong Item_func_weekday::val_int()
{
DBUG_ASSERT(fixed == 1);
THD *thd= current_thd;
- Datetime d(thd, args[0], Datetime::Options(TIME_NO_ZEROS, thd));
- return ((null_value= !d.is_valid_datetime())) ? 0 :
- calc_weekday(d.daynr(), odbc_type) + MY_TEST(odbc_type);
+ Datetime dt(thd, args[0], Datetime::Options(TIME_NO_ZEROS, thd));
+ if ((null_value= !dt.is_valid_datetime()))
+ return 0;
+ return dt.weekday(odbc_type) + MY_TEST(odbc_type);
}
bool Item_func_dayname::fix_length_and_dec()
@@ -1122,14 +1123,15 @@ bool Item_func_dayname::fix_length_and_dec()
String* Item_func_dayname::val_str(String* str)
{
DBUG_ASSERT(fixed == 1);
- uint weekday=(uint) val_int(); // Always Item_func_weekday()
const char *day_name;
uint err;
+ THD *thd= current_thd;
+ Datetime dt(thd, args[0], Datetime::Options(TIME_NO_ZEROS, thd));
- if (null_value)
+ if ((null_value= !dt.is_valid_datetime()))
return (String*) 0;
-
- day_name= locale->day_names->type_names[weekday];
+
+ day_name= locale->day_names->type_names[dt.weekday(false)];
str->copy(day_name, (uint) strlen(day_name), &my_charset_utf8mb3_bin,
collation.collation, &err);
return str;
diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h
index 97e9c2ac59b..4d6210e6179 100644
--- a/sql/item_timefunc.h
+++ b/sql/item_timefunc.h
@@ -166,32 +166,13 @@ public:
};
-class Item_func_month :public Item_func
+class Item_func_month :public Item_long_func
{
public:
- Item_func_month(THD *thd, Item *a): Item_func(thd, a)
- { collation= DTCollation_numeric(); }
+ Item_func_month(THD *thd, Item *a): Item_long_func(thd, a)
+ { }
longlong val_int();
- double val_real()
- { DBUG_ASSERT(fixed == 1); return (double) Item_func_month::val_int(); }
- String *val_str(String *str)
- {
- longlong nr= val_int();
- if (null_value)
- return 0;
- str->set(nr, collation.collation);
- return str;
- }
- my_decimal *val_decimal(my_decimal *decimal_value)
- {
- return val_decimal_from_int(decimal_value);
- }
- bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
- {
- return get_date_from_int(thd, ltime, fuzzydate);
- }
const char *func_name() const { return "month"; }
- const Type_handler *type_handler() const { return &type_handler_slong; }
bool fix_length_and_dec()
{
decimals= 0;
@@ -441,24 +422,13 @@ public:
};
-class Item_func_weekday :public Item_func
+class Item_func_weekday :public Item_long_func
{
bool odbc_type;
public:
Item_func_weekday(THD *thd, Item *a, bool type_arg):
- Item_func(thd, a), odbc_type(type_arg) { collation= DTCollation_numeric(); }
+ Item_long_func(thd, a), odbc_type(type_arg) { }
longlong val_int();
- double val_real() { DBUG_ASSERT(fixed == 1); return (double) val_int(); }
- String *val_str(String *str)
- {
- DBUG_ASSERT(fixed == 1);
- str->set(val_int(), &my_charset_bin);
- return null_value ? 0 : str;
- }
- my_decimal *val_decimal(my_decimal *decimal_value)
- {
- return val_decimal_from_int(decimal_value);
- }
const char *func_name() const
{
return (odbc_type ? "dayofweek" : "weekday");
@@ -467,7 +437,6 @@ public:
{
return type_handler()->Item_get_date_with_warn(thd, this, ltime, fuzzydate);
}
- const Type_handler *type_handler() const { return &type_handler_slong; }
bool fix_length_and_dec()
{
decimals= 0;
@@ -485,11 +454,11 @@ public:
{ return get_item_copy<Item_func_weekday>(thd, this); }
};
-class Item_func_dayname :public Item_func_weekday
+class Item_func_dayname :public Item_str_func
{
MY_LOCALE *locale;
public:
- Item_func_dayname(THD *thd, Item *a): Item_func_weekday(thd, a, 0) {}
+ Item_func_dayname(THD *thd, Item *a): Item_str_func(thd, a) {}
const char *func_name() const { return "dayname"; }
String *val_str(String *str);
const Type_handler *type_handler() const { return &type_handler_varchar; }
@@ -499,6 +468,12 @@ class Item_func_dayname :public Item_func_weekday
{
return mark_unsupported_function(func_name(), "()", arg, VCOL_SESSION_FUNC);
}
+ bool check_valid_arguments_processor(void *int_arg)
+ {
+ return !has_date_args();
+ }
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_func_dayname>(thd, this); }
};
diff --git a/sql/item_windowfunc.h b/sql/item_windowfunc.h
index 8b53b2012e7..f38209e4bb5 100644
--- a/sql/item_windowfunc.h
+++ b/sql/item_windowfunc.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2016,2017 MariaDB
+ Copyright (c) 2016,2019 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
@@ -445,28 +445,38 @@ class Item_sum_lag : public Item_sum_hybrid_simple
{ return get_item_copy<Item_sum_lag>(thd, this); }
};
-/*
- A base window function (aggregate) that also holds a counter for the number
- of rows.
-*/
-class Item_sum_window_with_row_count : public Item_sum_num
-{
- public:
- Item_sum_window_with_row_count(THD *thd) : Item_sum_num(thd),
- partition_row_count_(0) {}
-
- Item_sum_window_with_row_count(THD *thd, Item *arg) :
- Item_sum_num(thd, arg), partition_row_count_(0) {};
-
- void set_row_count(ulonglong count) { partition_row_count_ = count; }
- void reset_field() { DBUG_ASSERT(0); }
- protected:
+class Partition_row_count
+{
+public:
+ Partition_row_count() :partition_row_count_(0) { }
+ void set_partition_row_count(ulonglong count)
+ {
+ partition_row_count_ = count;
+ }
+ double calc_val_real(bool *null_value,
+ ulonglong current_row_count)
+ {
+ if ((*null_value= (partition_row_count_ == 0)))
+ return 0;
+ return static_cast<double>(current_row_count) / partition_row_count_;
+ }
+protected:
longlong get_row_count() { return partition_row_count_; }
- private:
ulonglong partition_row_count_;
};
+
+class Current_row_count
+{
+public:
+ Current_row_count() :current_row_count_(0) { }
+protected:
+ ulonglong get_row_number() { return current_row_count_ ; }
+ ulonglong current_row_count_;
+};
+
+
/*
@detail
"The relative rank of a row R is defined as (RK-1)/(NR-1), where RK is
@@ -478,11 +488,12 @@ class Item_sum_window_with_row_count : public Item_sum_num
This is held within the row_count context.
- Second pass to compute rank of current row and the value of the function
*/
-class Item_sum_percent_rank: public Item_sum_window_with_row_count
+class Item_sum_percent_rank: public Item_sum_double,
+ public Partition_row_count
{
public:
Item_sum_percent_rank(THD *thd)
- : Item_sum_window_with_row_count(thd), cur_rank(1), peer_tracker(NULL) {}
+ : Item_sum_double(thd), cur_rank(1), peer_tracker(NULL) {}
longlong val_int()
{
@@ -535,6 +546,14 @@ class Item_sum_percent_rank: public Item_sum_window_with_row_count
}
void setup_window_func(THD *thd, Window_spec *window_spec);
+
+ void reset_field() { DBUG_ASSERT(0); }
+
+ void set_partition_row_count(ulonglong count)
+ {
+ Partition_row_count::set_partition_row_count(count);
+ }
+
Item *get_copy(THD *thd)
{ return get_item_copy<Item_sum_percent_rank>(thd, this); }
@@ -569,25 +588,17 @@ class Item_sum_percent_rank: public Item_sum_window_with_row_count
two passes.
*/
-class Item_sum_cume_dist: public Item_sum_window_with_row_count
+class Item_sum_cume_dist: public Item_sum_double,
+ public Partition_row_count,
+ public Current_row_count
{
public:
- Item_sum_cume_dist(THD *thd) : Item_sum_window_with_row_count(thd),
- current_row_count_(0) {}
-
- Item_sum_cume_dist(THD *thd, Item *arg) : Item_sum_window_with_row_count(thd,arg),
- current_row_count_(0) {}
+ Item_sum_cume_dist(THD *thd) :Item_sum_double(thd) { }
+ Item_sum_cume_dist(THD *thd, Item *arg) :Item_sum_double(thd, arg) { }
double val_real()
{
- if (get_row_count() == 0)
- {
- null_value= true;
- return 0;
- }
- ulonglong partition_row_count= get_row_count();
- null_value= false;
- return static_cast<double>(current_row_count_) / partition_row_count;
+ return calc_val_real(&null_value, current_row_count_);
}
bool add()
@@ -604,7 +615,7 @@ class Item_sum_cume_dist: public Item_sum_window_with_row_count
void clear()
{
current_row_count_= 0;
- set_row_count(0);
+ partition_row_count_= 0;
}
const char*func_name() const
@@ -622,29 +633,26 @@ class Item_sum_cume_dist: public Item_sum_window_with_row_count
return FALSE;
}
- Item *get_copy(THD *thd)
- { return get_item_copy<Item_sum_cume_dist>(thd, this); }
+ void reset_field() { DBUG_ASSERT(0); }
- ulonglong get_row_number()
+ void set_partition_row_count(ulonglong count)
{
- return current_row_count_ ;
+ Partition_row_count::set_partition_row_count(count);
}
- private:
- ulonglong current_row_count_;
+ Item *get_copy(THD *thd)
+ { return get_item_copy<Item_sum_cume_dist>(thd, this); }
+
};
-class Item_sum_ntile : public Item_sum_window_with_row_count
+class Item_sum_ntile : public Item_sum_int,
+ public Partition_row_count,
+ public Current_row_count
{
public:
Item_sum_ntile(THD* thd, Item* num_quantiles_expr) :
- Item_sum_window_with_row_count(thd, num_quantiles_expr),
- current_row_count_(0) {};
-
- double val_real()
- {
- return (double) val_int();
- }
+ Item_sum_int(thd, num_quantiles_expr)
+ { }
longlong val_int()
{
@@ -685,7 +693,7 @@ class Item_sum_ntile : public Item_sum_window_with_row_count
void clear()
{
current_row_count_= 0;
- set_row_count(0);
+ partition_row_count_= 0;
}
const char*func_name() const
@@ -696,20 +704,28 @@ class Item_sum_ntile : public Item_sum_window_with_row_count
void update_field() {}
const Type_handler *type_handler() const { return &type_handler_slonglong; }
-
+
+ void reset_field() { DBUG_ASSERT(0); }
+
+ void set_partition_row_count(ulonglong count)
+ {
+ Partition_row_count::set_partition_row_count(count);
+ }
+
Item *get_copy(THD *thd)
{ return get_item_copy<Item_sum_ntile>(thd, this); }
private:
longlong get_num_quantiles() { return args[0]->val_int(); }
- ulong current_row_count_;
};
-class Item_sum_percentile_disc : public Item_sum_cume_dist,
- public Type_handler_hybrid_field_type
+class Item_sum_percentile_disc : public Item_sum_num,
+ public Type_handler_hybrid_field_type,
+ public Partition_row_count,
+ public Current_row_count
{
public:
- Item_sum_percentile_disc(THD *thd, Item* arg) : Item_sum_cume_dist(thd, arg),
+ Item_sum_percentile_disc(THD *thd, Item* arg) : Item_sum_num(thd, arg),
Type_handler_hybrid_field_type(&type_handler_slonglong),
value(NULL), val_calculated(FALSE), first_call(TRUE),
prev_value(0), order_item(NULL){}
@@ -758,6 +774,17 @@ public:
return value->val_str(str);
}
+ bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
+ {
+ if (get_row_count() == 0 || get_arg(0)->is_null())
+ {
+ null_value= true;
+ return 0;
+ }
+ null_value= false;
+ return value->get_date(thd, ltime, fuzzydate);
+ }
+
bool add()
{
Item *arg= get_arg(0);
@@ -791,8 +818,8 @@ public:
if (value->null_value)
return false;
- Item_sum_cume_dist::add();
- double val= Item_sum_cume_dist::val_real();
+ current_row_count_++;
+ double val= calc_val_real(&null_value, current_row_count_);
if (val >= prev_value && !val_calculated)
val_calculated= true;
@@ -809,7 +836,8 @@ public:
val_calculated= false;
first_call= true;
value->clear();
- Item_sum_cume_dist::clear();
+ partition_row_count_= 0;
+ current_row_count_= 0;
}
const char*func_name() const
@@ -818,7 +846,6 @@ public:
}
void update_field() {}
- void set_type_handler(Window_spec *window_spec);
const Type_handler *type_handler() const
{return Type_handler_hybrid_field_type::type_handler();}
@@ -829,6 +856,13 @@ public:
return FALSE;
}
+ void reset_field() { DBUG_ASSERT(0); }
+
+ void set_partition_row_count(ulonglong count)
+ {
+ Partition_row_count::set_partition_row_count(count);
+ }
+
Item *get_copy(THD *thd)
{ return get_item_copy<Item_sum_percentile_disc>(thd, this); }
void setup_window_func(THD *thd, Window_spec *window_spec);
@@ -843,12 +877,12 @@ private:
Item *order_item;
};
-class Item_sum_percentile_cont : public Item_sum_cume_dist,
- public Type_handler_hybrid_field_type
+class Item_sum_percentile_cont : public Item_sum_double,
+ public Partition_row_count,
+ public Current_row_count
{
public:
- Item_sum_percentile_cont(THD *thd, Item* arg) : Item_sum_cume_dist(thd, arg),
- Type_handler_hybrid_field_type(&type_handler_double),
+ Item_sum_percentile_cont(THD *thd, Item* arg) : Item_sum_double(thd, arg),
floor_value(NULL), ceil_value(NULL), first_call(TRUE),prev_value(0),
ceil_val_calculated(FALSE), floor_val_calculated(FALSE), order_item(NULL){}
@@ -918,7 +952,7 @@ public:
return false;
}
- Item_sum_cume_dist::add();
+ current_row_count_++;
double val= 1 + prev_value * (get_row_count()-1);
if (!floor_val_calculated && get_row_number() == floor(val))
@@ -941,7 +975,8 @@ public:
ceil_value->clear();
floor_val_calculated= false;
ceil_val_calculated= false;
- Item_sum_cume_dist::clear();
+ partition_row_count_= 0;
+ current_row_count_= 0;
}
const char*func_name() const
@@ -949,9 +984,6 @@ public:
return "percentile_cont";
}
void update_field() {}
- void set_type_handler(Window_spec *window_spec);
- const Type_handler *type_handler() const
- {return Type_handler_hybrid_field_type::type_handler();}
bool fix_length_and_dec()
{
@@ -960,6 +992,13 @@ public:
return FALSE;
}
+ void reset_field() { DBUG_ASSERT(0); }
+
+ void set_partition_row_count(ulonglong count)
+ {
+ Partition_row_count::set_partition_row_count(count);
+ }
+
Item *get_copy(THD *thd)
{ return get_item_copy<Item_sum_percentile_cont>(thd, this); }
void setup_window_func(THD *thd, Window_spec *window_spec);
diff --git a/sql/sql_audit.h b/sql/sql_audit.h
index 59cced13b0a..97317203e34 100644
--- a/sql/sql_audit.h
+++ b/sql/sql_audit.h
@@ -284,7 +284,9 @@ void mysql_audit_notify_connection_change_user(THD *thd)
}
static inline
-void mysql_audit_external_lock(THD *thd, TABLE_SHARE *share, int lock)
+void mysql_audit_external_lock_ex(THD *thd, my_thread_id thread_id,
+ const char *user, const char *host, const char *ip, query_id_t query_id,
+ TABLE_SHARE *share, int lock)
{
if (lock != F_UNLCK && mysql_audit_table_enabled())
{
@@ -293,25 +295,33 @@ void mysql_audit_external_lock(THD *thd, TABLE_SHARE *share, int lock)
event.event_subclass= MYSQL_AUDIT_TABLE_LOCK;
event.read_only= lock == F_RDLCK;
- event.thread_id= (unsigned long)thd->thread_id;
- event.user= sctx->user;
+ event.thread_id= (unsigned long)thread_id;
+ event.user= user;
event.priv_user= sctx->priv_user;
event.priv_host= sctx->priv_host;
event.external_user= sctx->external_user;
event.proxy_user= sctx->proxy_user;
- event.host= sctx->host;
- event.ip= sctx->ip;
+ event.host= host;
+ event.ip= ip;
event.database= share->db;
event.table= share->table_name;
event.new_database= null_clex_str;
event.new_table= null_clex_str;
- event.query_id= thd->query_id;
+ event.query_id= query_id;
mysql_audit_notify(thd, MYSQL_AUDIT_TABLE_CLASS, &event);
}
}
static inline
+void mysql_audit_external_lock(THD *thd, TABLE_SHARE *share, int lock)
+{
+ mysql_audit_external_lock_ex(thd, thd->thread_id, thd->security_ctx->user,
+ thd->security_ctx->host, thd->security_ctx->ip, thd->query_id,
+ share, lock);
+}
+
+static inline
void mysql_audit_create_table(TABLE *table)
{
if (mysql_audit_table_enabled())
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 0f267fff17b..60b60ec1e54 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -2203,36 +2203,16 @@ public:
passed from connection thread to the handler thread.
*/
MDL_request grl_protection;
- my_thread_id orig_thread_id;
- void set_default_user()
- {
- thd.security_ctx->user=(char*) delayed_user;
- thd.security_ctx->host=(char*) my_localhost;
- thd.security_ctx->ip= NULL;
- thd.query_id= 0;
- thd.thread_id= orig_thread_id;
- }
-
- void set_user_from_row(const delayed_row *r)
- {
- if (r)
- {
- thd.security_ctx->user= r->user;
- thd.security_ctx->host= r->host;
- thd.security_ctx->ip= r->ip;
- thd.query_id= r->query_id;
- thd.thread_id= r->thread_id;
- }
- }
-
Delayed_insert(SELECT_LEX *current_select)
:locks_in_memory(0), thd(next_thread_id()),
table(0),tables_in_use(0), stacked_inserts(0),
status(0), retry(0), handler_thread_initialized(FALSE), group_count(0)
{
DBUG_ENTER("Delayed_insert constructor");
- orig_thread_id= thd.thread_id;
- set_default_user();
+ thd.security_ctx->user=(char*) delayed_user;
+ thd.security_ctx->host=(char*) my_localhost;
+ thd.security_ctx->ip= NULL;
+ thd.query_id= 0;
strmake_buf(thd.security_ctx->priv_user, thd.security_ctx->user);
thd.current_tablenr=0;
thd.set_command(COM_DELAYED_INSERT);
@@ -3218,7 +3198,6 @@ pthread_handler_t handle_delayed_insert(void *arg)
if (di->tables_in_use && ! thd->lock &&
(!thd->killed || di->stacked_inserts))
{
- di->set_user_from_row(di->rows.head());
/*
Request for new delayed insert.
Lock the table, but avoid to be blocked by a global read lock.
@@ -3240,16 +3219,18 @@ pthread_handler_t handle_delayed_insert(void *arg)
{
delayed_row *row;
I_List_iterator<delayed_row> it(di->rows);
+ my_thread_id cur_thd= di->thd.thread_id;
+
while ((row= it++))
{
- if (di->thd.thread_id != row->thread_id)
+ if (cur_thd != row->thread_id)
{
- di->set_user_from_row(row);
- mysql_audit_external_lock(&di->thd, di->table->s, F_WRLCK);
+ mysql_audit_external_lock_ex(&di->thd, row->thread_id,
+ row->user, row->host, row->ip, row->query_id,
+ di->table->s, F_WRLCK);
+ cur_thd= row->thread_id;
}
}
- di->set_default_user();
-
if (di->handle_inserts())
{
/* Some fatal error */
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index 3afcce6e3bd..308bebd9fa1 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -1713,28 +1713,6 @@ public:
uint sroutines_list_own_elements;
/**
- Locking state of tables in this particular statement.
-
- If we under LOCK TABLES or in prelocked mode we consider tables
- for the statement to be "locked" if there was a call to lock_tables()
- (which called handler::start_stmt()) for tables of this statement
- and there was no matching close_thread_tables() call.
-
- As result this state may differ significantly from one represented
- by Open_tables_state::lock/locked_tables_mode more, which are always
- "on" under LOCK TABLES or in prelocked mode.
- */
- enum enum_lock_tables_state {
- LTS_NOT_LOCKED = 0,
- LTS_LOCKED
- };
- enum_lock_tables_state lock_tables_state;
- bool is_query_tables_locked()
- {
- return (lock_tables_state == LTS_LOCKED);
- }
-
- /**
Number of tables which were open by open_tables() and to be locked
by lock_tables().
Note that we set this member only in some cases, when this value
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3619c603697..bece1f9bee2 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2128,6 +2128,7 @@ JOIN::optimize_inner()
zero_result_cause= "Zero limit";
}
table_count= top_join_tab_count= 0;
+ handle_implicit_grouping_with_window_funcs();
error= 0;
subq_exit_fl= true;
goto setup_subq_exit;
@@ -2175,6 +2176,7 @@ JOIN::optimize_inner()
table_count= top_join_tab_count= 0;
error=0;
subq_exit_fl= true;
+ handle_implicit_grouping_with_window_funcs();
goto setup_subq_exit;
}
if (res > 1)
@@ -2190,6 +2192,7 @@ JOIN::optimize_inner()
tables_list= 0; // All tables resolved
select_lex->min_max_opt_list.empty();
const_tables= top_join_tab_count= table_count;
+ handle_implicit_grouping_with_window_funcs();
/*
Extract all table-independent conditions and replace the WHERE
clause with them. All other conditions were computed by opt_sum_query
@@ -2338,6 +2341,7 @@ int JOIN::optimize_stage2()
zero_result_cause= "no matching row in const table";
DBUG_PRINT("error",("Error: %s", zero_result_cause));
error= 0;
+ handle_implicit_grouping_with_window_funcs();
goto setup_subq_exit;
}
if (!(thd->variables.option_bits & OPTION_BIG_SELECTS) &&
@@ -2369,6 +2373,7 @@ int JOIN::optimize_stage2()
zero_result_cause=
"Impossible WHERE noticed after reading const tables";
select_lex->mark_const_derived(zero_result_cause);
+ handle_implicit_grouping_with_window_funcs();
goto setup_subq_exit;
}
@@ -2531,6 +2536,7 @@ int JOIN::optimize_stage2()
zero_result_cause=
"Impossible WHERE noticed after reading const tables";
select_lex->mark_const_derived(zero_result_cause);
+ handle_implicit_grouping_with_window_funcs();
goto setup_subq_exit;
}
@@ -15746,7 +15752,7 @@ static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
}
}
else if (cond->type() == Item::FUNC_ITEM &&
- ((Item_cond*) cond)->functype() == Item_func::MULT_EQUAL_FUNC)
+ ((Item_func*) cond)->functype() == Item_func::MULT_EQUAL_FUNC)
{
item_equal= (Item_equal *) cond;
item_equal->sort(&compare_fields_by_table_order, table_join_idx);
@@ -19722,7 +19728,8 @@ void set_postjoin_aggr_write_func(JOIN_TAB *tab)
}
}
else if (join->sort_and_group && !tmp_tbl->precomputed_group_by &&
- !join->sort_and_group_aggr_tab && join->tables_list)
+ !join->sort_and_group_aggr_tab && join->tables_list &&
+ join->top_join_tab_count)
{
DBUG_PRINT("info",("Using end_write_group"));
aggr->set_write_func(end_write_group);
@@ -25154,7 +25161,8 @@ change_to_use_tmp_fields(THD *thd, Ref_ptr_array ref_pointer_array,
for (uint i= 0; (item= it++); i++)
{
Field *field;
- if (item->with_sum_func() && item->type() != Item::SUM_FUNC_ITEM)
+ if ((item->with_sum_func() && item->type() != Item::SUM_FUNC_ITEM) ||
+ item->with_window_func)
item_field= item;
else if (item->type() == Item::FIELD_ITEM)
{
@@ -28696,6 +28704,28 @@ Item *remove_pushed_top_conjuncts(THD *thd, Item *cond)
}
+/*
+ There are 5 cases in which we shortcut the join optimization process as we
+ conclude that the join would be a degenerate one
+ 1) IMPOSSIBLE WHERE
+ 2) MIN/MAX optimization (@see opt_sum_query)
+ 3) EMPTY CONST TABLE
+ If a window function is present in any of the above cases then to get the
+ result of the window function, we need to execute it. So we need to
+ create a temporary table for its execution. Here we need to take in mind
+ that aggregate functions and non-aggregate function need not be executed.
+
+*/
+
+void JOIN::handle_implicit_grouping_with_window_funcs()
+{
+ if (select_lex->have_window_funcs() && send_row_on_empty_set())
+ {
+ const_tables= top_join_tab_count= table_count= 0;
+ }
+}
+
+
/**
@brief
Look for provision of the select_handler interface by a foreign engine
diff --git a/sql/sql_select.h b/sql/sql_select.h
index d440d79fbf5..e3501fb98c6 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -1127,6 +1127,7 @@ protected:
Join_plan_state *save_to);
/* Choose a subquery plan for a table-less subquery. */
bool choose_tableless_subquery_plan();
+ void handle_implicit_grouping_with_window_funcs();
public:
void save_query_plan(Join_plan_state *save_to);
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 9ba31a0ff83..e3514d286ef 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -6795,23 +6795,35 @@ static int get_check_constraints_record(THD *thd, TABLE_LIST *tables,
thd->clear_error();
DBUG_RETURN(0);
}
- else if (!tables->view)
+ if (!tables->view)
{
- if (tables->table->s->table_check_constraints)
+ StringBuffer<MAX_FIELD_WIDTH> str(system_charset_info);
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ TABLE_LIST table_acl_check;
+ bzero((char*) &table_acl_check, sizeof(table_acl_check));
+#endif
+ for (uint i= 0; i < tables->table->s->table_check_constraints; i++)
{
- for (uint i= 0; i < tables->table->s->table_check_constraints; i++)
+#ifndef NO_EMBEDDED_ACCESS_CHECKS
+ if (!(thd->col_access & TABLE_ACLS))
{
- StringBuffer<MAX_FIELD_WIDTH> str(system_charset_info);
- Virtual_column_info *check= tables->table->check_constraints[i];
- restore_record(table, s->default_values);
- table->field[0]->store(STRING_WITH_LEN("def"), system_charset_info);
- table->field[1]->store(db_name->str, db_name->length, system_charset_info);
- table->field[2]->store(check->name.str, check->name.length, system_charset_info);
- table->field[3]->store(table_name->str, table_name->length, system_charset_info);
- check->print(&str);
- table->field[4]->store(str.ptr(), str.length(), system_charset_info);
- schema_table_store_record(thd, table);
+ table_acl_check.db= *db_name;
+ table_acl_check.table_name= *table_name;
+ table_acl_check.grant.privilege= thd->col_access;
+ if (check_grant(thd, TABLE_ACLS, &table_acl_check, FALSE, 1, TRUE))
+ continue;
}
+#endif
+ Virtual_column_info *check= tables->table->check_constraints[i];
+ table->field[0]->store(STRING_WITH_LEN("def"), system_charset_info);
+ table->field[3]->store(check->name.str, check->name.length,
+ system_charset_info);
+ /* Make sure the string is empty between each print. */
+ str.length(0);
+ check->print(&str);
+ table->field[4]->store(str.ptr(), str.length(), system_charset_info);
+ if (schema_table_store_record(thd, table))
+ DBUG_RETURN(1);
}
}
DBUG_RETURN(res);
@@ -9370,8 +9382,8 @@ ST_FIELD_INFO check_constraints_fields_info[]=
{
Column("CONSTRAINT_CATALOG", Catalog(), NOT_NULL, OPEN_FULL_TABLE),
Column("CONSTRAINT_SCHEMA", Name(), NOT_NULL, OPEN_FULL_TABLE),
- Column("CONSTRAINT_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
Column("TABLE_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
+ Column("CONSTRAINT_NAME", Name(), NOT_NULL, OPEN_FULL_TABLE),
Column("CHECK_CLAUSE", Name(), NOT_NULL, OPEN_FULL_TABLE),
CEnd()
};
@@ -9402,7 +9414,8 @@ ST_SCHEMA_TABLE schema_tables[]=
{"CHARACTER_SETS", Show::charsets_fields_info, 0,
fill_schema_charsets, make_character_sets_old_format, 0, -1, -1, 0, 0},
{"CHECK_CONSTRAINTS", Show::check_constraints_fields_info, 0,
- get_all_tables, 0, get_check_constraints_record, 1, 2, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
+ get_all_tables, 0,
+ get_check_constraints_record, 1, 2, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
{"COLLATIONS", Show::collation_fields_info, 0,
fill_schema_collation, make_old_format, 0, -1, -1, 0, 0},
{"COLLATION_CHARACTER_SET_APPLICABILITY", Show::coll_charset_app_fields_info,
diff --git a/sql/sql_type.h b/sql/sql_type.h
index 3943a3f761f..749dc339f98 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -1887,6 +1887,10 @@ protected:
{
return (ulong) ::calc_daynr((uint) year, (uint) month, (uint) day);
}
+ int weekday(bool sunday_first_day_of_week) const
+ {
+ return ::calc_weekday(daynr(), sunday_first_day_of_week);
+ }
ulong dayofyear() const
{
return (ulong) (daynr() - ::calc_daynr(year, 1, 1) + 1);
@@ -2267,6 +2271,11 @@ public:
DBUG_ASSERT(is_valid_datetime_slow());
return Temporal_with_date::daynr();
}
+ int weekday(bool sunday_first_day_of_week) const
+ {
+ DBUG_ASSERT(is_valid_datetime_slow());
+ return Temporal_with_date::weekday(sunday_first_day_of_week);
+ }
ulong dayofyear() const
{
DBUG_ASSERT(is_valid_datetime_slow());
diff --git a/sql/sql_window.cc b/sql/sql_window.cc
index a6c9dd3fea7..7e319c96000 100644
--- a/sql/sql_window.cc
+++ b/sql/sql_window.cc
@@ -1779,11 +1779,7 @@ protected:
List_iterator_fast<Item_sum> it(sum_functions);
Item_sum* item;
while ((item= it++))
- {
- Item_sum_window_with_row_count* item_with_row_count =
- static_cast<Item_sum_window_with_row_count *>(item);
- item_with_row_count->set_row_count(num_rows_in_partition);
- }
+ item->set_partition_row_count(num_rows_in_partition);
}
};
diff --git a/sql/threadpool_generic.cc b/sql/threadpool_generic.cc
index 768dbab4e6b..e11a0613425 100644
--- a/sql/threadpool_generic.cc
+++ b/sql/threadpool_generic.cc
@@ -1237,7 +1237,7 @@ void wait_begin(thread_group_t *thread_group)
DBUG_ASSERT(thread_group->connection_count > 0);
if ((thread_group->active_thread_count == 0) &&
- (is_queue_empty(thread_group) || !thread_group->listener))
+ (!is_queue_empty(thread_group) || !thread_group->listener))
{
/*
Group might stall while this thread waits, thus wake
diff --git a/sql/tztime.cc b/sql/tztime.cc
index afbe7639dda..fbac2923a84 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -2432,7 +2432,7 @@ print_tz_leaps_as_sql(const TIME_ZONE_INFO *sp)
if (!opt_skip_write_binlog)
printf("\\d |\n"
"IF (select count(*) from information_schema.global_variables where\n"
- "variable_name='wsrep_on') = 1 THEN\n"
+ "variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n"
"ALTER TABLE time_zone_leap_second ENGINE=InnoDB;\n"
"END IF|\n"
"\\d ;\n");
@@ -2452,7 +2452,7 @@ print_tz_leaps_as_sql(const TIME_ZONE_INFO *sp)
if (!opt_skip_write_binlog)
printf("\\d |\n"
"IF (select count(*) from information_schema.global_variables where\n"
- "variable_name='wsrep_on') = 1 THEN\n"
+ "variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n"
"ALTER TABLE time_zone_leap_second ENGINE=Aria;\n"
"END IF|\n"
"\\d ;\n");
@@ -2708,7 +2708,7 @@ main(int argc, char **argv)
sql_log_bin and wsrep_on to avoid Galera replicating below
truncate table clauses. This will allow user to set different
time zones to nodes in Galera cluster. */
- printf("set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');\n"
+ printf("set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');\n"
"prepare set_wsrep_write_binlog from @prep1;\n"
"set @toggle=0; execute set_wsrep_write_binlog using @toggle;\n");
@@ -2724,7 +2724,7 @@ main(int argc, char **argv)
// to allow changes to them to replicate with Galera
printf("\\d |\n"
"IF (select count(*) from information_schema.global_variables where\n"
- "variable_name='wsrep_on') = 1 THEN\n"
+ "variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n"
"ALTER TABLE time_zone ENGINE=InnoDB;\n"
"ALTER TABLE time_zone_name ENGINE=InnoDB;\n"
"ALTER TABLE time_zone_transition ENGINE=InnoDB;\n"
@@ -2779,7 +2779,7 @@ main(int argc, char **argv)
// Fall back to Aria
printf("\\d |\n"
"IF (select count(*) from information_schema.global_variables where\n"
- "variable_name='wsrep_on') = 1 THEN\n"
+ "variable_name='wsrep_on' and variable_value='ON') = 1 THEN\n"
"ALTER TABLE time_zone ENGINE=Aria;\n"
"ALTER TABLE time_zone_name ENGINE=Aria;\n"
"ALTER TABLE time_zone_transition ENGINE=Aria;\n"
diff --git a/sql/unireg.cc b/sql/unireg.cc
index 7130b3e5d8a..e4a43d3ace5 100644
--- a/sql/unireg.cc
+++ b/sql/unireg.cc
@@ -538,7 +538,8 @@ LEX_CUSTRING build_frm_image(THD *thd, const LEX_CSTRING &table,
pos+= reclength;
int2store(pos, create_info->connect_string.length);
pos+= 2;
- memcpy(pos, create_info->connect_string.str, create_info->connect_string.length);
+ if (create_info->connect_string.length)
+ memcpy(pos, create_info->connect_string.str, create_info->connect_string.length);
pos+= create_info->connect_string.length;
int2store(pos, str_db_type.length);
pos+= 2;
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 7345f2f7b9e..708c320c471 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -2296,6 +2296,7 @@ int wsrep_wait_committing_connections_close(int wait_time)
{
int sleep_time= 100;
+ WSREP_DEBUG("wait for committing transaction to close: %d sleep: %d", wait_time, sleep_time);
while (server_threads.iterate(have_committing_connections) && wait_time > 0)
{
WSREP_DEBUG("wait for committing transaction to close: %d", wait_time);
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt
index 4ce5b9c6429..e1168aaa3f4 100644
--- a/storage/connect/CMakeLists.txt
+++ b/storage/connect/CMakeLists.txt
@@ -314,9 +314,6 @@ ENDIF(CONNECT_WITH_MONGO)
OPTION(CONNECT_WITH_REST "Compile CONNECT storage engine with REST support" ON)
IF(CONNECT_WITH_REST)
- MESSAGE(STATUS "=====> REST support is ON")
- SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp tabrest.h)
- add_definitions(-DREST_SUPPORT)
FIND_PACKAGE(cpprestsdk QUIET)
IF (cpprestsdk_FOUND)
IF(UNIX)
@@ -330,12 +327,8 @@ IF(CONNECT_WITH_REST)
# Comment it out if not needed depending on your cpprestsdk installation.
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
ENDIF(UNIX)
-# IF(REST_LIBRARY) why this? how about Windows
- SET(CONNECT_SOURCES ${CONNECT_SOURCES} restget.cpp)
- add_definitions(-DREST_SOURCE)
-# ENDIF()
- ELSE(NOT cpprestsdk_FOUND)
-# MESSAGE(STATUS "=====> cpprestsdk package not found")
+ SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp restget.cpp tabrest.h)
+ add_definitions(-DREST_SUPPORT)
ENDIF (cpprestsdk_FOUND)
ENDIF(CONNECT_WITH_REST)
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 35c4b753e92..5f5b7f47c48 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -87,6 +87,7 @@ struct set_numa_interleave_t
" policy to MPOL_INTERLEAVE: "
<< strerror(errno);
}
+ numa_bitmask_free(numa_mems_allowed);
}
}
@@ -1590,6 +1591,7 @@ buf_chunk_init(
" buffer pool page frames to MPOL_INTERLEAVE"
" (error: " << strerror(errno) << ").";
}
+ numa_bitmask_free(numa_mems_allowed);
}
#endif /* HAVE_LIBNUMA */
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index 19bf3b33cfa..392fefd7ebd 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -2233,45 +2233,3 @@ dict_replace_tablespace_in_dictionary(
return(error);
}
-
-/** Delete records from SYS_TABLESPACES and SYS_DATAFILES associated
-with a particular tablespace ID.
-@param[in] space Tablespace ID
-@param[in,out] trx Current transaction
-@return DB_SUCCESS if OK, dberr_t if the operation failed */
-
-dberr_t
-dict_delete_tablespace_and_datafiles(
- ulint space,
- trx_t* trx)
-{
- dberr_t err = DB_SUCCESS;
-
- ut_d(dict_sys.assert_locked());
- ut_ad(srv_sys_tablespaces_open);
-
- trx->op_info = "delete tablespace and datafiles from dictionary";
-
- pars_info_t* info = pars_info_create();
- ut_a(!is_system_tablespace(space));
- pars_info_add_int4_literal(info, "space", space);
-
- err = que_eval_sql(info,
- "PROCEDURE P () IS\n"
- "BEGIN\n"
- "DELETE FROM SYS_TABLESPACES\n"
- "WHERE SPACE = :space;\n"
- "DELETE FROM SYS_DATAFILES\n"
- "WHERE SPACE = :space;\n"
- "END;\n",
- FALSE, trx);
-
- if (err != DB_SUCCESS) {
- ib::warn() << "Could not delete space_id "
- << space << " from data dictionary";
- }
-
- trx->op_info = "";
-
- return(err);
-}
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 9ed16993ea5..f9a9539bf9c 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -630,6 +630,27 @@ buf_page_is_corrupted(
ulint fsp_flags)
MY_ATTRIBUTE((warn_unused_result));
+inline void *aligned_malloc(size_t size, size_t align)
+{
+#ifdef _MSC_VER
+ return _aligned_malloc(size, align);
+#else
+ void *result;
+ if (posix_memalign(&result, align, size))
+ result= NULL;
+ return result;
+#endif
+}
+
+inline void aligned_free(void *ptr)
+{
+#ifdef _MSC_VER
+ _aligned_free(ptr);
+#else
+ free(ptr);
+#endif
+}
+
/** Read the key version from the page. In full crc32 format,
key version is stored at {0-3th} bytes. In other format, it is
stored in 26th position.
@@ -687,34 +708,6 @@ inline uint buf_page_full_crc32_size(const byte* buf, bool* comp, bool* cr)
return page_size;
}
-# ifdef UNIV_LINUX
-# include <stdlib.h>
-# endif
-
-inline void* aligned_malloc(size_t size, size_t align)
-{
-#ifdef _MSC_VER
- return _aligned_malloc(size, align);
-#elif defined HAVE_POSIX_MEMALIGN
- void *result;
- if (posix_memalign(&result, align, size))
- result= NULL;
- return result;
-#else
- /* Use unaligned malloc as fallback */
- return malloc(size);
-#endif
-}
-
-inline void aligned_free(void *ptr)
-{
-#ifdef _MSC_VER
- _aligned_free(ptr);
-#else
- free(ptr);
-#endif
-}
-
#ifndef UNIV_INNOCHECKSUM
/**********************************************************************//**
Gets the hash value of a block. This can be used in searches in the
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 45cafcdf3fe..501f0ff6e96 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -113,7 +113,17 @@ ulint
buf_pool_get_n_pages(void)
/*======================*/
{
- return buf_pool_get_curr_size() >> srv_page_size_shift;
+ if (!buf_pool_ptr)
+ return buf_pool_get_curr_size() >> srv_page_size_shift;
+
+ ulint chunk_size= 0;
+ for (uint i= 0; i < srv_buf_pool_instances; i++)
+ {
+ buf_pool_t* buf_pool = buf_pool_from_array(i);
+ for (uint j= 0; j < buf_pool->n_chunks; j++)
+ chunk_size+= buf_pool->chunks[j].size;
+ }
+ return chunk_size;
}
/********************************************************************//**
diff --git a/storage/innobase/include/dict0crea.h b/storage/innobase/include/dict0crea.h
index 02854877f99..1935e58f9eb 100644
--- a/storage/innobase/include/dict0crea.h
+++ b/storage/innobase/include/dict0crea.h
@@ -198,16 +198,6 @@ dict_replace_tablespace_in_dictionary(
const char* path,
trx_t* trx);
-/** Delete records from SYS_TABLESPACES and SYS_DATAFILES associated
-with a particular tablespace ID.
-@param[in] space Tablespace ID
-@param[in,out] trx Current transaction
-@return DB_SUCCESS if OK, dberr_t if the operation failed */
-dberr_t
-dict_delete_tablespace_and_datafiles(
- ulint space,
- trx_t* trx);
-
/********************************************************************//**
Add a foreign key definition to the data dictionary tables.
@return error code or DB_SUCCESS */
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index 6e65b7458c5..3ad6fea1752 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -102,16 +102,21 @@ recv_sys.parse_start_lsn is non-zero.
@return true if more data added */
bool recv_sys_add_to_parsing_buf(const byte* log_block, lsn_t scanned_lsn);
-/** Parse log records from a buffer and optionally store them in recv_sys.pages
+/** Parse log records from a buffer and optionally store them to recv_sys.pages
to wait merging to file pages.
-@param[in] checkpoint_lsn the LSN of the latest checkpoint
-@param[in] store whether to store page operations
-@param[in] apply whether to apply the records
+@param[in] checkpoint_lsn the LSN of the latest checkpoint
+@param[in] store whether to store page operations
+@param[in] available_memory memory to read the redo logs
+@param[in] apply whether to apply the records
@return whether MLOG_CHECKPOINT record was seen the first time,
or corruption was noticed */
-bool recv_parse_log_recs(lsn_t checkpoint_lsn, store_t store, bool apply);
+bool recv_parse_log_recs(
+ lsn_t checkpoint_lsn,
+ store_t* store,
+ ulint available_memory,
+ bool apply);
-/** Moves the parsing buffer data left to the buffer start. */
+/** Moves the parsing buffer data left to the buffer start */
void recv_sys_justify_left_parsing_buf();
/** Report optimized DDL operation (without redo log),
diff --git a/storage/innobase/include/mtr0log.h b/storage/innobase/include/mtr0log.h
index e937dbfcb58..d067991e5d5 100644
--- a/storage/innobase/include/mtr0log.h
+++ b/storage/innobase/include/mtr0log.h
@@ -60,14 +60,6 @@ mlog_catenate_string(
const byte* str, /*!< in: string to write */
ulint len); /*!< in: string length */
/********************************************************//**
-Catenates a compressed ulint to mlog. */
-UNIV_INLINE
-void
-mlog_catenate_ulint_compressed(
-/*===========================*/
- mtr_t* mtr, /*!< in: mtr */
- ulint val); /*!< in: value to write */
-/********************************************************//**
Opens a buffer to mlog. It must be closed with mlog_close.
@return buffer, NULL if log mode MTR_LOG_NONE */
UNIV_INLINE
diff --git a/storage/innobase/include/mtr0log.ic b/storage/innobase/include/mtr0log.ic
index 9e3abe65c14..541be8f7090 100644
--- a/storage/innobase/include/mtr0log.ic
+++ b/storage/innobase/include/mtr0log.ic
@@ -117,30 +117,6 @@ mlog_catenate_ulint(
mlog_catenate_ulint(mtr->get_log(), val, type);
}
-/********************************************************//**
-Catenates a compressed ulint to mlog. */
-UNIV_INLINE
-void
-mlog_catenate_ulint_compressed(
-/*===========================*/
- mtr_t* mtr, /*!< in: mtr */
- ulint val) /*!< in: value to write */
-{
- byte* log_ptr;
-
- log_ptr = mlog_open(mtr, 10);
-
- /* If no logging is requested, we may return now */
- if (log_ptr == NULL) {
-
- return;
- }
-
- log_ptr += mach_write_compressed(log_ptr, val);
-
- mlog_close(mtr, log_ptr);
-}
-
/** Writes a log record about an operation.
@param[in] type redo log record type
@param[in] space_id tablespace identifier
diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
index ccc76c7ce3b..992ad50a93b 100644
--- a/storage/innobase/include/page0page.ic
+++ b/storage/innobase/include/page0page.ic
@@ -612,6 +612,7 @@ page_rec_get_next_low(
}
ut_ad(page_rec_is_infimum(rec)
+ || (!page_is_leaf(page) && !page_has_prev(page))
|| !(rec_get_info_bits(page + offs, comp)
& REC_INFO_MIN_REC_FLAG));
diff --git a/storage/innobase/innodb.cmake b/storage/innobase/innodb.cmake
index 1a5089979d5..657fb7815c3 100644
--- a/storage/innobase/innodb.cmake
+++ b/storage/innobase/innodb.cmake
@@ -135,11 +135,6 @@ IF(NOT MSVC)
SET_SOURCE_FILES_PROPERTIES(trx/trx0rec.cc PROPERTIES COMPILE_FLAGS -O1)
ENDIF()
- CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
- IF(HAVE_POSIX_MEMALIGN)
- ADD_DEFINITIONS(-DHAVE_POSIX_MEMALIGN)
- ENDIF()
-
# Only use futexes on Linux if GCC atomics are available
IF(NOT MSVC AND NOT CMAKE_CROSSCOMPILING)
CHECK_C_SOURCE_RUNS(
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index afce73f5524..56324b70629 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -505,8 +505,7 @@ fil_name_process(char* name, ulint len, ulint space_id, bool deleted)
/** Parse or process a MLOG_FILE_* record.
@param[in,out] ptr redo log record
@param[in] end end of the redo log buffer
-@param[in] space_id the tablespace ID
-@param[in] first_page_no first page number in the file
+@param[in] page_id first page number in the file
@param[in] type MLOG_FILE_NAME or MLOG_FILE_DELETE
or MLOG_FILE_CREATE2 or MLOG_FILE_RENAME2
@param[in] apply whether to apply the record
@@ -517,8 +516,7 @@ const byte*
fil_name_parse(
byte* ptr,
const byte* end,
- ulint space_id,
- ulint first_page_no,
+ const page_id_t page_id,
mlog_id_t type,
bool apply)
{
@@ -542,9 +540,9 @@ fil_name_parse(
/* MLOG_FILE_* records should only be written for
user-created tablespaces. The name must be long enough
and end in .ibd. */
- bool corrupt = is_predefined_tablespace(space_id)
+ bool corrupt = is_predefined_tablespace(page_id.space())
|| len < sizeof "/a.ibd\0"
- || (!first_page_no != !memcmp(ptr + len - 5, DOT_IBD, 5));
+ || (!page_id.page_no() != !memcmp(ptr + len - 5, DOT_IBD, 5));
if (!corrupt && !memchr(ptr, OS_PATH_SEPARATOR, len)) {
if (byte* c = static_cast<byte*>
@@ -575,7 +573,8 @@ fil_name_parse(
}
fil_name_process(
- reinterpret_cast<char*>(ptr), len, space_id, false);
+ reinterpret_cast<char*>(ptr), len, page_id.space(),
+ false);
break;
case MLOG_FILE_DELETE:
if (corrupt) {
@@ -584,23 +583,23 @@ fil_name_parse(
break;
}
- fil_name_process(
- reinterpret_cast<char*>(ptr), len, space_id, true);
+ fil_name_process(reinterpret_cast<char*>(ptr), len,
+ page_id.space(), true);
/* fall through */
case MLOG_FILE_CREATE2:
- if (first_page_no) {
- ut_ad(first_page_no
+ if (page_id.page_no()) {
+ ut_ad(page_id.page_no()
== SRV_UNDO_TABLESPACE_SIZE_IN_PAGES);
- ut_a(srv_is_undo_tablespace(space_id));
+ ut_a(srv_is_undo_tablespace(page_id.space()));
compile_time_assert(
UT_ARR_SIZE(recv_sys.truncated_undo_spaces)
== TRX_SYS_MAX_UNDO_SPACES);
recv_sys_t::trunc& t = recv_sys.truncated_undo_spaces[
- space_id - srv_undo_space_id_start];
+ page_id.space() - srv_undo_space_id_start];
t.lsn = recv_sys.recovered_lsn;
- t.pages = uint32_t(first_page_no);
+ t.pages = uint32_t(page_id.page_no());
} else if (log_file_op) {
- log_file_op(space_id,
+ log_file_op(page_id.space(),
type == MLOG_FILE_CREATE2 ? ptr - 4 : NULL,
ptr, len, NULL, 0);
}
@@ -656,13 +655,13 @@ fil_name_parse(
fil_name_process(
reinterpret_cast<char*>(ptr), len,
- space_id, false);
+ page_id.space(), false);
fil_name_process(
reinterpret_cast<char*>(new_name), new_len,
- space_id, false);
+ page_id.space(), false);
if (log_file_op) {
- log_file_op(space_id, NULL,
+ log_file_op(page_id.space(), NULL,
ptr, len, new_name, new_len);
}
@@ -670,7 +669,7 @@ fil_name_parse(
break;
}
if (!fil_op_replay_rename(
- space_id, first_page_no,
+ page_id.space(), page_id.page_no(),
reinterpret_cast<const char*>(ptr),
reinterpret_cast<const char*>(new_name))) {
recv_sys.found_corrupt_fs = true;
@@ -730,7 +729,6 @@ recv_sys_var_init(void)
recv_previous_parsed_rec_type = MLOG_SINGLE_REC_FLAG;
recv_previous_parsed_rec_offset = 0;
recv_previous_parsed_rec_is_multi = 0;
- recv_n_pool_free_frames = 384;
recv_max_page_lsn = 0;
}
@@ -813,12 +811,7 @@ void recv_sys_t::create()
apply_log_recs = false;
apply_batch_on = false;
- ulint size = buf_pool_get_curr_size();
- /* Set appropriate value of recv_n_pool_free_frames. */
- if (size >= 10 << 20) {
- /* Buffer pool of size greater than 10 MB. */
- recv_n_pool_free_frames = 512;
- }
+ recv_n_pool_free_frames = buf_pool_get_n_pages() / 3;
buf = static_cast<byte*>(ut_malloc_dontdump(RECV_PARSING_BUF_SIZE));
buf_size = RECV_PARSING_BUF_SIZE;
@@ -1278,8 +1271,7 @@ specified.
@param[in] type redo log entry type
@param[in] ptr redo log record body
@param[in] end_ptr end of buffer
-@param[in] space_id tablespace identifier
-@param[in] page_no page number
+@param[in] page_id page identifier
@param[in] apply whether to apply the record
@param[in,out] block buffer block, or NULL if
a page log record should not be applied
@@ -1293,8 +1285,7 @@ recv_parse_or_apply_log_rec_body(
mlog_id_t type,
const byte* ptr,
const byte* end_ptr,
- ulint space_id,
- ulint page_no,
+ const page_id_t page_id,
bool apply,
buf_block_t* block,
mtr_t* mtr)
@@ -1311,7 +1302,7 @@ recv_parse_or_apply_log_rec_body(
/* Collect the file names when parsing the log,
before applying any log records. */
return fil_name_parse(const_cast<byte*>(ptr), end_ptr,
- space_id, page_no, type, apply);
+ page_id, type, apply);
case MLOG_INDEX_LOAD:
if (end_ptr < ptr + 8) {
return(NULL);
@@ -1340,21 +1331,20 @@ recv_parse_or_apply_log_rec_body(
page_zip = buf_block_get_page_zip(block);
ut_d(page_type = fil_page_get_type(page));
} else if (apply
- && !is_predefined_tablespace(space_id)
- && recv_spaces.find(space_id) == recv_spaces.end()) {
+ && !is_predefined_tablespace(page_id.space())
+ && recv_spaces.find(page_id.space()) == recv_spaces.end()) {
if (recv_sys.recovered_lsn < recv_sys.mlog_checkpoint_lsn) {
/* We have not seen all records between the
checkpoint and MLOG_CHECKPOINT. There should be
a MLOG_FILE_DELETE for this tablespace later. */
recv_spaces.insert(
- std::make_pair(space_id,
+ std::make_pair(page_id.space(),
file_name_t("", false)));
goto parse_log;
}
ib::error() << "Missing MLOG_FILE_NAME or MLOG_FILE_DELETE"
- " for redo log record " << type << " (page "
- << space_id << ":" << page_no << ") at "
+ " for redo log record " << type << page_id << " at "
<< recv_sys.recovered_lsn << ".";
recv_sys.found_corrupt_log = true;
return(NULL);
@@ -1393,7 +1383,8 @@ parse_log:
redo log been written with something
older than InnoDB Plugin 1.0.4. */
ut_ad(offs == FIL_PAGE_TYPE
- || srv_is_undo_tablespace(space_id)
+ || srv_is_undo_tablespace(
+ page_id.space())
|| offs == IBUF_TREE_SEG_HEADER
+ IBUF_HEADER + FSEG_HDR_OFFSET
|| offs == PAGE_BTR_IBUF_FREE_LIST
@@ -1419,7 +1410,8 @@ parse_log:
ut_ad(0
/* fil_crypt_rotate_page() writes this */
|| offs == FIL_PAGE_SPACE_ID
- || srv_is_undo_tablespace(space_id)
+ || srv_is_undo_tablespace(
+ page_id.space())
|| offs == IBUF_TREE_SEG_HEADER
+ IBUF_HEADER + FSEG_HDR_SPACE
|| offs == IBUF_TREE_SEG_HEADER
@@ -1450,7 +1442,7 @@ parse_log:
}
#endif /* UNIV_DEBUG */
ptr = mlog_parse_nbytes(type, ptr, end_ptr, page, page_zip);
- if (ptr && page && !page_no && type == MLOG_4BYTES) {
+ if (ptr && page && !page_id.page_no() && type == MLOG_4BYTES) {
switch (ulint offs = mach_read_from_2(old_ptr)) {
fil_space_t* space;
ulint val;
@@ -1460,7 +1452,7 @@ parse_log:
case FSP_HEADER_OFFSET + FSP_SIZE:
case FSP_HEADER_OFFSET + FSP_FREE_LIMIT:
case FSP_HEADER_OFFSET + FSP_FREE + FLST_LEN:
- space = fil_space_get(space_id);
+ space = fil_space_get(page_id.space());
ut_a(space != NULL);
val = mach_read_from_4(page + offs);
@@ -1648,11 +1640,11 @@ parse_log:
this record yet. */
break;
case MLOG_WRITE_STRING:
- if (page_no || mach_read_from_2(ptr + 2)
+ if (page_id.page_no() || mach_read_from_2(ptr + 2)
!= 11 + MY_AES_BLOCK_SIZE) {
/* Not writing crypt_info */
} else if (fil_space_t* space
- = fil_space_acquire_silent(space_id)) {
+ = fil_space_acquire_silent(page_id.space())) {
if (mach_read_from_2(ptr)
== FSP_HEADER_OFFSET + XDES_ARR_OFFSET + MAGIC_SZ
+ space->physical_size() * XDES_SIZE
@@ -1947,8 +1939,7 @@ static void recv_recover_page(buf_block_t* block, mtr_t& mtr,
recv_parse_or_apply_log_rec_body(
recv->type, recs, recs + recv->len,
- block->page.id.space(),
- block->page.id.page_no(), true, block, &mtr);
+ block->page.id, true, block, &mtr);
end_lsn = recv->start_lsn + recv->len;
mach_write_to_8(FIL_PAGE_LSN + page, end_lsn);
@@ -2386,7 +2377,8 @@ recv_parse_log_rec(
const byte* old_ptr = new_ptr;
new_ptr = recv_parse_or_apply_log_rec_body(
- *type, new_ptr, end_ptr, *space, *page_no, apply, NULL, NULL);
+ *type, new_ptr, end_ptr, page_id_t(*space, *page_no), apply,
+ NULL, NULL);
if (UNIV_UNLIKELY(new_ptr == NULL)) {
return(0);
@@ -2509,14 +2501,39 @@ recv_mlog_index_load(ulint space_id, ulint page_no, lsn_t lsn)
}
}
+/** Check whether read redo log memory exceeds the available memory
+of buffer pool. Store last_stored_lsn if it is not in last phase
+@param[in] store whether to store page operations
+@param[in] available_mem Available memory in buffer pool to
+ read redo logs. */
+static bool recv_sys_heap_check(store_t* store, ulint available_mem)
+{
+ if (*store != STORE_NO && mem_heap_get_size(recv_sys.heap) >= available_mem)
+ {
+ if (*store == STORE_YES)
+ recv_sys.last_stored_lsn= recv_sys.recovered_lsn;
+
+ *store= STORE_NO;
+ DBUG_PRINT("ib_log",("Ran out of memory and last "
+ "stored lsn " LSN_PF " last stored offset "
+ ULINTPF "\n",
+ recv_sys.recovered_lsn, recv_sys.recovered_offset));
+ return true;
+ }
+
+ return false;
+}
+
/** Parse log records from a buffer and optionally store them to a
hash table to wait merging to file pages.
-@param[in] checkpoint_lsn the LSN of the latest checkpoint
-@param[in] store whether to store page operations
-@param[in] apply whether to apply the records
+@param[in] checkpoint_lsn the LSN of the latest checkpoint
+@param[in] store whether to store page operations
+@param[in] available_mem memory to read the redo logs
+@param[in] apply whether to apply the records
@return whether MLOG_CHECKPOINT record was seen the first time,
or corruption was noticed */
-bool recv_parse_log_recs(lsn_t checkpoint_lsn, store_t store, bool apply)
+bool recv_parse_log_recs(lsn_t checkpoint_lsn, store_t* store,
+ ulint available_mem, bool apply)
{
bool single_rec;
ulint len;
@@ -2526,6 +2543,7 @@ bool recv_parse_log_recs(lsn_t checkpoint_lsn, store_t store, bool apply)
ulint space;
ulint page_no;
const byte* body;
+ const bool last_phase = (*store == STORE_IF_EXISTS);
ut_ad(log_mutex_own());
ut_ad(mutex_own(&recv_sys.mutex));
@@ -2539,6 +2557,12 @@ loop:
return(false);
}
+ /* Check for memory overflow and ignore the parsing of remaining
+ redo log records if InnoDB ran out of memory */
+ if (recv_sys_heap_check(store, available_mem) && last_phase) {
+ return false;
+ }
+
switch (*ptr) {
case MLOG_CHECKPOINT:
case MLOG_DUMMY_RECORD:
@@ -2629,7 +2653,7 @@ loop:
}
break;
default:
- switch (store) {
+ switch (*store) {
case STORE_NO:
break;
case STORE_IF_EXISTS:
@@ -2805,7 +2829,7 @@ corrupted_log:
recv_parse_or_apply_log_rec_body(). */
break;
default:
- switch (store) {
+ switch (*store) {
case STORE_NO:
break;
case STORE_IF_EXISTS:
@@ -2848,7 +2872,6 @@ bool recv_sys_add_to_parsing_buf(const byte* log_block, lsn_t scanned_lsn)
if (!recv_sys.parse_start_lsn) {
/* Cannot start parsing yet because no start point for
it found */
-
return(false);
}
@@ -2869,7 +2892,6 @@ bool recv_sys_add_to_parsing_buf(const byte* log_block, lsn_t scanned_lsn)
}
if (more_len == 0) {
-
return(false);
}
@@ -2911,26 +2933,30 @@ void recv_sys_justify_left_parsing_buf()
/** Scan redo log from a buffer and stores new log data to the parsing buffer.
Parse and hash the log records if new data found.
Apply log records automatically when the hash table becomes full.
+@param[in] available_mem we let the hash table of recs to
+ grow to this size, at the maximum
+@param[in,out] store_to_hash whether the records should be
+ stored to the hash table; this is
+ reset if just debug checking is
+ needed, or when the available_mem
+ runs out
+@param[in] log_block log segment
+@param[in] checkpoint_lsn latest checkpoint LSN
+@param[in] start_lsn buffer start LSN
+@param[in] end_lsn buffer end LSN
+@param[in,out] contiguous_lsn it is known that all groups contain
+ contiguous log data upto this lsn
+@param[out] group_scanned_lsn scanning succeeded upto this lsn
@return true if not able to scan any more in this log group */
-static
-bool
-recv_scan_log_recs(
-/*===============*/
- ulint available_memory,/*!< in: we let the hash table of recs
- to grow to this size, at the maximum */
- store_t* store_to_hash, /*!< in,out: whether the records should be
- stored to the hash table; this is reset
- if just debug checking is needed, or
- when the available_memory runs out */
- const byte* log_block, /*!< in: log segment */
- lsn_t checkpoint_lsn, /*!< in: latest checkpoint LSN */
- lsn_t start_lsn, /*!< in: buffer start LSN */
- lsn_t end_lsn, /*!< in: buffer end LSN */
- lsn_t* contiguous_lsn, /*!< in/out: it is known that all log
- groups contain contiguous log data up
- to this lsn */
- lsn_t* group_scanned_lsn)/*!< out: scanning succeeded up to
- this lsn */
+static bool recv_scan_log_recs(
+ ulint available_mem,
+ store_t* store_to_hash,
+ const byte* log_block,
+ lsn_t checkpoint_lsn,
+ lsn_t start_lsn,
+ lsn_t end_lsn,
+ lsn_t* contiguous_lsn,
+ lsn_t* group_scanned_lsn)
{
lsn_t scanned_lsn = start_lsn;
bool finished = false;
@@ -2938,14 +2964,13 @@ recv_scan_log_recs(
bool more_data = false;
bool apply = recv_sys.mlog_checkpoint_lsn != 0;
ulint recv_parsing_buf_size = RECV_PARSING_BUF_SIZE;
-
+ const bool last_phase = (*store_to_hash == STORE_IF_EXISTS);
ut_ad(start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(end_lsn % OS_FILE_LOG_BLOCK_SIZE == 0);
ut_ad(end_lsn >= start_lsn + OS_FILE_LOG_BLOCK_SIZE);
const byte* const log_end = log_block
+ ulint(end_lsn - start_lsn);
-
do {
ut_ad(!finished);
@@ -3056,6 +3081,13 @@ recv_scan_log_recs(
= log_block_get_checkpoint_no(log_block);
}
+ /* During last phase of scanning, there can be redo logs
+ left in recv_sys.buf to parse & store it in recv_sys.heap */
+ if (last_phase
+ && recv_sys.recovered_lsn < recv_sys.scanned_lsn) {
+ more_data = true;
+ }
+
if (data_len < OS_FILE_LOG_BLOCK_SIZE) {
/* Log data for this group ends here */
finished = true;
@@ -3073,7 +3105,8 @@ recv_scan_log_recs(
/* Try to parse more log records */
if (recv_parse_log_recs(checkpoint_lsn,
- *store_to_hash, apply)) {
+ store_to_hash, available_mem,
+ apply)) {
ut_ad(recv_sys.found_corrupt_log
|| recv_sys.found_corrupt_fs
|| recv_sys.mlog_checkpoint_lsn
@@ -3082,22 +3115,18 @@ recv_scan_log_recs(
goto func_exit;
}
- if (*store_to_hash != STORE_NO
- && mem_heap_get_size(recv_sys.heap) > available_memory) {
-
- DBUG_PRINT("ib_log", ("Ran out of memory and last "
- "stored lsn " LSN_PF,
- recv_sys.recovered_lsn));
-
- recv_sys.last_stored_lsn = recv_sys.recovered_lsn;
- *store_to_hash = STORE_NO;
- }
+ recv_sys_heap_check(store_to_hash, available_mem);
if (recv_sys.recovered_offset > recv_parsing_buf_size / 4) {
/* Move parsing buffer data to the buffer start */
-
recv_sys_justify_left_parsing_buf();
}
+
+ /* Need to re-parse the redo log which're stored
+ in recv_sys.buf */
+ if (last_phase && *store_to_hash == STORE_NO) {
+ finished = false;
+ }
}
func_exit:
@@ -3154,6 +3183,8 @@ recv_group_scan_log_recs(
if (last_phase && store_to_hash == STORE_NO) {
store_to_hash = STORE_IF_EXISTS;
recv_apply_hashed_log_recs(false);
+ /* Rescan the redo logs from last stored lsn */
+ end_lsn = recv_sys.recovered_lsn;
}
start_lsn = ut_uint64_align_down(end_lsn,
diff --git a/storage/innobase/os/os0proc.cc b/storage/innobase/os/os0proc.cc
index c4ecbcd5db9..32067297a24 100644
--- a/storage/innobase/os/os0proc.cc
+++ b/storage/innobase/os/os0proc.cc
@@ -153,6 +153,12 @@ os_mem_free_large(
{
ut_a(os_total_large_mem_allocated >= size);
+ // We could have manually poisoned that memory for ASAN.
+ // And we must unpoison it by ourself as specified in documentation
+ // for __asan_poison_memory_region() in sanitizer/asan_interface.h
+ // munmap() doesn't do it for us automatically.
+ UNIV_MEM_ALLOC(ptr, size);
+
#ifdef HAVE_LINUX_LARGE_PAGES
if (my_use_large_pages && opt_large_page_size && !shmdt(ptr)) {
os_total_large_mem_allocated -= size;
diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt
index a285cd78d3b..f4f23ff08c6 100644
--- a/storage/rocksdb/CMakeLists.txt
+++ b/storage/rocksdb/CMakeLists.txt
@@ -248,6 +248,8 @@ IF(MSVC)
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267")
ENDIF()
+ELSEIF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ SET_TARGET_PROPERTIES(rocksdb_tools sst_dump mysql_ldb PROPERTIES COMPILE_FLAGS "-Wno-error")
ENDIF()
# Enable ZSTD if available. Upstream rocksdb cmake will use WITH_ZSTD and set
diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake
index 96da9737dbc..d7895b095ba 100644
--- a/storage/rocksdb/build_rocksdb.cmake
+++ b/storage/rocksdb/build_rocksdb.cmake
@@ -471,5 +471,5 @@ list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/build_version.cc)
ADD_CONVENIENCE_LIBRARY(rocksdblib ${SOURCES})
target_link_libraries(rocksdblib ${THIRDPARTY_LIBS} ${SYSTEM_LIBS})
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- set_target_properties(rocksdblib PROPERTIES COMPILE_FLAGS "-fPIC -fno-builtin-memcmp")
+ set_target_properties(rocksdblib PROPERTIES COMPILE_FLAGS "-fPIC -fno-builtin-memcmp -Wno-error")
endif()
diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c
index 91232a1e31f..17cb51ff8cb 100644
--- a/strings/ctype-simple.c
+++ b/strings/ctype-simple.c
@@ -1598,7 +1598,8 @@ my_strntoull10rnd_8bit(CHARSET_INFO *cs __attribute__((unused)),
int shift= 0, digits= 0, negative, addon;
/* Skip leading spaces and tabs */
- for ( ; str < end && (*str == ' ' || *str == '\t') ; str++);
+ for ( ; str < end && my_isspace(&my_charset_latin1, *str) ; )
+ str++;
if (str >= end)
goto ret_edom;
diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c
index 2311b4e5079..183829d7074 100644
--- a/strings/my_strtoll10.c
+++ b/strings/my_strtoll10.c
@@ -98,18 +98,25 @@ longlong my_strtoll10(const char *nptr, char **endptr, int *error)
if (endptr)
{
end= *endptr;
- while (s != end && (*s == ' ' || *s == '\t'))
+ /* Skip leading spaces */
+ for ( ; s < end && my_isspace(&my_charset_latin1, *s) ; )
s++;
+
if (s == end)
goto no_conv;
}
else
{
endptr= &dummy; /* Easier end test */
- while (*s == ' ' || *s == '\t')
- s++;
- if (!*s)
- goto no_conv;
+ /* Skip leading spaces */
+ for ( ; ; s++)
+ {
+ if (!*s)
+ goto no_conv;
+ if (!my_isspace(&my_charset_latin1, *s))
+ break;
+ }
+
/* This number must be big to guard against a lot of pre-zeros */
end= s+65535; /* Can't be longer than this */
}
diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in
index 8d2e57b8290..e7665ed1219 100644
--- a/support-files/mariadb.service.in
+++ b/support-files/mariadb.service.in
@@ -131,6 +131,13 @@ UMask=007
# LOAD DATA INFILE you can enable PrivateTmp=true for a little more security.
PrivateTmp=false
+# Set an explicit Start and Stop timeout of 900 seconds (15 minutes!)
+# this is the same value as used in SysV init scripts in the past
+# Galera might need a longer timeout, check the KB if you want to change this:
+# https://mariadb.com/kb/en/library/systemd/#configuring-the-systemd-service-timeout
+TimeoutStartSec=900
+TimeoutStopSec=900
+
##
## Options previously available to be set via [mysqld_safe]
## that now needs to be set by systemd config files as mysqld_safe
diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in
index 4a49bd48766..ffefc2f22d8 100644
--- a/support-files/mariadb@.service.in
+++ b/support-files/mariadb@.service.in
@@ -243,6 +243,13 @@ UMask=007
# LOAD DATA INFILE you can enable PrivateTmp=true for a little more security.
PrivateTmp=false
+# Set an explicit Start and Stop timeout of 900 seconds (15 minutes!)
+# this is the same value as used in SysV init scripts in the past
+# if you need a longer timeout, check the KB:
+# https://mariadb.com/kb/en/library/systemd/#configuring-the-systemd-service-timeout
+TimeoutStartSec=900
+TimeoutStopSec=900
+
# Controlling how multiple instances are separated. See top of this file.
# Note: This service isn't User=mysql by default so we need to be explicit.
# It is as an option here as a user may want to use the MYSQLD_MULTI_INSTANCE