
[Commits] 25870f4: MDEV-18668 Server crash or ASAN use-after-poison in Item_equal_iterator /
by IgorBabaev 24 Feb '19
by IgorBabaev 24 Feb '19
24 Feb '19
revision-id: 25870f48cf66c5984332120d1cb11db79ca1b5f6 (mariadb-10.3.6-172-g25870f4)
parent(s): 31deef0953a5cf7259e1d064ae7f2e0dde922436
author: Igor Babaev
committer: Igor Babaev
timestamp: 2019-02-24 02:02:07 -0800
message:
MDEV-18668 Server crash or ASAN use-after-poison in Item_equal_iterator /
st_select_lex::pushdown_from_having_into_where upon query
with impossible WHERE condition
Do not push from HAVING into impossible WHERE
---
mysql-test/main/having_cond_pushdown.result | 12 ++++++++++++
mysql-test/main/having_cond_pushdown.test | 13 +++++++++++++
sql/sql_select.cc | 6 +++++-
3 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/mysql-test/main/having_cond_pushdown.result b/mysql-test/main/having_cond_pushdown.result
index 9d2fbce..ef7368b 100644
--- a/mysql-test/main/having_cond_pushdown.result
+++ b/mysql-test/main/having_cond_pushdown.result
@@ -1906,3 +1906,15 @@ EXPLAIN
DROP TABLE t1,t2;
DROP VIEW v1;
DROP FUNCTION f1;
+#
+# MDEV-18668: pushdown from HAVING into impossible WHERE
+#
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,1),(2,2);
+SELECT a FROM t1 WHERE b = 1 AND b = 2 GROUP BY a HAVING a <= 3;
+a
+EXPLAIN
+SELECT a FROM t1 WHERE b = 1 AND b = 2 GROUP BY a HAVING a <= 3;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+DROP TABLE t1;
diff --git a/mysql-test/main/having_cond_pushdown.test b/mysql-test/main/having_cond_pushdown.test
index 2af9d58..2fbb570 100644
--- a/mysql-test/main/having_cond_pushdown.test
+++ b/mysql-test/main/having_cond_pushdown.test
@@ -473,3 +473,16 @@ eval $no_pushdown explain format=json $query;
DROP TABLE t1,t2;
DROP VIEW v1;
DROP FUNCTION f1;
+
+--echo #
+--echo # MDEV-18668: pushdown from HAVING into impossible WHERE
+--echo #
+
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 VALUES (1,1),(2,2);
+
+SELECT a FROM t1 WHERE b = 1 AND b = 2 GROUP BY a HAVING a <= 3;
+EXPLAIN
+SELECT a FROM t1 WHERE b = 1 AND b = 2 GROUP BY a HAVING a <= 3;
+
+DROP TABLE t1;
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 5faadb1..4f98153 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1929,8 +1929,11 @@ JOIN::optimize_inner()
DBUG_RETURN(1);
}
+ /* Do not push into WHERE from HAVING if cond_value == Item::COND_FALSE */
+
if (thd->lex->sql_command == SQLCOM_SELECT &&
- optimizer_flag(thd, OPTIMIZER_SWITCH_COND_PUSHDOWN_FROM_HAVING))
+ optimizer_flag(thd, OPTIMIZER_SWITCH_COND_PUSHDOWN_FROM_HAVING) &&
+ cond_value != Item::COND_FALSE)
{
having=
select_lex->pushdown_from_having_into_where(thd, having);
@@ -15380,6 +15383,7 @@ Item *eliminate_item_equal(THD *thd, COND *cond, COND_EQUAL *upper_levels,
@param cond condition to process
@param cond_equal multiple equalities to take into consideration
@param table_join_idx index to tables determining field preference
+ @param do_substitution if false: do not do any field substitution
@note
At the first glance full sort of fields in multiple equality
1
0
revision-id: 31deef0953a5cf7259e1d064ae7f2e0dde922436 (mariadb-10.3.6-171-g31deef0)
parent(s): 793f27a046e2c2753dcad8793c75e27f445938fc
author: Igor Babaev
committer: Igor Babaev
timestamp: 2019-02-24 01:55:51 -0800
message:
MDEV-18681 Server crashes in embedding_sjm
Do not do substitution for best equal field in HAVING conditions.
It's not needed.
---
mysql-test/main/having.result | 18 ++++++++++++++++++
mysql-test/main/having.test | 20 ++++++++++++++++++++
sql/sql_select.cc | 19 +++++++++++--------
3 files changed, 49 insertions(+), 8 deletions(-)
diff --git a/mysql-test/main/having.result b/mysql-test/main/having.result
index b1cd776..dd710db 100644
--- a/mysql-test/main/having.result
+++ b/mysql-test/main/having.result
@@ -847,3 +847,21 @@ t r
DROP TABLE t1;
DROP FUNCTION next_seq_value;
DROP TABLE series;
+# End of 10.3 tests
+#
+# MDEV-18681: AND formula in HAVING with several occurances
+# of the same field f in different conjuncts + f=constant
+#
+CREATE TABLE t1 (pk int, f varchar(1));
+INSERT INTO t1 VALUES (2,'x'), (7,'y');
+CREATE TABLE t2 (pk int);
+INSERT INTO t2 VALUES (2), (3);
+SELECT t.f
+FROM (SELECT t1.* FROM (t1 JOIN t2 ON (t2.pk = t1.pk))) t
+HAVING t.f != 112 AND t.f = 'x' AND t.f != 'a';
+f
+x
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+DROP TABLE t1,t2;
+# End of 10.4 tests
diff --git a/mysql-test/main/having.test b/mysql-test/main/having.test
index 179af14..ed86b41 100644
--- a/mysql-test/main/having.test
+++ b/mysql-test/main/having.test
@@ -890,3 +890,23 @@ SELECT t, next_seq_value() r FROM t1 FORCE INDEX(t)
DROP TABLE t1;
DROP FUNCTION next_seq_value;
DROP TABLE series;
+
+--echo # End of 10.3 tests
+
+--echo #
+--echo # MDEV-18681: AND formula in HAVING with several occurances
+--echo # of the same field f in different conjuncts + f=constant
+--echo #
+
+CREATE TABLE t1 (pk int, f varchar(1));
+INSERT INTO t1 VALUES (2,'x'), (7,'y');
+CREATE TABLE t2 (pk int);
+INSERT INTO t2 VALUES (2), (3);
+
+SELECT t.f
+FROM (SELECT t1.* FROM (t1 JOIN t2 ON (t2.pk = t1.pk))) t
+HAVING t.f != 112 AND t.f = 'x' AND t.f != 'a';
+
+DROP TABLE t1,t2;
+
+--echo # End of 10.4 tests
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index e6a858b..5faadb1 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -159,7 +159,8 @@ static COND *build_equal_items(JOIN *join, COND *cond,
static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
COND *cond,
COND_EQUAL *cond_equal,
- void *table_join_idx);
+ void *table_join_idx,
+ bool do_substitution);
static COND *simplify_joins(JOIN *join, List<TABLE_LIST> *join_list,
COND *conds, bool top, bool in_sj);
static bool check_interleaving_with_nj(JOIN_TAB *next);
@@ -2304,7 +2305,7 @@ int JOIN::optimize_stage2()
if (conds)
{
conds= substitute_for_best_equal_field(thd, NO_PARTICULAR_TAB, conds,
- cond_equal, map2table);
+ cond_equal, map2table, true);
if (unlikely(thd->is_error()))
{
error= 1;
@@ -2320,7 +2321,7 @@ int JOIN::optimize_stage2()
if (having)
{
having= substitute_for_best_equal_field(thd, NO_PARTICULAR_TAB, having,
- having_equal, map2table);
+ having_equal, map2table, false);
if (thd->is_error())
{
error= 1;
@@ -2347,7 +2348,7 @@ int JOIN::optimize_stage2()
*tab->on_expr_ref= substitute_for_best_equal_field(thd, NO_PARTICULAR_TAB,
*tab->on_expr_ref,
tab->cond_equal,
- map2table);
+ map2table, true);
if (unlikely(thd->is_error()))
{
error= 1;
@@ -2377,7 +2378,7 @@ int JOIN::optimize_stage2()
while (equals)
{
ref_item= substitute_for_best_equal_field(thd, tab, ref_item,
- equals, map2table);
+ equals, map2table, true);
if (unlikely(thd->is_fatal_error))
DBUG_RETURN(1);
@@ -15418,7 +15419,8 @@ Item *eliminate_item_equal(THD *thd, COND *cond, COND_EQUAL *upper_levels,
static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
COND *cond,
COND_EQUAL *cond_equal,
- void *table_join_idx)
+ void *table_join_idx,
+ bool do_substitution)
{
Item_equal *item_equal;
COND *org_cond= cond; // Return this in case of fatal error
@@ -15447,7 +15449,8 @@ static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
{
Item *new_item= substitute_for_best_equal_field(thd, context_tab,
item, cond_equal,
- table_join_idx);
+ table_join_idx,
+ do_substitution);
/*
This works OK with PS/SP re-execution as changes are made to
the arguments of AND/OR items only
@@ -15529,7 +15532,7 @@ static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
cond= eliminate_item_equal(thd, 0, cond_equal, item_equal);
return cond ? cond : org_cond;
}
- else
+ else if (do_substitution)
{
while (cond_equal)
{
1
0
revision-id: 9383cba08b8efeb7a70afe68502bfca96fbb251f (mariadb-10.3.6-171-g9383cba)
parent(s): 793f27a046e2c2753dcad8793c75e27f445938fc
author: Igor Babaev
committer: Igor Babaev
timestamp: 2019-02-24 01:36:05 -0800
message:
MDEV-18681 Server crashes in embedding_sjm
Do not do substitution for best equal field in HAVING conditions.
It's not needed.
---
mysql-test/main/having.result | 18 ++++++++++++++++++
mysql-test/main/having.test | 20 ++++++++++++++++++++
sql/sql_select.cc | 19 +++++++++++--------
3 files changed, 49 insertions(+), 8 deletions(-)
diff --git a/mysql-test/main/having.result b/mysql-test/main/having.result
index b1cd776..89c91b0 100644
--- a/mysql-test/main/having.result
+++ b/mysql-test/main/having.result
@@ -847,3 +847,21 @@ t r
DROP TABLE t1;
DROP FUNCTION next_seq_value;
DROP TABLE series;
+# End of 10.3 tests
+#
+# MDEV-18681: AND formula in having with several occurances
+# of the same field f in different conjunct AND f=constant
+#
+CREATE TABLE t1 (pk int, f varchar(1));
+INSERT INTO t1 VALUES (2,'x'), (7,'y');
+CREATE TABLE t2 (pk int);
+INSERT INTO t2 VALUES (2), (3);
+SELECT t.f
+FROM (SELECT t1.* FROM (t1 JOIN t2 ON (t2.pk = t1.pk))) t
+HAVING t.f != 112 AND t.f = 'x' AND t.f != 'a';
+f
+x
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'x'
+DROP TABLE t1,t2;
+# End of 10.4 tests
diff --git a/mysql-test/main/having.test b/mysql-test/main/having.test
index 179af14..57900ec 100644
--- a/mysql-test/main/having.test
+++ b/mysql-test/main/having.test
@@ -890,3 +890,23 @@ SELECT t, next_seq_value() r FROM t1 FORCE INDEX(t)
DROP TABLE t1;
DROP FUNCTION next_seq_value;
DROP TABLE series;
+
+--echo # End of 10.3 tests
+
+--echo #
+--echo # MDEV-18681: AND formula in having with several occurances
+--echo # of the same field f in different conjunct AND f=constant
+--echo #
+
+CREATE TABLE t1 (pk int, f varchar(1));
+INSERT INTO t1 VALUES (2,'x'), (7,'y');
+CREATE TABLE t2 (pk int);
+INSERT INTO t2 VALUES (2), (3);
+
+SELECT t.f
+FROM (SELECT t1.* FROM (t1 JOIN t2 ON (t2.pk = t1.pk))) t
+HAVING t.f != 112 AND t.f = 'x' AND t.f != 'a';
+
+DROP TABLE t1,t2;
+
+--echo # End of 10.4 tests
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index e6a858b..5faadb1 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -159,7 +159,8 @@ static COND *build_equal_items(JOIN *join, COND *cond,
static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
COND *cond,
COND_EQUAL *cond_equal,
- void *table_join_idx);
+ void *table_join_idx,
+ bool do_substitution);
static COND *simplify_joins(JOIN *join, List<TABLE_LIST> *join_list,
COND *conds, bool top, bool in_sj);
static bool check_interleaving_with_nj(JOIN_TAB *next);
@@ -2304,7 +2305,7 @@ int JOIN::optimize_stage2()
if (conds)
{
conds= substitute_for_best_equal_field(thd, NO_PARTICULAR_TAB, conds,
- cond_equal, map2table);
+ cond_equal, map2table, true);
if (unlikely(thd->is_error()))
{
error= 1;
@@ -2320,7 +2321,7 @@ int JOIN::optimize_stage2()
if (having)
{
having= substitute_for_best_equal_field(thd, NO_PARTICULAR_TAB, having,
- having_equal, map2table);
+ having_equal, map2table, false);
if (thd->is_error())
{
error= 1;
@@ -2347,7 +2348,7 @@ int JOIN::optimize_stage2()
*tab->on_expr_ref= substitute_for_best_equal_field(thd, NO_PARTICULAR_TAB,
*tab->on_expr_ref,
tab->cond_equal,
- map2table);
+ map2table, true);
if (unlikely(thd->is_error()))
{
error= 1;
@@ -2377,7 +2378,7 @@ int JOIN::optimize_stage2()
while (equals)
{
ref_item= substitute_for_best_equal_field(thd, tab, ref_item,
- equals, map2table);
+ equals, map2table, true);
if (unlikely(thd->is_fatal_error))
DBUG_RETURN(1);
@@ -15418,7 +15419,8 @@ Item *eliminate_item_equal(THD *thd, COND *cond, COND_EQUAL *upper_levels,
static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
COND *cond,
COND_EQUAL *cond_equal,
- void *table_join_idx)
+ void *table_join_idx,
+ bool do_substitution)
{
Item_equal *item_equal;
COND *org_cond= cond; // Return this in case of fatal error
@@ -15447,7 +15449,8 @@ static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
{
Item *new_item= substitute_for_best_equal_field(thd, context_tab,
item, cond_equal,
- table_join_idx);
+ table_join_idx,
+ do_substitution);
/*
This works OK with PS/SP re-execution as changes are made to
the arguments of AND/OR items only
@@ -15529,7 +15532,7 @@ static COND* substitute_for_best_equal_field(THD *thd, JOIN_TAB *context_tab,
cond= eliminate_item_equal(thd, 0, cond_equal, item_equal);
return cond ? cond : org_cond;
}
- else
+ else if (do_substitution)
{
while (cond_equal)
{
1
0
revision-id: d7ca6d56d9987d62ee848f08ad6f5b275fd32fe4 (mariadb-10.3.6-164-gd7ca6d5)
parent(s): 5b4d6595d26aaaf0bf8bb3c9171cf1da96306a7c
author: Igor Babaev
committer: Igor Babaev
timestamp: 2019-02-23 14:53:27 -0800
message:
MDEV-18679 Server crashes in JOIN::optimize
The bug manifested itself when executing a query with materialized
view/derived/CTE whose specification was a SELECT query contained
another materialized derived and impossible WHERE/HAVING condition
was detected for this SELECT.
As soon as such condition is detected the join structures of all
derived tables used in the SELECT are destroyed. So optimization
of the queries specifying these derived tables is impossible. Besides
it's not needed.
In 10.3 optimization of a materialized derived table is performed before
detection of impossible WHERE/HAVING condition in the embedding SELECT.
---
mysql-test/main/derived_cond_pushdown.result | 22 ++++++++++++++++++++++
mysql-test/main/derived_cond_pushdown.test | 23 +++++++++++++++++++++++
sql/sql_derived.cc | 9 +++++++++
3 files changed, 54 insertions(+)
diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result
index e7e2df4..dae127b 100644
--- a/mysql-test/main/derived_cond_pushdown.result
+++ b/mysql-test/main/derived_cond_pushdown.result
@@ -16743,3 +16743,25 @@ id username id userid logindate
set join_cache_level=default;
DROP TABLE t1,t2;
# End of 10.3 tests
+#
+# MDEV-18679: materialized view with SELECT S containing materialized
+# derived when impossible WHERE has been detected for S
+#
+create table t1 (pk int, f varchar(1));
+insert into t1 values
+(3,'y'), (1,'x'), (7,'z');
+create view v1 as
+select t1.f
+from t1, (select distinct * from t1) t
+where t.f = t1.f and 1 = 0
+group by t1.f;
+select * from v1;
+f
+explain select * from v1;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY <derived2> system NULL NULL NULL NULL 0 Const row not found
+2 DERIVED NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+3 DERIVED t1 ALL NULL NULL NULL NULL 3 Using temporary
+drop view v1;
+drop table t1;
+# End of 10.4 tests
diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test
index 076d39c..ef28dcf 100644
--- a/mysql-test/main/derived_cond_pushdown.test
+++ b/mysql-test/main/derived_cond_pushdown.test
@@ -3263,3 +3263,26 @@ set join_cache_level=default;
DROP TABLE t1,t2;
--echo # End of 10.3 tests
+
+--echo #
+--echo # MDEV-18679: materialized view with SELECT S containing materialized
+--echo # derived when impossible WHERE has been detected for S
+--echo #
+
+create table t1 (pk int, f varchar(1));
+insert into t1 values
+ (3,'y'), (1,'x'), (7,'z');
+
+create view v1 as
+select t1.f
+ from t1, (select distinct * from t1) t
+ where t.f = t1.f and 1 = 0
+group by t1.f;
+
+select * from v1;
+explain select * from v1;
+
+drop view v1;
+drop table t1;
+
+--echo # End of 10.4 tests
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index c8a892a..9919c30 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -1002,6 +1002,15 @@ bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived)
if (unit->optimized)
DBUG_RETURN(FALSE);
unit->optimized= TRUE;
+ if (!join)
+ {
+ /*
+ This happens when derived is used in SELECT for which
+ zer_result_cause != 0.
+ In this case join is already destroyed.
+ */
+ DBUG_RETURN(FALSE);
+ }
}
if ((res= join->optimize()))
goto err;
1
0

[Commits] e71c5614080: MDEV-18383: Missing rows with pushdown condition defined with IF-function
by Galina 23 Feb '19
by Galina 23 Feb '19
23 Feb '19
revision-id: e71c5614080f5cf6db2a581837f20dc31d7ddf6a (mariadb-10.2.22-19-ge71c5614080)
parent(s): 80c3fd184d4eeb66cd520079c3d23595e52cfdc0
author: Galina Shalygina
committer: Galina Shalygina
timestamp: 2019-02-23 22:16:33 +0300
message:
MDEV-18383: Missing rows with pushdown condition defined with IF-function
using Item_cond
This bug is similar with MDEV-16765.
It appears because of the wrong pushdown into HAVING clause while this
pushdown shouldn't be made at all.
This happens because function that checks if Item_cond can be pushed
always returns that it can be pushed.
To fix it new method Item_cond::excl_dep_on_table() was added.
---
mysql-test/r/derived_cond_pushdown.result | 21 +++++++++++++++++++++
mysql-test/t/derived_cond_pushdown.test | 22 ++++++++++++++++++++++
sql/item_cmpfunc.cc | 17 +++++++++++++++++
sql/item_cmpfunc.h | 1 +
4 files changed, 61 insertions(+)
diff --git a/mysql-test/r/derived_cond_pushdown.result b/mysql-test/r/derived_cond_pushdown.result
index 14c8e4d5e8f..00acdf241a6 100644
--- a/mysql-test/r/derived_cond_pushdown.result
+++ b/mysql-test/r/derived_cond_pushdown.result
@@ -10480,4 +10480,25 @@ EXPLAIN
}
DROP VIEW v1,v2;
DROP TABLE t1;
+#
+# MDEV-18383: pushdown condition with the IF structure
+# defined with Item_cond item
+#
+CREATE TABLE t1(a INT, b INT);
+CREATE TABLE t2(c INT, d INT);
+INSERT INTO t1 VALUES (1,2),(3,4),(5,6);
+INSERT INTO t2 VALUES (1,3),(3,7),(5,1);
+SELECT *
+FROM t1,
+(
+SELECT MAX(d) AS max_d,c
+FROM t2
+GROUP BY c
+) AS tab
+WHERE t1.a=tab.c AND
+IF(2,t1.a=1 OR t1.b>5,1=1);
+a b max_d c
+1 2 3 1
+5 6 1 5
+DROP TABLE t1,t2;
# End of 10.2 tests
diff --git a/mysql-test/t/derived_cond_pushdown.test b/mysql-test/t/derived_cond_pushdown.test
index 25cb29e13db..313d77d2332 100644
--- a/mysql-test/t/derived_cond_pushdown.test
+++ b/mysql-test/t/derived_cond_pushdown.test
@@ -2102,4 +2102,26 @@ eval EXPLAIN FORMAT=JSON $q2;
DROP VIEW v1,v2;
DROP TABLE t1;
+--echo #
+--echo # MDEV-18383: pushdown condition with the IF structure
+--echo # defined with Item_cond item
+--echo #
+
+CREATE TABLE t1(a INT, b INT);
+CREATE TABLE t2(c INT, d INT);
+INSERT INTO t1 VALUES (1,2),(3,4),(5,6);
+INSERT INTO t2 VALUES (1,3),(3,7),(5,1);
+
+SELECT *
+FROM t1,
+(
+ SELECT MAX(d) AS max_d,c
+ FROM t2
+ GROUP BY c
+) AS tab
+WHERE t1.a=tab.c AND
+ IF(2,t1.a=1 OR t1.b>5,1=1);
+
+DROP TABLE t1,t2;
+
--echo # End of 10.2 tests
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index 7357e57733a..badb0191471 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -4994,6 +4994,23 @@ Item *Item_cond::build_clone(THD *thd, MEM_ROOT *mem_root)
}
+bool Item_cond::excl_dep_on_table(table_map tab_map)
+{
+ if (used_tables() & OUTER_REF_TABLE_BIT)
+ return false;
+ if (!(used_tables() & ~tab_map))
+ return true;
+ List_iterator_fast<Item> li(list);
+ Item *item;
+ while ((item= li++))
+ {
+ if (!item->excl_dep_on_table(tab_map))
+ return false;
+ }
+ return true;
+}
+
+
bool Item_cond::excl_dep_on_grouping_fields(st_select_lex *sel)
{
List_iterator_fast<Item> li(list);
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 1b119c743d3..d083248f6cd 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -2229,6 +2229,7 @@ class Item_cond :public Item_bool_func
Item_transformer transformer, uchar *arg_t);
bool eval_not_null_tables(void *opt_arg);
Item *build_clone(THD *thd, MEM_ROOT *mem_root);
+ bool excl_dep_on_table(table_map tab_map);
bool excl_dep_on_grouping_fields(st_select_lex *sel);
};
1
0

[Commits] 09bd213: MDEV-18700 EXPLAIN EXTENDED shows a wrong operation for query
by IgorBabaev 23 Feb '19
by IgorBabaev 23 Feb '19
23 Feb '19
revision-id: 09bd2138522787a4e0b015695c462903f4a9e728 (mariadb-10.3.12-65-g09bd213)
parent(s): 4946eb7b54323f98fa2e399e981467733c3b0914
author: Igor Babaev
committer: Igor Babaev
timestamp: 2019-02-22 21:38:55 -0800
message:
MDEV-18700 EXPLAIN EXTENDED shows a wrong operation for query
with UNION ALL after INTERSECT
EXPLAIN EXTENDED erroneously showed UNION instead of UNION ALL in
the warning if UNION ALL followed INTERSECT or EXCEPT operations.
The bug was in the function st_select_lex_unit::print() that printed
the text of the query used in the warning.
---
mysql-test/main/union.result | 37 +++++++++++++++++++++++++++++++++++++
mysql-test/main/union.test | 30 ++++++++++++++++++++++++++++++
sql/sql_lex.cc | 4 ++--
3 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result
index da99d65..ef767b1 100644
--- a/mysql-test/main/union.result
+++ b/mysql-test/main/union.result
@@ -2568,5 +2568,42 @@ c1
-10
drop table t1,t2;
#
+# MDEV-18700: EXPLAIN EXTENDED for query with UNION ALL
+# after INTERSECT/EXCEPT operations
+#
+create table t1 (a int);
+insert into t1 values (3), (1), (7), (3), (2), (7), (4);
+create table t2 (a int);
+insert into t2 values (4), (5), (9), (1), (8), (9);
+create table t3 (a int);
+insert into t3 values (8), (1), (8), (2), (3), (7), (2);
+explain extended
+select * from t2 where a < 5
+intersect
+select * from t3 where a < 5
+union all
+select * from t1 where a > 4;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 Using where
+2 INTERSECT t3 ALL NULL NULL NULL NULL 7 100.00 Using where
+3 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where
+NULL UNIT RESULT <unit1,2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where `test`.`t2`.`a` < 5 intersect /* select#2 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where `test`.`t3`.`a` < 5 union all /* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4
+explain extended
+select * from t2 where a < 5
+except
+select * from t3 where a < 5
+union all
+select * from t1 where a > 4;
+id select_type table type possible_keys key key_len ref rows filtered Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 6 100.00 Using where
+2 EXCEPT t3 ALL NULL NULL NULL NULL 7 100.00 Using where
+3 UNION t1 ALL NULL NULL NULL NULL 7 100.00 Using where
+NULL UNIT RESULT <unit1,2,3> ALL NULL NULL NULL NULL NULL NULL
+Warnings:
+Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a` from `test`.`t2` where `test`.`t2`.`a` < 5 except /* select#2 */ select `test`.`t3`.`a` AS `a` from `test`.`t3` where `test`.`t3`.`a` < 5 union all /* select#3 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 4
+drop table t1,t2,t3;
+#
# End of 10.3 tests
#
diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test
index e7543ba..9d9194e 100644
--- a/mysql-test/main/union.test
+++ b/mysql-test/main/union.test
@@ -1812,5 +1812,35 @@ SELECT c1 FROM t1 UNION SELECT - @a FROM t2;
drop table t1,t2;
--echo #
+--echo # MDEV-18700: EXPLAIN EXTENDED for query with UNION ALL
+--echo # after INTERSECT/EXCEPT operations
+--echo #
+
+create table t1 (a int);
+insert into t1 values (3), (1), (7), (3), (2), (7), (4);
+
+create table t2 (a int);
+insert into t2 values (4), (5), (9), (1), (8), (9);
+
+create table t3 (a int);
+insert into t3 values (8), (1), (8), (2), (3), (7), (2);
+
+explain extended
+select * from t2 where a < 5
+intersect
+select * from t3 where a < 5
+union all
+select * from t1 where a > 4;
+
+explain extended
+select * from t2 where a < 5
+except
+select * from t3 where a < 5
+union all
+select * from t1 where a > 4;
+
+drop table t1,t2,t3;
+
+--echo #
--echo # End of 10.3 tests
--echo #
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 430bd2b..4282a8f 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -2897,8 +2897,6 @@ void st_select_lex_unit::print(String *str, enum_query_type query_type)
str->append(STRING_WITH_LEN(" union "));
if (union_all)
str->append(STRING_WITH_LEN("all "));
- else if (union_distinct == sl)
- union_all= TRUE;
break;
case INTERSECT_TYPE:
str->append(STRING_WITH_LEN(" intersect "));
@@ -2907,6 +2905,8 @@ void st_select_lex_unit::print(String *str, enum_query_type query_type)
str->append(STRING_WITH_LEN(" except "));
break;
}
+ if (sl == union_distinct)
+ union_all= TRUE;
}
if (sl->braces)
str->append('(');
1
0
revision-id: 67c0e759ae2d3b433dec5a0aa1da72d6bfc86bac (mariadb-25.3.19-28-g67c0e759)
parent(s): 6b89f2695eb8d5e73c06a93949e7b8d17d12b82a
author: Jan Lindström
committer: Jan Lindström
timestamp: 2019-02-22 15:48:18 +0200
message:
Bump version on build script.
---
scripts/build.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/build.sh b/scripts/build.sh
index ac8eccdf..e3a3e6e8 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -5,7 +5,7 @@ set -eu
# $Id$
# Galera library version
-VERSION="26.4.0"
+VERSION="26.4.1"
get_cores()
{
1
0

21 Feb '19
revision-id: 5b4d6595d26aaaf0bf8bb3c9171cf1da96306a7c (mariadb-10.3.6-163-g5b4d6595d26)
parent(s): 33b9f80595d3dad74bd16e8ac430a93aecf8eddf
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2019-02-21 18:29:17 +0100
message:
fix test to pass on embedded serever
---
mysql-test/suite/innodb/r/full_crc32_import.result | 4 ----
mysql-test/suite/innodb/t/full_crc32_import.test | 4 ++++
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/mysql-test/suite/innodb/r/full_crc32_import.result b/mysql-test/suite/innodb/r/full_crc32_import.result
index 6c68af64c7b..693ad22bab6 100644
--- a/mysql-test/suite/innodb/r/full_crc32_import.result
+++ b/mysql-test/suite/innodb/r/full_crc32_import.result
@@ -34,8 +34,6 @@ db.opt
t1.frm
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-Warnings:
-Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t1.cfg', will attempt to import without schema verification
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@@ -110,8 +108,6 @@ ALTER TABLE t1 ROW_FORMAT=DYNAMIC;
ALTER TABLE t1 DISCARD TABLESPACE;
restore: t1 .ibd and .cfg files
ALTER TABLE t1 IMPORT TABLESPACE;
-Warnings:
-Warning 1810 IO Read error: (2, No such file or directory) Error opening './test/t1.cfg', will attempt to import without schema verification
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/suite/innodb/t/full_crc32_import.test b/mysql-test/suite/innodb/t/full_crc32_import.test
index 71e38ddbafb..f62c68ec543 100644
--- a/mysql-test/suite/innodb/t/full_crc32_import.test
+++ b/mysql-test/suite/innodb/t/full_crc32_import.test
@@ -49,7 +49,9 @@ ib_restore_tablespaces("test", "t1");
EOF
--remove_file $MYSQLD_DATADIR/test/t1.cfg
+--disable_warnings
ALTER TABLE t1 IMPORT TABLESPACE;
+--enable_warnings
SHOW CREATE TABLE t1;
UPDATE t1 set b = repeat("de", 100) where b = repeat("cd", 200);
--replace_column 9 #
@@ -123,7 +125,9 @@ ib_restore_tablespaces("test", "t1");
EOF
--remove_file $MYSQLD_DATADIR/test/t1.cfg
+--disable_warnings
ALTER TABLE t1 IMPORT TABLESPACE;
+--enable_warnings
SHOW CREATE TABLE t1;
UPDATE t1 SET C2 = ST_GeomFromText('POINT(0 0)');
SELECT COUNT(*) FROM t1;
1
0
revision-id: 93ac7ae70ff000353538f732899b421a3f2ea7ce (mariadb-10.3.6-140-g93ac7ae70ff)
parent(s): 4932aba921755cfbc351b92c67068a5c48d3922b a40de1bdeb218d66d5cc737758a4bab1b06f255d
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2019-02-21 14:40:52 +0100
message:
Merge branch '10.3' into 10.4
CMakeLists.txt | 12 +-
client/mysqlbinlog.cc | 23 +-
client/mysqltest.cc | 66 +-
cmake/aws_sdk.cmake | 4 +
cmake/build_configurations/mysql_release.cmake | 1 -
cmake/readline.cmake | 2 +-
cmake/submodules.cmake | 12 +-
config.h.cmake | 6 +-
configure.cmake | 2 +-
debian/autobake-deb.sh | 27 -
extra/mariabackup/backup_copy.cc | 13 +
extra/mariabackup/xtrabackup.cc | 44 +-
include/my_sys.h | 5 +-
include/my_valgrind.h | 4 +-
include/mysql.h | 2 +-
include/mysql.h.pp | 2 +-
libmariadb | 2 +-
mysql-test/include/check-testcase.test | 1 -
mysql-test/include/mtr_check.sql | 1 -
mysql-test/main/alter_table.result | 49 +
mysql-test/main/alter_table.test | 17 +
mysql-test/main/alter_table_errors.result | 6 +
mysql-test/main/alter_table_errors.test | 10 +
mysql-test/main/check.result | 7 +
mysql-test/main/check.test | 9 +
mysql-test/main/check_constraint.result | 2 +-
mysql-test/main/check_constraint.test | 1 -
mysql-test/main/check_constraint_innodb.result | 9 +
mysql-test/main/check_constraint_innodb.test | 14 +
mysql-test/main/disabled.def | 1 +
mysql-test/main/error_simulation.result | 5 +-
mysql-test/main/error_simulation.test | 7 +-
mysql-test/main/func_misc.result | 8 +
mysql-test/main/func_misc.test | 8 +
mysql-test/main/gis.test | 1 -
mysql-test/main/gis2.result | 2 +-
mysql-test/main/mysql.result | 26 +
mysql-test/main/mysql.test | 22 +
mysql-test/main/mysqlbinlog_row_minimal.result | 122 +-
mysql-test/main/mysqlbinlog_row_minimal.test | 41 +
mysql-test/main/row-checksum-old.result | 16 +
mysql-test/main/row-checksum.result | 16 +
mysql-test/main/row-checksum.test | 17 +
mysql-test/main/subselect2.result | 22 +
mysql-test/main/subselect2.test | 20 +
mysql-test/main/subselect_mat.result | 16 +
mysql-test/main/subselect_mat.test | 13 +
mysql-test/main/subselect_sj2_mat.result | 4 +
mysql-test/main/subselect_sj2_mat.test | 2 +
mysql-test/suite/archive/partition_archive.result | 4 +-
mysql-test/suite/archive/partition_archive.test | 3 +-
.../suite/binlog/r/binlog_base64_flag.result | 19 +
.../binlog/r/binlog_mysqlbinlog_row_frag.result | 24 +
mysql-test/suite/binlog/t/binlog_base64_flag.test | 22 +
.../binlog/t/binlog_mysqlbinlog_row_frag.test | 46 +
.../encryption/r/innodb-encryption-alter.result | 4 +-
.../encryption/t/innodb-encryption-alter.test | 2 -
.../suite/encryption/t/innodb-spatial-index.test | 2 -
.../suite/funcs_1/r/is_routines_embedded.result | 6 +-
mysql-test/suite/galera/r/galera_defaults.result | 3 +-
mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf | 1 +
mysql-test/suite/galera_3nodes/galera_3nodes.cnf | 1 +
.../galera_3nodes/include/have_mariabackup.inc | 4 -
.../suite/galera_3nodes/r/galera_garbd.result | 4 +-
.../galera_3nodes/r/galera_var_dirty_reads2.result | 4 +
mysql-test/suite/galera_3nodes/suite.pm | 9 +-
mysql-test/suite/galera_3nodes/t/galera_garbd.test | 16 +-
.../galera_3nodes/t/galera_ipv6_mariabackup.test | 2 +-
.../galera_3nodes/t/galera_var_dirty_reads2.test | 14 +
.../suite/gcol/inc/gcol_column_def_options.inc | 1 -
mysql-test/suite/gcol/inc/gcol_keys.inc | 1 -
mysql-test/suite/gcol/r/gcol_keys_innodb.result | 2 +-
mysql-test/suite/gcol/r/innodb_virtual_fk.result | 4 +-
mysql-test/suite/gcol/t/innodb_virtual_fk.test | 2 -
mysql-test/suite/innodb/r/add_constraint.result | 2 +-
.../suite/innodb/r/alter_foreign_crash.result | 2 +-
.../suite/innodb/r/alter_varchar_change.result | 9 +
mysql-test/suite/innodb/r/foreign_key.result | 57 +-
.../suite/innodb/r/innodb-fk-warnings.result | 24 +-
mysql-test/suite/innodb/r/innodb-fk.result | 6 +-
.../suite/innodb/r/innodb-index-online.result | 2 +-
mysql-test/suite/innodb/r/innodb-index.result | 10 +-
.../suite/innodb/r/innodb_force_recovery.result | 8 +-
.../suite/innodb/r/instant_varchar_enlarge.result | 9 -
.../suite/innodb/r/undo_truncate_recover.result | 1 +
mysql-test/suite/innodb/t/add_constraint.test | 1 -
.../suite/innodb/t/alter_varchar_change.test | 7 +
mysql-test/suite/innodb/t/foreign_key.test | 52 +-
mysql-test/suite/innodb/t/innodb-fk-warnings.test | 18 -
mysql-test/suite/innodb/t/innodb-fk.test | 2 -
mysql-test/suite/innodb/t/innodb-index-online.test | 1 -
mysql-test/suite/innodb/t/innodb-index.test | 5 -
.../innodb/t/innodb-page_compression_tables.test | 4 -
.../suite/innodb/t/innodb_force_recovery.test | 4 -
.../suite/innodb/t/instant_varchar_enlarge.test | 8 -
.../suite/innodb/t/undo_truncate_recover.test | 6 +-
.../suite/innodb_gis/r/alter_spatial_index.result | 2 +-
mysql-test/suite/innodb_gis/r/point_basic.result | 14 +-
mysql-test/suite/innodb_gis/t/point_basic.test | 6 -
.../mariabackup/encrypted_page_compressed.test | 2 +-
.../mariabackup/encrypted_page_corruption.test | 2 +-
.../suite/mariabackup/incremental_rocksdb.opt | 1 +
.../suite/mariabackup/incremental_rocksdb.result | 19 +
.../suite/mariabackup/incremental_rocksdb.test | 38 +
.../suite/mariabackup/log_checksum_mismatch.test | 2 +-
.../mariabackup/unencrypted_page_compressed.test | 2 +-
.../perfschema/r/dml_setup_instruments.result | 4 +-
.../suite/perfschema/t/dml_setup_instruments.test | 5 +-
mysql-test/suite/plugins/t/audit_null.test | 2 +-
mysql-test/suite/rpl/r/rpl_set_statement.test | 0
mysql-test/suite/sys_vars/r/all_vars.result | 1 +
.../r/sysvars_innodb,32bit,xtradb.rdiff-disabled | 1236 +++++++++++
.../r/sysvars_innodb,xtradb.rdiff-disabled | 697 ++++++
mysql-test/suite/sys_vars/r/sysvars_wsrep.result | 14 +
.../sys_vars/r/tmp_disk_table_size_func.result | 2 +-
.../suite/sys_vars/t/tmp_disk_table_size_func.test | 1 -
mysql-test/suite/vcol/inc/vcol_keys.inc | 1 -
mysql-test/suite/vcol/r/vcol_keys_innodb.result | 2 +-
mysys/mf_iocache2.c | 61 +-
mysys/my_delete.c | 61 +
mysys/my_file.c | 7 +-
mysys/my_malloc.c | 1 +
plugin/aws_key_management/CMakeLists.txt | 2 +-
plugin/wsrep_info/mysql-test/wsrep_info/suite.pm | 2 +
scripts/mysql_install_db.sh | 24 +-
scripts/wsrep_sst_mariabackup.sh | 6 +-
scripts/wsrep_sst_rsync.sh | 2 +-
sql-common/client.c | 30 +-
sql/field.cc | 4 +-
sql/item.cc | 18 +-
sql/item_func.cc | 2 +-
sql/item_func.h | 4 +
sql/log.cc | 6 +-
sql/log_event.cc | 386 +++-
sql/log_event.h | 24 +-
sql/log_event_old.cc | 17 +-
sql/partition_info.cc | 2 +-
sql/rpl_tblmap.cc | 20 +-
sql/rpl_tblmap.h | 10 +-
sql/sql_binlog.cc | 91 +-
sql/sql_class.cc | 23 +-
sql/sql_class.h | 2 +-
sql/sql_lex.cc | 3 +-
sql/sql_lex.h | 4 +
sql/sql_repl.cc | 6 +-
sql/sql_select.cc | 21 +-
sql/sql_table.cc | 150 +-
sql/sql_yacc.yy | 19 +-
sql/sql_yacc_ora.yy | 19 +-
sql/sys_vars.cc | 13 +
sql/table.cc | 2 +-
sql/table.h | 12 +-
sql/wsrep_mysqld.cc | 1 +
sql/wsrep_mysqld.h | 1 +
sql/wsrep_mysqld_c.h | 30 +
storage/connect/ha_connect.cc | 45 +-
storage/connect/jsonudf.cpp | 48 +-
storage/connect/jsonudf.h | 5 +
.../mysql-test/connect/r/jdbc_postgresql.result | 2 +-
.../connect/mysql-test/connect/r/part_table.result | 4 +-
.../connect/mysql-test/connect/t/part_table.test | 2 +-
storage/connect/tabext.cpp | 43 +-
storage/connect/tabext.h | 5 +-
storage/connect/tabjdbc.cpp | 89 +-
storage/connect/tabjson.cpp | 46 +-
storage/connect/tabjson.h | 2 +-
storage/connect/tabxml.cpp | 279 +--
storage/connect/tabxml.h | 1 +
storage/innobase/dict/dict0dict.cc | 49 +-
storage/innobase/handler/handler0alter.cc | 107 +-
storage/innobase/handler/i_s.cc | 87 +-
storage/innobase/include/trx0rseg.h | 4 +-
storage/innobase/log/log0recv.cc | 2 +-
storage/innobase/row/row0mysql.cc | 3 -
storage/innobase/row/row0sel.cc | 43 +-
storage/innobase/srv/srv0start.cc | 6 +-
storage/maria/ma_delete.c | 2 -
storage/maria/ma_write.c | 3 +-
storage/maria/maria_def.h | 4 +-
storage/tokudb/PerconaFT/COPYING.APACHEv2 | 174 ++
storage/tokudb/PerconaFT/README.md | 5 +-
storage/tokudb/PerconaFT/ft/txn/txn_manager.h | 4 +-
.../tokudb/PerconaFT/locktree/concurrent_tree.cc | 14 +
.../tokudb/PerconaFT/locktree/concurrent_tree.h | 14 +
storage/tokudb/PerconaFT/locktree/keyrange.cc | 13 +
storage/tokudb/PerconaFT/locktree/keyrange.h | 13 +
storage/tokudb/PerconaFT/locktree/lock_request.cc | 13 +
storage/tokudb/PerconaFT/locktree/lock_request.h | 13 +
storage/tokudb/PerconaFT/locktree/locktree.cc | 13 +
storage/tokudb/PerconaFT/locktree/locktree.h | 13 +
storage/tokudb/PerconaFT/locktree/manager.cc | 13 +
storage/tokudb/PerconaFT/locktree/range_buffer.cc | 13 +
storage/tokudb/PerconaFT/locktree/range_buffer.h | 13 +
storage/tokudb/PerconaFT/locktree/treenode.cc | 13 +
storage/tokudb/PerconaFT/locktree/treenode.h | 13 +
storage/tokudb/PerconaFT/locktree/txnid_set.cc | 13 +
storage/tokudb/PerconaFT/locktree/txnid_set.h | 13 +
storage/tokudb/PerconaFT/locktree/wfg.cc | 13 +
storage/tokudb/PerconaFT/locktree/wfg.h | 13 +
.../PerconaFT/portability/toku_instr_mysql.cc | 12 +-
.../PerconaFT/portability/toku_instr_mysql.h | 11 +-
.../tokudb/PerconaFT/portability/toku_pthread.h | 78 +-
storage/tokudb/PerconaFT/util/growable_array.h | 13 +
storage/tokudb/PerconaFT/util/omt.cc | 2261 +++++++++++---------
storage/tokudb/PerconaFT/util/omt.h | 13 +
storage/tokudb/ha_tokudb.cc | 10 +
storage/tokudb/hatoku_hton.cc | 4 +-
storage/tokudb/hatoku_hton.h | 1 -
.../tokudb/mysql-test/tokudb_bugs/r/PS-4979.result | 2 +
.../tokudb/mysql-test/tokudb_bugs/t/PS-4979.test | 13 +
storage/tokudb/tokudb_background.cc | 4 +-
storage/tokudb/tokudb_sysvars.cc | 14 +-
storage/tokudb/tokudb_sysvars.h | 4 +-
support-files/mysql.server.sh | 6 +-
unittest/mysys/thr_template.c | 4 +-
unittest/sql/mf_iocache-t.cc | 70 +-
win/packaging/heidisql.cmake | 2 +-
217 files changed, 6122 insertions(+), 1986 deletions(-)
diff --cc cmake/aws_sdk.cmake
index 975a3fa6888,00000000000..92e1e78ad3f
mode 100644,000000..100644
--- a/cmake/aws_sdk.cmake
+++ b/cmake/aws_sdk.cmake
@@@ -1,91 -1,0 +1,95 @@@
+MACRO (SKIP_AWS_SDK MSG)
+ SET(${RETVAL} OFF PARENT_SCOPE)
+ SET(${REASON} ${MSG} PARENT_SCOPE)
+ RETURN()
+ENDMACRO()
+
+FUNCTION (CHECK_AWS_SDK RETVAL REASON)
+ # AWS_SDK_EXTERNAL_PROJECT must be ON
+ IF(NOT AWS_SDK_EXTERNAL_PROJECT)
+ SKIP_AWS_SDK("AWS_SDK_EXTERNAL_PROJECT is not ON")
+ ENDIF()
++ IF(NOT NOT_FOR_DISTRIBUTION)
++ SKIP_AWS_SDK("AWS SDK has Apache 2.0 License which is not complatible with GPLv2. Set -DNOT_FOR_DISTRIBUTION=ON if you need it")
++ ENDIF()
+ # Check compiler support
+ IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+ EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
+ IF (GCC_VERSION VERSION_LESS 4.8)
+ SKIP_AWS_SDK("GCC VERSION too old (${GCC_VERSION}, required is 4.8 or later")
+ ENDIF()
+ ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ IF ((CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) OR
+ (CLANG_VERSION_STRING AND CLANG_VERSION_STRING VERSION_LESS 3.3))
+ SKIP_AWS_SDK("Clang version too old, required is 3.3 or later")
+ ENDIF()
+ ELSEIF(MSVC)
+ IF (MSVC_VERSION LESS 1800)
+ SKIP_AWS_SDK("MSVC version too old, required is VS2015 or later")
+ ENDIF()
+ ELSE()
+ SKIP_AWS_SDK("Unsupported compiler")
+ ENDIF()
+
+ # Check OS support
+ IF (NOT(WIN32 OR APPLE OR (CMAKE_SYSTEM_NAME MATCHES "Linux")))
+ SKIP_AWS_SDK("OS unsupported by AWS SDK")
+ ENDIF()
+
+ # Build from source, using ExternalProject_Add
+ # AWS C++ SDK requires cmake 2.8.12
+ IF(CMAKE_VERSION VERSION_LESS "2.8.12")
+ SKIP_AWS_SDK("CMake is too old")
+ ENDIF()
+
+ IF(UNIX)
+ # Check librairies required for building SDK
+ FIND_PACKAGE(CURL)
+ IF(NOT CURL_FOUND)
+ SKIP_AWS_SDK("AWS C++ SDK requires libcurl development package")
+ ENDIF()
+ FIND_PATH(UUID_INCLUDE_DIR uuid/uuid.h)
+ IF(NOT UUID_INCLUDE_DIR)
+ SKIP_AWS_SDK("AWS C++ SDK requires uuid development package")
+ ENDIF()
+ IF(NOT APPLE)
+ FIND_LIBRARY(UUID_LIBRARIES uuid)
+ IF(NOT UUID_LIBRARIES)
+ SKIP_AWS_SDK("AWS C++ SDK requires uuid development package")
+ ENDIF()
+ FIND_PACKAGE(OpenSSL)
+ IF(NOT OPENSSL_FOUND)
+ SKIP_AWS_SDK("AWS C++ SDK requires openssl development package")
+ ENDIF()
+ ENDIF()
+ ENDIF()
+ SET(${RETVAL} ON PARENT_SCOPE)
+ENDFUNCTION()
+
+
+# USE_AWS_SDK_LIBS(target sdk_component1 ... sdk_component_N)
+# Example usage
+# USE_AWS_SDK_LIBS(aws_key_management kms s3)
+FUNCTION(USE_AWS_SDK_LIBS)
+ SET(SDK_COMPONENTS ${ARGN})
+ LIST(GET SDK_COMPONENTS 0 target)
+ IF(NOT TARGET ${target})
+ MESSAGE(FATAL_ERROR "${target} is not a valid target")
+ ENDIF()
++ SET(NON_DISTRIBUTABLE_WARNING "Apache 2.0" CACHE INTERNAL "")
+ LIST(REMOVE_AT SDK_COMPONENTS 0)
+ FOREACH(comp ${SDK_COMPONENTS})
+ SET_PROPERTY(GLOBAL PROPERTY AWS_SDK_LIBS ${comp} APPEND)
+ TARGET_LINK_LIBRARIES(${target} aws-cpp-sdk-${comp})
+ ENDFOREACH()
+ TARGET_LINK_LIBRARIES(${target} aws-cpp-sdk-core)
+ TARGET_INCLUDE_DIRECTORIES(${target} PRIVATE ${PROJECT_BINARY_DIR}/aws_sdk/aws_sdk_cpp/include)
+ # Link OS libraries that AWS SDK depends on
+ IF(WIN32)
+ TARGET_LINK_LIBRARIES(${target} bcrypt winhttp wininet userenv version)
+ ELSE()
+ FIND_PACKAGE(CURL REQUIRED)
+ FIND_PACKAGE(OpenSSL REQUIRED)
+ TARGET_LINK_LIBRARIES(${target} ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES} ${UUID_LIBRARIES})
+ ENDIF()
+ENDFUNCTION()
diff --cc cmake/readline.cmake
index 12a8980b6a9,f1c6f62e311..f7a5291135c
--- a/cmake/readline.cmake
+++ b/cmake/readline.cmake
@@@ -134,7 -134,7 +134,7 @@@ MACRO (MYSQL_FIND_SYSTEM_READLINE
SET(USE_NEW_READLINE_INTERFACE 1)
ELSE()
IF(NOT_FOR_DISTRIBUTION)
- SET(NON_DISTRIBUTABLE_WARNING 1)
- SET(NON_DISTRIBUTABLE_WARNING "GPLv3")
++ SET(NON_DISTRIBUTABLE_WARNING "GPLv3" CACHE INTERNAL "")
SET(USE_NEW_READLINE_INTERFACE 1)
ELSE()
SET(USE_NEW_READLINE_INTERFACE 0)
diff --cc cmake/submodules.cmake
index 9f04c26e8d6,34d1f37c956..c8f7b3cc400
--- a/cmake/submodules.cmake
+++ b/cmake/submodules.cmake
@@@ -31,7 -36,6 +36,6 @@@ ENDIF(
IF(update_result OR NOT EXISTS ${CMAKE_SOURCE_DIR}/libmariadb/CMakeLists.txt)
MESSAGE(FATAL_ERROR "No MariaDB Connector/C! Run
- git submodule update --init --recursive
- Then restart the build.
- ")
- ${GIT_EXECUTABLE} submodule update --init
++ ${GIT_EXECUTABLE} submodule update --init --recursive
+ Then restart the build.${SUBMODULE_UPDATE_CONFIG_MESSAGE}")
ENDIF()
diff --cc configure.cmake
index 08eac106e6a,3cfc4b31d4e..947689d0f86
--- a/configure.cmake
+++ b/configure.cmake
@@@ -260,7 -260,7 +260,7 @@@ SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_
CHECK_INCLUDE_FILES (bfd.h BFD_H_EXISTS)
IF(BFD_H_EXISTS)
IF(NOT_FOR_DISTRIBUTION)
- SET(NON_DISTRIBUTABLE_WARNING 1)
- SET(NON_DISTRIBUTABLE_WARNING "GPLv3")
++ SET(NON_DISTRIBUTABLE_WARNING "GPLv3" CACHE INTERNAL "")
SET(HAVE_BFD_H 1)
ENDIF()
ENDIF()
diff --cc debian/autobake-deb.sh
index 3442afbf376,5ca59e0305d..6ef0cb33553
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@@ -94,36 -94,9 +94,9 @@@ f
# x86 32 bit.
if [[ $GCCVERSION -lt 40800 ]] || [[ $(arch) =~ i[346]86 ]] || [[ $TRAVIS ]]
then
- sed '/Package: mariadb-plugin-rocksdb/,+14d' -i debian/control
+ sed '/Package: mariadb-plugin-rocksdb/,/^$/d' -i debian/control
fi
- # AWS SDK requires c++11 -capable compiler.
- # Minimal supported versions are g++ 4.8 and clang 3.3.
- # AWS SDK also requires the build machine to have network access and git, so
- # it cannot be part of the base version included in Linux distros, but a pure
- # custom built plugin.
- if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && [[ -x "$(command -v git)" ]] && timeout 3s bash -c 'sed -n q </dev/tcp/github.com/22'
- then
- cat <<EOF >> debian/control
-
- Package: mariadb-plugin-aws-key-management
- Architecture: any
- Breaks: mariadb-aws-key-management-10.1,
- mariadb-aws-key-management-10.2
- Replaces: mariadb-aws-key-management-10.1,
- mariadb-aws-key-management-10.2
- Depends: mariadb-server-10.4,
- \${misc:Depends},
- \${shlibs:Depends}
- Description: Amazon Web Service Key Management Service Plugin for MariaDB
- This encryption key management plugin gives an interface to the Amazon Web
- Services Key Management Service for managing encryption keys used for MariaDB
- data-at-rest encryption.
- EOF
-
- sed -i -e "/-DPLUGIN_AWS_KEY_MANAGEMENT=NO/d" debian/rules
- fi
-
# Don't build cassandra package if thrift is not installed
if [[ ! -f /usr/local/include/thrift/Thrift.h && ! -f /usr/include/thrift/Thrift.h ]]
then
diff --cc mysql-test/main/disabled.def
index eecee845a35,b6991cc1d37..c1cfd229a9b
--- a/mysql-test/main/disabled.def
+++ b/mysql-test/main/disabled.def
@@@ -18,6 -21,4 +18,7 @@@ innodb-wl5522-debug-zip : broken upstr
innodb_bug12902967 : broken upstream
file_contents : MDEV-6526 these files are not installed anymore
max_statement_time : cannot possibly work, depends on timing
+ partition_open_files_limit : open_files_limit check broken by MDEV-18360
+mysqlcheck : special tables like proxy , host specific to a system are shown
+flush_read_lock : special tables like proxy , host specific to a system are shown
+join_cache : enable after MDEV-17752 is fixed
diff --cc mysql-test/main/subselect2.result
index 21bf9aad122,cae0f2286c1..0e71f22e52e
--- a/mysql-test/main/subselect2.result
+++ b/mysql-test/main/subselect2.result
@@@ -394,3 -394,25 +394,25 @@@ select null in (select a from t1 where
(select a from t3) +1 < out3.a+1) from t3 out3;
ERROR 21000: Subquery returns more than 1 row
drop table t1, t2, t3;
+ CREATE TABLE t1(
+ q11 int, q12 int, q13 int, q14 int, q15 int, q16 int, q17 int, q18 int, q19 int,
+ q21 int, q22 int, q23 int, q24 int, q25 int, q26 int, q27 int, q28 int, q29 int,
+ f1 int
+ );
+ CREATE TABLE t2(f2 int, f21 int, f3 timestamp, f4 int, f5 int, f6 int);
+ INSERT INTO t1 (f1) VALUES (1),(1),(2),(2);
+ INSERT INTO t2 VALUES (1,1,"2004-02-29 11:11:11",0,0,0), (2,2,"2004-02-29 11:11:11",0,0,0);
+ SELECT f1,
+ (SELECT t.f21 from t2 t where max(
+ q11+q12+q13+q14+q15+q16+q17+q18+q19+
+ q21+q22+q23+q24+q25+q26+q27+q28+q29) = t.f2 UNION
+ SELECT t.f3 FROM t2 AS t WHERE t1.f1=t.f2 AND t.f3=MAX(t1.f1) UNION
+ SELECT 1 LIMIT 1) AS test
+ FROM t1 GROUP BY f1;
+ f1 test
+ 1 1
+ 2 1
+ Warnings:
-Warning 1292 Incorrect datetime value: '1'
-Warning 1292 Incorrect datetime value: '2'
++Warning 1292 Truncated incorrect datetime value: '1'
++Warning 1292 Truncated incorrect datetime value: '2'
+ DROP TABLE t1,t2;
diff --cc mysql-test/main/subselect_sj2_mat.result
index e4583cf6348,884451d7dff..73f682755da
--- a/mysql-test/main/subselect_sj2_mat.result
+++ b/mysql-test/main/subselect_sj2_mat.result
@@@ -1734,6 -1692,6 +1734,10 @@@ insert into t1(`id`,`local_name`) valu
(11,'Rollover - Internet Payday'),
(12,'AL Monthly Installment'),
(13,'AL Semi-Monthly Installment');
++ANALYZE TABLE t1;
++Table Op Msg_type Msg_text
++test.t1 analyze status Engine-independent statistics collected
++test.t1 analyze status OK
explain
SELECT SQL_NO_CACHE t.id
FROM t1 t
diff --cc mysql-test/main/subselect_sj2_mat.test
index 91057f0b201,6ae687aa99a..6eeaceb82b0
--- a/mysql-test/main/subselect_sj2_mat.test
+++ b/mysql-test/main/subselect_sj2_mat.test
@@@ -335,6 -329,6 +335,8 @@@ insert into t1(`id`,`local_name`) valu
(12,'AL Monthly Installment'),
(13,'AL Semi-Monthly Installment');
++ANALYZE TABLE t1;
++
explain
SELECT SQL_NO_CACHE t.id
FROM t1 t
diff --cc mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result
index 00000000000,04846efc274..5f685dfa785
mode 000000,100644..100644
--- a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result
@@@ -1,0 -1,24 +1,24 @@@
+ CREATE TABLE t (a TEXT);
+ RESET MASTER;
+ INSERT INTO t SET a=repeat('a', 1024);
-SELECT a from t into @a;
++SELECT a into @a from t;
+ FLUSH LOGS;
+ DELETE FROM t;
+ FOUND 1 /BINLOG @binlog_fragment_0, @binlog_fragment_1/ in mysqlbinlog.sql
+ SELECT a LIKE @a as 'true' FROM t;
+ true
+ 1
+ BINLOG number-of-fragments must be exactly two
+ BINLOG @binlog_fragment;
+ ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
+ BINLOG @binlog_fragment, @binlog_fragment, @binlog_fragment;
+ ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' @binlog_fragment' at line 1
+ SET @binlog_fragment_0='012345';
+ SET @binlog_fragment_1='012345';
+ BINLOG @binlog_fragment_0, @binlog_fragment_1;
+ ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use
+ SET @binlog_fragment_0='012345';
+ BINLOG @binlog_fragment_0, @binlog_fragment_not_exist;
+ ERROR 42000: Incorrect argument type to variable 'binlog_fragment_not_exist'
+ # Cleanup
+ DROP TABLE t;
diff --cc mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test
index 00000000000,2d55aa79d48..6765b26f3da
mode 000000,100644..100644
--- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test
@@@ -1,0 -1,46 +1,46 @@@
+ --source include/have_debug.inc
+ --source include/have_binlog_format_row.inc
+
+ --let $MYSQLD_DATADIR= `select @@datadir`
+
+ CREATE TABLE t (a TEXT);
+ # events of interest are guaranteed to stay in 000001 log
+ RESET MASTER;
+ --eval INSERT INTO t SET a=repeat('a', 1024)
-SELECT a from t into @a;
++SELECT a into @a from t;
+ FLUSH LOGS;
+ DELETE FROM t;
+
+ # Todo: MDEV-10362 to test multi-row Rows_log_event:s in verbose mode
+ --exec $MYSQL_BINLOG -vv --debug-binlog-row-event-max-encoded-size=256 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+
+ --let SEARCH_PATTERN= BINLOG @binlog_fragment_0, @binlog_fragment_1
+ --let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+ --source include/search_pattern_in_file.inc
+
+ --exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+
+ SELECT a LIKE @a as 'true' FROM t;
+
+ # improper syntax error
+ --echo BINLOG number-of-fragments must be exactly two
+ --error ER_PARSE_ERROR
+ BINLOG @binlog_fragment;
+ --error ER_PARSE_ERROR
+ BINLOG @binlog_fragment, @binlog_fragment, @binlog_fragment;
+
+ # corrupted fragments error check (to the expected error code notice,
+ # the same error code occurs in a similar unfragmented case)
+ SET @binlog_fragment_0='012345';
+ SET @binlog_fragment_1='012345';
+ --error ER_SYNTAX_ERROR
+ BINLOG @binlog_fragment_0, @binlog_fragment_1;
+
+ # Not existing fragment is not allowed
+ SET @binlog_fragment_0='012345';
+ --error ER_WRONG_TYPE_FOR_VAR
+ BINLOG @binlog_fragment_0, @binlog_fragment_not_exist;
+
+ --echo # Cleanup
+ --remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+ DROP TABLE t;
diff --cc mysql-test/suite/encryption/t/innodb-spatial-index.test
index a50ef306351,2bf56817740..0465225cd4f
--- a/mysql-test/suite/encryption/t/innodb-spatial-index.test
+++ b/mysql-test/suite/encryption/t/innodb-spatial-index.test
@@@ -7,21 -6,10 +7,20 @@@
#
#
-# (1) Do not allow creating table with ENCRYPTED=YES
#
#
---error ER_CANT_CREATE_TABLE
+let $checksum_algorithm = `SELECT @@innodb_checksum_algorithm`;
+let $error_code = ER_CANT_CREATE_TABLE, ER_ILLEGAL_HA_CREATE_OPTION;
+if ($checksum_algorithm == "full_crc32")
+{
+ let $error_code = 0;
+}
+if ($checksum_algorithm == "strict_full_crc32")
+{
+ let $error_code = 0;
+}
+
- --replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+--error $error_code
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL, SPATIAL index(coordinate)) ENGINE=INNODB
ENCRYPTED=YES;
@@@ -49,15 -30,14 +48,14 @@@ CREATE TABLE t1 (pk INT PRIMARY KEY AUT
c VARCHAR(256), coordinate POINT NOT NULL) ENCRYPTED=YES ENGINE=INNODB;
# FIXME: MDEV-13851 Encrypted table refuses some form of ALGORITHM=COPY,
# but allows rebuild by FORCE
- --replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE t1 ADD SPATIAL INDEX b(coordinate), ALGORITHM=COPY;
---error ER_ILLEGAL_HA_CREATE_OPTION
-ALTER TABLE t1 ADD SPATIAL INDEX b(coordinate), FORCE, ALGORITHM=INPLACE;
---error ER_ILLEGAL_HA_CREATE_OPTION
+--error $error_code
+ALTER TABLE t1 ADD SPATIAL INDEX b1(coordinate), ALGORITHM=COPY;
+--error $error_code
+ALTER TABLE t1 ADD SPATIAL INDEX b2(coordinate), FORCE, ALGORITHM=INPLACE;
+--error $error_code
ALTER TABLE t1 ADD SPATIAL INDEX(coordinate);
---error ER_ILLEGAL_HA_CREATE_OPTION
-CREATE SPATIAL INDEX b on t1(coordinate);
+--error $error_code
+CREATE SPATIAL INDEX b3 on t1(coordinate);
DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
diff --cc mysql-test/suite/funcs_1/r/is_routines_embedded.result
index 02d2867b657,1739a0c15c8..ec375e9c5f6
--- a/mysql-test/suite/funcs_1/r/is_routines_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_routines_embedded.result
@@@ -197,7 -197,7 +197,7 @@@ sp_6_408002_2 def db_datadict_2 sp_6_40
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
- check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'AUTO_INCREMENT_INCREMENT' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA
.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping,
mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE
R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zon
e, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
++check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE
R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.tim
e_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
connect testuser2, localhost, testuser2, , db_datadict;
SELECT * FROM information_schema.routines;
@@@ -209,7 -209,7 +209,7 @@@ sp_6_408002_2 def db_datadict_2 sp_6_40
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
- check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'AUTO_INCREMENT_INCREMENT' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA
.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping,
mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE
R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zon
e, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
++check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE
R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.tim
e_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
connect testuser3, localhost, testuser3, , test;
SELECT * FROM information_schema.routines;
@@@ -221,7 -221,7 +221,7 @@@ sp_6_408002_2 def db_datadict_2 sp_6_40
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
- check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'AUTO_INCREMENT_INCREMENT' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA
.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping,
mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE
R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zon
e, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
++check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDE
R BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.tim
e_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
connection default;
disconnect testuser1;
diff --cc mysql-test/suite/galera/r/galera_defaults.result
index d0eb22ffcbc,e7a2508c0f3..6dd5258ff6d
--- a/mysql-test/suite/galera/r/galera_defaults.result
+++ b/mysql-test/suite/galera/r/galera_defaults.result
@@@ -1,8 -1,6 +1,8 @@@
-SELECT COUNT(*) = 43 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
-COUNT(*) = 43
-0
+connection node_2;
+connection node_1;
+SELECT COUNT(*) `expect 48` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
+expect 48
- 48
++49
SELECT VARIABLE_NAME, VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME LIKE 'wsrep_%'
diff --cc mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
index 7aac1662edd,477789175fb..a0c7e64af91
--- a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
@@@ -9,7 -9,9 +9,8 @@@ innodb-autoinc-lock-mode=
default-storage-engine=innodb
wsrep_gtid_mode=1
gtid_ignore_duplicates
+ auto_increment_increment=3
-wsrep-on=1
wsrep-provider=(a)ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
# enforce read-committed characteristics across the cluster
diff --cc mysql-test/suite/galera_3nodes/galera_3nodes.cnf
index ab7493e313b,e5aa81b8742..d33ed0caddf
--- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
@@@ -5,7 -5,9 +5,8 @@@
binlog-format=row
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
+ auto_increment_increment=3
-wsrep-on=1
wsrep-provider=(a)ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
# enforce read-committed characteristics across the cluster
diff --cc mysql-test/suite/galera_3nodes/r/galera_garbd.result
index 88bb3ca2ff9,fb7e729dc77..ebc5fdf33f4
--- a/mysql-test/suite/galera_3nodes/r/galera_garbd.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_garbd.result
@@@ -1,10 -1,8 +1,12 @@@
+connection node_2;
+connection node_1;
+connection node_1;
+connection node_2;
- connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+ connection node_1;
+ connection node_2;
connection node_3;
Killing node #3 to free ports for garbd ...
+ connection node_3;
connection node_1;
Starting garbd ...
CREATE TABLE t1 (f1 INTEGER);
diff --cc mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
index 8e6d27823f6,77991a6d468..cb327107e2a
--- a/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
@@@ -1,5 -1,7 +1,9 @@@
+connection node_2;
+connection node_1;
+ connection node_1;
+ connection node_2;
+ connection node_3;
+ connection node_1;
CREATE TABLE t1 (f1 INTEGER);
INSERT INTO t1 VALUES (1);
connection node_2;
diff --cc mysql-test/suite/galera_3nodes/t/galera_garbd.test
index 68e288c06c7,2d03e8897b9..aaa9ecc8083
--- a/mysql-test/suite/galera_3nodes/t/galera_garbd.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_garbd.test
@@@ -7,21 -7,20 +7,31 @@@
--source include/have_innodb.inc
--source include/big_test.inc
+# Save galera ports
+--connection node_1
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT
+
+--connection node_2
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT
+
- --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+ --let $galera_connection_name = node_3
+ --let $galera_server_number = 3
+ --source include/galera_connect.inc
+--source suite/galera/include/galera_base_port.inc
+--let $NODE_GALERAPORT_3 = $_NODE_GALERAPORT
- --connection node_3
+ # Save original auto_increment_offset values.
+ --let $node_1=node_1
+ --let $node_2=node_2
+ --let $node_3=node_3
+ --source ../galera/include/auto_increment_offset_save.inc
+
--echo Killing node #3 to free ports for garbd ...
+ --connection node_3
+ --let $gp3 = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('base_port =', @@wsrep_provider_options) + LENGTH('base_port = '))`
+ --let $galera_port_3 = `SELECT SUBSTR('$gp3', 1, LOCATE(';', '$gp3') - 1)`
--source include/shutdown_mysqld.inc
--connection node_1
diff --cc mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
index 2ceda1ed352,e3f94a012b8..9f9d6da17b9
--- a/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
@@@ -106,8 -117,10 +117,11 @@@ SET GLOBAL wsrep_provider_options='gmca
--source include/wait_condition.inc
--connection node_2
---let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
+--source include/galera_wait_ready.inc
DROP TABLE t1;
+
+ # Restore original auto_increment_offset values.
+ --source ../galera/include/auto_increment_offset_restore.inc
diff --cc mysql-test/suite/innodb/r/undo_truncate_recover.result
index 018ac65537a,bcfc136e8c0..8ab41331950
--- a/mysql-test/suite/innodb/r/undo_truncate_recover.result
+++ b/mysql-test/suite/innodb/r/undo_truncate_recover.result
@@@ -9,6 -9,8 +9,7 @@@ update t1 set c = 'MariaDB'
update t1 set c = 'InnoDB';
set global debug_dbug = '+d,ib_undo_trunc';
commit;
+ call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces");
-call mtr.add_suppression("InnoDB: The redo log transaction size ");
SET GLOBAL innodb_fast_shutdown=0;
FOUND 1 /ib_undo_trunc/ in mysqld.1.err
drop table t1;
diff --cc mysql-test/suite/innodb/t/undo_truncate_recover.test
index 5d680525c5b,c3fa698ff13..1da64497550
--- a/mysql-test/suite/innodb/t/undo_truncate_recover.test
+++ b/mysql-test/suite/innodb/t/undo_truncate_recover.test
@@@ -39,18 -38,14 +39,20 @@@ update t1 set c = 'MariaDB'
update t1 set c = 'InnoDB';
eval set global debug_dbug = '+d,$SEARCH_PATTERN';
commit;
+ call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces");
-# FIXME: remove this work-around, and generate less log!
-call mtr.add_suppression("InnoDB: The redo log transaction size ");
SET GLOBAL innodb_fast_shutdown=0;
--source include/shutdown_mysqld.inc
--source include/search_pattern_in_file.inc
-# FIXME: remove this work-around, and generate less log!
---let $restart_parameters= --innodb-buffer-pool-size=16m --innodb-undo-tablespaces=1
++--let $restart_parameters= --innodb-undo-tablespaces=1
+if ($checksum_algorithm == "strict_full_crc32")
+{
- let $restart_parameters= --innodb_checksum_algorithm=strict_crc32;
++ let $restart_parameters= $restart_parameters --innodb_checksum_algorithm=strict_crc32;
+}
+
+if ($checksum_algorithm == "strict_crc32")
+{
- let $restart_parameters= --innodb_checksum_algorithm=strict_full_crc32;
++ let $restart_parameters= $restart_parameters --innodb_checksum_algorithm=strict_full_crc32;
+}
--source include/start_mysqld.inc
drop table t1;
diff --cc mysql-test/suite/perfschema/r/dml_setup_instruments.result
index e43841c80ac,a5184782af8..a972cf02285
--- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result
+++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
@@@ -16,10 -16,11 +16,12 @@@ wait/synch/mutex/sql/LOCK_after_binlog_
wait/synch/mutex/sql/LOCK_audit_mask YES YES
select * from performance_schema.setup_instruments
where name like 'Wait/Synch/Rwlock/sql/%'
- and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock')
+ and name not in (
+ 'wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock',
+ 'wait/synch/rwlock/sql/LOCK_named_pipe_full_access_group')
order by name limit 10;
NAME ENABLED TIMED
+wait/synch/rwlock/sql/LOCK_all_status_vars YES YES
wait/synch/rwlock/sql/LOCK_dboptions YES YES
wait/synch/rwlock/sql/LOCK_grant YES YES
wait/synch/rwlock/sql/LOCK_SEQUENCE YES YES
diff --cc plugin/aws_key_management/CMakeLists.txt
index b6f48cd18a0,e9e1b49d5f2..248d56e8d76
--- a/plugin/aws_key_management/CMakeLists.txt
+++ b/plugin/aws_key_management/CMakeLists.txt
@@@ -1,14 -1,174 +1,14 @@@
-# We build parts of AWS C++ SDK as CMake external project
-# The restrictions of the SDK (https://github.com/awslabs/aws-sdk-cpp/blob/master/README.md)
-# are
-
-# - OS : Windows,Linux or OSX
-# - C++11 compiler : VS2013+, gcc 4.8+, clang 3.3+
-# - libcurl development package needs to be present on Unixes
-#
-# If we build SDK outselves, we'll need require GIT to be present on the build machine
-
-
-# Give message why the building this plugin is skipped (only if -DVERBOSE is defined)
-# or if plugin is explicitly requested to build. Then bail out.
-MACRO(SKIP_AWS_PLUGIN msg)
- MESSAGE_ONCE(SKIP_AWS_PLUGIN "Skip aws_key_management - ${msg}")
+INCLUDE(aws_sdk)
+CHECK_AWS_SDK(HAVE_AWS_SDK REASON)
+IF(NOT HAVE_AWS_SDK)
+ MESSAGE_ONCE(AWS_KEY_MANAGEMENT_NO_AWS_SDK "Can't build aws_key_management - AWS SDK not available (${REASON})")
RETURN()
-ENDMACRO()
-SET(CMAKE_CXX_STANDARD 11)
-
-IF(NOT NOT_FOR_DISTRIBUTION)
- SKIP_AWS_PLUGIN("AWS SDK has Apache 2.0 License which is not complatible with GPLv2. Set -DNOT_FOR_DISTRIBUTION=ON if you need this plugin")
-ENDIF()
-
-# This plugin needs recent C++ compilers (AWS C++ SDK header files are using C++11 features)
-SET(CXX11_FLAGS)
-SET(OLD_COMPILER_MSG "AWS SDK requires c++11 -capable compiler (minimal supported versions are g++ 4.8, clang 3.3, VS2103)")
-
-IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
- EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
- IF (GCC_VERSION VERSION_LESS 4.8)
- SKIP_AWS_PLUGIN("${OLD_COMPILER_MSG}")
- ENDIF()
- SET(CXX11_FLAGS "-std=c++11")
-ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- IF ((CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) OR
- (CLANG_VERSION_STRING AND CLANG_VERSION_STRING VERSION_LESS 3.3))
- SKIP_AWS_PLUGIN("${OLD_COMPILER_MSG}")
- ENDIF()
- SET(CXX11_FLAGS "-stdlib=libc++")
-ELSEIF(MSVC)
- IF (MSVC_VERSION LESS 1800)
- SKIP_AWS_PLUGIN("${OLD_COMPILER_MSG}")
- ENDIF()
-ELSE()
- SKIP_AWS_PLUGIN("Compiler not supported by AWS C++ SDK")
-ENDIF()
-
-IF (NOT(WIN32 OR APPLE OR (CMAKE_SYSTEM_NAME MATCHES "Linux")))
- SKIP_AWS_PLUGIN("OS unsupported by AWS SDK")
ENDIF()
+MYSQL_ADD_PLUGIN(aws_key_management
+ aws_key_management_plugin.cc
+ COMPONENT aws-key-management)
-
-FIND_LIBRARY(AWS_CPP_SDK_CORE NAMES aws-cpp-sdk-core PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
-FIND_LIBRARY(AWS_CPP_SDK_KMS NAMES aws-cpp-sdk-kms PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}")
-FIND_PATH(AWS_CPP_SDK_INCLUDE_DIR NAMES aws/kms/KMSClient.h)
-
-IF(AWS_CPP_SDK_CORE AND AWS_CPP_SDK_KMS AND AWS_CPP_SDK_INCLUDE_DIR)
- # AWS C++ SDK installed
- INCLUDE_DIRECTORIES(${AWS_CPP_SDK_INCLUDE_DIR})
- SET(AWS_SDK_LIBS ${AWS_CPP_SDK_CORE} ${AWS_CPP_SDK_KMS})
-ELSE()
- OPTION(AWS_SDK_EXTERNAL_PROJECT "Allow download and build AWS C++ SDK" OFF)
- IF(NOT AWS_SDK_EXTERNAL_PROJECT)
- SKIP_AWS_PLUGIN("AWS_SDK_EXTERNAL_PROJECT is not set")
- ENDIF()
- # Build from source, using ExternalProject_Add
- # AWS C++ SDK requires cmake 2.8.12
- IF(CMAKE_VERSION VERSION_LESS "2.8.12")
- SKIP_AWS_PLUGIN("CMake is too old")
- ENDIF()
- FIND_PACKAGE(Git)
- IF(NOT GIT_FOUND)
- SKIP_AWS_PLUGIN("no GIT")
- ENDIF()
- INCLUDE(ExternalProject)
- IF(UNIX)
- FIND_PACKAGE(CURL)
- IF(NOT CURL_FOUND)
- SKIP_AWS_PLUGIN("AWS C++ SDK requires libcurl development package")
- ENDIF()
- SET(PIC_FLAG -fPIC)
- FIND_PATH(UUID_INCLUDE_DIR uuid/uuid.h)
- IF(NOT UUID_INCLUDE_DIR)
- SKIP_AWS_PLUGIN("AWS C++ SDK requires uuid development package")
- ENDIF()
- IF(NOT APPLE)
- FIND_LIBRARY(UUID_LIBRARIES uuid)
- IF(NOT UUID_LIBRARIES)
- SKIP_AWS_PLUGIN("AWS C++ SDK requires uuid development package")
- ENDIF()
- FIND_PACKAGE(OpenSSL)
- IF(NOT OPENSSL_FOUND)
- SKIP_AWS_PLUGIN("AWS C++ SDK requires openssl development package")
- ENDIF()
- ENDIF()
- ENDIF()
- IF(MSVC)
- SET(EXTRA_SDK_CMAKE_FLAGS -DCMAKE_CXX_FLAGS_DEBUGOPT="" -DCMAKE_EXE_LINKER_FLAGS_DEBUGOPT="" "-DCMAKE_CXX_FLAGS=/wd4530 /wd4577 /WX-")
- ENDIF()
- IF(CMAKE_CXX_COMPILER)
- SET(EXTRA_SDK_CMAKE_FLAGS ${EXTRA_SDK_CMAKE_FLAGS} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER})
- ENDIF()
-
- SET(byproducts )
- # We do not need to build the whole SDK , just 2 of its libs
- set(AWS_SDK_LIBS aws-cpp-sdk-core aws-cpp-sdk-kms)
- FOREACH(lib ${AWS_SDK_LIBS})
- ADD_LIBRARY(${lib} STATIC IMPORTED GLOBAL)
- ADD_DEPENDENCIES(${lib} aws_sdk_cpp)
- SET(loc "${CMAKE_CURRENT_BINARY_DIR}/aws_sdk_cpp/lib/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}")
- IF(CMAKE_VERSION VERSION_GREATER "3.1")
- SET(byproducts ${byproducts} BUILD_BYPRODUCTS ${loc})
- ENDIF()
- SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LOCATION ${loc})
- ENDFOREACH()
-
- # To be compatible with older cmake, we use older version of the SDK
- IF(CMAKE_VERSION LESS "3.0")
- SET(GIT_TAG "1.0.8")
- ELSE()
- SET(GIT_TAG "1.2.11")
- ENDIF()
-
- SET(AWS_SDK_PATCH_COMMAND )
- ExternalProject_Add(
- aws_sdk_cpp
- GIT_REPOSITORY "https://github.com/awslabs/aws-sdk-cpp.git"
- GIT_TAG ${GIT_TAG}
- UPDATE_COMMAND ""
- SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/aws-sdk-cpp"
- ${byproducts}
- CMAKE_ARGS
- -DBUILD_ONLY=kms
- -DBUILD_SHARED_LIBS=OFF
- -DFORCE_SHARED_CRT=OFF
- -DENABLE_TESTING=OFF
- "-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} ${PIC_FLAG}"
- "-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${PIC_FLAG}"
- "-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} ${PIC_FLAG}"
- "-DCMAKE_CXX_FLAGS_MINSIZEREL=${CMAKE_CXX_FLAGS_MINSIZEREL} ${PIC_FLAG}"
- ${EXTRA_SDK_CMAKE_FLAGS}
- -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/aws_sdk_cpp
- -DCMAKE_INSTALL_LIBDIR=lib
- TEST_COMMAND ""
- )
- SET_TARGET_PROPERTIES(aws_sdk_cpp PROPERTIES EXCLUDE_FROM_ALL TRUE)
-
- IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
- # Need whole-archive , otherwise static libraries are not linked
- SET(AWS_SDK_LIBS -Wl,--whole-archive ${AWS_SDK_LIBS} -Wl,--no-whole-archive)
- ENDIF()
- SET_TARGET_PROPERTIES(aws_sdk_cpp PROPERTIES EXCLUDE_FROM_ALL TRUE)
- INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/aws_sdk_cpp/include)
-ENDIF()
-
-ADD_DEFINITIONS(${SSL_DEFINES}) # Need to know whether openssl should be initialized
-IF(CMAKE_VERSION GREATER "3.0")
- SET(CMAKE_CXX_STANDARD 11)
-ELSE()
- SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}")
-ENDIF()
-IF(WIN32)
- SET(AWS_CPP_SDK_DEPENDENCIES bcrypt winhttp wininet userenv version)
-ELSE()
- SET(AWS_CPP_SDK_DEPENDENCIES ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES} ${UUID_LIBRARIES})
-ENDIF()
-MYSQL_ADD_PLUGIN(aws_key_management aws_key_management_plugin.cc
- LINK_LIBRARIES ${AWS_SDK_LIBS} ${AWS_CPP_SDK_DEPENDENCIES}
- COMPONENT aws-key-management)
-
-IF (TARGET aws_key_management)
- SET(NON_DISTRIBUTABLE_WARNING "Apache 2.0" PARENT_SCOPE)
+IF(TARGET aws_key_management)
+ USE_AWS_SDK_LIBS(aws_key_management kms)
- ENDIF()
+ ENDIF()
diff --cc scripts/mysql_install_db.sh
index 54b5bed4546,52107405525..4ab486186f4
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@@ -37,10 -37,13 +37,13 @@@ force=
in_rpm=0
ip_only=0
cross_bootstrap=0
-auth_root_authentication_method=normal
-auth_root_socket_user='root'
+auth_root_authentication_method=socket
+auth_root_socket_user=""
skip_test_db=0
+ dirname0=`dirname $0 2>/dev/null`
+ dirname0=`dirname $dirname0 2>/dev/null`
+
usage()
{
cat <<EOF
@@@ -343,7 -345,16 +346,18 @@@ the
exit 1
fi
plugindir=`find_in_dirs --dir auth_socket.so $basedir/lib*/plugin $basedir/lib*/mysql/plugin`
+ pamtooldir=$plugindir
+ # relative from where the script was run for a relocatable install
+ elif test -n "$dirname0" -a -x "$rel_mysqld" -a ! "$rel_mysqld" -ef "@sbindir@/mysqld"
+ then
+ basedir="$dirname0"
+ bindir="$basedir/@INSTALL_BINDIR@"
+ resolveip="$bindir/resolveip"
+ mysqld="$rel_mysqld"
+ srcpkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
+ buildpkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
+ plugindir="$basedir/@INSTALL_PLUGINDIR@"
++ pamtooldir=$plugindir
else
basedir="@prefix@"
bindir="@bindir@"
diff --cc sql-common/client.c
index 69404e43613,160a85fd7b5..c66cb1a749d
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@@ -1375,10 -1634,16 +1381,12 @@@ mysql_init(MYSQL *mysql
--enable-local-infile
*/
- #if defined(ENABLED_LOCAL_INFILE) && !defined(MYSQL_SERVER)
+ #if ENABLED_LOCAL_INFILE && !defined(MYSQL_SERVER)
mysql->options.client_flag|= CLIENT_LOCAL_FILES;
+ mysql->auto_local_infile= ENABLED_LOCAL_INFILE == LOCAL_INFILE_MODE_AUTO
+ ? WAIT_FOR_QUERY : ALWAYS_ACCEPT;
#endif
-#ifdef HAVE_SMEM
- mysql->options.shared_memory_base_name= (char*) def_shared_memory_base_name;
-#endif
-
mysql->options.methods_to_use= MYSQL_OPT_GUESS_CONNECTION;
mysql->options.report_data_truncation= TRUE; /* default */
diff --cc sql/item.cc
index a6b4402b6ba,ada79fcb9df..47e10ba4004
--- a/sql/item.cc
+++ b/sql/item.cc
@@@ -1950,9 -2195,34 +1950,14 @@@ bool Item_name_const::is_null(
Item_name_const::Item_name_const(THD *thd, Item *name_arg, Item *val):
- Item(thd), value_item(val), name_item(name_arg)
+ Item_fixed_hybrid(thd), value_item(val), name_item(name_arg)
{
+ StringBuffer<128> name_buffer;
+ String *name_str;
Item::maybe_null= TRUE;
- valid_args= true;
- if (!name_item->basic_const_item() ||
- !(name_str= name_item->val_str(&name_buffer))) // Can't have a NULL name
- goto err;
- set_name(thd, name_str->ptr(), name_str->length(), name_str->charset());
-
- if (value_item->basic_const_item())
- return; // ok
-
- if (value_item->type() == FUNC_ITEM)
- {
- Item_func *value_func= (Item_func *) value_item;
- if (value_func->functype() != Item_func::COLLATE_FUNC &&
- value_func->functype() != Item_func::NEG_FUNC)
- goto err;
-
- if (value_func->key_item()->basic_const_item())
- return; // ok
- }
-
-err:
- valid_args= false;
- my_error(ER_WRONG_ARGUMENTS, MYF(0), "NAME_CONST");
++ if (name_item->basic_const_item() &&
++ (name_str= name_item->val_str(&name_buffer))) // Can't have a NULL name
++ set_name(thd, name_str->ptr(), name_str->length(), name_str->charset());
}
@@@ -1988,16 -2266,12 +1993,10 @@@ Item::Type Item_name_const::type() cons
bool Item_name_const::fix_fields(THD *thd, Item **ref)
{
- char buf[128];
- String *item_name;
- String s(buf, sizeof(buf), &my_charset_bin);
- s.length(0);
-
- if ((!value_item->fixed &&
- value_item->fix_fields(thd, &value_item)) ||
- (!name_item->fixed &&
- name_item->fix_fields(thd, &name_item)) ||
+ if (value_item->fix_fields_if_needed(thd, &value_item) ||
+ name_item->fix_fields_if_needed(thd, &name_item) ||
!value_item->const_item() ||
- !name_item->const_item() ||
- !(item_name= name_item->val_str(&s))) // Can't have a NULL name
+ !name_item->const_item())
{
my_error(ER_RESERVED_SYNTAX, MYF(0), "NAME_CONST");
return TRUE;
diff --cc sql/sql_binlog.cc
index 1fa3cca7c27,60de2923a8f..97b8e2e4f91
--- a/sql/sql_binlog.cc
+++ b/sql/sql_binlog.cc
@@@ -109,6 -109,64 +109,64 @@@ static int check_event_type(int type, R
}
}
+ /**
+ Copy fragments into the standard placeholder thd->lex->comment.str.
+
+ Compute the size of the (still) encoded total,
+ allocate and then copy fragments one after another.
+ The size can exceed max(max_allowed_packet) which is not a
+ problem as no String instance is created off this char array.
+
+ @param thd THD handle
+ @return
+ 0 at success,
+ -1 otherwise.
+ */
+ int binlog_defragment(THD *thd)
+ {
+ user_var_entry *entry[2];
+ LEX_CSTRING name[2]= { thd->lex->comment, thd->lex->ident };
+
+ /* compute the total size */
+ thd->lex->comment.str= NULL;
+ thd->lex->comment.length= 0;
+ for (uint k= 0; k < 2; k++)
+ {
+ entry[k]=
+ (user_var_entry*) my_hash_search(&thd->user_vars, (uchar*) name[k].str,
+ name[k].length);
+ if (!entry[k] || entry[k]->type != STRING_RESULT)
+ {
+ my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), name[k].str);
+ return -1;
+ }
+ thd->lex->comment.length += entry[k]->length;
+ }
+
+ thd->lex->comment.str= // to be freed by the caller
+ (char *) my_malloc(thd->lex->comment.length, MYF(MY_WME));
+ if (!thd->lex->comment.str)
+ {
- my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 1);
++ my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), 1);
+ return -1;
+ }
+
+ /* fragments are merged into allocated buf while the user var:s get reset */
+ size_t gathered_length= 0;
+ for (uint k=0; k < 2; k++)
+ {
+ memcpy(const_cast<char*>(thd->lex->comment.str) + gathered_length, entry[k]->value,
+ entry[k]->length);
+ gathered_length += entry[k]->length;
+ update_hash(entry[k], true, NULL, 0, STRING_RESULT, &my_charset_bin, 0);
+ }
+
+ DBUG_ASSERT(gathered_length == thd->lex->comment.length);
+
+ return 0;
+ }
+
+
/**
Execute a BINLOG statement.
@@@ -171,14 -223,31 +223,31 @@@ void mysql_client_binlog_statement(THD
/*
Out of memory check
*/
- if (!(rli && buf))
+ if (!(rli))
{
- my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 1); /* needed 1 bytes */
+ my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), 1); /* needed 1 bytes */
goto end;
}
DBUG_ASSERT(rli->belongs_to_client());
+ if (unlikely(is_fragmented= thd->lex->comment.str && thd->lex->ident.str))
+ if (binlog_defragment(thd))
+ goto end;
+
+ if (!(coded_len= thd->lex->comment.length))
+ {
+ my_error(ER_SYNTAX_ERROR, MYF(0));
+ goto end;
+ }
+
+ decoded_len= my_base64_needed_decoded_length((int)coded_len);
+ if (!(buf= (char *) my_malloc(decoded_len, MYF(MY_WME))))
+ {
- my_error(ER_OUTOFMEMORY, MYF(ME_FATALERROR), 1);
++ my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), 1);
+ goto end;
+ }
+
for (char const *strptr= thd->lex->comment.str ;
strptr < thd->lex->comment.str + thd->lex->comment.length ; )
{
diff --cc sql/sql_class.h
index 88494f8c169,b1fc89db7f2..361340ee235
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@@ -4420,80 -4375,6 +4420,80 @@@ private
return raised;
}
+private:
+ void push_warning_truncated_priv(Sql_condition::enum_warning_level level,
+ uint sql_errno,
+ const char *type_str, const char *val)
+ {
+ DBUG_ASSERT(sql_errno == ER_TRUNCATED_WRONG_VALUE ||
+ sql_errno == ER_WRONG_VALUE);
+ char buff[MYSQL_ERRMSG_SIZE];
+ CHARSET_INFO *cs= &my_charset_latin1;
+ cs->cset->snprintf(cs, buff, sizeof(buff),
+ ER_THD(this, sql_errno), type_str, val);
+ /*
+ Note: the format string can vary between ER_TRUNCATED_WRONG_VALUE
+ and ER_WRONG_VALUE, but the code passed to push_warning() is
+ always ER_TRUNCATED_WRONG_VALUE. This is intentional.
+ */
+ push_warning(this, level, ER_TRUNCATED_WRONG_VALUE, buff);
+ }
+public:
+ void push_warning_truncated_wrong_value(Sql_condition::enum_warning_level level,
+ const char *type_str, const char *val)
+ {
+ return push_warning_truncated_priv(level, ER_TRUNCATED_WRONG_VALUE,
+ type_str, val);
+ }
+ void push_warning_wrong_value(Sql_condition::enum_warning_level level,
+ const char *type_str, const char *val)
+ {
+ return push_warning_truncated_priv(level, ER_WRONG_VALUE, type_str, val);
+ }
+ void push_warning_truncated_wrong_value(const char *type_str, const char *val)
+ {
+ return push_warning_truncated_wrong_value(Sql_condition::WARN_LEVEL_WARN,
+ type_str, val);
+ }
+ void push_warning_truncated_value_for_field(Sql_condition::enum_warning_level
+ level, const char *type_str,
+ const char *val,
+ const TABLE_SHARE *s,
+ const char *name)
+ {
+ DBUG_ASSERT(name);
+ char buff[MYSQL_ERRMSG_SIZE];
+ CHARSET_INFO *cs= &my_charset_latin1;
+ const char *db_name= s ? s->db.str : NULL;
- const char *table_name= s ? s->error_table_name() : NULL;
++ const char *table_name= s ? s->table_name.str : NULL;
+
+ if (!db_name)
+ db_name= "";
+ if (!table_name)
+ table_name= "";
+ cs->cset->snprintf(cs, buff, sizeof(buff),
+ ER_THD(this, ER_TRUNCATED_WRONG_VALUE_FOR_FIELD),
+ type_str, val, db_name, table_name, name,
+ (ulong) get_stmt_da()->current_row_for_warning());
+ push_warning(this, level, ER_TRUNCATED_WRONG_VALUE, buff);
+
+ }
+ void push_warning_wrong_or_truncated_value(Sql_condition::enum_warning_level level,
+ bool totally_useless_value,
+ const char *type_str,
+ const char *val,
+ const TABLE_SHARE *s,
+ const char *field_name)
+ {
+ if (field_name)
+ push_warning_truncated_value_for_field(level, type_str, val,
+ s, field_name);
+ else if (totally_useless_value)
+ push_warning_wrong_value(level, type_str, val);
+ else
+ push_warning_truncated_wrong_value(level, type_str, val);
+ }
+
public:
/** Overloaded to guard query/query_length fields */
virtual void set_statement(Statement *stmt);
diff --cc sql/sql_repl.cc
index 59f6a45a52f,fdca609f5af..7fc3bb5926d
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@@ -547,19 -556,29 +547,19 @@@ static my_bool adjust_callback(THD *thd
}
-bool log_in_use(const char* log_name)
+void adjust_linfo_offsets(my_off_t purge_offset)
{
- size_t log_name_len = strlen(log_name) + 1;
- THD *tmp;
- bool result = 0;
+ server_threads.iterate(adjust_callback, &purge_offset);
+}
- mysql_mutex_lock(&LOCK_thread_count);
- I_List_iterator<THD> it(threads);
- while ((tmp=it++))
- {
- LOG_INFO* linfo;
- if ((linfo = tmp->current_linfo))
- {
- mysql_mutex_lock(&linfo->lock);
- result = !strncmp(log_name, linfo->log_file_name, log_name_len);
- mysql_mutex_unlock(&linfo->lock);
- if (result)
- break;
- }
- }
-
- mysql_mutex_unlock(&LOCK_thread_count);
+static my_bool log_in_use_callback(THD *thd, const char *log_name)
+{
+ my_bool result= 0;
+ mysql_mutex_lock(&thd->LOCK_thd_data);
+ if (auto linfo= thd->current_linfo)
- result= !memcmp(log_name, linfo->log_file_name, strlen(log_name) + 1);
++ result= !strcmp(log_name, linfo->log_file_name);
+ mysql_mutex_unlock(&thd->LOCK_thd_data);
return result;
}
diff --cc sql/sql_table.cc
index 4dd9d43a7b9,7f2003b765b..a3f1f616edd
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@@ -9762,12 -9818,11 +9786,12 @@@ do_continue:
/* Mark that we have created table in storage engine. */
no_ha_table= false;
+ /* Open the table since we need to copy the data. */
- new_table= thd->create_and_open_tmp_table(new_db_type, &frm,
- alter_ctx.get_tmp_path(),
- alter_ctx.new_db.str,
- alter_ctx.tmp_name.str,
- true, true);
+ new_table=
+ thd->create_and_open_tmp_table(new_db_type, &frm, alter_ctx.get_tmp_path(),
+ alter_ctx.new_db.str,
+ alter_ctx.new_name.str,
+ true, true);
if (!new_table)
goto err_new_table_cleanup;
@@@ -10687,9 -10732,12 +10710,12 @@@ bool mysql_checksum_table(THD *thd, TAB
{
/* calculating table's checksum */
ha_checksum crc= 0;
- uchar null_mask=256 - (1 << t->s->last_null_bit_pos);
+ DBUG_ASSERT(t->s->last_null_bit_pos < 8);
+ uchar null_mask= (t->s->last_null_bit_pos ?
+ (256 - (1 << t->s->last_null_bit_pos)):
+ 0);
- t->use_all_columns();
+ t->use_all_stored_columns();
if (t->file->ha_rnd_init(1))
protocol->store_null();
diff --cc sql/table.cc
index 7682119c241,10543a1b4f0..75f5a464186
--- a/sql/table.cc
+++ b/sql/table.cc
@@@ -5449,8 -5292,8 +5449,8 @@@ int TABLE::verify_constraints(bool igno
}
field_error.append((*chk)->name.str);
my_error(ER_CONSTRAINT_FAILED,
- MYF(ignore_failure ? ME_JUST_WARNING : 0), field_error.c_ptr(),
+ MYF(ignore_failure ? ME_WARNING : 0), field_error.c_ptr(),
- s->db.str, s->error_table_name());
+ s->db.str, s->table_name.str);
return ignore_failure ? VIEW_CHECK_SKIP : VIEW_CHECK_ERROR;
}
}
diff --cc sql/wsrep_mysqld.h
index dc2793c384d,cca66922a24..d12cc835136
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@@ -20,25 -23,15 +20,26 @@@
#ifdef WITH_WSREP
+#include <mysql/plugin.h>
+#include "mysql/service_wsrep.h"
+
+#include <my_global.h>
+#include <my_pthread.h>
+#include "log.h"
+#include "mysqld.h"
+
typedef struct st_mysql_show_var SHOW_VAR;
#include <sql_priv.h>
-//#include "rpl_gtid.h"
-#include "../wsrep/wsrep_api.h"
#include "mdl.h"
-#include "mysqld.h"
#include "sql_table.h"
+ #include "wsrep_mysqld_c.h"
+#include "wsrep/provider.hpp"
+#include "wsrep/streaming_context.hpp"
+#include "wsrep_api.h"
+#include <vector>
+#include "wsrep_server_state.h"
+
#define WSREP_UNDEFINED_TRX_ID ULONGLONG_MAX
class set_var;
diff --cc storage/innobase/handler/handler0alter.cc
index 307374ec700,d3907f2d05e..b1dc295206a
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@@ -10176,12 -9087,12 +10191,13 @@@ commit_try_norebuild
after a successful commit_try_norebuild() call.
@param ha_alter_info algorithm=inplace context
@param ctx In-place ALTER TABLE context for the current partition
+@param altered_table the TABLE after the ALTER
@param table the TABLE before the ALTER
@param trx Data dictionary transaction
- (will be started and committed, for DROP INDEX) */
+ (will be started and committed, for DROP INDEX)
+ @return whether all replacements were found for dropped indexes */
inline MY_ATTRIBUTE((nonnull))
- void
+ bool
commit_cache_norebuild(
/*===================*/
Alter_inplace_info* ha_alter_info,
@@@ -11009,12 -9869,20 +11015,21 @@@ foreign_fail
m_user_thd,
Sql_condition::WARN_LEVEL_WARN,
ER_ALTER_INFO,
- "InnoDB: Could not add foreign"
- " key constraints.");
- } else {
- commit_cache_norebuild(ha_alter_info, ctx,
- altered_table,
- table, trx);
+ "failed to load FOREIGN KEY"
+ " constraints");
+ }
+ } else {
+ bool fk_fail = innobase_update_foreign_cache(
+ ctx, m_user_thd) != DB_SUCCESS;
+
- if (!commit_cache_norebuild(ha_alter_info, ctx, table,
++ if (!commit_cache_norebuild(ha_alter_info, ctx,
++ altered_table, table,
+ trx)) {
+ fk_fail = true;
+ }
+
+ if (fk_fail && m_prebuilt->trx->check_foreigns) {
+ goto foreign_fail;
}
}
1
0

[Commits] af2ebf62cb3: MDEV-18601: Can't create table with ENCRYPTED=DEFAULT when innodb_default_encryption_key_id!=1
by jan 21 Feb '19
by jan 21 Feb '19
21 Feb '19
revision-id: af2ebf62cb332205282d4f34d79850f80b0eedb4 (mariadb-10.1.38-6-gaf2ebf62cb3)
parent(s): 98e185ee373310291825fe6ac87f45afe6a3ccf7
author: Jan Lindström
committer: Jan Lindström
timestamp: 2019-02-21 14:47:53 +0200
message:
MDEV-18601: Can't create table with ENCRYPTED=DEFAULT when innodb_default_encryption_key_id!=1
innodb_check_default_encryption_key_id
Add a new function to check that provided innodb_default_encryption_key_id
is found from key file if it is not same as system default. We need to
accept system default here as it is used e.g. when no encryption configuration
is set.
ha_innobase::check_table_options
Used encryption key_id must be found from key file even
when encryption is disabled by table options or default
encryption is used and encryption is disabled. This is
because encryption can be enabled later and it is possible
only if all existing tables use key_id that is found
from key file. Again we need to accept system default
as it is used on default table creation.
innodb_var_default_encryption_key_id
New test to test variable innodb_default_encryption_key_id
---
.../encryption/r/innodb-encryption-alter.result | 69 +++++-----
.../encryption/r/innodb-page_encryption.result | 2 +-
.../r/innodb_var_default_encryption_key_id.result | 144 +++++++++++++++++++++
.../encryption/t/innodb-encryption-alter.test | 29 +++--
.../t/innodb_var_default_encryption_key_id.test | 101 +++++++++++++++
storage/innobase/handler/ha_innodb.cc | 95 ++++++++++----
storage/xtradb/handler/ha_innodb.cc | 97 ++++++++++----
7 files changed, 438 insertions(+), 99 deletions(-)
diff --git a/mysql-test/suite/encryption/r/innodb-encryption-alter.result b/mysql-test/suite/encryption/r/innodb-encryption-alter.result
index 5245d1da7d0..038e2a2fd47 100644
--- a/mysql-test/suite/encryption/r/innodb-encryption-alter.result
+++ b/mysql-test/suite/encryption/r/innodb-encryption-alter.result
@@ -3,24 +3,18 @@ SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_encrypt_tables = ON;
SET GLOBAL innodb_encryption_threads = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=4;
-Warnings:
-Warning 140 InnoDB: Ignored ENCRYPTION_KEY_ID 4 when encryption is disabled
DROP TABLE t1;
set innodb_default_encryption_key_id = 99;
+Warnings:
+Warning 1210 InnoDB: Ignored innodb_default_encryption_key_id=99 as it is not available in the key file. Using default=1.
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
-Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES;
-ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
-Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available
-Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+DROP TABLE t1;
set innodb_default_encryption_key_id = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES;
SHOW CREATE TABLE t1;
@@ -40,50 +34,57 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`pk`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=4
CREATE TABLE t2 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=1;
-Warnings:
-Warning 140 InnoDB: Ignored ENCRYPTION_KEY_ID 1 when encryption is disabled
ALTER TABLE t1 ENCRYPTION_KEY_ID=99;
ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
SHOW WARNINGS;
Level Code Message
-Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available
+Warning 140 InnoDB: ENCRYPTION_KEY_ID=99 not available
Error 1478 Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
set innodb_default_encryption_key_id = 1;
drop table t1,t2;
+set innodb_default_encryption_key_id = 10;
SET GLOBAL innodb_encrypt_tables=OFF;
CREATE TABLE t1 (a int not null primary key) engine=innodb;
ALTER TABLE t1 ENCRYPTION_KEY_ID=4;
-ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
-SHOW WARNINGS;
-Level Code Message
-Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1
-Error 1478 Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=4
DROP TABLE t1;
-CREATE TABLE t2 (a int not null primary key) engine=innodb;
-ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY;
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
+CREATE TABLE t1 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4;
SHOW WARNINGS;
Level Code Message
-Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1
-Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
-SHOW CREATE TABLE t2;
+SHOW CREATE TABLE t1;
Table Create Table
-t2 CREATE TABLE `t2` (
+t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL,
PRIMARY KEY (`a`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1
-DROP TABLE t2;
-CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4;
-ERROR HY000: Can't create table `test`.`t3` (errno: 140 "Wrong create options")
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=4
+ALTER TABLE t1 ENCRYPTION_KEY_ID=10;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=10
+DROP TABLE t1;
+CREATE TABLE t1 (a int not null primary key) engine=innodb ENCRYPTED=NO ENCRYPTION_KEY_ID=10;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTED`=NO `ENCRYPTION_KEY_ID`=10
SHOW WARNINGS;
Level Code Message
-Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1
-Error 1005 Can't create table `test`.`t3` (errno: 140 "Wrong create options")
-Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
+ALTER TABLE t1 ENCRYPTION_KEY_ID=1;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTED`=NO `ENCRYPTION_KEY_ID`=1
+DROP TABLE t1;
+set innodb_default_encryption_key_id = 1;
diff --git a/mysql-test/suite/encryption/r/innodb-page_encryption.result b/mysql-test/suite/encryption/r/innodb-page_encryption.result
index c4814983af4..37c4d6caab1 100644
--- a/mysql-test/suite/encryption/r/innodb-page_encryption.result
+++ b/mysql-test/suite/encryption/r/innodb-page_encryption.result
@@ -13,7 +13,7 @@ create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_f
ERROR HY000: Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
-Warning 140 InnoDB: ENCRYPTION_KEY_ID 3 not available
+Warning 140 InnoDB: ENCRYPTION_KEY_ID=3 not available
Error 1005 Can't create table `test`.`innodb_dynamic` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic encrypted=yes encryption_key_id=33;
diff --git a/mysql-test/suite/encryption/r/innodb_var_default_encryption_key_id.result b/mysql-test/suite/encryption/r/innodb_var_default_encryption_key_id.result
new file mode 100644
index 00000000000..f2af1b86b75
--- /dev/null
+++ b/mysql-test/suite/encryption/r/innodb_var_default_encryption_key_id.result
@@ -0,0 +1,144 @@
+SET @global_start_value = @@global.innodb_default_encryption_key_id;
+SELECT @global_start_value;
+@global_start_value
+1
+SET @@global.innodb_default_encryption_key_id = DEFAULT;
+SELECT @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+SELECT @@innodb_default_encryption_key_id;
+@@innodb_default_encryption_key_id
+1
+SET @@global.innodb_default_encryption_key_id = 4;
+SELECT @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+4
+SET @@global.innodb_default_encryption_key_id = 0;
+ERROR 42000: Variable 'innodb_default_encryption_key_id' can't be set to the value of '0'
+SET @@global.innodb_default_encryption_key_id = -1;
+ERROR 42000: Variable 'innodb_default_encryption_key_id' can't be set to the value of '-1'
+SET @@global.innodb_default_encryption_key_id = 4294967296;
+ERROR 42000: Variable 'innodb_default_encryption_key_id' can't be set to the value of '4294967296'
+SET @@global.innodb_default_encryption_key_id = "t";
+ERROR 42000: Incorrect argument type to variable 'innodb_default_encryption_key_id'
+SET @@global.innodb_default_encryption_key_id = NULL;
+ERROR 42000: Incorrect argument type to variable 'innodb_default_encryption_key_id'
+SET @@global.innodb_default_encryption_key_id = 99;
+Warnings:
+Warning 1210 InnoDB: Ignored innodb_default_encryption_key_id=99 as it is not available in the key file. Using default=1.
+SELECT @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+SET @@global.innodb_default_encryption_key_id = 4294967295;
+Warnings:
+Warning 1210 InnoDB: Ignored innodb_default_encryption_key_id=4294967295 as it is not available in the key file. Using default=1.
+SELECT @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+SELECT @@global.innodb_default_encryption_key_id =
+VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_default_encryption_key_id';
+@@global.innodb_default_encryption_key_id =
+VARIABLE_VALUE
+1
+SELECT @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='innodb_default_encryption_key_id';
+VARIABLE_VALUE
+1
+SET @@global.innodb_default_encryption_key_id = @global_start_value;
+SELECT @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+select @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+select @@session.innodb_default_encryption_key_id;
+@@session.innodb_default_encryption_key_id
+1
+create table t1(a int not null primary key) engine=innodb encrypted=yes;
+show create table t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes
+create table t2(a int not null primary key) engine=innodb encrypted=no;
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=no
+create table t3(a int not null primary key) engine=innodb;
+show create table t3;
+Table Create Table
+t3 CREATE TABLE `t3` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+set session innodb_default_encryption_key_id = 2;
+select @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+select @@session.innodb_default_encryption_key_id;
+@@session.innodb_default_encryption_key_id
+2
+create table t11(a int not null primary key) engine=innodb encrypted=yes;
+show create table t11;
+Table Create Table
+t11 CREATE TABLE `t11` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `ENCRYPTION_KEY_ID`=2
+create table t12(a int not null primary key) engine=innodb encrypted=no;
+show create table t12;
+Table Create Table
+t12 CREATE TABLE `t12` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=no `ENCRYPTION_KEY_ID`=2
+create table t13(a int not null primary key) engine=innodb;
+show create table t13;
+Table Create Table
+t13 CREATE TABLE `t13` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=2
+set session innodb_default_encryption_key_id = 4;
+select @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+select @@session.innodb_default_encryption_key_id;
+@@session.innodb_default_encryption_key_id
+4
+create table t21(a int not null primary key) engine=innodb encrypted=yes;
+show create table t21;
+Table Create Table
+t21 CREATE TABLE `t21` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=yes `ENCRYPTION_KEY_ID`=4
+create table t22(a int not null primary key) engine=innodb encrypted=no;
+show create table t22;
+Table Create Table
+t22 CREATE TABLE `t22` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `encrypted`=no `ENCRYPTION_KEY_ID`=4
+create table t23(a int not null primary key) engine=innodb;
+show create table t23;
+Table Create Table
+t23 CREATE TABLE `t23` (
+ `a` int(11) NOT NULL,
+ PRIMARY KEY (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 `ENCRYPTION_KEY_ID`=4
+select @@global.innodb_default_encryption_key_id;
+@@global.innodb_default_encryption_key_id
+1
+select @@session.innodb_default_encryption_key_id;
+@@session.innodb_default_encryption_key_id
+1
+drop table t1,t2,t3,t11,t12,t13,t21,t22,t23;
diff --git a/mysql-test/suite/encryption/t/innodb-encryption-alter.test b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
index 9465226dd96..d1a856a0011 100644
--- a/mysql-test/suite/encryption/t/innodb-encryption-alter.test
+++ b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
@@ -20,12 +20,12 @@ SET GLOBAL innodb_encryption_threads = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=NO ENCRYPTION_KEY_ID=4;
DROP TABLE t1;
set innodb_default_encryption_key_id = 99;
---error 1005
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB;
SHOW WARNINGS;
---error 1005
+DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES;
SHOW WARNINGS;
+DROP TABLE t1;
set innodb_default_encryption_key_id = 4;
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT, c VARCHAR(256)) ENGINE=INNODB ENCRYPTED=YES;
SHOW CREATE TABLE t1;
@@ -89,27 +89,30 @@ drop table t1,t2;
#
# MDEV-17230: encryption_key_id from alter is ignored by encryption threads
+# MDEV-18601: Can't create table with ENCRYPTED=DEFAULT when innodb_default_encryption_key_id!=1
#
+set innodb_default_encryption_key_id = 10;
SET GLOBAL innodb_encrypt_tables=OFF;
CREATE TABLE t1 (a int not null primary key) engine=innodb;
---error ER_ILLEGAL_HA_CREATE_OPTION
ALTER TABLE t1 ENCRYPTION_KEY_ID=4;
-SHOW WARNINGS;
SHOW CREATE TABLE t1;
DROP TABLE t1;
-CREATE TABLE t2 (a int not null primary key) engine=innodb;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
---error ER_CANT_CREATE_TABLE
-ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
+CREATE TABLE t1 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4;
SHOW WARNINGS;
-SHOW CREATE TABLE t2;
-DROP TABLE t2;
+SHOW CREATE TABLE t1;
+ALTER TABLE t1 ENCRYPTION_KEY_ID=10;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
---error ER_CANT_CREATE_TABLE
-CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4;
+CREATE TABLE t1 (a int not null primary key) engine=innodb ENCRYPTED=NO ENCRYPTION_KEY_ID=10;
+SHOW CREATE TABLE t1;
SHOW WARNINGS;
+ALTER TABLE t1 ENCRYPTION_KEY_ID=1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+set innodb_default_encryption_key_id = 1;
# reset system
--disable_query_log
diff --git a/mysql-test/suite/encryption/t/innodb_var_default_encryption_key_id.test b/mysql-test/suite/encryption/t/innodb_var_default_encryption_key_id.test
new file mode 100644
index 00000000000..779bcc5300b
--- /dev/null
+++ b/mysql-test/suite/encryption/t/innodb_var_default_encryption_key_id.test
@@ -0,0 +1,101 @@
+-- source include/have_innodb.inc
+-- source include/have_file_key_management_plugin.inc
+
+--disable_query_log
+SET @global_file_format = @@global.innodb_file_format;
+SET @global_file_per_table = @@global.innodb_file_per_table;
+--enable_query_log
+
+--disable_query_log
+--disable_warnings
+SET GLOBAL innodb_file_format = `Barracuda`;
+SET GLOBAL innodb_file_per_table = ON;
+--enable_warnings
+--enable_query_log
+
+SET @global_start_value = @@global.innodb_default_encryption_key_id;
+SELECT @global_start_value;
+
+SET @@global.innodb_default_encryption_key_id = DEFAULT;
+SELECT @@global.innodb_default_encryption_key_id;
+SELECT @@innodb_default_encryption_key_id;
+
+SET @@global.innodb_default_encryption_key_id = 4;
+SELECT @@global.innodb_default_encryption_key_id;
+
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_default_encryption_key_id = 0;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_default_encryption_key_id = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.innodb_default_encryption_key_id = 4294967296;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_default_encryption_key_id = "t";
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.innodb_default_encryption_key_id = NULL;
+
+SET @@global.innodb_default_encryption_key_id = 99;
+SELECT @@global.innodb_default_encryption_key_id;
+
+SET @@global.innodb_default_encryption_key_id = 4294967295;
+SELECT @@global.innodb_default_encryption_key_id;
+
+SELECT @@global.innodb_default_encryption_key_id =
+ VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_default_encryption_key_id';
+SELECT @@global.innodb_default_encryption_key_id;
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+ WHERE VARIABLE_NAME='innodb_default_encryption_key_id';
+
+SET @@global.innodb_default_encryption_key_id = @global_start_value;
+SELECT @@global.innodb_default_encryption_key_id;
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+--connection default
+select @@global.innodb_default_encryption_key_id;
+select @@session.innodb_default_encryption_key_id;
+create table t1(a int not null primary key) engine=innodb encrypted=yes;
+show create table t1;
+create table t2(a int not null primary key) engine=innodb encrypted=no;
+show create table t2;
+create table t3(a int not null primary key) engine=innodb;
+show create table t3;
+
+--connection con1
+set session innodb_default_encryption_key_id = 2;
+select @@global.innodb_default_encryption_key_id;
+select @@session.innodb_default_encryption_key_id;
+create table t11(a int not null primary key) engine=innodb encrypted=yes;
+show create table t11;
+create table t12(a int not null primary key) engine=innodb encrypted=no;
+show create table t12;
+create table t13(a int not null primary key) engine=innodb;
+show create table t13;
+
+--connection con2
+set session innodb_default_encryption_key_id = 4;
+select @@global.innodb_default_encryption_key_id;
+select @@session.innodb_default_encryption_key_id;
+create table t21(a int not null primary key) engine=innodb encrypted=yes;
+show create table t21;
+create table t22(a int not null primary key) engine=innodb encrypted=no;
+show create table t22;
+create table t23(a int not null primary key) engine=innodb;
+show create table t23;
+
+--connection default
+select @@global.innodb_default_encryption_key_id;
+select @@session.innodb_default_encryption_key_id;
+--disconnect con1
+--disconnect con2
+drop table t1,t2,t3,t11,t12,t13,t21,t22,t23;
+
+--disable_query_log
+--disable_warnings
+SET @@global.innodb_file_format = @global_file_format;
+SET @@global.innodb_file_per_table = @global_file_per_table;
+SET @@global.innodb_default_encryption_key_id = @global_start_value;
+--disable_warnings
+--enable_warnings
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 472fb86288f..326b4136861 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -686,9 +686,58 @@ static int mysql_tmpfile_path(const char *path, const char *prefix)
static void innodb_remember_check_sysvar_funcs();
mysql_var_check_func check_sysvar_enum;
+/*************************************************************//**
+Check whether provided innodb_default_encryption_key_id is
+found from key file if it is not same as system default.
+This function is registered as a callback with MySQL.
+@return 0 for valid key_id */
+static int innodb_check_default_encryption_key_id(
+ THD* thd, /*!< in: thread handle */
+ struct st_mysql_sys_var* var, /*!< in: pointer to system
+ variable */
+ void* save, /*!< out: immediate result
+ for update function */
+ struct st_mysql_value* value) /*!< in: incoming value */
+{
+ long long intbuf;
+ uint key_id;
+
+ if (value->val_int(value, &intbuf)) {
+ /* The value is NULL. That is invalid. */
+ return(1);
+ }
+
+ if (intbuf < 1 || intbuf > UINT_MAX32) {
+ /* Invalid value */
+ return(1);
+ }
+
+ key_id = static_cast<uint>(intbuf);
+
+ if (key_id != FIL_DEFAULT_ENCRYPTION_KEY) {
+ /* If user has requested key_id that is not same as
+ system default check that key is found from key file.
+ If it is not found fall back to default. */
+ if (!encryption_key_id_exists(key_id)) {
+ push_warning_printf(
+ thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_ARGUMENTS,
+ "InnoDB: Ignored innodb_default_encryption_key_id=%u as "
+ "it is not available in the key file. Using default=1.",
+ key_id
+ );
+
+ key_id = FIL_DEFAULT_ENCRYPTION_KEY;
+ }
+ }
+
+ *reinterpret_cast<ulint*>(save) = key_id;
+ return (0);
+}
+
static MYSQL_THDVAR_UINT(default_encryption_key_id, PLUGIN_VAR_RQCMDARG,
"Default encryption key id used for table encryption.",
- NULL, NULL,
+ innodb_check_default_encryption_key_id, NULL,
FIL_DEFAULT_ENCRYPTION_KEY, 1, UINT_MAX32, 0);
/**
@@ -11944,41 +11993,37 @@ ha_innobase::check_table_options(
/* If encryption is set up make sure that used key_id is found */
if (encrypt == FIL_ENCRYPTION_ON ||
(encrypt == FIL_ENCRYPTION_DEFAULT && srv_encrypt_tables)) {
- if (!encryption_key_id_exists((unsigned int)options->encryption_key_id)) {
+ if (!encryption_key_id_exists(options->encryption_key_id)) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
- "InnoDB: ENCRYPTION_KEY_ID %u not available",
- (uint)options->encryption_key_id
+ "InnoDB: ENCRYPTION_KEY_ID=%u not available",
+ options->encryption_key_id
);
return "ENCRYPTION_KEY_ID";
}
}
- /* Ignore nondefault key_id if encryption is set off */
- if (encrypt == FIL_ENCRYPTION_OFF &&
- options->encryption_key_id != THDVAR(thd, default_encryption_key_id)) {
- push_warning_printf(
- thd, Sql_condition::WARN_LEVEL_WARN,
- HA_WRONG_CREATE_OPTION,
- "InnoDB: Ignored ENCRYPTION_KEY_ID %u when encryption is disabled",
- (uint)options->encryption_key_id
- );
- options->encryption_key_id = FIL_DEFAULT_ENCRYPTION_KEY;
- }
-
- /* If default encryption is used and encryption is disabled, you may
- not use nondefault encryption_key_id as it is not stored anywhere. */
- if (encrypt == FIL_ENCRYPTION_DEFAULT
- && !srv_encrypt_tables
+ /* Used encryption key_id must be found from key file even
+ when encryption is disabled by table options or default
+ encryption is used and encryption is disabled. This is
+ because encryption can be enabled later and it is possible
+ only if all existing tables use key_id that is found
+ from key file. */
+ if ((encrypt == FIL_ENCRYPTION_OFF
+ || (encrypt == FIL_ENCRYPTION_DEFAULT && !srv_encrypt_tables))
&& options->encryption_key_id != FIL_DEFAULT_ENCRYPTION_KEY) {
compile_time_assert(FIL_DEFAULT_ENCRYPTION_KEY == 1);
- push_warning_printf(
- thd, Sql_condition::WARN_LEVEL_WARN,
- HA_WRONG_CREATE_OPTION,
- "InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1"
+ if (!encryption_key_id_exists(options->encryption_key_id)) {
+
+ push_warning_printf(
+ thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_WRONG_CREATE_OPTION,
+ "InnoDB: ENCRYPTION_KEY_ID=%u not available",
+ options->encryption_key_id
);
- return "ENCRYPTION_KEY_ID";
+ return "ENCRYPTION_KEY_ID";
+ }
}
/* Check atomic writes requirements */
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index c9db941b4bf..66ad3544030 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -5,7 +5,7 @@ Copyright (c) 2013, 2018, MariaDB Corporation.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2018, MariaDB Corporation.
+Copyright (c) 2013, 2019, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -687,9 +687,58 @@ ib_cb_t innodb_api_cb[] = {
static void innodb_remember_check_sysvar_funcs();
mysql_var_check_func check_sysvar_enum;
+/*************************************************************//**
+Check whether provided innodb_default_encryption_key_id is
+found from key file if it is not same as system default.
+This function is registered as a callback with MySQL.
+@return 0 for valid key_id */
+static int innodb_check_default_encryption_key_id(
+ THD* thd, /*!< in: thread handle */
+ struct st_mysql_sys_var* var, /*!< in: pointer to system
+ variable */
+ void* save, /*!< out: immediate result
+ for update function */
+ struct st_mysql_value* value) /*!< in: incoming value */
+{
+ long long intbuf;
+ uint key_id;
+
+ if (value->val_int(value, &intbuf)) {
+ /* The value is NULL. That is invalid. */
+ return(1);
+ }
+
+ if (intbuf < 1 || intbuf > UINT_MAX32) {
+ /* Invalid value */
+ return(1);
+ }
+
+ key_id = static_cast<uint>(intbuf);
+
+ if (key_id != FIL_DEFAULT_ENCRYPTION_KEY) {
+ /* If user has requested key_id that is not same as
+ system default check that key is found from key file.
+ If it is not found fall back to default. */
+ if (!encryption_key_id_exists(key_id)) {
+ push_warning_printf(
+ thd, Sql_condition::WARN_LEVEL_WARN,
+ ER_WRONG_ARGUMENTS,
+ "InnoDB: Ignored innodb_default_encryption_key_id=%u as "
+ "it is not available in the key file. Using default=1.",
+ key_id
+ );
+
+ key_id = FIL_DEFAULT_ENCRYPTION_KEY;
+ }
+ }
+
+ *reinterpret_cast<ulint*>(save) = key_id;
+ return (0);
+}
+
static MYSQL_THDVAR_UINT(default_encryption_key_id, PLUGIN_VAR_RQCMDARG,
"Default encryption key id used for table encryption.",
- NULL, NULL,
+ innodb_check_default_encryption_key_id, NULL,
FIL_DEFAULT_ENCRYPTION_KEY, 1, UINT_MAX32, 0);
/**
@@ -12510,42 +12559,38 @@ ha_innobase::check_table_options(
/* If encryption is set up make sure that used key_id is found */
if (encrypt == FIL_ENCRYPTION_ON ||
(encrypt == FIL_ENCRYPTION_DEFAULT && srv_encrypt_tables)) {
- if (!encryption_key_id_exists((unsigned int)options->encryption_key_id)) {
+ if (!encryption_key_id_exists(options->encryption_key_id)) {
push_warning_printf(
thd, Sql_condition::WARN_LEVEL_WARN,
HA_WRONG_CREATE_OPTION,
- "InnoDB: ENCRYPTION_KEY_ID %u not available",
- (uint)options->encryption_key_id
+ "InnoDB: ENCRYPTION_KEY_ID=%u not available",
+ options->encryption_key_id
);
return "ENCRYPTION_KEY_ID";
}
}
- /* Ignore nondefault key_id if encryption is set off */
- if (encrypt == FIL_ENCRYPTION_OFF &&
- options->encryption_key_id != THDVAR(thd, default_encryption_key_id)) {
- push_warning_printf(
- thd, Sql_condition::WARN_LEVEL_WARN,
- HA_WRONG_CREATE_OPTION,
- "InnoDB: Ignored ENCRYPTION_KEY_ID %u when encryption is disabled",
- (uint)options->encryption_key_id
- );
- options->encryption_key_id = FIL_DEFAULT_ENCRYPTION_KEY;
- }
-
- /* If default encryption is used and encryption is disabled, you may
- not use nondefault encryption_key_id as it is not stored anywhere. */
- if (encrypt == FIL_ENCRYPTION_DEFAULT
- && !srv_encrypt_tables
+ /* Used encryption key_id must be found from key file even
+ when encryption is disabled by table options or default
+ encryption is used and encryption is disabled. This is
+ because encryption can be enabled later and it is possible
+ only if all existing tables use key_id that is found
+ from key file. */
+ if ((encrypt == FIL_ENCRYPTION_OFF
+ || (encrypt == FIL_ENCRYPTION_DEFAULT && !srv_encrypt_tables))
&& options->encryption_key_id != FIL_DEFAULT_ENCRYPTION_KEY) {
compile_time_assert(FIL_DEFAULT_ENCRYPTION_KEY == 1);
- push_warning_printf(
- thd, Sql_condition::WARN_LEVEL_WARN,
- HA_WRONG_CREATE_OPTION,
- "InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1"
+ if (!encryption_key_id_exists(options->encryption_key_id)) {
+
+ push_warning_printf(
+ thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_WRONG_CREATE_OPTION,
+ "InnoDB: ENCRYPTION_KEY_ID=%u not available",
+ options->encryption_key_id
);
- return "ENCRYPTION_KEY_ID";
+ return "ENCRYPTION_KEY_ID";
+ }
}
/* Check atomic writes requirements */
1
0