lists.mariadb.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

commits

Thread Start a new thread
Threads by month
  • ----- 2025 -----
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
commits@lists.mariadb.org

  • 14605 discussions
[Commits] f53e795: MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys.
by holyfootï¼ askmonty.org 04 Feb '19

04 Feb '19
revision-id: f53e795250133a622eb1c00271c073726ae3c7fc (mariadb-10.2.21-65-gf53e795) parent(s): 227379988eac3c9ce7be626477f4d138dc34579d committer: Alexey Botchkov timestamp: 2019-02-05 11:24:19 +0400 message: MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys. The list of table constraints doesn't include foreign keys and uniques. So we replace DROP CONSTRAINT with DROP [FOREIGN] KEY in this case. --- mysql-test/r/alter_table.result | 49 ++++++++++++++++++++++++++++++++++ mysql-test/t/alter_table.test | 17 ++++++++++++ sql/sql_table.cc | 58 +++++++++++++++++++++++++++++++++++++++++ sql/sql_yacc.yy | 9 +++++-- 4 files changed, 131 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index dcee72e..f243d24 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -2456,5 +2456,54 @@ ERROR 23000: Duplicate entry '1' for key 'i' UNLOCK TABLES; DROP TABLE t1; # +# MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys. +# +CREATE TABLE t1(id INT PRIMARY KEY, c1 INT) ENGINE= INNODB; +CREATE TABLE t2(id INT PRIMARY KEY, c1 INT, c2 INT NOT NULL, +CONSTRAINT sid FOREIGN KEY (`c1`) REFERENCES t1 (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, +CONSTRAINT UNIQUE `ui`(c2)) ENGINE= INNODB; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `c1` int(11) DEFAULT NULL, + `c2` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `ui` (`c2`), + KEY `sid` (`c1`), + CONSTRAINT `sid` FOREIGN KEY (`c1`) REFERENCES `t1` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t2 DROP CONSTRAINT sid; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `c1` int(11) DEFAULT NULL, + `c2` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `ui` (`c2`), + KEY `sid` (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t2 DROP CONSTRAINT ui; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `c1` int(11) DEFAULT NULL, + `c2` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `sid` (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t2 DROP CONSTRAINT PRIMARY KEY; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `c1` int(11) DEFAULT NULL, + `c2` int(11) NOT NULL, + KEY `sid` (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t2, t1; +# # End of 10.2 tests # diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index df077c8..e6caadc 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -2013,5 +2013,22 @@ DROP TABLE t1; --echo # +--echo # MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys. +--echo # + +CREATE TABLE t1(id INT PRIMARY KEY, c1 INT) ENGINE= INNODB; +CREATE TABLE t2(id INT PRIMARY KEY, c1 INT, c2 INT NOT NULL, + CONSTRAINT sid FOREIGN KEY (`c1`) REFERENCES t1 (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT UNIQUE `ui`(c2)) ENGINE= INNODB; +SHOW CREATE TABLE t2; +ALTER TABLE t2 DROP CONSTRAINT sid; +SHOW CREATE TABLE t2; +ALTER TABLE t2 DROP CONSTRAINT ui; +SHOW CREATE TABLE t2; +ALTER TABLE t2 DROP CONSTRAINT PRIMARY KEY; +SHOW CREATE TABLE t2; +DROP TABLE t2, t1; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/sql/sql_table.cc b/sql/sql_table.cc index f27b610..1227f14 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -8979,6 +8979,64 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, THD_STAGE_INFO(thd, stage_setup); + if (alter_info->flags & Alter_info::ALTER_DROP_CHECK_CONSTRAINT) + { + /* + ALTER TABLE DROP CONSTRAINT + should be replaced with ... DROP [FOREIGN] KEY + if the constraint is the FOREIGN KEY or UNIQUE one. + */ + + List_iterator<Alter_drop> drop_it(alter_info->drop_list); + Alter_drop *drop; + List <FOREIGN_KEY_INFO> fk_child_key_list; + table->file->get_foreign_key_list(thd, &fk_child_key_list); + + alter_info->flags&= ~Alter_info::ALTER_DROP_CHECK_CONSTRAINT; + + while ((drop= drop_it++)) + { + if (drop->type == Alter_drop::CHECK_CONSTRAINT) + { + { + /* Test if there is a FOREIGN KEY with this name. */ + FOREIGN_KEY_INFO *f_key; + List_iterator<FOREIGN_KEY_INFO> fk_key_it(fk_child_key_list); + + while ((f_key= fk_key_it++)) + { + if (my_strcasecmp(system_charset_info, f_key->foreign_id->str, + drop->name) == 0) + { + drop->type= Alter_drop::FOREIGN_KEY; + alter_info->flags|= Alter_info::DROP_FOREIGN_KEY; + goto do_continue; + } + } + } + + { + /* Test if there is an UNIQUE with this name. */ + uint n_key; + + for (n_key=0; n_key < table->s->keys; n_key++) + { + if ((table->key_info[n_key].flags & HA_NOSAME) && + my_strcasecmp(system_charset_info, + drop->name, table->key_info[n_key].name) == 0) + { + drop->type= Alter_drop::KEY; + alter_info->flags|= Alter_info::ALTER_DROP_INDEX; + goto do_continue; + } + } + } + } + alter_info->flags|= Alter_info::ALTER_DROP_CHECK_CONSTRAINT; +do_continue:; + } + } + handle_if_exists_options(thd, table, alter_info); /* diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 480c2e9..14d084e 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1741,7 +1741,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); IDENT_sys TEXT_STRING_sys TEXT_STRING_literal NCHAR_STRING opt_component key_cache_name sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem ident_or_empty - opt_constraint constraint opt_ident ident_table_alias + opt_constraint opt_constraint_no_id constraint opt_ident ident_table_alias %type <lex_str_ptr> opt_table_alias @@ -6123,6 +6123,11 @@ check_constraint: } ; +opt_constraint_no_id: + /* Empty */ {} + | CONSTRAINT {} + ; + opt_constraint: /* empty */ { $$= null_lex_str; } | constraint { $$= $1; } @@ -7653,7 +7658,7 @@ alter_list_item: lex->alter_info.drop_list.push_back(ad, thd->mem_root); lex->alter_info.flags|= Alter_info::DROP_FOREIGN_KEY; } - | DROP PRIMARY_SYM KEY_SYM + | DROP opt_constraint_no_id PRIMARY_SYM KEY_SYM { LEX *lex=Lex; Alter_drop *ad= (new (thd->mem_root)
1 0
0 0
[Commits] 3390736: MDEV-16188 Post-merge corrections and adjustments
by IgorBabaev 04 Feb '19

04 Feb '19
revision-id: 33907360f56789cd9b467b40e66412eb0a0aff28 (mariadb-10.3.6-101-g3390736) parent(s): 07b7b2e4efb82a50e4575c309bf6987975c4607f author: Igor Babaev committer: Igor Babaev timestamp: 2019-02-04 22:44:33 -0800 message: MDEV-16188 Post-merge corrections and adjustments --- mysql-test/include/gis_keys.inc | 4 +- mysql-test/main/gis.result | 10 +- mysql-test/suite/gcol/inc/gcol_select.inc | 2 +- mysql-test/suite/gcol/r/gcol_keys_myisam.result | 2 +- mysql-test/suite/gcol/r/gcol_select_innodb.result | 16 +-- mysql-test/suite/gcol/r/gcol_select_myisam.result | 38 ++--- mysql-test/suite/heap/heap.result | 2 +- mysql-test/suite/heap/heap_btree.result | 20 +-- mysql-test/suite/heap/heap_hash.result | 8 +- mysql-test/suite/innodb/r/innodb-isolation.result | 6 +- mysql-test/suite/innodb/r/innodb_gis.result | 10 +- .../innodb/r/innodb_skip_innodb_is_tables.result | 3 + mysql-test/suite/innodb/r/mdev-117.result | 2 + mysql-test/suite/innodb/r/monitor.result | 15 +- mysql-test/suite/innodb_gis/r/0.result | 10 +- mysql-test/suite/innodb_gis/r/1.result | 10 +- mysql-test/suite/innodb_gis/r/gis.result | 10 +- .../suite/innodb_gis/r/rtree_estimate.result | 6 +- mysql-test/suite/innodb_gis/t/rtree_estimate.test | 1 + mysql-test/suite/maria/icp.result | 16 ++- mysql-test/suite/maria/ps_maria.result | 2 +- mysql-test/suite/parts/r/optimizer.result | 4 +- .../sys_vars/r/sysvars_server_embedded.result | 22 ++- .../sys_vars/r/sysvars_server_notembedded.result | 2 +- mysql-test/suite/vcol/inc/vcol_select.inc | 2 +- mysql-test/suite/vcol/r/vcol_select_innodb.result | 16 +-- mysql-test/suite/vcol/r/vcol_select_myisam.result | 32 ++--- sql/sys_vars.cc | 2 +- .../mysql-test/connect/r/mysql_index.result | 156 ++++++++++----------- .../connect/mysql-test/connect/r/part_file.result | 9 +- .../connect/mysql-test/connect/t/mysql_index.test | 4 +- .../connect/mysql-test/connect/t/part_file.test | 4 +- storage/innobase/srv/srv0mon.cc | 2 +- storage/myisam/mi_range.c | 6 +- 34 files changed, 242 insertions(+), 212 deletions(-) diff --git a/mysql-test/include/gis_keys.inc b/mysql-test/include/gis_keys.inc index cc8ec68..388c7b4 100644 --- a/mysql-test/include/gis_keys.inc +++ b/mysql-test/include/gis_keys.inc @@ -27,8 +27,8 @@ SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); # the "most rows covered" rule doesn't kick in anymore # now EXPLAIN shows the index used on the table # and we're getting the wrong result again -INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); -INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(3 4)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(3 4)')); EXPLAIN SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index 7695cef..1919555 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -964,29 +964,29 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 -INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); -INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(3 4)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(3 4)')); EXPLAIN SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref p p 28 const # Using where SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 EXPLAIN SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 DROP TABLE t1, t2; End of 5.0 tests # diff --git a/mysql-test/suite/gcol/inc/gcol_select.inc b/mysql-test/suite/gcol/inc/gcol_select.inc index efaffd5..7dcbcc7 100644 --- a/mysql-test/suite/gcol/inc/gcol_select.inc +++ b/mysql-test/suite/gcol/inc/gcol_select.inc @@ -35,7 +35,7 @@ insert into t2 (a) values (1); create table t3 (a int primary key, b int generated always as (-a) virtual, c int generated always as (-a) stored unique); -insert into t3 (a) values (2),(1),(3); +insert into t3 (a) values (2),(1),(3),(5),(4),(7); analyze table t1,t2,t3; --echo # select_type=SIMPLE, type=system diff --git a/mysql-test/suite/gcol/r/gcol_keys_myisam.result b/mysql-test/suite/gcol/r/gcol_keys_myisam.result index 8ef6736..91bd8fc 100644 --- a/mysql-test/suite/gcol/r/gcol_keys_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_keys_myisam.result @@ -205,7 +205,7 @@ outr.col_varchar_nokey in ('c', 'x', 'i') AND (outr.col_time_key IS NULL OR outr.col_datetime_key = '2009-09-27'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE outr ALL col_time_key,col_datetime_key NULL NULL NULL 4 x +1 SIMPLE outr index_merge col_time_key,col_datetime_key col_time_key,col_datetime_key 4,6 NULL 2 x SELECT outr.col_time_key AS x FROM c AS outr diff --git a/mysql-test/suite/gcol/r/gcol_select_innodb.result b/mysql-test/suite/gcol/r/gcol_select_innodb.result index 983e1fb..8288588 100644 --- a/mysql-test/suite/gcol/r/gcol_select_innodb.result +++ b/mysql-test/suite/gcol/r/gcol_select_innodb.result @@ -17,7 +17,7 @@ insert into t2 (a) values (1); create table t3 (a int primary key, b int generated always as (-a) virtual, c int generated always as (-a) stored unique); -insert into t3 (a) values (2),(1),(3); +insert into t3 (a) values (2),(1),(3),(5),(4),(7); analyze table t1,t2,t3; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected @@ -79,8 +79,8 @@ a b c 3 -3 -3 explain select * from t1 where b in (select c from t3); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 index c c 5 NULL 3 Using index -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index # select_type=PRIMARY, type=range,ref select * from t1 where c in (select c from t3 where c between -2 and -1); a b c @@ -89,7 +89,7 @@ a b c 2 -2 -2 explain select * from t1 where c in (select c from t3 where c between -2 and -1); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 index c c 5 NULL 3 Using where; Using index +1 PRIMARY t3 index c c 5 NULL 6 Using where; Using index 1 PRIMARY t1 ALL c NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) # select_type=UNION, type=system # select_type=UNION RESULT, type=<union1,2> @@ -173,7 +173,7 @@ a b c 2 -2 -2 explain select * from t3 where b between -2 and -1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where # SELECT * FROM tbl_name WHERE <indexed gcol expr> select * from t3 where c between -2 and -1; a b c @@ -236,7 +236,7 @@ a b c 2 -2 -2 explain select * from t3 where b between -2 and -1 order by a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index NULL PRIMARY 4 NULL 3 Using where +1 SIMPLE t3 index NULL PRIMARY 4 NULL 6 Using where # SELECT * FROM tbl_name WHERE <non-indexed gcol expr> ORDER BY <non-indexed gcol> select * from t3 where b between -2 and -1 order by b; a b c @@ -244,7 +244,7 @@ a b c 1 -1 -1 explain select * from t3 where b between -2 and -1 order by b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed gcol expr> ORDER BY <non-indexed gcol> select * from t3 where c between -2 and -1 order by b; a b c @@ -260,7 +260,7 @@ a b c 1 -1 -1 explain select * from t3 where b between -2 and -1 order by c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed gcol expr> ORDER BY <indexed gcol> select * from t3 where c between -2 and -1 order by c; a b c diff --git a/mysql-test/suite/gcol/r/gcol_select_myisam.result b/mysql-test/suite/gcol/r/gcol_select_myisam.result index e823458..039484b 100644 --- a/mysql-test/suite/gcol/r/gcol_select_myisam.result +++ b/mysql-test/suite/gcol/r/gcol_select_myisam.result @@ -17,7 +17,7 @@ insert into t2 (a) values (1); create table t3 (a int primary key, b int generated always as (-a) virtual, c int generated always as (-a) stored unique); -insert into t3 (a) values (2),(1),(3); +insert into t3 (a) values (2),(1),(3),(5),(4),(7); analyze table t1,t2,t3; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected @@ -60,7 +60,7 @@ a b c 1 -1 -1 explain select * from t3 where c>=-1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range c c 5 NULL 2 Using index condition +1 SIMPLE t3 range c c 5 NULL 1 Using index condition # select_type=SIMPLE, type=ref select * from t1,t3 where t1.c=t3.c and t3.c=-1; a b c a b c @@ -79,8 +79,8 @@ a b c 3 -3 -3 explain select * from t1 where b in (select c from t3); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 index c c 5 NULL 3 Using index -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index # select_type=PRIMARY, type=range,ref select * from t1 where c in (select c from t3 where c between -2 and -1); a b c @@ -89,7 +89,7 @@ a b c 2 -2 -2 explain select * from t1 where c in (select c from t3 where c between -2 and -1); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 index c c 5 NULL 3 Using where; Using index +1 PRIMARY t3 index c c 5 NULL 6 Using where; Using index 1 PRIMARY t1 ref c c 5 test.t3.c 1 # select_type=UNION, type=system # select_type=UNION RESULT, type=<union1,2> @@ -165,7 +165,7 @@ a b c 2 -2 -2 explain select * from t3 where a between 1 and 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using index condition +1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using index condition # SELECT * FROM tbl_name WHERE <non-indexed gcol expr> select * from t3 where b between -2 and -1; a b c @@ -173,7 +173,7 @@ a b c 2 -2 -2 explain select * from t3 where b between -2 and -1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where # SELECT * FROM tbl_name WHERE <indexed gcol expr> select * from t3 where c between -2 and -1; a b c @@ -181,7 +181,7 @@ a b c 2 -2 -2 explain select * from t3 where c between -2 and -1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range c c 5 NULL 1 Using index condition +1 SIMPLE t3 range c c 5 NULL 2 Using index condition # bug#20022189: WL411:DEBUG ASSERT AT FIELD_LONG::VAL_INT IN SQL/FIELD.CC CREATE TABLE t4 ( `pk` int(11) NOT NULL , @@ -211,7 +211,7 @@ a b c 1 -1 -1 explain select * from t3 where a between 1 and 2 order by c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Using filesort +1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed gcol expr> ORDER BY <non-gcol> select * from t3 where b between -2 and -1 order by a; a b c @@ -219,7 +219,7 @@ a b c 2 -2 -2 explain select * from t3 where b between -2 and -1 order by a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed gcol expr> ORDER BY <non-gcol> select * from t3 where c between -2 and -1 order by a; a b c @@ -227,7 +227,7 @@ a b c 2 -2 -2 explain select * from t3 where c between -2 and -1 order by a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Using filesort +1 SIMPLE t3 range c c 5 NULL 2 Using index condition; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed gcol expr> ORDER BY <non-indexed gcol> select * from t3 where b between -2 and -1 order by b; a b c @@ -235,7 +235,7 @@ a b c 1 -1 -1 explain select * from t3 where b between -2 and -1 order by b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed gcol expr> ORDER BY <non-indexed gcol> select * from t3 where c between -2 and -1 order by b; a b c @@ -243,7 +243,7 @@ a b c 1 -1 -1 explain select * from t3 where c between -2 and -1 order by b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Using filesort +1 SIMPLE t3 range c c 5 NULL 2 Using index condition; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed gcol expr> ORDER BY <indexed gcol> select * from t3 where b between -2 and -1 order by c; a b c @@ -251,7 +251,7 @@ a b c 1 -1 -1 explain select * from t3 where b between -2 and -1 order by c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed gcol expr> ORDER BY <indexed gcol> select * from t3 where c between -2 and -1 order by c; a b c @@ -259,7 +259,7 @@ a b c 1 -1 -1 explain select * from t3 where c between -2 and -1 order by c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range c c 5 NULL 1 Using index condition +1 SIMPLE t3 range c c 5 NULL 2 Using index condition # SELECT sum(<non-indexed gcol>) FROM tbl_name GROUP BY <non-indexed gcol> select sum(b) from t1 group by b; sum(b) @@ -794,15 +794,15 @@ KEY (col_int_key) INSERT INTO cc (col_int_nokey) VALUES (0),(1),(7),(0),(4),(5); EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE cc ALL col_int_key NULL NULL NULL 6 # +1 SIMPLE cc range col_int_key col_int_key 5 NULL 3 # SELECT pk FROM cc WHERE col_int_key > 3; pk -3 5 6 +3 EXPLAIN SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE cc ALL col_int_key NULL NULL NULL 6 # +1 SIMPLE cc range col_int_key col_int_key 5 NULL 3 # SELECT pk FROM cc WHERE col_int_key > 3 ORDER BY 1; pk 3 @@ -1211,7 +1211,7 @@ FROM t0 AS a0, t0 AS a1, t0 AS a2; EXPLAIN SELECT * FROM t1 WHERE i1 > 41 AND i1 <= 43; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 4 NULL 19 Using index condition +1 SIMPLE t1 range idx idx 4 NULL 20 Using index condition SELECT * FROM t1 WHERE i1 > 41 AND i1 <= 43; pk i1 i2 v1 v2 diff --git a/mysql-test/suite/heap/heap.result b/mysql-test/suite/heap/heap.result index 320966d..326142a 100644 --- a/mysql-test/suite/heap/heap.result +++ b/mysql-test/suite/heap/heap.result @@ -66,7 +66,7 @@ a alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index +1 SIMPLE t1 index uniq_id uniq_id 4 NULL 5 Using where; Using index drop table t1; create table t1 (x int not null, y int not null, key x (x), unique y (y)) engine=heap; diff --git a/mysql-test/suite/heap/heap_btree.result b/mysql-test/suite/heap/heap_btree.result index 83d1bcb..28292d9 100644 --- a/mysql-test/suite/heap/heap_btree.result +++ b/mysql-test/suite/heap/heap_btree.result @@ -48,8 +48,8 @@ a alter table t1 add unique uniq_id using BTREE (a); select * from t1 where a > 736494; a -802616 869751 +802616 select * from t1 where a = 736494; a 736494 @@ -59,14 +59,14 @@ a 869751 select * from t1 where a in (869751,736494,226312,802616); a -226312 +869751 736494 +226312 802616 -869751 alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index +1 SIMPLE t1 index uniq_id uniq_id 4 NULL 5 Using where; Using index drop table t1; create table t1 (x int not null, y int not null, key x using BTREE (x,y), unique y using BTREE (y)) engine=heap; @@ -178,7 +178,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range btn btn 10 NULL 1 Using where explain select * from t1 where btn like "h%"; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range btn btn 10 NULL # Using where +1 SIMPLE t1 ALL btn NULL NULL NULL # Using where explain select * from t1 where btn like "a%"; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range btn btn 10 NULL 1 Using where @@ -350,11 +350,11 @@ insert into t1 values (869751),(736494),(226312),(802616),(728912); alter table t1 add unique uniq_id using BTREE (a); select 0+a from t1 where a > 736494; 0+a -802616 869751 +802616 explain select 0+a from t1 where a > 736494; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uniq_id uniq_id 8 NULL 3 Using where +1 SIMPLE t1 ALL uniq_id NULL NULL NULL 5 Using where select 0+a from t1 where a = 736494; 0+a 736494 @@ -370,13 +370,13 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range uniq_id uniq_id 8 NULL 2 Using where select 0+a from t1 where a in (869751,736494,226312,802616); 0+a -226312 +869751 736494 +226312 802616 -869751 explain select 0+a from t1 where a in (869751,736494,226312,802616); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uniq_id uniq_id 8 NULL 4 Using where +1 SIMPLE t1 ALL uniq_id NULL NULL NULL 5 Using where drop table t1; End of 5.3 tests create table t1 (id int, a varchar(300) not null, key using btree(a)) engine=heap; diff --git a/mysql-test/suite/heap/heap_hash.result b/mysql-test/suite/heap/heap_hash.result index 55d4358..4f96827 100644 --- a/mysql-test/suite/heap/heap_hash.result +++ b/mysql-test/suite/heap/heap_hash.result @@ -66,7 +66,7 @@ a alter table t1 engine=myisam; explain select * from t1 where a in (869751,736494,226312,802616); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uniq_id uniq_id 4 NULL 4 Using where; Using index +1 SIMPLE t1 index uniq_id uniq_id 4 NULL 5 Using where; Using index drop table t1; create table t1 (x int not null, y int not null, key x using HASH (x), unique y using HASH (y)) engine=heap; @@ -428,13 +428,13 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range uniq_id uniq_id 8 NULL 2 Using where select 0+a from t1 where a in (869751,736494,226312,802616); 0+a -226312 +869751 736494 +226312 802616 -869751 explain select 0+a from t1 where a in (869751,736494,226312,802616); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range uniq_id uniq_id 8 NULL 4 Using where +1 SIMPLE t1 ALL uniq_id NULL NULL NULL 5 Using where drop table t1; End of 5.3 tests # diff --git a/mysql-test/suite/innodb/r/innodb-isolation.result b/mysql-test/suite/innodb/r/innodb-isolation.result index ce9c530..a308f10 100644 --- a/mysql-test/suite/innodb/r/innodb-isolation.result +++ b/mysql-test/suite/innodb/r/innodb-isolation.result @@ -963,15 +963,15 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 12 # EXPLAIN SELECT c1, c2 FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 8 # +1 PRIMARY t1 index PRIMARY k2 5 NULL 12 # 2 SUBQUERY t1 index NULL k2 5 NULL 12 # EXPLAIN SELECT COUNT(c2) FROM t1 WHERE c1 > ((SELECT COUNT(*) FROM t1) / 2); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 8 # +1 PRIMARY t1 index PRIMARY k2 5 NULL 12 # 2 SUBQUERY t1 index NULL k2 5 NULL 12 # EXPLAIN SELECT COUNT(*) FROM t1 WHERE c1 > (SELECT AVG(c1) FROM t1); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range PRIMARY PRIMARY 4 NULL 7 # +1 PRIMARY t1 index PRIMARY k2 5 NULL 12 # 2 SUBQUERY t1 index NULL k2 5 NULL 12 # # # Make all indexes in t2 obsolete to the active repeatable read transaction diff --git a/mysql-test/suite/innodb/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result index f8b02bb..162219c 100644 --- a/mysql-test/suite/innodb/r/innodb_gis.result +++ b/mysql-test/suite/innodb/r/innodb_gis.result @@ -560,29 +560,29 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 -INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); -INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(3 4)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(3 4)')); EXPLAIN SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref p p 28 const # Using where SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 EXPLAIN SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 DROP TABLE t1, t2; End of 5.0 tests # diff --git a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result index a90cd22..8640783 100644 --- a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result +++ b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result @@ -286,6 +286,9 @@ icp_attempts icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled icp_no_match icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Index push-down condition does not match icp_out_of_range icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Index push-down condition out of range icp_match icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Index push-down condition matches +pk-filter checks pk-filter 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of lookups into PK-filters +pk-filter_positive pk-filter 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter PK-filter test is positive +pk-filter_negative pk-filter 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter PK-filter test is negative select * from information_schema.innodb_ft_default_stopword; value a diff --git a/mysql-test/suite/innodb/r/mdev-117.result b/mysql-test/suite/innodb/r/mdev-117.result index 979f1ae..39a1fc5 100644 --- a/mysql-test/suite/innodb/r/mdev-117.result +++ b/mysql-test/suite/innodb/r/mdev-117.result @@ -12,6 +12,8 @@ DELETE IGNORE FROM t1;; connection con1; DELETE FROM t1 WHERE col_int_key IN (1, 40000000); connection default; +Warnings: +Warning 1205 Lock wait timeout exceeded; try restarting transaction disconnect con1; drop table t1; SET GLOBAL innodb_lock_wait_timeout=default; diff --git a/mysql-test/suite/innodb/r/monitor.result b/mysql-test/suite/innodb/r/monitor.result index 4a72a37..a160eb5 100644 --- a/mysql-test/suite/innodb/r/monitor.result +++ b/mysql-test/suite/innodb/r/monitor.result @@ -251,6 +251,9 @@ icp_attempts disabled icp_no_match disabled icp_out_of_range disabled icp_match disabled +pk-filter checks disabled +pk-filter_positive disabled +pk-filter_negative disabled set global innodb_monitor_enable = all; select name from information_schema.innodb_metrics where status!='enabled'; name @@ -461,7 +464,7 @@ max_count_reset, min_count_reset, count_reset, status from information_schema.innodb_metrics where name like "dml%"; name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 4 NULL 4 4 NULL 4 enabled +dml_reads 2 NULL 2 2 NULL 2 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 0 NULL 0 0 NULL 0 enabled dml_updates 2 NULL 2 2 NULL 2 enabled @@ -475,7 +478,7 @@ max_count_reset, min_count_reset, count_reset, status from information_schema.innodb_metrics where name like "dml%"; name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 6 NULL 6 6 NULL 6 enabled +dml_reads 4 NULL 4 4 NULL 4 enabled dml_inserts 1 NULL 1 1 NULL 1 enabled dml_deletes 2 NULL 2 2 NULL 2 enabled dml_updates 2 NULL 2 2 NULL 2 enabled @@ -489,7 +492,7 @@ max_count_reset, min_count_reset, count_reset, status from information_schema.innodb_metrics where name like "dml%"; name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 6 NULL 6 0 NULL 0 enabled +dml_reads 4 NULL 4 0 NULL 0 enabled dml_inserts 1 NULL 1 0 NULL 0 enabled dml_deletes 2 NULL 2 0 NULL 0 enabled dml_updates 2 NULL 2 0 NULL 0 enabled @@ -505,7 +508,7 @@ max_count_reset, min_count_reset, count_reset, status from information_schema.innodb_metrics where name like "dml%"; name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 enabled +dml_reads 6 NULL 6 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled @@ -519,7 +522,7 @@ max_count_reset, min_count_reset, count_reset, status from information_schema.innodb_metrics where name like "dml%"; name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 enabled +dml_reads 6 NULL 6 2 NULL 2 enabled dml_inserts 3 NULL 3 2 NULL 2 enabled dml_deletes 4 NULL 4 2 NULL 2 enabled dml_updates 2 NULL 2 0 NULL 0 enabled @@ -533,7 +536,7 @@ max_count_reset, min_count_reset, count_reset, status from information_schema.innodb_metrics where name like "dml%"; name max_count min_count count max_count_reset min_count_reset count_reset status -dml_reads 8 NULL 8 2 NULL 2 disabled +dml_reads 6 NULL 6 2 NULL 2 disabled dml_inserts 3 NULL 3 2 NULL 2 disabled dml_deletes 4 NULL 4 2 NULL 2 disabled dml_updates 2 NULL 2 0 NULL 0 disabled diff --git a/mysql-test/suite/innodb_gis/r/0.result b/mysql-test/suite/innodb_gis/r/0.result index ffe4230..6dd2cd1 100644 --- a/mysql-test/suite/innodb_gis/r/0.result +++ b/mysql-test/suite/innodb_gis/r/0.result @@ -560,29 +560,29 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 -INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); -INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(3 4)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(3 4)')); EXPLAIN SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref p p 28 const # Using where SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 EXPLAIN SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 DROP TABLE t1, t2; End of 5.0 tests # diff --git a/mysql-test/suite/innodb_gis/r/1.result b/mysql-test/suite/innodb_gis/r/1.result index 84e7bec..8de9fd3 100644 --- a/mysql-test/suite/innodb_gis/r/1.result +++ b/mysql-test/suite/innodb_gis/r/1.result @@ -943,29 +943,29 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 -INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); -INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(3 4)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(3 4)')); EXPLAIN SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref p p 28 const # Using where SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 EXPLAIN SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 DROP TABLE t1, t2; End of 5.0 tests # diff --git a/mysql-test/suite/innodb_gis/r/gis.result b/mysql-test/suite/innodb_gis/r/gis.result index 65d1e94..6929afd 100644 --- a/mysql-test/suite/innodb_gis/r/gis.result +++ b/mysql-test/suite/innodb_gis/r/gis.result @@ -939,29 +939,29 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 1 -INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(1 2)')); -INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(1 2)')); +INSERT INTO t1 VALUES (POINTFROMTEXT('POINT(3 4)')); +INSERT INTO t2 VALUES (POINTFROMTEXT('POINT(3 4)')); EXPLAIN SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ref p p 28 const # Using where SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 EXPLAIN SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using where SELECT COUNT(*) FROM t2 IGNORE INDEX(p) WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) -2 +1 DROP TABLE t1, t2; End of 5.0 tests # diff --git a/mysql-test/suite/innodb_gis/r/rtree_estimate.result b/mysql-test/suite/innodb_gis/r/rtree_estimate.result index dafcc40..edb3777 100644 --- a/mysql-test/suite/innodb_gis/r/rtree_estimate.result +++ b/mysql-test/suite/innodb_gis/r/rtree_estimate.result @@ -30,7 +30,7 @@ ST_AsText(g) POINT(10 10) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRDisjoint(g, @g1); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range g g 34 NULL 2 Using where +1 SIMPLE t1 ALL g NULL NULL NULL 3 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g1); ST_AsText(g) POINT(10 10) @@ -75,14 +75,14 @@ POINT(10 10) POLYGON((5 5,20 5,20 21,5 21,5 5)) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRIntersects(g, @g2); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range g g 34 NULL 2 Using where +1 SIMPLE t1 ALL g NULL NULL NULL 3 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g2); ST_AsText(g) POINT(10 10) POLYGON((5 5,20 5,20 21,5 21,5 5)) EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g2); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range g g 34 NULL 2 Using where +1 SIMPLE t1 ALL g NULL NULL NULL 3 Using where SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g2); ST_AsText(g) POINT(10 10) diff --git a/mysql-test/suite/innodb_gis/t/rtree_estimate.test b/mysql-test/suite/innodb_gis/t/rtree_estimate.test index 4caa5fe..7038799 100644 --- a/mysql-test/suite/innodb_gis/t/rtree_estimate.test +++ b/mysql-test/suite/innodb_gis/t/rtree_estimate.test @@ -15,6 +15,7 @@ SET @g1 = ST_GeomFromText('POINT(10 10)'); SET @g2 = ST_GeomFromText('POLYGON((5 5, 20 5, 20 21, 5 21, 5 5))'); SET @g3 = ST_GeomFromText('POLYGON((1.79769e+308 1.79769e+308, 20 5, -1.79769e+308 -1.79769e+308, 1.79769e+308 1.79769e+308))'); + # Test empty table EXPLAIN SELECT ST_AsText(g) FROM t1 WHERE MBRContains(g, @g1); SELECT ST_AsText(g) FROM t1 WHERE MBRWithin(g, @g1); diff --git a/mysql-test/suite/maria/icp.result b/mysql-test/suite/maria/icp.result index 8fc93e8..14517fe 100644 --- a/mysql-test/suite/maria/icp.result +++ b/mysql-test/suite/maria/icp.result @@ -409,7 +409,7 @@ WHERE (pk BETWEEN 4 AND 5 OR pk < 2) AND c1 < 240 ORDER BY c1 LIMIT 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,k1 k1 5 NULL 4 Using where +1 SIMPLE t1 range PRIMARY,k1 PRIMARY 4 NULL 3 Using index condition; Using where; Rowid-ordered scan; Using filesort DROP TABLE t1; # # @@ -590,6 +590,12 @@ i1 INTEGER NOT NULL, PRIMARY KEY (pk) ); INSERT INTO t2 VALUES (4,1); +ANALYZE TABLE t1,t2; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK EXPLAIN SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t2.pk <> t1.d1 AND t2.pk = 4; @@ -795,6 +801,12 @@ INSERT INTO t2 (g,h) VALUES (0,'p'),(0,'f'),(0,'p'),(7,'d'),(7,'f'),(5,'j'), (3,'e'),(1,'u'),(4,'v'),(9,'u'),(6,'i'),(1,'x'), (7,'f'),(5,'j'),(3,'e'),(1,'u'),(4,'v'),(9,'u'); +ANALYZE TABLE t1,t2; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status Table is already up to date SET @save_optimize_switch=@@optimizer_switch; SET optimizer_switch='materialization=on'; EXPLAIN @@ -804,7 +816,7 @@ AND (EXISTS (SELECT * FROM t1, t2 WHERE a = f AND h <= t.e AND a > t.b) OR a = 0 AND h < 'z' ); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t ALL PRIMARY,c NULL NULL NULL 64 Using where -1 PRIMARY t2 ref g g 5 test.t.c 19 Using where +1 PRIMARY t2 ref g g 5 test.t.c 18 Using where 2 DEPENDENT SUBQUERY t1 index PRIMARY PRIMARY 4 NULL 64 Using where; Using index 2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where SELECT COUNT(*) FROM t1 AS t, t2 diff --git a/mysql-test/suite/maria/ps_maria.result b/mysql-test/suite/maria/ps_maria.result index bd5f2b4..6f5d557 100644 --- a/mysql-test/suite/maria/ps_maria.result +++ b/mysql-test/suite/maria/ps_maria.result @@ -1161,7 +1161,7 @@ def possible_keys 253 4_OR_8_K 0 Y 0 39 8 def key 253 64 0 Y 0 39 8 def key_len 253 4_OR_8_K 0 Y 0 39 8 def ref 253 2048 0 Y 0 39 8 -def rows 8 10 1 Y 32928 0 63 +def rows 253 64 1 Y 0 39 8 def Extra 253 255 0 N 1 39 8 id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t9 ALL NULL NULL NULL NULL 2 diff --git a/mysql-test/suite/parts/r/optimizer.result b/mysql-test/suite/parts/r/optimizer.result index 465c6c7..42d85db 100644 --- a/mysql-test/suite/parts/r/optimizer.result +++ b/mysql-test/suite/parts/r/optimizer.result @@ -25,7 +25,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range a a 5 NULL 2 Using where; Using index EXPLAIN SELECT a, MAX(b) FROM t2 WHERE a IN (10,100) GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index for group-by +1 SIMPLE t2 range a a 5 NULL 2 Using where; Using index FLUSH status; SELECT a, MAX(b) FROM t1 WHERE a IN (10, 100) GROUP BY a; a MAX(b) @@ -41,5 +41,5 @@ a MAX(b) # Should be no more than 4 reads. SHOW status LIKE 'handler_read_key'; Variable_name Value -Handler_read_key 4 +Handler_read_key 2 DROP TABLE t1, t2; diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 926ac8b..ddaa495 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -2252,6 +2252,20 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME MAX_ROWID_FILTER_SIZE +SESSION_VALUE 131072 +GLOBAL_VALUE 131072 +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE 131072 +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT The maximum size of the container of a rowid filter +NUMERIC_MIN_VALUE 1024 +NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_SEEKS_FOR_KEY SESSION_VALUE 4294967295 GLOBAL_VALUE 4294967295 @@ -2729,17 +2743,17 @@ ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_SWITCH -SESSION_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on -GLOBAL_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on +SESSION_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on +GLOBAL_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on +DEFAULT_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on VARIABLE_SCOPE SESSION VARIABLE_TYPE FLAGSET VARIABLE_COMMENT Fine-tune the optimizer behavior NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,default +ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,rowid_filter,default READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_USE_CONDITION_SELECTIVITY diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 4f1b898..6c57061 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -2483,7 +2483,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 131072 VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT The maximum number of rows that fit in memory +VARIABLE_COMMENT The maximum size of the container of a rowid filter NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 18446744073709551615 NUMERIC_BLOCK_SIZE 1 diff --git a/mysql-test/suite/vcol/inc/vcol_select.inc b/mysql-test/suite/vcol/inc/vcol_select.inc index 0641e14..cbd1f2c 100644 --- a/mysql-test/suite/vcol/inc/vcol_select.inc +++ b/mysql-test/suite/vcol/inc/vcol_select.inc @@ -35,7 +35,7 @@ insert into t2 (a) values (1); create table t3 (a int primary key, b int as (-a), c int as (-a) persistent unique); -insert into t3 (a) values (2),(1),(3); +insert into t3 (a) values (2),(1),(3),(5),(4),(7); --echo # select_type=SIMPLE, type=system diff --git a/mysql-test/suite/vcol/r/vcol_select_innodb.result b/mysql-test/suite/vcol/r/vcol_select_innodb.result index 63c35ba..6ebdd87 100644 --- a/mysql-test/suite/vcol/r/vcol_select_innodb.result +++ b/mysql-test/suite/vcol/r/vcol_select_innodb.result @@ -9,7 +9,7 @@ insert into t2 (a) values (1); create table t3 (a int primary key, b int as (-a), c int as (-a) persistent unique); -insert into t3 (a) values (2),(1),(3); +insert into t3 (a) values (2),(1),(3),(5),(4),(7); # select_type=SIMPLE, type=system select * from t2; a b c @@ -63,8 +63,8 @@ a b c 3 -3 -3 explain select * from t1 where b in (select c from t3); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 index c c 5 NULL 3 Using index -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY t3 ref c c 5 test.t1.b 1 Using index # select_type=PRIMARY, type=range,ref select * from t1 where c in (select c from t3 where c between -2 and -1); a b c @@ -73,7 +73,7 @@ a b c 1 -1 -1 explain select * from t1 where c in (select c from t3 where c between -2 and -1); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 index c c 5 NULL 3 Using where; Using index +1 PRIMARY t3 index c c 5 NULL 6 Using where; Using index 1 PRIMARY t1 ALL c NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) # select_type=UNION, type=system # select_type=UNION RESULT, type=<union1,2> @@ -160,7 +160,7 @@ a b c 2 -2 -2 explain select * from t3 where b between -2 and -1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where # SELECT * FROM tbl_name WHERE <indexed vcol expr> select * from t3 where c between -2 and -1; a b c @@ -192,7 +192,7 @@ a b c 2 -2 -2 explain select * from t3 where b between -2 and -1 order by a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 index NULL PRIMARY 4 NULL 3 Using where +1 SIMPLE t3 index NULL PRIMARY 4 NULL 6 Using where # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-indexed vcol> select * from t3 where b between -2 and -1 order by b; a b c @@ -200,7 +200,7 @@ a b c 1 -1 -1 explain select * from t3 where b between -2 and -1 order by b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed vcol expr> ORDER BY <non-indexed vcol> select * from t3 where c between -2 and -1 order by b; a b c @@ -216,7 +216,7 @@ a b c 1 -1 -1 explain select * from t3 where b between -2 and -1 order by c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed vcol expr> ORDER BY <indexed vcol> select * from t3 where c between -2 and -1 order by c; a b c diff --git a/mysql-test/suite/vcol/r/vcol_select_myisam.result b/mysql-test/suite/vcol/r/vcol_select_myisam.result index be3ea81..4e21582 100644 --- a/mysql-test/suite/vcol/r/vcol_select_myisam.result +++ b/mysql-test/suite/vcol/r/vcol_select_myisam.result @@ -9,7 +9,7 @@ insert into t2 (a) values (1); create table t3 (a int primary key, b int as (-a), c int as (-a) persistent unique); -insert into t3 (a) values (2),(1),(3); +insert into t3 (a) values (2),(1),(3),(5),(4),(7); # select_type=SIMPLE, type=system select * from t2; a b c @@ -44,7 +44,7 @@ a b c 1 -1 -1 explain select * from t3 where c>=-1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range c c 5 NULL 2 Using index condition +1 SIMPLE t3 range c c 5 NULL 1 Using index condition # select_type=SIMPLE, type=ref select * from t1,t3 where t1.c=t3.c and t3.c=-1; a b c a b c @@ -63,8 +63,8 @@ a b c 3 -3 -3 explain select * from t1 where b in (select c from t3); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 index c c 5 NULL 3 Using index -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY t3 ref c c 5 test.t1.b 2 Using index # select_type=PRIMARY, type=range,ref select * from t1 where c in (select c from t3 where c between -2 and -1); a b c @@ -73,8 +73,8 @@ a b c 1 -1 -1 explain select * from t1 where c in (select c from t3 where c between -2 and -1); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t3 index c c 5 NULL 3 Using where; Using index -1 PRIMARY t1 ref c c 5 test.t3.c 2 +1 PRIMARY t1 range c c 5 NULL 3 Using index condition +1 PRIMARY t3 index c c 5 NULL 6 Using where; Using index; Using join buffer (flat, BNL join) # select_type=UNION, type=system # select_type=UNION RESULT, type=<union1,2> select * from t1 union select * from t2; @@ -152,7 +152,7 @@ a b c 2 -2 -2 explain select * from t3 where a between 1 and 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using index condition +1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using index condition # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> select * from t3 where b between -2 and -1; a b c @@ -160,7 +160,7 @@ a b c 1 -1 -1 explain select * from t3 where b between -2 and -1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where +1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where # SELECT * FROM tbl_name WHERE <indexed vcol expr> select * from t3 where c between -2 and -1; a b c @@ -168,7 +168,7 @@ a b c 1 -1 -1 explain select * from t3 where c between -2 and -1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range c c 5 NULL 1 Using index condition +1 SIMPLE t3 range c c 5 NULL 2 Using index condition # SELECT * FROM tbl_name WHERE <non-vcol expr> ORDER BY <indexed vcol> select * from t3 where a between 1 and 2 order by c; a b c @@ -176,7 +176,7 @@ a b c 1 -1 -1 explain select * from t3 where a between 1 and 2 order by c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Using filesort +1 SIMPLE t3 range PRIMARY PRIMARY 4 NULL 2 Using index condition; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-vcol> select * from t3 where b between -2 and -1 order by a; a b c @@ -184,7 +184,7 @@ a b c 2 -2 -2 explain select * from t3 where b between -2 and -1 order by a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed vcol expr> ORDER BY <non-vcol> select * from t3 where c between -2 and -1 order by a; a b c @@ -192,7 +192,7 @@ a b c 2 -2 -2 explain select * from t3 where c between -2 and -1 order by a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Using filesort +1 SIMPLE t3 range c c 5 NULL 2 Using index condition; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <non-indexed vcol> select * from t3 where b between -2 and -1 order by b; a b c @@ -200,7 +200,7 @@ a b c 1 -1 -1 explain select * from t3 where b between -2 and -1 order by b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed vcol expr> ORDER BY <non-indexed vcol> select * from t3 where c between -2 and -1 order by b; a b c @@ -208,7 +208,7 @@ a b c 1 -1 -1 explain select * from t3 where c between -2 and -1 order by b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range c c 5 NULL 1 Using index condition; Using filesort +1 SIMPLE t3 range c c 5 NULL 2 Using index condition; Using filesort # SELECT * FROM tbl_name WHERE <non-indexed vcol expr> ORDER BY <indexed vcol> select * from t3 where b between -2 and -1 order by c; a b c @@ -216,7 +216,7 @@ a b c 1 -1 -1 explain select * from t3 where b between -2 and -1 order by c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 ALL NULL NULL NULL NULL 3 Using where; Using filesort +1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using where; Using filesort # SELECT * FROM tbl_name WHERE <indexed vcol expr> ORDER BY <indexed vcol> select * from t3 where c between -2 and -1 order by c; a b c @@ -224,7 +224,7 @@ a b c 1 -1 -1 explain select * from t3 where c between -2 and -1 order by c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t3 range c c 5 NULL 1 Using index condition +1 SIMPLE t3 range c c 5 NULL 2 Using index condition # SELECT sum(<non-indexed vcol>) FROM tbl_name GROUP BY <non-indexed vcol> select sum(b) from t1 group by b; sum(b) diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 575af82..195f937 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -6184,7 +6184,7 @@ static Sys_var_enum Sys_secure_timestamp( static Sys_var_ulonglong Sys_max_rowid_filter_size( "max_rowid_filter_size", - "The maximum number of rows that fit in memory", + "The maximum size of the container of a rowid filter", SESSION_VAR(max_rowid_filter_size), CMD_LINE(REQUIRED_ARG), VALID_RANGE(1024, (ulonglong)~(intptr)0), DEFAULT(128*1024), BLOCK_SIZE(1)); diff --git a/storage/connect/mysql-test/connect/r/mysql_index.result b/storage/connect/mysql-test/connect/r/mysql_index.result index dd18645..b0c88b1 100644 --- a/storage/connect/mysql-test/connect/r/mysql_index.result +++ b/storage/connect/mysql-test/connect/r/mysql_index.result @@ -45,10 +45,9 @@ id msg SELECT * FROM t2 WHERE id IN (2,4) AND msg = 'Two'; id msg 2 Two -SELECT * FROM t2 WHERE id > 3; +SELECT * FROM t2 WHERE id > 4; id msg 5 Cinq -4 Four 6 Six SELECT * FROM t2 WHERE id >= 3; id msg @@ -60,10 +59,9 @@ SELECT * FROM t2 WHERE id < 3; id msg 1 Un 2 Two -SELECT * FROM t2 WHERE id < 3 OR id > 4; +SELECT * FROM t2 WHERE id < 2 OR id > 4; id msg 1 Un -2 Two 5 Cinq 6 Six SELECT * FROM t2 WHERE id <= 3; @@ -166,141 +164,141 @@ matricule nom prenom sexe aanais mmnais ddentree ddnom brut net service sitmat f 4974 LONES GERARD 1 1959 10 1979-01-01 1994-12-01 16081 12916.70 0 M SANS SELECT matricule, nom, prenom FROM t2 WHERE nom IN ('FOCH','MOGADOR'); matricule nom prenom +3368 MOGADOR ALAIN 1977 FOCH BERNADETTE -5707 FOCH DENIS +4080 FOCH SERGE 2552 FOCH FRANCK +5707 FOCH DENIS 2634 FOCH JOCELYNE 5765 FOCH ROBERT -4080 FOCH SERGE -3368 MOGADOR ALAIN SELECT matricule, nom, prenom FROM t2 WHERE nom = 'FOCH' OR nom = 'MOGADOR'; matricule nom prenom +3368 MOGADOR ALAIN 1977 FOCH BERNADETTE -5707 FOCH DENIS +4080 FOCH SERGE 2552 FOCH FRANCK +5707 FOCH DENIS 2634 FOCH JOCELYNE 5765 FOCH ROBERT -4080 FOCH SERGE -3368 MOGADOR ALAIN SELECT matricule, nom, prenom FROM t2 WHERE nom < 'ADDAX'; matricule nom prenom -4552 ABBADIE MONIQUE -307 ABBAYE ANNICK -6627 ABBAYE GERALD -7961 ABBE KATIA 1340 ABBE MICHELE -9270 ABBE SOPHIE +2728 ABOUT CATHERINE MARIE +895 ABORD CHANTAL +4038 ADAM JANICK +6627 ABBAYE GERALD +6124 ABELIAS DELIA +4552 ABBADIE MONIQUE +8673 ABEL JEAN PIERRE +3395 ADAM JEAN CLAUDE 2945 ABBEVILLE PASCAL -8596 ABEBERRY PATRICK +115 ACHILLE JACQUES 6399 ABEILLES RENE -8673 ABEL JEAN PIERRE -6124 ABELIAS DELIA -6314 ABERDEN EVELYNE -895 ABORD CHANTAL -2728 ABOUT CATHERINE MARIE +8596 ABEBERRY PATRICK +9270 ABBE SOPHIE 398 ABREUVOIR JEAN LUC -1122 ACACIAS SERGE +7961 ABBE KATIA +307 ABBAYE ANNICK +6314 ABERDEN EVELYNE 1644 ACARDIE BEATE -115 ACHILLE JACQUES -4038 ADAM JANICK -3395 ADAM JEAN CLAUDE +1122 ACACIAS SERGE SELECT matricule, nom, prenom FROM t2 WHERE nom <= 'ABEL'; matricule nom prenom -4552 ABBADIE MONIQUE -307 ABBAYE ANNICK -6627 ABBAYE GERALD -7961 ABBE KATIA 1340 ABBE MICHELE -9270 ABBE SOPHIE +6627 ABBAYE GERALD +4552 ABBADIE MONIQUE +8673 ABEL JEAN PIERRE 2945 ABBEVILLE PASCAL -8596 ABEBERRY PATRICK 6399 ABEILLES RENE -8673 ABEL JEAN PIERRE +8596 ABEBERRY PATRICK +9270 ABBE SOPHIE +7961 ABBE KATIA +307 ABBAYE ANNICK SELECT matricule, nom, prenom FROM t2 WHERE nom > 'YVON'; matricule nom prenom 9742 YZENGREMER MICHEL -8738 ZILINA JEAN LOUIS 5357 ZOLA BERNARD 5441 ZOLA BRIGITTE -1325 ZOLA CHRISTINE -4859 ZORI CATHERINE 4102 ZOUAVES ALAIN +4859 ZORI CATHERINE +1325 ZOLA CHRISTINE +8738 ZILINA JEAN LOUIS SELECT matricule, nom, prenom FROM t2 WHERE nom >= 'YVON'; matricule nom prenom -5389 YVON CAROLE 9742 YZENGREMER MICHEL -8738 ZILINA JEAN LOUIS 5357 ZOLA BERNARD +5389 YVON CAROLE 5441 ZOLA BRIGITTE -1325 ZOLA CHRISTINE -4859 ZORI CATHERINE 4102 ZOUAVES ALAIN +4859 ZORI CATHERINE +1325 ZOLA CHRISTINE +8738 ZILINA JEAN LOUIS SELECT matricule, nom, prenom FROM t2 WHERE nom <= 'ABEL' OR nom > 'YVON'; matricule nom prenom -4552 ABBADIE MONIQUE -307 ABBAYE ANNICK -6627 ABBAYE GERALD -7961 ABBE KATIA -1340 ABBE MICHELE -9270 ABBE SOPHIE -2945 ABBEVILLE PASCAL -8596 ABEBERRY PATRICK -6399 ABEILLES RENE -8673 ABEL JEAN PIERRE 9742 YZENGREMER MICHEL -8738 ZILINA JEAN LOUIS +1340 ABBE MICHELE 5357 ZOLA BERNARD +6627 ABBAYE GERALD +4552 ABBADIE MONIQUE 5441 ZOLA BRIGITTE -1325 ZOLA CHRISTINE -4859 ZORI CATHERINE 4102 ZOUAVES ALAIN +8673 ABEL JEAN PIERRE +4859 ZORI CATHERINE +2945 ABBEVILLE PASCAL +1325 ZOLA CHRISTINE +6399 ABEILLES RENE +8596 ABEBERRY PATRICK +9270 ABBE SOPHIE +7961 ABBE KATIA +307 ABBAYE ANNICK +8738 ZILINA JEAN LOUIS SELECT matricule, nom, prenom FROM t2 WHERE nom > 'HELEN' AND nom < 'HEROS'; matricule nom prenom -9096 HELENA PHILIPPE -3309 HELENE ISABELLE -8365 HELIOTROPES LISE -4666 HELLEN PIERRE -5781 HELSINKI DANIELLE +2085 HEOL GUY PAUL +2673 HENNER LILIANE +7093 HERAULTS DANIEL 7626 HENIN PHILIPPE +403 HERMITTE PHILIPPE 4254 HENIN SERGE -2673 HENNER LILIANE +4666 HELLEN PIERRE +3309 HELENE ISABELLE +9749 HEROLD ISABELLE 9716 HENRI JACQUES -2085 HEOL GUY PAUL -2579 HERANDIERE PIERRE -7093 HERAULTS DANIEL +1291 HERMITAGE XAVIER +8365 HELIOTROPES LISE 4050 HERBILLON FRANCOIS 9231 HERBILLON MADELEINE -1291 HERMITAGE XAVIER +9096 HELENA PHILIPPE +5781 HELSINKI DANIELLE +2579 HERANDIERE PIERRE 6185 HERMITTE FRANCOIS -403 HERMITTE PHILIPPE -9749 HEROLD ISABELLE SELECT matricule, nom, prenom FROM t2 WHERE nom BETWEEN 'HELEN' AND 'HEROS'; matricule nom prenom -6199 HELEN MARTIAL -9096 HELENA PHILIPPE -3309 HELENE ISABELLE -8365 HELIOTROPES LISE -4666 HELLEN PIERRE -5781 HELSINKI DANIELLE +2085 HEOL GUY PAUL +2673 HENNER LILIANE +7093 HERAULTS DANIEL 7626 HENIN PHILIPPE +403 HERMITTE PHILIPPE 4254 HENIN SERGE -2673 HENNER LILIANE +4666 HELLEN PIERRE +3309 HELENE ISABELLE +9749 HEROLD ISABELLE 9716 HENRI JACQUES -2085 HEOL GUY PAUL -2579 HERANDIERE PIERRE -7093 HERAULTS DANIEL +1291 HERMITAGE XAVIER +8365 HELIOTROPES LISE 4050 HERBILLON FRANCOIS 9231 HERBILLON MADELEINE -1291 HERMITAGE XAVIER -6185 HERMITTE FRANCOIS -403 HERMITTE PHILIPPE -9749 HEROLD ISABELLE 8445 HEROS SYLVIE +9096 HELENA PHILIPPE +5781 HELSINKI DANIELLE +2579 HERANDIERE PIERRE +6199 HELEN MARTIAL +6185 HERMITTE FRANCOIS SELECT matricule, nom, prenom FROM t2 WHERE nom BETWEEN 'HELEN' AND 'HEROS' AND prenom = 'PHILIPPE'; matricule nom prenom -9096 HELENA PHILIPPE 7626 HENIN PHILIPPE 403 HERMITTE PHILIPPE +9096 HELENA PHILIPPE SELECT matricule, nom, prenom FROM t2 ORDER BY nom LIMIT 10; matricule nom prenom 4552 ABBADIE MONIQUE diff --git a/storage/connect/mysql-test/connect/r/part_file.result b/storage/connect/mysql-test/connect/r/part_file.result index c679ed9..3dabd94 100644 --- a/storage/connect/mysql-test/connect/r/part_file.result +++ b/storage/connect/mysql-test/connect/r/part_file.result @@ -145,14 +145,11 @@ id select_type table partitions type possible_keys key key_len ref rows Extra SELECT * FROM t1 WHERE id = 10; rwid rnum prtn tbn fid id msg 1 1 2 t1 part2 10 ten -EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id >= 10; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id >= 40; id select_type table partitions type possible_keys key key_len ref rows Extra -1 SIMPLE t1 2,3 range PRIMARY PRIMARY 4 NULL 7 Using where -SELECT * FROM t1 WHERE id >= 10; +1 SIMPLE t1 2,3 range PRIMARY PRIMARY 4 NULL 4 Using where +SELECT * FROM t1 WHERE id >= 40; rwid rnum prtn tbn fid id msg -1 1 2 t1 part2 10 ten -3 3 2 t1 part2 20 twenty -4 4 2 t1 part2 35 thirty five 2 2 2 t1 part2 40 forty 1 1 3 t1 part3 60 sixty 3 3 3 t1 part3 72 seventy two diff --git a/storage/connect/mysql-test/connect/t/mysql_index.test b/storage/connect/mysql-test/connect/t/mysql_index.test index 81fdcad..74dc48f 100644 --- a/storage/connect/mysql-test/connect/t/mysql_index.test +++ b/storage/connect/mysql-test/connect/t/mysql_index.test @@ -49,10 +49,10 @@ SELECT * FROM t2; SELECT * FROM t2 WHERE id = 3; SELECT * FROM t2 WHERE id IN (2,4); SELECT * FROM t2 WHERE id IN (2,4) AND msg = 'Two'; -SELECT * FROM t2 WHERE id > 3; +SELECT * FROM t2 WHERE id > 4; SELECT * FROM t2 WHERE id >= 3; SELECT * FROM t2 WHERE id < 3; -SELECT * FROM t2 WHERE id < 3 OR id > 4; +SELECT * FROM t2 WHERE id < 2 OR id > 4; SELECT * FROM t2 WHERE id <= 3; SELECT * FROM t2 WHERE id BETWEEN 3 AND 5; SELECT * FROM t2 WHERE id > 2 AND id < 6; diff --git a/storage/connect/mysql-test/connect/t/part_file.test b/storage/connect/mysql-test/connect/t/part_file.test index 8ee43a9..2e5127f 100644 --- a/storage/connect/mysql-test/connect/t/part_file.test +++ b/storage/connect/mysql-test/connect/t/part_file.test @@ -82,8 +82,8 @@ SELECT * FROM t1; SELECT * FROM t1 order by id; EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id = 10; SELECT * FROM t1 WHERE id = 10; -EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id >= 10; -SELECT * FROM t1 WHERE id >= 10; +EXPLAIN PARTITIONS SELECT * FROM t1 WHERE id >= 40; +SELECT * FROM t1 WHERE id >= 40; SELECT count(*) FROM t1 WHERE id < 10; SELECT case when id < 10 then 1 when id < 50 then 2 else 3 end as pn, count(*) FROM t1 group by pn; SELECT prtn, count(*) FROM t1 group by prtn; diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc index 4d796d9..8bc9673 100644 --- a/storage/innobase/srv/srv0mon.cc +++ b/storage/innobase/srv/srv0mon.cc @@ -1414,7 +1414,7 @@ static monitor_info_t innodb_counter_info[] = MONITOR_NONE, MONITOR_DEFAULT_START, MONITOR_PK_FILTER_POSITIVE}, - {"pk-filter_negarive", "pk-filter", "PK-filter test is negative", + {"pk-filter_negative", "pk-filter", "PK-filter test is negative", MONITOR_NONE, MONITOR_DEFAULT_START, MONITOR_PK_FILTER_NEGATIVE}, diff --git a/storage/myisam/mi_range.c b/storage/myisam/mi_range.c index 185f2ca..a464b3d 100644 --- a/storage/myisam/mi_range.c +++ b/storage/myisam/mi_range.c @@ -103,7 +103,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx, max_key->keypart_map, max_key->flag) : (double) info->state->records); res= (end_pos < start_pos ? (ha_rows) 0 : - (end_pos == start_pos ? (ha_rows) 1 : end_pos-start_pos)); + (end_pos == start_pos ? (ha_rows) 1 : (ha_rows) (end_pos-start_pos))); if (start_pos == HA_POS_ERROR || end_pos == HA_POS_ERROR) res=HA_POS_ERROR; else @@ -111,7 +111,7 @@ ha_rows mi_records_in_range(MI_INFO *info, int inx, diff= end_pos - start_pos; if (diff >= 0) { - if (!(res= (diff + 0.5))) + if (!(res= (ha_rows) (diff + 0.5))) res= 1; } else @@ -208,7 +208,7 @@ static double _mi_record_pos(MI_INFO *info, const uchar *key, DBUG_PRINT("exit",("pos: %g",(pos*info->state->records))); DBUG_RETURN(pos*info->state->records); } - DBUG_RETURN(HA_POS_ERROR); + DBUG_RETURN((double) (HA_POS_ERROR)); }
1 0
0 0
[Commits] f706a820ba8: MDEV-12009: Allow to force kill user threads/query which are flagged as high priority by Galera
by jan 04 Feb '19

04 Feb '19
revision-id: f706a820ba88159e17640f71d369f54ebd8fe5aa (mariadb-10.1.37-81-gf706a820ba8) parent(s): 0bd8d9946831635325a8b72aec9433c769d4deb0 author: Jan Lindström committer: Jan Lindström timestamp: 2019-02-04 20:22:26 +0200 message: MDEV-12009: Allow to force kill user threads/query which are flagged as high priority by Galera As noted on kill_one_thread SUPER should be able to kill even system threads i.e. threads/query flagged as high priority or wsrep applier thread. Normal user, should not able to kill threads/query flagged as high priority (BF) or wsrep applier thread. --- include/mysql/service_wsrep.h | 3 ++ .../suite/galera/r/galera_kill_applier.result | 4 ++ mysql-test/suite/galera/t/galera_kill_applier.cnf | 10 ++++ mysql-test/suite/galera/t/galera_kill_applier.test | 54 ++++++++++++++++++++-- sql/sql_parse.cc | 14 ++++-- sql/sql_plugin_services.ic | 3 +- sql/wsrep_dummy.cc | 3 ++ sql/wsrep_mysqld.cc | 1 - sql/wsrep_thd.cc | 9 ++++ sql/wsrep_thd.h | 2 + 10 files changed, 95 insertions(+), 8 deletions(-) diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h index b51f154422f..6a83feaff55 100644 --- a/include/mysql/service_wsrep.h +++ b/include/mysql/service_wsrep.h @@ -111,6 +111,7 @@ extern struct wsrep_service_st { int (*wsrep_trx_order_before_func)(MYSQL_THD, MYSQL_THD); void (*wsrep_unlock_rollback_func)(); void (*wsrep_set_data_home_dir_func)(const char *data_dir); + my_bool (*wsrep_thd_is_applier_func)(THD *thd); } *wsrep_service; #ifdef MYSQL_DYNAMIC_PLUGIN @@ -153,6 +154,7 @@ extern struct wsrep_service_st { #define wsrep_trx_order_before(T1,T2) wsrep_service->wsrep_trx_order_before_func(T1,T2) #define wsrep_unlock_rollback() wsrep_service->wsrep_unlock_rollback_func() #define wsrep_set_data_home_dir(A) wsrep_service->wsrep_set_data_home_dir_func(A) +#define wsrep_thd_is_applier(T) wsrep_service->wsrep_thd_is_applier_func(T) #define wsrep_debug get_wsrep_debug() #define wsrep_log_conflicts get_wsrep_log_conflicts() @@ -211,6 +213,7 @@ void wsrep_thd_set_conflict_state(THD *thd, enum wsrep_conflict_state state); bool wsrep_thd_ignore_table(THD *thd); void wsrep_unlock_rollback(); void wsrep_set_data_home_dir(const char *data_dir); +my_bool wsrep_thd_is_applier(THD *thd); #endif diff --git a/mysql-test/suite/galera/r/galera_kill_applier.result b/mysql-test/suite/galera/r/galera_kill_applier.result index fe4911639ed..89f8ead0b65 100644 --- a/mysql-test/suite/galera/r/galera_kill_applier.result +++ b/mysql-test/suite/galera/r/galera_kill_applier.result @@ -1,4 +1,8 @@ +CREATE USER foo@localhost; +GRANT SELECT on test.* TO foo@localhost; +# Open connection to the 1st node using 'test_user1' user. Got one of the listed errors Got one of the listed errors Got one of the listed errors Got one of the listed errors +DROP USER foo@localhost; diff --git a/mysql-test/suite/galera/t/galera_kill_applier.cnf b/mysql-test/suite/galera/t/galera_kill_applier.cnf new file mode 100644 index 00000000000..f2563e66f2e --- /dev/null +++ b/mysql-test/suite/galera/t/galera_kill_applier.cnf @@ -0,0 +1,10 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep_provider_options='base_port=(a)mysqld.1.#galera_port;pc.ignore_sb=true' +auto_increment_offset=1 + +[mysqld.2] +wsrep_provider_options='base_port=(a)mysqld.2.#galera_port;pc.ignore_sb=true' +auto_increment_offset=2 + diff --git a/mysql-test/suite/galera/t/galera_kill_applier.test b/mysql-test/suite/galera/t/galera_kill_applier.test index e14a8b9af23..5e4a587fe57 100644 --- a/mysql-test/suite/galera/t/galera_kill_applier.test +++ b/mysql-test/suite/galera/t/galera_kill_applier.test @@ -1,14 +1,25 @@ # # This test checks that applier threads are immune to KILL QUERY and KILL STATEMENT +# when USER is not SUPER # --source include/galera_cluster.inc ---source include/have_innodb.inc --connection node_1 +CREATE USER foo@localhost; +GRANT SELECT on test.* TO foo@localhost; + --let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE != 'wsrep aborter idle' OR STATE IS NULL LIMIT 1` +--let $aborter_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep aborter idle' LIMIT 1` + +--echo # Open connection to the 1st node using 'test_user1' user. +--let $port_1= \$NODE_MYPORT_1 +--connect(foo_node_1,localhost,foo,,test,$port_1,) + +--connection foo_node_1 + --disable_query_log --error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR --eval KILL $applier_thread @@ -16,11 +27,48 @@ --error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR --eval KILL QUERY $applier_thread ---let $aborter_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep aborter idle' LIMIT 1` - --error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR --eval KILL $aborter_thread --error ER_KILL_DENIED_ERROR,ER_KILL_DENIED_ERROR --eval KILL QUERY $aborter_thread --enable_query_log + +# +# SUPER can kill applier threads +# +--connection node_2 + +--let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE != 'wsrep aborter idle' OR STATE IS NULL LIMIT 1` + +--disable_query_log +--eval KILL $applier_thread +--enable_query_log + +--let $aborter_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep aborter idle' LIMIT 1` + +--disable_query_log +--eval KILL $aborter_thread +--enable_query_log + +--source include/restart_mysqld.inc + +--connection node_2 +--let $applier_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE != 'wsrep aborter idle' OR STATE IS NULL LIMIT 1` + +--disable_query_log +--eval KILL QUERY $applier_thread +--enable_query_log + +--let $aborter_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'wsrep aborter idle' LIMIT 1` + +--disable_query_log +--eval KILL QUERY $aborter_thread +--enable_query_log + +--source include/restart_mysqld.inc + +--connection node_1 +--disconnect foo_node_1 +DROP USER foo@localhost; + diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3f6ce8356ce..83278559a9c 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -8297,11 +8297,19 @@ kill_one_thread(THD *thd, longlong id, killed_state kill_signal, killed_type typ It's ok to also kill DELAYED threads with KILL_CONNECTION instead of KILL_SYSTEM_THREAD; The difference is that KILL_CONNECTION may be faster and do a harder kill than KILL_SYSTEM_THREAD; + + Note that if thread is wsrep Brute Force or applier thread we + allow killing it only when we're SUPER. */ - if (((thd->security_ctx->master_access & SUPER_ACL) || - thd->security_ctx->user_matches(tmp->security_ctx)) && - !wsrep_thd_is_BF(tmp, false)) + if ((thd->security_ctx->master_access & SUPER_ACL) || + (thd->security_ctx->user_matches(tmp->security_ctx) +#ifdef WITH_WSREP + && + !tmp->wsrep_applier && + !wsrep_thd_is_BF(tmp, false) +#endif + )) { tmp->awake(kill_signal); error=0; diff --git a/sql/sql_plugin_services.ic b/sql/sql_plugin_services.ic index 95301a5fbe8..a0d42c04dba 100644 --- a/sql/sql_plugin_services.ic +++ b/sql/sql_plugin_services.ic @@ -180,7 +180,8 @@ static struct wsrep_service_st wsrep_handler = { wsrep_trx_is_aborting, wsrep_trx_order_before, wsrep_unlock_rollback, - wsrep_set_data_home_dir + wsrep_set_data_home_dir, + wsrep_thd_is_applier, }; static struct thd_specifics_service_st thd_specifics_handler= diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc index 5837ab4bed5..1f130e2b9a2 100644 --- a/sql/wsrep_dummy.cc +++ b/sql/wsrep_dummy.cc @@ -20,6 +20,9 @@ my_bool wsrep_thd_is_BF(THD *, my_bool) { return 0; } +my_bool wsrep_thd_is_applier(THD *) +{ return 0; } + int wsrep_trx_order_before(THD *, THD *) { return 0; } diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 47aea6d3824..85112967b7b 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -2469,7 +2469,6 @@ extern "C" void wsrep_thd_set_exec_mode(THD *thd, enum wsrep_exec_mode mode) thd->wsrep_exec_mode= mode; } - extern "C" void wsrep_thd_set_query_state( THD *thd, enum wsrep_query_state state) { diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index eb26da61282..492a3b67c68 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -596,6 +596,15 @@ my_bool wsrep_thd_is_BF(THD *thd, my_bool sync) return status; } +my_bool wsrep_thd_is_applier(THD *thd) +{ + my_bool ret = FALSE; + if (thd) { + ret = thd->wsrep_applier; + } + return ret; +} + extern "C" my_bool wsrep_thd_is_BF_or_commit(void *thd_ptr, my_bool sync) { diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h index 5900668f3fb..f5fcb50280c 100644 --- a/sql/wsrep_thd.h +++ b/sql/wsrep_thd.h @@ -37,6 +37,7 @@ int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, */ extern void wsrep_thd_set_PA_safe(void *thd_ptr, my_bool safe); extern my_bool wsrep_thd_is_BF(THD *thd, my_bool sync); +extern my_bool wsrep_thd_is_applier(THD *thd); extern my_bool wsrep_thd_is_wsrep(void *thd_ptr); enum wsrep_conflict_state wsrep_thd_conflict_state(void *thd_ptr, my_bool sync); @@ -47,6 +48,7 @@ extern "C" int wsrep_thd_in_locking_session(void *thd_ptr); #else /* WITH_WSREP */ #define wsrep_thd_is_BF(T, S) (0) +#define wsrep_thd_is_applier(T) (0) #define wsrep_abort_thd(X,Y,Z) do { } while(0) #define wsrep_create_appliers(T) do { } while(0)
1 0
0 0
[Commits] 0bd8d994683: MDEV-18464: Port kill_one_trx fixes from 10.4 to 10.1
by jan 04 Feb '19

04 Feb '19
revision-id: 0bd8d9946831635325a8b72aec9433c769d4deb0 (mariadb-10.1.37-80-g0bd8d994683) parent(s): 27f1de5cb3ededcea5a54d43047b5c38c2965075 author: Jan Lindström committer: Jan Lindström timestamp: 2019-02-04 20:01:08 +0200 message: MDEV-18464: Port kill_one_trx fixes from 10.4 to 10.1 Pushed the decision for innodb transaction and system locking down to lock_trx_handle_wait() level. With this, we can avoid releasing these mutexes for executions where these mutexes were acquired upfront. This patch will also fix BF aborting of native threads, e.g. threads which have declared wsrep_on=OFF. Earlier, we have used, for innodb trx locks, was_chosen_as_deadlock_victim flag, for marking inodb transactions, which are victims for wsrep BF abort. With native threads (wsrep_on==OFF), re-using was_chosen_as_deadlock_victim flag may lead to inteference with real deadlock, and to deal with this, the patch has added new flag for marking wsrep BF aborts only: was_chosen_as_wsrep_victim innobase_kill_query() Removed lock mutex and trx mutex code. wsrep_innobase_kill_one_trx() Code cleanup and we will now use new was_chosen_as_wsrep_victim flag. wsrep_kill_victim() Removed unnecessary code. lock_trx_handle_wait_low() New low lever function to handle lock waits. lock_trx_handle_wait() Taking lock mutex and trx mutex is pushed down to this function. --- storage/innobase/handler/ha_innodb.cc | 72 ++++++++++------------------------ storage/innobase/include/trx0trx.h | 9 +++-- storage/innobase/lock/lock0lock.cc | 42 ++++++++++++++------ storage/innobase/row/row0sel.cc | 4 -- storage/innobase/trx/trx0roll.cc | 3 ++ storage/innobase/trx/trx0trx.cc | 9 +++-- storage/xtradb/handler/ha_innodb.cc | 73 +++++++++++------------------------ storage/xtradb/include/trx0trx.h | 11 ++++-- storage/xtradb/lock/lock0lock.cc | 42 ++++++++++++++------ storage/xtradb/row/row0sel.cc | 4 -- storage/xtradb/trx/trx0roll.cc | 6 +-- storage/xtradb/trx/trx0trx.cc | 8 ++-- 12 files changed, 130 insertions(+), 153 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 702f84a52d1..7f2dff51440 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4912,8 +4912,6 @@ static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels) /* if victim has been signaled by BF thread and/or aborting is already progressing, following query aborting is not necessary any more. - Also, BF thread should own trx mutex for the victim, which would - conflict with trx_mutex_enter() below */ DBUG_VOID_RETURN; } @@ -4922,34 +4920,8 @@ static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels) if (trx_t* trx = thd_to_trx(thd)) { ut_ad(trx->mysql_thd == thd); - switch (trx->abort_type) { -#ifdef WITH_WSREP - case TRX_WSREP_ABORT: - break; -#endif - case TRX_SERVER_ABORT: - if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { - lock_mutex_enter(); - } - /* fall through */ - case TRX_REPLICATION_ABORT: - trx_mutex_enter(trx); - } /* Cancel a pending lock request if there are any */ lock_trx_handle_wait(trx); - switch (trx->abort_type) { -#ifdef WITH_WSREP - case TRX_WSREP_ABORT: - break; -#endif - case TRX_SERVER_ABORT: - if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { - lock_mutex_exit(); - } - /* fall through */ - case TRX_REPLICATION_ABORT: - trx_mutex_exit(trx); - } } DBUG_VOID_RETURN; @@ -18593,7 +18565,7 @@ wsrep_innobase_kill_one_trx( ut_ad(victim_trx); DBUG_ENTER("wsrep_innobase_kill_one_trx"); - THD *bf_thd = bf_thd_ptr ? (THD*) bf_thd_ptr : NULL; + THD *bf_thd = (THD *) bf_thd_ptr; THD *thd = (THD *) victim_trx->mysql_thd; int64_t bf_seqno = (bf_thd) ? wsrep_thd_trx_seqno(bf_thd) : 0; @@ -18603,27 +18575,28 @@ wsrep_innobase_kill_one_trx( DBUG_RETURN(1); } - if (!bf_thd) { - DBUG_PRINT("wsrep", ("no BF thd for conflicting lock")); - WSREP_WARN("no BF THD for trx: " TRX_ID_FMT, - bf_trx ? bf_trx->id : 0); - DBUG_RETURN(1); - } - WSREP_LOG_CONFLICT(bf_thd, thd, TRUE); - WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%lu) trx: " - TRX_ID_FMT, - signal, (long long)bf_seqno, + wsrep_thd_LOCK(thd); + + WSREP_DEBUG("BF kill (" ULINTPF ", seqno: " INT64PF + "), victim: (%lu) trx: " TRX_ID_FMT, + signal, bf_seqno, thd_get_thread_id(thd), victim_trx->id); - WSREP_DEBUG("Aborting query: %s conf %d trx: %" PRId64, - (thd && wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void", - wsrep_thd_conflict_state(thd, FALSE), + WSREP_DEBUG("Aborting query: %s conflict_state %s trx: %" PRId64, + (wsrep_thd_query(thd) ? wsrep_thd_query(thd) : "void"), + wsrep_thd_conflict_state_str(thd), wsrep_thd_ws_handle(thd)->trx_id); - wsrep_thd_LOCK(thd); + /* + * we mark with was_chosen_as_deadlock_victim transaction, + * which is already marked as BF victim + * lock_sys is held until this vicitm has aborted + */ + victim_trx->lock.was_chosen_as_wsrep_victim = TRUE; + DBUG_EXECUTE_IF("sync.wsrep_after_BF_victim_lock", { const char act[]= @@ -18633,7 +18606,6 @@ wsrep_innobase_kill_one_trx( STRING_WITH_LEN(act))); };); - if (wsrep_thd_query_state(thd) == QUERY_EXITING) { WSREP_DEBUG("kill trx EXITING for " TRX_ID_FMT, victim_trx->id); @@ -18642,9 +18614,9 @@ wsrep_innobase_kill_one_trx( } if(wsrep_thd_exec_mode(thd) != LOCAL_STATE) { - WSREP_DEBUG("withdraw for BF trx: " TRX_ID_FMT ", state: %d", + WSREP_DEBUG("withdraw for BF trx: " TRX_ID_FMT ", state: %s", victim_trx->id, - wsrep_thd_get_conflict_state(thd)); + wsrep_thd_conflict_state_str(thd)); } switch (wsrep_thd_get_conflict_state(thd)) { @@ -18661,8 +18633,8 @@ wsrep_innobase_kill_one_trx( case ABORTED: case ABORTING: // fall through default: - WSREP_DEBUG("victim " TRX_ID_FMT " in state %d", - victim_trx->id, wsrep_thd_get_conflict_state(thd)); + WSREP_DEBUG("victim " TRX_ID_FMT " in state %s", + victim_trx->id, wsrep_thd_conflict_state_str(thd)); wsrep_thd_UNLOCK(thd); DBUG_RETURN(0); break; @@ -18765,9 +18737,9 @@ wsrep_innobase_kill_one_trx( wsrep_thd_trx_seqno(thd)); DBUG_RETURN(0); } + /* This will lock thd from proceeding after net_read() */ wsrep_thd_set_conflict_state(thd, ABORTING); - wsrep_lock_rollback(); if (wsrep_aborting_thd_contains(thd)) { @@ -18819,12 +18791,10 @@ wsrep_abort_transaction( if (victim_trx) { lock_mutex_enter(); trx_mutex_enter(victim_trx); - victim_trx->abort_type = TRX_WSREP_ABORT; int rcode = wsrep_innobase_kill_one_trx(bf_thd, bf_trx, victim_trx, signal); trx_mutex_exit(victim_trx); lock_mutex_exit(); - victim_trx->abort_type = TRX_SERVER_ABORT; wsrep_srv_conc_cancel_wait(victim_trx); DBUG_RETURN(rcode); } else { diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index fe16b8272b8..50405fee69b 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -624,6 +624,12 @@ struct trx_lock_t { only be modified by the thread that is serving the running transaction. */ +#ifdef WITH_WSREP + bool was_chosen_as_wsrep_victim; + /*!< high priority wsrep thread has + marked this trx to abort */ +#endif /* WITH_WSREP */ + mem_heap_t* lock_heap; /*!< memory heap for trx_locks; protected by lock_sys->mutex */ @@ -697,9 +703,6 @@ lock_sys->mutex and sometimes by trx->mutex. */ enum trx_abort_t { TRX_SERVER_ABORT = 0, -#ifdef WITH_WSREP - TRX_WSREP_ABORT, -#endif TRX_REPLICATION_ABORT }; diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 3970a559a4c..dcf5b5ecfd0 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -1793,10 +1793,8 @@ wsrep_kill_victim( } } - lock->trx->abort_type = TRX_WSREP_ABORT; wsrep_innobase_kill_one_trx(trx->mysql_thd, (const trx_t*) trx, lock->trx, TRUE); - lock->trx->abort_type = TRX_SERVER_ABORT; } } } @@ -7967,16 +7965,7 @@ lock_trx_release_locks( lock_mutex_exit(); } -/*********************************************************************//** -Check whether the transaction has already been rolled back because it -was selected as a deadlock victim, or if it has to wait then cancel -the wait lock. -@return DB_DEADLOCK, DB_LOCK_WAIT or DB_SUCCESS */ -UNIV_INTERN -dberr_t -lock_trx_handle_wait( -/*=================*/ - trx_t* trx) /*!< in/out: trx lock state */ +static inline dberr_t lock_trx_handle_wait_low(trx_t* trx) { ut_ad(lock_mutex_own()); ut_ad(trx_mutex_own(trx)); @@ -7993,6 +7982,35 @@ lock_trx_handle_wait( return DB_LOCK_WAIT; } +/*********************************************************************//** +Check whether the transaction has already been rolled back because it +was selected as a deadlock victim, or if it has to wait then cancel +the wait lock. +@return DB_DEADLOCK, DB_LOCK_WAIT or DB_SUCCESS */ +UNIV_INTERN +dberr_t +lock_trx_handle_wait( +/*=================*/ + trx_t* trx) /*!< in/out: trx lock state */ +{ +#ifdef WITH_WSREP + /* We already own mutexes */ + if (trx->lock.was_chosen_as_wsrep_victim) { + return lock_trx_handle_wait_low(trx); + } +#endif /* WITH_WSREP */ + if (trx->abort_type != TRX_REPLICATION_ABORT) { + lock_mutex_enter(); + } + trx_mutex_enter(trx); + dberr_t err = lock_trx_handle_wait_low(trx); + if (trx->abort_type != TRX_REPLICATION_ABORT) { + lock_mutex_exit(); + } + trx_mutex_exit(trx); + return err; +} + /*********************************************************************//** Get the number of locks on a table. @return number of locks */ diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 06bf4cc30c0..855266686e6 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -4746,11 +4746,7 @@ row_search_for_mysql( a deadlock and the transaction had to wait then release the lock it is waiting on. */ - lock_mutex_enter(); - trx_mutex_enter(trx); err = lock_trx_handle_wait(trx); - lock_mutex_exit(); - trx_mutex_exit(trx); switch (err) { case DB_SUCCESS: diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index 3fd71aff23a..be8b7d29350 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -370,6 +370,9 @@ trx_rollback_to_savepoint_for_mysql_low( trx_mark_sql_stat_end(trx); trx->op_info = ""; +#ifdef WITH_WSREP + trx->lock.was_chosen_as_wsrep_victim = FALSE; +#endif return(err); } diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index f36aabba8b4..f79ca7a2bc0 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -168,6 +168,9 @@ trx_create(void) #ifdef WITH_WSREP trx->wsrep_event = NULL; #endif /* WITH_WSREP */ + + trx->abort_type = TRX_SERVER_ABORT; + return(trx); } @@ -1339,12 +1342,10 @@ trx_commit_in_memory( ut_ad(!trx->in_ro_trx_list); ut_ad(!trx->in_rw_trx_list); + trx->dict_operation = TRX_DICT_OP_NONE; #ifdef WITH_WSREP - if (trx->mysql_thd && wsrep_on(trx->mysql_thd)) { - trx->lock.was_chosen_as_deadlock_victim = FALSE; - } + trx->lock.was_chosen_as_wsrep_victim = FALSE; #endif - trx->dict_operation = TRX_DICT_OP_NONE; trx->error_state = DB_SUCCESS; diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index d3be5155d27..09a8d36709d 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -5517,43 +5517,15 @@ static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels) /* if victim has been signaled by BF thread and/or aborting is already progressing, following query aborting is not necessary any more. - Also, BF thread should own trx mutex for the victim, which would - conflict with trx_mutex_enter() below */ DBUG_VOID_RETURN; } #endif /* WITH_WSREP */ + if (trx_t* trx = thd_to_trx(thd)) { ut_ad(trx->mysql_thd == thd); - - switch (trx->abort_type) { -#ifdef WITH_WSREP - case TRX_WSREP_ABORT: - break; -#endif - case TRX_SERVER_ABORT: - if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { - lock_mutex_enter(); - } - /* fall through */ - case TRX_REPLICATION_ABORT: - trx_mutex_enter(trx); - } /* Cancel a pending lock request if there are any */ lock_trx_handle_wait(trx); - switch (trx->abort_type) { -#ifdef WITH_WSREP - case TRX_WSREP_ABORT: - break; -#endif - case TRX_SERVER_ABORT: - if (!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { - lock_mutex_exit(); - } - /* fall through */ - case TRX_REPLICATION_ABORT: - trx_mutex_exit(trx); - } } DBUG_VOID_RETURN; @@ -19636,7 +19608,7 @@ wsrep_innobase_kill_one_trx( ut_ad(victim_trx); DBUG_ENTER("wsrep_innobase_kill_one_trx"); - THD *bf_thd = bf_thd_ptr ? (THD*) bf_thd_ptr : NULL; + THD *bf_thd = (THD *) bf_thd_ptr; THD *thd = (THD *) victim_trx->mysql_thd; int64_t bf_seqno = (bf_thd) ? wsrep_thd_trx_seqno(bf_thd) : 0; @@ -19646,25 +19618,28 @@ wsrep_innobase_kill_one_trx( DBUG_RETURN(1); } - if (!bf_thd) { - DBUG_PRINT("wsrep", ("no BF thd for conflicting lock")); - WSREP_WARN("no BF THD for trx: " TRX_ID_FMT, - bf_trx ? bf_trx->id : 0); - DBUG_RETURN(1); - } - WSREP_LOG_CONFLICT(bf_thd, thd, TRUE); - WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%lu) trx: " - TRX_ID_FMT, - signal, (long long)bf_seqno, + wsrep_thd_LOCK(thd); + + WSREP_DEBUG("BF kill (" ULINTPF ", seqno: " INT64PF + "), victim: (%lu) trx: " TRX_ID_FMT, + signal, bf_seqno, thd_get_thread_id(thd), victim_trx->id); - WSREP_DEBUG("Aborting query: %s", - (thd && wsrep_thd_query(thd)) ? wsrep_thd_query(thd) : "void"); + WSREP_DEBUG("Aborting query: %s conflict_state %s trx: %" PRId64, + (wsrep_thd_query(thd) ? wsrep_thd_query(thd) : "void"), + wsrep_thd_conflict_state_str(thd), + wsrep_thd_ws_handle(thd)->trx_id); + + /* + * we mark with was_chosen_as_deadlock_victim transaction, + * which is already marked as BF victim + * lock_sys is held until this vicitm has aborted + */ + victim_trx->lock.was_chosen_as_wsrep_victim = TRUE; - wsrep_thd_LOCK(thd); DBUG_EXECUTE_IF("sync.wsrep_after_BF_victim_lock", { const char act[]= @@ -19683,9 +19658,9 @@ wsrep_innobase_kill_one_trx( } if(wsrep_thd_exec_mode(thd) != LOCAL_STATE) { - WSREP_DEBUG("withdraw for BF trx: " TRX_ID_FMT ", state: %d", + WSREP_DEBUG("withdraw for BF trx: " TRX_ID_FMT ", state: %s", victim_trx->id, - wsrep_thd_get_conflict_state(thd)); + wsrep_thd_conflict_state_str(thd)); } switch (wsrep_thd_get_conflict_state(thd)) { @@ -19702,8 +19677,8 @@ wsrep_innobase_kill_one_trx( case ABORTED: case ABORTING: // fall through default: - WSREP_DEBUG("victim " TRX_ID_FMT " in state %d", - victim_trx->id, wsrep_thd_get_conflict_state(thd)); + WSREP_DEBUG("victim " TRX_ID_FMT " in state %s", + victim_trx->id, wsrep_thd_conflict_state_str(thd)); wsrep_thd_UNLOCK(thd); DBUG_RETURN(0); break; @@ -19806,9 +19781,9 @@ wsrep_innobase_kill_one_trx( wsrep_thd_trx_seqno(thd)); DBUG_RETURN(0); } + /* This will lock thd from proceeding after net_read() */ wsrep_thd_set_conflict_state(thd, ABORTING); - wsrep_lock_rollback(); if (wsrep_aborting_thd_contains(thd)) { @@ -19853,12 +19828,10 @@ wsrep_abort_transaction(handlerton* hton, THD *bf_thd, THD *victim_thd, if (victim_trx) { lock_mutex_enter(); trx_mutex_enter(victim_trx); - victim_trx->abort_type = TRX_WSREP_ABORT; int rcode = wsrep_innobase_kill_one_trx(bf_thd, bf_trx, victim_trx, signal); trx_mutex_exit(victim_trx); lock_mutex_exit(); - victim_trx->abort_type = TRX_SERVER_ABORT; wsrep_srv_conc_cancel_wait(victim_trx); DBUG_RETURN(rcode); } else { diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h index 77afde4c35c..5c11d3ae292 100644 --- a/storage/xtradb/include/trx0trx.h +++ b/storage/xtradb/include/trx0trx.h @@ -673,6 +673,12 @@ struct trx_lock_t { only be modified by the thread that is serving the running transaction. */ +#ifdef WITH_WSREP + bool was_chosen_as_wsrep_victim; + /*!< high priority wsrep thread has + marked this trx to abort */ +#endif /* WITH_WSREP */ + mem_heap_t* lock_heap; /*!< memory heap for trx_locks; protected by lock_sys->mutex */ @@ -746,10 +752,7 @@ lock_sys->mutex and sometimes by trx->mutex. */ enum trx_abort_t { TRX_SERVER_ABORT = 0, -#ifdef WITH_WSREP - TRX_WSREP_ABORT, -#endif - TRX_REPLICATION_ABORT + TRX_REPLICATION_ABORT = 1 }; struct trx_t{ diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc index 2183d281b78..53bd6e77fe8 100644 --- a/storage/xtradb/lock/lock0lock.cc +++ b/storage/xtradb/lock/lock0lock.cc @@ -1804,10 +1804,8 @@ wsrep_kill_victim( } } - lock->trx->abort_type = TRX_WSREP_ABORT; wsrep_innobase_kill_one_trx(trx->mysql_thd, (const trx_t*) trx, lock->trx, TRUE); - lock->trx->abort_type = TRX_SERVER_ABORT; } } } @@ -8077,16 +8075,7 @@ lock_trx_release_locks( lock_mutex_exit(); } -/*********************************************************************//** -Check whether the transaction has already been rolled back because it -was selected as a deadlock victim, or if it has to wait then cancel -the wait lock. -@return DB_DEADLOCK, DB_LOCK_WAIT or DB_SUCCESS */ -UNIV_INTERN -dberr_t -lock_trx_handle_wait( -/*=================*/ - trx_t* trx) /*!< in/out: trx lock state */ +static inline dberr_t lock_trx_handle_wait_low(trx_t* trx) { ut_ad(lock_mutex_own()); ut_ad(trx_mutex_own(trx)); @@ -8103,6 +8092,35 @@ lock_trx_handle_wait( return DB_LOCK_WAIT; } +/*********************************************************************//** +Check whether the transaction has already been rolled back because it +was selected as a deadlock victim, or if it has to wait then cancel +the wait lock. +@return DB_DEADLOCK, DB_LOCK_WAIT or DB_SUCCESS */ +UNIV_INTERN +dberr_t +lock_trx_handle_wait( +/*=================*/ + trx_t* trx) /*!< in/out: trx lock state */ +{ +#ifdef WITH_WSREP + /* We already own mutexes */ + if (trx->lock.was_chosen_as_wsrep_victim) { + return lock_trx_handle_wait_low(trx); + } +#endif /* WITH_WSREP */ + if (trx->abort_type != TRX_REPLICATION_ABORT) { + lock_mutex_enter(); + } + trx_mutex_enter(trx); + dberr_t err = lock_trx_handle_wait_low(trx); + if (trx->abort_type != TRX_REPLICATION_ABORT) { + lock_mutex_exit(); + } + trx_mutex_exit(trx); + return err; +} + /*********************************************************************//** Get the number of locks on a table. @return number of locks */ diff --git a/storage/xtradb/row/row0sel.cc b/storage/xtradb/row/row0sel.cc index b6b5d107885..87bc2aa2875 100644 --- a/storage/xtradb/row/row0sel.cc +++ b/storage/xtradb/row/row0sel.cc @@ -4755,11 +4755,7 @@ row_search_for_mysql( a deadlock and the transaction had to wait then release the lock it is waiting on. */ - lock_mutex_enter(); - trx_mutex_enter(trx); err = lock_trx_handle_wait(trx); - lock_mutex_exit(); - trx_mutex_exit(trx); switch (err) { case DB_SUCCESS: diff --git a/storage/xtradb/trx/trx0roll.cc b/storage/xtradb/trx/trx0roll.cc index 56b7120fa34..5e60725b9be 100644 --- a/storage/xtradb/trx/trx0roll.cc +++ b/storage/xtradb/trx/trx0roll.cc @@ -375,12 +375,8 @@ trx_rollback_to_savepoint_for_mysql_low( trx_mark_sql_stat_end(trx); trx->op_info = ""; - #ifdef WITH_WSREP - if (wsrep_on(trx->mysql_thd) && - trx->lock.was_chosen_as_deadlock_victim) { - trx->lock.was_chosen_as_deadlock_victim = FALSE; - } + trx->lock.was_chosen_as_wsrep_victim = FALSE; #endif return(err); diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc index 17cba81daf3..81ffbc6e4e1 100644 --- a/storage/xtradb/trx/trx0trx.cc +++ b/storage/xtradb/trx/trx0trx.cc @@ -304,6 +304,8 @@ trx_create(void) trx->wsrep_event = NULL; #endif /* WITH_WSREP */ + trx->abort_type = TRX_SERVER_ABORT; + return(trx); } @@ -1563,12 +1565,10 @@ trx_commit_in_memory( ut_ad(!trx->in_ro_trx_list); ut_ad(!trx->in_rw_trx_list); + trx->dict_operation = TRX_DICT_OP_NONE; #ifdef WITH_WSREP - if (trx->mysql_thd && wsrep_on(trx->mysql_thd)) { - trx->lock.was_chosen_as_deadlock_victim = FALSE; - } + trx->lock.was_chosen_as_wsrep_victim = FALSE; #endif - trx->dict_operation = TRX_DICT_OP_NONE; trx->error_state = DB_SUCCESS;
1 0
0 0
[Commits] 1ed1b7794fd: Merge remote-tracking branch 'connect/11.2' into 10.2
by Oleksandr Byelkin 04 Feb '19

04 Feb '19
revision-id: 1ed1b7794fd0eba99932f43dc3f6ce1c6cdfda5d (mariadb-10.2.21-57-g1ed1b7794fd) parent(s): 564f63ccf78678dffc32841381deb19954dd36e3 a0e26599a3a772ccaa06410c722a770e300b5bb8 author: Oleksandr Byelkin committer: Oleksandr Byelkin timestamp: 2019-02-04 16:09:42 +0100 message: Merge remote-tracking branch 'connect/11.2' into 10.2 storage/connect/ha_connect.cc | 41 ++++++++++++++++---- storage/connect/jsonudf.cpp | 49 +++++++++++++++++++++++- storage/connect/jsonudf.h | 5 +++ storage/connect/tabext.cpp | 43 ++++++++++++++++++++- storage/connect/tabext.h | 5 ++- storage/connect/tabjdbc.cpp | 89 ++++++++++++++++++++++++++----------------- storage/connect/tabjson.cpp | 8 ++-- 7 files changed, 188 insertions(+), 52 deletions(-)
1 0
0 0
[Commits] c19bb963d7d: MDEV-17783: AddressSanitizer: stack-buffer-overflow in table_cond_selectivity with
by Varun 04 Feb '19

04 Feb '19
revision-id: c19bb963d7dcd1b3000a1aaa90eb1a606fc1957d (mariadb-10.0.37-73-gc19bb963d7d) parent(s): d9d83f1d92b696ef56f4944df036b8a78364ebb4 author: Varun Gupta committer: Varun Gupta timestamp: 2019-02-04 18:53:32 +0530 message: MDEV-17783: AddressSanitizer: stack-buffer-overflow in table_cond_selectivity with optimizer_use_condition_selectivity > 1, join_cache_level >2 This case happens when we pick hash-join in best_access_path but the number of keyparts in the hash_key are > MAX_REF_PARTS. Not allowing hash-join when the keyparts are greater than MAX_REF_PARTS. --- mysql-test/r/selectivity.result | 14 ++++++++++++++ mysql-test/r/selectivity_innodb.result | 14 ++++++++++++++ mysql-test/t/selectivity.test | 17 +++++++++++++++++ sql/sql_select.cc | 3 +++ 4 files changed, 48 insertions(+) diff --git a/mysql-test/r/selectivity.result b/mysql-test/r/selectivity.result index 6af4f9a9ace..b8d54fa12a6 100644 --- a/mysql-test/r/selectivity.result +++ b/mysql-test/r/selectivity.result @@ -1640,3 +1640,17 @@ set @@use_stat_tables= @save_use_stat_tables; set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table t1; drop function f1; +# +# MDEV-17783: AddressSanitizer: stack-buffer-overflow in table_cond_selectivity +# with optimizer_use_condition_selectivity > 1, join_cache_level >2 +# +set @save_join_cache_level= @@join_cache_level; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set join_cache_level=3; +set optimizer_use_condition_selectivity=2; +CREATE TABLE t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int, c17 int, c18 int, c19 int, c20 int, c21 int, c22 int, c23 int, c24 int, c25 int, c26 int, c27 int, c28 int, c29 int, c30 int, c31 int, c32 int, c33 int, c34 int); +SELECT * FROM t1 WHERE (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34) IN (SELECT * FROM t1) ; +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 c33 c34 +set join_cache_level= @save_join_cache_level; +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1; diff --git a/mysql-test/r/selectivity_innodb.result b/mysql-test/r/selectivity_innodb.result index e0ed2865f13..9536e4eede7 100644 --- a/mysql-test/r/selectivity_innodb.result +++ b/mysql-test/r/selectivity_innodb.result @@ -1644,6 +1644,20 @@ set @@use_stat_tables= @save_use_stat_tables; set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table t1; drop function f1; +# +# MDEV-17783: AddressSanitizer: stack-buffer-overflow in table_cond_selectivity +# with optimizer_use_condition_selectivity > 1, join_cache_level >2 +# +set @save_join_cache_level= @@join_cache_level; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set join_cache_level=3; +set optimizer_use_condition_selectivity=2; +CREATE TABLE t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int, c17 int, c18 int, c19 int, c20 int, c21 int, c22 int, c23 int, c24 int, c25 int, c26 int, c27 int, c28 int, c29 int, c30 int, c31 int, c32 int, c33 int, c34 int); +SELECT * FROM t1 WHERE (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34) IN (SELECT * FROM t1) ; +c1 c2 c3 c4 c5 c6 c7 c8 c9 c10 c11 c12 c13 c14 c15 c16 c17 c18 c19 c20 c21 c22 c23 c24 c25 c26 c27 c28 c29 c30 c31 c32 c33 c34 +set join_cache_level= @save_join_cache_level; +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1; set optimizer_switch=@save_optimizer_switch_for_selectivity_test; set @tmp_ust= @@use_stat_tables; set @tmp_oucs= @@optimizer_use_condition_selectivity; diff --git a/mysql-test/t/selectivity.test b/mysql-test/t/selectivity.test index 557a4e92bca..102459dd7d7 100644 --- a/mysql-test/t/selectivity.test +++ b/mysql-test/t/selectivity.test @@ -1100,3 +1100,20 @@ set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectiv drop table t1; drop function f1; +--echo # +--echo # MDEV-17783: AddressSanitizer: stack-buffer-overflow in table_cond_selectivity +--echo # with optimizer_use_condition_selectivity > 1, join_cache_level >2 +--echo # + +set @save_join_cache_level= @@join_cache_level; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set join_cache_level=3; +set optimizer_use_condition_selectivity=2; + +CREATE TABLE t1 (c1 int, c2 int, c3 int, c4 int, c5 int, c6 int, c7 int, c8 int, c9 int, c10 int, c11 int, c12 int, c13 int, c14 int, c15 int, c16 int, c17 int, c18 int, c19 int, c20 int, c21 int, c22 int, c23 int, c24 int, c25 int, c26 int, c27 int, c28 int, c29 int, c30 int, c31 int, c32 int, c33 int, c34 int); + +SELECT * FROM t1 WHERE (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20, c21, c22, c23, c24, c25, c26, c27, c28, c29, c30, c31, c32, c33, c34) IN (SELECT * FROM t1) ; + +set join_cache_level= @save_join_cache_level; +set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 6fafbbb11df..dbf607516da 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -5775,6 +5775,7 @@ best_access_path(JOIN *join, bool best_uses_jbuf= FALSE; MY_BITMAP *eq_join_set= &s->table->eq_join_set; KEYUSE *hj_start_key= 0; + uint hash_key_parts=0; disable_jbuf= disable_jbuf || idx == join->const_tables; @@ -5820,6 +5821,7 @@ best_access_path(JOIN *join, if (!hj_start_key) hj_start_key= keyuse; bitmap_set_bit(eq_join_set, keyuse->keypart); + ++hash_key_parts; } keyuse++; continue; @@ -6186,6 +6188,7 @@ best_access_path(JOIN *join, if (idx > join->const_tables && best_key == 0 && (join->allowed_join_cache_types & JOIN_CACHE_HASHED_BIT) && join->max_allowed_join_cache_level > 2 && + hash_key_parts <= MAX_REF_PARTS && !bitmap_is_clear_all(eq_join_set) && !disable_jbuf && (!s->emb_sj_nest || join->allowed_semijoin_with_cache) && // (1)
1 0
0 0
[Commits] ce91482: MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys.
by holyfootï¼ askmonty.org 04 Feb '19

04 Feb '19
revision-id: ce91482df1af6935f81a2142d0ee9391feab2454 (mariadb-10.2.21-45-gce91482) parent(s): 97930df13c0e403940969ebb47398760b59f753c committer: Alexey Botchkov timestamp: 2019-02-04 12:57:57 +0400 message: MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys. The list of table constraints doesn't include foreign keys and uniques. So we replace DROP CONSTRAINT with DROP [FOREIGN] KEY in this case. --- mysql-test/r/alter_table.result | 49 ++++++++++++++++++++++++++++++++++ mysql-test/t/alter_table.test | 17 ++++++++++++ sql/sql_table.cc | 58 +++++++++++++++++++++++++++++++++++++++++ sql/sql_yacc.yy | 9 +++++-- 4 files changed, 131 insertions(+), 2 deletions(-) diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result index dcee72e..f243d24 100644 --- a/mysql-test/r/alter_table.result +++ b/mysql-test/r/alter_table.result @@ -2456,5 +2456,54 @@ ERROR 23000: Duplicate entry '1' for key 'i' UNLOCK TABLES; DROP TABLE t1; # +# MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys. +# +CREATE TABLE t1(id INT PRIMARY KEY, c1 INT) ENGINE= INNODB; +CREATE TABLE t2(id INT PRIMARY KEY, c1 INT, c2 INT NOT NULL, +CONSTRAINT sid FOREIGN KEY (`c1`) REFERENCES t1 (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, +CONSTRAINT UNIQUE `ui`(c2)) ENGINE= INNODB; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `c1` int(11) DEFAULT NULL, + `c2` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `ui` (`c2`), + KEY `sid` (`c1`), + CONSTRAINT `sid` FOREIGN KEY (`c1`) REFERENCES `t1` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t2 DROP CONSTRAINT sid; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `c1` int(11) DEFAULT NULL, + `c2` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `ui` (`c2`), + KEY `sid` (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t2 DROP CONSTRAINT ui; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `c1` int(11) DEFAULT NULL, + `c2` int(11) NOT NULL, + PRIMARY KEY (`id`), + KEY `sid` (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +ALTER TABLE t2 DROP CONSTRAINT PRIMARY KEY; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `id` int(11) NOT NULL, + `c1` int(11) DEFAULT NULL, + `c2` int(11) NOT NULL, + KEY `sid` (`c1`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t2, t1; +# # End of 10.2 tests # diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index df077c8..e6caadc 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -2013,5 +2013,22 @@ DROP TABLE t1; --echo # +--echo # MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys. +--echo # + +CREATE TABLE t1(id INT PRIMARY KEY, c1 INT) ENGINE= INNODB; +CREATE TABLE t2(id INT PRIMARY KEY, c1 INT, c2 INT NOT NULL, + CONSTRAINT sid FOREIGN KEY (`c1`) REFERENCES t1 (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT UNIQUE `ui`(c2)) ENGINE= INNODB; +SHOW CREATE TABLE t2; +ALTER TABLE t2 DROP CONSTRAINT sid; +SHOW CREATE TABLE t2; +ALTER TABLE t2 DROP CONSTRAINT ui; +SHOW CREATE TABLE t2; +ALTER TABLE t2 DROP CONSTRAINT PRIMARY KEY; +SHOW CREATE TABLE t2; +DROP TABLE t2, t1; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1b426f8..bd6ab9e 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -8993,6 +8993,64 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, THD_STAGE_INFO(thd, stage_setup); + + if (alter_info->flags & Alter_info::ALTER_DROP_CHECK_CONSTRAINT) + { + /* + ALTER TABLE DROP CONSTRAINT + should be replaced with ... DROP FOREIGN KEY + if the constraint is the FOREIGN KEY one. + */ + + List_iterator<Alter_drop> drop_it(alter_info->drop_list); + Alter_drop *drop; + alter_info->flags&= ~Alter_info::ALTER_DROP_CHECK_CONSTRAINT; + + while ((drop= drop_it++)) + { + if (drop->type == Alter_drop::CHECK_CONSTRAINT) + { + { + /* Test if there is a FOREIGN KEY with this name. */ + List <FOREIGN_KEY_INFO> fk_child_key_list; + FOREIGN_KEY_INFO *f_key; + table->file->get_foreign_key_list(thd, &fk_child_key_list); + List_iterator<FOREIGN_KEY_INFO> fk_key_it(fk_child_key_list); + + while ((f_key= fk_key_it++)) + { + if (my_strcasecmp(system_charset_info, f_key->foreign_id->str, + drop->name) == 0) + { + drop->type= Alter_drop::FOREIGN_KEY; + alter_info->flags|= Alter_info::DROP_FOREIGN_KEY; + goto do_continue; + } + } + } + + { + /* Test if there is an UNIQUE with this name. */ + uint n_key; + + for (n_key=0; n_key < table->s->keys; n_key++) + { + if ((table->key_info[n_key].flags & HA_NOSAME) && + my_strcasecmp(system_charset_info, + drop->name, table->key_info[n_key].name) == 0) + { + drop->type= Alter_drop::KEY; + alter_info->flags|= Alter_info::ALTER_DROP_INDEX; + goto do_continue; + } + } + } + } + alter_info->flags|= Alter_info::ALTER_DROP_CHECK_CONSTRAINT; +do_continue:; + } + } + handle_if_exists_options(thd, table, alter_info); /* diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index b2b9cb4..cc6670b 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1741,7 +1741,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize); IDENT_sys TEXT_STRING_sys TEXT_STRING_literal NCHAR_STRING opt_component key_cache_name sp_opt_label BIN_NUM label_ident TEXT_STRING_filesystem ident_or_empty - opt_constraint constraint opt_ident ident_table_alias + opt_constraint opt_constraint_no_id constraint opt_ident ident_table_alias %type <lex_str_ptr> opt_table_alias @@ -6123,6 +6123,11 @@ check_constraint: } ; +opt_constraint_no_id: + /* Empty */ {} + | CONSTRAINT {} + ; + opt_constraint: /* empty */ { $$= null_lex_str; } | constraint { $$= $1; } @@ -7653,7 +7658,7 @@ alter_list_item: lex->alter_info.drop_list.push_back(ad, thd->mem_root); lex->alter_info.flags|= Alter_info::DROP_FOREIGN_KEY; } - | DROP PRIMARY_SYM KEY_SYM + | DROP opt_constraint_no_id PRIMARY_SYM KEY_SYM { LEX *lex=Lex; Alter_drop *ad= (new (thd->mem_root)
1 0
0 0
[Commits] 07b7b2e: Fixed a merge problem: missing reference to rowid_filter.cc in a cmake file
by IgorBabaev 04 Feb '19

04 Feb '19
revision-id: 07b7b2e4efb82a50e4575c309bf6987975c4607f (mariadb-10.3.6-100-g07b7b2e) parent(s): cfd2646c3152bbefe11e381c00b701a49cf5c4ef author: Igor Babaev committer: Igor Babaev timestamp: 2019-02-04 00:25:56 -0800 message: Fixed a merge problem: missing reference to rowid_filter.cc in a cmake file --- libmysqld/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index dfb5d4c..bf277e9 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -121,6 +121,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ../sql/proxy_protocol.cc ../sql/backup.cc ../sql/sql_tvc.cc ../sql/sql_tvc.h ../sql/opt_split.cc + ../sql/rowid_filter.cc ../sql/rowid_filter.h ../sql/item_vers.cc ${GEN_SOURCES} ${MYSYS_LIBWRAP_SOURCE}
1 0
0 0
[Commits] cfd2646: Fixed the results after the merge of 10.4 into bb-10.4-mdev16188.
by IgorBabaev 03 Feb '19

03 Feb '19
revision-id: cfd2646c3152bbefe11e381c00b701a49cf5c4ef (mariadb-10.3.6-99-gcfd2646) parent(s): 37deed3f37561f264f65e162146bbc2ad35fb1a2 author: Igor Babaev committer: Igor Babaev timestamp: 2019-02-03 22:26:39 -0800 message: Fixed the results after the merge of 10.4 into bb-10.4-mdev16188. --- mysql-test/main/delete_use_source.result | 2 +- mysql-test/main/group_by.result | 1 + mysql-test/main/innodb_ext_key.result | 2 + mysql-test/main/join.result | 4 +- mysql-test/main/join_nested.result | 2 +- mysql-test/main/join_nested_jcl6.result | 4 +- mysql-test/main/join_outer_innodb.result | 32 +++++------ mysql-test/main/key.result | 3 +- mysql-test/main/myisam_icp.result | 8 ++- mysql-test/main/partition_range.result | 2 + mysql-test/main/range_vs_index_merge_innodb.result | 62 +++++++++++----------- mysql-test/main/select.result | 1 + mysql-test/main/select_jcl6.result | 1 + mysql-test/main/select_pkeycache.result | 1 + mysql-test/main/stat_tables.result | 4 +- mysql-test/main/subselect.result | 1 + mysql-test/main/subselect_mat.result | 21 +++++--- mysql-test/main/subselect_no_exists_to_in.result | 1 + mysql-test/main/subselect_no_mat.result | 1 + mysql-test/main/subselect_no_opts.result | 1 + mysql-test/main/subselect_no_scache.result | 1 + mysql-test/main/subselect_no_semijoin.result | 1 + mysql-test/main/subselect_sj.result | 4 +- mysql-test/main/subselect_sj2.result | 10 ++++ mysql-test/main/subselect_sj2_jcl6.result | 10 ++++ mysql-test/main/subselect_sj_jcl6.result | 4 +- mysql-test/main/subselect_sj_mat.result | 37 +++++++------ mysql-test/main/type_bit.result | 1 + mysql-test/main/union.result | 2 +- .../suite/sys_vars/r/optimizer_switch_basic.result | 36 ++++++------- .../sys_vars/r/sysvars_server_notembedded.result | 22 ++++++-- 31 files changed, 177 insertions(+), 105 deletions(-) diff --git a/mysql-test/main/delete_use_source.result b/mysql-test/main/delete_use_source.result index a9a6df8..0ce010e 100644 --- a/mysql-test/main/delete_use_source.result +++ b/mysql-test/main/delete_use_source.result @@ -48,7 +48,7 @@ rollback; start transaction; explain delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 limit 1; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 range c1 c1 4 NULL 600 Using where +1 PRIMARY t1 range c1 c1 4 NULL 502 Using where 2 DEPENDENT SUBQUERY b ref c1 c1 4 test.t1.c1 167 Using index delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 limit 1; affected rows: 1 diff --git a/mysql-test/main/group_by.result b/mysql-test/main/group_by.result index a6878e8..2eaec8a 100644 --- a/mysql-test/main/group_by.result +++ b/mysql-test/main/group_by.result @@ -2434,6 +2434,7 @@ INSERT INTO t1 VALUES (1,NULL),(0,'a'),(1,NULL),(0,'a'), (1,'a'),(0,'a'),(2,'a'),(1,'a'); 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_BUFFER_RESULT MIN(a), b FROM t1 WHERE t1.b = 'a' GROUP BY b; diff --git a/mysql-test/main/innodb_ext_key.result b/mysql-test/main/innodb_ext_key.result index b6fd9b0..daf1f53 100644 --- a/mysql-test/main/innodb_ext_key.result +++ b/mysql-test/main/innodb_ext_key.result @@ -1036,7 +1036,9 @@ insert into t1 (b) values (null), (null), (null); insert into t2 (b) values (null), (null), (null); analyze table t1,t2; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK set optimizer_switch='extended_keys=on'; explain select a from t1 where b is null order by a desc limit 2; diff --git a/mysql-test/main/join.result b/mysql-test/main/join.result index 57ed343..54da744 100644 --- a/mysql-test/main/join.result +++ b/mysql-test/main/join.result @@ -1270,7 +1270,9 @@ INSERT INTO t1 VALUES (3,'b'),(4,NULL),(5,'c'),(6,'cc'),(7,'d'), INSERT INTO t2 VALUES (2,NULL); ANALYZE TABLE t1,t2; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK FLUSH STATUS; SELECT * FROM t1 JOIN t2 ON t1.v = t2.v WHERE t2.v IS NULL ORDER BY 1; @@ -1278,7 +1280,7 @@ pk v pk v SHOW STATUS LIKE 'Handler_read_%'; Variable_name Value Handler_read_first 0 -Handler_read_key 1 +Handler_read_key 11 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 diff --git a/mysql-test/main/join_nested.result b/mysql-test/main/join_nested.result index 603612e..4db32c3 100644 --- a/mysql-test/main/join_nested.result +++ b/mysql-test/main/join_nested.result @@ -1064,7 +1064,7 @@ t0.b=t1.b AND id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t0 ref idx_a idx_a 5 const 2 100.00 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 ALL idx_b NULL NULL NULL 7 85.71 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (flat, BNL join) 1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where 1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where diff --git a/mysql-test/main/join_nested_jcl6.result b/mysql-test/main/join_nested_jcl6.result index bc65286..5791185 100644 --- a/mysql-test/main/join_nested_jcl6.result +++ b/mysql-test/main/join_nested_jcl6.result @@ -1075,7 +1075,7 @@ t0.b=t1.b AND id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t0 ref idx_a idx_a 5 const 2 100.00 1 SIMPLE t9 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t1 ALL idx_b NULL NULL NULL 7 85.71 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t1 ALL idx_b NULL NULL NULL 7 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t4 ref idx_b idx_b 5 test.t2.b 2 100.00 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan @@ -2003,7 +2003,7 @@ ON t6.b >= 2 AND t5.b=t7.b AND id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t5 ALL NULL NULL NULL NULL 3 1 SIMPLE t7 ref|filter PRIMARY,b_i b_i|PRIMARY 5|4 test.t5.b 2 (29%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using filter -1 SIMPLE t6 range|filter PRIMARY,b_i PRIMARY|b_i 4|5 NULL 3 (86%) Using where; Rowid-ordered scan; Using join buffer (incremental, BNL join); Using filter +1 SIMPLE t6 range PRIMARY,b_i PRIMARY 4 NULL 3 Using where; Rowid-ordered scan; Using join buffer (incremental, BNL join) 1 SIMPLE t8 ref b_i b_i 5 test.t5.b 2 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM t5 diff --git a/mysql-test/main/join_outer_innodb.result b/mysql-test/main/join_outer_innodb.result index 9ab8bde..9026a32 100644 --- a/mysql-test/main/join_outer_innodb.result +++ b/mysql-test/main/join_outer_innodb.result @@ -433,47 +433,47 @@ left join t16 on t15.o1 = t16.p1 where t1.a10 = 1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL a4,a6,a5,a7 NULL NULL NULL 3 Using where -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where; Using index -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.d1 1 Using where -1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index 1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1 1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t1.a5 1 1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where 1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where 1 SIMPLE t13 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index +1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index 1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1 1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index 1 SIMPLE m2 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index -1 SIMPLE l3 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where; Using index +1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 Using index +1 SIMPLE t5 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +1 SIMPLE l3 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1 +1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index 1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where 1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index 1 SIMPLE t16 ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where +1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) explain select * from v1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL a4,a6,a5,a7 NULL NULL NULL 3 Using where -1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index -1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where; Using index -1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 Using index -1 SIMPLE t5 eq_ref PRIMARY PRIMARY 4 test.t4.d1 1 Using where -1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index 1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index -1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1 1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t1.a5 1 1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where 1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where 1 SIMPLE t13 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index +1 SIMPLE t2 ref PRIMARY PRIMARY 4 test.t1.a1 1 Using index 1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1 1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index 1 SIMPLE m2 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index -1 SIMPLE l3 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.b2 1 Using where; Using index +1 SIMPLE t4 eq_ref PRIMARY PRIMARY 4 test.t1.a2 1 Using index +1 SIMPLE t5 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +1 SIMPLE l3 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1 +1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index 1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where 1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index 1 SIMPLE t16 ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where +1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) drop view v1; drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16; # diff --git a/mysql-test/main/key.result b/mysql-test/main/key.result index 42eca8d..d1d751c 100644 --- a/mysql-test/main/key.result +++ b/mysql-test/main/key.result @@ -605,12 +605,13 @@ VALUES (2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6); ANALYZE table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE -2 SUBQUERY t1 range NULL a 5 NULL 4 Using index for group-by +2 SUBQUERY t1 index NULL a 10 NULL 15 Using index SELECT 1 as RES FROM t1 AS t1_outer WHERE (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12; RES diff --git a/mysql-test/main/myisam_icp.result b/mysql-test/main/myisam_icp.result index 804a039..b76a4c2 100644 --- a/mysql-test/main/myisam_icp.result +++ b/mysql-test/main/myisam_icp.result @@ -407,7 +407,7 @@ WHERE (pk BETWEEN 4 AND 5 OR pk < 2) AND c1 < 240 ORDER BY c1 LIMIT 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY,k1 k1 5 NULL 4 Using where +1 SIMPLE t1 range|filter PRIMARY,k1 PRIMARY|k1 4|5 NULL 3 (50%) Using index condition; Using where; Rowid-ordered scan; Using filesort; Using filter DROP TABLE t1; # # @@ -590,7 +590,9 @@ PRIMARY KEY (pk) INSERT INTO t2 VALUES (4,1); ANALYZE TABLE t1,t2; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK EXPLAIN SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 @@ -799,7 +801,9 @@ INSERT INTO t2 (g,h) VALUES (7,'f'),(5,'j'),(3,'e'),(1,'u'),(4,'v'),(9,'u'); ANALYZE TABLE t1,t2; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date SET @save_optimize_switch=@@optimizer_switch; SET optimizer_switch='materialization=on'; @@ -810,7 +814,7 @@ AND (EXISTS (SELECT * FROM t1, t2 WHERE a = f AND h <= t.e AND a > t.b) OR a = 0 AND h < 'z' ); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t ALL PRIMARY,c NULL NULL NULL 64 Using where -1 PRIMARY t2 ref g g 5 test.t.c 19 Using where +1 PRIMARY t2 ref g g 5 test.t.c 18 Using where 2 DEPENDENT SUBQUERY t1 index PRIMARY PRIMARY 4 NULL 64 Using where; Using index 2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where SELECT COUNT(*) FROM t1 AS t, t2 diff --git a/mysql-test/main/partition_range.result b/mysql-test/main/partition_range.result index 2a79e01..48b1ce8 100644 --- a/mysql-test/main/partition_range.result +++ b/mysql-test/main/partition_range.result @@ -960,7 +960,9 @@ INSERT INTO t1 SELECT a + 40, b + 40 FROM t1; INSERT INTO t2 SELECT * FROM t1; ANALYZE TABLE t1,t2; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date # plans should be identical EXPLAIN SELECT a, MAX(b) FROM t1 WHERE a IN (10,100) GROUP BY a; diff --git a/mysql-test/main/range_vs_index_merge_innodb.result b/mysql-test/main/range_vs_index_merge_innodb.result index f085cf7..6b6b772 100644 --- a/mysql-test/main/range_vs_index_merge_innodb.result +++ b/mysql-test/main/range_vs_index_merge_innodb.result @@ -1085,7 +1085,7 @@ EXPLAIN SELECT Name, Country, Population FROM City WHERE (Name='Samara' AND Country='RUS') OR (Name='Seattle' AND Country='USA'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Country,CountryPopulation,CountryName,CityName CountryName,CityName 38,35 NULL 27 Using sort_union(CountryName,CityName); Using where +1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CityName 35 NULL 27 Using index condition; Using where SELECT Name, Country, Population FROM City WHERE (Name='Manila' AND Country='PHL') OR (Name='Addis Abeba' AND Country='ETH') OR @@ -1116,32 +1116,32 @@ SELECT Name, Country, Population FROM City WHERE (Name='Seattle' AND Country='USA'); Name Country Population Addis Abeba ETH 2495000 -Manila PHL 1581082 -Jakarta IDN 9604900 -Delhi IND 7206704 +Ankara TUR 3038159 Bangalore IND 2660088 -Teheran IRN 6758845 -Roma ITA 2643581 -Venezia ITA 277305 -Tokyo JPN 7980230 -Toronto CAN 688275 -Vancouver CAN 514008 -Peking CHN 7472000 -Seoul KOR 9981619 +Basel CHE 166700 +Caracas VEN 1975294 +Dakar SEN 785071 +Delhi IND 7206704 +Dresden DEU 476668 +Jakarta IDN 9604900 Kaunas LTU 412639 -Rabat MAR 623457 -Tijuana MEX 1212232 Lagos NGA 1518000 +Lugansk UKR 469000 +Manila PHL 1581082 Paris FRA 2125246 -Dresden DEU 476668 -Dakar SEN 785071 -Basel CHE 166700 +Peking CHN 7472000 Praha CZE 1181126 -Ankara TUR 3038159 -Lugansk UKR 469000 -Caracas VEN 1975294 +Rabat MAR 623457 +Roma ITA 2643581 Samara RUS 1156100 Seattle USA 563374 +Seoul KOR 9981619 +Teheran IRN 6758845 +Tijuana MEX 1212232 +Tokyo JPN 7980230 +Toronto CAN 688275 +Vancouver CAN 514008 +Venezia ITA 277305 set optimizer_switch='index_merge=off'; EXPLAIN SELECT Name, Country, Population FROM City WHERE (Name='Manila' AND Country='PHL') OR @@ -1172,7 +1172,7 @@ EXPLAIN SELECT Name, Country, Population FROM City WHERE (Name='Samara' AND Country='RUS') OR (Name='Seattle' AND Country='USA'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CityName 35 NULL 28 Using index condition; Using where +1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CityName 35 NULL 27 Using index condition; Using where SELECT Name, Country, Population FROM City WHERE (Name='Manila' AND Country='PHL') OR (Name='Addis Abeba' AND Country='ETH') OR @@ -1757,6 +1757,7 @@ INSERT INTO t1 VALUES (0,72,321,-7),(0,73,0,3),(0,74,5,25),(0,75,5,3); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK SET SESSION optimizer_switch='index_merge_sort_union=off'; EXPLAIN @@ -1837,6 +1838,7 @@ INSERT INTO t1 VALUES ; ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT * FROM t1 FORCE KEY (state,capital) @@ -1904,23 +1906,23 @@ Country='NOR' AND Name IN ('Oslo', 'Bergen') OR Country='ITA' AND Name IN ('Napoli', 'Venezia'); ID Name Country Population 175 Antwerpen BEL 446525 -176 Gent BEL 224180 +2808 Bergen NOR 230948 3068 Berlin DEU 3386667 3087 Bonn DEU 301048 +2918 Braga PRT 90535 +176 Gent BEL 224180 3242 Lahti FIN 96921 -2974 Paris FRA 2125246 +3580 Moscow RUS 8389200 1466 Napoli ITA 1002619 -1474 Venezia ITA 277305 -2808 Bergen NOR 230948 2807 Oslo NOR 508726 -2928 Warszawa POL 1615369 -2931 Wroclaw POL 636765 -2918 Braga PRT 90535 +2974 Paris FRA 2125246 2915 Porto PRT 273060 -3580 Moscow RUS 8389200 3581 St Petersburg RUS 4694000 3048 Stockholm SWE 750348 3051 Uppsala SWE 189569 +1474 Venezia ITA 277305 +2928 Warszawa POL 1615369 +2931 Wroclaw POL 636765 explain select * from City where Country='FIN' AND Name IN ('Lahti','Imatra') OR @@ -1934,7 +1936,7 @@ Country='POL' AND Name IN ('Warszawa', 'Wroclaw') OR Country='NOR' AND Name IN ('Oslo', 'Bergen') OR Country='ITA' AND Name IN ('Napoli', 'Venezia'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range CountryName,Name CountryName 38 NULL 20 Using index condition; Using where +1 SIMPLE City range CountryName,Name Name 35 NULL 20 Using index condition; Using where DROP DATABASE world; set session optimizer_switch='index_merge_sort_intersection=default'; set global innodb_stats_persistent= @innodb_stats_persistent_save; diff --git a/mysql-test/main/select.result b/mysql-test/main/select.result index 230bef6..a73516f 100644 --- a/mysql-test/main/select.result +++ b/mysql-test/main/select.result @@ -3701,6 +3701,7 @@ INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL; INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL; ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null=3; COUNT(*) diff --git a/mysql-test/main/select_jcl6.result b/mysql-test/main/select_jcl6.result index a27585c..3f9a9f4 100644 --- a/mysql-test/main/select_jcl6.result +++ b/mysql-test/main/select_jcl6.result @@ -3712,6 +3712,7 @@ INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL; INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL; ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null=3; COUNT(*) diff --git a/mysql-test/main/select_pkeycache.result b/mysql-test/main/select_pkeycache.result index 230bef6..a73516f 100644 --- a/mysql-test/main/select_pkeycache.result +++ b/mysql-test/main/select_pkeycache.result @@ -3701,6 +3701,7 @@ INSERT INTO t1 SELECT * FROM t1 WHERE ID1_with_null IS NULL; INSERT INTO t1 SELECT * FROM t1 WHERE ID2_with_null IS NULL; ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK SELECT COUNT(*) FROM t1 WHERE ID1_with_null IS NULL AND ID2_with_null=3; COUNT(*) diff --git a/mysql-test/main/stat_tables.result b/mysql-test/main/stat_tables.result index 56efb53..8cfa838 100644 --- a/mysql-test/main/stat_tables.result +++ b/mysql-test/main/stat_tables.result @@ -68,7 +68,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 -1 SIMPLE orders ref PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey 5 dbt3_s001.customer.c_custkey 15 Using where +1 SIMPLE orders ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (12%) Using where; Using filter 1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region @@ -175,7 +175,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 -1 SIMPLE orders ref PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey 5 dbt3_s001.customer.c_custkey 15 Using where +1 SIMPLE orders ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (12%) Using where; Using filter 1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region diff --git a/mysql-test/main/subselect.result b/mysql-test/main/subselect.result index 393e9be..3bd23a4 100644 --- a/mysql-test/main/subselect.result +++ b/mysql-test/main/subselect.result @@ -3106,6 +3106,7 @@ insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989'); insert into t2(a, c, b) values (4,10,'360'), (5,10,'35998'), (6,10,'35999'); 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 t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' diff --git a/mysql-test/main/subselect_mat.result b/mysql-test/main/subselect_mat.result index 1850742..3cd45d1 100644 --- a/mysql-test/main/subselect_mat.result +++ b/mysql-test/main/subselect_mat.result @@ -41,11 +41,17 @@ insert into t2i select * from t2; insert into t3i select * from t3; analyze table t1,t2,t3,t1i,t2i,t3i; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK +test.t1i analyze status Engine-independent statistics collected test.t1i analyze status Table is already up to date +test.t2i analyze status Engine-independent statistics collected test.t2i analyze status Table is already up to date +test.t3i analyze status Engine-independent statistics collected test.t3i analyze status Table is already up to date set @@optimizer_switch='materialization=on,in_to_exists=off,firstmatch=off'; /****************************************************************************** @@ -133,7 +139,7 @@ explain extended select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1i index NULL # # # 3 100.00 # -2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 # +2 MATERIALIZED t2i range it2i1,it2i3 # # # 5 100.00 # Warnings: Note 1003 /* select#1 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`b1` and `test`.`t1i`.`a2` = `<subquery2>`.`max(b2)`)))) select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1); @@ -144,7 +150,7 @@ explain extended select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1i index NULL # # # 3 100.00 # -2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 # +2 MATERIALIZED t2i range it2i1,it2i3 # # # 5 100.00 # Warnings: Note 1003 /* select#1 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` where <expr_cache><`test`.`t1i`.`a1`,`test`.`t1i`.`a2`>(<in_optimizer>((`test`.`t1i`.`a1`,`test`.`t1i`.`a2`),(`test`.`t1i`.`a1`,`test`.`t1i`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1i`.`a1` in <temporary table> on distinct_key where `test`.`t1i`.`a1` = `<subquery2>`.`b1` and `test`.`t1i`.`a2` = `<subquery2>`.`min(b2)`)))) select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); @@ -158,6 +164,7 @@ insert into t2i_c select * from t2i; insert into t2i_c select * from t2i; analyze table t2i_c; Table Op Msg_type Msg_text +test.t2i_c analyze status Engine-independent statistics collected test.t2i_c analyze status OK show create table t2i_c; Table Create Table @@ -172,7 +179,7 @@ explain extended select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 3 100.00 Using index for group-by +2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 4 100.00 Using index for group-by Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2i_c`.`b1`,max(`test`.`t2i_c`.`b2`) from `test`.`t2i_c` group by `test`.`t2i_c`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`max(b2)`)))) select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1); @@ -183,11 +190,11 @@ prepare st1 from "explain select * from t1 where (a1, a2) in (select b1, max(b2) execute st1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 3 Using index for group-by +2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 4 Using index for group-by execute st1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where -2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 3 Using index for group-by +2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 4 Using index for group-by prepare st2 from "select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1)"; execute st2; a1 a2 @@ -202,7 +209,7 @@ explain extended select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -2 MATERIALIZED t2i range it2i1,it2i3 it2i3 18 NULL 3 100.00 Using where; Using index for group-by +2 MATERIALIZED t2i range it2i1,it2i3 it2i3 9 NULL 5 100.00 Using where; Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a1`,`test`.`t1`.`a2`>(<in_optimizer>((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(`test`.`t1`.`a1`,`test`.`t1`.`a2`) in ( <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1` ), <primary_index_lookup>(`test`.`t1`.`a1` in <temporary table> on distinct_key where `test`.`t1`.`a1` = `<subquery2>`.`b1` and `test`.`t1`.`a2` = `<subquery2>`.`min(b2)`)))) select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); @@ -511,7 +518,7 @@ where (c1, c2) in (select b1, b2 from t2i where b2 > '0' or b2 = a2)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 5 DEPENDENT SUBQUERY t3c ALL NULL NULL NULL NULL 4 100.00 Using where -6 DEPENDENT SUBQUERY t2i index_subquery it2i1,it2i2,it2i3 it2i3 18 func,func 2 100.00 Using index; Using where +6 DEPENDENT SUBQUERY t2i index_subquery it2i1,it2i2,it2i3 it2i3 18 func,func 1 100.00 Using index; Using where 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where 4 MATERIALIZED t3b ALL NULL NULL NULL NULL 4 100.00 Using where 3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where diff --git a/mysql-test/main/subselect_no_exists_to_in.result b/mysql-test/main/subselect_no_exists_to_in.result index 46b6dd0..bacba84 100644 --- a/mysql-test/main/subselect_no_exists_to_in.result +++ b/mysql-test/main/subselect_no_exists_to_in.result @@ -3109,6 +3109,7 @@ insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989'); insert into t2(a, c, b) values (4,10,'360'), (5,10,'35998'), (6,10,'35999'); 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 t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' diff --git a/mysql-test/main/subselect_no_mat.result b/mysql-test/main/subselect_no_mat.result index d7b72eb..a5b1d95 100644 --- a/mysql-test/main/subselect_no_mat.result +++ b/mysql-test/main/subselect_no_mat.result @@ -3111,6 +3111,7 @@ insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989'); insert into t2(a, c, b) values (4,10,'360'), (5,10,'35998'), (6,10,'35999'); 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 t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' diff --git a/mysql-test/main/subselect_no_opts.result b/mysql-test/main/subselect_no_opts.result index 0b528a7..0ea16d8 100644 --- a/mysql-test/main/subselect_no_opts.result +++ b/mysql-test/main/subselect_no_opts.result @@ -3107,6 +3107,7 @@ insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989'); insert into t2(a, c, b) values (4,10,'360'), (5,10,'35998'), (6,10,'35999'); 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 t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' diff --git a/mysql-test/main/subselect_no_scache.result b/mysql-test/main/subselect_no_scache.result index 5062c04..196af2d 100644 --- a/mysql-test/main/subselect_no_scache.result +++ b/mysql-test/main/subselect_no_scache.result @@ -3112,6 +3112,7 @@ insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989'); insert into t2(a, c, b) values (4,10,'360'), (5,10,'35998'), (6,10,'35999'); 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 t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' diff --git a/mysql-test/main/subselect_no_semijoin.result b/mysql-test/main/subselect_no_semijoin.result index fa1312e..c590a5d 100644 --- a/mysql-test/main/subselect_no_semijoin.result +++ b/mysql-test/main/subselect_no_semijoin.result @@ -3107,6 +3107,7 @@ insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989'); insert into t2(a, c, b) values (4,10,'360'), (5,10,'35998'), (6,10,'35999'); 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 t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899' diff --git a/mysql-test/main/subselect_sj.result b/mysql-test/main/subselect_sj.result index b16cdc2..85a1ee1 100644 --- a/mysql-test/main/subselect_sj.result +++ b/mysql-test/main/subselect_sj.result @@ -3105,13 +3105,13 @@ explain select a from t1, t2 where b between 1 and 2 and a in (select b from t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 1463 Using index; FirstMatch(t1) +1 PRIMARY t2 ref idx idx 5 test.t1.a 1462 Using index; FirstMatch(t1) 1 PRIMARY t2 range idx idx 5 NULL 5 Using where; Using index; Using join buffer (flat, BNL join) explain select a from t1 join t2 on b between 1 and 2 and a in (select b from t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 1463 Using index; FirstMatch(t1) +1 PRIMARY t2 ref idx idx 5 test.t1.a 1462 Using index; FirstMatch(t1) 1 PRIMARY t2 range idx idx 5 NULL 5 Using where; Using index; Using join buffer (flat, BNL join) drop table t1,t2; set optimizer_switch= @tmp_mdev12675; diff --git a/mysql-test/main/subselect_sj2.result b/mysql-test/main/subselect_sj2.result index e5ed30c..6b86f5a 100644 --- a/mysql-test/main/subselect_sj2.result +++ b/mysql-test/main/subselect_sj2.result @@ -74,8 +74,11 @@ insert into t3 select a,a, a,a,a from t0; insert into t3 select a,a, a+100,a+100,a+100 from t0; analyze table t1,t2,t3; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK explain select * from t3 where b in (select a from t1); id select_type table type possible_keys key key_len ref rows Extra @@ -933,7 +936,9 @@ INSERT INTO t2 VALUES (15,'g',6),(16,'x',7),(17,'f',8); analyze table t1,t2; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain SELECT * FROM t1 WHERE b IN ( @@ -968,6 +973,7 @@ INSERT INTO t1 VALUES ('q','q'),('w','w'),('d','d'),('e','e'); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; # This query returned 6 rows instead of 19 @@ -1004,6 +1010,7 @@ INSERT INTO t2 SELECT * FROM t1; INSERT INTO t2 SELECT * FROM t1; ANALYZE TABLE t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK EXPLAIN SELECT * FROM t2 @@ -1253,8 +1260,11 @@ INSERT IGNORE INTO t2 (t2id, t1idref) VALUES (200011, 200001),(200012, 200001),( INSERT IGNORE INTO t3 VALUES (1, 200011, 1), (1, 200012, 2), (1, 200013, 3); ANALYZE TABLE t1,t2,t3; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK set @tmp7474= @@optimizer_search_depth; SET SESSION optimizer_search_depth = 1; diff --git a/mysql-test/main/subselect_sj2_jcl6.result b/mysql-test/main/subselect_sj2_jcl6.result index b930bdc..c523525 100644 --- a/mysql-test/main/subselect_sj2_jcl6.result +++ b/mysql-test/main/subselect_sj2_jcl6.result @@ -85,8 +85,11 @@ insert into t3 select a,a, a,a,a from t0; insert into t3 select a,a, a+100,a+100,a+100 from t0; analyze table t1,t2,t3; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK explain select * from t3 where b in (select a from t1); id select_type table type possible_keys key key_len ref rows Extra @@ -949,7 +952,9 @@ INSERT INTO t2 VALUES (15,'g',6),(16,'x',7),(17,'f',8); analyze table t1,t2; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain SELECT * FROM t1 WHERE b IN ( @@ -984,6 +989,7 @@ INSERT INTO t1 VALUES ('q','q'),('w','w'),('d','d'),('e','e'); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; # This query returned 6 rows instead of 19 @@ -1020,6 +1026,7 @@ INSERT INTO t2 SELECT * FROM t1; INSERT INTO t2 SELECT * FROM t1; ANALYZE TABLE t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK EXPLAIN SELECT * FROM t2 @@ -1269,8 +1276,11 @@ INSERT IGNORE INTO t2 (t2id, t1idref) VALUES (200011, 200001),(200012, 200001),( INSERT IGNORE INTO t3 VALUES (1, 200011, 1), (1, 200012, 2), (1, 200013, 3); ANALYZE TABLE t1,t2,t3; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK set @tmp7474= @@optimizer_search_depth; SET SESSION optimizer_search_depth = 1; diff --git a/mysql-test/main/subselect_sj_jcl6.result b/mysql-test/main/subselect_sj_jcl6.result index ca6eaeb..e5a6f28 100644 --- a/mysql-test/main/subselect_sj_jcl6.result +++ b/mysql-test/main/subselect_sj_jcl6.result @@ -3119,13 +3119,13 @@ explain select a from t1, t2 where b between 1 and 2 and a in (select b from t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 1463 Using index; FirstMatch(t1) +1 PRIMARY t2 ref idx idx 5 test.t1.a 1462 Using index; FirstMatch(t1) 1 PRIMARY t2 range idx idx 5 NULL 5 Using where; Using index; Using join buffer (flat, BNL join) explain select a from t1 join t2 on b between 1 and 2 and a in (select b from t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 1463 Using index; FirstMatch(t1) +1 PRIMARY t2 ref idx idx 5 test.t1.a 1462 Using index; FirstMatch(t1) 1 PRIMARY t2 range idx idx 5 NULL 5 Using where; Using index; Using join buffer (flat, BNL join) drop table t1,t2; set optimizer_switch= @tmp_mdev12675; diff --git a/mysql-test/main/subselect_sj_mat.result b/mysql-test/main/subselect_sj_mat.result index ee45627..00f5acc 100644 --- a/mysql-test/main/subselect_sj_mat.result +++ b/mysql-test/main/subselect_sj_mat.result @@ -40,11 +40,17 @@ insert into t2i select * from t2; insert into t3i select * from t3; analyze table t1,t2,t3,t1i,t2i,t3i; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK +test.t1i analyze status Engine-independent statistics collected test.t1i analyze status Table is already up to date +test.t2i analyze status Engine-independent statistics collected test.t2i analyze status Table is already up to date +test.t3i analyze status Engine-independent statistics collected test.t3i analyze status Table is already up to date set @@optimizer_switch='materialization=on,in_to_exists=off,firstmatch=off'; /****************************************************************************** @@ -138,7 +144,7 @@ select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1i index it1i1,it1i2,it1i3 # # # 3 100.00 # 1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 # -2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 # +2 MATERIALIZED t2i range it2i1,it2i3 # # # 5 100.00 # Warnings: Note 1003 /* select#1 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,max(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1i` where `<subquery2>`.`b1` = `test`.`t1i`.`a1` and `<subquery2>`.`max(b2)` = `test`.`t1i`.`a2` select * from t1i where (a1, a2) in (select b1, max(b2) from t2i where b1 > '0' group by b1); @@ -150,7 +156,7 @@ select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1i index it1i1,it1i2,it1i3 # # # 3 100.00 # 1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 # -2 MATERIALIZED t2i range it2i1,it2i3 # # # 3 100.00 # +2 MATERIALIZED t2i range it2i1,it2i3 # # # 5 100.00 # Warnings: Note 1003 /* select#1 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1i` where `<subquery2>`.`b1` = `test`.`t1i`.`a1` and `<subquery2>`.`min(b2)` = `test`.`t1i`.`a2` select * from t1i where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); @@ -164,6 +170,7 @@ insert into t2i_c select * from t2i; insert into t2i_c select * from t2i; analyze table t2i_c; Table Op Msg_type Msg_text +test.t2i_c analyze status Engine-independent statistics collected test.t2i_c analyze status OK show create table t2i_c; Table Create Table @@ -179,7 +186,7 @@ select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 -2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 3 100.00 Using index for group-by +2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 4 100.00 Using index for group-by Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (/* select#2 */ select `test`.`t2i_c`.`b1`,max(`test`.`t2i_c`.`b2`) from `test`.`t2i_c` group by `test`.`t2i_c`.`b1`) join `test`.`t1` where `<subquery2>`.`b1` = `test`.`t1`.`a1` and `<subquery2>`.`max(b2)` = `test`.`t1`.`a2` select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1); @@ -191,12 +198,12 @@ execute st1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 -2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 3 Using index for group-by +2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 4 Using index for group-by execute st1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 -2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 3 Using index for group-by +2 MATERIALIZED t2i_c range NULL it2i3 9 NULL 4 Using index for group-by prepare st2 from "select * from t1 where (a1, a2) in (select b1, max(b2) from t2i_c group by b1)"; execute st2; a1 a2 @@ -212,7 +219,7 @@ select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' g id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 test.t1.a1,test.t1.a2 1 100.00 -2 MATERIALIZED t2i range it2i1,it2i3 it2i3 18 NULL 3 100.00 Using where; Using index for group-by +2 MATERIALIZED t2i range it2i1,it2i3 it2i3 9 NULL 5 100.00 Using where; Using index Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from <materialize> (/* select#2 */ select `test`.`t2i`.`b1`,min(`test`.`t2i`.`b2`) from `test`.`t2i` where `test`.`t2i`.`b1` > '0' group by `test`.`t2i`.`b1`) join `test`.`t1` where `<subquery2>`.`b1` = `test`.`t1`.`a1` and `<subquery2>`.`min(b2)` = `test`.`t1`.`a2` select * from t1 where (a1, a2) in (select b1, min(b2) from t2i where b1 > '0' group by b1); @@ -328,7 +335,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 16 func,func 1 100.00 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 func,func 1 100.00 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -3 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 2 100.00 Using index +3 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and `test`.`t2`.`b1` > '0' and `test`.`t3`.`c2` > '0' @@ -348,7 +355,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2i index it2i1,it2i2,it2i3 # # # 5 50.00 # 1 PRIMARY t1i ref it1i1,it1i2,it1i3 # # # 1 100.00 # 1 PRIMARY t3i ref it3i1,it3i2,it3i3 # # # 1 100.00 # -1 PRIMARY t2i ref it2i1,it2i2,it2i3 # # # 2 100.00 # +1 PRIMARY t2i ref it2i1,it2i2,it2i3 # # # 1 100.00 # Warnings: Note 1003 select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i`.`a2` AS `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where `test`.`t1i`.`a1` = `test`.`t2i`.`b1` and `test`.`t3i`.`c1` = `test`.`t2i`.`b1` and `test`.`t2i`.`b1` = `test`.`t2i`.`b1` and `test`.`t1i`.`a2` = `test`.`t2i`.`b2` and `test`.`t3i`.`c2` = `test`.`t2i`.`b2` and `test`.`t2i`.`b2` = `test`.`t2i`.`b2` and `test`.`t2i`.`b1` > '0' and `test`.`t2i`.`b2` > '0' select * from t1i @@ -370,7 +377,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery5> eq_ref distinct_key distinct_key 16 func,func 1 100.00 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 16 func,func 1 100.00 5 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 2 100.00 Using index +5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where 4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where @@ -396,7 +403,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery5> eq_ref distinct_key distinct_key 16 func,func 1 100.00 1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) 5 MATERIALIZED t3c ALL NULL NULL NULL NULL 4 100.00 Using where -5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3c.c1,test.t3c.c2 2 100.00 Using index +5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3c.c1,test.t3c.c2 1 100.00 Using index 4 MATERIALIZED t3b ALL NULL NULL NULL NULL 4 100.00 Using where 3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: @@ -429,14 +436,14 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery5> eq_ref distinct_key # # # 1 100.00 # 1 PRIMARY <subquery2> eq_ref distinct_key # # # 1 100.00 # 5 MATERIALIZED t3 ALL NULL # # # 4 100.00 # -5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 # # # 2 100.00 # +5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 # # # 1 100.00 # 2 MATERIALIZED t2 ALL NULL # # # 5 100.00 # 4 MATERIALIZED t3 ALL NULL # # # 4 100.00 # 3 MATERIALIZED t3 ALL NULL # # # 4 100.00 # 7 UNION t2i index it2i1,it2i2,it2i3 # # # 5 50.00 # 7 UNION t1i ref it1i1,it1i2,it1i3 # # # 1 100.00 # 7 UNION t3i ref it3i1,it3i2,it3i3 # # # 1 100.00 # -7 UNION t2i ref it2i1,it2i2,it2i3 # # # 2 100.00 # +7 UNION t2i ref it2i1,it2i2,it2i3 # # # 1 100.00 # NULL UNION RESULT <union1,7> ALL NULL # # # NULL NULL # Warnings: Note 1003 (/* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and (<expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (/* select#3 */ select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%02' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery3>`.`c2`)))) or <expr_cache><`test`.`t2`.`b2`>(<in_optimizer>(`test`.`t2`.`b2`,`test`.`t2`.`b2` in ( <materialize> (/* select#4 */ select `test`.`t3`.`c2` from `test`.`t3` where `test`.`t3`.`c2` like '%03' ), <primary_index_lookup>(`test`.`t2`.`b2` in <temporary table> on distinct_key where `test`.`t2`.`b2` = `<subquery4>`.`c2`))))) and `test`.`t3`.`c2` > '0') union (/* select#7 */ select `test`.`t1i`.`a1` AS `a1`,`test`.`t1i `.`a2` A S `a2` from `test`.`t1i` semi join (`test`.`t2i`) semi join (`test`.`t2i` join `test`.`t3i`) where `test`.`t1i`.`a1` = `test`.`t2i`.`b1` and `test`.`t3i`.`c1` = `test`.`t2i`.`b1` and `test`.`t2i`.`b1` = `test`.`t2i`.`b1` and `test`.`t1i`.`a2` = `test`.`t2i`.`b2` and `test`.`t3i`.`c2` = `test`.`t2i`.`b2` and `test`.`t2i`.`b2` = `test`.`t2i`.`b2` and `test`.`t2i`.`b1` > '0' and `test`.`t2i`.`b2` > '0') @@ -464,7 +471,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 16 func,func 1 100.00 4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -4 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 2 100.00 Using index +4 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL @@ -488,7 +495,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <subquery4> ALL distinct_key NULL NULL NULL 4 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) 4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -4 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 2 100.00 Using index +4 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 1 100.00 Using index 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL @@ -531,7 +538,7 @@ b2 in (select c2 from t3 t3b where c2 LIKE '%03')) and where (c1, c2) in (select b1, b2 from t2i where b2 > '0' or b2 = a2)); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where -1 PRIMARY t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t1.a1,test.t1.a2 2 100.00 Using index; Start temporary +1 PRIMARY t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t1.a1,test.t1.a2 1 100.00 Using index; Start temporary 1 PRIMARY t3c ALL NULL NULL NULL NULL 4 100.00 Using where; End temporary; Using join buffer (flat, BNL join) 1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) 4 MATERIALIZED t3b ALL NULL NULL NULL NULL 4 100.00 Using where diff --git a/mysql-test/main/type_bit.result b/mysql-test/main/type_bit.result index 42b31be..c2db7ee 100644 --- a/mysql-test/main/type_bit.result +++ b/mysql-test/main/type_bit.result @@ -679,6 +679,7 @@ INSERT IGNORE INTO t1(a) VALUES (65535),(65525),(65535),(65535),(65535),(65535),(65535),(65535),(65535),(65535); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT 1 FROM t1 GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result index 7ad5881..4d82e53 100644 --- a/mysql-test/main/union.result +++ b/mysql-test/main/union.result @@ -2187,7 +2187,7 @@ select id from t5 where name = (select name from t3 where id = t1.product_id)) l id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 2 SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 func 1 Using where -3 SUBQUERY t2 ref PRIMARY PRIMARY 4 const 3 Using index +3 SUBQUERY t2 ref PRIMARY PRIMARY 4 const 4 Using index 4 UNION t2 ref PRIMARY PRIMARY 4 func 1 Using where; Using index 5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 6 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables diff --git a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result index bc22fe1..aa52edc 100644 --- a/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result +++ b/mysql-test/suite/sys_vars/r/optimizer_switch_basic.result @@ -1,63 +1,63 @@ SET @start_global_value = @@global.optimizer_switch; SELECT @start_global_value; @start_global_value -index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on +index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on select @@global.optimizer_switch; @@global.optimizer_switch -index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on +index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on select @@session.optimizer_switch; @@session.optimizer_switch -index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on +index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on show global variables like 'optimizer_switch'; Variable_name Value -optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on +optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on show session variables like 'optimizer_switch'; Variable_name Value -optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on +optimizer_switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on select * from information_schema.global_variables where variable_name='optimizer_switch'; VARIABLE_NAME VARIABLE_VALUE -OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on +OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on select * from information_schema.session_variables where variable_name='optimizer_switch'; VARIABLE_NAME VARIABLE_VALUE -OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on +OPTIMIZER_SWITCH index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on set global optimizer_switch=10; set session optimizer_switch=5; select @@global.optimizer_switch; @@global.optimizer_switch -index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off +index_merge=off,index_merge_union=on,index_merge_sort_union=off,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off select @@session.optimizer_switch; @@session.optimizer_switch -index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off +index_merge=on,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off set global optimizer_switch="index_merge_sort_union=on"; set session optimizer_switch="index_merge=off"; select @@global.optimizer_switch; @@global.optimizer_switch -index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off +index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off select @@session.optimizer_switch; @@session.optimizer_switch -index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off +index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off show global variables like 'optimizer_switch'; Variable_name Value -optimizer_switch index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off +optimizer_switch index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off show session variables like 'optimizer_switch'; Variable_name Value -optimizer_switch index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off +optimizer_switch index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off select * from information_schema.global_variables where variable_name='optimizer_switch'; VARIABLE_NAME VARIABLE_VALUE -OPTIMIZER_SWITCH index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off +OPTIMIZER_SWITCH index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off select * from information_schema.session_variables where variable_name='optimizer_switch'; VARIABLE_NAME VARIABLE_VALUE -OPTIMIZER_SWITCH index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off +OPTIMIZER_SWITCH index_merge=off,index_merge_union=off,index_merge_sort_union=on,index_merge_intersection=off,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off set session optimizer_switch="default"; select @@session.optimizer_switch; @@session.optimizer_switch -index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off +index_merge=off,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=off,derived_merge=off,derived_with_keys=off,firstmatch=off,loosescan=off,materialization=off,in_to_exists=off,semijoin=off,partial_match_rowid_merge=off,partial_match_table_scan=off,subquery_cache=off,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=off,join_cache_hashed=off,join_cache_bka=off,optimize_join_buffer_size=off,table_elimination=off,extended_keys=off,exists_to_in=off,orderby_uses_equalities=off,condition_pushdown_for_derived=off,split_materialized=off,condition_pushdown_for_subquery=off,rowid_filter=off set optimizer_switch = replace(@@optimizer_switch, '=off', '=on'); Warnings: Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release select @@optimizer_switch; @@optimizer_switch -index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on +index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=on,engine_condition_pushdown=on,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=on,mrr_cost_based=on,mrr_sort_keys=on,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on set global optimizer_switch=1.1; ERROR 42000: Incorrect argument type to variable 'optimizer_switch' set global optimizer_switch=1e1; @@ -69,4 +69,4 @@ ERROR 42000: Variable 'optimizer_switch' can't be set to the value of 'foobar' SET @@global.optimizer_switch = @start_global_value; SELECT @@global.optimizer_switch; @@global.optimizer_switch -index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on +index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 219b550..4f1b898 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -2476,6 +2476,20 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME MAX_ROWID_FILTER_SIZE +SESSION_VALUE 131072 +GLOBAL_VALUE 131072 +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE 131072 +VARIABLE_SCOPE SESSION +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT The maximum number of rows that fit in memory +NUMERIC_MIN_VALUE 1024 +NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_BLOCK_SIZE 1 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_SEEKS_FOR_KEY SESSION_VALUE 4294967295 GLOBAL_VALUE 4294967295 @@ -2953,17 +2967,17 @@ ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_SWITCH -SESSION_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on -GLOBAL_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on +SESSION_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on +GLOBAL_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on +DEFAULT_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on VARIABLE_SCOPE SESSION VARIABLE_TYPE FLAGSET VARIABLE_COMMENT Fine-tune the optimizer behavior NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,default +ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,split_materialized,condition_pushdown_for_subquery,rowid_filter,default READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_USE_CONDITION_SELECTIVITY
1 0
0 0
[Commits] 37deed3: Merge branch '10.4' into bb-10.4-mdev16188
by IgorBabaev 03 Feb '19

03 Feb '19
revision-id: 37deed3f37561f264f65e162146bbc2ad35fb1a2 (mariadb-10.3.6-98-g37deed3) parent(s): 658128af43b4d7c6db445164f8ed25ed4d1e3109 5b996782be6b752ce50a0ecaa222b0688aa9e75d author: Igor Babaev committer: Igor Babaev timestamp: 2019-02-03 18:41:18 -0800 message: Merge branch '10.4' into bb-10.4-mdev16188 .gitignore | 3 + .gitmodules | 4 + .travis.compiler.sh | 13 +- .travis.yml | 65 +- BUILD/SETUP.sh | 5 +- CMakeLists.txt | 6 +- CONTRIBUTING.md | 47 + Docs/INSTALL-BINARY | 24 +- Docs/README-wsrep | 50 +- Docs/glibc-2.2.5.patch | 137 -- Docs/linuxthreads.txt | 19 - Docs/sp-imp-spec.txt | 1100 --------- KNOWN_BUGS.txt | 38 +- README.md | 30 +- VERSION | 4 +- appveyor.yml | 4 +- client/CMakeLists.txt | 2 +- client/mysql.cc | 10 +- client/mysql_upgrade.c | 10 +- client/mysqladmin.cc | 2 +- client/mysqlbinlog.cc | 16 +- client/mysqldump.c | 12 +- client/mysqlimport.c | 5 +- client/mysqlshow.c | 4 +- client/mysqlslap.c | 2 +- client/mysqltest.cc | 50 +- cmake/configure.pl | 15 + cmake/cpack_rpm.cmake | 4 +- cmake/make_dist.cmake.in | 8 + cmake/mariadb_connector_c.cmake | 5 +- cmake/os/WindowsCache.cmake | 1 + cmake/submodules.cmake | 6 +- cmake/wsrep.cmake | 15 +- cmake/zlib.cmake | 5 - config.h.cmake | 1 + configure.cmake | 1 + debian/additions/debian-start | 2 +- debian/additions/debian-start.inc.sh | 2 +- debian/autobake-deb.sh | 8 +- debian/control | 6 +- debian/mariadb-server-10.4.install | 5 +- debian/mariadb-server-10.4.postinst | 60 +- debian/rules | 5 - extra/innochecksum.cc | 40 +- extra/mariabackup/CMakeLists.txt | 29 +- extra/mariabackup/backup_copy.cc | 136 +- extra/mariabackup/backup_mysql.cc | 217 +- extra/mariabackup/changed_page_bitmap.cc | 26 +- extra/mariabackup/common.h | 71 +- extra/mariabackup/datasink.c | 141 -- extra/mariabackup/datasink.cc | 138 ++ extra/mariabackup/ds_archive.c | 281 --- extra/mariabackup/ds_archive.cc | 281 +++ extra/mariabackup/ds_buffer.c | 189 -- extra/mariabackup/ds_buffer.cc | 189 ++ extra/mariabackup/ds_compress.c | 463 ---- extra/mariabackup/ds_compress.cc | 463 ++++ extra/mariabackup/ds_local.cc | 1 - extra/mariabackup/ds_stdout.c | 122 - extra/mariabackup/ds_stdout.cc | 122 + extra/mariabackup/ds_tmpfile.c | 234 -- extra/mariabackup/ds_tmpfile.cc | 230 ++ extra/mariabackup/ds_xbstream.c | 223 -- extra/mariabackup/ds_xbstream.cc | 223 ++ extra/mariabackup/encryption_plugin.cc | 9 +- extra/mariabackup/fil_cur.cc | 229 +- extra/mariabackup/innobackupex.cc | 2 +- extra/mariabackup/write_filt.cc | 11 +- extra/mariabackup/wsrep.cc | 7 +- extra/mariabackup/xbstream.c | 564 ----- extra/mariabackup/xbstream.cc | 563 +++++ extra/mariabackup/xbstream.h | 2 +- extra/mariabackup/xbstream_read.c | 228 -- extra/mariabackup/xbstream_read.cc | 228 ++ extra/mariabackup/xbstream_write.c | 294 --- extra/mariabackup/xbstream_write.cc | 294 +++ extra/mariabackup/xtrabackup.cc | 717 +++--- extra/mariabackup/xtrabackup.h | 16 +- extra/perror.c | 6 +- extra/resolve_stack_dump.c | 2 +- extra/yassl/src/ssl.cpp | 16 +- include/aria_backup.h | 34 + include/json_lib.h | 17 +- include/lf.h | 2 + include/my_counter.h | 49 + include/my_global.h | 2 +- include/my_pthread.h | 14 +- include/my_time.h | 55 +- include/mysql/plugin.h | 2 +- include/mysql/plugin_audit.h.pp | 45 + include/mysql/plugin_auth.h.pp | 45 + include/mysql/plugin_encryption.h.pp | 45 + include/mysql/plugin_ftparser.h.pp | 45 + include/mysql/plugin_password_validation.h.pp | 45 + include/mysql/service_json.h | 117 + include/mysql/service_wsrep.h | 305 ++- include/mysql/services.h | 1 + include/mysql_com.h | 1 + include/service_versions.h | 1 + include/thr_lock.h | 6 +- include/thread_pool_priv.h | 3 - include/wsrep.h | 27 +- libmariadb | 2 +- libmysqld/CMakeLists.txt | 2 +- libmysqld/examples/CMakeLists.txt | 2 +- libmysqld/lib_sql.cc | 9 +- libmysqld/libmysql.c | 7 +- libservices/CMakeLists.txt | 1 + libservices/json_service.c | 19 + man/CMakeLists.txt | 1 - man/wsrep_sst_xtrabackup-v2.1 | 16 - man/wsrep_sst_xtrabackup.1 | 16 - mysql-test/include/add_anonymous_users.inc | 2 +- mysql-test/include/check-testcase.test | 51 + mysql-test/include/check_ftwrl_incompatible.inc | 6 +- mysql-test/include/default_mysqld.cnf | 1 + mysql-test/include/galera_cluster.inc | 6 + mysql-test/include/galera_have_debug_sync.inc | 9 + mysql-test/include/galera_wait_sync_point.inc | 11 + .../include/have_aria_used_for_temp_tables.inc | 4 + mysql-test/include/have_auth_named_pipe.inc | 13 + mysql-test/include/have_openssl.inc | 7 +- mysql-test/include/have_wsrep_enabled.inc | 1 - .../include/innodb_encrypt_tables.combinations | 14 + mysql-test/include/innodb_encrypt_tables.inc | 4 + mysql-test/include/kill_galera.inc | 20 + mysql-test/include/mtr_check.sql | 2 +- mysql-test/include/switch_to_mysql_global_priv.inc | 6 + mysql-test/include/switch_to_mysql_user.inc | 56 + mysql-test/include/system_db_struct.inc | 1 + mysql-test/include/wait_until_connected_again.inc | 19 +- mysql-test/include/wsrep_wait_disconnect.inc | 20 + mysql-test/lib/generate-ssl-certs.sh | 37 +- mysql-test/lib/mtr_cases.pm | 1 + mysql-test/main/1st.result | 1 + mysql-test/main/alter_table.result | 28 +- mysql-test/main/alter_table.test | 19 + mysql-test/main/alter_table_errors.result | 19 + mysql-test/main/alter_table_errors.test | 11 + mysql-test/main/alter_user.result | 19 +- mysql-test/main/alter_user.test | 4 +- mysql-test/main/analyze.result | 7 + mysql-test/main/auth_rpl.result | 2 +- mysql-test/main/backup_aria.result | 158 ++ mysql-test/main/backup_aria.test | 157 ++ mysql-test/main/backup_interaction.result | 520 ++++ mysql-test/main/backup_interaction.test | 503 ++++ mysql-test/main/backup_lock.result | 219 ++ mysql-test/main/backup_lock.test | 284 +++ mysql-test/main/backup_lock_debug.result | 28 + mysql-test/main/backup_lock_debug.test | 40 + mysql-test/main/backup_locks.result | 46 + mysql-test/main/backup_locks.test | 50 + mysql-test/main/backup_priv.result | 40 + mysql-test/main/backup_priv.test | 52 + mysql-test/main/backup_stages.result | 335 +++ mysql-test/main/backup_stages.test | 385 +++ mysql-test/main/backup_syntax.result | 163 ++ mysql-test/main/backup_syntax.test | 181 ++ mysql-test/main/bigint.result | 11 + mysql-test/main/bigint.test | 9 + mysql-test/main/check.result | 10 + mysql-test/main/check.test | 12 + mysql-test/main/column_compression_parts.result | 1 + mysql-test/main/column_compression_parts.test | 2 +- mysql-test/main/connect.result | 19 +- mysql-test/main/connect.test | 29 +- mysql-test/main/create-big.result | 12 +- mysql-test/main/create-big.test | 12 +- mysql-test/main/create.result | 101 +- mysql-test/main/create.test | 91 +- mysql-test/main/create_drop_binlog.result | 4 - mysql-test/main/create_or_replace.result | 51 +- mysql-test/main/create_or_replace.test | 22 +- mysql-test/main/create_user.result | 16 +- mysql-test/main/create_utf8.result | 89 + mysql-test/main/create_utf8.test | 80 + mysql-test/main/cte_recursive.result | 86 + mysql-test/main/cte_recursive.test | 73 + mysql-test/main/ctype_big5.result | 128 +- mysql-test/main/ctype_cp932_binlog_stm.result | 128 +- mysql-test/main/ctype_eucjpms.result | 128 +- mysql-test/main/ctype_euckr.result | 140 +- mysql-test/main/ctype_gb2312.result | 128 +- mysql-test/main/ctype_gbk.result | 454 ++-- mysql-test/main/ctype_latin1.result | 8 +- mysql-test/main/ctype_many.result | 4 +- mysql-test/main/ctype_recoding.result | 4 +- mysql-test/main/ctype_sjis.result | 128 +- mysql-test/main/ctype_uca.result | 40 +- mysql-test/main/ctype_uca_innodb.result | 28 +- mysql-test/main/ctype_ucs.result | 14 +- mysql-test/main/ctype_ucs.test | 15 + mysql-test/main/ctype_ujis.result | 128 +- mysql-test/main/ctype_ujis_ucs2.result | 150 +- mysql-test/main/ctype_upgrade.result | 6 +- mysql-test/main/ctype_utf16.result | 4 +- mysql-test/main/ctype_utf16le.result | 4 +- mysql-test/main/ctype_utf32.result | 18 +- mysql-test/main/ctype_utf8.result | 86 +- mysql-test/main/ctype_utf8mb4.result | 52 +- mysql-test/main/ctype_utf8mb4_heap.result | 14 +- mysql-test/main/ctype_utf8mb4_innodb.result | 16 +- mysql-test/main/ctype_utf8mb4_myisam.result | 16 +- mysql-test/main/custom_aggregate_functions.result | 2 +- mysql-test/main/delayed.result | 4 +- mysql-test/main/delete_use_source.result | 9 +- mysql-test/main/deprecated_features.result | 2 +- mysql-test/main/derived_cond_pushdown.result | 251 +- mysql-test/main/derived_cond_pushdown.test | 27 + mysql-test/main/derived_split_innodb.result | 1 + mysql-test/main/derived_view.result | 8 +- mysql-test/main/disabled.def | 7 +- mysql-test/main/distinct.result | 24 +- mysql-test/main/distinct.test | 18 + mysql-test/main/empty_user_table.result | 11 +- mysql-test/main/empty_user_table.test | 22 +- mysql-test/main/events_bugs.result | 2 +- mysql-test/main/explain_json.result | 1 + mysql-test/main/explain_non_select.result | 2 +- mysql-test/main/failed_auth_3909.result | 25 +- mysql-test/main/failed_auth_3909.test | 18 +- mysql-test/main/failed_auth_unixsocket.result | 4 +- mysql-test/main/failed_auth_unixsocket.test | 4 +- mysql-test/main/flush.result | 21 +- mysql-test/main/flush.test | 48 +- mysql-test/main/flush_block_commit.test | 2 +- .../main/flush_block_commit_notembedded.test | 2 +- mysql-test/main/flush_read_lock.result | 58 +- mysql-test/main/flush_read_lock.test | 115 +- mysql-test/main/flush_read_lock_kill.test | 2 +- mysql-test/main/flush_ssl.result | 26 + mysql-test/main/flush_ssl.test | 61 + mysql-test/main/fulltext.result | 8 +- mysql-test/main/func_default.result | 10 +- mysql-test/main/func_default.test | 5 + mysql-test/main/func_extract.result | 592 +++++ mysql-test/main/func_extract.test | 257 ++ mysql-test/main/func_group_innodb.result | 26 +- mysql-test/main/func_group_innodb.test | 19 + mysql-test/main/func_hybrid_type.result | 18 + mysql-test/main/func_hybrid_type.test | 16 + mysql-test/main/func_json.result | 20 + mysql-test/main/func_json.test | 18 + mysql-test/main/func_math.result | 40 + mysql-test/main/func_math.test | 33 + mysql-test/main/func_set.result | 4 +- mysql-test/main/func_str.result | 12 + mysql-test/main/func_str.test | 16 + mysql-test/main/func_time.result | 77 +- mysql-test/main/func_time.test | 40 +- mysql-test/main/func_time_round.result | 1374 +++++++++++ mysql-test/main/func_time_round.test | 461 ++++ mysql-test/main/gis-rtree.result | 1 + mysql-test/main/gis.result | 2 +- mysql-test/main/gis2.result | 4 +- mysql-test/main/grant.result | 42 +- mysql-test/main/grant.test | 43 +- mysql-test/main/grant2.result | 65 +- mysql-test/main/grant2.test | 25 +- mysql-test/main/grant3.result | 24 +- mysql-test/main/grant4.result | 18 +- mysql-test/main/grant5.result | 35 +- mysql-test/main/grant5.test | 19 +- mysql-test/main/grant_4332.result | 6 +- mysql-test/main/grant_4332.test | 8 +- mysql-test/main/group_by.result | 22 +- mysql-test/main/group_by.test | 13 + mysql-test/main/group_by_innodb.result | 1 + mysql-test/main/group_min_max.result | 116 +- mysql-test/main/group_min_max_innodb.result | 1 + mysql-test/main/handlersocket.result | 2 +- mysql-test/main/having.result | 1 + mysql-test/main/huge_frm-6224.result | 5 + mysql-test/main/huge_frm-6224.test | 11 +- mysql-test/main/index_merge_innodb.result | 6 +- mysql-test/main/index_merge_innodb.test | 1 + mysql-test/main/index_merge_myisam.result | 4 + mysql-test/main/information_schema.result | 21 +- mysql-test/main/information_schema.test | 13 +- .../main/information_schema_all_engines.result | 2 +- mysql-test/main/init_file_set_password-7656.result | 6 +- mysql-test/main/innodb_ext_key.result | 7 +- mysql-test/main/innodb_ext_key.test | 1 + mysql-test/main/innodb_icp.result | 8 +- mysql-test/main/innodb_mysql_sync.result | 4 +- mysql-test/main/innodb_mysql_sync.test | 2 +- mysql-test/main/insert.result | 32 +- mysql-test/main/invisible_field.result | 4 +- mysql-test/main/invisible_field_debug.result | 2 + mysql-test/main/invisible_field_debug.test | 2 + mysql-test/main/join.result | 10 +- mysql-test/main/join.test | 2 +- mysql-test/main/join_cache.result | 208 +- mysql-test/main/join_cache.test | 4 +- mysql-test/main/join_outer.result | 7 +- mysql-test/main/join_outer_innodb.result | 12 +- mysql-test/main/join_outer_jcl6.result | 7 +- mysql-test/main/kill.result | 2 +- mysql-test/main/kill.test | 8 +- mysql-test/main/limit_rows_examined.result | 11 +- mysql-test/main/loaddata.result | 6 +- mysql-test/main/lock.result | 3 +- mysql-test/main/lock.test | 2 +- mysql-test/main/lock_multi.result | 17 +- mysql-test/main/lock_multi.test | 68 +- mysql-test/main/lock_sync.result | 2 +- mysql-test/main/lock_sync.test | 4 +- mysql-test/main/log_tables_upgrade.result | 3 +- mysql-test/main/lowercase_fs_off.result | 3 +- mysql-test/main/max_password_errors.result | 45 + mysql-test/main/max_password_errors.test | 64 + mysql-test/main/mdev-504.result | 3 +- mysql-test/main/mdev-504.test | 4 +- mysql-test/main/mdev13607.result | 3 + mysql-test/main/mdl.result | 74 +- mysql-test/main/mdl.test | 64 +- mysql-test/main/mdl_sync.result | 63 +- mysql-test/main/mdl_sync.test | 95 +- mysql-test/main/merge.result | 5 + mysql-test/main/mix2_myisam.result | 1 + mysql-test/main/multi_update.result | 4 +- mysql-test/main/myisam.result | 8 +- .../main/myisam_explain_non_select_all.result | 238 +- mysql-test/main/myisam_icp.result | 2 +- mysql-test/main/mysql_install_db_win.result | 13 + mysql-test/main/mysql_install_db_win.test | 24 + mysql-test/main/mysql_upgrade-6984.result | 7 +- mysql-test/main/mysql_upgrade-6984.test | 4 +- mysql-test/main/mysql_upgrade.result | 35 +- mysql-test/main/mysql_upgrade.test | 5 +- mysql-test/main/mysql_upgrade_no_innodb.result | 2 +- mysql-test/main/mysql_upgrade_noengine.result | 12 + mysql-test/main/mysql_upgrade_noengine.test | 16 + mysql-test/main/mysql_upgrade_ssl.result | 3 +- mysql-test/main/mysql_upgrade_view.result | 13 +- mysql-test/main/mysqlbinlog_row_compressed.result | 16 +- mysql-test/main/mysqlbinlog_row_minimal.result | 16 +- mysql-test/main/mysqlcheck.result | 10 +- mysql-test/main/mysqld--help.result | 29 +- mysql-test/main/mysqld_option_err.test | 2 + mysql-test/main/mysqldump.result | 6 +- mysql-test/main/mysqldump.test | 2 +- .../main/no_password_column-mdev-11170.result | 169 -- mysql-test/main/no_password_column-mdev-11170.test | 95 - mysql-test/main/not_embedded_server.result | 4 +- mysql-test/main/not_embedded_server.test | 2 +- mysql-test/main/null_key.result | 3 + mysql-test/main/old-mode.result | 41 + mysql-test/main/old-mode.test | 29 + mysql-test/main/openssl_1.result | 72 +- mysql-test/main/openssl_1.test | 91 +- mysql-test/main/order_by.result | 37 + mysql-test/main/order_by.test | 37 + mysql-test/main/outfile_loaddata.result | 4 +- mysql-test/main/parser.result | 65 + mysql-test/main/parser.test | 74 + mysql-test/main/partition.result | 104 + mysql-test/main/partition.test | 62 + mysql-test/main/partition_alter.test | 2 - mysql-test/main/partition_binlog.result | 1 + mysql-test/main/partition_explicit_prune.result | 6 + mysql-test/main/partition_innodb.result | 64 + mysql-test/main/partition_innodb.test | 66 + mysql-test/main/perror-win.result | 4 +- mysql-test/main/perror.result | 8 +- mysql-test/main/plugin.result | 6 +- mysql-test/main/plugin_auth.result | 3 + mysql-test/main/plugin_auth.test | 8 +- mysql-test/main/plugin_auth_qa.result | 90 +- mysql-test/main/plugin_auth_qa_1.result | 44 +- mysql-test/main/plugin_auth_qa_1.test | 14 +- mysql-test/main/plugin_auth_qa_2.result | 26 +- mysql-test/main/processlist.result | 2 +- mysql-test/main/ps.result | 50 +- mysql-test/main/ps_ddl.result | 8 +- mysql-test/main/ps_ddl.test | 2 +- mysql-test/main/ps_error.result | 73 + mysql-test/main/ps_error.test | 66 + mysql-test/main/range.result | 87 +- mysql-test/main/range_innodb.result | 43 + mysql-test/main/range_innodb.test | 42 + mysql-test/main/range_mrr_icp.result | 121 +- mysql-test/main/range_vs_index_merge.result | 136 +- mysql-test/main/range_vs_index_merge.test | 17 + mysql-test/main/range_vs_index_merge_innodb.result | 36 + mysql-test/main/read_only.result | 16 +- mysql-test/main/read_only.test | 23 +- mysql-test/main/row.result | 2 +- mysql-test/main/select.result | 3 + mysql-test/main/select_jcl6.result | 3 + mysql-test/main/select_pkeycache.result | 3 + mysql-test/main/select_safe.result | 9 +- mysql-test/main/selectivity_innodb.result | 1 - mysql-test/main/session_tracker_last_gtid.result | 6 - mysql-test/main/set_password.result | 28 +- mysql-test/main/set_password.test | 2 + mysql-test/main/show_check.result | 6 +- .../main/show_grants_with_plugin-7985.result | 197 -- mysql-test/main/show_grants_with_plugin-7985.test | 160 -- mysql-test/main/sp-code.result | 12 +- mysql-test/main/sp-cursor.result | 26 +- mysql-test/main/sp-cursor.test | 21 + mysql-test/main/sp-error.result | 2 +- mysql-test/main/sp-for-loop.result | 2 +- mysql-test/main/sp-for-loop.test | 2 +- mysql-test/main/sp-security.result | 24 +- mysql-test/main/sp-security.test | 9 +- mysql-test/main/sp-vars.result | 8 +- mysql-test/main/sp.result | 60 +- mysql-test/main/sp.test | 36 +- mysql-test/main/sp_notembedded.result | 2 - mysql-test/main/sp_notembedded.test | 8 +- mysql-test/main/sql_mode.result | 8 +- mysql-test/main/sql_mode.test | 4 +- mysql-test/main/ssl-crl-revoked-crl.result | 1 - mysql-test/main/ssl.result | 9 +- mysql-test/main/ssl.test | 5 - mysql-test/main/ssl_cert_verify.result | 5 - mysql-test/main/ssl_cert_verify.test | 43 - mysql-test/main/ssl_cipher-master.opt | 1 - mysql-test/main/ssl_cipher.result | 63 +- mysql-test/main/ssl_cipher.test | 110 +- mysql-test/main/ssl_crl-master.opt | 4 - mysql-test/main/ssl_crl.combinations | 5 + mysql-test/main/ssl_crl.result | 24 +- mysql-test/main/ssl_crl.test | 15 +- mysql-test/main/ssl_crl_clients-master.opt | 4 - mysql-test/main/ssl_crl_clients-valid.result | 24 - mysql-test/main/ssl_crl_clients.result | 6 + mysql-test/main/ssl_crl_clients.test | 31 +- mysql-test/main/ssl_crl_clients_valid-master.opt | 4 - mysql-test/main/ssl_crl_clients_valid.result | 16 - mysql-test/main/ssl_crl_clients_valid.test | 23 - mysql-test/main/ssl_crl_clrpath-master.opt | 4 - mysql-test/main/ssl_crl_clrpath.result | 23 - mysql-test/main/ssl_crl_clrpath.test | 16 - mysql-test/main/stat_tables.result | 113 +- mysql-test/main/stat_tables.test | 59 + mysql-test/main/stat_tables_disabled.result | 4 +- mysql-test/main/stat_tables_innodb.result | 113 +- mysql-test/main/stat_tables_rbr.result | 4 +- mysql-test/main/stat_tables_rbr.test | 5 +- mysql-test/main/statistics.result | 10 - mysql-test/main/status.result | 8 +- mysql-test/main/str_to_datetime_457.result | 5 +- mysql-test/main/strict.result | 184 +- mysql-test/main/subselect.result | 16 +- mysql-test/main/subselect_exists2in.result | 7 +- mysql-test/main/subselect_exists2in_costmat.result | 2 +- mysql-test/main/subselect_extra.result | 4 + mysql-test/main/subselect_extra_no_semijoin.result | 4 + mysql-test/main/subselect_innodb.result | 1 + mysql-test/main/subselect_mat.result | 6 +- mysql-test/main/subselect_mat_cost.result | 22 +- mysql-test/main/subselect_mat_cost_bugs.result | 1 + mysql-test/main/subselect_no_exists_to_in.result | 14 +- mysql-test/main/subselect_no_mat.result | 12 +- mysql-test/main/subselect_no_opts.result | 6 +- mysql-test/main/subselect_no_scache.result | 16 +- mysql-test/main/subselect_no_semijoin.result | 4 +- mysql-test/main/subselect_sj.result | 2 + mysql-test/main/subselect_sj2_mat.result | 36 +- mysql-test/main/subselect_sj2_mat.test | 4 + mysql-test/main/subselect_sj_jcl6.result | 2 + mysql-test/main/subselect_sj_mat.result | 22 +- mysql-test/main/system_mysql_db.result | 66 +- mysql-test/main/system_mysql_db_507.result | 169 ++ mysql-test/main/system_mysql_db_507.test | 94 + mysql-test/main/system_mysql_db_fix40123.result | 13 +- mysql-test/main/system_mysql_db_fix40123.test | 2 +- mysql-test/main/system_mysql_db_fix50030.result | 13 +- mysql-test/main/system_mysql_db_fix50030.test | 2 +- mysql-test/main/system_mysql_db_fix50117.result | 13 +- mysql-test/main/system_mysql_db_fix50117.test | 2 +- mysql-test/main/temp_table_frm.result | 6 + mysql-test/main/temp_table_frm.test | 9 +- mysql-test/main/temporal_literal.result | 12 +- mysql-test/main/timezone2.result | 202 ++ mysql-test/main/timezone2.test | 179 ++ mysql-test/main/trigger.result | 4 +- mysql-test/main/trigger_notembedded.test | 2 +- mysql-test/main/truncate_coverage.result | 2 +- mysql-test/main/truncate_coverage.test | 4 +- mysql-test/main/type_date.result | 22 +- mysql-test/main/type_date_round.result | 174 ++ mysql-test/main/type_date_round.test | 113 + mysql-test/main/type_datetime.result | 8 +- mysql-test/main/type_datetime_round.result | 205 ++ mysql-test/main/type_datetime_round.test | 147 ++ mysql-test/main/type_decimal.result | 4 +- mysql-test/main/type_float.result | 2 +- mysql-test/main/type_interval.result | 83 + mysql-test/main/type_interval.test | 54 + mysql-test/main/type_newdecimal.result | 2 +- mysql-test/main/type_newdecimal.test | 1 + mysql-test/main/type_num.result | 168 +- mysql-test/main/type_time.result | 40 +- mysql-test/main/type_time.test | 21 + mysql-test/main/type_time_round.result | 260 ++ mysql-test/main/type_time_round.test | 184 ++ mysql-test/main/type_timestamp.result | 135 +- mysql-test/main/type_timestamp.test | 136 + mysql-test/main/type_timestamp_round.result | 191 ++ mysql-test/main/type_timestamp_round.test | 160 ++ mysql-test/main/udf.result | 119 + mysql-test/main/udf.test | 79 + mysql-test/main/union.result | 40 +- mysql-test/main/union.test | 35 + mysql-test/main/update.result | 4 +- mysql-test/main/update_use_source.result | 1 + mysql-test/main/userstat.result | 4 +- mysql-test/main/view.result | 9 +- mysql-test/main/view_grant.result | 8 - mysql-test/main/view_grant.test | 16 - mysql-test/main/warnings.result | 68 +- mysql-test/main/win.result | 132 +- mysql-test/main/win.test | 127 +- mysql-test/main/win_big-mdev-11697.result | 2 + mysql-test/mysql-test-run.pl | 167 +- mysql-test/std_data/ca-cert-verify.pem | 20 - mysql-test/std_data/cacert.pem | 110 +- mysql-test/std_data/cakey.pem | 52 +- mysql-test/std_data/client-cert.crl | 12 + mysql-test/std_data/client-cert.pem | 102 +- mysql-test/std_data/client-key.pem | 38 +- mysql-test/std_data/crl-ca-cert.pem | 63 - mysql-test/std_data/crl-client-cert.pem | 62 - mysql-test/std_data/crl-client-key.pem | 15 - mysql-test/std_data/crl-client-revoked.crl | 10 - mysql-test/std_data/crl-server-cert.pem | 62 - mysql-test/std_data/crl-server-key.pem | 15 - mysql-test/std_data/crldir/ed1f42db.r0 | 12 + mysql-test/std_data/crldir/fc725416.r0 | 10 - mysql-test/std_data/galera-cert.pem | 26 - mysql-test/std_data/galera-key.pem | 28 - mysql-test/std_data/galera-upgrade-ca-cert.pem | 40 - mysql-test/std_data/galera-upgrade-server-cert.pem | 20 - mysql-test/std_data/galera-upgrade-server-key.pem | 28 - mysql-test/std_data/mdev17909#P#p20181029.MYD | Bin mysql-test/std_data/mdev17909#P#p20181029.MYI | Bin 0 -> 1024 bytes mysql-test/std_data/mdev17909#P#p20181128.MYD | Bin mysql-test/std_data/mdev17909#P#p20181128.MYI | Bin 0 -> 1024 bytes mysql-test/std_data/mdev17909.frm | Bin 0 -> 3284 bytes mysql-test/std_data/mdev17909.par | Bin 0 -> 48 bytes .../mysql-5.7.11-stm-temporal-round-binlog.000001 | Bin 0 -> 514 bytes .../mysql-8.0.13-stm-temporal-round-binlog.000001 | Bin 0 -> 892 bytes mysql-test/std_data/server-cert-verify-fail.pem | 19 - mysql-test/std_data/server-cert-verify-pass.pem | 19 - mysql-test/std_data/server-cert.crl | 12 + mysql-test/std_data/server-cert.pem | 100 +- mysql-test/std_data/server-key-verify-fail.pem | 27 - mysql-test/std_data/server-key-verify-pass.pem | 27 - mysql-test/std_data/server-key.pem | 38 +- mysql-test/std_data/server-new-cert.pem | 81 + mysql-test/std_data/server-new-key.pem | 27 + mysql-test/std_data/server8k-cert.pem | 246 +- mysql-test/std_data/server8k-key.pem | 194 +- mysql-test/std_data/serversan-cert.pem | 92 +- mysql-test/std_data/serversan-key.pem | 40 +- mysql-test/suite.pm | 5 +- mysql-test/suite/archive/disabled.def | 13 + mysql-test/suite/archive/flush.result | 18 + mysql-test/suite/archive/flush.test | 25 + mysql-test/suite/archive/rnd_pos.result | 56 + mysql-test/suite/archive/rnd_pos.test | 27 + mysql-test/suite/binlog/include/binlog.test | 8 +- mysql-test/suite/binlog/r/binlog_row_binlog.result | 18 +- mysql-test/suite/binlog/r/binlog_stm_binlog.result | 16 +- mysql-test/suite/binlog/t/binlog_stm_binlog.test | 4 - .../suite/binlog_encryption/rpl_parallel.result | 1 + mysql-test/suite/compat/oracle/r/parser.result | 110 + mysql-test/suite/compat/oracle/r/sp-code.result | 42 +- .../suite/compat/oracle/r/sp-cursor-rowtype.result | 25 + mysql-test/suite/compat/oracle/r/sp-cursor.result | 30 +- .../suite/compat/oracle/r/sp-package-mdl.result | 4 +- mysql-test/suite/compat/oracle/r/sp-package.result | 48 + mysql-test/suite/compat/oracle/r/sp.result | 60 +- mysql-test/suite/compat/oracle/r/versioning.result | 8 + mysql-test/suite/compat/oracle/t/parser.test | 154 ++ mysql-test/suite/compat/oracle/t/sp-code.test | 2 +- .../suite/compat/oracle/t/sp-cursor-rowtype.test | 23 + mysql-test/suite/compat/oracle/t/sp-cursor.test | 35 + mysql-test/suite/compat/oracle/t/sp-package.test | 57 + mysql-test/suite/compat/oracle/t/sp.test | 45 +- mysql-test/suite/compat/oracle/t/versioning.test | 10 + mysql-test/suite/csv/flush.result | 25 + mysql-test/suite/csv/flush.test | 30 + mysql-test/suite/encryption/disabled.def | 1 + .../encryption/r/innodb-bad-key-change.result | 1 + .../encryption/r/innodb-checksum-algorithm.result | 225 -- .../encryption/r/innodb-encryption-alter.result | 28 +- .../encryption/r/innodb-encryption-disable.result | 1 + .../suite/encryption/r/innodb-force-corrupt.result | 3 +- .../suite/encryption/r/innodb-missing-key.result | 1 + .../suite/encryption/t/innodb-bad-key-change.test | 1 + .../encryption/t/innodb-checksum-algorithm.test | 9 +- .../encryption/t/innodb-encryption-alter.test | 38 +- .../encryption/t/innodb-encryption-disable.test | 1 + .../suite/encryption/t/innodb-force-corrupt.test | 9 +- .../suite/encryption/t/innodb-missing-key.test | 1 + .../suite/engines/funcs/r/an_calendar.result | 4 + mysql-test/suite/engines/funcs/r/an_number.result | 14 + mysql-test/suite/engines/funcs/r/an_string.result | 10 + .../funcs/r/in_number_boundary_error.result | 12 +- .../r/in_number_decimal_boundary_error.result | 8 +- .../engines/funcs/r/tc_partition_analyze.result | 1 + .../suite/engines/iuds/r/insert_decimal.result | 12 +- .../suite/engines/iuds/r/insert_number.result | 304 ++- mysql-test/suite/engines/iuds/r/insert_year.result | 16 +- .../suite/engines/iuds/r/update_decimal.result | 4 +- .../engines/iuds/r/update_delete_number.result | 17 + mysql-test/suite/funcs_1/r/innodb_func_view.result | 72 +- .../suite/funcs_1/r/is_check_constraint.result | 121 + .../suite/funcs_1/r/is_check_constraints.result | 36 + .../suite/funcs_1/r/is_columns_innodb.result | 4 +- mysql-test/suite/funcs_1/r/is_columns_mysql.result | 197 +- .../funcs_1/r/is_columns_mysql_embedded.result | 197 +- .../suite/funcs_1/r/is_key_column_usage.result | 4 +- .../funcs_1/r/is_key_column_usage_embedded.result | 4 +- .../suite/funcs_1/r/is_routines_embedded.result | 6 +- mysql-test/suite/funcs_1/r/is_statistics.result | 4 +- .../suite/funcs_1/r/is_statistics_mysql.result | 4 +- .../funcs_1/r/is_statistics_mysql_embedded.result | 8 +- .../suite/funcs_1/r/is_table_constraints.result | 3 +- .../funcs_1/r/is_table_constraints_mysql.result | 3 +- .../r/is_table_constraints_mysql_embedded.result | 6 +- mysql-test/suite/funcs_1/r/is_tables_mysql.result | 39 +- .../funcs_1/r/is_tables_mysql_embedded.result | 78 +- .../suite/funcs_1/r/is_user_privileges.result | 1839 ++------------ mysql-test/suite/funcs_1/r/is_views.result | 1 + .../suite/funcs_1/r/is_views_embedded.result | 1 + mysql-test/suite/funcs_1/r/memory_func_view.result | 72 +- mysql-test/suite/funcs_1/r/myisam_func_view.result | 72 +- mysql-test/suite/funcs_1/r/storedproc.result | 6 +- .../suite/funcs_1/t/is_check_constraint.test | 92 + mysql-test/suite/funcs_1/t/is_user_privileges.test | 11 +- mysql-test/suite/galera/disabled.def | 28 +- mysql-test/suite/galera/galera_2nodes.cnf | 26 +- .../suite/galera/galera_2nodes_as_master.cnf | 18 +- mysql-test/suite/galera/galera_2nodes_as_slave.cnf | 51 +- mysql-test/suite/galera/galera_3nodes_as_slave.cnf | 62 +- mysql-test/suite/galera/galera_4nodes.cnf | 30 +- .../suite/galera/include/galera_base_port.inc | 8 + .../galera/include/galera_concurrent_test.inc | 90 + .../suite/galera/include/galera_dump_sr_table.inc | 28 + .../galera/include/galera_have_debug_sync.inc | 9 - .../suite/galera/include/galera_load_provider.inc | 68 + mysql-test/suite/galera/include/galera_resume.inc | 9 - .../suite/galera/include/galera_sst_restore.inc | 2 +- .../galera/include/galera_st_disconnect_slave.inc | 8 + .../galera/include/galera_unload_provider.inc | 8 + .../galera/include/have_filekeymanagement.inc | 3 + .../suite/galera/include/have_xtrabackup.inc | 4 - mysql-test/suite/galera/r/GAL-382.result | 2 + mysql-test/suite/galera/r/GAL-401.result | 2 + mysql-test/suite/galera/r/GAL-480.result | 2 + mysql-test/suite/galera/r/GCF-1081.result | 47 + mysql-test/suite/galera/r/GCF-939.result | 13 + mysql-test/suite/galera/r/MDEV-15443.result | 2 + mysql-test/suite/galera/r/MW-252.result | 2 + mysql-test/suite/galera/r/MW-258.result | 2 + mysql-test/suite/galera/r/MW-259.result | 2 + mysql-test/suite/galera/r/MW-284.result | 4 + mysql-test/suite/galera/r/MW-285.result | 2 + mysql-test/suite/galera/r/MW-286.result | 21 +- mysql-test/suite/galera/r/MW-292.result | 27 +- mysql-test/suite/galera/r/MW-309.result | 2 + mysql-test/suite/galera/r/MW-313.result | 2 + mysql-test/suite/galera/r/MW-328A.result | 25 +- mysql-test/suite/galera/r/MW-328B.result | 2 + mysql-test/suite/galera/r/MW-328C.result | 2 + mysql-test/suite/galera/r/MW-328D.result | 2 + mysql-test/suite/galera/r/MW-328E.result | 2 + mysql-test/suite/galera/r/MW-329.result | 9 +- mysql-test/suite/galera/r/MW-336.result | 2 + mysql-test/suite/galera/r/MW-357.result | 2 + mysql-test/suite/galera/r/MW-360.result | 41 + mysql-test/suite/galera/r/MW-369.result | 149 +- mysql-test/suite/galera/r/MW-388.result | 6 +- mysql-test/suite/galera/r/MW-402.result | 76 +- mysql-test/suite/galera/r/MW-416.result | 5 +- mysql-test/suite/galera/r/MW-86-wait1.result | 17 +- mysql-test/suite/galera/r/MW-86-wait8.result | 16 +- mysql-test/suite/galera/r/MW-86.result | 78 + mysql-test/suite/galera/r/basic.result | 2 + mysql-test/suite/galera/r/binlog_checksum.result | 2 + mysql-test/suite/galera/r/create.result | 2 + .../suite/galera/r/enforce_storage_engine.result | 2 + .../suite/galera/r/enforce_storage_engine2.result | 2 + mysql-test/suite/galera/r/ev51914.result | 2 + mysql-test/suite/galera/r/fk.result | 2 + mysql-test/suite/galera/r/galera#414.result | 2 + mysql-test/suite/galera/r/galera#500.result | 8 + mysql-test/suite/galera/r/galera#505.result | 2 + .../r/galera_FK_duplicate_client_insert.result | 382 +++ mysql-test/suite/galera/r/galera_admin.result | 4 + .../galera/r/galera_alter_engine_innodb.result | 2 + .../galera/r/galera_alter_engine_myisam.result | 2 + .../suite/galera/r/galera_alter_table_force.result | 2 + .../galera/r/galera_applier_ftwrl_table.result | 2 + .../r/galera_applier_ftwrl_table_alter.result | 2 + mysql-test/suite/galera/r/galera_as_master.result | 4 + .../suite/galera/r/galera_as_master_gtid.result | 44 +- .../suite/galera/r/galera_as_master_large.result | 2 + mysql-test/suite/galera/r/galera_as_slave.result | 12 +- .../suite/galera/r/galera_as_slave_autoinc.result | 12 +- .../suite/galera/r/galera_as_slave_gtid.result | 12 +- .../r/galera_as_slave_gtid_replicate_do_db.result | 159 ++ .../galera_as_slave_gtid_replicate_do_db_cc.result | 315 +++ .../suite/galera/r/galera_as_slave_nonprim.result | 16 + .../galera/r/galera_autoinc_sst_mariabackup.result | 51 + .../galera/r/galera_autoinc_sst_xtrabackup.result | 47 - mysql-test/suite/galera/r/galera_bf_abort.result | 4 +- .../r/galera_bf_abort_flush_for_export.result | 2 + .../galera/r/galera_bf_abort_for_update.result | 6 +- .../suite/galera/r/galera_bf_abort_ftwrl.result | 2 + .../suite/galera/r/galera_bf_abort_get_lock.result | 4 +- .../galera/r/galera_bf_abort_group_commit.result | 685 ++++++ .../galera/r/galera_bf_abort_lock_table.result | 2 + .../suite/galera/r/galera_bf_abort_shutdown.result | 12 + .../suite/galera/r/galera_bf_abort_sleep.result | 4 +- .../r/galera_bf_background_statistics.result | 4 +- .../suite/galera/r/galera_bf_lock_wait.result | 2 + .../suite/galera/r/galera_binlog_cache_size.result | 2 + .../suite/galera/r/galera_binlog_checksum.result | 2 + .../r/galera_binlog_event_max_size_max.result | 2 + .../r/galera_binlog_event_max_size_min.result | 2 + .../suite/galera/r/galera_binlog_row_image.result | 2 + .../suite/galera/r/galera_commit_empty.result | 15 + .../suite/galera/r/galera_concurrent_ctas.result | 2 + .../suite/galera/r/galera_create_function.result | 2 + .../suite/galera/r/galera_create_procedure.result | 2 + .../galera/r/galera_create_table_as_select.result | 103 + .../suite/galera/r/galera_create_table_like.result | 2 + .../suite/galera/r/galera_create_trigger.result | 2 + .../suite/galera/r/galera_ddl_multiline.result | 2 + mysql-test/suite/galera/r/galera_defaults.result | 13 +- .../suite/galera/r/galera_delete_limit.result | 2 + .../suite/galera/r/galera_desync_overlapped.result | 2 + .../suite/galera/r/galera_drop_database.result | 8 + mysql-test/suite/galera/r/galera_drop_multi.result | 2 + .../suite/galera/r/galera_encrypt_tmp_files.result | 2 + mysql-test/suite/galera/r/galera_enum.result | 4 +- mysql-test/suite/galera/r/galera_events.result | 2 + .../suite/galera/r/galera_fk_cascade_delete.result | 2 + .../suite/galera/r/galera_fk_cascade_update.result | 2 + .../suite/galera/r/galera_fk_conflict.result | 4 +- .../suite/galera/r/galera_fk_mismatch.result | 2 + .../suite/galera/r/galera_fk_multicolumn.result | 2 + .../suite/galera/r/galera_fk_multitable.result | 2 + mysql-test/suite/galera/r/galera_fk_no_pk.result | 2 + .../galera/r/galera_fk_selfreferential.result | 2 + mysql-test/suite/galera/r/galera_fk_setnull.result | 2 + .../suite/galera/r/galera_flush_local.result | 6 + .../galera/r/galera_forced_binlog_format.result | 20 +- mysql-test/suite/galera/r/galera_ftwrl.result | 2 + .../suite/galera/r/galera_ftwrl_drain.result | 4 +- mysql-test/suite/galera/r/galera_fulltext.result | 2 + .../suite/galera/r/galera_gcache_recover.result | 9 + .../r/galera_gcache_recover_full_gcache.result | 11 +- .../suite/galera/r/galera_gcs_fc_limit.result | 2 + .../suite/galera/r/galera_gcs_fragment.result | 15 +- .../galera/r/galera_gcs_max_packet_size.result | 2 + mysql-test/suite/galera/r/galera_gra_log.result | 2 + mysql-test/suite/galera/r/galera_gtid.result | 2 + mysql-test/suite/galera/r/galera_gtid_slave.result | 26 +- .../galera/r/galera_gtid_slave_sst_rsync.result | 107 +- .../suite/galera/r/galera_insert_ignore.result | 2 + .../suite/galera/r/galera_insert_multi.result | 4 +- .../r/galera_ist_innodb_flush_logs,debug.rdiff | 103 - .../r/galera_ist_innodb_flush_logs,release.rdiff | 114 + .../galera/r/galera_ist_innodb_flush_logs.result | 118 + .../galera/r/galera_ist_mariabackup,debug.rdiff | 114 + .../suite/galera/r/galera_ist_mariabackup.result | 292 +++ ...a_ist_mariabackup_innodb_flush_logs,debug.rdiff | 114 + ...galera_ist_mariabackup_innodb_flush_logs.result | 98 + .../galera/r/galera_ist_mysqldump,debug.rdiff | 19 +- .../suite/galera/r/galera_ist_mysqldump.result | 3 + .../suite/galera/r/galera_ist_progress.result | 9 - .../suite/galera/r/galera_ist_recv_bind.result | 2 + .../galera/r/galera_ist_restart_joiner.result | 3 +- mysql-test/suite/galera/r/galera_ist_rsync.result | 5 + .../galera/r/galera_ist_xtrabackup-v2,debug.rdiff | 103 - .../suite/galera/r/galera_ist_xtrabackup-v2.result | 261 -- mysql-test/suite/galera/r/galera_kill_ddl.result | 2 + .../suite/galera/r/galera_kill_largechanges.result | 2 + .../suite/galera/r/galera_kill_smallchanges.result | 2 + mysql-test/suite/galera/r/galera_lock_table.result | 2 + mysql-test/suite/galera/r/galera_log_bin.result | 4 + .../suite/galera/r/galera_log_output_csv.result | 2 + .../suite/galera/r/galera_many_columns.result | 4 +- .../suite/galera/r/galera_many_indexes.result | 6 +- mysql-test/suite/galera/r/galera_many_rows.result | 6 +- .../suite/galera/r/galera_many_tables_nopk.result | 4 +- .../suite/galera/r/galera_many_tables_pk.result | 4 +- mysql-test/suite/galera/r/galera_mdev_10812.result | 2 + mysql-test/suite/galera/r/galera_mdev_13787.result | 2 + mysql-test/suite/galera/r/galera_mdev_15611.result | 2 + mysql-test/suite/galera/r/galera_mdl_race.result | 4 +- .../suite/galera/r/galera_multi_database.result | 2 + .../suite/galera/r/galera_myisam_autocommit.result | 2 + .../galera/r/galera_myisam_transactions.result | 2 + mysql-test/suite/galera/r/galera_nopk_bit.result | 4 +- mysql-test/suite/galera/r/galera_nopk_blob.result | 4 +- .../galera/r/galera_nopk_large_varchar.result | 4 +- .../suite/galera/r/galera_nopk_unicode.result | 4 +- .../r/galera_parallel_apply_lock_table.result | 8 +- .../r/galera_parallel_autoinc_largetrx.result | 20 +- .../r/galera_parallel_autoinc_manytrx.result | 4 +- .../suite/galera/r/galera_parallel_simple.result | 2 + .../suite/galera/r/galera_pc_recovery.result | 37 + .../suite/galera/r/galera_pk_bigint_signed.result | 4 +- .../galera/r/galera_pk_bigint_unsigned.result | 4 +- .../galera/r/galera_prepared_statement.result | 4 +- .../suite/galera/r/galera_query_cache.result | 2 + .../galera/r/galera_query_cache_sync_wait.result | 2 + mysql-test/suite/galera/r/galera_read_only.result | 2 + .../galera/r/galera_repl_key_format_flat16.result | 2 + .../suite/galera/r/galera_repl_max_ws_size.result | 4 +- .../suite/galera/r/galera_restart_nochanges.result | 2 + .../r/galera_restart_on_unknown_option.result | 2 + mysql-test/suite/galera/r/galera_roles.result | 2 + mysql-test/suite/galera/r/galera_rsu_add_pk.result | 2 + .../suite/galera/r/galera_rsu_drop_pk.result | 2 + mysql-test/suite/galera/r/galera_rsu_error.result | 2 + mysql-test/suite/galera/r/galera_rsu_simple.result | 2 + .../suite/galera/r/galera_rsu_wsrep_desync.result | 2 + mysql-test/suite/galera/r/galera_sbr.result | 2 + mysql-test/suite/galera/r/galera_sbr_binlog.result | 2 + .../galera/r/galera_schema_dirty_reads.result | 2 + .../suite/galera/r/galera_serializable.result | 8 +- mysql-test/suite/galera/r/galera_server.result | 2 + .../suite/galera/r/galera_sql_log_bin_zero.result | 2 + mysql-test/suite/galera/r/galera_ssl.result | 2 + .../suite/galera/r/galera_ssl_compression.result | 2 + .../galera/r/galera_sst_mariabackup,debug.rdiff | 4 +- .../suite/galera/r/galera_sst_mariabackup.result | 2 + .../r/galera_sst_mariabackup_data_dir,debug.rdiff | 116 + .../r/galera_sst_mariabackup_data_dir.result | 292 +++ .../galera_sst_mariabackup_encrypt_with_key.result | 5 + .../r/galera_sst_mariabackup_table_options.result | 999 ++++++++ .../galera/r/galera_sst_mysqldump,debug.rdiff | 22 +- .../galera/r/galera_sst_mysqldump,release.rdiff | 18 + .../suite/galera/r/galera_sst_mysqldump.result | 1 + .../r/galera_sst_mysqldump_with_key,debug.rdiff | 106 + .../galera/r/galera_sst_mysqldump_with_key.result | 97 - mysql-test/suite/galera/r/galera_sst_rsync.result | 2 + .../suite/galera/r/galera_sst_rsync2,debug.rdiff | 12 +- .../galera/r/galera_sst_rsync_data_dir.result | 2 + .../galera/r/galera_sst_xtrabackup-v2,debug.rdiff | 116 - .../r/galera_sst_xtrabackup-v2-options.result | 3 - .../suite/galera/r/galera_sst_xtrabackup-v2.result | 290 --- .../r/galera_sst_xtrabackup-v2_data_dir.result | 262 -- ...alera_sst_xtrabackup-v2_encrypt_with_key.result | 3 - .../suite/galera/r/galera_status_cluster.result | 2 + .../galera/r/galera_status_local_index.result | 2 + .../galera/r/galera_status_local_state.result | 2 + .../suite/galera/r/galera_suspend_slave.result | 2 + .../suite/galera/r/galera_sync_wait_show.result | 2 + .../r/galera_toi_alter_auto_increment.result | 2 + .../suite/galera/r/galera_toi_ddl_error.result | 5 + .../suite/galera/r/galera_toi_ddl_fk_insert.result | 2 + .../suite/galera/r/galera_toi_ddl_fk_update.result | 2 + .../suite/galera/r/galera_toi_ddl_locking.result | 33 +- .../galera/r/galera_toi_ddl_nonconflicting.result | 2 + .../galera/r/galera_toi_ddl_sequential.result | 2 + .../suite/galera/r/galera_toi_drop_database.result | 6 +- mysql-test/suite/galera/r/galera_toi_ftwrl.result | 2 + .../galera/r/galera_toi_lock_exclusive.result | 4 +- .../suite/galera/r/galera_toi_lock_shared.result | 2 + .../suite/galera/r/galera_toi_truncate.result | 4 +- .../galera/r/galera_transaction_read_only.result | 2 + .../galera/r/galera_transaction_replay.result | 96 +- mysql-test/suite/galera/r/galera_truncate.result | 2 + .../galera/r/galera_truncate_temporary.result | 2 + .../galera/r/galera_unicode_identifiers.result | 2 + mysql-test/suite/galera/r/galera_unicode_pk.result | 6 +- .../suite/galera/r/galera_update_limit.result | 2 + .../suite/galera/r/galera_v1_row_events.result | 2 + .../suite/galera/r/galera_var_OSU_method.result | 2 + .../suite/galera/r/galera_var_OSU_method2.result | 2 + .../r/galera_var_auto_inc_control_off.result | 4 +- .../galera/r/galera_var_auto_inc_control_on.result | 2 + .../galera/r/galera_var_certify_nonPK_off.result | 2 + .../galera/r/galera_var_cluster_address.result | 8 +- .../suite/galera/r/galera_var_desync_on.result | 2 + .../suite/galera/r/galera_var_dirty_reads.result | 5 +- .../suite/galera/r/galera_var_fkchecks.result | 2 + .../galera/r/galera_var_gtid_domain_id.result | 2 + .../galera/r/galera_var_ignore_apply_errors.result | 186 ++ .../r/galera_var_innodb_disallow_writes.result | 2 + .../galera/r/galera_var_load_data_splitting.result | 2 + .../suite/galera/r/galera_var_log_bin.result | 2 + .../suite/galera/r/galera_var_max_ws_rows.result | 2 + .../suite/galera/r/galera_var_max_ws_size.result | 4 +- .../r/galera_var_mysql_replication_bundle.result | 2 + .../suite/galera/r/galera_var_node_address.result | 2 + .../galera/r/galera_var_reject_queries.result | 3 +- .../r/galera_var_replicate_myisam_off.result | 2 + .../galera/r/galera_var_replicate_myisam_on.result | 2 + .../galera/r/galera_var_retry_autocommit.result | 28 +- .../suite/galera/r/galera_var_slave_threads.result | 60 +- .../suite/galera/r/galera_var_sst_auth.result | 2 + .../suite/galera/r/galera_var_sync_wait.result | 2 + .../suite/galera/r/galera_var_wsrep_on_off.result | 2 + mysql-test/suite/galera/r/galera_wan.result | 2 + .../suite/galera/r/galera_wan_restart_ist.result | 2 + .../suite/galera/r/galera_wan_restart_sst.result | 2 + .../galera/r/galera_wsrep_desync_wsrep_on.result | 2 + .../galera/r/galera_wsrep_log_conficts.result | 4 +- .../suite/galera/r/galera_wsrep_new_cluster.result | 2 + .../r/galera_wsrep_provider_options_syntax.result | 2 + .../r/galera_wsrep_provider_unset_set.result | 2 + .../galera/r/galera_zero_length_column.result | 2 + mysql-test/suite/galera/r/grant.result | 4 +- mysql-test/suite/galera/r/lp1276424.result | 2 + mysql-test/suite/galera/r/lp1347768.result | 2 + mysql-test/suite/galera/r/lp1376747-2.result | 2 + mysql-test/suite/galera/r/lp1376747-3.result | 2 + mysql-test/suite/galera/r/lp1376747-4.result | 2 + mysql-test/suite/galera/r/lp1376747.result | 2 + mysql-test/suite/galera/r/lp1438990.result | 2 + mysql-test/suite/galera/r/lp959512.result | 2 + mysql-test/suite/galera/r/mdev_10518.result | 2 + mysql-test/suite/galera/r/mdev_9290.result | 2 + mysql-test/suite/galera/r/mysql-wsrep#110.result | 2 + mysql-test/suite/galera/r/mysql-wsrep#198.result | 2 + mysql-test/suite/galera/r/mysql-wsrep#201.result | 2 + mysql-test/suite/galera/r/mysql-wsrep#216.result | 11 + mysql-test/suite/galera/r/mysql-wsrep#237.result | 4 +- mysql-test/suite/galera/r/mysql-wsrep#247.result | 2 + mysql-test/suite/galera/r/mysql-wsrep#31.result | 2 + mysql-test/suite/galera/r/mysql-wsrep#33.result | 6 + mysql-test/suite/galera/r/mysql-wsrep#332.result | 42 +- mysql-test/suite/galera/r/mysql-wsrep#90.result | 2 + mysql-test/suite/galera/r/partition.result | 24 +- mysql-test/suite/galera/r/pxc-421.result | 2 + mysql-test/suite/galera/r/query_cache.result | 2 + mysql-test/suite/galera/r/rename.result | 2 + mysql-test/suite/galera/r/rpl_row_annotate.result | 8 +- mysql-test/suite/galera/r/sql_log_bin.result | 2 + mysql-test/suite/galera/r/unique_key.result | 2 + mysql-test/suite/galera/r/versioning_trx_id.result | 2 + mysql-test/suite/galera/r/view.result | 2 + .../galera/r/wsrep_trx_fragment_size_sr.result | 15 + mysql-test/suite/galera/suite.pm | 12 +- mysql-test/suite/galera/t/GAL-419.test | 4 +- mysql-test/suite/galera/t/GCF-1081.test | 72 + mysql-test/suite/galera/t/GCF-939.test | 31 + mysql-test/suite/galera/t/MW-284.test | 2 + mysql-test/suite/galera/t/MW-286.test | 50 +- mysql-test/suite/galera/t/MW-292.test | 50 +- mysql-test/suite/galera/t/MW-328A.test | 40 +- mysql-test/suite/galera/t/MW-329.test | 28 +- mysql-test/suite/galera/t/MW-336.test | 9 +- mysql-test/suite/galera/t/MW-360-master.opt | 2 + mysql-test/suite/galera/t/MW-360.test | 100 + mysql-test/suite/galera/t/MW-369.inc | 7 +- mysql-test/suite/galera/t/MW-369.test | 100 +- mysql-test/suite/galera/t/MW-388.test | 5 +- mysql-test/suite/galera/t/MW-402.test | 56 +- mysql-test/suite/galera/t/MW-416.test | 8 +- mysql-test/suite/galera/t/MW-86-wait1.test | 13 +- mysql-test/suite/galera/t/MW-86-wait8.test | 11 +- mysql-test/suite/galera/t/galera#500.test | 6 + .../t/galera_FK_duplicate_client_insert.test | 161 ++ .../t/galera_applier_ftwrl_table_alter-master.opt | 2 +- mysql-test/suite/galera/t/galera_as_master.test | 2 + .../suite/galera/t/galera_as_master_gtid.cnf | 2 - .../suite/galera/t/galera_as_master_gtid.test | 24 +- .../t/galera_as_master_gtid_change_master.cnf | 2 - .../t/galera_as_master_gtid_change_master.test | 2 + mysql-test/suite/galera/t/galera_as_slave.test | 17 +- .../suite/galera/t/galera_as_slave_autoinc.test | 18 +- .../suite/galera/t/galera_as_slave_gtid.test | 21 +- .../t/galera_as_slave_gtid_replicate_do_db.cnf | 17 + .../t/galera_as_slave_gtid_replicate_do_db.test | 150 ++ .../t/galera_as_slave_gtid_replicate_do_db_cc.test | 176 ++ .../suite/galera/t/galera_as_slave_nonprim.test | 26 +- .../suite/galera/t/galera_as_slave_preordered.test | 19 +- .../t/galera_as_slave_replication_bundle.test | 13 +- .../galera/t/galera_autoinc_sst_mariabackup.cnf | 11 + .../galera/t/galera_autoinc_sst_mariabackup.test | 105 + .../galera/t/galera_autoinc_sst_xtrabackup.cnf | 12 - .../galera/t/galera_autoinc_sst_xtrabackup.test | 96 - .../galera/t/galera_bf_abort_group_commit.cnf | 15 + .../galera/t/galera_bf_abort_group_commit.test | 77 + .../suite/galera/t/galera_bf_abort_shutdown.test | 33 + mysql-test/suite/galera/t/galera_commit_empty.test | 35 + .../galera/t/galera_create_table_as_select.test | 145 ++ mysql-test/suite/galera/t/galera_defaults.test | 25 +- .../suite/galera/t/galera_drop_database.test | 26 +- .../galera/t/galera_forced_binlog_format.test | 5 +- mysql-test/suite/galera/t/galera_ftwrl_drain.test | 4 +- .../t/galera_gcache_recover_full_gcache.test | 12 +- mysql-test/suite/galera/t/galera_gcs_fragment.test | 4 +- mysql-test/suite/galera/t/galera_gtid-master.opt | 2 +- mysql-test/suite/galera/t/galera_gtid_slave.test | 33 +- .../galera/t/galera_gtid_slave_sst_rsync.test | 110 +- .../galera/t/galera_ist_innodb_flush_logs.cnf | 3 +- .../galera/t/galera_ist_innodb_flush_logs.test | 1 + .../suite/galera/t/galera_ist_mariabackup.cnf | 12 + .../suite/galera/t/galera_ist_mariabackup.test | 16 + .../t/galera_ist_mariabackup_innodb_flush_logs.cnf | 14 + .../galera_ist_mariabackup_innodb_flush_logs.test | 13 + mysql-test/suite/galera/t/galera_ist_progress.test | 4 +- .../suite/galera/t/galera_ist_restart_joiner.test | 4 +- .../suite/galera/t/galera_ist_xtrabackup-v2.cnf | 12 - .../suite/galera/t/galera_ist_xtrabackup-v2.test | 15 - mysql-test/suite/galera/t/galera_kill_applier.test | 1 - mysql-test/suite/galera/t/galera_log_bin.test | 2 + mysql-test/suite/galera/t/galera_many_rows.cnf | 10 + mysql-test/suite/galera/t/galera_many_rows.test | 7 + mysql-test/suite/galera/t/galera_migrate.cnf | 2 + .../galera/t/galera_parallel_apply_lock_table.test | 6 +- .../galera/t/galera_parallel_autoinc_largetrx.test | 11 +- .../galera/t/galera_parallel_autoinc_manytrx.test | 2 +- .../suite/galera/t/galera_parallel_simple.test | 2 +- mysql-test/suite/galera/t/galera_pc_recovery.test | 102 + mysql-test/suite/galera/t/galera_split_brain.test | 6 +- mysql-test/suite/galera/t/galera_ssl.cnf | 4 +- .../suite/galera/t/galera_ssl_compression.cnf | 4 +- mysql-test/suite/galera/t/galera_ssl_upgrade.cnf | 4 +- mysql-test/suite/galera/t/galera_ssl_upgrade.test | 6 +- .../galera/t/galera_sst_mariabackup_data_dir.cnf | 17 + .../galera/t/galera_sst_mariabackup_data_dir.test | 23 + .../t/galera_sst_mariabackup_encrypt_with_key.cnf | 12 + .../t/galera_sst_mariabackup_encrypt_with_key.test | 14 + .../t/galera_sst_mariabackup_table_options.cnf | 16 + .../t/galera_sst_mariabackup_table_options.test | 229 ++ mysql-test/suite/galera/t/galera_sst_mysqldump.cnf | 4 +- .../suite/galera/t/galera_sst_mysqldump.test | 2 - .../galera/t/galera_sst_mysqldump_with_key.cnf | 4 + .../galera/t/galera_sst_xtrabackup-v2-options.cnf | 25 - .../galera/t/galera_sst_xtrabackup-v2-options.test | 13 - .../suite/galera/t/galera_sst_xtrabackup-v2.cnf | 15 - .../suite/galera/t/galera_sst_xtrabackup-v2.test | 20 - .../galera/t/galera_sst_xtrabackup-v2_data_dir.cnf | 16 - .../t/galera_sst_xtrabackup-v2_data_dir.test | 23 - .../galera_sst_xtrabackup-v2_encrypt_with_key.cnf | 12 - .../galera_sst_xtrabackup-v2_encrypt_with_key.test | 14 - .../suite/galera/t/galera_toi_ddl_error.test | 5 + .../suite/galera/t/galera_toi_ddl_locking.test | 54 +- .../suite/galera/t/galera_transaction_replay.test | 201 +- .../suite/galera/t/galera_var_cluster_address.test | 11 +- .../suite/galera/t/galera_var_dirty_reads.test | 12 +- .../galera/t/galera_var_ignore_apply_errors.test | 235 ++ mysql-test/suite/galera/t/galera_var_log_bin.cnf | 5 + .../suite/galera/t/galera_var_reject_queries.test | 7 +- .../galera/t/galera_var_retry_autocommit.test | 24 +- .../suite/galera/t/galera_var_slave_threads.cnf | 7 + .../suite/galera/t/galera_var_slave_threads.test | 139 +- .../galera/t/galera_vote_drop_temporary-master.opt | 1 + .../suite/galera/t/galera_wsrep_new_cluster.test | 1 - .../suite/galera/t/mysql-wsrep#198-master.opt | 1 + mysql-test/suite/galera/t/mysql-wsrep#237.test | 4 +- mysql-test/suite/galera/t/mysql-wsrep#332.test | 2 +- mysql-test/suite/galera/t/partition.test | 30 +- mysql-test/suite/galera/t/rpl_row_annotate.test | 5 +- .../suite/galera/t/wsrep_trx_fragment_size_sr.test | 22 + mysql-test/suite/galera_3nodes/disabled.def | 1 - mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf | 34 +- mysql-test/suite/galera_3nodes/galera_3nodes.cnf | 20 +- .../suite/galera_3nodes/include/galera_resume.inc | 9 + .../suite/galera_3nodes/include/galera_suspend.inc | 2 +- .../suite/galera_3nodes/include/have_ipv6.inc | 15 - .../galera_3nodes/include/have_mariabackup.inc | 4 + mysql-test/suite/galera_3nodes/r/GAL-501.result | 6 + .../r/galera_certification_ccc.result | 2 + .../r/galera_certification_double_failure.result | 5 +- .../r/galera_evs_suspect_timeout.result | 8 + .../suite/galera_3nodes/r/galera_garbd.result | 14 + .../r/galera_innobackupex_backup.result | 11 - .../galera_3nodes/r/galera_ipv6_mariabackup.result | 24 + .../galera_3nodes/r/galera_ipv6_mysqldump.result | 24 +- .../suite/galera_3nodes/r/galera_ipv6_rsync.result | 5 + .../r/galera_ipv6_xtrabackup-v2.result | 18 - .../r/galera_ist_gcache_rollover.result | 2 + .../r/galera_parallel_apply_3nodes.result | 4 +- .../galera_3nodes/r/galera_pc_bootstrap.result | 13 + .../suite/galera_3nodes/r/galera_pc_weight.result | 24 + .../r/galera_safe_to_bootstrap.result | 23 + .../galera_3nodes/r/galera_var_dirty_reads2.result | 7 + .../galera_3nodes/r/galera_wsrep_schema.result | 82 + mysql-test/suite/galera_3nodes/suite.pm | 48 +- mysql-test/suite/galera_3nodes/t/GAL-501.opt | 1 + mysql-test/suite/galera_3nodes/t/GAL-501.test | 8 +- .../t/galera_certification_double_failure.test | 2 + .../t/galera_evs_suspect_timeout.test | 6 +- mysql-test/suite/galera_3nodes/t/galera_garbd.test | 22 +- .../galera_3nodes/t/galera_innobackupex_backup.cnf | 4 + .../t/galera_innobackupex_backup.test | 58 - .../galera_3nodes/t/galera_ipv6_mariabackup.cnf | 34 + .../galera_3nodes/t/galera_ipv6_mariabackup.opt | 1 + .../galera_3nodes/t/galera_ipv6_mariabackup.test | 68 + .../galera_3nodes/t/galera_ipv6_mysqldump.cnf | 10 +- .../galera_3nodes/t/galera_ipv6_mysqldump.opt | 1 + .../galera_3nodes/t/galera_ipv6_mysqldump.test | 48 +- .../suite/galera_3nodes/t/galera_ipv6_rsync.cnf | 10 +- .../suite/galera_3nodes/t/galera_ipv6_rsync.opt | 1 + .../suite/galera_3nodes/t/galera_ipv6_rsync.test | 2 +- .../galera_3nodes/t/galera_ipv6_xtrabackup-v2.cnf | 26 - .../galera_3nodes/t/galera_ipv6_xtrabackup-v2.test | 62 - .../t/galera_ist_gcache_rollover.test | 2 +- .../t/galera_parallel_apply_3nodes.test | 2 +- .../suite/galera_3nodes/t/galera_pc_weight.cnf | 8 +- .../suite/galera_3nodes/t/galera_pc_weight.test | 9 +- .../galera_3nodes/t/galera_safe_to_bootstrap.test | 26 +- .../t/galera_slave_options_ignore.test | 1 + .../galera_3nodes/t/galera_var_dirty_reads2.test | 3 +- .../suite/galera_3nodes/t/galera_wsrep_schema.test | 83 + mysql-test/suite/galera_3nodes_sr/disabled.def | 7 + .../suite/galera_3nodes_sr/galera_3nodes.cnf | 1 + mysql-test/suite/galera_3nodes_sr/my.cnf | 1 + mysql-test/suite/galera_3nodes_sr/r/GCF-336.result | 26 + mysql-test/suite/galera_3nodes_sr/r/GCF-582.result | 23 + mysql-test/suite/galera_3nodes_sr/r/GCF-606.result | 38 + mysql-test/suite/galera_3nodes_sr/r/GCF-609.result | 20 + .../suite/galera_3nodes_sr/r/GCF-810A.result | 256 ++ .../suite/galera_3nodes_sr/r/GCF-810B.result | 100 + .../suite/galera_3nodes_sr/r/GCF-810C.result | 177 ++ mysql-test/suite/galera_3nodes_sr/r/GCF-817.result | 54 + mysql-test/suite/galera_3nodes_sr/r/GCF-832.result | 26 + .../r/galera_sr_isolate_master.result | 80 + .../galera_3nodes_sr/r/galera_sr_join_slave.result | 39 + .../r/galera_sr_kill_master.result | 33 + .../r/galera_sr_kill_slave_after_apply.result | 53 + ...alera_sr_kill_slave_after_apply_rollback.result | 58 + ...lera_sr_kill_slave_after_apply_rollback2.result | 31 + .../r/galera_sr_kill_slave_before_apply.result | 44 + .../r/galera_sr_threeway_split.result | 117 + mysql-test/suite/galera_3nodes_sr/t/GCF-336.test | 47 + mysql-test/suite/galera_3nodes_sr/t/GCF-582.test | 39 + mysql-test/suite/galera_3nodes_sr/t/GCF-606.test | 80 + mysql-test/suite/galera_3nodes_sr/t/GCF-609.test | 30 + mysql-test/suite/galera_3nodes_sr/t/GCF-810A.test | 137 ++ mysql-test/suite/galera_3nodes_sr/t/GCF-810B.test | 49 + mysql-test/suite/galera_3nodes_sr/t/GCF-810C.test | 70 + mysql-test/suite/galera_3nodes_sr/t/GCF-817.test | 109 + mysql-test/suite/galera_3nodes_sr/t/GCF-832.test | 43 + .../t/galera_sr_isolate_master.test | 127 + .../galera_3nodes_sr/t/galera_sr_join_slave.test | 59 + .../galera_3nodes_sr/t/galera_sr_kill_master.test | 58 + .../t/galera_sr_kill_slave_after_apply.test | 81 + .../galera_sr_kill_slave_after_apply_rollback.test | 80 + ...galera_sr_kill_slave_after_apply_rollback2.test | 56 + .../t/galera_sr_kill_slave_before_apply.test | 73 + .../t/galera_sr_threeway_split.cnf | 5 + .../t/galera_sr_threeway_split.test | 177 ++ mysql-test/suite/galera_sr/disabled.def | 3 + mysql-test/suite/galera_sr/galera_2nodes.cnf | 1 + mysql-test/suite/galera_sr/my.cnf | 1 + mysql-test/suite/galera_sr/r/GCF-1008.result | 70 + mysql-test/suite/galera_sr/r/GCF-1018.result | 24 + mysql-test/suite/galera_sr/r/GCF-1018B.result | 12 + mysql-test/suite/galera_sr/r/GCF-1043A.result | 21 + mysql-test/suite/galera_sr/r/GCF-1043B.result | 21 + mysql-test/suite/galera_sr/r/GCF-1051.result | 46 + mysql-test/suite/galera_sr/r/GCF-1060.result | 21 + mysql-test/suite/galera_sr/r/GCF-437.result | 12 + mysql-test/suite/galera_sr/r/GCF-561.result | 50 + mysql-test/suite/galera_sr/r/GCF-571.result | 67 + mysql-test/suite/galera_sr/r/GCF-572.result | 37 + mysql-test/suite/galera_sr/r/GCF-574.result | 11 + mysql-test/suite/galera_sr/r/GCF-580.result | 13 + mysql-test/suite/galera_sr/r/GCF-585.result | 28 + mysql-test/suite/galera_sr/r/GCF-597.result | 21 + mysql-test/suite/galera_sr/r/GCF-620.result | 18 + mysql-test/suite/galera_sr/r/GCF-623.result | 29 + mysql-test/suite/galera_sr/r/GCF-627.result | 26 + mysql-test/suite/galera_sr/r/GCF-845.result | 21 + mysql-test/suite/galera_sr/r/GCF-851.result | 30 + mysql-test/suite/galera_sr/r/GCF-867.result | 4 + mysql-test/suite/galera_sr/r/GCF-889.result | 25 + mysql-test/suite/galera_sr/r/GCF-900.result | 21 + .../suite/galera_sr/r/galera-features#56.result | 32 + .../suite/galera_sr/r/galera_sr_bf_abort.result | 555 +++++ mysql-test/suite/galera_sr/r/galera_sr_blob.result | 23 + .../suite/galera_sr/r/galera_sr_cc_master.result | 65 + .../suite/galera_sr/r/galera_sr_cc_slave.result | 59 + .../suite/galera_sr/r/galera_sr_concurrent.result | 36 + .../suite/galera_sr/r/galera_sr_conflict.result | 21 + .../r/galera_sr_conflict_on_commit.result | 31 + .../r/galera_sr_conflict_on_commit2.result | 28 + .../galera_sr_conflict_with_rollback_master.result | 29 + .../suite/galera_sr/r/galera_sr_ddl_master.result | 48 + .../suite/galera_sr/r/galera_sr_ddl_schema.result | 23 + .../suite/galera_sr/r/galera_sr_ddl_slave.result | 50 + .../galera_sr/r/galera_sr_ddl_unrelated.result | 42 + .../galera_sr/r/galera_sr_dupkey_error.result | 46 + .../suite/galera_sr/r/galera_sr_fk_conflict.result | 39 + mysql-test/suite/galera_sr/r/galera_sr_gtid.result | 57 + .../galera_sr/r/galera_sr_insert_select.result | 18 + .../r/galera_sr_kill_all_nobootstrap.result | 29 + .../r/galera_sr_kill_all_norecovery.result | 30 + .../r/galera_sr_kill_all_pcrecovery.result | 30 + .../galera_sr/r/galera_sr_kill_connection.result | 32 + .../suite/galera_sr/r/galera_sr_kill_query.result | 31 + .../suite/galera_sr/r/galera_sr_kill_slave.result | 53 + .../galera_sr/r/galera_sr_large_fragment.result | 33 + .../suite/galera_sr/r/galera_sr_load_data.result | 13 + .../r/galera_sr_load_data_splitting.result | 9 + .../suite/galera_sr/r/galera_sr_log_bin.result | 124 + .../galera_sr/r/galera_sr_many_fragments.result | 33 + .../suite/galera_sr/r/galera_sr_myisam.result | 16 + .../galera_sr/r/galera_sr_mysqldump_sst.result | 58 + .../galera_sr/r/galera_sr_parallel_apply.result | 37 + .../suite/galera_sr/r/galera_sr_rollback.result | 42 + .../galera_sr/r/galera_sr_rollback_retry.result | 33 + .../r/galera_sr_rollback_savepoint.result | 42 + .../r/galera_sr_rollback_statement.result | 22 + mysql-test/suite/galera_sr/r/galera_sr_sbr.result | 16 + .../galera_sr/r/galera_sr_shutdown_master.result | 31 + .../galera_sr/r/galera_sr_shutdown_slave.result | 43 + .../galera_sr/r/galera_sr_small_gcache.result | 15 + .../galera_sr/r/galera_sr_table_contents.result | 198 ++ .../r/galera_sr_transaction_replay.result | 121 + .../galera_sr/r/galera_sr_unit_statements.result | 54 + .../galera_sr/r/galera_sr_v1_row_events.result | 20 + .../suite/galera_sr/r/galera_sr_ws_size.result | 36 + .../suite/galera_sr/r/galera_sr_ws_size2.result | 34 + .../r/galera_var_ignore_apply_errors_sr.result | 29 + .../suite/galera_sr/r/mysql-wsrep#215.result | 137 ++ .../galera_sr/r/mysql-wsrep-features#136.result | 65 + .../galera_sr/r/mysql-wsrep-features#138.result | 24 + .../galera_sr/r/mysql-wsrep-features#14.result | 12 + .../galera_sr/r/mysql-wsrep-features#148.result | 42 + .../galera_sr/r/mysql-wsrep-features#15.result | 11 + .../galera_sr/r/mysql-wsrep-features#165.result | 752 ++++++ .../galera_sr/r/mysql-wsrep-features#22.result | 35 + .../galera_sr/r/mysql-wsrep-features#27.result | 23 + .../galera_sr/r/mysql-wsrep-features#29.result | 14 + .../galera_sr/r/mysql-wsrep-features#32.result | 27 + .../galera_sr/r/mysql-wsrep-features#35.result | 41 + .../galera_sr/r/mysql-wsrep-features#8.result | 39 + .../galera_sr/r/mysql-wsrep-features#9.result | 20 + .../galera_sr/r/mysql-wsrep-features#93.result | 18 + .../galera_sr/r/mysql-wsrep-features#96.result | 33 + mysql-test/suite/galera_sr/t/GCF-1008.inc | 36 + mysql-test/suite/galera_sr/t/GCF-1008.test | 18 + mysql-test/suite/galera_sr/t/GCF-1018.test | 38 + mysql-test/suite/galera_sr/t/GCF-1018B.test | 40 + mysql-test/suite/galera_sr/t/GCF-1043A.test | 13 + mysql-test/suite/galera_sr/t/GCF-1043B.test | 13 + mysql-test/suite/galera_sr/t/GCF-1051.test | 51 + mysql-test/suite/galera_sr/t/GCF-1060.test | 9 + mysql-test/suite/galera_sr/t/GCF-437.test | 21 + mysql-test/suite/galera_sr/t/GCF-561.test | 65 + mysql-test/suite/galera_sr/t/GCF-571.test | 54 + mysql-test/suite/galera_sr/t/GCF-572.test | 54 + mysql-test/suite/galera_sr/t/GCF-574.test | 27 + mysql-test/suite/galera_sr/t/GCF-580.test | 27 + mysql-test/suite/galera_sr/t/GCF-585.test | 44 + mysql-test/suite/galera_sr/t/GCF-597.test | 29 + mysql-test/suite/galera_sr/t/GCF-620.test | 22 + mysql-test/suite/galera_sr/t/GCF-623.test | 31 + mysql-test/suite/galera_sr/t/GCF-627.test | 30 + mysql-test/suite/galera_sr/t/GCF-845.test | 30 + mysql-test/suite/galera_sr/t/GCF-851.test | 24 + mysql-test/suite/galera_sr/t/GCF-867.test | 42 + mysql-test/suite/galera_sr/t/GCF-889.test | 29 + mysql-test/suite/galera_sr/t/GCF-900.test | 28 + .../suite/galera_sr/t/galera-features#56.test | 55 + .../suite/galera_sr/t/galera_sr_bf_abort.inc | 145 ++ .../suite/galera_sr/t/galera_sr_bf_abort.test | 50 + mysql-test/suite/galera_sr/t/galera_sr_blob.test | 38 + .../suite/galera_sr/t/galera_sr_cc_master.test | 98 + .../suite/galera_sr/t/galera_sr_cc_slave.test | 97 + .../suite/galera_sr/t/galera_sr_concurrent.test | 45 + .../suite/galera_sr/t/galera_sr_conflict.test | 45 + .../galera_sr/t/galera_sr_conflict_on_commit.test | 45 + .../galera_sr/t/galera_sr_conflict_on_commit2.test | 46 + .../t/galera_sr_conflict_with_rollback_master.test | 44 + .../suite/galera_sr/t/galera_sr_ddl_master.test | 63 + .../suite/galera_sr/t/galera_sr_ddl_schema.test | 43 + .../suite/galera_sr/t/galera_sr_ddl_slave.test | 65 + .../suite/galera_sr/t/galera_sr_ddl_unrelated.test | 53 + .../suite/galera_sr/t/galera_sr_dupkey_error.test | 59 + .../suite/galera_sr/t/galera_sr_fk_conflict.test | 62 + .../suite/galera_sr/t/galera_sr_gtid-master.opt | 1 + mysql-test/suite/galera_sr/t/galera_sr_gtid.test | 46 + .../suite/galera_sr/t/galera_sr_insert_select.test | 33 + .../t/galera_sr_kill_all_nobootstrap.test | 52 + .../galera_sr/t/galera_sr_kill_all_norecovery.cnf | 4 + .../galera_sr/t/galera_sr_kill_all_norecovery.test | 53 + .../galera_sr/t/galera_sr_kill_all_pcrecovery.test | 54 + .../galera_sr/t/galera_sr_kill_connection.test | 59 + .../suite/galera_sr/t/galera_sr_kill_query.test | 48 + .../suite/galera_sr/t/galera_sr_kill_slave.cnf | 4 + .../suite/galera_sr/t/galera_sr_kill_slave.test | 80 + .../t/galera_sr_large_fragment-master.opt | 1 + .../galera_sr/t/galera_sr_large_fragment.test | 58 + .../suite/galera_sr/t/galera_sr_load_data.test | 39 + .../galera_sr/t/galera_sr_load_data_splitting.test | 50 + .../suite/galera_sr/t/galera_sr_log_bin-master.opt | 1 + .../suite/galera_sr/t/galera_sr_log_bin.test | 70 + .../galera_sr/t/galera_sr_many_fragments.test | 53 + mysql-test/suite/galera_sr/t/galera_sr_myisam.test | 29 + .../suite/galera_sr/t/galera_sr_mysqldump_sst.cnf | 11 + .../suite/galera_sr/t/galera_sr_mysqldump_sst.test | 79 + .../galera_sr/t/galera_sr_parallel_apply.test | 59 + .../suite/galera_sr/t/galera_sr_rollback.test | 76 + .../galera_sr/t/galera_sr_rollback_retry.test | 55 + .../galera_sr/t/galera_sr_rollback_savepoint.test | 51 + .../galera_sr/t/galera_sr_rollback_statement.test | 61 + mysql-test/suite/galera_sr/t/galera_sr_sbr.test | 31 + .../galera_sr/t/galera_sr_shutdown_master.test | 53 + .../galera_sr/t/galera_sr_shutdown_slave.test | 63 + .../suite/galera_sr/t/galera_sr_small_gcache.cnf | 6 + .../suite/galera_sr/t/galera_sr_small_gcache.test | 21 + .../galera_sr/t/galera_sr_table_contents.test | 49 + .../galera_sr/t/galera_sr_transaction_replay.test | 260 ++ .../galera_sr/t/galera_sr_unit_statements.test | 54 + .../galera_sr/t/galera_sr_v1_row_events-master.opt | 1 + .../suite/galera_sr/t/galera_sr_v1_row_events.test | 27 + .../suite/galera_sr/t/galera_sr_ws_size.test | 70 + .../suite/galera_sr/t/galera_sr_ws_size2.test | 62 + .../t/galera_var_ignore_apply_errors_sr.test | 38 + mysql-test/suite/galera_sr/t/mysql-wsrep#215.test | 175 ++ .../t/mysql-wsrep-features#136-master.opt | 1 + .../galera_sr/t/mysql-wsrep-features#136.test | 41 + .../galera_sr/t/mysql-wsrep-features#138.test | 25 + .../suite/galera_sr/t/mysql-wsrep-features#14.test | 21 + .../galera_sr/t/mysql-wsrep-features#148.test | 60 + .../suite/galera_sr/t/mysql-wsrep-features#15.test | 17 + .../suite/galera_sr/t/mysql-wsrep-features#165.inc | 104 + .../galera_sr/t/mysql-wsrep-features#165.test | 41 + .../suite/galera_sr/t/mysql-wsrep-features#22.test | 47 + .../suite/galera_sr/t/mysql-wsrep-features#27.test | 29 + .../suite/galera_sr/t/mysql-wsrep-features#29.test | 23 + .../galera_sr/t/mysql-wsrep-features#32-master.opt | 1 + .../suite/galera_sr/t/mysql-wsrep-features#32.test | 44 + .../suite/galera_sr/t/mysql-wsrep-features#35.test | 48 + .../suite/galera_sr/t/mysql-wsrep-features#8.test | 63 + .../suite/galera_sr/t/mysql-wsrep-features#9.test | 44 + .../suite/galera_sr/t/mysql-wsrep-features#93.test | 29 + .../suite/galera_sr/t/mysql-wsrep-features#96.test | 45 + mysql-test/suite/gcol/r/gcol_bugfixes.result | 2 + mysql-test/suite/gcol/r/gcol_keys_innodb.result | 8 +- mysql-test/suite/gcol/r/gcol_keys_myisam.result | 6 + mysql-test/suite/gcol/r/gcol_select_innodb.result | 7 + mysql-test/suite/gcol/r/gcol_select_myisam.result | 11 + mysql-test/suite/gcol/r/gcol_view_innodb.result | 1 + mysql-test/suite/gcol/r/gcol_view_myisam.result | 1 + .../suite/gcol/r/innodb_virtual_fk_restart.result | 9 + .../suite/gcol/r/innodb_virtual_index.result | 22 +- .../suite/gcol/t/innodb_virtual_fk_restart.test | 9 + mysql-test/suite/gcol/t/innodb_virtual_index.test | 19 + mysql-test/suite/handler/aria.result | 4 +- mysql-test/suite/handler/heap.result | 5 +- mysql-test/suite/handler/innodb.result | 4 +- mysql-test/suite/handler/interface.result | 6 +- mysql-test/suite/handler/interface.test | 6 +- mysql-test/suite/handler/myisam.result | 4 +- mysql-test/suite/innodb/include/alter_instant.inc | 33 - mysql-test/suite/innodb/include/crc32.pl | 33 + .../suite/innodb/r/alter_candidate_key.result | 114 + .../suite/innodb/r/alter_inplace_perfschema.result | 9 +- mysql-test/suite/innodb/r/analyze_table.result | 1 + mysql-test/suite/innodb/r/data_types.result | 23 +- .../r/default_row_format_create,redundant.rdiff | 11 + .../innodb/r/default_row_format_create.result | 22 +- mysql-test/suite/innodb/r/innochecksum.result | 5 - .../suite/innodb/r/innodb-alter-debug.result | 23 + .../suite/innodb/r/innodb-alter-table.result | 1 + mysql-test/suite/innodb/r/innodb-alter.result | 35 +- .../suite/innodb/r/innodb-index-online.result | 7 +- mysql-test/suite/innodb/r/innodb-index.result | 48 + .../suite/innodb/r/innodb-online-alter-gis.result | 2 +- .../suite/innodb/r/innodb-table-online.result | 12 +- .../suite/innodb/r/innodb-update-insert.result | 4 +- .../suite/innodb/r/innodb-virtual-columns.result | 13 + .../suite/innodb/r/innodb-wl5522-debug.result | 6 - mysql-test/suite/innodb/r/innodb.result | 3 +- mysql-test/suite/innodb/r/innodb_28867993.result | 9 + .../suite/innodb/r/innodb_bug14676111.result | 6 + mysql-test/suite/innodb/r/innodb_bug30423.result | 11 + mysql-test/suite/innodb/r/innodb_bug53046.result | 1 + mysql-test/suite/innodb/r/innodb_bug57252.result | 1 + .../innodb/r/innodb_max_recordsize_32k.result | 6 + .../innodb/r/innodb_max_recordsize_64k.result | 6 + mysql-test/suite/innodb/r/innodb_mysql.result | 15 +- .../innodb/r/innodb_skip_innodb_is_tables.result | 1 - mysql-test/suite/innodb/r/innodb_stats.result | 10 + .../suite/innodb/r/innodb_stats_drop_locked.result | 1 + .../suite/innodb/r/innodb_stats_fetch.result | 4 + .../innodb/r/innodb_stats_fetch_corrupted.result | 4 + .../innodb/r/innodb_stats_fetch_nonexistent.result | 4 + .../suite/innodb/r/innodb_stats_persistent.result | 3 +- .../innodb/r/innodb_stats_persistent_debug.result | 1 + .../suite/innodb/r/innodb_zip_innochecksum.result | 91 - .../suite/innodb/r/innodb_zip_innochecksum2.result | 160 -- .../suite/innodb/r/innodb_zip_innochecksum3.result | 227 -- mysql-test/suite/innodb/r/instant_alter.result | 635 ++++- .../suite/innodb/r/instant_alter_bugs.result | 130 + .../suite/innodb/r/instant_alter_crash.result | 30 +- .../suite/innodb/r/instant_alter_debug.result | 40 + .../suite/innodb/r/instant_alter_null.result | 56 + .../innodb/r/instant_alter_purge,release.rdiff | 18 + .../suite/innodb/r/instant_alter_purge.result | 46 + mysql-test/suite/innodb/r/instant_drop.result | 27 +- .../suite/innodb/r/instant_varchar_enlarge.result | 9 + mysql-test/suite/innodb/r/monitor.result | 1 - mysql-test/suite/innodb/r/purge_secondary.result | 1 + mysql-test/suite/innodb/r/table_flags.result | 5 + mysql-test/suite/innodb/r/truncate.result | 33 + .../suite/innodb/r/undo_truncate_recover.result | 1 - mysql-test/suite/innodb/t/alter_candidate_key.test | 72 + .../suite/innodb/t/alter_inplace_perfschema.test | 8 +- mysql-test/suite/innodb/t/data_types.test | 22 +- .../suite/innodb/t/default_row_format_create.test | 20 +- mysql-test/suite/innodb/t/innochecksum.test | 32 - mysql-test/suite/innodb/t/innodb-alter-debug.test | 32 + mysql-test/suite/innodb/t/innodb-alter.test | 18 +- mysql-test/suite/innodb/t/innodb-index.test | 55 +- mysql-test/suite/innodb/t/innodb-table-online.test | 4 - .../suite/innodb/t/innodb-virtual-columns.test | 11 + mysql-test/suite/innodb/t/innodb-wl5522-debug.test | 14 - mysql-test/suite/innodb/t/innodb_28867993.test | 12 + .../suite/innodb/t/innodb_zip_innochecksum.opt | 2 - .../suite/innodb/t/innodb_zip_innochecksum.test | 239 -- .../suite/innodb/t/innodb_zip_innochecksum2.opt | 3 - .../suite/innodb/t/innodb_zip_innochecksum2.test | 118 - .../suite/innodb/t/innodb_zip_innochecksum3.opt | 1 - .../suite/innodb/t/innodb_zip_innochecksum3.test | 406 --- mysql-test/suite/innodb/t/instant_alter.test | 236 ++ mysql-test/suite/innodb/t/instant_alter_bugs.test | 138 ++ mysql-test/suite/innodb/t/instant_alter_crash.test | 10 +- mysql-test/suite/innodb/t/instant_alter_debug.test | 40 + mysql-test/suite/innodb/t/instant_alter_null.test | 57 + mysql-test/suite/innodb/t/instant_alter_purge.test | 75 + mysql-test/suite/innodb/t/instant_drop.test | 14 +- .../suite/innodb/t/instant_varchar_enlarge.test | 8 + mysql-test/suite/innodb/t/log_file_name_debug.test | 4 +- .../suite/innodb/t/purge_thread_shutdown.test | 4 +- mysql-test/suite/innodb/t/recovery_shutdown.test | 6 + mysql-test/suite/innodb/t/table_flags.test | 6 + mysql-test/suite/innodb/t/truncate.test | 35 + .../suite/innodb/t/undo_truncate_recover.test | 4 - mysql-test/suite/innodb_fts/r/create.result | 20 +- .../suite/innodb_fts/r/innodb-fts-ddl.result | 11 +- .../suite/innodb_fts/r/innodb-fts-fic.result | 2 + .../suite/innodb_fts/r/innodb-fts-stopword.result | 4 + .../suite/innodb_fts/r/innodb_fts_misc_1.result | 4 + mysql-test/suite/innodb_fts/t/create.test | 16 + mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test | 10 + mysql-test/suite/innodb_gis/r/1.result | 4 +- .../suite/innodb_gis/r/alter_spatial_index.result | 9 +- .../suite/innodb_gis/r/create_spatial_index.result | 3 + mysql-test/suite/innodb_gis/r/gis.result | 4 +- .../suite/innodb_gis/r/innodb_gis_rtree.result | 1 + mysql-test/suite/innodb_gis/r/rt_precise.result | 1 + mysql-test/suite/innodb_gis/r/rtree.result | 2 + .../suite/innodb_gis/r/rtree_estimate.result | 1 + mysql-test/suite/innodb_zip/r/innodb-zip.result | 4 + .../suite/innodb_zip/r/wl5522_debug_zip.result | 6 - mysql-test/suite/innodb_zip/t/innochecksum.test | 4 + .../suite/innodb_zip/t/wl5522_debug_zip.test | 14 - .../large_tests/r/rpl_slave_net_timeout.result | 4 + mysql-test/suite/maria/icp.result | 2 +- mysql-test/suite/maria/maria-autozerofill.result | 1 + .../suite/maria/maria-gis-rtree-dynamic.result | 1 + .../suite/maria/maria-gis-rtree-trans.result | 1 + mysql-test/suite/maria/maria-gis-rtree.result | 1 + mysql-test/suite/maria/maria.result | 9 +- mysql-test/suite/maria/maria3.result | 2 + mysql-test/suite/maria/system_tables.result | 1 + mysql-test/suite/maria/system_tables.test | 4 +- mysql-test/suite/mariabackup/backup_grants.result | 5 + mysql-test/suite/mariabackup/backup_grants.test | 30 + .../mariabackup/drop_table_during_backup.result | 5 + .../mariabackup/drop_table_during_backup.test | 9 + .../mariabackup/encrypted_page_compressed.opt | 6 + .../mariabackup/encrypted_page_compressed.result | 7 + .../mariabackup/encrypted_page_compressed.test | 48 + .../mariabackup/encrypted_page_corruption.opt | 6 + .../mariabackup/encrypted_page_corruption.result | 8 + .../mariabackup/encrypted_page_corruption.test | 70 + mysql-test/suite/mariabackup/huge_lsn.opt | 4 + mysql-test/suite/mariabackup/partition_partial.opt | 1 + .../suite/mariabackup/partition_partial.result | 31 + .../suite/mariabackup/partition_partial.test | 44 + .../suite/mariabackup/rename_during_backup.result | 9 + .../suite/mariabackup/rename_during_backup.test | 7 + .../mariabackup/unencrypted_page_compressed.result | 11 + .../mariabackup/unencrypted_page_compressed.test | 50 + .../suite/mariabackup/xb_aws_key_management.result | 5 - .../parts/r/partition_alter1_1_2_innodb.result | 56 + .../parts/r/partition_alter1_1_2_myisam.result | 16 + .../suite/parts/r/partition_alter1_1_innodb.result | 32 + .../suite/parts/r/partition_alter1_1_myisam.result | 16 + .../suite/parts/r/partition_alter1_2_innodb.result | 80 + .../suite/parts/r/partition_alter1_2_myisam.result | 32 + .../parts/r/partition_alter2_1_1_innodb.result | 40 + .../parts/r/partition_alter2_1_2_innodb.result | 40 + .../suite/parts/r/partition_alter2_1_maria.result | 48 + .../suite/parts/r/partition_alter2_1_myisam.result | 48 + .../parts/r/partition_alter2_2_1_innodb.result | 40 + .../parts/r/partition_alter2_2_2_innodb.result | 40 + .../suite/parts/r/partition_alter2_2_maria.result | 48 + .../suite/parts/r/partition_alter2_2_myisam.result | 48 + .../suite/parts/r/partition_alter4_innodb.result | 216 ++ .../suite/parts/r/partition_alter4_myisam.result | 216 ++ .../suite/parts/r/partition_basic_innodb.result | 64 + .../suite/parts/r/partition_basic_myisam.result | 32 + .../parts/r/partition_basic_symlink_myisam.result | 39 + .../suite/parts/r/partition_engine_innodb.result | 11 + .../suite/parts/r/partition_engine_myisam.result | 11 + .../suite/parts/r/partition_mgm_lc0_innodb.result | 1 + .../suite/parts/r/partition_mgm_lc0_memory.result | 1 + .../suite/parts/r/partition_mgm_lc0_myisam.result | 1 + .../suite/parts/r/partition_mgm_lc1_innodb.result | 1 + .../suite/parts/r/partition_mgm_lc1_memory.result | 1 + .../suite/parts/r/partition_mgm_lc1_myisam.result | 1 + .../suite/parts/r/partition_mgm_lc2_innodb.result | 1 + .../suite/parts/r/partition_mgm_lc2_memory.result | 1 + .../suite/parts/r/partition_mgm_lc2_myisam.result | 1 + .../suite/parts/r/partition_repair_myisam.result | 3 +- .../perfschema/r/dml_setup_instruments.result | 4 +- .../suite/perfschema/r/event_aggregate.result | 412 ++-- .../suite/perfschema/r/event_aggregate_no_a.result | 344 +-- .../perfschema/r/event_aggregate_no_a_no_h.result | 268 +- .../perfschema/r/event_aggregate_no_a_no_u.result | 272 +- .../r/event_aggregate_no_a_no_u_no_h.result | 196 +- .../suite/perfschema/r/event_aggregate_no_h.result | 336 +-- .../suite/perfschema/r/event_aggregate_no_u.result | 340 +-- .../perfschema/r/event_aggregate_no_u_no_h.result | 264 +- .../r/hostcache_ipv4_nameinfo_again_allow.result | 4 +- .../r/hostcache_ipv6_nameinfo_again_allow.result | 4 +- .../suite/perfschema/r/privilege_table_io.result | 12 +- .../perfschema/r/setup_instruments_defaults.result | 1 - .../suite/perfschema/r/socket_connect.result | 13 - .../suite/perfschema/r/stage_mdl_global.result | 2 +- mysql-test/suite/perfschema/t/socket_connect.test | 9 +- .../suite/perfschema/t/stage_mdl_global.test | 4 +- mysql-test/suite/plugins/r/audit_null.result | 6 + mysql-test/suite/plugins/r/auth_ed25519.result | 2 +- .../suite/plugins/r/cracklib_password_check.result | 2 +- .../suite/plugins/r/feedback_plugin_load.result | 2 +- .../suite/plugins/r/feedback_plugin_send.result | 2 +- .../r/max_password_errors_auth_named_pipe.result | 12 + .../r/max_password_errors_auth_socket.result | 12 + mysql-test/suite/plugins/r/server_audit.result | 22 +- mysql-test/suite/plugins/r/show_all_plugins.result | 4 +- .../suite/plugins/r/simple_password_check.result | 4 +- mysql-test/suite/plugins/r/sql_error_log.result | 4 +- .../plugins/r/thread_pool_server_audit.result | 22 +- .../suite/plugins/t/feedback_plugin_load.test | 4 +- .../t/max_password_errors_auth_named_pipe.opt | 1 + .../t/max_password_errors_auth_named_pipe.test | 22 + .../plugins/t/max_password_errors_auth_socket.opt | 1 + .../plugins/t/max_password_errors_auth_socket.test | 23 + .../suite/plugins/t/simple_password_check.test | 2 +- mysql-test/suite/roles/create_and_drop_role.result | 6 +- .../create_and_drop_role_invalid_user_table.result | 1 - .../create_and_drop_role_invalid_user_table.test | 7 +- .../roles/default_create_user_not_role.result | 2 +- mysql-test/suite/roles/flush_roles-17898.result | 9 + mysql-test/suite/roles/flush_roles-17898.test | 12 + mysql-test/suite/roles/grant_revoke_current.result | 3 +- mysql-test/suite/roles/grant_revoke_current.test | 5 +- .../suite/roles/grant_role_auto_create_user.result | 2 +- .../roles/i_s_applicable_roles_is_default.result | 1 + .../roles/i_s_applicable_roles_is_default.test | 2 +- mysql-test/suite/roles/none_public.result | 12 +- mysql-test/suite/roles/none_public.test | 6 +- .../suite/roles/prepare_stmt_with_role.result | 6 +- mysql-test/suite/roles/rename_user.result | 2 +- .../suite/roles/role_case_sensitive-10744.result | 2 +- .../suite/roles/set_default_role_clear.result | 8 +- mysql-test/suite/roles/set_default_role_for.result | 13 +- mysql-test/suite/roles/set_default_role_for.test | 3 - .../suite/roles/set_default_role_invalid.result | 6 +- .../roles/set_default_role_new_connection.result | 10 +- .../suite/roles/set_default_role_ps-6960.result | 3 +- .../suite/roles/set_default_role_ps-6960.test | 7 +- .../suite/roles/set_role-database-recursive.result | 2 +- .../suite/roles/set_role-database-simple.result | 2 +- mysql-test/suite/roles/set_role-recursive.result | 2 +- .../suite/roles/set_role-routine-simple.result | 2 +- mysql-test/suite/roles/set_role-simple.result | 2 +- .../suite/roles/set_role-table-column-priv.result | 2 +- .../suite/roles/set_role-table-simple.result | 2 +- mysql-test/suite/roles/show_grants.result | 2 +- .../suite/roles/show_grants_replicated.result | 2 +- mysql-test/suite/rpl/disabled.def | 1 + mysql-test/suite/rpl/include/rpl_EE_err.test | 2 +- mysql-test/suite/rpl/include/rpl_row_001.test | 96 - mysql-test/suite/rpl/include/rpl_row_annotate.test | 2 +- .../suite/rpl/include/rpl_row_delayed_ins.test | 2 +- mysql-test/suite/rpl/r/rpl_EE_err.result | 2 +- mysql-test/suite/rpl/r/rpl_bug31076.result | 2 +- mysql-test/suite/rpl/r/rpl_create_drop_user.result | 22 +- .../suite/rpl/r/rpl_create_if_not_exists.result | 2 - mysql-test/suite/rpl/r/rpl_ddl.result | 12 +- mysql-test/suite/rpl/r/rpl_do_grant.result | 24 +- .../suite/rpl/r/rpl_extra_col_master_innodb.result | 2 +- .../suite/rpl/r/rpl_extra_col_master_myisam.result | 2 +- mysql-test/suite/rpl/r/rpl_grant.result | 8 +- mysql-test/suite/rpl/r/rpl_gtid_mdev4484.result | 40 +- mysql-test/suite/rpl/r/rpl_gtid_stop_start.result | 8 +- mysql-test/suite/rpl/r/rpl_idempotency.result | 17 + mysql-test/suite/rpl/r/rpl_ignore_revoke.result | 10 +- mysql-test/suite/rpl/r/rpl_ignore_table.result | 9 +- mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result | 45 +- .../rpl/r/rpl_mixed_implicit_commit_binlog.result | 1 + .../rpl/r/rpl_mysql57_stm_temporal_round.result | 22 + .../rpl/r/rpl_mysql80_stm_temporal_round.result | 23 + mysql-test/suite/rpl/r/rpl_parallel.result | 1 + .../suite/rpl/r/rpl_parallel_optimistic.result | 16 +- mysql-test/suite/rpl/r/rpl_rewrt_db.result | 6 +- mysql-test/suite/rpl/r/rpl_row_001.result | 42 +- mysql-test/suite/rpl/r/rpl_row_annotate_do.result | 2 +- .../suite/rpl/r/rpl_row_annotate_dont.result | 2 +- .../suite/rpl/r/rpl_row_big_table_id,32bit.rdiff | 31 + mysql-test/suite/rpl/r/rpl_row_big_table_id.result | 46 + mysql-test/suite/rpl/r/rpl_row_delayed_ins.result | 2 +- .../rpl/r/rpl_row_implicit_commit_binlog.result | 1 + mysql-test/suite/rpl/r/rpl_stm_000001.result | 33 +- .../rpl/r/rpl_stm_implicit_commit_binlog.result | 1 + mysql-test/suite/rpl/r/rpl_temporal_round.result | 50 + .../suite/rpl/r/rpl_tmp_table_and_DDL.result | 22 +- mysql-test/suite/rpl/r/rpl_user.result | 11 + mysql-test/suite/rpl/t/rpl_do_grant.test | 30 +- mysql-test/suite/rpl/t/rpl_gtid_crash.test | 2 + mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test | 68 +- mysql-test/suite/rpl/t/rpl_idempotency.test | 21 + mysql-test/suite/rpl/t/rpl_ignore_table.test | 4 +- .../rpl/t/rpl_mysql57_stm_temporal_round.test | 58 + .../rpl/t/rpl_mysql80_stm_temporal_round.test | 62 + .../suite/rpl/t/rpl_parallel_optimistic.test | 42 +- mysql-test/suite/rpl/t/rpl_row_001.test | 48 +- mysql-test/suite/rpl/t/rpl_row_big_table_id.test | 57 + mysql-test/suite/rpl/t/rpl_stm_000001.test | 21 +- mysql-test/suite/rpl/t/rpl_temporal_round.test | 35 + mysql-test/suite/rpl/t/rpl_user.test | 11 + mysql-test/suite/storage_engine/type_bool.result | 4 +- .../suite/sys_vars/r/max_seeks_for_key_func.result | 1 + .../sys_vars/r/myisam_stats_method_func.result | 6 +- ...ptimizer_use_condition_selectivity_basic.result | 20 +- mysql-test/suite/sys_vars/r/sql_mode_basic.result | 10 +- .../sys_vars/r/sysvars_server_embedded.result | 44 +- .../sys_vars/r/sysvars_server_notembedded.result | 58 +- mysql-test/suite/sys_vars/r/sysvars_wsrep.result | 58 +- .../sys_vars/r/table_definition_cache_basic.result | 16 +- .../suite/sys_vars/r/use_stat_tables_basic.result | 10 +- .../sys_vars/r/wsrep_provider_options_basic.result | 15 +- .../suite/sys_vars/r/wsrep_sst_method_basic.result | 4 + .../t/aria_used_for_temp_tables_basic.test | 1 + mysql-test/suite/sys_vars/t/sql_mode_basic.test | 8 +- mysql-test/suite/sys_vars/t/sysvars_aria.test | 1 + .../sys_vars/t/table_definition_cache_basic.test | 6 +- .../suite/sys_vars/t/tmp_disk_table_size_func.test | 2 + .../sys_vars/t/wsrep_provider_options_basic.test | 16 +- .../suite/sys_vars/t/wsrep_sst_method_basic.test | 5 + mysql-test/suite/vcol/r/update.result | 4 +- mysql-test/suite/vcol/r/update_binlog.result | 8 +- mysql-test/suite/vcol/r/upgrade.result | 16 + mysql-test/suite/vcol/r/vcol_keys_myisam.result | 1 + mysql-test/suite/vcol/r/vcol_misc.result | 28 +- mysql-test/suite/vcol/t/update.test | 4 +- mysql-test/suite/vcol/t/upgrade.test | 15 + mysql-test/suite/vcol/t/vcol_misc.test | 27 +- mysql-test/suite/versioning/r/alter.result | 2 +- mysql-test/suite/versioning/r/cte.result | 2 +- mysql-test/suite/versioning/r/foreign.result | 9 + mysql-test/suite/versioning/r/online.result | 28 + mysql-test/suite/versioning/r/sysvars.result | 15 +- mysql-test/suite/versioning/t/alter.test | 2 +- mysql-test/suite/versioning/t/foreign.test | 14 + mysql-test/suite/versioning/t/online.test | 44 + mysql-test/suite/versioning/t/sysvars.test | 10 + mysql-test/suite/wsrep/disabled.def | 3 +- mysql-test/suite/wsrep/my.cnf | 4 +- mysql-test/suite/wsrep/r/variables.result | 3 - .../suite/wsrep/r/wsrep-recover,binlogon.rdiff | 28 + mysql-test/suite/wsrep/r/wsrep-recover.result | 66 + mysql-test/suite/wsrep/suite.pm | 4 +- mysql-test/suite/wsrep/t/binlog_format.cnf | 8 + mysql-test/suite/wsrep/t/binlog_format.opt | 1 - mysql-test/suite/wsrep/t/binlog_format.test | 1 + mysql-test/suite/wsrep/t/mdev_10186.cnf | 6 + mysql-test/suite/wsrep/t/mdev_10186.opt | 1 - mysql-test/suite/wsrep/t/mdev_10186.test | 1 + mysql-test/suite/wsrep/t/mdev_6832.cnf | 7 + mysql-test/suite/wsrep/t/mdev_6832.opt | 1 - mysql-test/suite/wsrep/t/mdev_6832.test | 1 + mysql-test/suite/wsrep/t/mdev_7798.cnf | 7 + mysql-test/suite/wsrep/t/mdev_7798.opt | 1 - mysql-test/suite/wsrep/t/mdev_7798.test | 1 + mysql-test/suite/wsrep/t/pool_of_threads.cnf | 8 + mysql-test/suite/wsrep/t/pool_of_threads.opt | 1 - mysql-test/suite/wsrep/t/variables.test | 6 +- mysql-test/suite/wsrep/t/wsrep-recover-step.inc | 41 + mysql-test/suite/wsrep/t/wsrep-recover.cnf | 9 + .../suite/wsrep/t/wsrep-recover.combinations | 4 + mysql-test/suite/wsrep/t/wsrep-recover.test | 204 ++ mysys/mf_iocache.c | 12 +- mysys/safemalloc.c | 4 +- mysys/thr_alarm.c | 6 +- plugin/feedback/sender_thread.cc | 11 +- plugin/handler_socket/handlersocket/database.cpp | 6 +- plugin/metadata_lock_info/metadata_lock_info.cc | 29 +- .../metadata_lock_info/r/global_read_lock.result | 3 +- plugin/query_response_time/query_response_time.cc | 39 +- plugin/wsrep_info/mysql-test/wsrep_info/my.cnf | 7 +- .../mysql-test/wsrep_info/r/plugin.result | 10 +- plugin/wsrep_info/mysql-test/wsrep_info/suite.pm | 4 +- plugin/wsrep_info/plugin.cc | 87 +- scripts/CMakeLists.txt | 6 +- scripts/galera_new_cluster.sh | 2 +- scripts/mysql_install_db.sh | 7 + scripts/mysql_secure_installation.sh | 6 +- scripts/mysql_system_tables.sql | 63 +- scripts/mysql_system_tables_data.sql | 26 +- scripts/mysql_system_tables_fix.sql | 76 +- scripts/mysql_test_db.sql | 4 +- scripts/mysqld_safe.sh | 11 +- scripts/mytop.sh | 19 +- scripts/wsrep_sst_common.sh | 6 +- scripts/wsrep_sst_mariabackup.sh | 155 +- scripts/wsrep_sst_mysqldump.sh | 5 +- scripts/wsrep_sst_rsync.sh | 27 +- scripts/wsrep_sst_xtrabackup-v2.sh | 1260 ---------- scripts/wsrep_sst_xtrabackup.sh | 692 ------ sql-common/my_time.c | 515 ++-- sql/CMakeLists.txt | 25 +- sql/backup.cc | 385 +++ sql/backup.h | 34 + sql/compat56.cc | 21 +- sql/compat56.h | 9 + sql/event_data_objects.cc | 34 +- sql/event_parse_data.cc | 14 +- sql/event_scheduler.cc | 24 +- sql/field.cc | 454 ++-- sql/field.h | 86 +- sql/field_conv.cc | 33 +- sql/filesort.cc | 115 +- sql/filesort.h | 3 + sql/gen_lex_token.cc | 8 +- sql/ha_partition.cc | 9 +- sql/ha_partition.h | 4 - sql/ha_sequence.cc | 2 +- sql/handle_connections_win.cc | 4 +- sql/handler.cc | 386 ++- sql/handler.h | 49 +- sql/init.h | 1 - sql/innodb_priv.h | 4 +- sql/item.cc | 217 +- sql/item.h | 300 ++- sql/item_cmpfunc.cc | 228 +- sql/item_cmpfunc.h | 46 +- sql/item_create.cc | 101 + sql/item_func.cc | 68 +- sql/item_func.h | 26 +- sql/item_inetfunc.cc | 544 ++-- sql/item_inetfunc.h | 60 +- sql/item_jsonfunc.cc | 9 +- sql/item_strfunc.cc | 107 +- sql/item_strfunc.h | 51 + sql/item_subselect.cc | 26 +- sql/item_subselect.h | 1 + sql/item_sum.cc | 28 + sql/item_sum.h | 15 +- sql/item_timefunc.cc | 190 +- sql/item_timefunc.h | 54 +- sql/item_vers.cc | 4 +- sql/lex.h | 41 +- sql/lock.cc | 183 +- sql/log.cc | 130 +- sql/log.h | 17 +- sql/log_event.cc | 152 +- sql/log_event.h | 53 +- sql/mdl.cc | 626 +++-- sql/mdl.h | 123 +- sql/my_decimal.cc | 4 +- sql/my_decimal.h | 3 +- sql/mysql_install_db.cc | 14 +- sql/mysql_upgrade_service.cc | 189 +- sql/mysqld.cc | 1252 ++++------ sql/mysqld.h | 28 +- sql/opt_range.cc | 14 +- sql/partition_info.cc | 21 +- sql/partition_info.h | 1 + sql/protocol.cc | 22 +- sql/rpl_gtid.cc | 413 ++-- sql/rpl_gtid.h | 12 +- sql/rpl_mi.cc | 4 +- sql/rpl_mi.h | 6 +- sql/rpl_parallel.cc | 4 +- sql/rpl_record.cc | 3 +- sql/rpl_rli.cc | 87 +- sql/rpl_rli.h | 11 - sql/semisync_master_ack_receiver.cc | 61 +- sql/semisync_master_ack_receiver.h | 147 +- sql/service_wsrep.cc | 255 ++ sql/share/errmsg-utf8.txt | 16 +- sql/slave.cc | 197 +- sql/slave.h | 1 + sql/sp.cc | 7 +- sql/sp.h | 3 +- sql/sp_head.cc | 58 +- sql/sp_pcontext.cc | 13 + sql/sp_pcontext.h | 8 +- sql/sp_rcontext.cc | 27 - sql/sql_acl.cc | 2338 ++++++++++-------- sql/sql_admin.cc | 2 +- sql/sql_alter.cc | 2 + sql/sql_array.h | 10 +- sql/sql_base.cc | 661 +++-- sql/sql_base.h | 23 +- sql/sql_basic_types.h | 265 +- sql/sql_cache.cc | 4 +- sql/sql_class.cc | 259 +- sql/sql_class.h | 423 +++- sql/sql_cmd.h | 1 + sql/sql_connect.cc | 32 +- sql/sql_const.h | 12 +- sql/sql_cursor.cc | 5 + sql/sql_db.cc | 11 +- sql/sql_db.h | 3 +- sql/sql_delete.cc | 4 +- sql/sql_handler.cc | 14 +- sql/sql_handler.h | 1 + sql/sql_insert.cc | 183 +- sql/sql_lex.cc | 167 +- sql/sql_lex.h | 31 +- sql/sql_load.cc | 11 +- sql/sql_parse.cc | 935 +++---- sql/sql_parse.h | 3 +- sql/sql_partition.cc | 2 + sql/sql_plugin.cc | 30 +- sql/sql_plugin_services.ic | 59 +- sql/sql_prepare.cc | 60 +- sql/sql_reload.cc | 59 +- sql/sql_repl.cc | 123 +- sql/sql_select.cc | 121 +- sql/sql_show.cc | 531 ++-- sql/sql_signal.cc | 10 +- sql/sql_sort.h | 1 - sql/sql_statistics.cc | 98 +- sql/sql_statistics.h | 28 + sql/sql_string.cc | 176 +- sql/sql_string.h | 1036 +++++--- sql/sql_table.cc | 197 +- sql/sql_time.cc | 74 +- sql/sql_time.h | 22 +- sql/sql_trigger.cc | 9 +- sql/sql_trigger.h | 3 + sql/sql_truncate.cc | 2 + sql/sql_type.cc | 716 +++++- sql/sql_type.h | 1145 ++++++++- sql/sql_type_int.h | 44 + sql/sql_udf.cc | 3 + sql/sql_udf.h | 15 + sql/sql_union.cc | 7 +- sql/sql_update.cc | 2 +- sql/sql_yacc.yy | 686 ++++-- sql/sql_yacc_ora.yy | 664 +++-- sql/structs.h | 41 +- sql/sys_vars.cc | 84 +- sql/sys_vars.ic | 7 +- sql/table.cc | 29 +- sql/table.h | 58 +- sql/table_cache.cc | 32 +- sql/table_cache.h | 2 +- sql/temporary_tables.cc | 50 +- sql/threadpool_common.cc | 2 +- sql/threadpool_generic.cc | 52 +- sql/transaction.cc | 56 +- sql/udf_example.c | 139 ++ sql/udf_example.def | 7 + sql/unireg.h | 2 +- sql/upgrade_conf_file.cc | 177 ++ sql/vers_string.h | 6 + sql/vers_utils.h | 39 - sql/wsrep_applier.cc | 320 +-- sql/wsrep_applier.h | 67 +- sql/wsrep_binlog.cc | 341 +-- sql/wsrep_binlog.h | 35 +- sql/wsrep_check_opts.cc | 4 +- sql/wsrep_client_service.cc | 307 +++ sql/wsrep_client_service.h | 63 + sql/wsrep_client_state.h | 47 + sql/wsrep_condition_variable.h | 54 + sql/wsrep_dummy.cc | 112 +- sql/wsrep_high_priority_service.cc | 649 +++++ sql/wsrep_high_priority_service.h | 118 + sql/wsrep_hton.cc | 658 ----- sql/wsrep_mutex.h | 50 + sql/wsrep_mysqld.cc | 2600 ++++++++++---------- sql/wsrep_mysqld.h | 394 ++- sql/wsrep_notify.cc | 77 +- sql/wsrep_plugin.cc | 53 + sql/wsrep_priv.h | 24 +- sql/wsrep_schema.cc | 1360 ++++++++++ sql/wsrep_schema.h | 161 ++ sql/wsrep_server_service.cc | 318 +++ sql/wsrep_server_service.h | 81 + sql/wsrep_server_state.cc | 82 + sql/wsrep_server_state.h | 66 + sql/wsrep_sst.cc | 621 ++--- sql/wsrep_sst.h | 33 +- sql/wsrep_storage_service.cc | 238 ++ sql/wsrep_storage_service.h | 48 + sql/wsrep_thd.cc | 787 ++---- sql/wsrep_thd.h | 216 +- sql/wsrep_trans_observer.h | 423 ++++ sql/wsrep_types.h | 29 + sql/wsrep_utils.cc | 104 +- sql/wsrep_utils.h | 79 +- sql/wsrep_var.cc | 324 ++- sql/wsrep_var.h | 11 +- sql/wsrep_xid.cc | 118 +- sql/wsrep_xid.h | 14 +- storage/archive/azio.c | 5 +- storage/archive/ha_archive.cc | 14 + storage/archive/ha_archive.h | 3 +- storage/blackhole/ha_blackhole.h | 2 +- storage/connect/global.h | 6 +- storage/connect/ha_connect.cc | 4 +- storage/connect/jsonudf.cpp | 12 +- storage/connect/mysql-test/connect/r/dir.result | 2 +- storage/connect/mysql-test/connect/r/jdbc.result | 13 + .../mysql-test/connect/r/jdbc_oracle.result | 18 +- .../mysql-test/connect/r/jdbc_postgresql.result | 8 + storage/connect/mysql-test/connect/r/xml2.result | 2 +- storage/connect/plugutil.cpp | 28 +- storage/connect/reldef.cpp | 11 +- storage/connect/tabfmt.h | 2 +- storage/connect/tabjson.cpp | 10 +- storage/connect/tabjson.h | 6 +- storage/connect/tabodbc.cpp | 317 +-- storage/connect/tabxml.cpp | 13 +- storage/connect/tabxml.h | 5 +- storage/connect/user_connect.cc | 4 +- storage/csv/ha_tina.cc | 28 +- storage/csv/ha_tina.h | 2 +- storage/federated/ha_federated.h | 1 + storage/federatedx/TODO | 30 - storage/federatedx/ha_federatedx.h | 2 +- storage/heap/ha_heap.h | 2 +- storage/innobase/CMakeLists.txt | 6 +- storage/innobase/btr/btr0btr.cc | 142 +- storage/innobase/btr/btr0bulk.cc | 9 +- storage/innobase/btr/btr0cur.cc | 231 +- storage/innobase/btr/btr0defragment.cc | 25 +- storage/innobase/btr/btr0pcur.cc | 32 +- storage/innobase/btr/btr0scrub.cc | 8 +- storage/innobase/btr/btr0sea.cc | 8 +- storage/innobase/buf/buf0buf.cc | 470 ++-- storage/innobase/buf/buf0checksum.cc | 55 +- storage/innobase/buf/buf0dblwr.cc | 42 +- storage/innobase/buf/buf0dump.cc | 6 +- storage/innobase/buf/buf0flu.cc | 163 +- storage/innobase/buf/buf0lru.cc | 3 +- storage/innobase/buf/buf0rea.cc | 2 +- storage/innobase/data/data0data.cc | 7 +- storage/innobase/data/data0type.cc | 2 - storage/innobase/dict/dict0boot.cc | 44 +- storage/innobase/dict/dict0crea.cc | 28 +- storage/innobase/dict/dict0defrag_bg.cc | 5 +- storage/innobase/dict/dict0dict.cc | 224 +- storage/innobase/dict/dict0load.cc | 5 +- storage/innobase/dict/dict0mem.cc | 73 +- storage/innobase/dict/dict0stats.cc | 8 +- storage/innobase/dict/dict0stats_bg.cc | 1 - storage/innobase/fil/fil0crypt.cc | 185 +- storage/innobase/fil/fil0fil.cc | 525 ++-- storage/innobase/fil/fil0pagecompress.cc | 9 +- storage/innobase/fsp/fsp0file.cc | 5 - storage/innobase/fsp/fsp0fsp.cc | 5 +- storage/innobase/fsp/fsp0space.cc | 16 +- storage/innobase/fsp/fsp0sysspace.cc | 20 +- storage/innobase/fts/fts0ast.cc | 2 - storage/innobase/fts/fts0fts.cc | 107 +- storage/innobase/fts/fts0opt.cc | 2 - storage/innobase/fts/fts0que.cc | 3 - storage/innobase/gis/gis0rtree.cc | 14 +- storage/innobase/gis/gis0sea.cc | 15 +- storage/innobase/ha/ha0ha.cc | 20 +- storage/innobase/ha/ha0storage.cc | 1 - storage/innobase/handler/ha_innodb.cc | 993 ++++---- storage/innobase/handler/ha_innodb.h | 51 +- storage/innobase/handler/handler0alter.cc | 665 +++-- storage/innobase/handler/i_s.cc | 5 +- storage/innobase/ibuf/ibuf0ibuf.cc | 51 +- storage/innobase/include/btr0btr.h | 30 +- storage/innobase/include/btr0bulk.h | 7 +- storage/innobase/include/btr0cur.h | 3 +- storage/innobase/include/btr0defragment.h | 6 +- storage/innobase/include/btr0pcur.h | 5 - storage/innobase/include/btr0scrub.h | 6 - storage/innobase/include/btr0sea.h | 5 - storage/innobase/include/btr0types.h | 5 +- storage/innobase/include/buf0buddy.h | 6 - storage/innobase/include/buf0buddy.ic | 10 - storage/innobase/include/buf0buf.h | 94 +- storage/innobase/include/buf0buf.ic | 63 +- storage/innobase/include/buf0checksum.h | 19 +- storage/innobase/include/buf0dblwr.h | 1 - storage/innobase/include/buf0flu.h | 13 - storage/innobase/include/buf0flu.ic | 79 +- storage/innobase/include/buf0lru.h | 1 - storage/innobase/include/buf0rea.h | 2 - storage/innobase/include/data0data.h | 2 - storage/innobase/include/dict0boot.h | 17 +- storage/innobase/include/dict0crea.h | 11 - storage/innobase/include/dict0defrag_bg.h | 5 +- storage/innobase/include/dict0dict.h | 185 +- storage/innobase/include/dict0dict.ic | 154 +- storage/innobase/include/dict0load.h | 2 - storage/innobase/include/dict0mem.h | 215 +- storage/innobase/include/dict0priv.h | 14 - storage/innobase/include/dict0priv.ic | 35 - storage/innobase/include/dict0stats.h | 2 - storage/innobase/include/dict0stats.ic | 1 - storage/innobase/include/dict0stats_bg.h | 2 - storage/innobase/include/dyn0buf.h | 3 +- storage/innobase/include/eval0eval.h | 1 - storage/innobase/include/eval0proc.h | 1 - storage/innobase/include/fil0crypt.h | 13 +- storage/innobase/include/fil0fil.h | 130 +- storage/innobase/include/fsp0file.h | 5 +- storage/innobase/include/fsp0fsp.h | 12 +- storage/innobase/include/fsp0space.h | 2 - storage/innobase/include/fsp0sysspace.h | 1 - storage/innobase/include/fsp0types.h | 6 +- storage/innobase/include/fts0ast.h | 1 - storage/innobase/include/fts0fts.h | 18 +- storage/innobase/include/fts0plugin.h | 2 +- storage/innobase/include/fts0priv.h | 1 - storage/innobase/include/fts0types.h | 1 - storage/innobase/include/fts0types.ic | 29 +- storage/innobase/include/fut0fut.h | 3 - storage/innobase/include/fut0lst.h | 11 +- storage/innobase/include/fut0lst.ic | 2 +- storage/innobase/include/gis0rtree.h | 18 - storage/innobase/include/gis0type.h | 11 +- storage/innobase/include/ha0ha.h | 2 - storage/innobase/include/ha0storage.ic | 2 - storage/innobase/include/hash0hash.h | 1 - storage/innobase/include/ib0mutex.h | 127 +- storage/innobase/include/ibuf0ibuf.h | 2 - storage/innobase/include/ibuf0ibuf.ic | 7 +- storage/innobase/include/lock0iter.h | 1 - storage/innobase/include/lock0lock.h | 2 - storage/innobase/include/lock0prdt.h | 1 - storage/innobase/include/lock0priv.h | 1 - storage/innobase/include/lock0types.h | 1 + storage/innobase/include/log0log.h | 9 - storage/innobase/include/log0recv.h | 2 - storage/innobase/include/mach0data.h | 4 +- storage/innobase/include/mem0mem.h | 102 - storage/innobase/include/mem0mem.ic | 2 - storage/innobase/include/mtr0log.h | 1 - storage/innobase/include/mtr0mtr.h | 1 - storage/innobase/include/mtr0mtr.ic | 2 +- storage/innobase/include/os0file.ic | 2 - storage/innobase/include/os0proc.h | 2 +- storage/innobase/include/os0thread.h | 2 +- storage/innobase/include/page0cur.h | 3 - storage/innobase/include/page0cur.ic | 5 - storage/innobase/include/page0page.h | 33 +- storage/innobase/include/page0page.ic | 13 - storage/innobase/include/page0size.h | 1 - storage/innobase/include/page0types.h | 2 - storage/innobase/include/page0zip.h | 30 +- storage/innobase/include/page0zip.ic | 10 - storage/innobase/include/pars0opt.h | 2 - storage/innobase/include/pars0pars.h | 1 - storage/innobase/include/pars0sym.h | 2 - storage/innobase/include/que0que.h | 2 - storage/innobase/include/que0types.h | 1 - storage/innobase/include/read0types.h | 37 +- storage/innobase/include/rem0cmp.h | 6 +- storage/innobase/include/rem0cmp.ic | 1 + storage/innobase/include/rem0rec.h | 1 - storage/innobase/include/rem0rec.ic | 1 + storage/innobase/include/row0ext.h | 3 +- storage/innobase/include/row0ftsort.h | 5 - storage/innobase/include/row0import.h | 1 - storage/innobase/include/row0ins.h | 2 - storage/innobase/include/row0log.h | 6 +- storage/innobase/include/row0merge.h | 5 +- storage/innobase/include/row0mysql.h | 56 +- storage/innobase/include/row0purge.h | 5 +- storage/innobase/include/row0quiesce.h | 1 - storage/innobase/include/row0row.h | 7 +- storage/innobase/include/row0row.ic | 8 +- storage/innobase/include/row0sel.h | 2 - storage/innobase/include/row0uins.h | 2 - storage/innobase/include/row0umod.h | 2 - storage/innobase/include/row0undo.h | 19 +- storage/innobase/include/row0upd.h | 34 +- storage/innobase/include/row0upd.ic | 8 +- storage/innobase/include/row0vers.h | 2 - storage/innobase/include/srv0mon.h | 1 - storage/innobase/include/srv0srv.h | 20 +- storage/innobase/include/srv0start.h | 1 - storage/innobase/include/sync0arr.h | 1 - storage/innobase/include/sync0debug.h | 1 - storage/innobase/include/sync0policy.h | 524 ++-- storage/innobase/include/sync0policy.ic | 101 - storage/innobase/include/sync0rw.h | 7 +- storage/innobase/include/sync0rw.ic | 87 +- storage/innobase/include/sync0sync.h | 1 - storage/innobase/include/sync0types.h | 74 - storage/innobase/include/trx0i_s.h | 1 - storage/innobase/include/trx0purge.h | 42 +- storage/innobase/include/trx0rec.h | 3 - storage/innobase/include/trx0roll.h | 12 - storage/innobase/include/trx0sys.h | 63 +- storage/innobase/include/trx0trx.h | 27 +- storage/innobase/include/trx0types.h | 2 - storage/innobase/include/trx0undo.h | 39 +- storage/innobase/include/trx0undo.ic | 31 - storage/innobase/include/univ.i | 16 +- storage/innobase/include/ut0counter.h | 12 +- storage/innobase/include/ut0crc32.h | 6 +- storage/innobase/include/ut0dbg.h | 2 - storage/innobase/include/ut0mem.h | 1 - storage/innobase/include/ut0mutex.h | 6 - storage/innobase/include/ut0new.h | 4 +- storage/innobase/include/ut0rbt.h | 1 - storage/innobase/include/ut0rnd.h | 5 +- storage/innobase/include/ut0sort.h | 2 - storage/innobase/include/ut0stage.h | 2 - storage/innobase/include/ut0ut.h | 13 +- storage/innobase/include/ut0vec.h | 1 - storage/innobase/include/ut0vec.ic | 2 - storage/innobase/innodb.cmake | 2 + storage/innobase/lock/lock0iter.cc | 1 - storage/innobase/lock/lock0lock.cc | 161 +- storage/innobase/lock/lock0prdt.cc | 9 - storage/innobase/lock/lock0wait.cc | 6 +- storage/innobase/log/log0log.cc | 18 +- storage/innobase/log/log0recv.cc | 33 +- storage/innobase/mem/mem0mem.cc | 2 - storage/innobase/mtr/mtr0mtr.cc | 6 +- storage/innobase/os/os0event.cc | 23 +- storage/innobase/os/os0file.cc | 36 +- storage/innobase/os/os0proc.cc | 31 +- storage/innobase/os/os0thread.cc | 17 +- storage/innobase/page/page0cur.cc | 14 +- storage/innobase/page/page0page.cc | 42 +- storage/innobase/page/page0zip.cc | 231 +- storage/innobase/pars/pars0opt.cc | 1 - storage/innobase/pars/pars0pars.cc | 3 - storage/innobase/que/que0que.cc | 5 - storage/innobase/read/read0read.cc | 10 +- storage/innobase/rem/rem0cmp.cc | 33 +- storage/innobase/rem/rem0rec.cc | 20 +- storage/innobase/row/row0ftsort.cc | 42 +- storage/innobase/row/row0import.cc | 75 +- storage/innobase/row/row0ins.cc | 94 +- storage/innobase/row/row0log.cc | 25 +- storage/innobase/row/row0merge.cc | 86 +- storage/innobase/row/row0mysql.cc | 170 +- storage/innobase/row/row0purge.cc | 33 +- storage/innobase/row/row0quiesce.cc | 11 +- storage/innobase/row/row0row.cc | 6 +- storage/innobase/row/row0sel.cc | 105 +- storage/innobase/row/row0uins.cc | 209 +- storage/innobase/row/row0umod.cc | 76 +- storage/innobase/row/row0undo.cc | 189 +- storage/innobase/row/row0upd.cc | 110 +- storage/innobase/row/row0vers.cc | 2 - storage/innobase/srv/srv0conc.cc | 38 +- storage/innobase/srv/srv0mon.cc | 9 +- storage/innobase/srv/srv0srv.cc | 79 +- storage/innobase/srv/srv0start.cc | 146 +- storage/innobase/sync/sync0arr.cc | 40 +- storage/innobase/sync/sync0debug.cc | 3 - storage/innobase/sync/sync0rw.cc | 89 +- storage/innobase/sync/sync0sync.cc | 1 - storage/innobase/trx/trx0i_s.cc | 14 +- storage/innobase/trx/trx0purge.cc | 42 +- storage/innobase/trx/trx0rec.cc | 101 +- storage/innobase/trx/trx0roll.cc | 190 +- storage/innobase/trx/trx0rseg.cc | 74 +- storage/innobase/trx/trx0sys.cc | 9 +- storage/innobase/trx/trx0trx.cc | 27 +- storage/innobase/trx/trx0undo.cc | 56 +- storage/innobase/ut/ut0crc32.cc | 81 +- storage/innobase/ut/ut0dbg.cc | 5 +- storage/innobase/ut/ut0new.cc | 2 - storage/innobase/ut/ut0rbt.cc | 3 - storage/maria/CMakeLists.txt | 7 +- storage/maria/ha_maria.cc | 29 +- storage/maria/ma_backup.c | 281 +++ storage/maria/ma_check.c | 6 + storage/maria/ma_control_file.c | 120 + storage/maria/ma_control_file.h | 1 + storage/maria/ma_extra.c | 5 + storage/maria/ma_init.c | 2 + storage/maria/ma_locking.c | 6 +- storage/maria/ma_loghandler.c | 26 +- storage/maria/ma_loghandler.h | 3 + storage/maria/ma_pagecrc.c | 10 +- storage/maria/ma_recovery.c | 8 +- storage/maria/maria_def.h | 4 + storage/maria/maria_read_log.c | 24 +- storage/maria/test_ma_backup.c | 449 ++++ storage/maria/unittest/ma_test_recovery.pl | 23 +- storage/mroonga/ha_mroonga.cpp | 22 +- storage/mroonga/lib/mrn_condition_converter.cpp | 11 +- ...etime_64bit_strict_sql_mode_out_of_range.result | 2 +- storage/myisam/TODO | 7 - storage/myisam/mi_check.c | 4 + storage/myisam/mi_extra.c | 5 + storage/myisam/mi_locking.c | 6 +- storage/myisam/myisamdef.h | 1 + storage/perfschema/unittest/pfs_server_stubs.cc | 2 - storage/rocksdb/CMakeLists.txt | 4 +- storage/rocksdb/ha_rocksdb.cc | 1 - storage/rocksdb/myrocks_hotbackup | 686 ------ storage/rocksdb/myrocks_hotbackup.py | 685 ++++++ .../mysql-test/rocksdb/r/add_index_inplace.result | 12 + .../mysql-test/rocksdb/r/analyze_table.result | 6 + .../rocksdb/mysql-test/rocksdb/r/bulk_load.result | 3 + .../mysql-test/rocksdb/r/bulk_load_errors.result | 2 +- .../mysql-test/rocksdb/r/bulk_load_rev_cf.result | 3 + .../rocksdb/r/bulk_load_rev_cf_and_data.result | 3 + .../mysql-test/rocksdb/r/bulk_load_rev_data.result | 3 + .../mysql-test/rocksdb/r/bulk_load_unsorted.result | 3 + .../rocksdb/r/bulk_load_unsorted_rev.result | 3 + .../mysql-test/rocksdb/r/cardinality.result | 1 + .../mysql-test/rocksdb/r/col_opt_not_null.result | 4 +- .../mysql-test/rocksdb/r/col_opt_null.result | 4 +- .../mysql-test/rocksdb/r/drop_index_inplace.result | 2 + .../rocksdb/r/index_merge_rocksdb.result | 1 + storage/rocksdb/mysql-test/rocksdb/r/misc.result | 4 +- .../rocksdb/mysql-test/rocksdb/r/partition.result | 1 + .../mysql-test/rocksdb/r/records_in_range.result | 2 +- .../rocksdb/mysql-test/rocksdb/r/rocksdb.result | 14 +- .../rocksdb/r/rocksdb_cf_per_partition.result | 2 + .../mysql-test/rocksdb/r/rocksdb_range2.result | 3 +- .../rocksdb/mysql-test/rocksdb/r/statistics.result | 3 + .../rocksdb/mysql-test/rocksdb/r/type_bool.result | 4 +- .../mysql-test/rocksdb/r/type_decimal.result | 2 + .../mysql-test/rocksdb/r/type_varchar.result | 5 + storage/rocksdb/mysql-test/rocksdb/r/xa.result | 32 + storage/rocksdb/mysql-test/rocksdb/t/disabled.def | 1 + storage/rocksdb/mysql-test/rocksdb/t/xa-master.opt | 1 + storage/rocksdb/mysql-test/rocksdb/t/xa.test | 38 + .../mysql-test/rocksdb_rpl/r/mdev12179.result | 18 + .../mysql-test/rocksdb_rpl/t/mdev12179.test | 85 + storage/spider/ha_spider.cc | 199 +- storage/spider/ha_spider.h | 92 +- storage/spider/hs_client/hs_compat.h | 2 +- storage/spider/hs_client/hstcpcli.cpp | 25 +- storage/spider/hs_client/hstcpcli.hpp | 3 + .../checksum_table_with_quick_mode_3_deinit.inc | 15 + .../checksum_table_with_quick_mode_3_init.inc | 31 + .../spider/include/direct_join_using_deinit.inc | 9 + .../spider/include/direct_join_using_init.inc | 13 + .../spider/include/direct_left_join_deinit.inc | 9 + .../spider/include/direct_left_join_init.inc | 13 + .../include/direct_left_join_nullable_deinit.inc | 9 + .../include/direct_left_join_nullable_init.inc | 13 + .../direct_left_right_join_nullable_deinit.inc | 9 + .../direct_left_right_join_nullable_init.inc | 13 + ...direct_left_right_left_join_nullable_deinit.inc | 9 + .../direct_left_right_left_join_nullable_init.inc | 13 + .../spider/include/direct_right_join_deinit.inc | 9 + .../spider/include/direct_right_join_init.inc | 13 + .../include/direct_right_join_nullable_deinit.inc | 9 + .../include/direct_right_join_nullable_init.inc | 13 + .../direct_right_left_join_nullable_deinit.inc | 9 + .../direct_right_left_join_nullable_init.inc | 13 + ...irect_right_left_right_join_nullable_deinit.inc | 9 + .../direct_right_left_right_join_nullable_init.inc | 13 + .../spider/include/quick_mode_0_deinit.inc | 21 + .../spider/include/quick_mode_0_init.inc | 55 + .../spider/include/quick_mode_1_deinit.inc | 21 + .../spider/include/quick_mode_1_init.inc | 55 + .../spider/include/quick_mode_2_deinit.inc | 21 + .../spider/include/quick_mode_2_init.inc | 55 + .../spider/include/quick_mode_3_deinit.inc | 21 + .../spider/include/quick_mode_3_init.inc | 55 + .../spider/include/slave_trx_isolation_deinit.inc | 17 + .../spider/include/slave_trx_isolation_init.inc | 39 + .../r/checksum_table_with_quick_mode_3.result | 104 + .../mysql-test/spider/r/direct_join_using.result | 108 + .../mysql-test/spider/r/direct_left_join.result | 108 + .../spider/r/direct_left_join_nullable.result | 113 + .../r/direct_left_right_join_nullable.result | 113 + .../r/direct_left_right_left_join_nullable.result | 112 + .../mysql-test/spider/r/direct_right_join.result | 108 + .../spider/r/direct_right_join_nullable.result | 113 + .../r/direct_right_left_join_nullable.result | 112 + .../r/direct_right_left_right_join_nullable.result | 113 + .../spider/mysql-test/spider/r/quick_mode_0.result | 515 ++++ .../spider/mysql-test/spider/r/quick_mode_1.result | 515 ++++ .../spider/mysql-test/spider/r/quick_mode_2.result | 515 ++++ .../spider/mysql-test/spider/r/quick_mode_3.result | 515 ++++ .../mysql-test/spider/r/slave_trx_isolation.result | 110 + .../spider/t/checksum_table_with_quick_mode_3.test | 134 + .../mysql-test/spider/t/direct_join_using.test | 197 ++ .../mysql-test/spider/t/direct_left_join.test | 197 ++ .../spider/t/direct_left_join_nullable.test | 212 ++ .../spider/t/direct_left_right_join_nullable.test | 212 ++ .../t/direct_left_right_left_join_nullable.test | 212 ++ .../mysql-test/spider/t/direct_right_join.test | 197 ++ .../spider/t/direct_right_join_nullable.test | 212 ++ .../spider/t/direct_right_left_join_nullable.test | 212 ++ .../t/direct_right_left_right_join_nullable.test | 212 ++ .../spider/mysql-test/spider/t/quick_mode_0.test | 309 +++ .../spider/mysql-test/spider/t/quick_mode_1.test | 309 +++ .../spider/mysql-test/spider/t/quick_mode_2.test | 309 +++ .../spider/mysql-test/spider/t/quick_mode_3.test | 309 +++ .../mysql-test/spider/t/slave_trx_isolation.test | 166 ++ storage/spider/scripts/install_spider.sql | 93 +- storage/spider/spd_conn.cc | 10 +- storage/spider/spd_conn.h | 4 +- storage/spider/spd_copy_tables.cc | 45 +- storage/spider/spd_db_conn.cc | 547 ++-- storage/spider/spd_db_conn.h | 27 +- storage/spider/spd_db_handlersocket.cc | 125 +- storage/spider/spd_db_handlersocket.h | 9 +- storage/spider/spd_db_include.h | 12 +- storage/spider/spd_db_mysql.cc | 939 +++++-- storage/spider/spd_db_mysql.h | 45 +- storage/spider/spd_db_oracle.cc | 301 ++- storage/spider/spd_db_oracle.h | 11 +- storage/spider/spd_direct_sql.cc | 79 +- storage/spider/spd_environ.h | 15 +- storage/spider/spd_group_by_handler.cc | 67 +- storage/spider/spd_i_s.cc | 4 +- storage/spider/spd_include.h | 86 +- storage/spider/spd_param.cc | 81 +- storage/spider/spd_param.h | 10 +- storage/spider/spd_ping_table.cc | 2 +- storage/spider/spd_sys_table.cc | 169 +- storage/spider/spd_sys_table.h | 33 +- storage/spider/spd_table.cc | 59 +- storage/spider/spd_trx.cc | 38 +- storage/tokudb/CMakeLists.txt | 47 +- .../rpl/r/rpl_extra_col_master_tokudb.result | 2 +- .../mysql-test/rpl/r/rpl_tokudb_mixed_dml.result | 45 +- storage/tokudb/mysql-test/tokudb/disabled.def | 4 +- .../mysql-test/tokudb/r/card_add_drop.result | 2 + .../mysql-test/tokudb/r/card_add_index.result | 3 + .../mysql-test/tokudb/r/card_drop_index.result | 1 + .../mysql-test/tokudb/r/card_drop_index_2.result | 1 + .../tokudb/mysql-test/tokudb/r/card_drop_pk.result | 1 + .../tokudb/mysql-test/tokudb/r/card_no_keys.result | 1 + storage/tokudb/mysql-test/tokudb/r/card_pk.result | 1 + .../tokudb/mysql-test/tokudb/r/card_pk_2.result | 1 + .../tokudb/mysql-test/tokudb/r/card_pk_sk.result | 2 + .../mysql-test/tokudb/r/card_scale_percent.result | 1 + storage/tokudb/mysql-test/tokudb/r/card_sk.result | 1 + .../tokudb/mysql-test/tokudb/r/card_sk_2.result | 1 + .../mysql-test/tokudb/r/card_unique_sk.result | 1 + .../tokudb/mysql-test/tokudb/r/type_date.result | 6 +- .../mysql-test/tokudb/r/type_datetime.result | 4 +- .../tokudb/mysql-test/tokudb/r/type_decimal.result | 4 +- .../tokudb/mysql-test/tokudb/r/type_float.result | 2 +- .../mysql-test/tokudb/r/type_newdecimal.result | 2 +- .../mysql-test/tokudb/t/change_column_bin.py | 0 .../tokudb/t/change_column_bin_rename.py | 0 .../mysql-test/tokudb/t/change_column_char.py | 0 .../tokudb/t/change_column_char_binary.py | 0 .../tokudb/t/change_column_char_charbinary.py | 0 .../tokudb/t/change_column_char_rename.py | 0 .../mysql-test/tokudb/t/change_column_int.py | 0 .../mysql-test/tokudb/t/change_column_int_key.py | 0 .../tokudb/t/change_column_int_not_supported.py | 0 .../tokudb/t/change_column_int_rename.py | 0 .../tokudb_bugs/r/db756_card_part_hash.result | 1 + .../tokudb_bugs/r/db756_card_part_hash_1.result | 1 + .../r/db756_card_part_hash_1_pick.result | 1 + .../tokudb_bugs/r/db756_card_part_hash_2.result | 1 + .../r/db756_card_part_hash_2_pick.result | 1 + .../tokudb_bugs/r/db757_part_alter_analyze.result | 6 +- .../r/partition_alter1_1_2_tokudb.result | 56 + .../r/partition_alter1_1_tokudb.result | 32 + .../r/partition_alter1_2_tokudb.result | 80 + .../r/partition_alter2_1_1_tokudb.result | 40 + .../r/partition_alter2_1_2_tokudb.result | 40 + .../r/partition_alter2_2_1_tokudb.result | 40 + .../r/partition_alter2_2_2_tokudb.result | 40 + .../tokudb_parts/r/partition_alter4_tokudb.result | 216 ++ .../tokudb_parts/r/partition_basic_tokudb.result | 64 + .../tokudb_parts/r/partition_debug_tokudb.result | 262 ++ .../tokudb_parts/r/partition_engine_tokudb.result | 11 + .../tokudb_parts/r/partition_mgm_lc0_tokudb.result | 1 + .../r/partition_mgm_lc10_tokudb.result | 1 + .../tokudb_parts/r/partition_mgm_lc1_tokudb.result | 1 + .../mysql-test/tokudb_rpl/r/mdev12179.result | 18 + .../tokudb/mysql-test/tokudb_rpl/t/mdev12179.test | 85 + storage/tokudb/tokudb_sysvars.cc | 4 +- strings/json_lib.c | 252 +- support-files/compiler_warnings.supp | 1 - support-files/policy/apparmor/usr.sbin.mysqld | 3 +- support-files/policy/selinux/mariadb-server.fc | 2 +- support-files/policy/selinux/mariadb-server.te | 4 +- tests/mysql_client_test.c | 62 +- unittest/mysys/lf-t.c | 5 - unittest/mysys/my_atomic-t.c | 17 +- unittest/mysys/thr_template.c | 31 +- unittest/mysys/waiting_threads-t.c | 4 +- unittest/sql/mf_iocache-t.cc | 2 +- unittest/strings/CMakeLists.txt | 2 +- unittest/strings/json-t.c | 82 + vio/docs/TODO | 3 - win/upgrade_wizard/upgradeDlg.cpp | 27 +- wsrep-lib | 1 + wsrep/CMakeLists.txt | 26 - wsrep/wsrep_api.h | 1117 --------- wsrep/wsrep_dummy.c | 413 ---- wsrep/wsrep_gtid.c | 74 - wsrep/wsrep_loader.c | 226 -- wsrep/wsrep_uuid.c | 83 - 2416 files changed, 89421 insertions(+), 41458 deletions(-) diff --cc mysql-test/main/derived_cond_pushdown.result index c73fb80,36a44ce..473415a --- a/mysql-test/main/derived_cond_pushdown.result +++ b/mysql-test/main/derived_cond_pushdown.result @@@ -14981,11 -15076,11 +15076,11 @@@ from t1 joi on t1.a=t.a where t1.b <= 5; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL idx_b NULL NULL NULL 12 75.00 Using where +1 PRIMARY t1 ALL idx_b NULL NULL NULL 12 83.33 Using where - 1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 9 100.00 - 2 DERIVED t2 ALL idx_a NULL NULL NULL 90 100.00 Using temporary; Using filesort + 1 PRIMARY <derived2> ref key0 key0 5 test.t1.a 2 100.00 + 2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 1 100.00 Warnings: - Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`s` AS `s`,`t`.`m` AS `m` from `test`.`t1` join (/* select#2 */ select `test`.`t2`.`a` AS `a`,sum(`test`.`t2`.`b`) AS `s`,min(`test`.`t2`.`b`) AS `m` from `test`.`t2` group by `test`.`t2`.`a`) `t` where `t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` <= 5 + Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`s` AS `s`,`t`.`m` AS `m` from `test`.`t1` join (/* select#2 */ select `test`.`t2`.`a` AS `a`,sum(`test`.`t2`.`b`) AS `s`,min(`test`.`t2`.`b`) AS `m` from `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` group by `test`.`t2`.`a`) `t` where `t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` <= 5 explain format=json select t1.a,t.s,t.m from t1 join (select a, sum(t2.b) as s, min(t2.b) as m from t2 group by t2.a) t diff --cc mysql-test/main/func_group_innodb.result index 5be46ed,141d7cc..a4c9b57 --- a/mysql-test/main/func_group_innodb.result +++ b/mysql-test/main/func_group_innodb.result @@@ -251,9 -244,30 +251,33 @@@ MIN(c 0 EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b; id select_type table type possible_keys key key_len ref rows Extra - 1 SIMPLE t1 range NULL b 263 NULL 3 Using index for group-by + 1 SIMPLE t1 range NULL b 263 NULL 2 Using index for group-by DROP TABLE t1; + # + # MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field + # + CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2), + KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC; + INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go'); + explain + SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; + id select_type table type possible_keys key key_len ref rows Extra + 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away + SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; + MIN(t1.v1) + king + drop table t1; + CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; + INSERT INTO t1 VALUES ('king'), ('bad'); + explain + SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; + id select_type table type possible_keys key key_len ref rows Extra + 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row + SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; + MIN(x.v1) + NULL + drop table t1; End of 5.5 tests +set global innodb_stats_persistent= @innodb_stats_persistent_save; +set global innodb_stats_persistent_sample_pages= +@innodb_stats_persistent_sample_pages_save; diff --cc mysql-test/main/func_group_innodb.test index 0aa657b,c4914b9..6141b4d --- a/mysql-test/main/func_group_innodb.test +++ b/mysql-test/main/func_group_innodb.test @@@ -201,8 -192,23 +201,27 @@@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY DROP TABLE t1; + --echo # + --echo # MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field + --echo # + + CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2), + KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC; + INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go'); + explain + SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; + SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; + drop table t1; + + CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; + INSERT INTO t1 VALUES ('king'), ('bad'); + explain + SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; + SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; + drop table t1; + --echo End of 5.5 tests + +set global innodb_stats_persistent= @innodb_stats_persistent_save; +set global innodb_stats_persistent_sample_pages= + @innodb_stats_persistent_sample_pages_save; diff --cc mysql-test/main/group_min_max.result index 4667c4b,a8e0762..7a49dbd --- a/mysql-test/main/group_min_max.result +++ b/mysql-test/main/group_min_max.result @@@ -2075,19 -2078,19 +2078,19 @@@ id select_type table type possible_key explain extended select a1,a2,min(b),max(b) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2; id select_type table type possible_keys key key_len ref rows filtered Extra - 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 77 85.71 Using where; Using index -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 100.00 Using where; Using index ++1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 77 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`c` > 'a111' group by `test`.`t1`.`a1`,`test`.`t1`.`a2` explain extended select a1,a2,b,min(c),max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows filtered Extra - 1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 51.56 Using where; Using temporary; Using filesort -1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 39.58 Using where; Using temporary; Using filesort ++1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 40.10 Using where; Using temporary; Using filesort Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`d` > 'xy2' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` explain extended select a1,a2,b,c from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b,c; id select_type table type possible_keys key key_len ref rows filtered Extra - 1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 51.56 Using where; Using temporary; Using filesort -1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 39.58 Using where; Using temporary; Using filesort ++1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 40.10 Using where; Using temporary; Using filesort Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`d` > 'xy2' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c` explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b < 'b') group by a1; @@@ -2095,7 -2098,7 +2098,7 @@@ id select_type table type possible_key 1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index explain extended select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows filtered Extra - 1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 77 85.71 Using where; Using index -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 100.00 Using where; Using index ++1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 77 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`c` > 'a111' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` explain select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1; @@@ -2281,15 -2284,9 +2284,16 @@@ INSERT INTO t1 (a) VALUE (''), ('CENTRAL'), ('EASTERN'), ('GREATER LONDON'), ('NORTH CENTRAL'), ('NORTH EAST'), ('NORTH WEST'), ('SCOTLAND'), ('SOUTH EAST'), ('SOUTH WEST'), ('WESTERN'); +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK EXPLAIN SELECT DISTINCT a,a FROM t1 ORDER BY a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 66 NULL 6 Using index for group-by +1 SIMPLE t1 range NULL a 66 NULL 12 Using index for group-by SELECT DISTINCT a,a FROM t1 ORDER BY a; a a @@@ -2348,15 -2345,10 +2352,16 @@@ id2 id3 id5 id4 id3 id6 id5 id 1 1 1 1 1 1 1 1 DROP TABLE t1,t2,t3,t4,t5,t6; CREATE TABLE t1 (a int, b int, KEY (a,b), KEY b (b)); -INSERT INTO t1 VALUES (1,1),(1,2),(1,0),(1,3); +INSERT INTO t1 VALUES +(1,1),(1,2),(1,0),(1,3), +(1,-1),(1,-2),(1,-3),(1,-4); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK explain SELECT MAX(b), a FROM t1 WHERE b < 2 AND a = 1 GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range a,b a 10 NULL 1 Using where; Using index for group-by +1 SIMPLE t1 range a,b a 10 NULL 2 Using where; Using index for group-by SELECT MAX(b), a FROM t1 WHERE b < 2 AND a = 1 GROUP BY a; MAX(b) a 1 1 @@@ -2375,12 -2367,9 +2380,13 @@@ DROP TABLE t1,t2 CREATE TABLE t1 (a INT, b INT, INDEX (a,b)); INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5), (2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK EXPLAIN SELECT max(b), a FROM t1 GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra - 1 SIMPLE t1 range NULL a 5 NULL 4 Using index for group-by -1 SIMPLE t1 range NULL a 5 NULL 8 Using index for group-by ++1 SIMPLE t1 index NULL a 10 NULL 15 Using index FLUSH STATUS; SELECT max(b), a FROM t1 GROUP BY a; max(b) a @@@ -2390,18 -2379,18 +2396,18 @@@ 6 4 SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value --Handler_read_key 8 --Handler_read_next 0 ++Handler_read_key 0 ++Handler_read_next 15 Handler_read_retry 0 EXPLAIN SELECT max(b), a FROM t1 GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra - 1 SIMPLE t1 range NULL a 5 NULL 4 Using index for group-by -1 SIMPLE t1 range NULL a 5 NULL 8 Using index for group-by ++1 SIMPLE t1 index NULL a 10 NULL 15 Using index FLUSH STATUS; CREATE TABLE t2 SELECT max(b), a FROM t1 GROUP BY a; SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value --Handler_read_key 8 --Handler_read_next 0 ++Handler_read_key 0 ++Handler_read_next 15 Handler_read_retry 0 FLUSH STATUS; SELECT * FROM (SELECT max(b), a FROM t1 GROUP BY a) b; @@@ -2412,8 -2401,8 +2418,8 @@@ max(b) 6 4 SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value --Handler_read_key 8 --Handler_read_next 0 ++Handler_read_key 0 ++Handler_read_next 15 Handler_read_retry 0 FLUSH STATUS; (SELECT max(b), a FROM t1 GROUP BY a) UNION @@@ -2425,20 -2414,20 +2431,20 @@@ max(b) 6 4 SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value --Handler_read_key 16 --Handler_read_next 0 ++Handler_read_key 0 ++Handler_read_next 30 Handler_read_retry 0 EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION (SELECT max(b), a FROM t1 GROUP BY a); id select_type table type possible_keys key key_len ref rows Extra - 1 PRIMARY t1 range NULL a 5 NULL 4 Using index for group-by - 2 UNION t1 range NULL a 5 NULL 4 Using index for group-by -1 PRIMARY t1 range NULL a 5 NULL 8 Using index for group-by -2 UNION t1 range NULL a 5 NULL 8 Using index for group-by ++1 PRIMARY t1 index NULL a 10 NULL 15 Using index ++2 UNION t1 index NULL a 10 NULL 15 Using index NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL EXPLAIN SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x FROM t1 AS t1_outer; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index - 2 SUBQUERY t1 range NULL a 5 NULL 4 Using index for group-by -2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by ++2 SUBQUERY t1 index NULL a 10 NULL 15 Using index EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE EXISTS (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2); id select_type table type possible_keys key key_len ref rows Extra @@@ -2448,38 -2437,38 +2454,38 @@@ EXPLAIN SELECT 1 FROM t1 AS t1_outer WH (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) > 12; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE - 2 SUBQUERY t1 range NULL a 5 NULL 4 Using index for group-by -2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by ++2 SUBQUERY t1 index NULL a 10 NULL 15 Using index EXPLAIN SELECT 1 FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2); id select_type table type possible_keys key key_len ref rows Extra - 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 4 - 1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 4 Using index - 2 MATERIALIZED t1 range NULL a 5 NULL 4 Using index for group-by -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 8 -1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 2 Using index -2 MATERIALIZED t1 range NULL a 5 NULL 8 Using index for group-by ++1 PRIMARY t1_outer index a a 10 NULL 15 Using where; Using index ++1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 test.t1_outer.a 1 ++2 MATERIALIZED t1 index NULL a 10 NULL 15 Using index EXPLAIN SELECT 1 FROM t1 AS t1_outer GROUP BY a HAVING a > (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2); id select_type table type possible_keys key key_len ref rows Extra - 1 PRIMARY t1_outer range NULL a 5 NULL 4 Using index for group-by - 2 SUBQUERY t1 range NULL a 5 NULL 4 Using index for group-by -1 PRIMARY t1_outer range NULL a 5 NULL 8 Using index for group-by -2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by ++1 PRIMARY t1_outer index NULL a 10 NULL 15 Using index ++2 SUBQUERY t1 index NULL a 10 NULL 15 Using index EXPLAIN SELECT 1 FROM t1 AS t1_outer1 JOIN t1 AS t1_outer2 ON t1_outer1.a = (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) AND t1_outer1.b = t1_outer2.b; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1_outer1 ref a a 5 const 1 Using where; Using index 1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using where; Using index; Using join buffer (flat, BNL join) - 2 SUBQUERY t1 range NULL a 5 NULL 4 Using index for group-by -2 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by ++2 SUBQUERY t1 index NULL a 10 NULL 15 Using index EXPLAIN SELECT (SELECT (SELECT max(b) FROM t1 GROUP BY a HAVING a < 2) x FROM t1 AS t1_outer) x2 FROM t1 AS t1_outer2; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1_outer2 index NULL a 10 NULL 15 Using index 2 SUBQUERY t1_outer index NULL a 10 NULL 15 Using index - 3 SUBQUERY t1 range NULL a 5 NULL 4 Using index for group-by -3 SUBQUERY t1 range NULL a 5 NULL 8 Using index for group-by ++3 SUBQUERY t1 index NULL a 10 NULL 15 Using index CREATE TABLE t3 LIKE t1; FLUSH STATUS; INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a; SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value - Handler_read_key 8 -Handler_read_key 13 --Handler_read_next 0 ++Handler_read_key 5 ++Handler_read_next 15 Handler_read_retry 0 DELETE FROM t3; FLUSH STATUS; @@@ -2487,15 -2476,15 +2493,15 @@@ INSERT INTO t3 SELECT 1, (SELECT MAX(b FROM t1 LIMIT 1; SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value --Handler_read_key 8 --Handler_read_next 0 ++Handler_read_key 0 ++Handler_read_next 15 Handler_read_retry 0 FLUSH STATUS; DELETE FROM t3 WHERE (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) > 10000; SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value --Handler_read_key 8 --Handler_read_next 0 ++Handler_read_key 0 ++Handler_read_next 15 Handler_read_retry 0 FLUSH STATUS; DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x @@@ -2503,20 -2492,17 +2509,21 @@@ FROM t1) > 10000 ERROR 21000: Subquery returns more than 1 row SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value --Handler_read_key 8 --Handler_read_next 1 ++Handler_read_key 0 ++Handler_read_next 16 Handler_read_retry 0 DROP TABLE t1,t2,t3; CREATE TABLE t1 (a int, INDEX idx(a)); INSERT INTO t1 VALUES (4), (2), (1), (2), (4), (2), (1), (4), (4), (2), (1), (2), (2), (4), (1), (4); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK EXPLAIN SELECT DISTINCT(a) FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL idx 5 NULL 9 Using index for group-by +1 SIMPLE t1 range NULL idx 5 NULL 4 Using index for group-by SELECT DISTINCT(a) FROM t1; a 1 @@@ -2532,12 -2518,9 +2539,13 @@@ 4 DROP TABLE t1; CREATE TABLE t1 (a INT, b INT); -INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3); +INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5); INSERT INTO t1 SELECT a + 1, b FROM t1; INSERT INTO t1 SELECT a + 2, b FROM t1; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK EXPLAIN SELECT a, MIN(b), MAX(b) FROM t1 GROUP BY a ORDER BY a DESC; id select_type table type possible_keys key key_len ref rows Extra @@@ -2664,12 -2647,9 +2672,13 @@@ INSERT INTO t1 VALUES (1, 1, 1, 1), (1 INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT a,b,c+1,d FROM t1; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK EXPLAIN SELECT DISTINCT c FROM t1 WHERE d=4; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL foo 10 NULL 9 Using where; Using index for group-by +1 SIMPLE t1 range NULL foo 10 NULL 3 Using where; Using index for group-by SELECT DISTINCT c FROM t1 WHERE d=4; c 1 @@@ -2683,9 -2663,6 +2692,10 @@@ CREATE TABLE t (a INT, b INT, INDEX (a, INSERT INTO t VALUES (2,0), (2,0), (2,1), (2,1); INSERT INTO t SELECT * FROM t; INSERT INTO t SELECT * FROM t; +ANALYZE TABLE t; +Table Op Msg_type Msg_text ++test.t analyze status Engine-independent statistics collected +test.t analyze status OK # test MIN #should use range with index for group by EXPLAIN @@@ -2712,7 -2689,7 +2722,7 @@@ INSERT INTO t SELECT a, 2 FROM t EXPLAIN SELECT a, MAX(b) FROM t WHERE b > 0 AND b < 2 GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra - 1 SIMPLE t range NULL a 10 NULL 3 Using where; Using index for group-by -1 SIMPLE t range NULL a 10 NULL 9 Using where; Using index for group-by ++1 SIMPLE t range NULL a 10 NULL 2 Using where; Using index for group-by #should return 1 row SELECT a, MAX(b) FROM t WHERE b > 0 AND b < 2 GROUP BY a; a MAX(b) @@@ -3321,10 -3299,6 +3332,12 @@@ INSERT INTO t1 VALUES (0,99),(9,99),(4, INSERT INTO t1 VALUES (0,99),(9,99),(4,0),(7,0),(99,0),(7,0),(8,0),(99,0),(1,0); CREATE TABLE t2 (c int) ; INSERT INTO t2 VALUES (0),(1); +ANALYZE TABLE t1,t2; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK ++test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK EXPLAIN SELECT MIN(a), b FROM t1 WHERE a > 0 GROUP BY b; id select_type table type possible_keys key key_len ref rows Extra @@@ -3360,28 -3334,16 +3373,30 @@@ End of 5.3 test # CREATE TABLE t1 (a INT, b INT, c INT, KEY (a,b)); INSERT INTO t1 VALUES (1,1,1), (1,2,1), (1,3,1), (1,4,1); +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT a, b + 4, 1 FROM t1; +INSERT INTO t1 SELECT a, b + 8, 1 FROM t1; INSERT INTO t1 SELECT a + 1, b, 1 FROM t1; CREATE TABLE t2 (a INT, b INT, c INT, d INT, e INT, f INT, KEY (a,b,c)); -INSERT INTO t2 VALUES (1,1,1,1,1,1), (1,2,1,1,1,1), (1,3,1,1,1,1), -(1,4,1,1,1,1); +INSERT INTO t2 VALUES +(1,1,1,1,1,1), (1,2,1,1,1,1), (1,3,1,1,1,1), (1,4,1,1,1,1); +INSERT INTO t2 SELECT * FROM t2; +INSERT INTO t2 SELECT * FROM t2; +INSERT INTO t2 SELECT * FROM t2; +INSERT INTO t2 SELECT * FROM t2; INSERT INTO t2 SELECT a, b + 4, c,d,e,f FROM t2; INSERT INTO t2 SELECT a + 1, b, c,d,e,f FROM t2; +ANALYZE TABLE t1,t2; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK ++test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK EXPLAIN SELECT COUNT(DISTINCT a) FROM t1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL a 5 NULL 9 Using index for group-by +1 SIMPLE t1 range NULL a 5 NULL 3 Using index for group-by SELECT COUNT(DISTINCT a) FROM t1; COUNT(DISTINCT a) 2 @@@ -3731,12 -3687,8 +3747,13 @@@ b drop table faulty; CREATE TABLE t1 (a INT, b INT); INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3); +INSERT INTO t1 SELECT * FROM t1; INSERT INTO t1 SELECT a + 1, b FROM t1; INSERT INTO t1 SELECT a + 2, b FROM t1; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK CREATE INDEX break_it ON t1 (a, b); EXPLAIN SELECT distinct a, b FROM t1 where a = '3' ORDER BY b; @@@ -3792,28 -3744,24 +3809,29 @@@ DROP TABLE t1 CREATE TABLE t1 (a INT, b INT,c INT DEFAULT 0, INDEX (a,b)); INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5), (2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6); +INSERT INTO t1 SELECT * FROM t1; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; set @save_use_stat_tables= @@use_stat_tables; set @@optimizer_use_condition_selectivity=4; set @@use_stat_tables=PREFERABLY; explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a); id select_type table type possible_keys key key_len ref rows filtered Extra - 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 4 100.00 - 1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 8 100.00 Using index - 2 MATERIALIZED t1 range NULL a 5 NULL 4 100.00 Using index for group-by -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 8 100.00 -1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 2 100.00 Using index -2 MATERIALIZED t1 range NULL a 5 NULL 8 100.00 Using index for group-by ++1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5 100.00 ++1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 7 100.00 Using index ++2 MATERIALIZED t1 range NULL a 5 NULL 5 100.00 Using index for group-by Warnings: Note 1003 /* select#1 */ select `test`.`t1_outer`.`a` AS `a` from <materialize> (/* select#2 */ select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where `test`.`t1_outer`.`a` = `<subquery2>`.`max(b)` set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set @@use_stat_tables=@save_use_stat_tables; explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a); id select_type table type possible_keys key key_len ref rows filtered Extra - 1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 4 100.00 - 1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 8 100.00 Using index - 2 MATERIALIZED t1 range NULL a 5 NULL 4 100.00 Using index for group-by -1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 8 100.00 -1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 2 100.00 Using index -2 MATERIALIZED t1 range NULL a 5 NULL 8 100.00 Using index for group-by ++1 PRIMARY <subquery2> ALL distinct_key NULL NULL NULL 5 100.00 ++1 PRIMARY t1_outer ref a a 5 <subquery2>.max(b) 7 100.00 Using index ++2 MATERIALIZED t1 range NULL a 5 NULL 5 100.00 Using index for group-by Warnings: Note 1003 /* select#1 */ select `test`.`t1_outer`.`a` AS `a` from <materialize> (/* select#2 */ select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where `test`.`t1_outer`.`a` = `<subquery2>`.`max(b)` drop table t1; @@@ -3843,18 -3791,15 +3861,19 @@@ INSERT INTO t1 VALUES (4,'2001-01-01') INSERT INTO t1 VALUES (4,'2001-01-02'); INSERT INTO t1 VALUES (4,'2001-01-03'); INSERT INTO t1 VALUES (4,'2001-01-04'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='2001-01-04' GROUP BY id; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL id 8 NULL 9 Using where; Using index for group-by +1 SIMPLE t1 range NULL id 8 NULL 5 Using where; Using index for group-by EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104.0 GROUP BY id; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL id 8 NULL 9 Using where; Using index for group-by +1 SIMPLE t1 range NULL id 8 NULL 5 Using where; Using index for group-by EXPLAIN SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=20010104e0 GROUP BY id; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL id 8 NULL 9 Using where; Using index for group-by +1 SIMPLE t1 range NULL id 8 NULL 5 Using where; Using index for group-by SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>='2001-01-04' GROUP BY id; id MIN(a) MAX(a) 1 2001-01-04 2001-01-04 @@@ -3895,11 -3840,6 +3914,12 @@@ INSERT INTO t1 VALUES (4,'2001-01-01') INSERT INTO t1 VALUES (4,'2001-01-02'); INSERT INTO t1 VALUES (4,'2001-01-03'); INSERT INTO t1 VALUES (4,' 2001-01-04'); +INSERT INTO t1 SELECT * FROM t1; +INSERT INTO t1 SELECT * FROM t1; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK SELECT id,MIN(a),MAX(a) FROM t1 WHERE a BETWEEN ' 2001-01-04' AND '2001-01-05' GROUP BY id; id MIN(a) MAX(a) 1 2001-01-04 2001-01-03 diff --cc mysql-test/main/index_merge_myisam.result index 8e83bdf,0438d0e..77d6ae2 --- a/mysql-test/main/index_merge_myisam.result +++ b/mysql-test/main/index_merge_myisam.result @@@ -19,15 -18,16 +19,16 @@@ alter table t0 add key8 int not null, a update t0 set key2=key1,key3=key1,key4=key1,key5=key1,key6=key1,key7=key1,key8=1024-key1; analyze table t0; Table Op Msg_type Msg_text + test.t0 analyze status Engine-independent statistics collected test.t0 analyze status OK -explain select * from t0 where key1 < 3 or key1 > 1020; +explain select * from t0 where key1 < 3 or key1 > 920 and key1 < 924; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 range i1 i1 4 NULL 78 Using index condition; Using where +1 SIMPLE t0 range i1 i1 4 NULL 5 Using index condition; Using where explain -select * from t0 where key1 < 3 or key2 > 1020; +select * from t0 where key1 < 3 or key2 > 920 and key2 < 924; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 45 Using sort_union(i1,i2); Using where -select * from t0 where key1 < 3 or key2 > 1020; +1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL 5 Using sort_union(i1,i2); Using where +select * from t0 where key1 < 3 or key2 > 920 and key2 < 924; key1 key2 key3 key4 key5 key6 key7 key8 1 1 1 1 1 1 1 1023 2 2 2 2 2 2 2 1022 diff --cc mysql-test/main/innodb_icp.result index c65e4d1,00ca6b1..07d3179 --- a/mysql-test/main/innodb_icp.result +++ b/mysql-test/main/innodb_icp.result @@@ -595,10 -590,6 +595,12 @@@ i1 INTEGER NOT NULL PRIMARY KEY (pk) ); INSERT INTO t2 VALUES (4,1); +ANALYZE TABLE t1,t2; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK ++test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK EXPLAIN SELECT t1.d1, t2.pk, t2.i1 FROM t1 STRAIGHT_JOIN t2 ON t2.i1 WHERE t2.pk <> t1.d1 AND t2.pk = 4; @@@ -804,10 -795,6 +806,12 @@@ INSERT INTO t2 (g,h) VALUE (0,'p'),(0,'f'),(0,'p'),(7,'d'),(7,'f'),(5,'j'), (3,'e'),(1,'u'),(4,'v'),(9,'u'),(6,'i'),(1,'x'), (7,'f'),(5,'j'),(3,'e'),(1,'u'),(4,'v'),(9,'u'); +ANALYZE TABLE t1,t2; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK ++test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK SET @save_optimize_switch=@@optimizer_switch; SET optimizer_switch='materialization=on'; EXPLAIN @@@ -817,7 -804,7 +821,7 @@@ AND (EXISTS (SELECT * FROM t1, t2 WHER OR a = 0 AND h < 'z' ); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t ALL PRIMARY,c NULL NULL NULL 64 Using where --1 PRIMARY t2 ref g g 5 test.t.c 9 Using where ++1 PRIMARY t2 ref g g 5 test.t.c 18 Using where 2 DEPENDENT SUBQUERY t1 index PRIMARY d 3 NULL 64 Using where; Using index 2 DEPENDENT SUBQUERY t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using where SELECT COUNT(*) FROM t1 AS t, t2 diff --cc mysql-test/main/myisam_explain_non_select_all.result index 939d6c4,d238b0d..bfc8370 --- a/mysql-test/main/myisam_explain_non_select_all.result +++ b/mysql-test/main/myisam_explain_non_select_all.result @@@ -701,9 -740,10 +740,10 @@@ FLUSH STATUS FLUSH TABLES; EXPLAIN EXTENDED DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 100.00 Using where +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE # Status of EXPLAIN EXTENDED query Variable_name Value + Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE t1.a > 0 ORDER BY t1.a; @@@ -721,8 -763,9 +763,9 @@@ Handler_read_key Handler_read_rnd_next 1 # Status of testing query execution: Variable_name Value -Handler_read_key 4 ++Handler_read_key 3 -INSERT INTO t1 VALUES (1), (2), (3); +INSERT INTO t1 VALUES (1), (2), (3), (-1), (-2), (-3); # # query: DELETE FROM t1 WHERE t1.a > 0 ORDER BY t1.a # select: SELECT * FROM t1 WHERE t1.a > 0 ORDER BY t1.a diff --cc mysql-test/main/mysqld--help.result index 68ed55c,d621c5c..528ee68 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@@ -1548,8 -1562,8 +1565,8 @@@ old-style-user-limits FALS optimizer-prune-level 1 optimizer-search-depth 62 optimizer-selectivity-sampling-limit 100 -optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on +optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on - optimizer-use-condition-selectivity 1 + optimizer-use-condition-selectivity 4 performance-schema FALSE performance-schema-accounts-size -1 performance-schema-consumer-events-stages-current FALSE diff --cc mysql-test/main/partition_innodb.result index 46353c6,e91d376..ed79bbb --- a/mysql-test/main/partition_innodb.result +++ b/mysql-test/main/partition_innodb.result @@@ -29,11 -24,9 +29,12 @@@ INSERT INTO t1 VALUES (0, 'Mod Zero'), (20, '0'), (21, '1'), (22, '2'), (23, '3'), (4, '4'), (5, '5'), (6, '6'), (7, '7'), (8, '8'), (9, '9'); INSERT INTO t1 SELECT a + 30, b FROM t1 WHERE a >= 0; +INSERT INTO t1 SELECT a + 60, b FROM t1 WHERE a >= 0; +INSERT INTO t1 SELECT a + 120, b FROM t1 WHERE a >= 0; +INSERT INTO t1 SELECT a + 240, b FROM t1 WHERE a >= 0; ANALYZE TABLE t1; Table Op Msg_type Msg_text + test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100; id select_type table type possible_keys key key_len ref rows Extra @@@ -935,6 -955,37 +965,40 @@@ test_jfg test_jfg1 test_jfg test_jfg12#P#p1000 test_jfg test_jfg12#P#pmax DROP DATABASE test_jfg; +set global innodb_stats_persistent= @innodb_stats_persistent_save; +set global innodb_stats_persistent_sample_pages= +@innodb_stats_persistent_sample_pages_save; + create table t1 (a int) engine=innodb; + create table t2 ( + b int, + c int, + d bit not null default 0, + v bit as (d) virtual, + key (b,v) + ) engine=innodb partition by hash (b); + insert into t1 values (1),(2); + insert into t2 (b,c,d) values (1,1,0),(2,2,0); + explain select t1.* from t1 join t2 on (v = a); + id select_type table type possible_keys key key_len ref rows Extra + 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 + 1 SIMPLE t2 index NULL b 7 NULL 2 Using where; Using index; Using join buffer (flat, BNL join) + select t1.* from t1 join t2 on (v = a); + a + drop table t1, t2; + # + # End of 10.2 tests + # + # + # MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end() + # + CREATE TABLE t1 (pk INT PRIMARY KEY, x INT, y INT, z INT, KEY (x), KEY (y, z)) + WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT); + INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL); + SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL; + COUNT(*) + 2 + DROP TABLE t1; + # + # End of 10.3 tests + # diff --cc mysql-test/main/partition_innodb.test index a8bbb7c,57d644d..e09a2b4 --- a/mysql-test/main/partition_innodb.test +++ b/mysql-test/main/partition_innodb.test @@@ -1028,6 -1048,37 +1060,40 @@@ database_name = 'test_jfg' DROP DATABASE test_jfg; +set global innodb_stats_persistent= @innodb_stats_persistent_save; +set global innodb_stats_persistent_sample_pages= + @innodb_stats_persistent_sample_pages_save; + # + # MDEV-17755 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed in Field_bit::val_int upon SELECT with JOIN, partitions, indexed virtual column + # + create table t1 (a int) engine=innodb; + create table t2 ( + b int, + c int, + d bit not null default 0, + v bit as (d) virtual, + key (b,v) + ) engine=innodb partition by hash (b); + insert into t1 values (1),(2); + insert into t2 (b,c,d) values (1,1,0),(2,2,0); + explain select t1.* from t1 join t2 on (v = a); + select t1.* from t1 join t2 on (v = a); + drop table t1, t2; + + --echo # + --echo # End of 10.2 tests + --echo # + + --echo # + --echo # MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end() + --echo # + CREATE TABLE t1 (pk INT PRIMARY KEY, x INT, y INT, z INT, KEY (x), KEY (y, z)) + WITH SYSTEM VERSIONING + PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT); + INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL); + SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL; + DROP TABLE t1; + + --echo # + --echo # End of 10.3 tests + --echo # diff --cc mysql-test/main/range.result index 83237a9,2c2f7be..8bef87d --- a/mysql-test/main/range.result +++ b/mysql-test/main/range.result @@@ -2529,7 -2477,7 +2533,7 @@@ EXPLAI "key_length": "5", "used_key_parts": ["d"], "rows": 3, - "filtered": 100, - "filtered": 55, ++ "filtered": 60, "index_condition": "t2.d is not null", "attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((2,2)))" }, @@@ -2585,8 -2533,8 +2589,8 @@@ insert into t2 value explain select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1; id select_type table type possible_keys key key_len ref rows Extra - 1 SIMPLE t1 range idx idx 5 NULL 6 Using index condition - 1 SIMPLE t2 ref|filter idx1,idx2 idx1|idx2 5|5 test.t1.a 12 (14%) Using where; Using filter -1 SIMPLE t2 range idx1,idx2 idx1 5 NULL 8 Using index condition; Using where ++1 SIMPLE t2 range|filter idx1,idx2 idx1|idx2 5|5 NULL 8 (14%) Using index condition; Using where; Using filter + 1 SIMPLE t1 ref idx idx 5 test.t2.d 8 explain format=json select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1; EXPLAIN @@@ -2611,18 -2548,21 +2604,29 @@@ "key": "idx1", "key_length": "5", "used_key_parts": ["d"], - "ref": ["test.t1.a"], + "rowid_filter": { + "range": { + "key": "idx2", + "used_key_parts": ["e"] + }, + "rows": 15, + "selectivity_pct": 14.423 + }, - "rows": 12, - "filtered": 100, - "attached_condition": "(t1.a,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1" + "rows": 8, - "filtered": 12.5, ++ "filtered": 14.423, + "index_condition": "t2.d is not null", + "attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1" + }, + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["idx"], + "key": "idx", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.d"], + "rows": 8, + "filtered": 100 } } } @@@ -2702,21 -2642,12 +2706,21 @@@ EXPLAI "table_name": "t2", "access_type": "range", "possible_keys": ["idx1", "idx2"], - "key": "idx2", + "key": "idx1", "key_length": "5", - "used_key_parts": ["e"], - "rows": 6, + "used_key_parts": ["d"], + "rowid_filter": { + "range": { + "key": "idx2", + "used_key_parts": ["e"] + }, + "rows": 7, + "selectivity_pct": 6.7308 + }, + "rows": 7, - "filtered": 100, + "filtered": 6.7308, - "attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1 and t2.d is not null" + "index_condition": "t2.d is not null", + "attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1" }, "table": { "table_name": "t1", diff --cc mysql-test/main/range_mrr_icp.result index a4a64dd,97f35bf..5d55a82 --- a/mysql-test/main/range_mrr_icp.result +++ b/mysql-test/main/range_mrr_icp.result @@@ -2535,7 -2482,7 +2539,7 @@@ EXPLAI "key_length": "5", "used_key_parts": ["d"], "rows": 3, - "filtered": 100, - "filtered": 55, ++ "filtered": 60, "index_condition": "t2.d is not null", "attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((2,2)))", "mrr_type": "Rowid-ordered scan" @@@ -2601,15 -2548,16 +2605,16 @@@ EXPLAI "query_block": { "select_id": 1, "table": { - "table_name": "t1", + "table_name": "t2", "access_type": "range", - "possible_keys": ["idx"], - "key": "idx", + "possible_keys": ["idx1", "idx2"], + "key": "idx1", "key_length": "5", - "used_key_parts": ["a"], - "rows": 6, - "filtered": 100, - "index_condition": "t1.a is not null", + "used_key_parts": ["d"], + "rows": 8, - "filtered": 12.5, ++ "filtered": 14.423, + "index_condition": "t2.d is not null", + "attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1", "mrr_type": "Rowid-ordered scan" }, "table": { @@@ -2702,13 -2649,12 +2706,13 @@@ EXPLAI "table_name": "t2", "access_type": "range", "possible_keys": ["idx1", "idx2"], - "key": "idx2", + "key": "idx1", "key_length": "5", - "used_key_parts": ["e"], - "rows": 6, + "used_key_parts": ["d"], + "rows": 7, - "filtered": 100, + "filtered": 6.7308, - "attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1 and t2.d is not null", + "index_condition": "t2.d is not null", + "attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and octet_length(t2.f) = 1", "mrr_type": "Rowid-ordered scan" }, "table": { diff --cc mysql-test/main/range_vs_index_merge.result index d332156,b8900af..82d2358 --- a/mysql-test/main/range_vs_index_merge.result +++ b/mysql-test/main/range_vs_index_merge.result @@@ -1079,7 -1079,7 +1079,7 @@@ EXPLAIN SELECT Name, Country, Populatio (Name='Samara' AND Country='RUS') OR (Name='Seattle' AND Country='USA'); id select_type table type possible_keys key key_len ref rows Extra - 1 SIMPLE City index_merge Country,CountryPopulation,CountryName,CityName CountryName,CityName 38,35 NULL 28 Using sort_union(CountryName,CityName); Using where -1 SIMPLE City index_merge Country,CountryPopulation,CountryName,CityName CityName,CountryName 35,38 NULL 27 Using sort_union(CityName,CountryName); Using where ++1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CityName 35 NULL 27 Using index condition; Using where SELECT Name, Country, Population FROM City WHERE (Name='Manila' AND Country='PHL') OR (Name='Addis Abeba' AND Country='ETH') OR @@@ -1110,32 -1110,32 +1110,32 @@@ (Name='Seattle' AND Country='USA'); Name Country Population Addis Abeba ETH 2495000 --Manila PHL 1581082 --Jakarta IDN 9604900 --Delhi IND 7206704 ++Ankara TUR 3038159 Bangalore IND 2660088 --Teheran IRN 6758845 --Roma ITA 2643581 --Venezia ITA 277305 --Tokyo JPN 7980230 --Toronto CAN 688275 --Vancouver CAN 514008 --Peking CHN 7472000 --Seoul KOR 9981619 ++Basel CHE 166700 ++Caracas VEN 1975294 ++Dakar SEN 785071 ++Delhi IND 7206704 ++Dresden DEU 476668 ++Jakarta IDN 9604900 Kaunas LTU 412639 --Rabat MAR 623457 --Tijuana MEX 1212232 Lagos NGA 1518000 ++Lugansk UKR 469000 ++Manila PHL 1581082 Paris FRA 2125246 --Dresden DEU 476668 --Dakar SEN 785071 --Basel CHE 166700 ++Peking CHN 7472000 Praha CZE 1181126 --Ankara TUR 3038159 --Lugansk UKR 469000 --Caracas VEN 1975294 ++Rabat MAR 623457 ++Roma ITA 2643581 Samara RUS 1156100 Seattle USA 563374 ++Seoul KOR 9981619 ++Teheran IRN 6758845 ++Tijuana MEX 1212232 ++Tokyo JPN 7980230 ++Toronto CAN 688275 ++Vancouver CAN 514008 ++Venezia ITA 277305 set optimizer_switch='index_merge=off'; EXPLAIN SELECT Name, Country, Population FROM City WHERE (Name='Manila' AND Country='PHL') OR @@@ -1166,7 -1166,7 +1166,7 @@@ (Name='Samara' AND Country='RUS') OR (Name='Seattle' AND Country='USA'); id select_type table type possible_keys key key_len ref rows Extra - 1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 28 Using index condition; Using where -1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 27 Using index condition; Using where ++1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CityName 35 NULL 27 Using index condition; Using where SELECT Name, Country, Population FROM City WHERE (Name='Manila' AND Country='PHL') OR (Name='Addis Abeba' AND Country='ETH') OR @@@ -1196,33 -1196,33 +1196,33 @@@ (Name='Samara' AND Country='RUS') OR (Name='Seattle' AND Country='USA'); Name Country Population --Toronto CAN 688275 --Vancouver CAN 514008 --Basel CHE 166700 --Peking CHN 7472000 --Praha CZE 1181126 --Dresden DEU 476668 Addis Abeba ETH 2495000 --Paris FRA 2125246 --Jakarta IDN 9604900 ++Ankara TUR 3038159 Bangalore IND 2660088 ++Basel CHE 166700 ++Caracas VEN 1975294 ++Dakar SEN 785071 Delhi IND 7206704 --Teheran IRN 6758845 --Roma ITA 2643581 --Venezia ITA 277305 --Tokyo JPN 7980230 --Seoul KOR 9981619 ++Dresden DEU 476668 ++Jakarta IDN 9604900 Kaunas LTU 412639 --Rabat MAR 623457 --Tijuana MEX 1212232 Lagos NGA 1518000 ++Lugansk UKR 469000 Manila PHL 1581082 ++Paris FRA 2125246 ++Peking CHN 7472000 ++Praha CZE 1181126 ++Rabat MAR 623457 ++Roma ITA 2643581 Samara RUS 1156100 --Dakar SEN 785071 --Ankara TUR 3038159 --Lugansk UKR 469000 Seattle USA 563374 --Caracas VEN 1975294 ++Seoul KOR 9981619 ++Teheran IRN 6758845 ++Tijuana MEX 1212232 ++Tokyo JPN 7980230 ++Toronto CAN 688275 ++Vancouver CAN 514008 ++Venezia ITA 277305 set optimizer_switch=@save_optimizer_switch; # # Bug mdev-585: range vs index-merge with ORDER BY ... LIMIT n @@@ -1713,9 -1749,6 +1749,10 @@@ PRIMARY KEY(b), INDEX idx1(d), INDEX id INSERT INTO t1 VALUES (0,58,7,7),(0,63,2,0),(0,64,186,8),(0,65,1,-2), (0,71,190,-3), (0,72,321,-7),(0,73,0,3),(0,74,5,25),(0,75,5,3); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK SET SESSION optimizer_switch='index_merge_sort_union=off'; EXPLAIN SELECT * FROM t1 @@@ -1793,9 -1826,6 +1830,10 @@@ INSERT INTO t1 VALUE (7,'Pennsylvania','Harrisburg'), (8,'Virginia','Richmond') ; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK EXPLAIN SELECT * FROM t1 FORCE KEY (state,capital) WHERE ( state = 'Alabama' OR state >= 'Colorado' ) AND id != 9 @@@ -1862,23 -1892,23 +1900,23 @@@ Country='NOR' AND Name IN ('Oslo', 'Ber Country='ITA' AND Name IN ('Napoli', 'Venezia'); ID Name Country Population 175 Antwerpen BEL 446525 --176 Gent BEL 224180 ++2808 Bergen NOR 230948 3068 Berlin DEU 3386667 3087 Bonn DEU 301048 ++2918 Braga PRT 90535 ++176 Gent BEL 224180 3242 Lahti FIN 96921 --2974 Paris FRA 2125246 ++3580 Moscow RUS 8389200 1466 Napoli ITA 1002619 --1474 Venezia ITA 277305 --2808 Bergen NOR 230948 2807 Oslo NOR 508726 --2928 Warszawa POL 1615369 --2931 Wroclaw POL 636765 --2918 Braga PRT 90535 ++2974 Paris FRA 2125246 2915 Porto PRT 273060 --3580 Moscow RUS 8389200 3581 St Petersburg RUS 4694000 3048 Stockholm SWE 750348 3051 Uppsala SWE 189569 ++1474 Venezia ITA 277305 ++2928 Warszawa POL 1615369 ++2931 Wroclaw POL 636765 explain select * from City where Country='FIN' AND Name IN ('Lahti','Imatra') OR @@@ -1892,6 -1922,6 +1930,6 @@@ Country='POL' AND Name IN ('Warszawa', Country='NOR' AND Name IN ('Oslo', 'Bergen') OR Country='ITA' AND Name IN ('Napoli', 'Venezia'); id select_type table type possible_keys key key_len ref rows Extra --1 SIMPLE City range CountryName,Name CountryName 38 NULL 20 Using index condition; Using where ++1 SIMPLE City range CountryName,Name Name 35 NULL 20 Using index condition; Using where DROP DATABASE world; set session optimizer_switch='index_merge_sort_intersection=default'; diff --cc mysql-test/main/stat_tables_innodb.result index 69c07b0,c8b18f0..feb7a4c --- a/mysql-test/main/stat_tables_innodb.result +++ b/mysql-test/main/stat_tables_innodb.result @@@ -72,11 -67,11 +72,11 @@@ and r_name = 'AMERICA' and o_orderdate group by n_name order by revenue desc; id select_type table type possible_keys key key_len ref rows Extra - 1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 213 Using where; Using temporary; Using filesort - 1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where - 1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 - 1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.customer.c_nationkey 1 Using index - 1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) + 1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort + 1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 + 1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 Using index + 1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index -1 SIMPLE orders ref PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey 5 dbt3_s001.customer.c_custkey 15 Using where ++1 SIMPLE orders ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (14%) Using where; Using filter 1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region @@@ -203,11 -198,11 +203,11 @@@ and r_name = 'AMERICA' and o_orderdate group by n_name order by revenue desc; id select_type table type possible_keys key key_len ref rows Extra - 1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 213 Using where; Using temporary; Using filesort - 1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where - 1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 - 1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.customer.c_nationkey 1 Using index - 1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) + 1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort + 1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 + 1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 Using index + 1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index -1 SIMPLE orders ref PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey 5 dbt3_s001.customer.c_custkey 15 Using where ++1 SIMPLE orders ref|filter PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey|i_o_orderdate 5|4 dbt3_s001.customer.c_custkey 15 (14%) Using where; Using filter 1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region @@@ -638,8 -652,61 +657,64 @@@ MAX(pk NULL DROP TABLE t1; set use_stat_tables=@save_use_stat_tables; + # + # MDEV-17255: New optimizer defaults and ANALYZE TABLE + # + create table t1 (a int, b int); + insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10); + set use_stat_tables= preferably_for_queries; + # + # with use_stat_tables= PREFERABLY_FOR_QUERIES + # analyze table t1 will not collect statistics + # + analyze table t1; + Table Op Msg_type Msg_text + test.t1 analyze status OK + select * from mysql.column_stats; + db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram + analyze + select * from t1 where a = 1 and b=3; + id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra + 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where + # + # with use_stat_tables= PREFERABLY_FOR_QUERIES + # analyze table t1 will collect statistics if we use PERSISTENT + # for columns, indexes or everything + # + analyze table t1 persistent for columns (a) indexes (); + Table Op Msg_type Msg_text + test.t1 analyze status Engine-independent statistics collected + test.t1 analyze status OK + select * from mysql.column_stats; + db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram + test t1 a 1 4 0.0000 4.0000 2.5000 0 NULL NULL + # filtered shows that we used the data from stat tables + analyze + select * from t1 where a = 1 and b=3; + id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra + 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 25.00 10.00 Using where + # + # with use_stat_tables= PREFERABLY + # analyze table t1 will collect statistics + # + set use_stat_tables=PREFERABLY; + analyze table t1; + Table Op Msg_type Msg_text + test.t1 analyze status Engine-independent statistics collected + test.t1 analyze status OK + select * from mysql.column_stats; + db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram + test t1 a 1 4 0.0000 4.0000 2.5000 0 NULL NULL + test t1 b 2 10 0.0000 4.0000 1.1111 0 NULL NULL + # filtered shows that we used the data from stat tables + analyze + select * from t1 where a=1 and b=3; + id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra + 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 2.78 10.00 Using where + drop table t1; + set use_stat_tables=@save_use_stat_tables; +set global innodb_stats_persistent= @innodb_stats_persistent_save; +set global innodb_stats_persistent_sample_pages= +@innodb_stats_persistent_sample_pages_save; set optimizer_switch=@save_optimizer_switch_for_stat_tables_test; SET SESSION STORAGE_ENGINE=DEFAULT; diff --cc mysql-test/main/subselect_sj2_mat.result index 65dfddc,78df076..c05db8d --- a/mysql-test/main/subselect_sj2_mat.result +++ b/mysql-test/main/subselect_sj2_mat.result @@@ -74,11 -69,6 +74,14 @@@ primary key(pk1, pk2, pk3 ) engine=innodb; insert into t3 select a,a, a,a,a from t0; insert into t3 select a,a, a+100,a+100,a+100 from t0; +analyze table t1,t2,t3; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK ++test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK ++test.t3 analyze status Engine-independent statistics collected +test.t3 analyze status OK explain select * from t3 where b in (select a from t1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t3 ALL b NULL NULL NULL 20 @@@ -933,10 -924,6 +936,12 @@@ INSERT INTO t2 VALUE (6,'u',6),(7,'m',7),(8,'k',8),(9,'o',9),(10,'w',1), (11,'m',2),(12,'q',3),(13,'m',4),(14,'d',5), (15,'g',6),(16,'x',7),(17,'f',8); +analyze table t1,t2; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK ++test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK explain SELECT * FROM t1 WHERE b IN ( SELECT d FROM t2, t1 @@@ -968,9 -955,6 +973,10 @@@ INSERT INTO t1 VALUE ('y','y'),('t','t'),('d','d'),('s','s'),('r','r'), ('m','m'),('b','b'),('x','x'),('g','g'),('p','p'), ('q','q'),('w','w'),('d','d'),('e','e'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; # This query returned 6 rows instead of 19 SELECT * FROM v1 @@@ -1004,9 -988,6 +1010,10 @@@ y CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(1) NOT NULL, KEY(a)) ENGINE=InnoDB; INSERT INTO t2 SELECT * FROM t1; INSERT INTO t2 SELECT * FROM t1; +ANALYZE TABLE t2; +Table Op Msg_type Msg_text ++test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK EXPLAIN SELECT * FROM t2 WHERE (a, a) IN (SELECT alias2.b, alias2.a FROM t1 AS alias1, t1 AS alias2 @@@ -1253,11 -1234,6 +1260,14 @@@ INSERT IGNORE INTO t2 (t2id, t1idref) S INSERT IGNORE INTO t1 VALUES (200001, 'a'); INSERT IGNORE INTO t2 (t2id, t1idref) VALUES (200011, 200001),(200012, 200001),(200013, 200001); INSERT IGNORE INTO t3 VALUES (1, 200011, 1), (1, 200012, 2), (1, 200013, 3); +ANALYZE TABLE t1,t2,t3; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK ++test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK ++test.t3 analyze status Engine-independent statistics collected +test.t3 analyze status OK set @tmp7474= @@optimizer_search_depth; SET SESSION optimizer_search_depth = 1; SELECT SQL_NO_CACHE @@@ -1873,14 -1841,6 +1883,19 @@@ CREATE TABLE t5 (id_product int) ENGINE INSERT INTO `t5` VALUES (652),(668),(669),(670),(671),(673),(674),(675),(676), (677),(679),(680),(681),(682),(683),(684),(685),(686); +ANALYZE TABLE t1,t2,t3,t,t5; +Table Op Msg_type Msg_text ++test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK ++test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status Table is already up to date ++test.t3 analyze status Engine-independent statistics collected +test.t3 analyze status OK +test.t analyze Error Table 'test.t' doesn't exist +test.t analyze status Operation failed ++test.t5 analyze status Engine-independent statistics collected +test.t5 analyze status OK ++set optimizer_switch='rowid_filter=off'; explain SELECT * FROM t3 JOIN t4 ON (t4.id_product = t3.id_product AND t4.id_shop = 1) @@@ -1893,21 -1853,18 +1908,22 @@@ AND t3.id_product IN (SELECT id_produc AND t3.id_product IN (SELECT id_product FROM t2 t2_4 WHERE t2_4.id_t2 = 34 OR t2_4.id_t2 = 23) AND t3.id_product IN (SELECT id_product FROM t2 t2_5 WHERE t2_5.id_t2 = 29 OR t2_5.id_t2 = 28 OR t2_5.id_t2 = 26); id select_type table type possible_keys key key_len ref rows Extra - 1 PRIMARY t1 index NULL PRIMARY 8 NULL 73 Using index - 1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.id_product 1 Using index + 1 PRIMARY <subquery3> ALL distinct_key NULL NULL NULL 12 + 1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t2_2.id_product 1 Using where; Using index 1 PRIMARY <subquery5> eq_ref distinct_key distinct_key 4 func 1 Using where - 1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 func 1 Using where - 1 PRIMARY <subquery3> eq_ref distinct_key distinct_key 4 func 1 Using where - 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 Using where - 1 PRIMARY t4 eq_ref PRIMARY PRIMARY 8 test.t1.id_product,const 1 Using where; Using index - 1 PRIMARY <subquery6> eq_ref distinct_key distinct_key 4 func 1 Using where 1 PRIMARY t5 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) + 1 PRIMARY <subquery6> eq_ref distinct_key distinct_key 4 func 1 Using where + 1 PRIMARY t4 eq_ref PRIMARY PRIMARY 8 test.t3.id_product,const 1 Using where; Using index + 1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 Using where + 1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 func 1 Using where + 1 PRIMARY t1 index NULL PRIMARY 8 NULL 73 Using where; Using index; Using join buffer (flat, BNL join) + 3 MATERIALIZED t2_2 ref id_t2,id_product id_t2 5 const 12 Using where 5 MATERIALIZED t2_4 range id_t2,id_product id_t2 5 NULL 18 Using index condition; Using where - 4 MATERIALIZED t2_3 range id_t2,id_product id_t2 5 NULL 33 Using index condition; Using where - 3 MATERIALIZED t2_2 ref id_t2,id_product id_t2 5 const 12 - 2 MATERIALIZED t2_1 ref id_t2,id_product id_t2 5 const 51 -6 MATERIALIZED t2_5 range id_t2,id_product id_t2 5 NULL 30 Using index condition; Using where -2 MATERIALIZED t2_1 ref id_t2,id_product id_t2 5 const 50 -4 MATERIALIZED t2_3 range id_t2,id_product id_t2 5 NULL 32 Using index condition; Using where +6 MATERIALIZED t2_5 range id_t2,id_product id_t2 5 NULL 31 Using index condition; Using where ++2 MATERIALIZED t2_1 ref id_t2,id_product id_t2 5 const 51 ++4 MATERIALIZED t2_3 range id_t2,id_product id_t2 5 NULL 33 Using index condition; Using where ++set optimizer_switch='rowid_filter=default'; drop table t1,t2,t3,t4,t5; +set global innodb_stats_persistent= @innodb_stats_persistent_save; +set global innodb_stats_persistent_sample_pages= +@innodb_stats_persistent_sample_pages_save; diff --cc mysql-test/main/subselect_sj2_mat.test index 47e48283,6ae687a..91057f0 --- a/mysql-test/main/subselect_sj2_mat.test +++ b/mysql-test/main/subselect_sj2_mat.test @@@ -473,8 -467,6 +473,10 @@@ CREATE TABLE t5 (id_product int) ENGINE INSERT INTO `t5` VALUES (652),(668),(669),(670),(671),(673),(674),(675),(676), (677),(679),(680),(681),(682),(683),(684),(685),(686); + +ANALYZE TABLE t1,t2,t3,t,t5; ++ ++set optimizer_switch='rowid_filter=off'; explain SELECT * FROM t3 @@@ -488,8 -480,4 +490,10 @@@ AND t3.id_product IN (SELECT id_produc AND t3.id_product IN (SELECT id_product FROM t2 t2_4 WHERE t2_4.id_t2 = 34 OR t2_4.id_t2 = 23) AND t3.id_product IN (SELECT id_product FROM t2 t2_5 WHERE t2_5.id_t2 = 29 OR t2_5.id_t2 = 28 OR t2_5.id_t2 = 26); ++set optimizer_switch='rowid_filter=default'; ++ drop table t1,t2,t3,t4,t5; + +set global innodb_stats_persistent= @innodb_stats_persistent_save; +set global innodb_stats_persistent_sample_pages= + @innodb_stats_persistent_sample_pages_save; diff --cc sql/CMakeLists.txt index b37962d,a22ce69..6cb78f4 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@@ -134,10 -139,9 +139,10 @@@ SET (SQL_SOURC sql_sequence.cc sql_sequence.h ha_sequence.h sql_tvc.cc sql_tvc.h opt_split.cc + rowid_filter.cc rowid_filter.h ${WSREP_SOURCES} table_cache.cc encryption.cc temporary_tables.cc - proxy_protocol.cc + proxy_protocol.cc backup.cc ${CMAKE_CURRENT_BINARY_DIR}/sql_builtin.cc ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.cc diff --cc sql/structs.h index 12b5dee,3e29e13..8aec29b --- a/sql/structs.h +++ b/sql/structs.h @@@ -118,13 -109,8 +118,13 @@@ typedef struct st_key pk2 is explicitly present in idx1, it is not in the extension, so ext_key_part_map.is_set(1) == false */ - LEX_CSTRING name; key_part_map ext_key_part_map; + /* + Bitmap of indexes having common parts with this index + (only key parts from key definitions are taken into account) + */ + key_map overlapped; + LEX_CSTRING name; uint block_size; enum ha_key_alg algorithm; /* diff --cc storage/innobase/handler/ha_innodb.cc index 0b4880b,683a641..4606285 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@@ -7558,14 -7574,8 +7579,15 @@@ ha_innobase::build_template /* Below we check column by column if we need to access the clustered index. */ + if (pushed_rowid_filter && rowid_filter_is_active) { + fetch_primary_key_cols = TRUE; + m_prebuilt->pk_filter = this; + } else { + m_prebuilt->pk_filter = NULL; + } + - n_fields = (ulint) mysql_fields(table); + const bool skip_virtual = omits_virtual_cols(*table_share); + const ulint n_fields = table_share->fields; if (!m_prebuilt->mysql_template) { m_prebuilt->mysql_template = (mysql_row_templ_t*) @@@ -7585,26 -7595,24 +7607,25 @@@ /* Note that in InnoDB, i is the column number in the table. MySQL calls columns 'fields'. */ + ulint num_v = 0; + - if (active_index != MAX_KEY - && active_index == pushed_idx_cond_keyno) { + if ((active_index != MAX_KEY + && active_index == pushed_idx_cond_keyno) || + (pushed_rowid_filter && rowid_filter_is_active)) { - ulint num_v = 0; - /* Push down an index condition or an end_range check. */ - for (i = 0; i < n_fields; i++) { - ibool index_contains; - - if (innobase_is_v_fld(table->field[i])) { - index_contains = dict_index_contains_col_or_prefix( - index, num_v, true); - if (index_contains) - { - m_prebuilt->n_template = 0; - goto no_icp; - } - } else { - index_contains = dict_index_contains_col_or_prefix( - index, i - num_v, false); + for (ulint i = 0; i < n_fields; i++) { + const Field* field = table->field[i]; + const bool is_v = innobase_is_v_fld(field); + if (is_v && skip_virtual) { + num_v++; + continue; + } + bool index_contains = index->contains_col_or_prefix( + is_v ? num_v : i - num_v, is_v); + if (is_v && index_contains) { + m_prebuilt->n_template = 0; + num_v = 0; + goto no_icp; } /* Test if an end_range or an index condition
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • ...
  • 1461
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.