diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2019-05-12 17:20:23 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2019-05-12 17:20:23 +0200 |
commit | c51f85f8823a845cd4a6aa1b2aa5af18484b2ab0 (patch) | |
tree | 65c45f6100c13dad90c33b86dc68be268139b0b8 | |
parent | a89f199c64a1d2339de7c167ce64ec148061a4d3 (diff) | |
parent | 8ce702aa90c174566f4ac950e85cc7570bf9b647 (diff) | |
download | mariadb-git-c51f85f8823a845cd4a6aa1b2aa5af18484b2ab0.tar.gz |
Merge branch '10.2' into 10.3
255 files changed, 3974 insertions, 1185 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 6615106093d..0ea8269c14c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -491,7 +491,7 @@ ADD_CUSTOM_TARGET(INFO_BIN ALL WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) -INSTALL_DOCUMENTATION(README.md CREDITS COPYING COPYING.thirdparty +INSTALL_DOCUMENTATION(README.md CREDITS COPYING THIRDPARTY EXCEPTIONS-CLIENT COMPONENT Readme) # MDEV-6526 these files are not installed anymore diff --git a/README.md b/README.md index 681f75ca812..053831e4cd7 100644 --- a/README.md +++ b/README.md @@ -45,8 +45,8 @@ https://launchpad.net/~maria-discuss and the #maria IRC channel on Freenode. -License: --------- +Licensing: +---------- *************************************************************************** @@ -57,8 +57,8 @@ General Public License (GPLv2). (I.e. Without the "any later version" clause.) This is inherited from MySQL. Please see the README file in the MySQL distribution for more information. -License information can be found in the COPYING, COPYING.LESSER, -and COPYING.thirdparty files. +License information can be found in the COPYING file. Third party +license information can be found in the THIRDPARTY file. *************************************************************************** diff --git a/COPYING.thirdparty b/THIRDPARTY index 7edd61f21f9..7edd61f21f9 100644 --- a/COPYING.thirdparty +++ b/THIRDPARTY diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index 40560613a89..022042e149b 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -321,7 +321,7 @@ static int get_default_values() int ret= 0; FILE *file= 0; - bzero(tool_path, FN_REFLEN); + memset(tool_path, 0, FN_REFLEN); if ((error= find_tool("my_print_defaults" FN_EXEEXT, tool_path))) goto exit; else @@ -334,9 +334,9 @@ static int get_default_values() char *format_str= 0; if (has_spaces(tool_path) || has_spaces(defaults_file)) - format_str = "\"%s mysqld > %s\""; + format_str = "\"%s --mysqld > %s\""; else - format_str = "%s mysqld > %s"; + format_str = "%s --mysqld > %s"; snprintf(defaults_cmd, sizeof(defaults_cmd), format_str, add_quotes(tool_path), add_quotes(defaults_file)); @@ -347,7 +347,7 @@ static int get_default_values() } #else snprintf(defaults_cmd, sizeof(defaults_cmd), - "%s mysqld > %s", tool_path, defaults_file); + "%s --mysqld > %s", tool_path, defaults_file); #endif /* Execute the command */ diff --git a/client/mysqldump.c b/client/mysqldump.c index cbb3a7d3ff7..46db77496bc 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -3322,7 +3322,7 @@ static void dump_trigger_old(FILE *sql_file, MYSQL_RES *show_triggers_rs, char name_buff[NAME_LEN * 4 + 3]; const char *xml_msg= "\nWarning! mysqldump being run against old server " - "that does not\nsupport 'SHOW CREATE TRIGGERS' " + "that does not\nsupport 'SHOW CREATE TRIGGER' " "statement. Skipping..\n"; DBUG_ENTER("dump_trigger_old"); @@ -3481,12 +3481,14 @@ static int dump_triggers_for_table(char *table_name, char *db_name) char db_cl_name[MY_CS_NAME_SIZE]; int ret= TRUE; + /* Servers below 5.1.21 do not support SHOW CREATE TRIGGER */ + const int use_show_create_trigger= mysql_get_server_version(mysql) >= 50121; DBUG_ENTER("dump_triggers_for_table"); DBUG_PRINT("enter", ("db: %s, table_name: %s", db_name, table_name)); - if (path && !(sql_file= open_sql_file_for_table(table_name, - O_WRONLY | O_APPEND))) + if (path && + !(sql_file= open_sql_file_for_table(table_name, O_WRONLY | O_APPEND))) DBUG_RETURN(1); /* Do not use ANSI_QUOTES on triggers in dump */ @@ -3502,11 +3504,15 @@ static int dump_triggers_for_table(char *table_name, char *db_name) /* Get list of triggers. */ - my_snprintf(query_buff, sizeof(query_buff), - "SELECT TRIGGER_NAME FROM INFORMATION_SCHEMA.TRIGGERS " - "WHERE EVENT_OBJECT_SCHEMA = DATABASE() AND " - "EVENT_OBJECT_TABLE = %s", - quote_for_equal(table_name, name_buff)); + if (use_show_create_trigger) + my_snprintf(query_buff, sizeof(query_buff), + "SELECT TRIGGER_NAME FROM INFORMATION_SCHEMA.TRIGGERS " + "WHERE EVENT_OBJECT_SCHEMA = DATABASE() AND " + "EVENT_OBJECT_TABLE = %s", + quote_for_equal(table_name, name_buff)); + else + my_snprintf(query_buff, sizeof(query_buff), "SHOW TRIGGERS LIKE %s", + quote_for_like(table_name, name_buff)); if (mysql_query_with_error_report(mysql, &show_triggers_rs, query_buff)) goto done; @@ -3522,35 +3528,28 @@ static int dump_triggers_for_table(char *table_name, char *db_name) while ((row= mysql_fetch_row(show_triggers_rs))) { - - my_snprintf(query_buff, sizeof (query_buff), - "SHOW CREATE TRIGGER %s", - quote_name(row[0], name_buff, TRUE)); - - if (mysql_query(mysql, query_buff)) + if (use_show_create_trigger) { - /* - mysqldump is being run against old server, that does not support - SHOW CREATE TRIGGER statement. We should use SHOW TRIGGERS output. + MYSQL_RES *show_create_trigger_rs; - NOTE: the dump may be incorrect, as old SHOW TRIGGERS does not - provide all the necessary information to restore trigger properly. - */ + my_snprintf(query_buff, sizeof (query_buff), "SHOW CREATE TRIGGER %s", + quote_name(row[0], name_buff, TRUE)); - dump_trigger_old(sql_file, show_triggers_rs, &row, table_name); - } - else - { - MYSQL_RES *show_create_trigger_rs= mysql_store_result(mysql); - - int error= (!show_create_trigger_rs || - dump_trigger(sql_file, show_create_trigger_rs, db_name, - db_cl_name)); - mysql_free_result(show_create_trigger_rs); - if (error) + if (mysql_query_with_error_report(mysql, &show_create_trigger_rs, + query_buff)) goto done; + else + { + int error= (!show_create_trigger_rs || + dump_trigger(sql_file, show_create_trigger_rs, db_name, + db_cl_name)); + mysql_free_result(show_create_trigger_rs); + if (error) + goto done; + } } - + else + dump_trigger_old(sql_file, show_triggers_rs, &row, table_name); } if (opt_xml) diff --git a/client/mysqlimport.c b/client/mysqlimport.c index c7432992d45..e54ed4a87df 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -514,11 +514,11 @@ static void safe_exit(int error, MYSQL *mysql) if (mysql) mysql_close(mysql); + mysql_library_end(); #ifdef HAVE_SMEM my_free(shared_memory_base_name); #endif free_defaults(argv_to_free); - mysql_library_end(); my_free(opt_password); if (error) sf_leaking_memory= 1; /* dirty exit, some threads are still running */ diff --git a/include/my_tree.h b/include/my_tree.h index e175492431e..48bbc5162f8 100644 --- a/include/my_tree.h +++ b/include/my_tree.h @@ -59,7 +59,7 @@ typedef struct st_tree_element { #define ELEMENT_CHILD(element, offs) (*(TREE_ELEMENT**)((char*)element + offs)) typedef struct st_tree { - TREE_ELEMENT *root,null_element; + TREE_ELEMENT *root; TREE_ELEMENT **parents[MAX_TREE_HEIGHT]; uint offset_to_key,elements_in_tree,size_of_element; size_t memory_limit, allocated; diff --git a/libmariadb b/libmariadb -Subproject b50871611764d282874ad095d6c021163d1fe35 +Subproject bce6c8013805f203b38e52c979b22b3141334f3 diff --git a/mysql-test/include/ctype_like_escape.inc b/mysql-test/include/ctype_like_escape.inc index d4abc33c178..f817bc03e74 100644 --- a/mysql-test/include/ctype_like_escape.inc +++ b/mysql-test/include/ctype_like_escape.inc @@ -16,3 +16,9 @@ select c1 as c1u from t1 where c1 like 'ab\_def'; # should return ab_def select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; drop table t1; + +# +# MDEV-13335 UTF8 escape wildcard LIKE match has different behavior in different collations +# +SELECT @@collation_connection; +SELECT '\%b' LIKE '%\%'; diff --git a/mysql-test/lib/generate-ssl-certs.sh b/mysql-test/lib/generate-ssl-certs.sh index 0894be3a299..7df1c2d8279 100755 --- a/mysql-test/lib/generate-ssl-certs.sh +++ b/mysql-test/lib/generate-ssl-certs.sh @@ -34,7 +34,7 @@ openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_ # with SubjectAltName, only for OpenSSL 1.0.2+ cat > demoCA/sanext.conf <<EOF -subjectAltName=DNS:localhost +subjectAltName=IP:127.0.0.1, DNS:localhost EOF openssl req -newkey rsa:2048 -keyout serversan-key.pem -out demoCA/serversan-req.pem -days 7300 -nodes -subj '/CN=server/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB' openssl ca -keyfile cakey.pem -extfile demoCA/sanext.conf -days 7300 -batch -cert cacert.pem -policy policy_anything -out serversan-cert.pem -in demoCA/serversan-req.pem diff --git a/mysql-test/main/bootstrap.test b/mysql-test/main/bootstrap.test index 414deede892..97f5da86096 100644 --- a/mysql-test/main/bootstrap.test +++ b/mysql-test/main/bootstrap.test @@ -65,6 +65,15 @@ SELECT 'bug' as '' FROM INFORMATION_SCHEMA.ENGINES WHERE engine='innodb' --error 1 --exec $MYSQLD_BOOTSTRAP_CMD --myisam_recover_options=NONE +# +# MDEV-19349 mysql_install_db: segfault at tmp_file_prefix check +# +--write_file $MYSQLTEST_VARDIR/tmp/1 +use test; +EOF +--exec $MYSQLD_BOOTSTRAP_CMD < $MYSQLTEST_VARDIR/tmp/1 >> $MYSQLTEST_VARDIR/tmp/bootstrap.log 2>&1 +--remove_file $MYSQLTEST_VARDIR/tmp/1 + --echo End of 5.5 tests --source include/not_windows_embedded.inc diff --git a/mysql-test/main/create_drop_binlog.result b/mysql-test/main/create_drop_binlog.result index be40fcc140a..39d5754224c 100644 --- a/mysql-test/main/create_drop_binlog.result +++ b/mysql-test/main/create_drop_binlog.result @@ -246,7 +246,11 @@ Log_name Pos Event_type Server_id End_log_pos Info RESET MASTER; SET timestamp=UNIX_TIMESTAMP('2014-11-01 10:20:30'); CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE IF EXISTS t2; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; EVENT_NAME EVENT_DEFINITION ev1 DROP TABLE IF EXISTS t2 diff --git a/mysql-test/main/create_drop_event.result b/mysql-test/main/create_drop_event.result index 0d69e85dfd6..fadfbb6a3b3 100644 --- a/mysql-test/main/create_drop_event.result +++ b/mysql-test/main/create_drop_event.result @@ -4,6 +4,8 @@ CREATE TABLE t1 (a INT); CREATE OR REPLACE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db1; ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (10); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; EVENT_NAME EVENT_DEFINITION ev1 INSERT INTO t1 VALUES (10) @@ -21,10 +23,13 @@ ev1 INSERT INTO t1 VALUES (10) CREATE EVENT IF NOT EXISTS ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (12); Warnings: Note 1537 Event 'ev1' already exists +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; EVENT_NAME EVENT_DEFINITION ev1 INSERT INTO t1 VALUES (10) CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (13); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT EVENT_NAME, EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; EVENT_NAME EVENT_DEFINITION ev1 INSERT INTO t1 VALUES (13) diff --git a/mysql-test/main/ctype_big5.result b/mysql-test/main/ctype_big5.result index f61fc4c8400..8895e2d89df 100644 --- a/mysql-test/main/ctype_big5.result +++ b/mysql-test/main/ctype_big5.result @@ -220,6 +220,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +big5_chinese_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); @@ -450,6 +456,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +big5_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); diff --git a/mysql-test/main/ctype_euckr.result b/mysql-test/main/ctype_euckr.result index 3006e77412a..f8dab97ce1d 100644 --- a/mysql-test/main/ctype_euckr.result +++ b/mysql-test/main/ctype_euckr.result @@ -220,6 +220,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +euckr_korean_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); @@ -355,6 +361,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +euckr_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); diff --git a/mysql-test/main/ctype_gb2312.result b/mysql-test/main/ctype_gb2312.result index 8a0950caea8..2998615b1cb 100644 --- a/mysql-test/main/ctype_gb2312.result +++ b/mysql-test/main/ctype_gb2312.result @@ -220,6 +220,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +gb2312_chinese_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); @@ -436,6 +442,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +gb2312_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); diff --git a/mysql-test/main/ctype_gbk.result b/mysql-test/main/ctype_gbk.result index de056dffe2a..8dcc5e12d0b 100644 --- a/mysql-test/main/ctype_gbk.result +++ b/mysql-test/main/ctype_gbk.result @@ -220,6 +220,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +gbk_chinese_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); @@ -436,6 +442,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +gbk_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result index 705c719405b..efee1006abf 100644 --- a/mysql-test/main/ctype_latin1.result +++ b/mysql-test/main/ctype_latin1.result @@ -506,6 +506,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +latin1_swedish_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 # # MDEV-4842 STR_TO_DATE does not work with UCS2/UTF16/UTF32 # @@ -636,6 +642,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +latin1_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 SELECT strcmp('a','a '), strcmp('a ','a'); strcmp('a','a ') strcmp('a ','a') 0 0 diff --git a/mysql-test/main/ctype_sjis.result b/mysql-test/main/ctype_sjis.result index 090bb12fc42..c897268b204 100644 --- a/mysql-test/main/ctype_sjis.result +++ b/mysql-test/main/ctype_sjis.result @@ -189,6 +189,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +sjis_japanese_ci +SELECT '\%b' LIKE '%\%'; +'_%b' LIKE '%_%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); @@ -343,6 +349,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +sjis_bin +SELECT '\%b' LIKE '%\%'; +'_%b' LIKE '%_%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); diff --git a/mysql-test/main/ctype_tis620.result b/mysql-test/main/ctype_tis620.result index cf66c81c647..9650c366d38 100644 --- a/mysql-test/main/ctype_tis620.result +++ b/mysql-test/main/ctype_tis620.result @@ -3033,6 +3033,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +tis620_thai_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 drop table if exists t1; create table t1 select repeat('a',10) as c1; delete from t1; @@ -3331,6 +3337,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +tis620_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 # # MDEV-7149 Constant condition propagation erroneously applied for LIKE # diff --git a/mysql-test/main/ctype_uca.result b/mysql-test/main/ctype_uca.result index 7394ec82924..41d2a1149ee 100644 --- a/mysql-test/main/ctype_uca.result +++ b/mysql-test/main/ctype_uca.result @@ -6233,6 +6233,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8_unicode_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result index dee9da3ce87..9d88ba93153 100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@ -840,6 +840,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +ucs2_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; @@ -1089,6 +1095,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +ucs2_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); diff --git a/mysql-test/main/ctype_ujis.result b/mysql-test/main/ctype_ujis.result index a1fcce33bbb..8d01212c9b1 100644 --- a/mysql-test/main/ctype_ujis.result +++ b/mysql-test/main/ctype_ujis.result @@ -2327,6 +2327,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +ujis_japanese_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); @@ -2462,6 +2468,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +ujis_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 AS SELECT 10 AS a, REPEAT('a',20) AS b, REPEAT('a',8) AS c, REPEAT('a',8) AS d; ALTER TABLE t1 ADD PRIMARY KEY(a), ADD KEY(b); diff --git a/mysql-test/main/ctype_utf16.result b/mysql-test/main/ctype_utf16.result index fb7ae1f62bb..3ad7baadae3 100644 --- a/mysql-test/main/ctype_utf16.result +++ b/mysql-test/main/ctype_utf16.result @@ -669,6 +669,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf16_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 SET NAMES latin1; SET collation_connection='utf16_bin'; create table t1 select repeat('a',4000) a; @@ -806,6 +812,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf16_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 select hex(substr(_utf16 0x00e400e50068,1)); hex(substr(_utf16 0x00e400e50068,1)) 00E400E50068 diff --git a/mysql-test/main/ctype_utf16_uca.result b/mysql-test/main/ctype_utf16_uca.result index 0cb9c4c74c1..de7852f9a41 100644 --- a/mysql-test/main/ctype_utf16_uca.result +++ b/mysql-test/main/ctype_utf16_uca.result @@ -2952,6 +2952,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf16_unicode_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; diff --git a/mysql-test/main/ctype_utf16le.result b/mysql-test/main/ctype_utf16le.result index ba7a2383671..a9e5cd5a417 100644 --- a/mysql-test/main/ctype_utf16le.result +++ b/mysql-test/main/ctype_utf16le.result @@ -713,6 +713,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf16le_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 SET NAMES utf8, collation_connection='utf16le_bin'; create table t1 select repeat('a',4000) a; delete from t1; @@ -849,6 +855,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf16le_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 # # Bug#10344 Some string functions fail for UCS2 # diff --git a/mysql-test/main/ctype_utf32.result b/mysql-test/main/ctype_utf32.result index 47e739df290..7bab78a10bf 100644 --- a/mysql-test/main/ctype_utf32.result +++ b/mysql-test/main/ctype_utf32.result @@ -668,6 +668,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf32_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 SET NAMES latin1; SET collation_connection='utf32_bin'; create table t1 select repeat('a',4000) a; @@ -805,6 +811,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf32_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 select hex(substr(_utf32 0x000000e4000000e500000068,1)); hex(substr(_utf32 0x000000e4000000e500000068,1)) 000000E4000000E500000068 diff --git a/mysql-test/main/ctype_utf32_uca.result b/mysql-test/main/ctype_utf32_uca.result index a112918c0c3..da23fa30ab4 100644 --- a/mysql-test/main/ctype_utf32_uca.result +++ b/mysql-test/main/ctype_utf32_uca.result @@ -2952,6 +2952,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf32_unicode_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result index 6a72f60a437..a1f5537a8d7 100644 --- a/mysql-test/main/ctype_utf8.result +++ b/mysql-test/main/ctype_utf8.result @@ -1032,6 +1032,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; @@ -1263,6 +1269,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 ( user varchar(255) NOT NULL default '' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; diff --git a/mysql-test/main/ctype_utf8mb4.result b/mysql-test/main/ctype_utf8mb4.result index fac15a5a2cd..911108bf74a 100644 --- a/mysql-test/main/ctype_utf8mb4.result +++ b/mysql-test/main/ctype_utf8mb4.result @@ -1032,6 +1032,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; @@ -1284,6 +1290,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 ( user varchar(255) NOT NULL default '' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; diff --git a/mysql-test/main/ctype_utf8mb4_heap.result b/mysql-test/main/ctype_utf8mb4_heap.result index 85668451181..18213e65166 100644 --- a/mysql-test/main/ctype_utf8mb4_heap.result +++ b/mysql-test/main/ctype_utf8mb4_heap.result @@ -971,6 +971,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; @@ -1183,6 +1189,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 ( user varchar(255) NOT NULL default '' ) ENGINE=heap DEFAULT CHARSET=latin1; diff --git a/mysql-test/main/ctype_utf8mb4_innodb.result b/mysql-test/main/ctype_utf8mb4_innodb.result index 82f0ddff1c4..baa22f0ffc4 100644 --- a/mysql-test/main/ctype_utf8mb4_innodb.result +++ b/mysql-test/main/ctype_utf8mb4_innodb.result @@ -1034,6 +1034,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; @@ -1246,6 +1252,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 ( user varchar(255) NOT NULL default '' ) ENGINE=InnoDB DEFAULT CHARSET=latin1; diff --git a/mysql-test/main/ctype_utf8mb4_myisam.result b/mysql-test/main/ctype_utf8mb4_myisam.result index 0bd13ef0282..67eef5856ec 100644 --- a/mysql-test/main/ctype_utf8mb4_myisam.result +++ b/mysql-test/main/ctype_utf8mb4_myisam.result @@ -1037,6 +1037,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_general_ci +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 "BEGIN ctype_german.inc" drop table if exists t1; create table t1 as select repeat(' ', 64) as s1; @@ -1249,6 +1255,12 @@ select c1 as c2h from t1 where c1 like 'ab#_def' escape '#'; c2h ab_def drop table t1; +SELECT @@collation_connection; +@@collation_connection +utf8mb4_bin +SELECT '\%b' LIKE '%\%'; +'\%b' LIKE '%\%' +0 CREATE TABLE t1 ( user varchar(255) NOT NULL default '' ) ENGINE=MyISAM DEFAULT CHARSET=latin1; diff --git a/mysql-test/main/ddl_i18n_koi8r.result b/mysql-test/main/ddl_i18n_koi8r.result index f6e44a14f9d..612a4a4cbff 100644 --- a/mysql-test/main/ddl_i18n_koi8r.result +++ b/mysql-test/main/ddl_i18n_koi8r.result @@ -2183,6 +2183,8 @@ COLLATION(_utf8 'текÑÑ‚') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT ev2 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO BEGIN @@ -2195,6 +2197,8 @@ COLLATION(_utf8 'текÑÑ‚') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO BEGIN @@ -2207,6 +2211,8 @@ COLLATION(_utf8 'текÑÑ‚') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO BEGIN @@ -2219,6 +2225,8 @@ COLLATION(_utf8 'текÑÑ‚') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. diff --git a/mysql-test/main/ddl_i18n_utf8.result b/mysql-test/main/ddl_i18n_utf8.result index 2021a552f69..2be5413f182 100644 --- a/mysql-test/main/ddl_i18n_utf8.result +++ b/mysql-test/main/ddl_i18n_utf8.result @@ -2183,6 +2183,8 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT ev2 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO BEGIN @@ -2195,6 +2197,8 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT mysqltest2.ev3 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO BEGIN @@ -2207,6 +2211,8 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT mysqltest2.ev4 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO BEGIN @@ -2219,6 +2225,8 @@ COLLATION(_koi8r 'ÔÅËÓÔ') AS c4, @@collation_connection AS c5, @@character_set_client AS c6; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result index 8086c4480f6..fa1cf8c0373 100644 --- a/mysql-test/main/derived_cond_pushdown.result +++ b/mysql-test/main/derived_cond_pushdown.result @@ -10517,6 +10517,56 @@ a b max_d c 1 2 3 1 5 6 1 5 DROP TABLE t1,t2; +# +# MDEV-19139: pushdown condition with Item_func_set_user_var +# +CREATE TABLE t1 (a INT, b INT); +CREATE VIEW v1 AS SELECT a, MAX(b) FROM t1 GROUP BY a; +SELECT * FROM (SELECT 1 FROM v1 UNION (SELECT 1 FROM v1 WHERE @a := uuid())) dt; +1 +EXPLAIN FORMAT=JSON +SELECT * FROM (SELECT 1 FROM v1 UNION (SELECT 1 FROM v1 WHERE @a := uuid())) dt; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "<derived2>", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "union_result": { + "table_name": "<union2,3>", + "access_type": "ALL", + "query_specifications": [ + { + "query_block": { + "select_id": 2, + "table": { + "message": "no matching row in const table" + } + } + }, + { + "query_block": { + "select_id": 3, + "operation": "UNION", + "table": { + "message": "no matching row in const table" + } + } + } + ] + } + } + } + } + } +} +DROP TABLE t1; +DROP VIEW v1; # End of 10.2 tests # # MDEV-14579: pushdown conditions into materialized views/derived tables diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test index c6c8c26271f..2d683f06023 100644 --- a/mysql-test/main/derived_cond_pushdown.test +++ b/mysql-test/main/derived_cond_pushdown.test @@ -2124,6 +2124,20 @@ WHERE t1.a=tab.c AND DROP TABLE t1,t2; +--echo # +--echo # MDEV-19139: pushdown condition with Item_func_set_user_var +--echo # + +CREATE TABLE t1 (a INT, b INT); +CREATE VIEW v1 AS SELECT a, MAX(b) FROM t1 GROUP BY a; + +SELECT * FROM (SELECT 1 FROM v1 UNION (SELECT 1 FROM v1 WHERE @a := uuid())) dt; +EXPLAIN FORMAT=JSON +SELECT * FROM (SELECT 1 FROM v1 UNION (SELECT 1 FROM v1 WHERE @a := uuid())) dt; + +DROP TABLE t1; +DROP VIEW v1; + --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/events_1.result b/mysql-test/main/events_1.result index 6f3ad654810..26611abb880 100644 --- a/mysql-test/main/events_1.result +++ b/mysql-test/main/events_1.result @@ -13,7 +13,11 @@ USE db_x; CREATE TABLE x_table(a int); connect priv_conn,localhost,pauline,,db_x; CREATE EVENT e_x1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE db_x; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e_x2 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE x_table; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. connection default; SHOW DATABASES LIKE 'db_x'; Database (db_x) @@ -39,6 +43,8 @@ drop event if exists event1; Warnings: Note 1305 Event event1 does not exist create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. alter event event1 rename to event2 enable; alter event event2 disable; alter event event2 enable; @@ -47,8 +53,12 @@ alter event event2 on schedule every 1 year on completion preserve rename to eve alter event event3 rename to event2; drop event event2; create event event2 on schedule every 2 second starts now() ends date_add(now(), interval 5 hour) comment "some" DO begin end; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. drop event event2; CREATE EVENT event_starts_test ON SCHEDULE EVERY 10 SECOND COMMENT "" DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT interval_field, interval_value, body FROM mysql.event WHERE db='events_test' AND name='event_starts_test'; interval_field interval_value body SECOND 10 SELECT 1 @@ -69,6 +79,8 @@ execute_at IS NULL starts IS NULL ends IS NULL comment 0 1 1 DROP EVENT event_starts_test; CREATE EVENT event_starts_test ON SCHEDULE EVERY 20 SECOND STARTS '1970-01-02 00:00:00' ENDS '1970-01-03 00:00:00' ON COMPLETION PRESERVE DISABLE DO SELECT 2; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test'; execute_at IS NULL starts IS NULL ends IS NULL comment 1 0 0 @@ -83,6 +95,8 @@ execute_at IS NULL starts IS NULL ends IS NULL comment DROP EVENT event_starts_test; create table test_nested(a int); create event e_43 on schedule every 1 second do set @a = 5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. alter event e_43 do alter event e_43 do set @a = 4; ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present alter event e_43 do @@ -111,6 +125,8 @@ alter event non_existant rename to non_existant_too; ERROR HY000: Unknown event 'non_existant' set global event_scheduler = off; create event existant on schedule at now() + interval 1 year do select 12; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. alter event non_existant rename to existant; ERROR HY000: Event 'existant' already exists alter event existant rename to events_test.existant; @@ -121,6 +137,8 @@ drop event if exists event3; Warnings: Note 1305 Event event3 does not exist create event event3 on schedule every 50 + 10 minute starts date_add(curdate(), interval 5 minute) ends date_add(curdate(), interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand()); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select count(*) from t_event3; count(*) 0 @@ -128,79 +146,117 @@ drop event event3; drop table t_event3; set names utf8; CREATE EVENT root6 ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root6; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root6 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root6` ON SCHEDULE EVERY '10:20' MINUTE_SECOND STARTS '#' ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root7 on schedule every 2 year do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root7; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root7 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root7` ON SCHEDULE EVERY 2 YEAR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root8 on schedule every '2:5' year_month do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root8; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root8 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root8` ON SCHEDULE EVERY '2-5' YEAR_MONTH STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root8_1 on schedule every '2:15' year_month do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root8_1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root8_1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root8_1` ON SCHEDULE EVERY '3-3' YEAR_MONTH STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root9 on schedule every 2 week ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root9; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root9 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root9` ON SCHEDULE EVERY 2 WEEK STARTS '#' ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root10 on schedule every '20:5' day_hour do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root10; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root10 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root10` ON SCHEDULE EVERY '20 5' DAY_HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root11 on schedule every '20:25' day_hour do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root11; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root11 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root11` ON SCHEDULE EVERY '21 1' DAY_HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root12 on schedule every '20:25' hour_minute do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root12; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root12 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root12` ON SCHEDULE EVERY '20:25' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root13 on schedule every '25:25' hour_minute do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root13; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root13 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root13` ON SCHEDULE EVERY '25:25' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root13_1 on schedule every '11:65' hour_minute do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root13_1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root13_1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root13_1` ON SCHEDULE EVERY '12:5' HOUR_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root14 on schedule every '35:35' minute_second do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root14; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root14 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root14` ON SCHEDULE EVERY '35:35' MINUTE_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root15 on schedule every '35:66' minute_second do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root15; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root15 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root15` ON SCHEDULE EVERY '36:6' MINUTE_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root16 on schedule every '35:56' day_minute do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root16; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root16 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root16` ON SCHEDULE EVERY '1 11:56' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root17 on schedule every '35:12:45' day_minute do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root17; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root17 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root17` ON SCHEDULE EVERY '35 12:45' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root17_1 on schedule every '35:25:65' day_minute do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root17_1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root17_1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root17_1` ON SCHEDULE EVERY '36 2:5' DAY_MINUTE STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root18 on schedule every '35:12:45' hour_second do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root18; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root18 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root18` ON SCHEDULE EVERY '35:12:45' HOUR_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root19 on schedule every '15:59:85' hour_second do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root19; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root19 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root19` ON SCHEDULE EVERY '16:0:25' HOUR_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci create event root20 on schedule every '50:20:12:45' day_second do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT root20; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation root20 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `root20` ON SCHEDULE EVERY '50 20:12:45' DAY_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci set names cp1251; create event ðóóò21 on schedule every '50:23:59:95' day_second COMMENT 'òîâà å 1251 êîìåíòàð' do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW CREATE EVENT ðóóò21; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation ðóóò21 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `руут21` ON SCHEDULE EVERY '51 0:0:35' DAY_SECOND STARTS '#' ON COMPLETION NOT PRESERVE ENABLE COMMENT 'това е 1251 коментар' DO select 1 cp1251 cp1251_general_ci latin1_swedish_ci @@ -260,6 +316,8 @@ set names latin1; Create a test event. Only event metadata is relevant, the actual schedule and body are not. CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing"; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation events_test intact_check root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -306,6 +364,8 @@ SET GLOBAL event_scheduler=OFF; ALTER TABLE mysql.event DROP dummy; DROP EVENT intact_check; CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing"; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. Now let's add a column to the first position: the server expects to see event schema name there @@ -349,6 +409,8 @@ Clean up ALTER TABLE mysql.event DROP dummy; DELETE FROM mysql.event; CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing"; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. Back up the table, further changes are not reversible CREATE TABLE event_like LIKE mysql.event; INSERT INTO event_like SELECT * FROM mysql.event; @@ -447,6 +509,8 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E # CREATE EVENT ev1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. ALTER EVENT ev1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8; CREATE TABLE event_original LIKE mysql.event; @@ -480,6 +544,8 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E # CREATE TABLE t1 (a INT); CREATE EVENT ev1 ON SCHEDULE EVERY 5 SECOND DO DELETE FROM t1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation events_test ev1 root@localhost SYSTEM RECURRING NULL 5 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -489,6 +555,8 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E events_test ev1 root@localhost SYSTEM RECURRING NULL 5 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci DROP EVENT ev1; CREATE EVENT ev1 ON SCHEDULE EVERY 5 SECOND DO DELETE FROM t1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation events_test ev1 root@localhost SYSTEM RECURRING NULL 5 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci diff --git a/mysql-test/main/events_2.result b/mysql-test/main/events_2.result index 6d2ebda03d0..6dd1a9e5dc6 100644 --- a/mysql-test/main/events_2.result +++ b/mysql-test/main/events_2.result @@ -3,6 +3,8 @@ drop database if exists events_test; create database events_test; use events_test; create event e_26 on schedule at '2037-01-01 00:00:00' disable do set @a = 5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event; db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion events_test e_26 set @a = 5 root@localhost 2037-01-01 00:00:00 DROP @@ -13,6 +15,8 @@ create event e_26 on schedule at 'definitely not a datetime' disable do set @a = ERROR HY000: Incorrect AT value: 'definitely not a datetime' set names utf8; create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. drop event задачка; "DISABLE the scheduler. Testing that it does not work when the variable is 0" set global event_scheduler=off; @@ -22,6 +26,8 @@ select get_lock("test_lock1", 20); get_lock("test_lock1", 20) 1 create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. "Should return 1 row" select definer, name, db from mysql.event; definer name db @@ -94,22 +100,30 @@ on schedule every 10 hour disable do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space'; event_schema event_name definer event_definition events_test white_space root@localhost select 1 drop event white_space; create event white_space on schedule every 10 hour disable do select 2; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space'; event_schema event_name definer event_definition events_test white_space root@localhost select 2 drop event white_space; create event white_space on schedule every 10 hour disable do select 3; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space'; event_schema event_name definer event_definition events_test white_space root@localhost select 3 drop event white_space; create event e1 on schedule every 1 year do set @a = 5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. create table t1 (s1 int); create trigger t1_ai after insert on t1 for each row show create event e1; ERROR 0A000: Not allowed to return a result set from a trigger @@ -126,6 +140,8 @@ LOCK TABLES mode. create table t1 (a int); create event e1 on schedule every 10 hour do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. lock table t1 read; show create event e1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation @@ -229,6 +245,8 @@ Events in sub-statements, events and prelocking create event e1 on schedule every 10 hour do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. create function f1() returns int begin show create event e1; @@ -321,6 +339,8 @@ drop table t1| drop event e1| set names utf8; create event имÑ_ÑобытиÑ_в_кодировке_утф8_длиной_больше_чем_48 on schedule every 2 year do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select EVENT_NAME from information_schema.events where event_schema='test'; EVENT_NAME @@ -333,6 +353,8 @@ create event event_35981 on schedule every 6 month on completion preserve disable do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. The following SELECTs should all give 1 select count(*) from information_schema.events where event_schema = database() and event_name = 'event_35981' and @@ -367,6 +389,8 @@ drop event event_35981; create event event_35981 on schedule every 6 month disable do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select count(*) from information_schema.events where event_schema = database() and event_name = 'event_35981' and on_completion = 'NOT PRESERVE'; @@ -377,6 +401,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp on completion not preserve do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00' ends '1999-01-02 00:00:00'; ERROR HY000: Event execution time is in the past and ON COMPLETION NOT PRESERVE is set. The event was not changed. Specify a time in the future @@ -385,6 +411,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp on completion not preserve do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00' ends '1999-01-02 00:00:00' on completion preserve; Warnings: @@ -394,6 +422,8 @@ create event event_35981 on schedule every 1 hour starts current_timestamp on completion preserve do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. alter event event_35981 on schedule every 1 hour starts '1999-01-01 00:00:00' ends '1999-01-02 00:00:00'; Warnings: diff --git a/mysql-test/main/events_bugs.result b/mysql-test/main/events_bugs.result index 3e770451735..008d4db7dae 100644 --- a/mysql-test/main/events_bugs.result +++ b/mysql-test/main/events_bugs.result @@ -11,16 +11,22 @@ VARIABLE_NAME VARIABLE_VALUE EVENT_SCHEDULER ON SET GLOBAL event_scheduler = 'OFF'; CREATE EVENT lower_case ON SCHEDULE EVERY 1 MINUTE DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT Lower_case ON SCHEDULE EVERY 2 MINUTE DO SELECT 2; ERROR HY000: Event 'Lower_case' already exists DROP EVENT Lower_case; SET NAMES cp1251; CREATE EVENT äîëåí_ðåãèñòúð_1251 ON SCHEDULE EVERY 1 YEAR DO SELECT 100; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT ÄîËåÍ_ðåãèñòúð_1251 ON SCHEDULE EVERY 2 YEAR DO SELECT 200; ERROR HY000: Event 'ÄîËåÍ_ðåãèñòúð_1251' already exists DROP EVENT ÄîËåÍ_ðåãèñòúð_1251; SET NAMES utf8; CREATE EVENT долен_региÑÑ‚ÑŠÑ€_утф8 ON SCHEDULE EVERY 3 YEAR DO SELECT 300; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT ДОЛЕÐ_региÑÑ‚ÑŠÑ€_утф8 ON SCHEDULE EVERY 4 YEAR DO SELECT 400; ERROR HY000: Event 'ДОЛЕÐ_региÑÑ‚ÑŠÑ€_утф8' already exists DROP EVENT ДОЛЕÐ_региÑÑ‚ÑŠÑ€_утф8; @@ -205,6 +211,8 @@ create database mysqltest_db1; grant event on events_test.* to mysqltest_user1@localhost; connect conn2,localhost,mysqltest_user1,,events_test; create event mysqltest_user1 on schedule every 10 second do select 42; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. alter event mysqltest_user1 rename to mysqltest_db1.mysqltest_user1; ERROR 42000: Access denied for user 'mysqltest_user1'@'localhost' to database 'mysqltest_db1' "Let's test now rename when there is no select DB" @@ -234,6 +242,8 @@ ERROR 42000: CREATE/ALTER EVENT does not support subqueries or stored functions drop event if exists e_16; drop procedure if exists p_16; create event e_16 on schedule every 1 second do set @a=5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. create procedure p_16 () alter event e_16 on schedule every @a second; set @a = null; call p_16(); @@ -347,11 +357,15 @@ DROP USER mysqltest_u1@localhost; CREATE USER mysqltest_u1@localhost; GRANT EVENT ON events_test.* TO mysqltest_u1@localhost; CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 root@localhost DROP EVENT e1; CREATE DEFINER=CURRENT_USER EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 root@localhost @@ -361,23 +375,31 @@ event_name definer e1 mysqltest_u1@localhost DROP EVENT e1; CREATE DEFINER=CURRENT_USER() EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 root@localhost DROP EVENT e1; CREATE DEFINER=mysqltest_u1@localhost EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 mysqltest_u1@localhost DROP EVENT e1; connect conn1, localhost, mysqltest_u1, , events_test; CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 mysqltest_u1@localhost DROP EVENT e1; CREATE DEFINER=CURRENT_USER EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 mysqltest_u1@localhost @@ -388,6 +410,8 @@ event_name definer e1 mysqltest_u1@localhost DROP EVENT e1; CREATE DEFINER=CURRENT_USER() EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, definer FROM INFORMATION_SCHEMA.EVENTS; event_name definer e1 mysqltest_u1@localhost @@ -404,6 +428,8 @@ SET @save_time_zone= @@TIME_ZONE; SET TIME_ZONE= '+00:00'; SET TIMESTAMP= UNIX_TIMESTAMP('2005-12-31 23:58:59'); CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation events_test e1 root@localhost +00:00 RECURRING NULL 1 DAY 2005-12-31 23:58:59 NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -433,14 +459,20 @@ DROP EVENT e1; SET TIME_ZONE='+05:00'; CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SET TIMESTAMP= @@TIMESTAMP + 1; SET TIME_ZONE='-05:00'; CREATE EVENT e2 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SET TIMESTAMP= @@TIMESTAMP + 1; SET TIME_ZONE='+00:00'; CREATE EVENT e3 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT * FROM INFORMATION_SCHEMA.EVENTS ORDER BY event_name; EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER TIME_ZONE EVENT_BODY EVENT_DEFINITION EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD SQL_MODE STARTS ENDS STATUS ON_COMPLETION CREATED LAST_ALTERED LAST_EXECUTED EVENT_COMMENT ORIGINATOR CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION def events_test e1 root@localhost +05:00 SQL SELECT 1 RECURRING NULL 1 DAY 2006-01-01 00:00:00 NULL ENABLED NOT PRESERVE 2005-12-31 23:58:59 2005-12-31 23:58:59 NULL 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -505,26 +537,34 @@ DO SELECT 1; Warnings: Note 1544 Event execution time is in the past. Event has been disabled +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e5 ON SCHEDULE AT '1999-01-01 00:00:00' ON COMPLETION PRESERVE DO SELECT 1; Warnings: Note 1544 Event execution time is in the past. Event has been disabled +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. The following should succeed without warnings. ALTER EVENT e2 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00'; ALTER EVENT e3 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE; CREATE EVENT e6 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e7 ON SCHEDULE EVERY 1 HOUR STARTS '1999-01-01 00:00:00' ENDS '1999-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e8 ON SCHEDULE AT '1999-01-01 00:00:00' ON COMPLETION PRESERVE DISABLE DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation events_test e1 root@localhost +00:00 RECURRING NULL 1 HOUR 1999-01-01 00:00:00 1999-01-02 00:00:00 DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -663,6 +703,8 @@ ERROR HY000: The MariaDB server is running with the --read-only option so it can connect root_con,localhost,root,,events_test; CREATE EVENT e1 ON SCHEDULE AT '2020-01-01 00:00:00' DO SET @a = 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. ALTER EVENT e1 COMMENT 'comment'; @@ -673,7 +715,11 @@ SET GLOBAL READ_ONLY = 0; connection u1_con; CREATE EVENT e1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND DO SET @a = 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO SET @a = 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, @@ -731,6 +777,8 @@ drop procedure if exists p; set @old_mode= @@sql_mode; set @@sql_mode= cast(pow(2,32)-1 as unsigned integer); create event e1 on schedule every 1 day do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. select @@sql_mode into @full_mode; set @@sql_mode= @old_mode; select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode; @@ -744,6 +792,8 @@ SELECT @@GLOBAL.server_id; @@GLOBAL.server_id 4294967295 CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT event_name, originator FROM INFORMATION_SCHEMA.EVENTS; event_name originator ev1 4294967295 @@ -752,6 +802,8 @@ SET GLOBAL server_id = @old_server_id; CREATE DATABASE event_test12; USE event_test12; CREATE EVENT ev1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE DATABASE event_test1; USE event_test1; SHOW EVENTS; @@ -801,6 +853,8 @@ DROP DATABASE IF EXISTS event_test11764334; CREATE DATABASE event_test11764334; USE event_test11764334; CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS IN event_test11764334 WHERE NAME='ev1'; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation event_test11764334 ev1 root@localhost SYSTEM RECURRING NULL 3 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci diff --git a/mysql-test/main/events_grant.result b/mysql-test/main/events_grant.result index cc7796975a6..c4f459dbe5b 100644 --- a/mysql-test/main/events_grant.result +++ b/mysql-test/main/events_grant.result @@ -1,6 +1,8 @@ CREATE DATABASE IF NOT EXISTS events_test; use events_test; CREATE EVENT one_event ON SCHEDULE EVERY 10 SECOND DO SELECT 123; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation events_test one_event root@localhost SYSTEM RECURRING NULL 10 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -38,7 +40,11 @@ Let's create some new events from the name of ev_test@localhost CREATE EVENT one_event ON SCHEDULE EVERY 20 SECOND DO SELECT 123; ERROR HY000: Event 'one_event' already exists CREATE EVENT two_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION NOT PRESERVE COMMENT "two event" DO SELECT 123; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT three_event ON SCHEDULE EVERY 20 SECOND ON COMPLETION PRESERVE COMMENT "three event" DO SELECT 123; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. "Now we should see 3 events:"; SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation @@ -58,6 +64,8 @@ GRANT EVENT ON events_test2.* TO ev_test@localhost; connection ev_con1; USE events_test2; CREATE EVENT four_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. connection default; USE events_test; "We should see 4 events : one_event, two_event, three_event & four_event" @@ -78,6 +86,8 @@ connection default; CREATE DATABASE events_test2; USE events_test2; CREATE EVENT five_event ON SCHEDULE EVERY 20 SECOND DO SELECT 42; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. connection ev_con1; "Should see 4 events - one, two, three & five" SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_DEFINITION, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT FROM INFORMATION_SCHEMA.EVENTS ORDER BY EVENT_SCHEMA, EVENT_NAME; diff --git a/mysql-test/main/events_restart.result b/mysql-test/main/events_restart.result index 0caac907f64..e22cfa011f2 100644 --- a/mysql-test/main/events_restart.result +++ b/mysql-test/main/events_restart.result @@ -6,10 +6,16 @@ use events_test; create table execution_log(name char(10)); create event abc1 on schedule every 1 second do insert into execution_log value('abc1'); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. create event abc2 on schedule every 1 second do insert into execution_log value('abc2'); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. create event abc3 on schedule every 1 second do insert into execution_log value('abc3'); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. create table event_like like mysql.event; insert into event_like select * from mysql.event; alter table mysql.event @@ -20,25 +26,25 @@ select @@event_scheduler; @@event_scheduler OFF show events; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled select event_name from information_schema.events; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled show create event intact_check; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled drop event no_such_event; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled create event intact_check_1 on schedule every 5 hour do select 5; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled alter event intact_check_1 on schedule every 8 hour do select 8; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled alter event intact_check_1 rename to intact_check_2; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled drop event intact_check_1; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled drop event intact_check_2; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled drop event intact_check; -ERROR HY000: Cannot proceed because system tables used by Event Scheduler were found damaged at server start +ERROR HY000: Cannot proceed, because event scheduler is disabled set global event_scheduler=on; ERROR HY000: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler. set global event_scheduler=off; diff --git a/mysql-test/main/events_stress.test b/mysql-test/main/events_stress.test index 8ea7633877b..080707f029f 100644 --- a/mysql-test/main/events_stress.test +++ b/mysql-test/main/events_stress.test @@ -21,6 +21,7 @@ GRANT ALL ON *.* TO event_user3@localhost; connect (conn2,localhost,event_user2,,events_conn2_db); --echo "In the second connection we create some events which won't be dropped till the end" --disable_query_log +--disable_warnings let $1= 50; while ($1) { diff --git a/mysql-test/main/events_trans.result b/mysql-test/main/events_trans.result index 873f0441089..a7b268fe2a7 100644 --- a/mysql-test/main/events_trans.result +++ b/mysql-test/main/events_trans.result @@ -15,6 +15,8 @@ create table t1 (a varchar(255)) engine=innodb; begin work; insert into t1 (a) values ("OK: create event"); create event e1 on schedule every 1 day do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. rollback work; select * from t1; a @@ -60,11 +62,14 @@ OK: drop event if exists delete from t1; commit work; create event e1 on schedule every 1 day do select 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. begin work; insert into t1 (a) values ("OK: create event if not exists"); create event if not exists e1 on schedule every 2 day do select 2; Warnings: Note 1537 Event 'e1' already exists +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. rollback work; select * from t1; a @@ -96,6 +101,8 @@ OK: alter event rename: rename to same name delete from t1; commit work; create event e2 on schedule every 3 day do select 3; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. begin work; insert into t1 (a) values ("OK: alter event rename: destination exists"); alter event e2 rename to e1; @@ -126,6 +133,8 @@ DROP EVENT IF EXISTS e1; CREATE TABLE t1 (a INT) ENGINE=InnoDB; CREATE TABLE t2 (a INT); CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. START TRANSACTION; INSERT INTO t1 VALUES (1); SAVEPOINT A; diff --git a/mysql-test/main/flush_read_lock.result b/mysql-test/main/flush_read_lock.result index 55c31ae8d12..47c46da05f1 100644 --- a/mysql-test/main/flush_read_lock.result +++ b/mysql-test/main/flush_read_lock.result @@ -85,6 +85,8 @@ insert into t1_temp values (1); return 0; end| create event e1 on schedule every 1 minute do begin end; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. connect con1,localhost,root,,; connect con2,localhost,root,,; connect con3,localhost,root,,; diff --git a/mysql-test/main/func_gconcat.result b/mysql-test/main/func_gconcat.result index 1701bb364e8..79011b4fc5e 100644 --- a/mysql-test/main/func_gconcat.result +++ b/mysql-test/main/func_gconcat.result @@ -1,4 +1,3 @@ -drop table if exists t1, t2; create table t1 (grp int, a bigint unsigned, c char(10) not null, d char(10) not null); insert into t1 values (1,1,"a","a"); insert into t1 values (2,2,"b","a"); @@ -1200,6 +1199,35 @@ Warning 1260 Row 3 was cut by GROUP_CONCAT() Warning 1260 Row 5 was cut by GROUP_CONCAT() DROP TABLE t1; SET group_concat_max_len= DEFAULT; +set session group_concat_max_len=1024; +set max_session_mem_used=16*1024*1024; +SELECT GROUP_CONCAT(concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1) ORDER BY 2,1,3,4,6,5,8,7) AS c +FROM seq_1_to_200000; +c +0.90910.90910.90910.90910.90910.90910.90910.9091,1.81821.81821.81821.81821.81821.81821.81821.8182,10.000010.000010.000010.000010.000010.000010.000010.0000,10.909110.909110.909110.909110.909110.909110.909110.9091,100.0000100.0000100.0000100.0000100.0000100.0000100.0000100.0000,100.9091100.9091100.9091100.9091100.9091100.9091100.9091100.9091,1000.00001000.00001000.00001000.00001000.00001000.00001000.00001000.0000,1000.90911000.90911000.90911000.90911000.90911000.90911000.90911000.9091,10000.000010000.000010000.000010000.000010000.000010000.000010000.000010000.0000,10000.909110000.909110000.909110000.909110000.909110000.909110000.909110000.9091,100000.0000100000.0000100000.0000100000.0000100000.0000100000.0000100000.0000100000.0000,100000.9091100000.9091100000.9091100000.9091100000.9091100000.9091100000.9091100000.9091,100001.8182100001.8182100001.8182100001.8182100001.8182100001.8182100001.8182100001.8182,100002.7273100002.7273100002.7273100002.7273100002.7273100002.7273100002.7273100002.7273,100003.6364100003. +Warnings: +Warning 1260 Row 15 was cut by GROUP_CONCAT() +set max_session_mem_used=default; +set session group_concat_max_len=default; +SET group_concat_max_len= 8; +CREATE TABLE t1 (a INT); +INSERT t1 VALUES (1),(2); +CREATE TABLE t2 (b DATE, c INT); +INSERT t2 VALUES ('2019-12-04',1),('2020-03-28',2); +CREATE TABLE t3 (d INT); +INSERT t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14); +CREATE TABLE t4 (e INT); +INSERT t4 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15); +SELECT (SELECT MAX(a) FROM t1 WHERE t2_sq.c > 0) AS f, +GROUP_CONCAT(t2_sq.b ORDER BY 1) AS gc +FROM (SELECT t2_a.* FROM t2 AS t2_a, t2 AS t2_b) AS t2_sq, t3, t4 +GROUP BY f; +f gc +2 2019-12- +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +DROP TABLE t1, t2, t3, t4; +SET group_concat_max_len= default; # # Start of 10.2 tests # diff --git a/mysql-test/main/func_gconcat.test b/mysql-test/main/func_gconcat.test index b8ab96bdea4..a76568bdae3 100644 --- a/mysql-test/main/func_gconcat.test +++ b/mysql-test/main/func_gconcat.test @@ -1,9 +1,7 @@ # # simple test of group_concat function # ---disable_warnings -drop table if exists t1, t2; ---enable_warnings +source include/have_sequence.inc; create table t1 (grp int, a bigint unsigned, c char(10) not null, d char(10) not null); insert into t1 values (1,1,"a","a"); @@ -874,6 +872,35 @@ SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 GROUP BY f2; DROP TABLE t1; SET group_concat_max_len= DEFAULT; +# +# MDEV-9531 GROUP_CONCAT with ORDER BY inside takes a lot of memory while it's executed +# +set session group_concat_max_len=1024; +set max_session_mem_used=16*1024*1024; # 8M..32M +SELECT GROUP_CONCAT(concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1), concat(seq/1.1) ORDER BY 2,1,3,4,6,5,8,7) AS c +FROM seq_1_to_200000; +set max_session_mem_used=default; +set session group_concat_max_len=default; + +# +# MDEV-19350 Server crashes in delete_tree_element / ... / Item_func_group_concat::repack_tree +# +SET group_concat_max_len= 8; +CREATE TABLE t1 (a INT); +INSERT t1 VALUES (1),(2); +CREATE TABLE t2 (b DATE, c INT); +INSERT t2 VALUES ('2019-12-04',1),('2020-03-28',2); +CREATE TABLE t3 (d INT); +INSERT t3 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14); +CREATE TABLE t4 (e INT); +INSERT t4 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15); +SELECT (SELECT MAX(a) FROM t1 WHERE t2_sq.c > 0) AS f, + GROUP_CONCAT(t2_sq.b ORDER BY 1) AS gc +FROM (SELECT t2_a.* FROM t2 AS t2_a, t2 AS t2_b) AS t2_sq, t3, t4 +GROUP BY f; +DROP TABLE t1, t2, t3, t4; +SET group_concat_max_len= default; + --echo # --echo # Start of 10.2 tests diff --git a/mysql-test/main/func_hybrid_type.result b/mysql-test/main/func_hybrid_type.result index 109f7a35038..c7ec29f1a49 100644 --- a/mysql-test/main/func_hybrid_type.result +++ b/mysql-test/main/func_hybrid_type.result @@ -3448,6 +3448,36 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # +# MDEV-11015 Assertion failed: precision > 0 in decimal_bin_size upon SELECT with DISTINCT, CAST and other functions +# +CREATE TABLE t1 (b LONGBLOB); +INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); +SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATETIME ) ) AS f FROM t1; +f +NULL +Warnings: +Warning 1292 Incorrect datetime value: 'foo' +Warning 1292 Incorrect datetime value: 'bar' +DROP TABLE t1; +CREATE TABLE t1 (b LONGBLOB); +INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); +SELECT DISTINCT - GREATEST( b, CAST( NULL AS TIME) ) AS f FROM t1; +f +NULL +Warnings: +Warning 1292 Truncated incorrect time value: 'foo' +Warning 1292 Truncated incorrect time value: 'bar' +DROP TABLE t1; +CREATE TABLE t1 (b LONGBLOB); +INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); +SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATE) ) AS f FROM t1; +f +NULL +Warnings: +Warning 1292 Incorrect datetime value: 'foo' +Warning 1292 Incorrect datetime value: 'bar' +DROP TABLE t1; +# # End of 10.1 tests # # diff --git a/mysql-test/main/func_hybrid_type.test b/mysql-test/main/func_hybrid_type.test index 223ae4b2166..9736485bb9f 100644 --- a/mysql-test/main/func_hybrid_type.test +++ b/mysql-test/main/func_hybrid_type.test @@ -458,6 +458,26 @@ EXECUTE stmt USING @a,@a; SHOW CREATE TABLE t1; DROP TABLE t1; + +--echo # +--echo # MDEV-11015 Assertion failed: precision > 0 in decimal_bin_size upon SELECT with DISTINCT, CAST and other functions +--echo # + +CREATE TABLE t1 (b LONGBLOB); +INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); +SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATETIME ) ) AS f FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (b LONGBLOB); +INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); +SELECT DISTINCT - GREATEST( b, CAST( NULL AS TIME) ) AS f FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (b LONGBLOB); +INSERT IGNORE INTO t1 VALUES ('foo'),('bar'); +SELECT DISTINCT - GREATEST( b, CAST( NULL AS DATE) ) AS f FROM t1; +DROP TABLE t1; + --echo # --echo # End of 10.1 tests --echo # diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index f1da28d10be..22cf0a5cc56 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -4972,6 +4972,44 @@ YQ== 61 Yq== 62 DROP TABLE t1; # +# MDEV-18738 ASAN heap-use-after-free in copy_if_not_alloced / copy_fields +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE( CAST( CURDATE() AS BINARY ), CURDATE(), REPEAT('a',32) ) AS f FROM t1 GROUP BY f; +f +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE( LEFT( CURDATE(), 4), LEFT(CURDATE(),4), REPEAT('a',32) ) AS f FROM t1 GROUP BY f; +f +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE(RIGHT(CURDATE(), 4), RIGHT(CURDATE(),4), REPEAT('a',32)) AS f FROM t1 GROUP BY f; +f +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE(SUBSTR(CURDATE(),2,3), SUBSTR(CURDATE(),2,3), REPEAT('a',32)) AS f FROM t1 GROUP BY f; +f +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa +DROP TABLE t1; +# +# MDEV-19359 ASAN heap-use-after-free in copy_if_not_alloced / make_sortkey +# +CREATE TABLE t1 (a INT, b TIME, c TIME); +INSERT INTO t1 VALUES (NULL,'22:56:45','22:56:45'),(4,'12:51:42','12:51:42'); +SELECT REPLACE( BINARY c, a, b ) f FROM t1 GROUP BY f WITH ROLLUP; +f +NULL +12:51:12:51:422 +NULL +DROP TABLE t1; +# # End of 10.1 tests # # diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test index 64aca38c115..c122516d756 100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@ -1945,6 +1945,42 @@ SELECT f1,HEX(f2) FROM t1 WHERE f1='YQ==' AND (f2= from_base64( SELECT f1,HEX(f2) FROM t1 WHERE f1='YQ==' AND (f2= from_base64("Yq==") OR f2= from_base64("YQ==")); DROP TABLE t1; + +--echo # +--echo # MDEV-18738 ASAN heap-use-after-free in copy_if_not_alloced / copy_fields +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE( CAST( CURDATE() AS BINARY ), CURDATE(), REPEAT('a',32) ) AS f FROM t1 GROUP BY f; +DROP TABLE t1; + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE( LEFT( CURDATE(), 4), LEFT(CURDATE(),4), REPEAT('a',32) ) AS f FROM t1 GROUP BY f; +DROP TABLE t1; + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE(RIGHT(CURDATE(), 4), RIGHT(CURDATE(),4), REPEAT('a',32)) AS f FROM t1 GROUP BY f; +DROP TABLE t1; + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT REPLACE(SUBSTR(CURDATE(),2,3), SUBSTR(CURDATE(),2,3), REPEAT('a',32)) AS f FROM t1 GROUP BY f; +DROP TABLE t1; + + +--echo # +--echo # MDEV-19359 ASAN heap-use-after-free in copy_if_not_alloced / make_sortkey +--echo # + +CREATE TABLE t1 (a INT, b TIME, c TIME); +INSERT INTO t1 VALUES (NULL,'22:56:45','22:56:45'),(4,'12:51:42','12:51:42'); +SELECT REPLACE( BINARY c, a, b ) f FROM t1 GROUP BY f WITH ROLLUP; +DROP TABLE t1; + + --echo # --echo # End of 10.1 tests --echo # diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index 0ee502d8f87..fb8919ef061 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -1865,6 +1865,20 @@ t2 CREATE TABLE `t2` ( `w2` int(1) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1,t2; +CREATE TABLE t1 ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +point_data POINT NOT NULL, +PRIMARY KEY (id), +KEY idx_point_data(point_data) +) ENGINE=MyISAM; +INSERT t1 (point_data) VALUES +(GeomFromText('Point(37.0248492 23.8512726)')), +(GeomFromText('Point(38.0248492 23.8512726)')); +SELECT id FROM t1 +WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); +id +2 +DROP TABLE t1; # # Start of 10.2 tests # @@ -2234,8 +2248,20 @@ SELECT c FROM t1; c 1 DROP TABLE t1; +create table t1 (p point default "qwer"); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +create table t1 (p point default 0); +ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field +create table t1 (p point not null default st_geometryfromtext('point 0)')); +ERROR 42000: Invalid default value for 'p' +create table t1 (p point not null default st_geometryfromtext('point(0 0)')); +insert into t1 values(default); +select st_astext(p) from t1; +st_astext(p) +POINT(0 0) +drop table t1; # -# Start of 10.3 tests +# End of 10.2 tests # # # MDEV-11478 Result data type aggregation for pluggable data types diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test index fbc130fcb7e..c4115f7ed54 100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@ -1572,6 +1572,25 @@ CREATE TABLE t2 AS SELECT WITHIN(g1,g1) as w1,WITHIN(g2,g2) AS w2 FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1,t2; + +# +# MDEV-3934 Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column +# + +CREATE TABLE t1 ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + point_data POINT NOT NULL, + PRIMARY KEY (id), + KEY idx_point_data(point_data) +) ENGINE=MyISAM; +INSERT t1 (point_data) VALUES + (GeomFromText('Point(37.0248492 23.8512726)')), + (GeomFromText('Point(38.0248492 23.8512726)')); +SELECT id FROM t1 +WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); +DROP TABLE t1; + + --echo # --echo # Start of 10.2 tests --echo # @@ -1762,8 +1781,22 @@ INSERT INTO t1 (a,b) VALUES (Point(1,1),Point(1,1)); SELECT c FROM t1; DROP TABLE t1; +# +# MDEV-13923 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon altering table with geometry field +# +--error ER_CANT_CREATE_GEOMETRY_OBJECT +create table t1 (p point default "qwer"); +--error ER_CANT_CREATE_GEOMETRY_OBJECT +create table t1 (p point default 0); +--error ER_INVALID_DEFAULT +create table t1 (p point not null default st_geometryfromtext('point 0)')); +create table t1 (p point not null default st_geometryfromtext('point(0 0)')); +insert into t1 values(default); +select st_astext(p) from t1; +drop table t1; + --echo # ---echo # Start of 10.3 tests +--echo # End of 10.2 tests --echo # --echo # diff --git a/mysql-test/main/gis2.result b/mysql-test/main/gis2.result deleted file mode 100644 index 6eb1c54e8d4..00000000000 --- a/mysql-test/main/gis2.result +++ /dev/null @@ -1,38 +0,0 @@ -CREATE TABLE t1 ( -id INT UNSIGNED NOT NULL AUTO_INCREMENT, -point_data POINT NOT NULL, -PRIMARY KEY (id), -KEY idx_point_data(point_data) -) ENGINE=MyISAM; -INSERT t1 (point_data) VALUES -(GeomFromText('Point(37.0248492 23.8512726)')), -(GeomFromText('Point(38.0248492 23.8512726)')); -SELECT id FROM t1 -WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); -id -2 -DROP TABLE t1; -create table t1 (p point default "qwer"); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field -create table t1 (p point default 0); -ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field -create table t1 (p point not null default st_geometryfromtext('point 0)')); -ERROR 42000: Invalid default value for 'p' -create table t1 (p point not null default st_geometryfromtext('point(0 0)')); -insert into t1 values(default); -select st_astext(p) from t1; -st_astext(p) -POINT(0 0) -drop table t1; -create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))); -set timestamp=10; -insert into t1 values(default); -ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`t1`.`p` at row 1 -drop table t1; -SET timestamp=default; -create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))); -set timestamp=10; -alter table t1 add column i int; -ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`t1`.`p` at row 1 -drop table t1; -SET timestamp=default; diff --git a/mysql-test/main/gis2.test b/mysql-test/main/gis2.test deleted file mode 100644 index 9731e2a91d0..00000000000 --- a/mysql-test/main/gis2.test +++ /dev/null @@ -1,45 +0,0 @@ -# -# MDEV-3934 Assertion `((keypart_map+1) & keypart_map) == 0' failed in _mi_pack_key with an index on a POINT column -# - -CREATE TABLE t1 ( - id INT UNSIGNED NOT NULL AUTO_INCREMENT, - point_data POINT NOT NULL, - PRIMARY KEY (id), - KEY idx_point_data(point_data) -) ENGINE=MyISAM; -INSERT t1 (point_data) VALUES - (GeomFromText('Point(37.0248492 23.8512726)')), - (GeomFromText('Point(38.0248492 23.8512726)')); -SELECT id FROM t1 -WHERE ST_Contains(point_data, GeomFromText('Point(38.0248492 23.8512726)')); -DROP TABLE t1; - -# -# MDEV-13923 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon altering table with geometry field -# ---error ER_CANT_CREATE_GEOMETRY_OBJECT -create table t1 (p point default "qwer"); ---error ER_CANT_CREATE_GEOMETRY_OBJECT -create table t1 (p point default 0); ---error ER_INVALID_DEFAULT -create table t1 (p point not null default st_geometryfromtext('point 0)')); -create table t1 (p point not null default st_geometryfromtext('point(0 0)')); -insert into t1 values(default); -select st_astext(p) from t1; -drop table t1; - -create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))); -set timestamp=10; ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD -insert into t1 values(default); -drop table t1; -SET timestamp=default; - -create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))); -set timestamp=10; ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD -alter table t1 add column i int; -drop table t1; -SET timestamp=default; - diff --git a/mysql-test/main/gis_notembedded.result b/mysql-test/main/gis_notembedded.result new file mode 100644 index 00000000000..64e90572bf0 --- /dev/null +++ b/mysql-test/main/gis_notembedded.result @@ -0,0 +1,45 @@ +show create procedure mysql.AddGeometryColumn; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +AddGeometryColumn CREATE DEFINER=`root`@`localhost` PROCEDURE `AddGeometryColumn`(catalog varchar(64), t_schema varchar(64), + t_name varchar(64), geometry_column varchar(64), t_srid int) + SQL SECURITY INVOKER +begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end latin1 latin1_swedish_ci latin1_swedish_ci +show create procedure mysql.DropGeometryColumn; +Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation +DropGeometryColumn CREATE DEFINER=`root`@`localhost` PROCEDURE `DropGeometryColumn`(catalog varchar(64), t_schema varchar(64), + t_name varchar(64), geometry_column varchar(64)) + SQL SECURITY INVOKER +begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end latin1 latin1_swedish_ci latin1_swedish_ci +create table t1 (a int, b int); +call mysql.AddGeometryColumn('', 'test', 't1', 'c', 10); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL, + `c` geometry DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +call mysql.DropGeometryColumn('', 'test', 't1', 'c'); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `b` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +call mysql.DropGeometryColumn('', 'test', 't1', 'b'); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +drop table t1; +create user foo@localhost; +grant execute on mysql.* to foo@localhost; +connect foo, localhost, foo; +call mysql.AddGeometryColumn('', 'mysql', 'proc', 'c', 10); +ERROR 42000: ALTER command denied to user 'foo'@'localhost' for table 'proc' +disconnect foo; +connection default; +drop user foo@localhost; diff --git a/mysql-test/main/gis_notembedded.test b/mysql-test/main/gis_notembedded.test new file mode 100644 index 00000000000..d25d6a7097e --- /dev/null +++ b/mysql-test/main/gis_notembedded.test @@ -0,0 +1,24 @@ +source include/not_embedded.inc; +# +# MDEV-60 Support for Spatial Reference systems for the GIS data. +# +show create procedure mysql.AddGeometryColumn; +show create procedure mysql.DropGeometryColumn; +create table t1 (a int, b int); +call mysql.AddGeometryColumn('', 'test', 't1', 'c', 10); +show create table t1; +call mysql.DropGeometryColumn('', 'test', 't1', 'c'); +show create table t1; +call mysql.DropGeometryColumn('', 'test', 't1', 'b'); +show create table t1; +drop table t1; + +create user foo@localhost; +grant execute on mysql.* to foo@localhost; +connect (foo, localhost, foo); +--error ER_TABLEACCESS_DENIED_ERROR +call mysql.AddGeometryColumn('', 'mysql', 'proc', 'c', 10); +disconnect foo; +connection default; +drop user foo@localhost; + diff --git a/mysql-test/main/grant4.result b/mysql-test/main/grant4.result index c3db2e03e3e..99f1131143e 100644 --- a/mysql-test/main/grant4.result +++ b/mysql-test/main/grant4.result @@ -129,6 +129,26 @@ connection default; disconnect con1; drop database mysqltest_db1; drop user mysqltest_u1@localhost; +call mtr.add_suppression("Table 'mysql.user' doesn't exist"); +call mtr.add_suppression("'mysql.user' is not of type 'TABLE'"); +rename table mysql.user to mysql.user1; +create view mysql.user as select * from mysql.user1; +flush privileges; +ERROR HY000: 'mysql.user' is not of type 'TABLE' +drop view mysql.user; +create temporary table mysql.user select * from mysql.user1 limit 0; +flush privileges; +ERROR 42S02: Table 'mysql.user' doesn't exist +drop temporary table mysql.user; +rename table mysql.user1 to mysql.user; +call mtr.add_suppression('mysql.user table is damaged'); +rename table mysql.user to mysql.user1; +create table mysql.user (Host char(100), User char(100)); +flush privileges; +ERROR HY000: Unknown error +drop table mysql.user; +rename table mysql.user1 to mysql.user; +End of 5.5 tests # # Additional coverage for refactoring which is made as part # of fix for bug #27480 "Extend CREATE TEMPORARY TABLES privilege @@ -224,3 +244,4 @@ ERROR HY000: Password hash should be a 16-digit hexadecimal number create user foo4 identified via mysql_old_password using '11111111111111111111111111111111111111111'; ERROR HY000: Password hash should be a 16-digit hexadecimal number set GLOBAL sql_mode=default; +End of 10.1 tests diff --git a/mysql-test/main/grant4.test b/mysql-test/main/grant4.test index 2715b7c7145..30f08f9eea2 100644 --- a/mysql-test/main/grant4.test +++ b/mysql-test/main/grant4.test @@ -145,6 +145,34 @@ disconnect con1; drop database mysqltest_db1; drop user mysqltest_u1@localhost; +# +# MDEV-18241 Downgrade from 10.4 to 10.3 crashes +# +call mtr.add_suppression("Table 'mysql.user' doesn't exist"); +call mtr.add_suppression("'mysql.user' is not of type 'TABLE'"); +rename table mysql.user to mysql.user1; +create view mysql.user as select * from mysql.user1; +--error ER_WRONG_OBJECT +flush privileges; +drop view mysql.user; +create temporary table mysql.user select * from mysql.user1 limit 0; +--error ER_NO_SUCH_TABLE +flush privileges; +drop temporary table mysql.user; +rename table mysql.user1 to mysql.user; + +# +# Bug#28986737: RENAMING AND REPLACING MYSQL.USER TABLE CAN LEAD TO A SERVER CRASH +# +call mtr.add_suppression('mysql.user table is damaged'); +rename table mysql.user to mysql.user1; +create table mysql.user (Host char(100), User char(100)); +--error ER_UNKNOWN_ERROR +flush privileges; +drop table mysql.user; +rename table mysql.user1 to mysql.user; + +--echo End of 5.5 tests --echo # --echo # Additional coverage for refactoring which is made as part @@ -233,5 +261,6 @@ create user foo3 identified via mysql_old_password using '00'; --error ER_PASSWD_LENGTH create user foo4 identified via mysql_old_password using '11111111111111111111111111111111111111111'; - set GLOBAL sql_mode=default; + +--echo End of 10.1 tests diff --git a/mysql-test/main/information_schema_prepare.result b/mysql-test/main/information_schema_prepare.result new file mode 100644 index 00000000000..3b5ee16b14b --- /dev/null +++ b/mysql-test/main/information_schema_prepare.result @@ -0,0 +1,4 @@ +PREPARE stmt2 FROM "CREATE VIEW v AS SELECT * FROM INFORMATION_SCHEMA.TABLES"; +FLUSH PRIVILEGES; +EXECUTE stmt2; +DROP VIEW v; diff --git a/mysql-test/main/information_schema_prepare.test b/mysql-test/main/information_schema_prepare.test new file mode 100644 index 00000000000..c5f3f89ff29 --- /dev/null +++ b/mysql-test/main/information_schema_prepare.test @@ -0,0 +1,7 @@ +# +# MDEV-15907 ASAN heap-use-after-free in strnmov / .. / fill_effective_table_privileges on concurrent GRANT and CREATE VIEW +# +PREPARE stmt2 FROM "CREATE VIEW v AS SELECT * FROM INFORMATION_SCHEMA.TABLES"; +FLUSH PRIVILEGES; +EXECUTE stmt2; +DROP VIEW v; diff --git a/mysql-test/main/lock_sync.result b/mysql-test/main/lock_sync.result index 7b61c5994b6..d017cf90cb8 100644 --- a/mysql-test/main/lock_sync.result +++ b/mysql-test/main/lock_sync.result @@ -729,7 +729,11 @@ disconnect con2; # Bug#51391 Deadlock involving events during rqg_info_schema test # CREATE EVENT e1 ON SCHEDULE EVERY 5 HOUR DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e2 ON SCHEDULE EVERY 5 HOUR DO SELECT 2; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. connect con1, localhost, root; SET DEBUG_SYNC="before_lock_tables_takes_lock SIGNAL drop WAIT_FOR query"; # Sending: diff --git a/mysql-test/main/mdev_19276.result b/mysql-test/main/mdev_19276.result new file mode 100644 index 00000000000..c1b822de6bf --- /dev/null +++ b/mysql-test/main/mdev_19276.result @@ -0,0 +1,11 @@ +CREATE DATABASE db1; +CREATE USER u@localhost IDENTIFIED BY 'pw'; +set global log_warnings=2; +connect(localhost,u,pw,db1,MASTER_PORT,MASTER_SOCKET); +connect con1,localhost,u,pw,db1; +ERROR 42000: Access denied for user 'u'@'localhost' to database 'db1' +connection default; +FOUND 1 /Access denied for user 'u'@'localhost' to database 'db1'/ in mysqld.1.err +set global log_warnings=@@log_warnings; +DROP DATABASE db1; +DROP USER u@localhost; diff --git a/mysql-test/main/mdev_19276.test b/mysql-test/main/mdev_19276.test new file mode 100644 index 00000000000..3e6b72a3f55 --- /dev/null +++ b/mysql-test/main/mdev_19276.test @@ -0,0 +1,17 @@ +source include/not_embedded.inc; + +CREATE DATABASE db1; +CREATE USER u@localhost IDENTIFIED BY 'pw'; +set global log_warnings=2; + +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_DBACCESS_DENIED_ERROR +--connect(con1,localhost,u,pw,db1) +--connection default +let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err; +let SEARCH_RANGE= -50; +let SEARCH_PATTERN=Access denied for user 'u'@'localhost' to database 'db1'; +source include/search_pattern_in_file.inc; +set global log_warnings=@@log_warnings; +DROP DATABASE db1; +DROP USER u@localhost; diff --git a/mysql-test/main/multi_update.result b/mysql-test/main/multi_update.result index c40de47668a..2cc85039e3a 100644 --- a/mysql-test/main/multi_update.result +++ b/mysql-test/main/multi_update.result @@ -940,6 +940,29 @@ execute stmt1; deallocate prepare stmt1; drop view v3,v2,v1; drop table t1,t2,t3; +create table t1 (id int not null, v1 varchar(10) not null); +insert into t1 values (1,1),(2,2); +create table t2 (log varchar(10) not null); +create trigger t1_after_update after update on t1 +for each row insert into t2 values ('triggered'); +create user foo; +grant select, insert, update, delete, create, drop, reload, index, alter, show databases, create temporary tables, lock tables, execute, create view, show view, create routine, alter routine, trigger on *.* to 'foo'@'%'; +set global read_only=1; +connect a, localhost, foo; +create temporary table temp_t1 (id int not null, update_me varchar(10)); +insert into temp_t1 values (1,1),(2,2),(3,3); +update temp_t1 left join t1 on temp_t1.id = t1.id set temp_t1.update_me = 'hello'; +connection default; +set global read_only = 0; +create table t3 (id int not null); +insert t3 values (2); +update t1 left join t3 on t1.id = t3.id set t1.v1 = 'hello'; +select * from t2; +log +triggered +triggered +drop table t1,t2, t3; +drop user foo; end of 5.5 tests create table t1 (c1 int, c3 int); insert t1(c3) values (1), (2), (3), (4), (5), (6), (7), (8); diff --git a/mysql-test/main/multi_update.test b/mysql-test/main/multi_update.test index 42e34d1e4a1..b6ad8bfcf52 100644 --- a/mysql-test/main/multi_update.test +++ b/mysql-test/main/multi_update.test @@ -899,6 +899,37 @@ deallocate prepare stmt1; drop view v3,v2,v1; drop table t1,t2,t3; + +# +# MDEV-18507 can't update temporary table when joined with table with triggers on read-only +# +create table t1 (id int not null, v1 varchar(10) not null); +insert into t1 values (1,1),(2,2); +create table t2 (log varchar(10) not null); +create trigger t1_after_update after update on t1 + for each row insert into t2 values ('triggered'); + +create user foo; +grant select, insert, update, delete, create, drop, reload, index, alter, show databases, create temporary tables, lock tables, execute, create view, show view, create routine, alter routine, trigger on *.* to 'foo'@'%'; + +set global read_only=1; +connect a, localhost, foo; + +create temporary table temp_t1 (id int not null, update_me varchar(10)); +insert into temp_t1 values (1,1),(2,2),(3,3); +update temp_t1 left join t1 on temp_t1.id = t1.id set temp_t1.update_me = 'hello'; + +connection default; +set global read_only = 0; + +create table t3 (id int not null); +insert t3 values (2); +update t1 left join t3 on t1.id = t3.id set t1.v1 = 'hello'; +select * from t2; + +drop table t1,t2, t3; +drop user foo; + --echo end of 5.5 tests # diff --git a/mysql-test/main/multi_update2-master.opt b/mysql-test/main/multi_update_big.opt index da78f987af3..da78f987af3 100644 --- a/mysql-test/main/multi_update2-master.opt +++ b/mysql-test/main/multi_update_big.opt diff --git a/mysql-test/main/multi_update2.result b/mysql-test/main/multi_update_big.result index 3712e638f40..3712e638f40 100644 --- a/mysql-test/main/multi_update2.result +++ b/mysql-test/main/multi_update_big.result diff --git a/mysql-test/main/multi_update2.test b/mysql-test/main/multi_update_big.test index a0f17fabec4..a0f17fabec4 100644 --- a/mysql-test/main/multi_update2.test +++ b/mysql-test/main/multi_update_big.test diff --git a/mysql-test/main/mysqldump-compat.result b/mysql-test/main/mysqldump-compat.result index f15cc7a1d7a..9a24ef2a3d1 100644 --- a/mysql-test/main/mysqldump-compat.result +++ b/mysql-test/main/mysqldump-compat.result @@ -2,3 +2,7 @@ CREATE DATABASE mysqldump_30126; USE mysqldump_30126; CREATE TABLE t1 (c1 int); DROP DATABASE mysqldump_30126; +use test; +create table t1 (a int); +create trigger tr after insert on t1 for each row set @a=1; +drop table t1; diff --git a/mysql-test/main/mysqldump-compat.test b/mysql-test/main/mysqldump-compat.test index 9a830b16f26..ae74a760953 100644 --- a/mysql-test/main/mysqldump-compat.test +++ b/mysql-test/main/mysqldump-compat.test @@ -15,3 +15,16 @@ CREATE TABLE t1 (c1 int); DROP DATABASE mysqldump_30126; --remove_file $file +use test; + +# +# MDEV-19182 mysqldump not always handling SHOW CREATE TRIGGER failures correctly +# +create table t1 (a int); +create trigger tr after insert on t1 for each row set @a=1; +let $datadir=`select @@datadir`; +move_file $datadir/test/tr.TRN $datadir/test/tr-1.TRN; +error 2; +exec $MYSQL_DUMP test t1 >/dev/null; +move_file $datadir/test/tr-1.TRN $datadir/test/tr.TRN; +drop table t1; diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result index 556245df9cd..812a095d1bb 100644 --- a/mysql-test/main/mysqldump.result +++ b/mysql-test/main/mysqldump.result @@ -4318,6 +4318,8 @@ create database first; use first; set time_zone = 'UTC'; create event ee1 on schedule at '2035-12-31 20:01:23' do set @a=5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. show events; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation first ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -4334,7 +4336,11 @@ show create event ee1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. show events; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -4471,6 +4477,8 @@ DROP DATABASE mysqldump_test_db; TRUNCATE mysql.event; USE test; CREATE event e29938 ON SCHEDULE AT '2035-12-31 20:01:23' DO SET @bug29938=29938; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation test e29938 root@localhost SYSTEM ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci @@ -4565,6 +4573,8 @@ CREATE TABLE t1 (f1 INT); CREATE TRIGGER tr1 BEFORE UPDATE ON t1 FOR EACH ROW SET @f1 = 1; CREATE PROCEDURE pr1 () SELECT "Meow"; CREATE EVENT ev1 ON SCHEDULE AT '2030-01-01 00:00:00' DO SELECT "Meow"; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation @@ -4755,7 +4765,11 @@ SELECT COUNT(*) INTO param1 FROM t2; END// # Events. CREATE EVENT e1 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e2 ON SCHEDULE EVERY 1 SECOND DO DROP DATABASE BUG52792; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. # Functions. CREATE FUNCTION `hello1` (s CHAR(20)) RETURNS CHAR(50) DETERMINISTIC @@ -5360,6 +5374,8 @@ one` BEFORE INSERT ON `tab one` FOR EACH ROW SET NEW.a = 1; CREATE EVENT `event one` ON SCHEDULE AT '2030-01-01 00:00:00' DO SET @a=5; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW TABLES FROM bug25717383; Tables_in_bug25717383 tab diff --git a/mysql-test/main/partition_innodb.result b/mysql-test/main/partition_innodb.result index cdfe619cb29..f3d24347ff9 100644 --- a/mysql-test/main/partition_innodb.result +++ b/mysql-test/main/partition_innodb.result @@ -928,6 +928,48 @@ DROP view v; DROP TABLE t; set sql_mode= @save_sql_mode; # +# Bug#28573894 ALTER PARTITIONED TABLE ADD AUTO_INCREMENT DIFF RESULT +# +CREATE TABLE t (a VARCHAR(10) NOT NULL,b INT,PRIMARY KEY (b)) ENGINE=INNODB +PARTITION BY RANGE (b) +(PARTITION pa VALUES LESS THAN (2), +PARTITION pb VALUES LESS THAN (20), +PARTITION pc VALUES LESS THAN (30), +PARTITION pd VALUES LESS THAN (40)); +INSERT INTO t +VALUES('A',0),('B',1),('C',2),('D',3),('E',4),('F',5),('G',25),('H',35); +CREATE TABLE t_copy LIKE t; +INSERT INTO t_copy SELECT * FROM t; +ALTER TABLE t ADD COLUMN r INT UNSIGNED NOT NULL AUTO_INCREMENT, +ADD UNIQUE KEY (r,b); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +ALTER TABLE t_copy ADD COLUMN r INT UNSIGNED NOT NULL AUTO_INCREMENT, +ADD UNIQUE KEY (r,b), ALGORITHM=COPY; +affected rows: 8 +info: Records: 8 Duplicates: 0 Warnings: 0 +SELECT * FROM t; +a b r +A 0 1 +B 1 2 +C 2 3 +D 3 4 +E 4 5 +F 5 6 +G 25 7 +H 35 8 +SELECT * FROM t_copy; +a b r +A 0 1 +B 1 2 +C 2 3 +D 3 4 +E 4 5 +F 5 6 +G 25 7 +H 35 8 +DROP TABLE t,t_copy; +# # Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE # MYSQL.INNODB_TABLE_STATS # diff --git a/mysql-test/main/partition_innodb.test b/mysql-test/main/partition_innodb.test index 57d644d293d..f1a25b91c5b 100644 --- a/mysql-test/main/partition_innodb.test +++ b/mysql-test/main/partition_innodb.test @@ -1021,6 +1021,31 @@ DROP TABLE t; set sql_mode= @save_sql_mode; --echo # +--echo # Bug#28573894 ALTER PARTITIONED TABLE ADD AUTO_INCREMENT DIFF RESULT +--echo # +CREATE TABLE t (a VARCHAR(10) NOT NULL,b INT,PRIMARY KEY (b)) ENGINE=INNODB +PARTITION BY RANGE (b) +(PARTITION pa VALUES LESS THAN (2), + PARTITION pb VALUES LESS THAN (20), + PARTITION pc VALUES LESS THAN (30), + PARTITION pd VALUES LESS THAN (40)); + +INSERT INTO t +VALUES('A',0),('B',1),('C',2),('D',3),('E',4),('F',5),('G',25),('H',35); +CREATE TABLE t_copy LIKE t; +INSERT INTO t_copy SELECT * FROM t; + +--enable_info +ALTER TABLE t ADD COLUMN r INT UNSIGNED NOT NULL AUTO_INCREMENT, +ADD UNIQUE KEY (r,b); +ALTER TABLE t_copy ADD COLUMN r INT UNSIGNED NOT NULL AUTO_INCREMENT, +ADD UNIQUE KEY (r,b), ALGORITHM=COPY; +--disable_info +SELECT * FROM t; +SELECT * FROM t_copy; +DROP TABLE t,t_copy; + +--echo # --echo # Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE --echo # MYSQL.INNODB_TABLE_STATS --echo # diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result index b0c7c7d9847..5145a50d273 100644 --- a/mysql-test/main/ps.result +++ b/mysql-test/main/ps.result @@ -2714,9 +2714,13 @@ create procedure proc_1() alter event xyz comment 'xyz'; call proc_1(); drop event xyz; create event xyz on schedule every 5 minute disable do select 123; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. call proc_1(); drop event xyz; create event xyz on schedule every 5 minute disable do select 123; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. call proc_1(); drop event xyz; drop procedure proc_1; @@ -2731,6 +2735,8 @@ create event xyz on schedule every 5 minute disable do select 123; create procedure proc_1() drop event xyz; call proc_1(); create event xyz on schedule every 5 minute disable do select 123; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. call proc_1(); call proc_1(); ERROR HY000: Unknown event 'xyz' @@ -4407,6 +4413,23 @@ END; 1 1 # +# MDEV-14572: Assertion `! is_set()' failed in +# Diagnostics_area::set_eof_status upon EXPLAIN UPDATE in PS +# +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +PREPARE stmt FROM 'EXPLAIN UPDATE t1, t2 SET a = 1'; +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found +EXECUTE stmt; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 system NULL NULL NULL NULL 0 Const row not found +1 SIMPLE t2 system NULL NULL NULL NULL 0 Const row not found +deallocate prepare stmt; +DROP TABLE t1, t2; +# # End of 10.1 tests # # diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test index 2b8a05094a6..685d528ecb9 100644 --- a/mysql-test/main/ps.test +++ b/mysql-test/main/ps.test @@ -3924,6 +3924,22 @@ END; / DELIMITER ;/ +--echo # +--echo # MDEV-14572: Assertion `! is_set()' failed in +--echo # Diagnostics_area::set_eof_status upon EXPLAIN UPDATE in PS +--echo # + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); + +#EXPLAIN UPDATE t1, t2 SET a = 1; +PREPARE stmt FROM 'EXPLAIN UPDATE t1, t2 SET a = 1'; +EXECUTE stmt; +EXECUTE stmt; +deallocate prepare stmt; + +# Cleanup +DROP TABLE t1, t2; --echo # --echo # End of 10.1 tests diff --git a/mysql-test/main/show_check.result b/mysql-test/main/show_check.result index 6a7afb80fae..1b9c1950668 100644 --- a/mysql-test/main/show_check.result +++ b/mysql-test/main/show_check.result @@ -809,6 +809,8 @@ create event e1 on schedule every 1 year starts now() ends date_add(now(), interval 5 hour) do begin end; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. flush status; show databases; show tables; @@ -1431,6 +1433,8 @@ CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET NEW.c1 = 'ÔÅÓÔ'; CREATE EVENT ev1 ON SCHEDULE AT '1970-01-02 00:00:00' ON COMPLETION PRESERVE DISABLE DO SELECT 'ÔÅÓÔ' AS test; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. set names utf8; SHOW CREATE VIEW v1; View Create View character_set_client collation_connection diff --git a/mysql-test/main/sp_notembedded.result b/mysql-test/main/sp_notembedded.result index d337d50e18a..fe95508cb9d 100644 --- a/mysql-test/main/sp_notembedded.result +++ b/mysql-test/main/sp_notembedded.result @@ -306,6 +306,8 @@ USE test; SET @@SQL_MODE = ''; CREATE EVENT teste_bug11763507 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT 1 $ +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS LIKE 'teste_bug11763507'; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation test teste_bug11763507 root@localhost SYSTEM ONE TIME # # # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci diff --git a/mysql-test/main/ssl_verify_ip.opt b/mysql-test/main/ssl_verify_ip.opt new file mode 100644 index 00000000000..7b1c308e46b --- /dev/null +++ b/mysql-test/main/ssl_verify_ip.opt @@ -0,0 +1,3 @@ +--loose-enable-ssl +--loose-ssl-cert=$MYSQL_TEST_DIR/std_data/serversan-cert.pem +--loose-ssl-key=$MYSQL_TEST_DIR/std_data/serversan-key.pem diff --git a/mysql-test/main/ssl_verify_ip.result b/mysql-test/main/ssl_verify_ip.result new file mode 100644 index 00000000000..98fb6a68656 --- /dev/null +++ b/mysql-test/main/ssl_verify_ip.result @@ -0,0 +1,4 @@ +1 +1 +1 +1 diff --git a/mysql-test/main/ssl_verify_ip.test b/mysql-test/main/ssl_verify_ip.test new file mode 100644 index 00000000000..2a2e780ecfc --- /dev/null +++ b/mysql-test/main/ssl_verify_ip.test @@ -0,0 +1,3 @@ +source include/have_ssl_crypto_functs.inc; +--exec $MYSQL --protocol=tcp --host=127.0.0.1 --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl --ssl-verify-server-cert -e "select 1" +--exec $MYSQL --protocol=tcp --host=localhost --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl --ssl-verify-server-cert -e "select 1" diff --git a/mysql-test/main/stat_tables.result b/mysql-test/main/stat_tables.result index 7fd0b5902ec..d224286056f 100644 --- a/mysql-test/main/stat_tables.result +++ b/mysql-test/main/stat_tables.result @@ -692,6 +692,24 @@ USE test; delete from mysql.table_stats; delete from mysql.column_stats; delete from mysql.index_stats; +# +# MDEV-19352: Server crash in alloc_histograms_for_table_share upon query from information schema +# +use test; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity= 4; +set use_stat_tables='preferably'; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +CREATE VIEW v AS SELECT * FROM t1 JOIN t2; +INSERT INTO t2 SELECT * FROM x; +ERROR 42S02: Table 'test.x' doesn't exist +select * from information_schema.tables where table_name='v'; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY +def test v VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL +drop table t1,t2; +drop view v; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; set @save_optimizer_switch=@@optimizer_switch; set use_stat_tables=@save_use_stat_tables; # diff --git a/mysql-test/main/stat_tables.test b/mysql-test/main/stat_tables.test index 93caa47ce79..ddf881c69ae 100644 --- a/mysql-test/main/stat_tables.test +++ b/mysql-test/main/stat_tables.test @@ -453,6 +453,27 @@ delete from mysql.table_stats; delete from mysql.column_stats; delete from mysql.index_stats; +--echo # +--echo # MDEV-19352: Server crash in alloc_histograms_for_table_share upon query from information schema +--echo # + +use test; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity= 4; +set use_stat_tables='preferably'; + +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +CREATE VIEW v AS SELECT * FROM t1 JOIN t2; +--error ER_NO_SUCH_TABLE +INSERT INTO t2 SELECT * FROM x; + +select * from information_schema.tables where table_name='v'; + +drop table t1,t2; +drop view v; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; + set @save_optimizer_switch=@@optimizer_switch; set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/main/stat_tables_innodb.result b/mysql-test/main/stat_tables_innodb.result index 2bc69c24104..1d7e1b8f1b6 100644 --- a/mysql-test/main/stat_tables_innodb.result +++ b/mysql-test/main/stat_tables_innodb.result @@ -719,6 +719,24 @@ USE test; delete from mysql.table_stats; delete from mysql.column_stats; delete from mysql.index_stats; +# +# MDEV-19352: Server crash in alloc_histograms_for_table_share upon query from information schema +# +use test; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity= 4; +set use_stat_tables='preferably'; +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +CREATE VIEW v AS SELECT * FROM t1 JOIN t2; +INSERT INTO t2 SELECT * FROM x; +ERROR 42S02: Table 'test.x' doesn't exist +select * from information_schema.tables where table_name='v'; +TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY +def test v VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL +drop table t1,t2; +drop view v; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; set @save_optimizer_switch=@@optimizer_switch; set use_stat_tables=@save_use_stat_tables; # diff --git a/mysql-test/main/statistics.result b/mysql-test/main/statistics.result index 34a17cf049c..267d9da965e 100644 --- a/mysql-test/main/statistics.result +++ b/mysql-test/main/statistics.result @@ -1735,6 +1735,20 @@ rename table t1 to t2, t3 to t4; ERROR 42S02: Table 'test.t3' doesn't exist drop table t1, mysql.table_stats; rename table test.table_stats to mysql.table_stats; +# +# MDEV-19334: bool is_eits_usable(Field*): Assertion `field->table->stats_is_read' failed. +# +create temporary table t1(a int); +insert into t1 values (1),(2),(3); +set use_stat_tables=preferably; +set @optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set optimizer_use_condition_selectivity=4; +select * from t1 where a >= 2; +a +2 +3 +drop table t1; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; # # Start of 10.2 tests diff --git a/mysql-test/main/statistics.test b/mysql-test/main/statistics.test index b2e544064b0..4c45b4f38b8 100644 --- a/mysql-test/main/statistics.test +++ b/mysql-test/main/statistics.test @@ -879,6 +879,21 @@ rename table t1 to t2, t3 to t4; drop table t1, mysql.table_stats; rename table test.table_stats to mysql.table_stats; +--echo # +--echo # MDEV-19334: bool is_eits_usable(Field*): Assertion `field->table->stats_is_read' failed. +--echo # + +create temporary table t1(a int); +insert into t1 values (1),(2),(3); + +set use_stat_tables=preferably; +set @optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set optimizer_use_condition_selectivity=4; + +select * from t1 where a >= 2; +drop table t1; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; + set use_stat_tables=@save_use_stat_tables; --echo # diff --git a/mysql-test/main/status2.result b/mysql-test/main/status2.result index 5805818fdf5..fa0fc4e1061 100644 --- a/mysql-test/main/status2.result +++ b/mysql-test/main/status2.result @@ -15,10 +15,10 @@ BEGIN SELECT 1; END $$ DROP TABLE IF EXISTS t1,t2; -CREATE TABLE t1 (c1 INT); -CREATE TABLE t2 (c1 INT); CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES(1); +CREATE TABLE t1 (c1 INT); +CREATE TABLE t2 (c1 INT); Assert Questions == 7 SHOW STATUS LIKE 'Questions'; Variable_name Value diff --git a/mysql-test/main/status2.test b/mysql-test/main/status2.test index 2d1541c54f2..fa3b718efaa 100644 --- a/mysql-test/main/status2.test +++ b/mysql-test/main/status2.test @@ -20,11 +20,11 @@ END $$ DELIMITER ;$$ --disable_warnings DROP TABLE IF EXISTS t1,t2; +CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND + DO INSERT INTO t1 VALUES(1); --enable_warnings CREATE TABLE t1 (c1 INT); CREATE TABLE t2 (c1 INT); -CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND - DO INSERT INTO t1 VALUES(1); --echo Assert Questions == 7 SHOW STATUS LIKE 'Questions'; diff --git a/mysql-test/main/timezone2.result b/mysql-test/main/timezone2.result index 096e996bffb..c4d13f6c678 100644 --- a/mysql-test/main/timezone2.result +++ b/mysql-test/main/timezone2.result @@ -332,3 +332,36 @@ NULL # # End of 5.3 tests # +# +# Start of 10.1 tests +# +# +# MDEV-11895 NO_ZERO_DATE affects timestamp values without any warnings +# +SET sql_mode = ''; +CREATE TABLE t1 (a TIMESTAMP NULL) ENGINE = MyISAM; +CREATE TABLE t2 (a TIMESTAMP NULL) ENGINE = MyISAM; +CREATE TABLE t3 (a TIMESTAMP NULL) ENGINE = MyISAM; +SET @@session.time_zone = 'UTC'; +INSERT INTO t1 VALUES ('2011-10-29 23:00:00'); +INSERT INTO t1 VALUES ('2011-10-29 23:00:01'); +INSERT INTO t1 VALUES ('2011-10-29 23:59:59'); +SET @@session.time_zone = 'Europe/Moscow'; +SET sql_mode='NO_ZERO_DATE'; +INSERT INTO t2 SELECT * FROM t1; +SET sql_mode=''; +INSERT INTO t3 SELECT * FROM t1; +SELECT UNIX_TIMESTAMP(a), a FROM t2; +UNIX_TIMESTAMP(a) a +1319929200 2011-10-30 02:00:00 +1319929201 2011-10-30 02:00:01 +1319932799 2011-10-30 02:59:59 +SELECT UNIX_TIMESTAMP(a), a FROM t3; +UNIX_TIMESTAMP(a) a +1319929200 2011-10-30 02:00:00 +1319929201 2011-10-30 02:00:01 +1319932799 2011-10-30 02:59:59 +DROP TABLE t1, t2, t3; +# +# End of 10.1 tests +# diff --git a/mysql-test/main/timezone2.test b/mysql-test/main/timezone2.test index 7a38610ad95..1e5615502da 100644 --- a/mysql-test/main/timezone2.test +++ b/mysql-test/main/timezone2.test @@ -308,3 +308,34 @@ SELECT CONVERT_TZ('2001-10-08 00:00:00', MAKE_SET(0,'+01:00'), '+00:00' ); --echo # --echo # End of 5.3 tests --echo # + +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-11895 NO_ZERO_DATE affects timestamp values without any warnings +--echo # + +SET sql_mode = ''; +CREATE TABLE t1 (a TIMESTAMP NULL) ENGINE = MyISAM; +CREATE TABLE t2 (a TIMESTAMP NULL) ENGINE = MyISAM; +CREATE TABLE t3 (a TIMESTAMP NULL) ENGINE = MyISAM; + +SET @@session.time_zone = 'UTC'; +INSERT INTO t1 VALUES ('2011-10-29 23:00:00'); +INSERT INTO t1 VALUES ('2011-10-29 23:00:01'); +INSERT INTO t1 VALUES ('2011-10-29 23:59:59'); + +SET @@session.time_zone = 'Europe/Moscow'; +SET sql_mode='NO_ZERO_DATE'; +INSERT INTO t2 SELECT * FROM t1; +SET sql_mode=''; +INSERT INTO t3 SELECT * FROM t1; +SELECT UNIX_TIMESTAMP(a), a FROM t2; +SELECT UNIX_TIMESTAMP(a), a FROM t3; +DROP TABLE t1, t2, t3; + +--echo # +--echo # End of 10.1 tests +--echo # diff --git a/mysql-test/main/type_bit.result b/mysql-test/main/type_bit.result index eeedc501dc4..7eaba70d7fa 100644 --- a/mysql-test/main/type_bit.result +++ b/mysql-test/main/type_bit.result @@ -831,6 +831,13 @@ COALESCE(val, 1) 0 DROP TABLE t1; # +# MDEV-18452 ASAN unknown-crash in Field::set_default upon SET bit_column = DEFAULT +# +CREATE TABLE t1 (b BIT(20)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (0); +UPDATE t1 SET b = DEFAULT; +DROP TABLE t1; +# # End of 10.1 tests # # diff --git a/mysql-test/main/type_bit.test b/mysql-test/main/type_bit.test index 04db1511833..012fa2236d7 100644 --- a/mysql-test/main/type_bit.test +++ b/mysql-test/main/type_bit.test @@ -460,6 +460,15 @@ SELECT COALESCE(val, 1) FROM t1; DROP TABLE t1; --echo # +--echo # MDEV-18452 ASAN unknown-crash in Field::set_default upon SET bit_column = DEFAULT +--echo # + +CREATE TABLE t1 (b BIT(20)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (0); +UPDATE t1 SET b = DEFAULT; +DROP TABLE t1; + +--echo # --echo # End of 10.1 tests --echo # diff --git a/mysql-test/main/view_grant.result b/mysql-test/main/view_grant.result index 82594128d85..6d22f93fd49 100644 --- a/mysql-test/main/view_grant.result +++ b/mysql-test/main/view_grant.result @@ -198,12 +198,15 @@ create table mysqltest.t1 (a int, b int, primary key(a)); insert into mysqltest.t1 values (10,2), (20,3), (30,4), (40,5), (50,10); create table mysqltest.t2 (x int); insert into mysqltest.t2 values (3), (4), (5), (6); +create table mysqltest.t3 (x int); +insert into mysqltest.t3 values (3), (4), (5), (6); create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1; create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1; create view mysqltest.v3 (a,c) as select a, b+1 from mysqltest.t1; create user mysqltest_1@localhost; grant update (a) on mysqltest.v2 to mysqltest_1@localhost; grant update on mysqltest.v1 to mysqltest_1@localhost; +grant update on mysqltest.t3 to mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost; connection user1; use mysqltest; @@ -239,6 +242,7 @@ a b 48 4 62 5 71 10 +update t3,v3 set t3.x=t3.x+v3.c where t3.x=v3.c; update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c; ERROR 42000: UPDATE command denied to user 'mysqltest_1'@'localhost' for column 'c' in table 'v2' update v2 set c=a+c; diff --git a/mysql-test/main/view_grant.test b/mysql-test/main/view_grant.test index a70241138aa..df4ca502dff 100644 --- a/mysql-test/main/view_grant.test +++ b/mysql-test/main/view_grant.test @@ -244,6 +244,8 @@ create table mysqltest.t1 (a int, b int, primary key(a)); insert into mysqltest.t1 values (10,2), (20,3), (30,4), (40,5), (50,10); create table mysqltest.t2 (x int); insert into mysqltest.t2 values (3), (4), (5), (6); +create table mysqltest.t3 (x int); +insert into mysqltest.t3 values (3), (4), (5), (6); create view mysqltest.v1 (a,c) as select a, b+1 from mysqltest.t1; create view mysqltest.v2 (a,c) as select a, b from mysqltest.t1; create view mysqltest.v3 (a,c) as select a, b+1 from mysqltest.t1; @@ -251,6 +253,7 @@ create view mysqltest.v3 (a,c) as select a, b+1 from mysqltest.t1; create user mysqltest_1@localhost; grant update (a) on mysqltest.v2 to mysqltest_1@localhost; grant update on mysqltest.v1 to mysqltest_1@localhost; +grant update on mysqltest.t3 to mysqltest_1@localhost; grant select on mysqltest.* to mysqltest_1@localhost; connection user1; @@ -265,6 +268,8 @@ update t2,v2 set v2.a=v2.a+v2.c where t2.x=v2.c; select * from t1; update v2 set a=a+c; select * from t1; +# update a table, select only on view +update t3,v3 set t3.x=t3.x+v3.c where t3.x=v3.c; # no rights on column --error ER_COLUMNACCESS_DENIED_ERROR update t2,v2 set v2.c=v2.a+v2.c where t2.x=v2.c; diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index 917fccaef21..b872e058c6c 100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@ -3518,6 +3518,95 @@ rank() OVER (ORDER BY 1) ROW_NUMBER() OVER (ORDER BY (EXPORT_SET(5,'Y','N',',',4 1 3 drop table t1; # +# MDEV-17781: Server crashes in next_linear_tab +# +CREATE TABLE t1 (i1 int); +explain +(SELECT AVG(0) OVER (), MAX('2') FROM t1) +UNION ALL +(SELECT AVG(0) OVER (), MAX('2') FROM t1); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used +2 UNION NULL NULL NULL NULL NULL NULL NULL No tables used +(SELECT AVG(0) OVER (), MAX('2') FROM t1) +UNION ALL +(SELECT AVG(0) OVER (), MAX('2') FROM t1); +AVG(0) OVER () MAX('2') +0.0000 NULL +0.0000 NULL +drop table t1; +# +# MDEV-14791: Crash with order by expression containing window functions +# +CREATE TABLE t1 (b1 int, b2 int); +INSERT INTO t1 VALUES (1,1),(0,0); +explain +SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1; +b1 +0 +1 +explain +SELECT b1 from t1 order by row_number() over (ORDER BY b2); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary; Using filesort +SELECT b1 from t1 order by row_number() over (ORDER BY b2); +b1 +0 +1 +DROP TABLE t1; +CREATE TABLE t1 (a int, b int, c int); +INSERT INTO t1 VALUES (2,3,207), (1,21,909), (7,13,312), (8,64,248); +explain +SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); +a b c +1 21 909 +2 3 207 +7 13 312 +8 64 248 +explain +SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c); +x b c +1 21 909 +2 3 207 +7 13 312 +8 64 248 +drop table t1; +# +# MDEV-18373: DENSE_RANK is not calculated correctly +# +create table t1 (a int, b int); +insert into t1 values (60, 1515),(60, 2000),(70, 2000),(55, 1600); +select b, dense_rank() over (order by sum(a)) from t1 group by b; +b dense_rank() over (order by sum(a)) +1515 2 +1600 1 +2000 3 +select b, dense_rank() over (order by sum(a)+1) from t1 group by b; +b dense_rank() over (order by sum(a)+1) +1515 2 +1600 1 +2000 3 +select b, row_number() over (partition by sum(a)) from t1 group by b; +b row_number() over (partition by sum(a)) +1515 1 +1600 1 +2000 1 +select b, row_number() over (partition by sum(a)+1) from t1 group by b; +b row_number() over (partition by sum(a)+1) +1515 1 +1600 1 +2000 1 +drop table t1; +# # End of 10.2 tests # # diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test index 81d3be19c10..16e8be5eb0a 100644 --- a/mysql-test/main/win.test +++ b/mysql-test/main/win.test @@ -2266,6 +2266,66 @@ SELECT rank() OVER (ORDER BY 1), ROW_NUMBER() OVER (ORDER BY (EXPORT_SET(5,'Y', drop table t1; --echo # +--echo # MDEV-17781: Server crashes in next_linear_tab +--echo # + +CREATE TABLE t1 (i1 int); +explain +(SELECT AVG(0) OVER (), MAX('2') FROM t1) +UNION ALL +(SELECT AVG(0) OVER (), MAX('2') FROM t1); +(SELECT AVG(0) OVER (), MAX('2') FROM t1) +UNION ALL +(SELECT AVG(0) OVER (), MAX('2') FROM t1); +drop table t1; + +--echo # +--echo # MDEV-14791: Crash with order by expression containing window functions +--echo # + +CREATE TABLE t1 (b1 int, b2 int); +INSERT INTO t1 VALUES (1,1),(0,0); + +explain +SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1; + +SELECT b1 from t1 order by row_number() over (ORDER BY b2) + 1; + +explain +SELECT b1 from t1 order by row_number() over (ORDER BY b2); + +SELECT b1 from t1 order by row_number() over (ORDER BY b2); +DROP TABLE t1; + +CREATE TABLE t1 (a int, b int, c int); +INSERT INTO t1 VALUES (2,3,207), (1,21,909), (7,13,312), (8,64,248); + +explain +SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); +SELECT * FROM t1 ORDER BY max(t1.a) over (partition by c); + +explain +SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c); +SELECT max(t1.a) over (partition by c) as x, b, c from t1 order by max(t1.a) over (partition by c); + +drop table t1; + +--echo # +--echo # MDEV-18373: DENSE_RANK is not calculated correctly +--echo # + +create table t1 (a int, b int); +insert into t1 values (60, 1515),(60, 2000),(70, 2000),(55, 1600); + +select b, dense_rank() over (order by sum(a)) from t1 group by b; +select b, dense_rank() over (order by sum(a)+1) from t1 group by b; + +select b, row_number() over (partition by sum(a)) from t1 group by b; +select b, row_number() over (partition by sum(a)+1) from t1 group by b; + +drop table t1; + +--echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index a166330d813..14dbb152111 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3197,6 +3197,10 @@ sub mysql_install_db { mtr_appendfile_to_file("$sql_dir/mysql_system_tables.sql", $bootstrap_sql_file); + my $gis_sp_path = $source_dist ? "$bindir/scripts" : $sql_dir; + mtr_appendfile_to_file("$gis_sp_path/maria_add_gis_sp_bootstrap.sql", + $bootstrap_sql_file); + # Add the performance tables # for a production system mtr_appendfile_to_file("$sql_dir/mysql_performance_tables.sql", diff --git a/mysql-test/std_data/serversan-cert.pem b/mysql-test/std_data/serversan-cert.pem index d40127365ca..41d5241a389 100644 --- a/mysql-test/std_data/serversan-cert.pem +++ b/mysql-test/std_data/serversan-cert.pem @@ -1,72 +1,72 @@ Certificate: Data: Version: 3 (0x2) - Serial Number: 4 (0x4) - Signature Algorithm: sha256WithRSAEncryption + Serial Number: 1 (0x1) + Signature Algorithm: sha256WithRSAEncryption Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB Validity - Not Before: Jan 27 10:11:15 2019 GMT - Not After : Jan 22 10:11:15 2039 GMT + Not Before: May 2 14:29:07 2019 GMT + Not After : Apr 27 14:29:07 2039 GMT Subject: C=FI, ST=Helsinki, L=Helsinki, O=MariaDB, CN=server Subject Public Key Info: Public Key Algorithm: rsaEncryption - Public-Key: (2048 bit) + RSA Public-Key: (2048 bit) Modulus: - 00:be:e7:9b:da:e1:bf:fe:e6:a4:6d:c2:20:8a:1f: - ea:8e:1a:a6:3f:57:93:75:d8:3b:80:55:bd:f3:fe: - c3:1e:50:0f:e9:66:0e:bf:98:98:5f:06:95:fc:4a: - 9a:b2:fc:7f:b1:e0:d9:ef:df:6c:28:d0:12:98:bf: - 78:b6:f4:1a:94:83:a0:3e:bc:d3:b3:02:4f:4a:96: - d9:30:b5:7c:5a:82:dd:ff:96:72:1c:f5:ad:80:bd: - ec:f7:fa:9c:40:e2:37:f5:86:b7:c6:b0:bb:6a:69: - 77:77:e1:2a:b1:03:bb:1e:bb:e8:b3:7a:2c:bf:a6: - c5:6b:4d:99:fb:f3:84:ec:ac:a9:2a:f3:f5:09:4e: - 5b:75:18:9c:68:f7:c9:2b:59:0b:41:33:60:23:fa: - d4:f8:64:e2:51:59:37:29:f2:bb:68:f5:6a:47:69: - 58:ed:a8:bb:11:9d:6b:d1:77:75:01:da:57:5d:3e: - 8e:bf:f7:b1:7b:69:df:53:22:5f:7d:c5:ac:b0:80: - 0c:20:ea:9d:f7:c4:52:d8:31:03:07:b8:84:a9:74: - e3:2e:4a:68:bf:a1:84:c6:38:32:c1:11:ef:f9:4b: - e6:79:f4:7b:7f:52:f3:36:4b:a6:d8:a5:ad:d2:02: - 40:89:42:ed:ba:d6:ea:74:d0:6e:c1:bc:02:33:9f: - 0b:ab + 00:b1:17:08:8f:43:a3:00:01:98:3b:52:8f:0b:b0: + 13:4c:eb:df:37:0d:a3:2c:5b:38:8d:28:88:94:33: + f3:04:0a:b2:1c:98:27:ec:76:9f:a2:f7:35:79:48: + cc:55:1e:68:b4:a7:4d:40:0e:bd:d5:86:c0:e5:cc: + cc:fa:41:5a:55:3f:79:59:28:6b:a2:ca:55:77:c9: + 3f:5e:c4:96:e1:8c:64:cc:c7:95:29:48:81:bf:a8: + c0:d2:3a:6f:6d:a7:14:b5:ec:d8:b6:c1:d8:86:7f: + 7a:e9:83:c0:83:c3:e1:5a:30:dd:29:ec:85:68:d9: + 09:9a:75:eb:ab:5f:3d:b1:a3:4f:e2:de:54:35:56: + 9c:7d:8f:2a:4a:18:8d:34:05:05:b4:3b:5b:9e:df: + 40:20:ad:87:a3:6b:c1:f2:da:a3:65:ef:c4:cb:3c: + 24:68:43:23:e8:14:a7:c0:11:b7:5f:e9:e3:09:24: + af:dd:ac:97:75:22:9e:15:b7:20:b0:82:b0:e1:0f: + 0f:41:fc:da:3b:76:0c:6b:f8:42:06:e2:9e:70:9a: + ed:a1:73:23:58:5c:f1:98:18:42:42:d4:0f:2e:35: + 41:00:50:1d:15:e7:65:30:b5:db:72:7d:88:da:be: + 93:72:e3:65:14:fa:0d:23:98:d6:5c:a5:fc:bb:8a: + 8f:f9 Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Subject Alternative Name: - DNS:localhost + IP Address:127.0.0.1, DNS:localhost Signature Algorithm: sha256WithRSAEncryption - 73:fa:07:e9:05:65:28:2e:72:91:29:f8:6b:a6:11:2e:e3:e2: - 14:6c:4d:7e:69:16:01:47:55:df:88:8d:be:82:37:bd:95:4e: - cc:9c:71:98:fa:3b:0d:ad:13:53:e7:04:e7:6f:38:97:ce:12: - c1:f1:c2:48:bc:3f:a9:61:b5:22:48:e1:8c:64:1f:58:14:e9: - dd:5d:9f:e3:e7:78:5f:7d:43:6a:89:21:38:9d:65:e8:71:c1: - 62:d9:62:c7:e6:b3:bd:cb:de:f1:7c:46:10:53:28:8c:47:02: - 22:91:ad:78:c0:21:10:28:a8:2c:23:a3:f2:c0:2c:c9:71:0d: - b4:a0:ca:37:ac:36:b3:1c:75:6a:74:85:a5:ba:c2:19:de:e4: - 3e:c2:3c:a4:cc:dc:8e:a7:08:36:f4:e9:81:32:ac:49:f4:34: - 89:84:e7:61:54:29:7b:c0:54:53:b9:73:37:58:21:32:56:01: - 7f:97:d3:a1:06:5b:06:14:19:6a:42:5d:45:5a:ba:8e:14:d7: - df:49:46:f2:83:7a:f0:d6:25:52:37:39:ae:37:ea:67:5f:7f: - 7b:6d:f1:42:c9:0f:44:4d:f7:39:2d:39:78:12:93:42:1b:4a: - 6d:f8:76:48:78:41:e9:a1:0b:78:fd:ad:29:f1:28:62:b8:9f: - f7:22:39:3b + 7e:97:8a:e9:81:e7:c9:44:0d:a6:45:7c:f6:ae:12:f9:c3:3c: + 2c:1f:de:aa:6b:1b:1a:09:ce:9d:d2:d7:5c:ab:32:98:91:1e: + f8:7d:63:7a:c0:d3:34:eb:3a:55:b2:cd:f5:99:5f:95:bb:3e: + 52:1d:05:2d:06:26:08:d1:e8:59:09:61:64:67:70:6d:5b:94: + 2b:b4:0c:59:88:bf:56:c8:fe:73:7f:47:e9:b0:e5:46:71:26: + 73:5f:d2:a0:81:4a:67:43:7a:18:2a:81:5b:2a:90:a9:3e:7b: + 73:6e:83:b5:55:06:75:d1:8c:d1:d8:ad:7c:6a:ce:48:00:dd: + c2:1d:b9:40:cd:91:2f:43:c4:d6:f4:79:5e:5c:83:23:87:a7: + 38:3c:d8:49:81:d2:eb:49:c7:f0:5f:3d:6e:a0:38:75:ca:92: + ce:d5:a7:54:fc:0e:7e:f4:14:66:77:79:93:bb:92:56:ab:f3: + 1b:3c:75:57:4f:2d:12:6d:99:5b:d0:b5:62:b7:1d:e3:5b:a9: + 70:cd:58:41:77:a6:2c:6d:34:bd:11:13:7d:ca:51:3e:06:f5: + cb:d4:d5:11:64:b0:cc:30:2f:a5:62:d0:dd:2c:8c:66:3f:df: + 2a:df:4d:56:99:5c:12:af:ee:92:e1:02:f6:ce:12:be:99:fa: + cc:0c:5c:af -----BEGIN CERTIFICATE----- -MIIDPzCCAiegAwIBAgIBBDANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl +MIIDRTCCAi2gAwIBAgIBATANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl cnQxCzAJBgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVs -c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTkwMTI3MTAxMTE1WhcNMzkwMTIy -MTAxMTE1WjBWMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV +c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTkwNTAyMTQyOTA3WhcNMzkwNDI3 +MTQyOTA3WjBWMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV BAcMCEhlbHNpbmtpMRAwDgYDVQQKDAdNYXJpYURCMQ8wDQYDVQQDDAZzZXJ2ZXIw -ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC+55va4b/+5qRtwiCKH+qO -GqY/V5N12DuAVb3z/sMeUA/pZg6/mJhfBpX8Spqy/H+x4Nnv32wo0BKYv3i29BqU -g6A+vNOzAk9KltkwtXxagt3/lnIc9a2Avez3+pxA4jf1hrfGsLtqaXd34SqxA7se -u+izeiy/psVrTZn784TsrKkq8/UJTlt1GJxo98krWQtBM2Aj+tT4ZOJRWTcp8rto -9WpHaVjtqLsRnWvRd3UB2lddPo6/97F7ad9TIl99xaywgAwg6p33xFLYMQMHuISp -dOMuSmi/oYTGODLBEe/5S+Z59Ht/UvM2S6bYpa3SAkCJQu261up00G7BvAIznwur -AgMBAAGjGDAWMBQGA1UdEQQNMAuCCWxvY2FsaG9zdDANBgkqhkiG9w0BAQsFAAOC -AQEAc/oH6QVlKC5ykSn4a6YRLuPiFGxNfmkWAUdV34iNvoI3vZVOzJxxmPo7Da0T -U+cE5284l84SwfHCSLw/qWG1IkjhjGQfWBTp3V2f4+d4X31DaokhOJ1l6HHBYtli -x+azvcve8XxGEFMojEcCIpGteMAhECioLCOj8sAsyXENtKDKN6w2sxx1anSFpbrC -Gd7kPsI8pMzcjqcINvTpgTKsSfQ0iYTnYVQpe8BUU7lzN1ghMlYBf5fToQZbBhQZ -akJdRVq6jhTX30lG8oN68NYlUjc5rjfqZ19/e23xQskPRE33OS05eBKTQhtKbfh2 -SHhB6aELeP2tKfEoYrif9yI5Ow== +ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCxFwiPQ6MAAZg7Uo8LsBNM +6983DaMsWziNKIiUM/MECrIcmCfsdp+i9zV5SMxVHmi0p01ADr3VhsDlzMz6QVpV +P3lZKGuiylV3yT9exJbhjGTMx5UpSIG/qMDSOm9tpxS17Ni2wdiGf3rpg8CDw+Fa +MN0p7IVo2QmadeurXz2xo0/i3lQ1Vpx9jypKGI00BQW0O1ue30AgrYeja8Hy2qNl +78TLPCRoQyPoFKfAEbdf6eMJJK/drJd1Ip4VtyCwgrDhDw9B/No7dgxr+EIG4p5w +mu2hcyNYXPGYGEJC1A8uNUEAUB0V52UwtdtyfYjavpNy42UU+g0jmNZcpfy7io/5 +AgMBAAGjHjAcMBoGA1UdEQQTMBGHBH8AAAGCCWxvY2FsaG9zdDANBgkqhkiG9w0B +AQsFAAOCAQEAfpeK6YHnyUQNpkV89q4S+cM8LB/eqmsbGgnOndLXXKsymJEe+H1j +esDTNOs6VbLN9Zlflbs+Uh0FLQYmCNHoWQlhZGdwbVuUK7QMWYi/Vsj+c39H6bDl +RnEmc1/SoIFKZ0N6GCqBWyqQqT57c26DtVUGddGM0ditfGrOSADdwh25QM2RL0PE +1vR5XlyDI4enODzYSYHS60nH8F89bqA4dcqSztWnVPwOfvQUZnd5k7uSVqvzGzx1 +V08tEm2ZW9C1Yrcd41upcM1YQXemLG00vRETfcpRPgb1y9TVEWSwzDAvpWLQ3SyM +Zj/fKt9NVplcEq/ukuEC9s4Svpn6zAxcrw== -----END CERTIFICATE----- diff --git a/mysql-test/std_data/serversan-key.pem b/mysql-test/std_data/serversan-key.pem index 84c34d63b0f..22387b3af7d 100644 --- a/mysql-test/std_data/serversan-key.pem +++ b/mysql-test/std_data/serversan-key.pem @@ -1,28 +1,28 @@ -----BEGIN PRIVATE KEY----- -MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC+55va4b/+5qRt -wiCKH+qOGqY/V5N12DuAVb3z/sMeUA/pZg6/mJhfBpX8Spqy/H+x4Nnv32wo0BKY -v3i29BqUg6A+vNOzAk9KltkwtXxagt3/lnIc9a2Avez3+pxA4jf1hrfGsLtqaXd3 -4SqxA7seu+izeiy/psVrTZn784TsrKkq8/UJTlt1GJxo98krWQtBM2Aj+tT4ZOJR -WTcp8rto9WpHaVjtqLsRnWvRd3UB2lddPo6/97F7ad9TIl99xaywgAwg6p33xFLY -MQMHuISpdOMuSmi/oYTGODLBEe/5S+Z59Ht/UvM2S6bYpa3SAkCJQu261up00G7B -vAIznwurAgMBAAECggEATXOwMuyWNbejjHhPNVrfkcnUGyzPweb5tQaUa5K33OuE -mR/z6d3iK+ODJHmsK+Pvdt6P7RcLTb+lW92K/0coJYsFj46SoTTVsKBk+7MWAa7I -nLKQF5nBS9NCehVuIZDmPTHsC6uWTgT+GF/9LxYha8W3EmIGF7d0ryUrzSGuk0qA -yVj4V2JbEbox5jjRUvRvCfbQnZYhT1Aa1/kN4fxYp00sQTkCQ1QZiC+SbN245nrv -UHumVBy0dPL+vmYxKc+L9qwYhHKsspx6+RUTgW+7YbHs6LEd8HmXb0hIp1Xb4yUS -ADVI7TgTGEGGRt1gQYkfcwl1YoVQeyBK8Yvfz88tgQKBgQD9PeBEXM+y7z8jcXAB -f/JpmMmm+S8JhPyKOMDZRL5jPKgm93Xm0pAReo8xM/quKH2jAoMxmburnYTTskyo -HBATcWDTBUiNkjCJORdWKwP6kvtYt8ZZsC9vrWkx4pPqTXQaXUNmrfZ1cuh5U/BK -5aAzN5Drx0tKie+/+2gvevoZawKBgQDA++qDlRAiNft7fEZhjA3ovOSq9kIf1hnE -psh4SRB21QZ443gifQKRRFIhMWRX0QkTyw2PbeVJvPjab08NmcumJWK5NCxPy3C0 -/ihQV2Ip49GVYA2qlgVzOMuxJJlG6SyKvCiBmadHY/ex4Ya1YPcfhjKsNr4ObIV8 -OCvQruQmwQKBgB+jp21jGyAD/CN1fMTzM1o2GJuf7lyGHPc3+AAtMow7e9bCfByG -mjFU2qcPE3bG4EuJeNKtnmDmoT3BvQoT135WX/59Xn8xkJbUZzIA1dJsorKG42U5 -OfP9+nKdGFXhr2vL0yv0+CHcZWcjMZZp8gX0H0sV7zY03Zti0bV869pZAoGBALDg -c+IkJoRkm9ljXxKbDkiJkMBNMvABCN8fyk/ND8UKnIMCYaKil07Tor7/iSuf0MUO -b6BNJkE+bYuvR3J8ypW+YEzFT/PWz7dj10lDvhoMz5QsVHpMRDSGEtOKat3+ay/B -IxMd5J7fNjAYN6JYfEetdRY4mluYBYSD60y6byxBAoGBALDoRoub5TUMdgr66fNp -p7tc9ERH8/htPEq5g2SrzQex7lUIp8+wmvprx0i4a2SgDYCkj6gmjG8rP2O65tsn -dkrKXnUOjIgjHGesbZoKgE+7Gl4c+eyoDsNVHH+ZFKN26fcO9i6wrbeGKjTTMcfu -nEXqAq0CccdZ0lXxQTS/ttbU +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCxFwiPQ6MAAZg7 +Uo8LsBNM6983DaMsWziNKIiUM/MECrIcmCfsdp+i9zV5SMxVHmi0p01ADr3VhsDl +zMz6QVpVP3lZKGuiylV3yT9exJbhjGTMx5UpSIG/qMDSOm9tpxS17Ni2wdiGf3rp +g8CDw+FaMN0p7IVo2QmadeurXz2xo0/i3lQ1Vpx9jypKGI00BQW0O1ue30AgrYej +a8Hy2qNl78TLPCRoQyPoFKfAEbdf6eMJJK/drJd1Ip4VtyCwgrDhDw9B/No7dgxr ++EIG4p5wmu2hcyNYXPGYGEJC1A8uNUEAUB0V52UwtdtyfYjavpNy42UU+g0jmNZc +pfy7io/5AgMBAAECggEAP6QHb3TfHyFzk94Xihu80+fwT9iWy1n8+L2YV6pTqyAs +4hnMPy5iMC6nCO8gf3ZuKn31RRAHKLVEnVD8WPMjg39MHL5p8BbGoEWygFwl3OiX +UQBomm10M2xx3xsg8EcbKkXzm7oOFke55DF0/eVnFwJ4eJiHWSamTNwT1YJkqXFt +kbYxxcpvjzFKuIOFXMTbS6OHGLHjuuyWffxEkbvM/bU13IFmDOzahLFPihcz7rFu +CaFN9JSSj4jENPkYOiw+zTtJhgOMCoclAcNc4c5Gs95wk6pTxoj9kHJaaYqinVgI +owUTgIXRhuixjWJd1dylgY3YvrRFENZlMe39cVKwAQKBgQDppB7Qf2FmejMYtJkA +WmlDSy+LZnYAAYjTqIeSAlRXI91iDa9HqrdPucQkv6nPvL6yndZYIrq50BLNGiL+ +v/3Ok/9v3H8jAiCzwIuqAYoA2gHh4d4ZV9Vxoqu6CcX/2xOUL7CSOV5NkK+3Yrs7 +n47X4ILGihIKzz5GoSTHyb6zRwKBgQDCCX1jwSEnIDhPCuid4+6g1vjTvVtgVIf9 +87sds02duE8K5Uwjio7g3BlV1YzLv0jKNkUK+HuG/c7n9r0IVrs4of6t/bJjl7vJ +RLl6ZkSybzzS2x2nYk23VZlInYWUdJS9kHlic+mXfJvJvBBwyz8WX7t2wQaTqlDu +QCpuV+HCvwKBgDz4/q2swG9s7o7A+rjT32qXYXYArES+IcYS0iZxgy8mhezD431R +ePtOYHiyqA81k5KrjDd+ALrjKTTrYDyZQBQ8HUpFAczSDlS6p/ga5LfqLNmVB1AX +0vUP3b70M/7cXlSqyWqvnAOkAadbFb+umSmPRrGncKPvh7II9b9J0AGbAoGAMyD3 +BnMcfkfSLpnMQ9aMyZr7xCeQTWjY0MUJmEDoAdhQE6nqDy9yiLPWhTSZPhLwZkA4 +nzRssFxuydbNZsYb3UdqaYSBHhccZ2ORkDwke/Qtzc3pGXMg0V9f3a+MRFsX2n+Y +TKYIdl9iWZ0Ro/cab5XYOumQBxcI7k7AH4VOutcCgYEA3JgQiYoiPohS9A49bPiF +eDX1Ck3lgaEF72us6BfvLHTrbA/qYhVUlrbrU2P/gAy1uKDRYq5RAoNGDLdwatvE +0hPYj1hc1DuPAAGG83/tSh2jfFVbZBw5xEDjLerkpQyop59dfTS0E/oSu6ebxIIg +dHEwqlmDrrJv7WwUJUzuUJU= -----END PRIVATE KEY----- diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index 1c99e1ed645..76bfab714df 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -70,6 +70,10 @@ sub skip_combinations { unless $::mysqld_variables{'version-ssl-library'} =~ /OpenSSL (\S+)/ and $1 ge "1.0.2"; + $skip{'main/ssl_verify_ip.test'} = 'x509v3 support required' + unless $::mysqld_variables{'version-ssl-library'} =~ /OpenSSL (\S+)/ + and $1 ge "1.0.2"; + %skip; } diff --git a/mysql-test/suite/binlog/r/binlog_mdev717.result b/mysql-test/suite/binlog/r/binlog_mdev717.result index 5fe80be651a..f9ec3a32845 100644 --- a/mysql-test/suite/binlog/r/binlog_mdev717.result +++ b/mysql-test/suite/binlog/r/binlog_mdev717.result @@ -21,6 +21,8 @@ ERROR 42000: Unknown database 'mysqltest' connection default; CREATE DATABASE mysqltest; CREATE EVENT mysqltest.e1 ON SCHEDULE EVERY 15 MINUTE DO BEGIN END; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SET DEBUG_SYNC= "after_wait_locked_schema_name SIGNAL locked WAIT_FOR release"; DROP DATABASE mysqltest;; connection con1; diff --git a/mysql-test/suite/binlog/r/binlog_sql_mode.result b/mysql-test/suite/binlog/r/binlog_sql_mode.result index 1aea77c4a4b..27ba30b5e4f 100644 --- a/mysql-test/suite/binlog/r/binlog_sql_mode.result +++ b/mysql-test/suite/binlog/r/binlog_sql_mode.result @@ -21,6 +21,8 @@ DO BEGIN UPDATE t1 SET id = id +1; END;| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. Check Result select (@a:=load_file("MYSQLTEST_VARDIR/tmp/mysqlbinlog_bug39526.binlog")) diff --git a/mysql-test/suite/compat/oracle/r/events.result b/mysql-test/suite/compat/oracle/r/events.result index 7b4ad5679eb..ef9c50115ae 100644 --- a/mysql-test/suite/compat/oracle/r/events.result +++ b/mysql-test/suite/compat/oracle/r/events.result @@ -8,6 +8,8 @@ CREATE TABLE t1 (a TIMESTAMP); CREATE EVENT e1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 MICROSECOND DO INSERT INTO t1 VALUES(NOW()); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SET GLOBAL event_scheduler=on; SELECT COUNT(*) FROM t1; COUNT(*) diff --git a/mysql-test/suite/funcs_1/r/is_routines_embedded.result b/mysql-test/suite/funcs_1/r/is_routines_embedded.result index 1739a0c15c8..ec68057eaa1 100644 --- a/mysql-test/suite/funcs_1/r/is_routines_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_routines_embedded.result @@ -199,6 +199,10 @@ END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +AddGeometryColumn def mysql AddGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +DropGeometryColumn def mysql DropGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci connect testuser2, localhost, testuser2, , db_datadict; SELECT * FROM information_schema.routines; SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -211,6 +215,10 @@ END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +AddGeometryColumn def mysql AddGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +DropGeometryColumn def mysql DropGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci connect testuser3, localhost, testuser3, , test; SELECT * FROM information_schema.routines; SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -223,6 +231,10 @@ END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.host, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +AddGeometryColumn def mysql AddGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci +DropGeometryColumn def mysql DropGeometryColumn PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL begin + set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end NULL NULL SQL NO CONTAINS SQL NULL INVOKER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci connection default; disconnect testuser1; disconnect testuser2; diff --git a/mysql-test/suite/galera/r/galera_events.result b/mysql-test/suite/galera/r/galera_events.result index f01627aba70..e925e62cb91 100644 --- a/mysql-test/suite/galera/r/galera_events.result +++ b/mysql-test/suite/galera/r/galera_events.result @@ -1,5 +1,7 @@ connection node_1; CREATE EVENT event1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. connection node_2; SELECT DEFINER= 'root@localhost', ORIGINATOR = 1, STATUS = 'SLAVESIDE_DISABLED', EVENT_TYPE = 'ONE TIME', ON_COMPLETION = 'NOT PRESERVE' FROM INFORMATION_SCHEMA.EVENTS WHERE EVENT_NAME = 'event1'; DEFINER= 'root@localhost' ORIGINATOR = 1 STATUS = 'SLAVESIDE_DISABLED' EVENT_TYPE = 'ONE TIME' ON_COMPLETION = 'NOT PRESERVE' diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result index 827b2aa9dac..b21a9d0bdca 100644 --- a/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result +++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_largetrx.result @@ -1,8 +1,9 @@ connection node_1; -CREATE TABLE ten (f1 INTEGER); +CREATE TABLE ten (f1 INTEGER) Engine=InnoDB; INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; connection node_2; +set session wsrep_sync_wait=15; SET GLOBAL wsrep_slave_threads = 4; connection node_1; INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; @@ -13,16 +14,13 @@ INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;; connection node_1; connection node_1a; connection node_2; +disconnect node_1a; SELECT COUNT(*) FROM t1; COUNT(*) 30000 SELECT COUNT(DISTINCT f1) FROM t1; COUNT(DISTINCT f1) 30000 -SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE -USER = 'system user' AND STATE NOT LIKE 'InnoDB%'; -COUNT(*) -3 connection default; DROP TABLE t1; DROP TABLE ten; diff --git a/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result index c8c07221cb1..0fd0f0b505a 100644 --- a/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result +++ b/mysql-test/suite/galera/r/galera_parallel_autoinc_manytrx.result @@ -1,20 +1,33 @@ connection node_1; -CREATE TABLE ten (f1 INTEGER); +CREATE TABLE ten (f1 INTEGER) Engine=InnoDB; INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; connection node_2; +set session wsrep_sync_wait=15; SET GLOBAL wsrep_slave_threads = 4; connection node_1; +CREATE PROCEDURE p1 (repeat_count int) +BEGIN +DECLARE current_num int; +SET current_num = 0; +WHILE current_num < repeat_count do +INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1; +COMMIT; +SET current_num = current_num + 1; +END WHILE; +END| +connection node_1a; +connection node_1b; connection node_2; -SELECT COUNT(*) = 20000 FROM t1; -COUNT(*) = 20000 -1 -SELECT COUNT(DISTINCT f1) = 20000 FROM t1; -COUNT(DISTINCT f1) = 20000 -1 -SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%'; -COUNT(*) = 4 -1 +SELECT COUNT(*) FROM t1; +COUNT(*) +40000 +SELECT COUNT(DISTINCT f1) FROM t1; +COUNT(DISTINCT f1) +40000 +disconnect node_1a; +disconnect node_1b; connection default; DROP TABLE t1; DROP TABLE ten; +DROP PROCEDURE p1; diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test index 644b4687cb3..34558283462 100644 --- a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test +++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test @@ -12,13 +12,18 @@ --source include/galera_connect.inc --connection node_1 -CREATE TABLE ten (f1 INTEGER); +CREATE TABLE ten (f1 INTEGER) Engine=InnoDB; INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; + --connection node_2 +set session wsrep_sync_wait=15; --let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` SET GLOBAL wsrep_slave_threads = 4; +--let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%'); +--source include/wait_condition.inc + --connection node_1 --send INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; @@ -37,10 +42,9 @@ SET GLOBAL wsrep_slave_threads = 4; --connection node_2 --reap +--disconnect node_1a SELECT COUNT(*) FROM t1; SELECT COUNT(DISTINCT f1) FROM t1; -SELECT COUNT(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE - USER = 'system user' AND STATE NOT LIKE 'InnoDB%'; --disable_query_log --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test index 8680d62a36d..d04603891db 100644 --- a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test +++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test @@ -6,43 +6,78 @@ --source include/have_innodb.inc --source include/big_test.inc -# Create a second connection to node1 so that we can run transactions concurrently +--connection node_1 +CREATE TABLE ten (f1 INTEGER) Engine=InnoDB; +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; + +# Create few connections to node1 so that we can run transactions concurrently --let $galera_connection_name = node_1a --let $galera_server_number = 1 --source include/galera_connect.inc ---connection node_1 -CREATE TABLE ten (f1 INTEGER); -INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +--let $galera_connection_name = node_1b +--let $galera_server_number = 1 +--source include/galera_connect.inc -CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) Engine=InnoDB; --connection node_2 +set session wsrep_sync_wait=15; --let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` SET GLOBAL wsrep_slave_threads = 4; +--let $wait_condition = SELECT COUNT(*) = @@wsrep_slave_threads + 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE IS NULL OR STATE NOT LIKE 'InnoDB%'); +--source include/wait_condition.inc + +--connection node_1 +DELIMITER |; +CREATE PROCEDURE p1 (repeat_count int) +BEGIN + DECLARE current_num int; + SET current_num = 0; + WHILE current_num < repeat_count do + INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1; + COMMIT; + SET current_num = current_num + 1; + END WHILE; +END| +DELIMITER ;| + +--disable_query_log +send call p1(1000); + +--connection node_1a +--disable_query_log +send call p1(1000); + +--connection node_1b +--disable_query_log +send call p1(1000); + +--connection node_2 +--disable_query_log +send call p1(1000); --connection node_1 ---let $count = 1000 -while ($count) -{ - --disable_query_log - INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1; - --enable_query_log - --dec $count -} +reap; +--enable_query_log + +--connection node_1a +reap; +--enable_query_log + +--connection node_1b +reap; +--enable_query_log --connection node_2 ---let $count = 1000 -while ($count) -{ - --disable_query_log - INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1; - --enable_query_log - --dec $count -} - -SELECT COUNT(*) = 20000 FROM t1; -SELECT COUNT(DISTINCT f1) = 20000 FROM t1; -SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE 'committed%'; +reap; +--enable_query_log + +SELECT COUNT(*) FROM t1; +SELECT COUNT(DISTINCT f1) FROM t1; + +--disconnect node_1a +--disconnect node_1b --disable_query_log --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; @@ -51,4 +86,6 @@ SELECT COUNT(*) = 4 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system use --connection default DROP TABLE t1; DROP TABLE ten; +DROP PROCEDURE p1; + diff --git a/mysql-test/suite/gcol/r/innodb_virtual_purge.result b/mysql-test/suite/gcol/r/innodb_virtual_purge.result index 308b01ded25..ee88527ec2e 100644 --- a/mysql-test/suite/gcol/r/innodb_virtual_purge.result +++ b/mysql-test/suite/gcol/r/innodb_virtual_purge.result @@ -142,4 +142,21 @@ CREATE TABLE t1 (a VARCHAR(30), b INT, a2 VARCHAR(30) GENERATED ALWAYS AS (a) VI CREATE INDEX idx ON t1(a2(10), b, a2(20)); ERROR 42S21: Duplicate column name 'a2' DROP TABLE t1; +# +# MDEV-17540 Server crashes in row_purge after TRUNCATE TABLE +# +CREATE TABLE t1 (a BIT(14)) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(b'01110110101011'),(b'01100111111000'),(b'00001011110100'), +(b'01110110111010'),(b'10001010101011'),(b'01100111001111'); +CREATE TABLE t2 ( +pk INT DEFAULT 1, +b YEAR, +c BIT(14), +d YEAR AS (b), +e BIT(14) AS (c), +UNIQUE(pk), +KEY(e) +) ENGINE=InnoDB; +DROP TABLE t1, t2; SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/gcol/t/innodb_virtual_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_purge.test index 4eb5d8c65b8..c79a817dd4e 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_purge.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_purge.test @@ -137,5 +137,40 @@ CREATE INDEX idx ON t1(a2(10), b, a2(20)); DROP TABLE t1; +--echo # +--echo # MDEV-17540 Server crashes in row_purge after TRUNCATE TABLE +--echo # + +# Note: this test case is nondeterministic and should depend on +# MDEV-12288 to trigger the needed purge activity. +# The test does not seem to repeat the bug on MariaDB 10.2. + +CREATE TABLE t1 (a BIT(14)) ENGINE=InnoDB; +INSERT INTO t1 VALUES + (b'01110110101011'),(b'01100111111000'),(b'00001011110100'), + (b'01110110111010'),(b'10001010101011'),(b'01100111001111'); + +CREATE TABLE t2 ( + pk INT DEFAULT 1, + b YEAR, + c BIT(14), + d YEAR AS (b), + e BIT(14) AS (c), + UNIQUE(pk), + KEY(e) +) ENGINE=InnoDB; + +# Run a few times in order to improve the chances of triggering the bug. +--disable_query_log +let $n=10; +while ($n) { +REPLACE INTO t2 (c) SELECT a FROM t1; +TRUNCATE TABLE t2; +dec $n; +} +--enable_query_log + +DROP TABLE t1, t2; + --source include/wait_until_count_sessions.inc SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency; diff --git a/mysql-test/suite/innodb/r/foreign-keys.result b/mysql-test/suite/innodb/r/foreign-keys.result index 447013d408d..c4cf3a6a72d 100644 --- a/mysql-test/suite/innodb/r/foreign-keys.result +++ b/mysql-test/suite/innodb/r/foreign-keys.result @@ -100,6 +100,30 @@ CREATE TABLE t2 (b INT, KEY(b)) ENGINE=InnoDB; INSERT INTO t2 VALUES(2); ALTER TABLE t2 ADD FOREIGN KEY(b) REFERENCES t1(a), LOCK=EXCLUSIVE; DROP TABLE t2, t1; +# +# MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name) +# +CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 LIKE t1; +FLUSH TABLES; +SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go'; +ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE; +connect con1, localhost, root; +SET debug_sync='now WAIT_FOR ready'; +SET lock_wait_timeout=1; +UPDATE t2 SET pk=10 WHERE pk=1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1'; +DEALLOCATE PREPARE stmt; +FLUSH TABLE t2; +SET debug_sync='now SIGNAL go'; +connection default; +disconnect con1; +connection default; +SET debug_sync='reset'; +SHOW OPEN TABLES FROM test; +Database Table In_use Name_locked +DROP TABLE t1, t2; create table t1 (a int primary key, b int) engine=innodb; create table t2 (c int primary key, d int, foreign key (d) references t1 (a) on update cascade) engine=innodb; diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result index b64fd27fb35..bdc16ad7692 100644 --- a/mysql-test/suite/innodb/r/innodb-index.result +++ b/mysql-test/suite/innodb/r/innodb-index.result @@ -1212,6 +1212,33 @@ Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; # +# Bug#19811005 ALTER TABLE ADD INDEX DOES NOT UPDATE INDEX_LENGTH +# IN I_S TABLES +# +CREATE TABLE t1(a INT, b INT) ENGINE=INNODB, STATS_PERSISTENT=1; +SELECT cast(DATA_LENGTH/@@innodb_page_size as int) D, +cast(INDEX_LENGTH/@@innodb_page_size as int) I +FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'; +D I +1 0 +ALTER TABLE t1 ADD INDEX (a); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT cast(DATA_LENGTH/@@innodb_page_size as int) D, +cast(INDEX_LENGTH/@@innodb_page_size as int) I +FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'; +D I +1 1 +ALTER TABLE t1 ADD INDEX (b); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 +SELECT cast(DATA_LENGTH/@@innodb_page_size as int) D, +cast(INDEX_LENGTH/@@innodb_page_size as int) I +FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'; +D I +1 2 +DROP TABLE t1; +# # Bug #17657223 EXCESSIVE TEMPORARY FILE USAGE IN ALTER TABLE # SET GLOBAL innodb_monitor_enable = module_ddl; diff --git a/mysql-test/suite/innodb/r/innodb-truncate.result b/mysql-test/suite/innodb/r/innodb-truncate.result index a606868ae52..8610a892cc6 100644 --- a/mysql-test/suite/innodb/r/innodb-truncate.result +++ b/mysql-test/suite/innodb/r/innodb-truncate.result @@ -78,3 +78,16 @@ a 1 2 DROP TABLE t1; +call mtr.add_suppression('InnoDB: in RENAME TABLE table `test`.`t3`'); +SET FOREIGN_KEY_CHECKS= OFF; +CREATE TABLE t1 (f2 INT, f4 INT, KEY(f2), FOREIGN KEY (f4) REFERENCES t3 (f4)) ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS= ON; +CREATE TABLE t2 (f2 INT, FOREIGN KEY(f2) REFERENCES t1 (f2)) ENGINE=InnoDB; +CREATE TABLE t3 (a INT) ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t3` (errno: 150 "Foreign key constraint is incorrectly formed") +ALTER TABLE t1 RENAME TO t3; +ERROR HY000: Error on rename of './test/t1' to './test/t3' (errno: 150 "Foreign key constraint is incorrectly formed") +ALTER TABLE t1 FORCE; +TRUNCATE TABLE t1; +ERROR 42000: Cannot truncate a table referenced in a foreign key constraint (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `test`.`t3` (`f2`)) +DROP TABLE t2, t1; 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 af0714148cf..d42285bf157 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 @@ -204,9 +204,9 @@ log_lsn_checkpoint_age recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL log_lsn_buf_pool_oldest recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value The oldest modified block LSN in the buffer pool log_max_modified_age_async recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Maximum LSN difference; when exceeded, start asynchronous preflush log_max_modified_age_sync recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Maximum LSN difference; when exceeded, start synchronous preflush -log_pending_log_flushes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Pending log flushes -log_pending_checkpoint_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Pending checkpoints -log_num_log_io recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of log I/Os +log_pending_log_flushes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Pending log flushes +log_pending_checkpoint_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Pending checkpoints +log_num_log_io recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of log I/Os log_waits recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log waits due to small log buffer (innodb_log_waits) log_write_requests recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log write requests (innodb_log_write_requests) log_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log writes (innodb_log_writes) diff --git a/mysql-test/suite/innodb/r/xa_debug.result b/mysql-test/suite/innodb/r/xa_debug.result index 902166f51c8..7c2bd9f92c2 100644 --- a/mysql-test/suite/innodb/r/xa_debug.result +++ b/mysql-test/suite/innodb/r/xa_debug.result @@ -252,6 +252,7 @@ insert into t1 values(1); xa end 'test1'; xa prepare 'test1'; connection default; +FLUSH TABLES; xa recover; formatID gtrid_length bqual_length data 1 5 0 test1 diff --git a/mysql-test/suite/innodb/t/foreign-keys.test b/mysql-test/suite/innodb/t/foreign-keys.test index 442467b7dbe..be2c891771b 100644 --- a/mysql-test/suite/innodb/t/foreign-keys.test +++ b/mysql-test/suite/innodb/t/foreign-keys.test @@ -127,6 +127,38 @@ INSERT INTO t2 VALUES(2); ALTER TABLE t2 ADD FOREIGN KEY(b) REFERENCES t1(a), LOCK=EXCLUSIVE; DROP TABLE t2, t1; + +--echo # +--echo # MDEV-16060 - InnoDB: Failing assertion: ut_strcmp(index->name, key->name) +--echo # +CREATE TABLE t1 (`pk` INT PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE t2 LIKE t1; +FLUSH TABLES; + +SET debug_sync='alter_table_intermediate_table_created SIGNAL ready WAIT_FOR go'; +send ALTER TABLE t1 ADD FOREIGN KEY(pk) REFERENCES t2(pk) ON UPDATE CASCADE; + +connect con1, localhost, root; +SET debug_sync='now WAIT_FOR ready'; +SET lock_wait_timeout=1; # change to 0 in 10.3 +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t2 SET pk=10 WHERE pk=1; +PREPARE stmt FROM 'UPDATE t2 SET pk=10 WHERE pk=1'; +DEALLOCATE PREPARE stmt; +FLUSH TABLE t2; +SET debug_sync='now SIGNAL go'; + +connection default; +reap; + +# Cleanup +disconnect con1; + +connection default; +SET debug_sync='reset'; +SHOW OPEN TABLES FROM test; +DROP TABLE t1, t2; + # # FK and prelocking: # child table accesses (reads and writes) wait for locks. diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test index 8bd3919af91..474b0e08935 100644 --- a/mysql-test/suite/innodb/t/innodb-index.test +++ b/mysql-test/suite/innodb/t/innodb-index.test @@ -570,6 +570,26 @@ CHECK TABLE t1; DROP TABLE t1; --echo # +--echo # Bug#19811005 ALTER TABLE ADD INDEX DOES NOT UPDATE INDEX_LENGTH +--echo # IN I_S TABLES +--echo # +let $i_s_query=SELECT cast(DATA_LENGTH/@@innodb_page_size as int) D, +cast(INDEX_LENGTH/@@innodb_page_size as int) I +FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'; + +CREATE TABLE t1(a INT, b INT) ENGINE=INNODB, STATS_PERSISTENT=1; +eval $i_s_query; +--enable_info +ALTER TABLE t1 ADD INDEX (a); +--disable_info +eval $i_s_query; +--enable_info +ALTER TABLE t1 ADD INDEX (b); +--disable_info +eval $i_s_query; +DROP TABLE t1; + +--echo # --echo # Bug #17657223 EXCESSIVE TEMPORARY FILE USAGE IN ALTER TABLE --echo # diff --git a/mysql-test/suite/innodb/t/innodb-truncate.test b/mysql-test/suite/innodb/t/innodb-truncate.test index 8f9b1f1f0e9..71c0fcfea8b 100644 --- a/mysql-test/suite/innodb/t/innodb-truncate.test +++ b/mysql-test/suite/innodb/t/innodb-truncate.test @@ -1,4 +1,5 @@ --source include/have_innodb.inc +let $datadir=`select @@datadir`; --echo # --echo # TRUNCATE TABLE --echo # @@ -73,3 +74,21 @@ SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE table_name = 't1'; INSERT INTO t1 () VALUES (), (); SELECT a FROM t1 ORDER BY a; DROP TABLE t1; + +# +# MDEV-18923 Assertion `!lex_string_cmp(system_charset_info, fk_info->referenced_table, &table->s->table_name)' failed in fk_truncate_illegal_if_parent +# +call mtr.add_suppression('InnoDB: in RENAME TABLE table `test`.`t3`'); +SET FOREIGN_KEY_CHECKS= OFF; +CREATE TABLE t1 (f2 INT, f4 INT, KEY(f2), FOREIGN KEY (f4) REFERENCES t3 (f4)) ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS= ON; +CREATE TABLE t2 (f2 INT, FOREIGN KEY(f2) REFERENCES t1 (f2)) ENGINE=InnoDB; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t3 (a INT) ENGINE=InnoDB; +--replace_result $datadir ./ +--error ER_ERROR_ON_RENAME +ALTER TABLE t1 RENAME TO t3; +ALTER TABLE t1 FORCE; +--error ER_TRUNCATE_ILLEGAL_FK +TRUNCATE TABLE t1; +DROP TABLE t2, t1; diff --git a/mysql-test/suite/innodb/t/xa_debug.test b/mysql-test/suite/innodb/t/xa_debug.test index 5724891bb65..5e38ba1124b 100644 --- a/mysql-test/suite/innodb/t/xa_debug.test +++ b/mysql-test/suite/innodb/t/xa_debug.test @@ -20,6 +20,7 @@ dec $trial; connection default; # Kill and restart the server. +FLUSH TABLES; -- exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect -- shutdown_server 0 -- source include/wait_until_disconnected.inc diff --git a/mysql-test/suite/perfschema/r/pfs_upgrade_event.result b/mysql-test/suite/perfschema/r/pfs_upgrade_event.result index 2bcebe06e96..cbaeec201e0 100644 --- a/mysql-test/suite/perfschema/r/pfs_upgrade_event.result +++ b/mysql-test/suite/perfschema/r/pfs_upgrade_event.result @@ -1,6 +1,8 @@ "Testing mysql_upgrade with EVENT performance_schema.user_event" create event test.user_event on schedule every 1 day do select "not supposed to be here"; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. update mysql.event set db='performance_schema' where name='user_event'; select name from mysql.event where db='performance_schema'; name diff --git a/mysql-test/suite/plugins/r/pam.result b/mysql-test/suite/plugins/r/pam.result index 86303206b3b..46f1223d7b3 100644 --- a/mysql-test/suite/plugins/r/pam.result +++ b/mysql-test/suite/plugins/r/pam.result @@ -22,4 +22,24 @@ Now, the magic number! PIN: **** drop user test_pam; drop user pam_test; +create user PAM_TEST identified via pam using 'mariadb_mtr'; +# +# athentication is unsuccessful +# +Challenge input first. +Enter: not very secret challenge +Now, the magic number! +PIN: **** +set global pam_winbind_workaround=1; +# +# athentication is successful +# +Challenge input first. +Enter: not very secret challenge +Now, the magic number! +PIN: **** +select user(), current_user(), database(); +user() current_user() database() +PAM_TEST@localhost PAM_TEST@% test +drop user PAM_TEST; uninstall plugin pam; diff --git a/mysql-test/suite/plugins/t/pam.test b/mysql-test/suite/plugins/t/pam.test index 8a95d6baed2..8441b83c5c3 100644 --- a/mysql-test/suite/plugins/t/pam.test +++ b/mysql-test/suite/plugins/t/pam.test @@ -17,18 +17,34 @@ EOF --echo # athentication is successful, challenge/pin are ok --echo # note that current_user() differs from user() --echo # ---exec $MYSQL_TEST -u test_pam --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/pam_good.txt +--exec $MYSQL_TEST -u test_pam < $MYSQLTEST_VARDIR/tmp/pam_good.txt --echo # --echo # athentication is unsuccessful --echo # --error 1 ---exec $MYSQL_TEST -u test_pam --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/pam_bad.txt +--exec $MYSQL_TEST -u test_pam < $MYSQLTEST_VARDIR/tmp/pam_bad.txt ---remove_file $MYSQLTEST_VARDIR/tmp/pam_good.txt ---remove_file $MYSQLTEST_VARDIR/tmp/pam_bad.txt drop user test_pam; drop user pam_test; +create user PAM_TEST identified via pam using 'mariadb_mtr'; + +--echo # +--echo # athentication is unsuccessful +--echo # +--error 1 +--exec $MYSQL_TEST -u PAM_TEST < $MYSQLTEST_VARDIR/tmp/pam_good.txt + +set global pam_winbind_workaround=1; +--echo # +--echo # athentication is successful +--echo # +--exec $MYSQL_TEST -u PAM_TEST < $MYSQLTEST_VARDIR/tmp/pam_good.txt + +--remove_file $MYSQLTEST_VARDIR/tmp/pam_good.txt +--remove_file $MYSQLTEST_VARDIR/tmp/pam_bad.txt +drop user PAM_TEST; + let $count_sessions= 1; --source include/wait_until_count_sessions.inc uninstall plugin pam; diff --git a/mysql-test/suite/rpl/r/kill_race_condition.result b/mysql-test/suite/rpl/r/kill_race_condition.result new file mode 100644 index 00000000000..87ee3214b8e --- /dev/null +++ b/mysql-test/suite/rpl/r/kill_race_condition.result @@ -0,0 +1,18 @@ +include/master-slave.inc +[connection master] +connection slave; +set global debug_dbug='d,rows_log_event_before_open_table'; +set debug_sync='now WAIT_FOR before_open_table'; +connection master; +create table t1 (a int); +insert t1 values (1),(2),(3); +connection slave; +kill slave_sql_thread; +set debug_sync='now SIGNAL go_ahead_sql'; +set global debug_dbug=''; +set debug_sync='RESET'; +connection master; +drop table t1; +connection slave; +start slave; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_create_drop_event.result b/mysql-test/suite/rpl/r/rpl_create_drop_event.result index 250e7894c78..f055c4f1291 100644 --- a/mysql-test/suite/rpl/r/rpl_create_drop_event.result +++ b/mysql-test/suite/rpl/r/rpl_create_drop_event.result @@ -4,9 +4,13 @@ connection master; SET GLOBAL event_scheduler=off; CREATE TABLE t1 (a INT); CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (10); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11); ERROR HY000: Event 'ev1' already exists CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SELECT EVENT_NAME,STATUS,EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS; EVENT_NAME STATUS EVENT_DEFINITION ev1 ENABLED INSERT INTO t1 VALUES (11) diff --git a/mysql-test/suite/rpl/r/rpl_current_user.result b/mysql-test/suite/rpl/r/rpl_current_user.result index ba5269bef22..efb036023e9 100644 --- a/mysql-test/suite/rpl/r/rpl_current_user.result +++ b/mysql-test/suite/rpl/r/rpl_current_user.result @@ -90,6 +90,8 @@ include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user] # Verify 'ALTER EVENT...' statement connection master; CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. # Explicitly assign CURRENT_USER() to definer ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE; include/rpl_sync.inc diff --git a/mysql-test/suite/rpl/r/rpl_events.result b/mysql-test/suite/rpl/r/rpl_events.result index 4b2226109d9..a84bc6b67f5 100644 --- a/mysql-test/suite/rpl/r/rpl_events.result +++ b/mysql-test/suite/rpl/r/rpl_events.result @@ -31,6 +31,8 @@ test justonce SLAVESIDE_DISABLED 1 DROP EVENT IF EXISTS test.slave_once; CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once'); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. "Checking event status on the slave for originator value = slave's server_id" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once'; db name status originator @@ -78,6 +80,8 @@ db name status originator "Creating event test.slave_terminate on the slave" CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate'); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. "Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; db name status originator @@ -87,6 +91,8 @@ DROP EVENT test.slave_terminate; "Creating event test.slave_terminate with DISABLE ON SLAVE on the slave" CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate'); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. "Checking event status on the slave" SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate'; db name status originator diff --git a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result index 4ffa8fc9883..1db69ea4b83 100644 --- a/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result +++ b/mysql-test/suite/rpl/r/rpl_heartbeat_basic.result @@ -237,6 +237,8 @@ DO BEGIN UPDATE test.t1 SET a = a + 1 WHERE a < 10; END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. connection slave; RESET SLAVE; CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5; diff --git a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result index 00b50df4a68..dce79837700 100644 --- a/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result +++ b/mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result @@ -679,6 +679,8 @@ DROP TRIGGER tr1; GRANT EVENT ON *.* TO 'root'@'localhost'; INSERT INTO t1 VALUES(1, 'test1'); CREATE EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation test_rpl e1 root@localhost SYSTEM RECURRING NULL 1 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci diff --git a/mysql-test/suite/rpl/r/rpl_invoked_features.result b/mysql-test/suite/rpl/r/rpl_invoked_features.result index fcd79136e09..43a8e8625de 100644 --- a/mysql-test/suite/rpl/r/rpl_invoked_features.result +++ b/mysql-test/suite/rpl/r/rpl_invoked_features.result @@ -50,11 +50,15 @@ BEGIN ALTER EVENT e1 DISABLE; CALL p1(10, ''); END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO BEGIN ALTER EVENT e11 DISABLE; CALL p11(10, ''); END| +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE FUNCTION f1 (x INT) RETURNS VARCHAR(64) BEGIN IF x > 5 THEN diff --git a/mysql-test/suite/rpl/r/rpl_killed_ddl.result b/mysql-test/suite/rpl/r/rpl_killed_ddl.result index 66309432efe..2c0f27a3218 100644 --- a/mysql-test/suite/rpl/r/rpl_killed_ddl.result +++ b/mysql-test/suite/rpl/r/rpl_killed_ddl.result @@ -32,6 +32,8 @@ CREATE DATABASE d1; CREATE EVENT e1 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY DO INSERT INTO test.t1 VALUES (1); +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. CREATE FUNCTION f1 () RETURNS INT DETERMINISTIC RETURN 1; CREATE PROCEDURE p1 (OUT rows_cnt INT) diff --git a/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result index f900a8b0e9a..55d0c020fcd 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_implicit_commit_binlog.result @@ -61,6 +61,8 @@ INSERT INTO tt_1(ddl_case) VALUES (28); DROP USER 'user_new'@'localhost'; INSERT INTO tt_1(ddl_case) VALUES (27); CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. INSERT INTO tt_1(ddl_case) VALUES (26); ALTER EVENT evt COMMENT 'evt'; INSERT INTO tt_1(ddl_case) VALUES (25); diff --git a/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result index ef393873b97..40754a73cb8 100644 --- a/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result +++ b/mysql-test/suite/rpl/r/rpl_row_implicit_commit_binlog.result @@ -61,6 +61,8 @@ INSERT INTO tt_1(ddl_case) VALUES (28); DROP USER 'user_new'@'localhost'; INSERT INTO tt_1(ddl_case) VALUES (27); CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. INSERT INTO tt_1(ddl_case) VALUES (26); ALTER EVENT evt COMMENT 'evt'; INSERT INTO tt_1(ddl_case) VALUES (25); diff --git a/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result b/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result index f900a8b0e9a..55d0c020fcd 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result +++ b/mysql-test/suite/rpl/r/rpl_stm_implicit_commit_binlog.result @@ -61,6 +61,8 @@ INSERT INTO tt_1(ddl_case) VALUES (28); DROP USER 'user_new'@'localhost'; INSERT INTO tt_1(ddl_case) VALUES (27); CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. INSERT INTO tt_1(ddl_case) VALUES (26); ALTER EVENT evt COMMENT 'evt'; INSERT INTO tt_1(ddl_case) VALUES (25); diff --git a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result index e8e95ab7c4c..fb8e2a349bb 100644 --- a/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result +++ b/mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result @@ -4,6 +4,8 @@ CREATE TEMPORARY TABLE t1 (a INT); CREATE TABLE t2 (a INT, b INT) ENGINE= MyISAM; INSERT INTO t1 VALUES (1); CREATE EVENT e1 ON SCHEDULE EVERY 10 HOUR DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. INSERT INTO t1 VALUES (1); ALTER EVENT e1 ON SCHEDULE EVERY 20 HOUR DO SELECT 1; INSERT INTO t1 VALUES (1); @@ -125,6 +127,8 @@ ERROR HY000: Can't execute the given command because you have active locked tabl INSERT INTO t2 VALUES ("CREATE EVENT e1 with table locked"); UNLOCK TABLE; CREATE EVENT e2 ON SCHEDULE EVERY 10 HOUR DO SELECT 1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. LOCK TABLE t1 WRITE; ALTER EVENT e2 ON SCHEDULE EVERY 20 HOUR DO SELECT 1; ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction diff --git a/mysql-test/suite/rpl/t/kill_race_condition.test b/mysql-test/suite/rpl/t/kill_race_condition.test new file mode 100644 index 00000000000..4268c12cdbf --- /dev/null +++ b/mysql-test/suite/rpl/t/kill_race_condition.test @@ -0,0 +1,28 @@ +source include/have_debug_sync.inc; +source include/have_binlog_format_row.inc; +source include/master-slave.inc; + +connection slave; +set global debug_dbug='d,rows_log_event_before_open_table'; +send set debug_sync='now WAIT_FOR before_open_table'; + +connection master; +create table t1 (a int); +insert t1 values (1),(2),(3); + +connection slave; +reap; +let $a=`select id from information_schema.processlist where state='debug sync point: now'`; +replace_result $a slave_sql_thread; +eval kill $a; +set debug_sync='now SIGNAL go_ahead_sql'; +set global debug_dbug=''; +set debug_sync='RESET'; + +connection master; +drop table t1; + +connection slave; +start slave; + +source include/rpl_end.inc; diff --git a/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit,32bit.rdiff b/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit,32bit.rdiff new file mode 100644 index 00000000000..cd9a004a686 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit,32bit.rdiff @@ -0,0 +1,11 @@ +--- mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit.result 2019-05-07 15:09:57.220599318 +0530 ++++ mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit.reject 2019-05-07 15:10:20.012718538 +0530 +@@ -1,5 +1,7 @@ + set global innodb_ft_result_cache_limit=5000000000; ++Warnings: ++Warning 1292 Truncated incorrect innodb_ft_result_cache_limit value: '5000000000' + select @@innodb_ft_result_cache_limit; + @@innodb_ft_result_cache_limit +-5000000000 ++4294967295 + set global innodb_ft_result_cache_limit=2000000000; diff --git a/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit_64.result b/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit.result index c86331a8a1c..c86331a8a1c 100644 --- a/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit_64.result +++ b/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit.result diff --git a/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit_32.result b/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit_32.result deleted file mode 100644 index b3bec1eecdd..00000000000 --- a/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit_32.result +++ /dev/null @@ -1,7 +0,0 @@ -set global innodb_ft_result_cache_limit=5000000000; -Warnings: -Warning 1292 Truncated incorrect innodb_ft_result_cache_limit value: '5000000000' -select @@innodb_ft_result_cache_limit; -@@innodb_ft_result_cache_limit -4294967295 -set global innodb_ft_result_cache_limit=2000000000; diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled index 2019c4dc616..794e93a108b 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled @@ -1214,8 +1214,8 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL --GLOBAL_VALUE 5.6.43 -+GLOBAL_VALUE 5.6.42-84.2 +-GLOBAL_VALUE 5.6.44 ++GLOBAL_VALUE 5.6.43-84.3 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled index 998d95e523f..195eda13c52 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled @@ -684,8 +684,8 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL --GLOBAL_VALUE 5.6.43 -+GLOBAL_VALUE 5.6.42-84.2 +-GLOBAL_VALUE 5.6.44 ++GLOBAL_VALUE 5.6.43-84.3 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_32.test b/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit.test index d9defc7447b..b1ad2cd3821 100644 --- a/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_32.test +++ b/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit.test @@ -1,4 +1,4 @@ ---source include/have_32bit.inc +--source include/word_size.inc --source include/have_innodb.inc let $innodb_ft_result_cache_limit_orig=`select @@innodb_ft_result_cache_limit`; diff --git a/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_64.test b/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_64.test deleted file mode 100644 index 2606d2b5ca8..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_ft_result_cache_limit_64.test +++ /dev/null @@ -1,9 +0,0 @@ ---source include/have_64bit.inc ---source include/have_innodb.inc - -let $innodb_ft_result_cache_limit_orig=`select @@innodb_ft_result_cache_limit`; - -set global innodb_ft_result_cache_limit=5000000000; -select @@innodb_ft_result_cache_limit; - -eval set global innodb_ft_result_cache_limit=$innodb_ft_result_cache_limit_orig; diff --git a/mysql-test/suite/sys_vars/t/transaction_prealloc_size_bug27322.test b/mysql-test/suite/sys_vars/t/transaction_prealloc_size_bug27322.test index c83f3dc2507..6e3c330ce06 100644 --- a/mysql-test/suite/sys_vars/t/transaction_prealloc_size_bug27322.test +++ b/mysql-test/suite/sys_vars/t/transaction_prealloc_size_bug27322.test @@ -44,22 +44,23 @@ SET @def_var= @@session.transaction_prealloc_size; SET SESSION transaction_prealloc_size=1024*1024*1024*1; # Embedded server is shows "cleaning up" as STATE, while non-embedded shows "init" --replace_column 1 <Id> 3 <Host> 6 <Time> 7 <State> ---replace_regex /localhost[:0-9]*/localhost/ +--replace_result Execute Query SHOW PROCESSLIST; SET SESSION transaction_prealloc_size=1024*1024*1024*2; --replace_column 1 <Id> 3 <Host> 6 <Time> 7 <State> ---replace_regex /localhost[:0-9]*/localhost/ +--replace_result Execute Query SHOW PROCESSLIST; SET SESSION transaction_prealloc_size=1024*1024*1024*3; --replace_column 1 <Id> 3 <Host> 6 <Time> 7 <State> ---replace_regex /localhost[:0-9]*/localhost/ +--replace_result Execute Query SHOW PROCESSLIST; SET SESSION transaction_prealloc_size=1024*1024*1024*4; --replace_column 1 <Id> 3 <Host> 6 <Time> 7 <State> ---replace_regex /localhost[:0-9]*/localhost/ +--replace_result Execute Query SHOW PROCESSLIST; SET SESSION transaction_prealloc_size=1024*1024*1024*5; --replace_column 1 <Id> 3 <Host> 6 <Time> 7 <State> +--replace_result Execute Query SHOW PROCESSLIST; --enable_warnings diff --git a/mysys/tree.c b/mysys/tree.c index b07d56ec942..87297bb434e 100644 --- a/mysys/tree.c +++ b/mysys/tree.c @@ -77,6 +77,7 @@ static void rb_insert(TREE *tree,TREE_ELEMENT ***parent, TREE_ELEMENT *leaf); static void rb_delete_fixup(TREE *tree,TREE_ELEMENT ***parent); +static TREE_ELEMENT null_element= { NULL, NULL, 0, BLACK }; /* The actual code for handling binary trees */ @@ -95,8 +96,7 @@ void init_tree(TREE *tree, size_t default_alloc_size, size_t memory_limit, if (default_alloc_size < DEFAULT_ALLOC_SIZE) default_alloc_size= DEFAULT_ALLOC_SIZE; default_alloc_size= MY_ALIGN(default_alloc_size, DEFAULT_ALIGN_SIZE); - bzero((uchar*) &tree->null_element,sizeof(tree->null_element)); - tree->root= &tree->null_element; + tree->root= &null_element; tree->compare=compare; tree->size_of_element= size > 0 ? (uint) size : 0; tree->memory_limit=memory_limit; @@ -104,8 +104,6 @@ void init_tree(TREE *tree, size_t default_alloc_size, size_t memory_limit, tree->allocated=0; tree->elements_in_tree=0; tree->custom_arg = custom_arg; - tree->null_element.colour=BLACK; - tree->null_element.left=tree->null_element.right=0; tree->my_flags= my_flags; tree->flag= 0; if (!free_element && size >= 0 && @@ -167,7 +165,7 @@ static int free_tree(TREE *tree, my_bool abort, myf free_flags) free_root(&tree->mem_root, free_flags); } } - tree->root= &tree->null_element; + tree->root= &null_element; tree->elements_in_tree=0; tree->allocated=0; @@ -207,7 +205,7 @@ static int delete_tree_element(TREE *tree, TREE_ELEMENT *element, my_bool abort) { int error, first_error= 0; - if (element != &tree->null_element) + if (element != &null_element) { if ((first_error= delete_tree_element(tree, element->left, abort))) abort= 1; @@ -247,7 +245,7 @@ TREE_ELEMENT *tree_insert(TREE *tree, void *key, uint key_size, *parent = &tree->root; element= tree->root; for (;;) { - if (element == &tree->null_element || + if (element == &null_element || (cmp = (*tree->compare)(custom_arg, ELEMENT_KEY(tree,element), key)) == 0) break; @@ -260,11 +258,11 @@ TREE_ELEMENT *tree_insert(TREE *tree, void *key, uint key_size, *++parent = &element->left; element= element->left; } } - if (element == &tree->null_element) + if (element == &null_element) { uint alloc_size; if (tree->flag & TREE_ONLY_DUPS) - return((TREE_ELEMENT *) 1); + return TREE_ELEMENT_UNIQUE; alloc_size=sizeof(TREE_ELEMENT)+key_size+tree->size_of_element; tree->allocated+=alloc_size; @@ -284,7 +282,7 @@ TREE_ELEMENT *tree_insert(TREE *tree, void *key, uint key_size, if (!element) return(NULL); **parent=element; - element->left=element->right= &tree->null_element; + element->left=element->right= &null_element; if (!tree->offset_to_key) { if (key_size == sizeof(void*)) /* no length, save pointer */ @@ -326,7 +324,7 @@ int tree_delete(TREE *tree, void *key, uint key_size, void *custom_arg) *parent= &tree->root; element= tree->root; for (;;) { - if (element == &tree->null_element) + if (element == &null_element) return 1; /* Was not in tree */ if ((cmp = (*tree->compare)(custom_arg, ELEMENT_KEY(tree,element), key)) == 0) @@ -340,12 +338,12 @@ int tree_delete(TREE *tree, void *key, uint key_size, void *custom_arg) *++parent = &element->left; element= element->left; } } - if (element->left == &tree->null_element) + if (element->left == &null_element) { (**parent)=element->right; remove_colour= element->colour; } - else if (element->right == &tree->null_element) + else if (element->right == &null_element) { (**parent)=element->left; remove_colour= element->colour; @@ -354,7 +352,7 @@ int tree_delete(TREE *tree, void *key, uint key_size, void *custom_arg) { org_parent= parent; *++parent= &element->right; nod= element->right; - while (nod->left != &tree->null_element) + while (nod->left != &null_element) { *++parent= &nod->left; nod= nod->left; } @@ -384,7 +382,7 @@ void *tree_search(TREE *tree, void *key, void *custom_arg) for (;;) { - if (element == &tree->null_element) + if (element == &null_element) return (void*) 0; if ((cmp = (*tree->compare)(custom_arg, ELEMENT_KEY(tree,element), key)) == 0) @@ -409,8 +407,8 @@ void *tree_search_key(TREE *tree, const void *key, TODO: support for HA_READ_KEY_OR_PREV, HA_READ_PREFIX flags if needed. */ - *parents = &tree->null_element; - while (element != &tree->null_element) + *parents = &null_element; + while (element != &null_element) { *++parents= element; if ((cmp= (*tree->compare)(custom_arg, ELEMENT_KEY(tree, element), @@ -481,14 +479,14 @@ void *tree_search_edge(TREE *tree, TREE_ELEMENT **parents, { TREE_ELEMENT *element= tree->root; - *parents= &tree->null_element; - while (element != &tree->null_element) + *parents= &null_element; + while (element != &null_element) { *++parents= element; element= ELEMENT_CHILD(element, child_offs); } *last_pos= parents; - return **last_pos != &tree->null_element ? + return **last_pos != &null_element ? ELEMENT_KEY(tree, **last_pos) : NULL; } @@ -497,11 +495,11 @@ void *tree_search_next(TREE *tree, TREE_ELEMENT ***last_pos, int l_offs, { TREE_ELEMENT *x= **last_pos; - if (ELEMENT_CHILD(x, r_offs) != &tree->null_element) + if (ELEMENT_CHILD(x, r_offs) != &null_element) { x= ELEMENT_CHILD(x, r_offs); *++*last_pos= x; - while (ELEMENT_CHILD(x, l_offs) != &tree->null_element) + while (ELEMENT_CHILD(x, l_offs) != &null_element) { x= ELEMENT_CHILD(x, l_offs); *++*last_pos= x; @@ -511,12 +509,12 @@ void *tree_search_next(TREE *tree, TREE_ELEMENT ***last_pos, int l_offs, else { TREE_ELEMENT *y= *--*last_pos; - while (y != &tree->null_element && x == ELEMENT_CHILD(y, r_offs)) + while (y != &null_element && x == ELEMENT_CHILD(y, r_offs)) { x= y; y= *--*last_pos; } - return y == &tree->null_element ? NULL : ELEMENT_KEY(tree, y); + return y == &null_element ? NULL : ELEMENT_KEY(tree, y); } } @@ -532,7 +530,7 @@ ha_rows tree_record_pos(TREE *tree, const void *key, double left= 1; double right= tree->elements_in_tree; - while (element != &tree->null_element) + while (element != &null_element) { if ((cmp= (*tree->compare)(custom_arg, ELEMENT_KEY(tree, element), key)) == 0) diff --git a/pcre/AUTHORS b/pcre/AUTHORS index eb9b1a44b34..23c005a33d6 100644 --- a/pcre/AUTHORS +++ b/pcre/AUTHORS @@ -8,7 +8,7 @@ Email domain: cam.ac.uk University of Cambridge Computing Service, Cambridge, England. -Copyright (c) 1997-2018 University of Cambridge +Copyright (c) 1997-2019 University of Cambridge All rights reserved @@ -19,7 +19,7 @@ Written by: Zoltan Herczeg Email local part: hzmester Emain domain: freemail.hu -Copyright(c) 2010-2018 Zoltan Herczeg +Copyright(c) 2010-2019 Zoltan Herczeg All rights reserved. @@ -30,7 +30,7 @@ Written by: Zoltan Herczeg Email local part: hzmester Emain domain: freemail.hu -Copyright(c) 2009-2018 Zoltan Herczeg +Copyright(c) 2009-2019 Zoltan Herczeg All rights reserved. diff --git a/pcre/ChangeLog b/pcre/ChangeLog index 7b53195f6a6..e4d2d9fa24c 100644 --- a/pcre/ChangeLog +++ b/pcre/ChangeLog @@ -5,6 +5,49 @@ Note that the PCRE 8.xx series (PCRE1) is now in a bugfix-only state. All development is happening in the PCRE2 10.xx series. +Version 8.43 23-February-2019 +----------------------------- + +1. Some time ago the config macro SUPPORT_UTF8 was changed to SUPPORT_UTF +because it also applies to UTF-16 and UTF-32. However, this change was not made +in the pcre2cpp files; consequently the C++ wrapper has from then been compiled +with a bug in it, which would have been picked up by the unit test except that +it also had its UTF8 code cut out. The bug was in a global replace when moving +forward after matching an empty string. + +2. The C++ wrapper got broken a long time ago (version 7.3, August 2007) when +(*CR) was invented (assuming it was the first such start-of-pattern option). +The wrapper could never handle such patterns because it wraps patterns in +(?:...)\z in order to support end anchoring. I have hacked in some code to fix +this, that is, move the wrapping till after any existing start-of-pattern +special settings. + +3. "pcre2grep" (sic) was accidentally mentioned in an error message (fix was +ported from PCRE2). + +4. Typo LCC_ALL for LC_ALL fixed in pcregrep. + +5. In a pattern such as /[^\x{100}-\x{ffff}]*[\x80-\xff]/ which has a repeated +negative class with no characters less than 0x100 followed by a positive class +with only characters less than 0x100, the first class was incorrectly being +auto-possessified, causing incorrect match failures. + +6. If the only branch in a conditional subpattern was anchored, the whole +subpattern was treated as anchored, when it should not have been, since the +assumed empty second branch cannot be anchored. Demonstrated by test patterns +such as /(?(1)^())b/ or /(?(?=^))b/. + +7. Fix subject buffer overread in JIT when UTF is disabled and \X or \R has +a greater than 1 fixed quantifier. This issue was found by Yunho Kim. + +8. If a pattern started with a subroutine call that had a quantifier with a +minimum of zero, an incorrect "match must start with this character" could be +recorded. Example: /(?&xxx)*ABC(?<xxx>XYZ)/ would (incorrectly) expect 'A' to +be the first character of a match. + +9. Improve MAP_JIT flag usage on MacOS. Patch by Rich Siegel. + + Version 8.42 20-March-2018 -------------------------- diff --git a/pcre/LICENCE b/pcre/LICENCE index f6ef7fd7664..760a6666b60 100644 --- a/pcre/LICENCE +++ b/pcre/LICENCE @@ -25,7 +25,7 @@ Email domain: cam.ac.uk University of Cambridge Computing Service, Cambridge, England. -Copyright (c) 1997-2018 University of Cambridge +Copyright (c) 1997-2019 University of Cambridge All rights reserved. @@ -34,9 +34,9 @@ PCRE JUST-IN-TIME COMPILATION SUPPORT Written by: Zoltan Herczeg Email local part: hzmester -Emain domain: freemail.hu +Email domain: freemail.hu -Copyright(c) 2010-2018 Zoltan Herczeg +Copyright(c) 2010-2019 Zoltan Herczeg All rights reserved. @@ -45,9 +45,9 @@ STACK-LESS JUST-IN-TIME COMPILER Written by: Zoltan Herczeg Email local part: hzmester -Emain domain: freemail.hu +Email domain: freemail.hu -Copyright(c) 2009-2018 Zoltan Herczeg +Copyright(c) 2009-2019 Zoltan Herczeg All rights reserved. diff --git a/pcre/NEWS b/pcre/NEWS index 09b4ad36003..0f184081740 100644 --- a/pcre/NEWS +++ b/pcre/NEWS @@ -1,6 +1,16 @@ News about PCRE releases ------------------------ +Note that this library (now called PCRE1) is now being maintained for bug fixes +only. New projects are advised to use the new PCRE2 libraries. + + +Release 8.43 23-February-2019 +----------------------------- + +This is a bug-fix release. + + Release 8.42 20-March-2018 -------------------------- diff --git a/pcre/configure.ac b/pcre/configure.ac index dcdef6a9427..d2e5236cbd6 100644 --- a/pcre/configure.ac +++ b/pcre/configure.ac @@ -9,17 +9,17 @@ dnl The PCRE_PRERELEASE feature is for identifying release candidates. It might dnl be defined as -RC2, for example. For real releases, it should be empty. m4_define(pcre_major, [8]) -m4_define(pcre_minor, [42]) +m4_define(pcre_minor, [43]) m4_define(pcre_prerelease, []) -m4_define(pcre_date, [2018-03-20]) +m4_define(pcre_date, [2019-02-23]) # NOTE: The CMakeLists.txt file searches for the above variables in the first # 50 lines of this file. Please update that if the variables above are moved. # Libtool shared library interface versions (current:revision:age) -m4_define(libpcre_version, [3:10:2]) -m4_define(libpcre16_version, [2:10:2]) -m4_define(libpcre32_version, [0:10:0]) +m4_define(libpcre_version, [3:11:2]) +m4_define(libpcre16_version, [2:11:2]) +m4_define(libpcre32_version, [0:11:0]) m4_define(libpcreposix_version, [0:6:0]) m4_define(libpcrecpp_version, [0:1:0]) diff --git a/pcre/pcre_compile.c b/pcre/pcre_compile.c index 9b9da46f0d0..734875de2fb 100644 --- a/pcre/pcre_compile.c +++ b/pcre/pcre_compile.c @@ -6,7 +6,7 @@ and semantics are as close as possible to those of the Perl 5 language. Written by Philip Hazel - Copyright (c) 1997-2016 University of Cambridge + Copyright (c) 1997-2018 University of Cambridge ----------------------------------------------------------------------------- Redistribution and use in source and binary forms, with or without @@ -3300,7 +3300,7 @@ for(;;) if ((*xclass_flags & XCL_MAP) == 0) { /* No bits are set for characters < 256. */ - if (list[1] == 0) return TRUE; + if (list[1] == 0) return (*xclass_flags & XCL_NOT) == 0; /* Might be an empty repeat. */ continue; } @@ -7645,6 +7645,8 @@ for (;; ptr++) /* Can't determine a first byte now */ if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE; + zerofirstchar = firstchar; + zerofirstcharflags = firstcharflags; continue; @@ -8685,10 +8687,18 @@ do { if (!is_anchored(scode, new_map, cd, atomcount)) return FALSE; } - /* Positive forward assertions and conditions */ + /* Positive forward assertion */ - else if (op == OP_ASSERT || op == OP_COND) + else if (op == OP_ASSERT) + { + if (!is_anchored(scode, bracket_map, cd, atomcount)) return FALSE; + } + + /* Condition; not anchored if no second branch */ + + else if (op == OP_COND) { + if (scode[GET(scode,1)] != OP_ALT) return FALSE; if (!is_anchored(scode, bracket_map, cd, atomcount)) return FALSE; } diff --git a/pcre/pcre_jit_compile.c b/pcre/pcre_jit_compile.c index 2bad74b0231..bc5f9c01433 100644 --- a/pcre/pcre_jit_compile.c +++ b/pcre/pcre_jit_compile.c @@ -9002,7 +9002,7 @@ if (exact > 1) #ifdef SUPPORT_UTF && !common->utf #endif - ) + && type != OP_ANYNL && type != OP_EXTUNI) { OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(exact)); add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_GREATER, TMP1, 0, STR_END, 0)); diff --git a/pcre/pcrecpp.cc b/pcre/pcrecpp.cc index d09c9abc516..77a2fedc4be 100644 --- a/pcre/pcrecpp.cc +++ b/pcre/pcrecpp.cc @@ -80,6 +80,24 @@ static const string empty_string; // If the user doesn't ask for any options, we just use this one static RE_Options default_options; +// Specials for the start of patterns. See comments where start_options is used +// below. (PH June 2018) +static const char *start_options[] = { + "(*UTF8)", + "(*UTF)", + "(*UCP)", + "(*NO_START_OPT)", + "(*NO_AUTO_POSSESS)", + "(*LIMIT_RECURSION=", + "(*LIMIT_MATCH=", + "(*CRLF)", + "(*CR)", + "(*BSR_UNICODE)", + "(*BSR_ANYCRLF)", + "(*ANYCRLF)", + "(*ANY)", + "" }; + void RE::Init(const string& pat, const RE_Options* options) { pattern_ = pat; if (options == NULL) { @@ -135,7 +153,49 @@ pcre* RE::Compile(Anchor anchor) { } else { // Tack a '\z' at the end of RE. Parenthesize it first so that // the '\z' applies to all top-level alternatives in the regexp. - string wrapped = "(?:"; // A non-counting grouping operator + + /* When this code was written (for PCRE 6.0) it was enough just to + parenthesize the entire pattern. Unfortunately, when the feature of + starting patterns with (*UTF8) or (*CR) etc. was added to PCRE patterns, + this code was never updated. This bug was not noticed till 2018, long after + PCRE became obsolescent and its maintainer no longer around. Since PCRE is + frozen, I have added a hack to check for all the existing "start of + pattern" specials - knowing that no new ones will ever be added. I am not a + C++ programmer, so the code style is no doubt crude. It is also + inefficient, but is only run when the pattern starts with "(*". + PH June 2018. */ + + string wrapped = ""; + + if (pattern_.c_str()[0] == '(' && pattern_.c_str()[1] == '*') { + int kk, klen, kmat; + for (;;) { // Loop for any number of leading items + + for (kk = 0; start_options[kk][0] != 0; kk++) { + klen = strlen(start_options[kk]); + kmat = strncmp(pattern_.c_str(), start_options[kk], klen); + if (kmat >= 0) break; + } + if (kmat != 0) break; // Not found + + // If the item ended in "=" we must copy digits up to ")". + + if (start_options[kk][klen-1] == '=') { + while (isdigit(pattern_.c_str()[klen])) klen++; + if (pattern_.c_str()[klen] != ')') break; // Syntax error + klen++; + } + + // Move the item from the pattern to the start of the wrapped string. + + wrapped += pattern_.substr(0, klen); + pattern_.erase(0, klen); + } + } + + // Wrap the rest of the pattern. + + wrapped += "(?:"; // A non-counting grouping operator wrapped += pattern_; wrapped += ")\\z"; re = pcre_compile(wrapped.c_str(), pcre_options, @@ -415,7 +475,7 @@ int RE::GlobalReplace(const StringPiece& rewrite, matchend++; } // We also need to advance more than one char if we're in utf8 mode. -#ifdef SUPPORT_UTF8 +#ifdef SUPPORT_UTF if (options_.utf8()) { while (matchend < static_cast<int>(str->length()) && ((*str)[matchend] & 0xc0) == 0x80) diff --git a/pcre/pcrecpp_unittest.cc b/pcre/pcrecpp_unittest.cc index 4b15fbef1c3..1fc01a042b3 100644 --- a/pcre/pcrecpp_unittest.cc +++ b/pcre/pcrecpp_unittest.cc @@ -309,7 +309,7 @@ static void TestReplace() { "@aa", "@@@", 3 }, -#ifdef SUPPORT_UTF8 +#ifdef SUPPORT_UTF { "b*", "bb", "\xE3\x83\x9B\xE3\x83\xBC\xE3\x83\xA0\xE3\x81\xB8", // utf8 @@ -327,7 +327,7 @@ static void TestReplace() { { "", NULL, NULL, NULL, NULL, 0 } }; -#ifdef SUPPORT_UTF8 +#ifdef SUPPORT_UTF const bool support_utf8 = true; #else const bool support_utf8 = false; @@ -535,7 +535,7 @@ static void TestQuoteMetaLatin1() { } static void TestQuoteMetaUtf8() { -#ifdef SUPPORT_UTF8 +#ifdef SUPPORT_UTF TestQuoteMeta("Pl\xc3\xa1\x63ido Domingo", pcrecpp::UTF8()); TestQuoteMeta("xyz", pcrecpp::UTF8()); // No fancy utf8 TestQuoteMeta("\xc2\xb0", pcrecpp::UTF8()); // 2-byte utf8 (degree symbol) @@ -1178,7 +1178,7 @@ int main(int argc, char** argv) { CHECK(re.error().empty()); // Must have no error } -#ifdef SUPPORT_UTF8 +#ifdef SUPPORT_UTF // Check UTF-8 handling { printf("Testing UTF-8 handling\n"); @@ -1203,6 +1203,30 @@ int main(int argc, char** argv) { RE re_test2("...", pcrecpp::UTF8()); CHECK(re_test2.FullMatch(utf8_string)); + // PH added these tests for leading option settings + + RE re_testZ0("(*CR)(*NO_START_OPT)........."); + CHECK(re_testZ0.FullMatch(utf8_string)); + +#ifdef SUPPORT_UTF + RE re_testZ1("(*UTF8)..."); + CHECK(re_testZ1.FullMatch(utf8_string)); + + RE re_testZ2("(*UTF)..."); + CHECK(re_testZ2.FullMatch(utf8_string)); + +#ifdef SUPPORT_UCP + RE re_testZ3("(*UCP)(*UTF)..."); + CHECK(re_testZ3.FullMatch(utf8_string)); + + RE re_testZ4("(*UCP)(*LIMIT_MATCH=1000)(*UTF)..."); + CHECK(re_testZ4.FullMatch(utf8_string)); + + RE re_testZ5("(*UCP)(*LIMIT_MATCH=1000)(*ANY)(*UTF)..."); + CHECK(re_testZ5.FullMatch(utf8_string)); +#endif +#endif + // Check that '.' matches one byte or UTF-8 character // according to the mode. string ss; @@ -1248,7 +1272,7 @@ int main(int argc, char** argv) { CHECK(!match_sentence.FullMatch(target)); CHECK(!match_sentence_re.FullMatch(target)); } -#endif /* def SUPPORT_UTF8 */ +#endif /* def SUPPORT_UTF */ printf("Testing error reporting\n"); diff --git a/pcre/pcregrep.c b/pcre/pcregrep.c index 22c43bcda00..01ad16d680e 100644 --- a/pcre/pcregrep.c +++ b/pcre/pcregrep.c @@ -2252,7 +2252,7 @@ if (isdirectory(pathname)) size_t fnlength = strlen(pathname) + strlen(nextfile) + 2; if (fnlength > 2048) { - fprintf(stderr, "pcre2grep: recursive filename is too long\n"); + fprintf(stderr, "pcregrep: recursive filename is too long\n"); rc = 2; break; } @@ -3034,7 +3034,7 @@ LC_ALL environment variable is set, and if so, use it. */ if (locale == NULL) { locale = getenv("LC_ALL"); - locale_from = "LCC_ALL"; + locale_from = "LC_ALL"; } if (locale == NULL) diff --git a/pcre/testdata/testinput1 b/pcre/testdata/testinput1 index 5c23f41fa81..02e4f4825fc 100644 --- a/pcre/testdata/testinput1 +++ b/pcre/testdata/testinput1 @@ -5742,4 +5742,19 @@ AbcdCBefgBhiBqz /X+(?#comment)?/ >XXX< +/ (?<word> \w+ )* \. /xi + pokus. + +/(?(DEFINE) (?<word> \w+ ) ) (?&word)* \./xi + pokus. + +/(?(DEFINE) (?<word> \w+ ) ) ( (?&word)* ) \./xi + pokus. + +/(?&word)* (?(DEFINE) (?<word> \w+ ) ) \./xi + pokus. + +/(?&word)* \. (?<word> \w+ )/xi + pokus.hokus + /-- End of testinput1 --/ diff --git a/pcre/testdata/testinput2 b/pcre/testdata/testinput2 index 8ba4dc4ddab..3528de153eb 100644 --- a/pcre/testdata/testinput2 +++ b/pcre/testdata/testinput2 @@ -4257,4 +4257,7 @@ backtracking verbs. --/ ab aaab +/(?(?=^))b/ + abc + /-- End of testinput2 --/ diff --git a/pcre/testdata/testinput4 b/pcre/testdata/testinput4 index 8bdbdac4c26..63368c0a097 100644 --- a/pcre/testdata/testinput4 +++ b/pcre/testdata/testinput4 @@ -727,4 +727,7 @@ /\C(\W?Å¿)'?{{/8 \\C(\\W?Å¿)'?{{ +/[^\x{100}-\x{ffff}]*[\x80-\xff]/8 + \x{99}\x{99}\x{99} + /-- End of testinput4 --/ diff --git a/pcre/testdata/testoutput1 b/pcre/testdata/testoutput1 index eff8ecc948c..e6147e60b95 100644 --- a/pcre/testdata/testoutput1 +++ b/pcre/testdata/testoutput1 @@ -9446,4 +9446,28 @@ No match >XXX< 0: X +/ (?<word> \w+ )* \. /xi + pokus. + 0: pokus. + 1: pokus + +/(?(DEFINE) (?<word> \w+ ) ) (?&word)* \./xi + pokus. + 0: pokus. + +/(?(DEFINE) (?<word> \w+ ) ) ( (?&word)* ) \./xi + pokus. + 0: pokus. + 1: <unset> + 2: pokus + +/(?&word)* (?(DEFINE) (?<word> \w+ ) ) \./xi + pokus. + 0: pokus. + +/(?&word)* \. (?<word> \w+ )/xi + pokus.hokus + 0: pokus.hokus + 1: hokus + /-- End of testinput1 --/ diff --git a/pcre/testdata/testoutput2 b/pcre/testdata/testoutput2 index 61ed8d9d4e4..4ccda272010 100644 --- a/pcre/testdata/testoutput2 +++ b/pcre/testdata/testoutput2 @@ -14721,4 +14721,8 @@ No need char 0: ab 1: a +/(?(?=^))b/ + abc + 0: b + /-- End of testinput2 --/ diff --git a/pcre/testdata/testoutput4 b/pcre/testdata/testoutput4 index d43c12392dd..69e812cd357 100644 --- a/pcre/testdata/testoutput4 +++ b/pcre/testdata/testoutput4 @@ -1277,4 +1277,8 @@ No match \\C(\\W?Å¿)'?{{ No match +/[^\x{100}-\x{ffff}]*[\x80-\xff]/8 + \x{99}\x{99}\x{99} + 0: \x{99}\x{99}\x{99} + /-- End of testinput4 --/ diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c index a6a981f9641..83fd64e4cb1 100644 --- a/plugin/auth_pam/auth_pam.c +++ b/plugin/auth_pam/auth_pam.c @@ -52,6 +52,8 @@ static char pam_debug = 0; #define PAM_DEBUG(X) /* no-op */ #endif +static char winbind_hack = 0; + static int conv(int n, const struct pam_message **msg, struct pam_response **resp, void *data) { @@ -159,7 +161,8 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) PAM_DEBUG((stderr, "PAM: pam_get_item(PAM_USER)\n")); DO( pam_get_item(pamh, PAM_USER, (pam_get_item_3_arg) &new_username) ); - if (new_username && strcmp(new_username, info->user_name)) + if (new_username && + (winbind_hack ? strcasecmp : strcmp)(new_username, info->user_name)) strncpy(info->authenticated_as, new_username, sizeof(info->authenticated_as)-1); info->authenticated_as[sizeof(info->authenticated_as)-1]= 0; @@ -185,6 +188,10 @@ static MYSQL_SYSVAR_BOOL(use_cleartext_plugin, use_cleartext_plugin, "supports simple PAM policies that don't require anything besides " "a password", NULL, NULL, 0); +static MYSQL_SYSVAR_BOOL(winbind_workaround, winbind_hack, PLUGIN_VAR_OPCMDARG, + "Compare usernames case insensitively to work around pam_winbind " + "unconditional username lowercasing", NULL, NULL, 0); + #ifndef DBUG_OFF static MYSQL_SYSVAR_BOOL(debug, pam_debug, PLUGIN_VAR_OPCMDARG, "Log all PAM activity", NULL, NULL, 0); @@ -193,6 +200,7 @@ static MYSQL_SYSVAR_BOOL(debug, pam_debug, PLUGIN_VAR_OPCMDARG, static struct st_mysql_sys_var* vars[] = { MYSQL_SYSVAR(use_cleartext_plugin), + MYSQL_SYSVAR(winbind_workaround), #ifndef DBUG_OFF MYSQL_SYSVAR(debug), #endif diff --git a/scripts/maria_add_gis_sp.sql.in b/scripts/maria_add_gis_sp.sql.in index 3a5dd49b95b..5826cc1a038 100644 --- a/scripts/maria_add_gis_sp.sql.in +++ b/scripts/maria_add_gis_sp.sql.in @@ -24,12 +24,12 @@ DROP PROCEDURE IF EXISTS AddGeometryColumn; DROP PROCEDURE IF EXISTS DropGeometryColumn; CREATE DEFINER=`root`@`localhost` PROCEDURE AddGeometryColumn(catalog varchar(64), t_schema varchar(64), - t_name varchar(64), geometry_column varchar(64), t_srid int) + t_name varchar(64), geometry_column varchar(64), t_srid int) SQL SECURITY INVOKER begin set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' ADD ', geometry_column,' GEOMETRY REF_SYSTEM_ID=', t_srid); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end @ADD_GIS_SP_EOL@ CREATE DEFINER=`root`@`localhost` PROCEDURE DropGeometryColumn(catalog varchar(64), t_schema varchar(64), - t_name varchar(64), geometry_column varchar(64)) + t_name varchar(64), geometry_column varchar(64)) SQL SECURITY INVOKER begin set @qwe= concat('ALTER TABLE ', t_schema, '.', t_name, ' DROP ', geometry_column); PREPARE ls from @qwe; execute ls; deallocate prepare ls; end @ADD_GIS_SP_EOL@ diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 52107405525..92e6ed20cff 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -437,7 +437,7 @@ then fi # Create database directories -for dir in "$ldata" "$ldata/mysql" +for dir in "$ldata" do if test ! -d "$dir" then @@ -489,6 +489,7 @@ mysqld_install_cmd_line() cat_sql() { + echo "create database if not exists mysql;" echo "use mysql;" case "$auth_root_authentication_method" in diff --git a/sql-common/client.c b/sql-common/client.c index 160a85fd7b5..d4ba7b6b9f5 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1832,8 +1832,10 @@ static int ssl_verify_server_cert(Vio *vio, const char* server_hostname, const c */ #ifdef HAVE_X509_check_host - ret_validation= X509_check_host(server_cert, server_hostname, - strlen(server_hostname), 0, 0) != 1; + ret_validation= + (X509_check_host(server_cert, server_hostname, + strlen(server_hostname), 0, 0) != 1) && + (X509_check_ip_asc(server_cert, server_hostname, 0) != 1); #else subject= X509_get_subject_name(server_cert); cn_loc= X509_NAME_get_index_by_NID(subject, NID_commonName, -1); diff --git a/sql/events.cc b/sql/events.cc index c3a578f1097..ce5f2b1bc10 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -418,6 +418,12 @@ Events::create_event(THD *thd, Event_parse_data *parse_data) thd->restore_stmt_binlog_format(save_binlog_format); + if (!ret && Events::opt_event_scheduler == Events::EVENTS_OFF) + { + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, + "Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it."); + } + DBUG_RETURN(ret); WSREP_ERROR_LABEL: diff --git a/sql/field.cc b/sql/field.cc index 0f75772e485..d97c267009f 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -2397,7 +2397,7 @@ int Field::set_default() /* Copy constant value stored in s->default_values */ my_ptrdiff_t l_offset= (my_ptrdiff_t) (table->s->default_values - table->record[0]); - memcpy(ptr, ptr + l_offset, pack_length()); + memcpy(ptr, ptr + l_offset, pack_length_in_rec()); if (maybe_null_in_table()) *null_ptr= ((*null_ptr & (uchar) ~null_bit) | (null_ptr[l_offset] & null_bit)); diff --git a/sql/gen_win_tzname_data.ps1 b/sql/gen_win_tzname_data.ps1 new file mode 100644 index 00000000000..13b6ce6ffd0 --- /dev/null +++ b/sql/gen_win_tzname_data.ps1 @@ -0,0 +1,11 @@ +# Generates a header file for converting between Windows timezone names to tzdb names +# using CLDR data. +# Usage: powershell -File gen_win_tzname_data.ps1 > win_tzname_data.h + +write-output "/* This file was generated using gen_win_tzname_data.ps1 */" +$xdoc = new-object System.Xml.XmlDocument +$xdoc.load("https://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml") +$nodes = $xdoc.SelectNodes("//mapZone[@territory='001']") # use default territory (001) +foreach ($node in $nodes) { + write-output ('{L"'+ $node.other + '","'+ $node.type+'"},') +} diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 6371c330170..2646a2a1225 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1,6 +1,6 @@ /* - Copyright (c) 2005, 2017, Oracle and/or its affiliates. - Copyright (c) 2009, 2018, MariaDB + Copyright (c) 2005, 2019, Oracle and/or its affiliates. + Copyright (c) 2009, 2019, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -10079,7 +10079,12 @@ bool ha_partition::inplace_alter_table(TABLE *altered_table, for (index= 0; index < m_tot_parts && !error; index++) { - ha_alter_info->handler_ctx= part_inplace_ctx->handler_ctx_array[index]; + if ((ha_alter_info->handler_ctx= + part_inplace_ctx->handler_ctx_array[index]) != NULL + && index != 0) + ha_alter_info->handler_ctx->set_shared_data + (*part_inplace_ctx->handler_ctx_array[index - 1]); + if (m_file[index]->ha_inplace_alter_table(altered_table, ha_alter_info)) error= true; diff --git a/sql/handler.h b/sql/handler.h index 83e8bc2a60a..28faf9fc9ad 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1,8 +1,8 @@ #ifndef HANDLER_INCLUDED #define HANDLER_INCLUDED /* - Copyright (c) 2000, 2016, Oracle and/or its affiliates. - Copyright (c) 2009, 2018, MariaDB + Copyright (c) 2000, 2019, Oracle and/or its affiliates. + Copyright (c) 2009, 2019, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -2219,6 +2219,7 @@ public: inplace_alter_handler_ctx() {} virtual ~inplace_alter_handler_ctx() {} + virtual void set_shared_data(const inplace_alter_handler_ctx& ctx) {} }; diff --git a/sql/item_func.h b/sql/item_func.h index 80d90ae21c5..61491b34cf8 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -2466,6 +2466,7 @@ public: void cleanup(); Item *get_copy(THD *thd) { return get_item_copy<Item_func_set_user_var>(thd, this); } + bool excl_dep_on_table(table_map tab_map) { return false; } }; diff --git a/sql/item_sum.cc b/sql/item_sum.cc index ce0c9d3e944..e27b61e9d22 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -3736,6 +3736,7 @@ Item_func_group_concat::Item_func_group_concat(THD *thd, tmp_table_param(item->tmp_table_param), separator(item->separator), tree(item->tree), + tree_len(item->tree_len), unique_filter(item->unique_filter), table(item->table), context(item->context), @@ -3848,7 +3849,10 @@ void Item_func_group_concat::clear() if (row_limit) copy_row_limit= row_limit->val_int(); if (tree) + { reset_tree(tree); + tree_len= 0; + } if (unique_filter) unique_filter->reset(); if (table && table->blob_storage) @@ -3856,6 +3860,62 @@ void Item_func_group_concat::clear() /* No need to reset the table as we never call write_row */ } +struct st_repack_tree { + TREE tree; + TABLE *table; + size_t len, maxlen; +}; + +extern "C" +int copy_to_tree(void* key, element_count count __attribute__((unused)), + void* arg) +{ + struct st_repack_tree *st= (struct st_repack_tree*)arg; + TABLE *table= st->table; + Field* field= table->field[0]; + const uchar *ptr= field->ptr_in_record((uchar*)key - table->s->null_bytes); + size_t len= (size_t)field->val_int(ptr); + + DBUG_ASSERT(count == 1); + if (!tree_insert(&st->tree, key, 0, st->tree.custom_arg)) + return 1; + + st->len += len; + return st->len > st->maxlen; +} + +bool Item_func_group_concat::repack_tree(THD *thd) +{ + struct st_repack_tree st; + + init_tree(&st.tree, (size_t) MY_MIN(thd->variables.max_heap_table_size, + thd->variables.sortbuff_size/16), 0, + tree->size_of_element, group_concat_key_cmp_with_order, NULL, + (void*) this, MYF(MY_THREAD_SPECIFIC)); + st.table= table; + st.len= 0; + st.maxlen= (size_t)thd->variables.group_concat_max_len; + tree_walk(tree, ©_to_tree, &st, left_root_right); + if (st.len <= st.maxlen) // Copying aborted. Must be OOM + { + delete_tree(&st.tree, 0); + return 1; + } + delete_tree(tree, 0); + *tree= st.tree; + tree_len= st.len; + return 0; +} + +/* + Repacking the tree is expensive. But it keeps the tree small, and + inserting into an unnecessary large tree is also waste of time. + + The following number is best-by-test. Test execution time slowly + decreases up to N=10 (that is, factor=1024) and then starts to increase, + again, very slowly. +*/ +#define GCONCAT_REPACK_FACTOR (1 << 10) bool Item_func_group_concat::add() { @@ -3865,6 +3925,9 @@ bool Item_func_group_concat::add() if (copy_funcs(tmp_table_param->items_to_copy, table->in_use)) return TRUE; + size_t row_str_len= 0; + StringBuffer<MAX_FIELD_WIDTH> buf; + String *res; for (uint i= 0; i < arg_count_field; i++) { Item *show_item= args[i]; @@ -3872,8 +3935,13 @@ bool Item_func_group_concat::add() continue; Field *field= show_item->get_tmp_table_field(); - if (field && field->is_null_in_record((const uchar*) table->record[0])) - return 0; // Skip row if it contains null + if (field) + { + if (field->is_null_in_record((const uchar*) table->record[0])) + return 0; // Skip row if it contains null + if (tree && (res= field->val_str(&buf))) + row_str_len+= res->length(); + } } null_value= FALSE; @@ -3891,11 +3959,18 @@ bool Item_func_group_concat::add() TREE_ELEMENT *el= 0; // Only for safety if (row_eligible && tree) { + THD *thd= table->in_use; + table->field[0]->store(row_str_len, FALSE); + if (tree_len > thd->variables.group_concat_max_len * GCONCAT_REPACK_FACTOR + && tree->elements_in_tree > 1) + if (repack_tree(thd)) + return 1; el= tree_insert(tree, table->record[0] + table->s->null_bytes, 0, tree->custom_arg); /* check if there was enough memory to insert the row */ if (!el) return 1; + tree_len+= row_str_len; } /* If the row is not a duplicate (el->count == 1) @@ -4026,10 +4101,19 @@ bool Item_func_group_concat::setup(THD *thd) if (setup_order(thd, Ref_ptr_array(ref_pointer_array, n_elems), context->table_list, list, all_fields, *order)) DBUG_RETURN(TRUE); + /* + Prepend the field to store the length of the string representation + of this row. Used to detect when the tree goes over group_concat_max_len + */ + Item *item= new (thd->mem_root) + Item_uint(thd, thd->variables.group_concat_max_len); + if (!item || all_fields.push_front(item, thd->mem_root)) + DBUG_RETURN(TRUE); } count_field_types(select_lex, tmp_table_param, all_fields, 0); tmp_table_param->force_copy_fields= force_copy_fields; + tmp_table_param->hidden_field_count= (arg_count_order > 0); DBUG_ASSERT(table == 0); if (order_or_distinct) { @@ -4089,10 +4173,11 @@ bool Item_func_group_concat::setup(THD *thd) create this tree. */ init_tree(tree, (size_t)MY_MIN(thd->variables.max_heap_table_size, - thd->variables.sortbuff_size/16), 0, - tree_key_length, + thd->variables.sortbuff_size/16), 0, + tree_key_length, group_concat_key_cmp_with_order, NULL, (void*) this, MYF(MY_THREAD_SPECIFIC)); + tree_len= 0; } if (distinct) diff --git a/sql/item_sum.h b/sql/item_sum.h index b400ebd5f80..7152916498c 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -1750,6 +1750,7 @@ class Item_func_group_concat : public Item_sum String *separator; TREE tree_base; TREE *tree; + size_t tree_len; Item **ref_pointer_array; /** @@ -1796,6 +1797,9 @@ class Item_func_group_concat : public Item_sum friend int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)), void* item_arg); + + bool repack_tree(THD *thd); + public: Item_func_group_concat(THD *thd, Name_resolution_context *context_arg, bool is_distinct, List<Item> *is_select, @@ -1852,8 +1856,8 @@ public: String* val_str(String* str); Item *copy_or_same(THD* thd); void no_rows_in_result() {} - virtual void print(String *str, enum_query_type query_type); - virtual bool change_context_processor(void *cntx) + void print(String *str, enum_query_type query_type); + bool change_context_processor(void *cntx) { context= (Name_resolution_context *)cntx; return FALSE; } Item *get_copy(THD *thd) { return get_item_copy<Item_func_group_concat>(thd, this); } diff --git a/sql/log_event.cc b/sql/log_event.cc index 52556cddd12..fa42e7b0a07 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1,5 +1,5 @@ /* - Copyright (c) 2000, 2018, Oracle and/or its affiliates. + Copyright (c) 2000, 2019, Oracle and/or its affiliates. Copyright (c) 2009, 2019, MariaDB This program is free software; you can redistribute it and/or modify @@ -39,6 +39,7 @@ #include "transaction.h" #include <my_dir.h> #include "sql_show.h" // append_identifier +#include "debug_sync.h" // debug_sync #include <mysql/psi/mysql_statement.h> #include <strfunc.h> #include "compat56.h" @@ -11279,6 +11280,12 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) /* A small test to verify that objects have consistent types */ DBUG_ASSERT(sizeof(thd->variables.option_bits) == sizeof(OPTION_RELAXED_UNIQUE_CHECKS)); + DBUG_EXECUTE_IF("rows_log_event_before_open_table", + { + const char action[] = "now SIGNAL before_open_table WAIT_FOR go_ahead_sql"; + DBUG_ASSERT(!debug_sync_set_action(thd, STRING_WITH_LEN(action))); + };); + if (slave_run_triggers_for_rbr) { LEX *lex= thd->lex; @@ -11303,7 +11310,6 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) } if (unlikely(open_and_lock_tables(thd, rgi->tables_to_lock, FALSE, 0))) { - uint actual_error= thd->get_stmt_da()->sql_errno(); #ifdef WITH_WSREP if (WSREP(thd)) { @@ -11316,23 +11322,22 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) (long long)wsrep_thd_trx_seqno(thd)); } #endif - if ((thd->is_slave_error || thd->is_fatal_error) && - !is_parallel_retry_error(rgi, actual_error)) + if (thd->is_error() && + !is_parallel_retry_error(rgi, error= thd->get_stmt_da()->sql_errno())) { /* Error reporting borrowed from Query_log_event with many excessive - simplifications. + simplifications. We should not honour --slave-skip-errors at this point as we are - having severe errors which should not be skiped. + having severe errors which should not be skipped. */ - rli->report(ERROR_LEVEL, actual_error, rgi->gtid_info(), + rli->report(ERROR_LEVEL, error, rgi->gtid_info(), "Error executing row event: '%s'", - (actual_error ? thd->get_stmt_da()->message() : + (error ? thd->get_stmt_da()->message() : "unexpected success or fatal error")); thd->is_slave_error= 1; } /* remove trigger's tables */ - error= actual_error; goto err; } diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index b5381ec6d74..f56bc86127d 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2007, 2018, Oracle and/or its affiliates. - Copyright (c) 2009, 2018, MariaDB +/* Copyright (c) 2007, 2019, Oracle and/or its affiliates. + Copyright (c) 2009, 2019, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -101,21 +101,20 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, rpl_group_info *rgi) if (unlikely(open_and_lock_tables(ev_thd, rgi->tables_to_lock, FALSE, 0))) { - uint actual_error= ev_thd->get_stmt_da()->sql_errno(); - if (ev_thd->is_slave_error || ev_thd->is_fatal_error) + if (ev_thd->is_error()) { /* Error reporting borrowed from Query_log_event with many excessive - simplifications (we don't honour --slave-skip-errors) + simplifications. + We should not honour --slave-skip-errors at this point as we are + having severe errors which should not be skipped. */ - rli->report(ERROR_LEVEL, actual_error, NULL, + rli->report(ERROR_LEVEL, ev_thd->get_stmt_da()->sql_errno(), NULL, "Error '%s' on opening tables", - (actual_error ? ev_thd->get_stmt_da()->message() : - "unexpected success or fatal error")); + ev_thd->get_stmt_da()->message()); ev_thd->is_slave_error= 1; } - rgi->slave_close_thread_tables(thd); - DBUG_RETURN(actual_error); + DBUG_RETURN(1); } /* diff --git a/sql/mysql_upgrade_service.cc b/sql/mysql_upgrade_service.cc index 9ea78accf44..94ca10766d8 100644 --- a/sql/mysql_upgrade_service.cc +++ b/sql/mysql_upgrade_service.cc @@ -159,8 +159,9 @@ static void die(const char *fmt, ...) #define WRITE_LOG(fmt,...) {\ char log_buf[1024]; \ + DWORD nbytes; \ snprintf(log_buf,sizeof(log_buf), fmt, __VA_ARGS__);\ - WriteFile(logfile_handle,log_buf, (DWORD)strlen(log_buf), 0 , 0);\ + WriteFile(logfile_handle,log_buf, (DWORD)strlen(log_buf), &nbytes , 0);\ } /* diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a824d0898d6..1f155b32903 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -4173,6 +4173,39 @@ static int init_early_variables() return 0; } +#ifdef _WIN32 +static void get_win_tzname(char* buf, size_t size) +{ + static struct + { + const wchar_t* windows_name; + const char* tzdb_name; + } + tz_data[] = + { +#include "win_tzname_data.h" + {0,0} + }; + DYNAMIC_TIME_ZONE_INFORMATION tzinfo; + if (GetDynamicTimeZoneInformation(&tzinfo) == TIME_ZONE_ID_UNKNOWN) + { + strncpy(buf, "unknown", size); + return; + } + + for (size_t i= 0; tz_data[i].windows_name; i++) + { + if (wcscmp(tzinfo.TimeZoneKeyName, tz_data[i].windows_name) == 0) + { + strncpy(buf, tz_data[i].tzdb_name, size); + return; + } + } + wcstombs(buf, tzinfo.TimeZoneKeyName, size); + buf[size-1]= 0; + return; +} +#endif static int init_common_variables() { @@ -4228,22 +4261,13 @@ static int init_common_variables() if (ignore_db_dirs_init()) exit(1); -#ifdef HAVE_TZNAME +#ifdef _WIN32 + get_win_tzname(system_time_zone, sizeof(system_time_zone)); +#elif defined(HAVE_TZNAME) struct tm tm_tmp; localtime_r(&server_start_time,&tm_tmp); const char *tz_name= tzname[tm_tmp.tm_isdst != 0 ? 1 : 0]; -#ifdef _WIN32 - /* - Time zone name may be localized and contain non-ASCII characters, - Convert from ANSI encoding to UTF8. - */ - wchar_t wtz_name[sizeof(system_time_zone)]; - mbstowcs(wtz_name, tz_name, sizeof(system_time_zone)-1); - WideCharToMultiByte(CP_UTF8,0, wtz_name, -1, system_time_zone, - sizeof(system_time_zone) - 1, NULL, NULL); -#else strmake_buf(system_time_zone, tz_name); -#endif /* _WIN32 */ #endif /* HAVE_TZNAME */ /* diff --git a/sql/mysqld.h b/sql/mysqld.h index dccf7436f80..cb57682bcfc 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -65,7 +65,7 @@ typedef Bitmap<((MAX_INDEXES+7)/8*8)> key_map; /* Used for finding keys */ #define OPT_SESSION SHOW_OPT_SESSION #define OPT_GLOBAL SHOW_OPT_GLOBAL -extern MY_TIMER_INFO sys_timer_info; +extern MYSQL_PLUGIN_IMPORT MY_TIMER_INFO sys_timer_info; /* Values for --slave-parallel-mode diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 74aed792f1d..99af1c60287 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -6134,8 +6134,8 @@ ER_EVENT_RECURSION_FORBIDDEN eng "Recursion of EVENT DDL statements is forbidden when body is present" ger "Rekursivität von EVENT-DDL-Anweisungen ist unzulässig wenn ein Hauptteil (Body) existiert" ER_EVENTS_DB_ERROR - eng "Cannot proceed because system tables used by Event Scheduler were found damaged at server start" - ger "Kann nicht weitermachen, weil die Tabellen, die von Events verwendet werden, beim Serverstart als beschädigt markiert wurden" + eng "Cannot proceed, because event scheduler is disabled" + ger "Die Operation kann nicht fortgesetzt werden, da Event Scheduler deaktiviert ist." ER_ONLY_INTEGERS_ALLOWED eng "Only integers allowed as number here" ger "An dieser Stelle sind nur Ganzzahlen zulässig" diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 924fd04007e..747bf92dbf9 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1496,7 +1496,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success) NULL. In this case, mysql_change_db() would generate an error. */ - err_status|= mysql_change_db(thd, (LEX_CSTRING*) &saved_cur_db_name, TRUE); + err_status|= mysql_change_db(thd, (LEX_CSTRING*)&saved_cur_db_name, TRUE) != 0; } m_flags&= ~IS_INVOKED; if (m_parent) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index ed200bba763..60697ab3449 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -770,8 +770,7 @@ class Grant_table_base void init(enum thr_lock_type lock_type, bool is_optional) { tl.open_type= OT_BASE_ONLY; - if (lock_type >= TL_WRITE_ALLOW_WRITE) - tl.updating= 1; + tl.i_s_requested_object= OPEN_TABLE_ONLY; if (is_optional) tl.open_strategy= TABLE_LIST::OPEN_IF_EXISTS; } @@ -1772,6 +1771,12 @@ static bool acl_load(THD *thd, const Grant_tables& tables) if (user_table.init_read_record(&read_record_info, thd)) DBUG_RETURN(true); + if (user_table.num_fields() < 13) // number of columns in 3.21 + { + sql_print_error("Fatal error: mysql.user table is damaged or in " + "unsupported 3.20 format."); + DBUG_RETURN(true); + } username_char_length= MY_MIN(user_table.user()->char_length(), USERNAME_CHAR_LENGTH); if (user_table.password()) // Password column might be missing. (MySQL 5.7.6+) @@ -12092,7 +12097,7 @@ struct MPVIO_EXT :public MYSQL_PLUGIN_VIO }; /** - a helper function to report an access denied error in all the proper places + a helper function to report an access denied error in most proper places */ static void login_failed_error(THD *thd) { @@ -13526,10 +13531,26 @@ bool acl_authenticate(THD *thd, uint com_change_user_pkt_len) /* Change a database if necessary */ if (mpvio.db.length) { - if (mysql_change_db(thd, &mpvio.db, FALSE)) + uint err = mysql_change_db(thd, &mpvio.db, FALSE); + if(err) { - /* mysql_change_db() has pushed the error message. */ - status_var_increment(thd->status_var.access_denied_errors); + if (err == ER_DBACCESS_DENIED_ERROR) + { + /* + Got an "access denied" error, which must be handled + other access denied errors (see login_failed_error()). + mysql_change_db() already sent error to client, and + wrote to general log, we only need to increment the counter + and maybe write a warning to error log. + */ + status_var_increment(thd->status_var.access_denied_errors); + if (global_system_variables.log_warnings > 1) + { + Security_context* sctx = thd->security_ctx; + sql_print_warning(ER_THD(thd, err), + sctx->priv_user, sctx->priv_host, mpvio.db.str); + } + } DBUG_RETURN(1); } } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index ddb8fee6f70..73817ddb722 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -3362,6 +3362,47 @@ open_and_process_routine(THD *thd, Query_tables_list *prelocking_ctx, DBUG_RETURN(FALSE); } +/* + If we are not already in prelocked mode and extended table list is not + yet built we might have to build the prelocking set for this statement. + + Since currently no prelocking strategy prescribes doing anything for + tables which are only read, we do below checks only if table is going + to be changed. +*/ +bool extend_table_list(THD *thd, TABLE_LIST *tables, + Prelocking_strategy *prelocking_strategy, + bool has_prelocking_list) +{ + bool error= false; + LEX *lex= thd->lex; + bool maybe_need_prelocking= + (tables->updating && tables->lock_type >= TL_WRITE_ALLOW_WRITE) + || thd->lex->default_used; + + if (thd->locked_tables_mode <= LTM_LOCK_TABLES && + ! has_prelocking_list && maybe_need_prelocking) + { + bool need_prelocking= FALSE; + TABLE_LIST **save_query_tables_last= lex->query_tables_last; + /* + Extend statement's table list and the prelocking set with + tables and routines according to the current prelocking + strategy. + + For example, for DML statements we need to add tables and routines + used by triggers which are going to be invoked for this element of + table list and also add tables required for handling of foreign keys. + */ + error= prelocking_strategy->handle_table(thd, lex, tables, + &need_prelocking); + + if (need_prelocking && ! lex->requires_prelocking()) + lex->mark_as_requiring_prelocking(save_query_tables_last); + } + return error; +} + /** Handle table list element by obtaining metadata lock, opening table or view @@ -3388,14 +3429,13 @@ open_and_process_routine(THD *thd, Query_tables_list *prelocking_ctx, */ static bool -open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables, - uint *counter, uint flags, +open_and_process_table(THD *thd, TABLE_LIST *tables, uint *counter, uint flags, Prelocking_strategy *prelocking_strategy, - bool has_prelocking_list, - Open_table_context *ot_ctx) + bool has_prelocking_list, Open_table_context *ot_ctx) { bool error= FALSE; bool safe_to_ignore_table= FALSE; + LEX *lex= thd->lex; DBUG_ENTER("open_and_process_table"); DEBUG_SYNC(thd, "open_and_process_table"); @@ -3670,38 +3710,9 @@ open_and_process_table(THD *thd, LEX *lex, TABLE_LIST *tables, if (tables->open_strategy && !tables->table) goto end; - /* - If we are not already in prelocked mode and extended table list is not - yet built we might have to build the prelocking set for this statement. - - Since currently no prelocking strategy prescribes doing anything for - tables which are only read, we do below checks only if table is going - to be changed. - */ - if (thd->locked_tables_mode <= LTM_LOCK_TABLES && - ! has_prelocking_list && - (tables->lock_type >= TL_WRITE_ALLOW_WRITE || thd->lex->default_used)) - { - bool need_prelocking= FALSE; - TABLE_LIST **save_query_tables_last= lex->query_tables_last; - /* - Extend statement's table list and the prelocking set with - tables and routines according to the current prelocking - strategy. - - For example, for DML statements we need to add tables and routines - used by triggers which are going to be invoked for this element of - table list and also add tables required for handling of foreign keys. - */ - error= prelocking_strategy->handle_table(thd, lex, tables, - &need_prelocking); - - if (need_prelocking && ! lex->requires_prelocking()) - lex->mark_as_requiring_prelocking(save_query_tables_last); - - if (unlikely(error)) - goto end; - } + error= extend_table_list(thd, tables, prelocking_strategy, has_prelocking_list); + if (unlikely(error)) + goto end; /* Copy grant information from TABLE_LIST instance to TABLE one. */ tables->table->grant= tables->grant; @@ -3879,8 +3890,8 @@ lock_table_names(THD *thd, const DDL_options_st &options, if (create_table) #ifdef WITH_WSREP - if (thd->lex->sql_command != SQLCOM_CREATE_TABLE && - thd->wsrep_exec_mode != REPL_RECV) + if (!(thd->lex->sql_command == SQLCOM_CREATE_TABLE && + thd->wsrep_exec_mode == REPL_RECV)) #endif lock_wait_timeout= 0; // Don't wait for timeout } @@ -3892,6 +3903,7 @@ lock_table_names(THD *thd, const DDL_options_st &options, bool res= thd->mdl_context.acquire_locks(&mdl_requests, lock_wait_timeout); if (create_table) thd->pop_internal_handler(); + if (!res) DBUG_RETURN(FALSE); // Got locks @@ -4026,7 +4038,8 @@ open_tables_check_upgradable_mdl(THD *thd, TABLE_LIST *tables_start, */ bool open_tables(THD *thd, const DDL_options_st &options, - TABLE_LIST **start, uint *counter, uint flags, + TABLE_LIST **start, uint *counter, + Sroutine_hash_entry **sroutine_to_open_list, uint flags, Prelocking_strategy *prelocking_strategy) { /* @@ -4069,7 +4082,7 @@ restart: has_prelocking_list= thd->lex->requires_prelocking(); table_to_open= start; - sroutine_to_open= (Sroutine_hash_entry**) &thd->lex->sroutines_list.first; + sroutine_to_open= sroutine_to_open_list; *counter= 0; THD_STAGE_INFO(thd, stage_opening_tables); @@ -4139,9 +4152,9 @@ restart: for (tables= *table_to_open; tables; table_to_open= &tables->next_global, tables= tables->next_global) { - error= open_and_process_table(thd, thd->lex, tables, counter, - flags, prelocking_strategy, - has_prelocking_list, &ot_ctx); + error= open_and_process_table(thd, tables, counter, flags, + prelocking_strategy, has_prelocking_list, + &ot_ctx); if (unlikely(error)) { @@ -8688,8 +8701,7 @@ my_bool mysql_rm_tmp_tables(void) { file=dirp->dir_entry+idx; - if (!memcmp(file->name, tmp_file_prefix, - tmp_file_prefix_length)) + if (!strncmp(file->name, tmp_file_prefix, tmp_file_prefix_length)) { char *ext= fn_ext(file->name); size_t ext_len= strlen(ext); diff --git a/sql/sql_base.h b/sql/sql_base.h index 22247af07a8..5c2ff18b170 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -240,8 +240,19 @@ lock_table_names(THD *thd, TABLE_LIST *table_list, table_list_end, lock_wait_timeout, flags); } bool open_tables(THD *thd, const DDL_options_st &options, - TABLE_LIST **tables, uint *counter, uint flags, + TABLE_LIST **tables, uint *counter, + Sroutine_hash_entry **sroutine_to_open, uint flags, Prelocking_strategy *prelocking_strategy); + +static inline bool +open_tables(THD *thd, const DDL_options_st &options, TABLE_LIST **tables, + uint *counter, uint flags, Prelocking_strategy *prelocking_strategy) +{ + return open_tables(thd, options, tables, counter, + &thd->lex->sroutines_list.first, flags, + prelocking_strategy); +} + static inline bool open_tables(THD *thd, TABLE_LIST **tables, uint *counter, uint flags, Prelocking_strategy *prelocking_strategy) @@ -505,6 +516,10 @@ inline bool open_and_lock_tables(THD *thd, TABLE_LIST *tables, bool restart_trans_for_tables(THD *thd, TABLE_LIST *table); +bool extend_table_list(THD *thd, TABLE_LIST *tables, + Prelocking_strategy *prelocking_strategy, + bool has_prelocking_list); + /** A context of open_tables() function, used to recover from a failed open_table() or open_routine() attempt. diff --git a/sql/sql_class.h b/sql/sql_class.h index 221e453eab5..2a949856879 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -38,6 +38,7 @@ #include "thr_timer.h" #include "thr_malloc.h" #include "log_slow.h" /* LOG_SLOW_DISABLE_... */ +#include <my_tree.h> #include "sql_digest_stream.h" // sql_digest_state diff --git a/sql/sql_db.cc b/sql/sql_db.cc index cce0bdadedb..957b676f81f 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -1441,12 +1441,12 @@ static void backup_current_db_name(THD *thd, a stack pointer set by Stored Procedures was used by replication after the stack address was long gone. - @return Operation status - @retval FALSE Success - @retval TRUE Error + @return error code (ER_XXX) + @retval 0 Success + @retval >0 Error */ -bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, +uint mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, bool force_switch) { LEX_CSTRING new_db_file_name; @@ -1477,7 +1477,7 @@ bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, { my_message(ER_NO_DB_ERROR, ER_THD(thd, ER_NO_DB_ERROR), MYF(0)); - DBUG_RETURN(TRUE); + DBUG_RETURN(ER_NO_DB_ERROR); } } DBUG_PRINT("enter",("name: '%s'", new_db_name->str)); @@ -1503,7 +1503,7 @@ bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, new_db_file_name.length= new_db_name->length; if (new_db_file_name.str == NULL) - DBUG_RETURN(TRUE); /* the error is set */ + DBUG_RETURN(ER_OUT_OF_RESOURCES); /* the error is set */ /* NOTE: if check_db_name() fails, we should throw an error in any case, @@ -1523,7 +1523,7 @@ bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, if (force_switch) mysql_change_db_impl(thd, NULL, 0, thd->variables.collation_server); - DBUG_RETURN(TRUE); + DBUG_RETURN(ER_WRONG_DB_NAME); } DBUG_PRINT("info",("Use database: %s", new_db_file_name.str)); @@ -1553,7 +1553,7 @@ bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, general_log_print(thd, COM_INIT_DB, ER_THD(thd, ER_DBACCESS_DENIED_ERROR), sctx->priv_user, sctx->priv_host, new_db_file_name.str); my_free(const_cast<char*>(new_db_file_name.str)); - DBUG_RETURN(TRUE); + DBUG_RETURN(ER_DBACCESS_DENIED_ERROR); } #endif @@ -1587,7 +1587,7 @@ bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, /* The operation failed. */ - DBUG_RETURN(TRUE); + DBUG_RETURN(ER_BAD_DB_ERROR); } } @@ -1603,7 +1603,7 @@ bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, done: SESSION_TRACKER_CHANGED(thd, CURRENT_SCHEMA_TRACKER, NULL); SESSION_TRACKER_CHANGED(thd, SESSION_STATE_CHANGE_TRACKER, NULL); - DBUG_RETURN(FALSE); + DBUG_RETURN(0); } @@ -1851,7 +1851,7 @@ bool mysql_upgrade_db(THD *thd, const LEX_CSTRING *old_db) /* Step9: Let's do "use newdb" if we renamed the current database */ if (change_to_newdb) - error|= mysql_change_db(thd, & new_db, FALSE); + error|= mysql_change_db(thd, & new_db, FALSE) != 0; exit: DBUG_RETURN(error); diff --git a/sql/sql_db.h b/sql/sql_db.h index c0646bd65f0..7eee86fa7c8 100644 --- a/sql/sql_db.h +++ b/sql/sql_db.h @@ -26,7 +26,7 @@ bool mysql_alter_db(THD *thd, const LEX_CSTRING *db, const Schema_specification_st *create); bool mysql_rm_db(THD *thd, const LEX_CSTRING *db, bool if_exists); bool mysql_upgrade_db(THD *thd, const LEX_CSTRING *old_db); -bool mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, +uint mysql_change_db(THD *thd, const LEX_CSTRING *new_db_name, bool force_switch); bool mysql_opt_change_db(THD *thd, diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 24383b1949c..40d6799ece7 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1229,7 +1229,7 @@ public: TABLE_LIST *convert_right_join(); List<Item>* get_item_list(); ulong get_table_join_options(); - void set_lock_for_tables(thr_lock_type lock_type); + void set_lock_for_tables(thr_lock_type lock_type, bool for_update); inline void init_order() { order_list.elements= 0; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index ab649f23160..7a74f322dc1 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3406,9 +3406,6 @@ mysql_execute_command(THD *thd) my_message(ER_SLAVE_IGNORED_TABLE, ER_THD(thd, ER_SLAVE_IGNORED_TABLE), MYF(0)); } - - for (table=all_tables; table; table=table->next_global) - table->updating= TRUE; } /* @@ -4602,6 +4599,16 @@ end_with_restore_list: res= 0; unit->set_limit(select_lex); + /* + We can not use mysql_explain_union() because of parameters of + mysql_select in mysql_multi_update so just set the option if needed + */ + if (thd->lex->describe) + { + select_lex->set_explain_type(FALSE); + select_lex->options|= SELECT_DESCRIBE; + } + res= mysql_multi_update_prepare(thd); #ifdef HAVE_REPLICATION @@ -8680,9 +8687,8 @@ bool st_select_lex::add_window_spec(THD *thd, query */ -void st_select_lex::set_lock_for_tables(thr_lock_type lock_type) +void st_select_lex::set_lock_for_tables(thr_lock_type lock_type, bool for_update) { - bool for_update= lock_type >= TL_READ_NO_INSERT; DBUG_ENTER("set_lock_for_tables"); DBUG_PRINT("enter", ("lock_type: %d for_update: %d", lock_type, for_update)); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7b98a235ab0..20551285d70 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1219,8 +1219,9 @@ JOIN::prepare(TABLE_LIST *tables_init, item->max_length))) real_order= TRUE; - if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM) - item->split_sum_func(thd, ref_ptrs, all_fields, 0); + if ((item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM) || + item->with_window_func) + item->split_sum_func(thd, ref_ptrs, all_fields, SPLIT_SUM_SELECT); } if (!real_order) order= NULL; @@ -9381,7 +9382,7 @@ JOIN_TAB *next_linear_tab(JOIN* join, JOIN_TAB* tab, } /* If no more JOIN_TAB's on the top level */ - if (++tab == join->join_tab + join->top_join_tab_count + join->aggr_tables) + if (++tab >= join->join_tab + join->exec_join_tab_cnt() + join->aggr_tables) return NULL; if (include_bush_roots == WITHOUT_BUSH_ROOTS && tab->bush_children) @@ -17023,28 +17024,28 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, /* Fall through */ case Item::COND_ITEM: + case Item::SUBSELECT_ITEM: + case Item::REF_ITEM: + case Item::EXPR_CACHE_ITEM: + if (make_copy_field) + { + DBUG_ASSERT(((Item_result_field*)item)->result_field); + *from_field= ((Item_result_field*)item)->result_field; + } + /* Fall through */ case Item::FIELD_AVG_ITEM: case Item::FIELD_STD_ITEM: - case Item::SUBSELECT_ITEM: - /* The following can only happen with 'CREATE TABLE ... SELECT' */ case Item::PROC_ITEM: case Item::INT_ITEM: case Item::REAL_ITEM: case Item::DECIMAL_ITEM: case Item::STRING_ITEM: case Item::DATE_ITEM: - case Item::REF_ITEM: case Item::NULL_ITEM: case Item::VARBIN_ITEM: case Item::CACHE_ITEM: case Item::WINDOW_FUNC_ITEM: // psergey-winfunc: - case Item::EXPR_CACHE_ITEM: case Item::PARAM_ITEM: - if (make_copy_field) - { - DBUG_ASSERT(((Item_result_field*)item)->result_field); - *from_field= ((Item_result_field*)item)->result_field; - } return create_tmp_field_from_item(thd, item, table, (make_copy_field ? 0 : copy_func), modify_item); @@ -23215,6 +23216,10 @@ int setup_order(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables, my_error(ER_WINDOW_FUNCTION_IN_WINDOW_SPEC, MYF(0)); return 1; } + if (from_window_spec && (*order->item)->with_sum_func && + (*order->item)->type() != Item::SUM_FUNC_ITEM) + (*order->item)->split_sum_func(thd, ref_pointer_array, + all_fields, SPLIT_SUM_SELECT); } return 0; } @@ -23282,6 +23287,10 @@ setup_group(THD *thd, Ref_ptr_array ref_pointer_array, TABLE_LIST *tables, my_error(ER_WINDOW_FUNCTION_IN_WINDOW_SPEC, MYF(0)); return 1; } + if (from_window_spec && (*ord->item)->with_sum_func && + (*ord->item)->type() != Item::SUM_FUNC_ITEM) + (*ord->item)->split_sum_func(thd, ref_pointer_array, + all_fields, SPLIT_SUM_SELECT); } if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY && context_analysis_place == IN_GROUP_BY) @@ -27441,27 +27450,6 @@ AGGR_OP::end_send() } else { - /* - In case we have window functions present, an extra step is required - to compute all the fields from the temporary table. - In case we have a compound expression such as: expr + expr, - where one of the terms has a window function inside it, only - after computing window function values we actually know the true - final result of the compounded expression. - - Go through all the func items and save their values once again in the - corresponding temp table fields. Do this for each row in the table. - */ - if (join_tab->window_funcs_step) - { - Item **func_ptr= join_tab->tmp_table_param->items_to_copy; - Item *func; - for (; (func = *func_ptr) ; func_ptr++) - { - if (func->with_window_func) - func->save_in_result_field(true); - } - } rc= evaluate_join_record(join, join_tab, 0); } } diff --git a/sql/sql_show.cc b/sql/sql_show.cc index fe8ed5076a8..8ec5435fd45 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -8520,7 +8520,6 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list) table->alias_name_used= my_strcasecmp(table_alias_charset, table_list->schema_table_name.str, table_list->alias.str); - table_list->table_name= table->s->table_name; table_list->table= table; table->next= thd->derived_tables; thd->derived_tables= table; diff --git a/sql/sql_statistics.cc b/sql/sql_statistics.cc index c751b079147..02598897028 100644 --- a/sql/sql_statistics.cc +++ b/sql/sql_statistics.cc @@ -3293,12 +3293,13 @@ int read_statistics_for_tables_if_needed(THD *thd, TABLE_LIST *tables) if (table_share->stats_cb.stats_is_read) tl->table->stats_is_read= TRUE; if (thd->variables.optimizer_use_condition_selectivity > 3 && - table_share && !table_share->stats_cb.histograms_are_read) + table_share && table_share->stats_cb.stats_can_be_read && + !table_share->stats_cb.histograms_are_read) { (void) read_histograms_for_table(thd, tl->table, stat_tables); table_share->stats_cb.histograms_are_read= TRUE; } - if (table_share->stats_cb.stats_is_read) + if (table_share->stats_cb.histograms_are_read) tl->table->histograms_are_read= TRUE; } } @@ -4077,6 +4078,14 @@ bool is_stat_table(const LEX_CSTRING *db, LEX_CSTRING *table) bool is_eits_usable(Field *field) { + Column_statistics* col_stats= field->read_stats; + + // check if column_statistics was allocated for this field + if (!col_stats) + return false; + + DBUG_ASSERT(field->table->stats_is_read); + /* (1): checks if we have EITS statistics for a particular column (2): Don't use EITS for GEOMETRY columns @@ -4084,10 +4093,9 @@ bool is_eits_usable(Field *field) partition list of a table. We assume the selecticivity for such columns would be handled during partition pruning. */ - DBUG_ASSERT(field->table->stats_is_read); - Column_statistics* col_stats= field->read_stats; - return col_stats && !col_stats->no_stat_values_provided() && //(1) - field->type() != MYSQL_TYPE_GEOMETRY && //(2) + + return !col_stats->no_stat_values_provided() && //(1) + field->type() != MYSQL_TYPE_GEOMETRY && //(2) #ifdef WITH_PARTITION_STORAGE_ENGINE (!field->table->part_info || !field->table->part_info->field_in_partition_expr(field)) && //(3) diff --git a/sql/sql_string.cc b/sql/sql_string.cc index cc77452ecd1..fa27bc968da 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -996,6 +996,27 @@ String *copy_if_not_alloced(String *to,String *from,uint32 from_length) (void) from->realloc(from_length); return from; } + if (from->uses_buffer_owned_by(to)) + { + DBUG_ASSERT(!from->alloced); + DBUG_ASSERT(to->alloced); + /* + "from" is a constant string pointing to a fragment of alloced string "to": + to= xxxFFFyyy + - FFF is the part of "to" pointed by "from" + - xxx is the part of "to" before "from" + - yyy is the part of "to" after "from" + */ + uint32 xxx_length= (uint32) (from->ptr() - to->ptr()); + uint32 yyy_length= (uint32) (to->end() - from->end()); + DBUG_ASSERT(to->length() >= yyy_length); + to->length(to->length() - yyy_length); // Remove the "yyy" part + DBUG_ASSERT(to->length() >= xxx_length); + to->replace(0, xxx_length, "", 0); // Remove the "xxx" part + to->realloc(from_length); + to->str_charset= from->str_charset; + return to; + } if (to->realloc(from_length)) return from; // Actually an error if ((to->str_length=MY_MIN(from->str_length,from_length))) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index cbea0c6cbfd..513b6a2e2f3 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -8811,6 +8811,52 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table, } } + /* + Normally, an attempt to modify an FK parent table will cause + FK children to be prelocked, so the table-being-altered cannot + be modified by a cascade FK action, because ALTER holds a lock + and prelocking will wait. + + But if a new FK is being added by this very ALTER, then the target + table is not locked yet (it's a temporary table). So, we have to + lock FK parents explicitly. + */ + if (alter_info->flags & ALTER_ADD_FOREIGN_KEY) + { + List_iterator<Key> fk_list_it(alter_info->key_list); + + while (Key *key= fk_list_it++) + { + if (key->type != Key::FOREIGN_KEY) + continue; + + Foreign_key *fk= static_cast<Foreign_key*>(key); + char dbuf[NAME_LEN]; + char tbuf[NAME_LEN]; + const char *ref_db= (fk->ref_db.str ? + fk->ref_db.str : + alter_ctx->new_db.str); + const char *ref_table= fk->ref_table.str; + MDL_request mdl_request; + + if (lower_case_table_names) + { + strmake_buf(dbuf, ref_db); + my_casedn_str(system_charset_info, dbuf); + strmake_buf(tbuf, ref_table); + my_casedn_str(system_charset_info, tbuf); + ref_db= dbuf; + ref_table= tbuf; + } + + mdl_request.init(MDL_key::TABLE, ref_db, ref_table, MDL_SHARED_NO_WRITE, + MDL_TRANSACTION); + if (thd->mdl_context.acquire_lock(&mdl_request, + thd->variables.lock_wait_timeout)) + DBUG_RETURN(true); + } + } + DBUG_RETURN(false); } @@ -9812,6 +9858,7 @@ do_continue:; /* Mark that we have created table in storage engine. */ no_ha_table= false; + DEBUG_SYNC(thd, "alter_table_intermediate_table_created"); new_table= thd->create_and_open_tmp_table(new_db_type, &frm, alter_ctx.get_tmp_path(), @@ -9827,54 +9874,6 @@ do_continue:; /* in case of alter temp table send the tracker in OK packet */ SESSION_TRACKER_CHANGED(thd, SESSION_STATE_CHANGE_TRACKER, NULL); } - else - { - /* - Normally, an attempt to modify an FK parent table will cause - FK children to be prelocked, so the table-being-altered cannot - be modified by a cascade FK action, because ALTER holds a lock - and prelocking will wait. - - But if a new FK is being added by this very ALTER, then the target - table is not locked yet (it's a temporary table). So, we have to - lock FK parents explicitly. - */ - if (alter_info->flags & ALTER_ADD_FOREIGN_KEY) - { - List <FOREIGN_KEY_INFO> fk_list; - List_iterator<FOREIGN_KEY_INFO> fk_list_it(fk_list); - FOREIGN_KEY_INFO *fk; - - /* tables_opened can be > 1 only for MERGE tables */ - DBUG_ASSERT(tables_opened == 1); - DBUG_ASSERT(&table_list->next_global == thd->lex->query_tables_last); - - new_table->file->get_foreign_key_list(thd, &fk_list); - while ((fk= fk_list_it++)) - { - MDL_request mdl_request; - - if (lower_case_table_names) - { - char buf[NAME_LEN]; - size_t len; - strmake_buf(buf, fk->referenced_db->str); - len = my_casedn_str(files_charset_info, buf); - thd->make_lex_string(fk->referenced_db, buf, len); - strmake_buf(buf, fk->referenced_table->str); - len = my_casedn_str(files_charset_info, buf); - thd->make_lex_string(fk->referenced_table, buf, len); - } - - mdl_request.init(MDL_key::TABLE, - fk->referenced_db->str, fk->referenced_table->str, - MDL_SHARED_NO_WRITE, MDL_TRANSACTION); - if (thd->mdl_context.acquire_lock(&mdl_request, - thd->variables.lock_wait_timeout)) - goto err_new_table_cleanup; - } - } - } /* Note: In case of MERGE table, we do not attach children. We do not diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index bab9bb5e9ac..d87fe13b10e 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -147,15 +147,11 @@ fk_truncate_illegal_if_parent(THD *thd, TABLE *table) /* Loop over the set of foreign keys for which this table is a parent. */ while ((fk_info= it++)) { - DBUG_ASSERT(!lex_string_cmp(system_charset_info, - fk_info->referenced_db, - &table->s->db)); - - DBUG_ASSERT(!lex_string_cmp(system_charset_info, - fk_info->referenced_table, - &table->s->table_name)); - - if (lex_string_cmp(system_charset_info, fk_info->foreign_db, + if (lex_string_cmp(system_charset_info, fk_info->referenced_db, + &table->s->db) || + lex_string_cmp(system_charset_info, fk_info->referenced_table, + &table->s->table_name) || + lex_string_cmp(system_charset_info, fk_info->foreign_db, &table->s->db) || lex_string_cmp(system_charset_info, fk_info->foreign_table, &table->s->table_name)) diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 497f419c1db..32ac28f6e46 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1536,6 +1536,9 @@ int mysql_multi_update_prepare(THD *thd) List<Item> *fields= &lex->select_lex.item_list; table_map tables_for_update; bool update_view= 0; + DML_prelocking_strategy prelocking_strategy; + bool has_prelocking_list= thd->lex->requires_prelocking(); + /* if this multi-update was converted from usual update, here is table counter else junk will be assigned here, but then replaced with real @@ -1556,10 +1559,10 @@ int mysql_multi_update_prepare(THD *thd) keep prepare of multi-UPDATE compatible with concurrent LOCK TABLES WRITE and global read lock. */ - if ((original_multiupdate && - open_tables(thd, &table_list, &table_count, - (thd->stmt_arena->is_stmt_prepare() ? - MYSQL_OPEN_FORCE_SHARED_MDL : 0))) || + if ((original_multiupdate && open_tables(thd, &table_list, &table_count, + thd->stmt_arena->is_stmt_prepare() + ? MYSQL_OPEN_FORCE_SHARED_MDL : 0, + &prelocking_strategy)) || mysql_handle_derived(lex, DT_INIT)) DBUG_RETURN(TRUE); /* @@ -1608,6 +1611,9 @@ int mysql_multi_update_prepare(THD *thd) if (unsafe_key_update(lex->select_lex.leaf_tables, tables_for_update)) DBUG_RETURN(true); + TABLE_LIST **new_tables= lex->query_tables_last; + DBUG_ASSERT(*new_tables== NULL); + /* Setup timestamp handling and locking mode */ @@ -1635,6 +1641,11 @@ int mysql_multi_update_prepare(THD *thd) If table will be updated we should not downgrade lock for it and leave it as is. */ + tl->updating= 1; + if (tl->belong_to_view) + tl->belong_to_view->updating= 1; + if (extend_table_list(thd, tl, &prelocking_strategy, has_prelocking_list)) + DBUG_RETURN(TRUE); } else { @@ -1657,7 +1668,6 @@ int mysql_multi_update_prepare(THD *thd) tl->lock_type= lock_type; else tl->set_lock_type(thd, lock_type); - tl->updating= 0; } } @@ -1666,6 +1676,20 @@ int mysql_multi_update_prepare(THD *thd) Note that unlike in the above loop we need to iterate here not only through all leaf tables but also through all view hierarchy. */ + + uint addon_table_count= 0; + if (*new_tables) + { + Sroutine_hash_entry **new_routines= thd->lex->sroutines_list.next; + DBUG_ASSERT(*new_routines == NULL); + if (open_tables(thd, thd->lex->create_info, new_tables, + &addon_table_count, new_routines, + thd->stmt_arena->is_stmt_prepare() + ? MYSQL_OPEN_FORCE_SHARED_MDL : 0, + &prelocking_strategy)) + DBUG_RETURN(TRUE); + } + for (tl= table_list; tl; tl= tl->next_local) { bool not_used= false; @@ -1694,7 +1718,7 @@ int mysql_multi_update_prepare(THD *thd) /* now lock and fill tables */ if (!thd->stmt_arena->is_stmt_prepare() && - lock_tables(thd, table_list, table_count, 0)) + lock_tables(thd, table_list, table_count + addon_table_count, 0)) { DBUG_RETURN(TRUE); } diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 50416940960..b85243dc134 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -442,7 +442,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views, */ if (lex->current_select->lock_type != TL_READ_DEFAULT) { - lex->current_select->set_lock_for_tables(TL_READ_DEFAULT); + lex->current_select->set_lock_for_tables(TL_READ_DEFAULT, false); view->mdl_request.set_type(MDL_EXCLUSIVE); } @@ -1554,6 +1554,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table, if (!tbl->sequence) tbl->lock_type= table->lock_type; tbl->mdl_request.set_type(table->mdl_request.type); + tbl->updating= table->updating; } /* If the view is mergeable, we might want to diff --git a/sql/sql_window.cc b/sql/sql_window.cc index 86c40b5f58f..487242933d4 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -2710,11 +2710,38 @@ bool save_window_function_values(List<Item_window_func>& window_functions, TABLE *tbl, uchar *rowid_buf) { List_iterator_fast<Item_window_func> iter(window_functions); + JOIN_TAB *join_tab= tbl->reginfo.join_tab; tbl->file->ha_rnd_pos(tbl->record[0], rowid_buf); store_record(tbl, record[1]); while (Item_window_func *item_win= iter++) item_win->save_in_field(item_win->result_field, true); + /* + In case we have window functions present, an extra step is required + to compute all the fields from the temporary table. + In case we have a compound expression such as: expr + expr, + where one of the terms has a window function inside it, only + after computing window function values we actually know the true + final result of the compounded expression. + + Go through all the func items and save their values once again in the + corresponding temp table fields. Do this for each row in the table. + + This needs to be done earlier because ORDER BY clause can also have + a window function, so we need to make sure all the fields of the temp.table + are updated before we do the filesort. So is best to update the other fields + that contain the window functions along with the computation of window + functions. + */ + + Item **func_ptr= join_tab->tmp_table_param->items_to_copy; + Item *func; + for (; (func = *func_ptr) ; func_ptr++) + { + if (func->with_window_func && func->type() != Item::WINDOW_FUNC_ITEM) + func->save_in_result_field(true); + } + int err= tbl->file->ha_update_row(tbl->record[1], tbl->record[0]); if (err && err != HA_ERR_RECORD_IS_THE_SAME) return true; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 8910d7418fd..6414609f643 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -9540,7 +9540,7 @@ opt_select_lock_type: { LEX *lex=Lex; lex->current_select->lock_type= TL_WRITE; - lex->current_select->set_lock_for_tables(TL_WRITE); + lex->current_select->set_lock_for_tables(TL_WRITE, false); lex->safe_to_cache_query=0; } | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM opt_lock_wait_timeout @@ -9548,7 +9548,7 @@ opt_select_lock_type: LEX *lex=Lex; lex->current_select->lock_type= TL_READ_WITH_SHARED_LOCKS; lex->current_select-> - set_lock_for_tables(TL_READ_WITH_SHARED_LOCKS); + set_lock_for_tables(TL_READ_WITH_SHARED_LOCKS, false); lex->safe_to_cache_query=0; } ; @@ -13416,7 +13416,7 @@ insert: insert_lock_option opt_ignore insert2 { - Select->set_lock_for_tables($3); + Select->set_lock_for_tables($3, true); Lex->current_select= &Lex->select_lex; } insert_field_spec opt_insert_update @@ -13433,7 +13433,7 @@ replace: } replace_lock_option insert2 { - Select->set_lock_for_tables($3); + Select->set_lock_for_tables($3, true); Lex->current_select= &Lex->select_lex; } insert_field_spec @@ -13666,14 +13666,14 @@ update: opt_low_priority opt_ignore join_table_list SET update_list { - LEX *lex= Lex; - if (lex->select_lex.table_list.elements > 1) - lex->sql_command= SQLCOM_UPDATE_MULTI; - else if (unlikely(lex->select_lex.get_table_list()->derived)) + SELECT_LEX *slex= &Lex->select_lex; + if (slex->table_list.elements > 1) + Lex->sql_command= SQLCOM_UPDATE_MULTI; + else if (unlikely(slex->get_table_list()->derived)) { /* it is single table update and it is update of derived table */ my_error(ER_NON_UPDATABLE_TABLE, MYF(0), - lex->select_lex.get_table_list()->alias.str, "UPDATE"); + slex->get_table_list()->alias.str, "UPDATE"); MYSQL_YYABORT; } /* @@ -13681,7 +13681,7 @@ update: be too pessimistic. We will decrease lock level if possible in mysql_multi_update(). */ - Select->set_lock_for_tables($3); + slex->set_lock_for_tables($3, slex->table_list.elements == 1); } opt_where_clause opt_order_clause delete_limit_clause {} ; @@ -16692,13 +16692,16 @@ table_lock: { thr_lock_type lock_type= (thr_lock_type) $3; bool lock_for_write= (lock_type >= TL_WRITE_ALLOW_WRITE); + ulong table_options= lock_for_write ? TL_OPTION_UPDATING : 0; + enum_mdl_type mdl_type= !lock_for_write + ? MDL_SHARED_READ + : lock_type == TL_WRITE_CONCURRENT_INSERT + ? MDL_SHARED_WRITE + : MDL_SHARED_NO_READ_WRITE; + if (unlikely(!Select-> - add_table_to_list(thd, $1, $2, 0, lock_type, - (lock_for_write ? - lock_type == TL_WRITE_CONCURRENT_INSERT ? - MDL_SHARED_WRITE : - MDL_SHARED_NO_READ_WRITE : - MDL_SHARED_READ)))) + add_table_to_list(thd, $1, $2, table_options, + lock_type, mdl_type))) MYSQL_YYABORT; } ; diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy index 1c83462e6ac..40315c05056 100644 --- a/sql/sql_yacc_ora.yy +++ b/sql/sql_yacc_ora.yy @@ -9477,7 +9477,7 @@ opt_select_lock_type: { LEX *lex=Lex; lex->current_select->lock_type= TL_WRITE; - lex->current_select->set_lock_for_tables(TL_WRITE); + lex->current_select->set_lock_for_tables(TL_WRITE, false); lex->safe_to_cache_query=0; } | LOCK_SYM IN_SYM SHARE_SYM MODE_SYM opt_lock_wait_timeout @@ -9485,7 +9485,7 @@ opt_select_lock_type: LEX *lex=Lex; lex->current_select->lock_type= TL_READ_WITH_SHARED_LOCKS; lex->current_select-> - set_lock_for_tables(TL_READ_WITH_SHARED_LOCKS); + set_lock_for_tables(TL_READ_WITH_SHARED_LOCKS, false); lex->safe_to_cache_query=0; } ; @@ -13377,7 +13377,7 @@ insert: insert_lock_option opt_ignore insert2 { - Select->set_lock_for_tables($3); + Select->set_lock_for_tables($3, true); Lex->current_select= &Lex->select_lex; } insert_field_spec opt_insert_update @@ -13394,7 +13394,7 @@ replace: } replace_lock_option insert2 { - Select->set_lock_for_tables($3); + Select->set_lock_for_tables($3, true); Lex->current_select= &Lex->select_lex; } insert_field_spec @@ -13627,14 +13627,14 @@ update: opt_low_priority opt_ignore join_table_list SET update_list { - LEX *lex= Lex; - if (lex->select_lex.table_list.elements > 1) - lex->sql_command= SQLCOM_UPDATE_MULTI; - else if (unlikely(lex->select_lex.get_table_list()->derived)) + SELECT_LEX *slex= &Lex->select_lex; + if (slex->table_list.elements > 1) + Lex->sql_command= SQLCOM_UPDATE_MULTI; + else if (unlikely(slex->get_table_list()->derived)) { /* it is single table update and it is update of derived table */ my_error(ER_NON_UPDATABLE_TABLE, MYF(0), - lex->select_lex.get_table_list()->alias.str, "UPDATE"); + slex->get_table_list()->alias.str, "UPDATE"); MYSQL_YYABORT; } /* @@ -13642,7 +13642,7 @@ update: be too pessimistic. We will decrease lock level if possible in mysql_multi_update(). */ - Select->set_lock_for_tables($3); + slex->set_lock_for_tables($3, slex->table_list.elements == 1); } opt_where_clause opt_order_clause delete_limit_clause {} ; @@ -16745,13 +16745,16 @@ table_lock: { thr_lock_type lock_type= (thr_lock_type) $3; bool lock_for_write= (lock_type >= TL_WRITE_ALLOW_WRITE); + ulong table_options= lock_for_write ? TL_OPTION_UPDATING : 0; + enum_mdl_type mdl_type= !lock_for_write + ? MDL_SHARED_READ + : lock_type == TL_WRITE_CONCURRENT_INSERT + ? MDL_SHARED_WRITE + : MDL_SHARED_NO_READ_WRITE; + if (unlikely(!Select-> - add_table_to_list(thd, $1, $2, 0, lock_type, - (lock_for_write ? - lock_type == TL_WRITE_CONCURRENT_INSERT ? - MDL_SHARED_WRITE : - MDL_SHARED_NO_READ_WRITE : - MDL_SHARED_READ)))) + add_table_to_list(thd, $1, $2, table_options, + lock_type, mdl_type))) MYSQL_YYABORT; } ; diff --git a/sql/table.cc b/sql/table.cc index 7042959215d..e46af771507 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -6099,7 +6099,8 @@ const char *Field_iterator_table_ref::get_table_name() return natural_join_it.column_ref()->safe_table_name(); DBUG_ASSERT(!strcmp(table_ref->table_name.str, - table_ref->table->s->table_name.str)); + table_ref->table->s->table_name.str) || + table_ref->schema_table); return table_ref->table_name.str; } diff --git a/sql/table.h b/sql/table.h index b7c14e0a606..abef6e44806 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1949,6 +1949,7 @@ struct TABLE_LIST table_name= *table_name_arg; alias= (alias_arg ? *alias_arg : *table_name_arg); lock_type= lock_type_arg; + updating= lock_type >= TL_WRITE_ALLOW_WRITE; mdl_request.init(MDL_key::TABLE, db.str, table_name.str, mdl_type, MDL_TRANSACTION); } diff --git a/sql/win_tzname_data.h b/sql/win_tzname_data.h new file mode 100644 index 00000000000..28a14ab7c11 --- /dev/null +++ b/sql/win_tzname_data.h @@ -0,0 +1,136 @@ +/* This file was generated using gen_win_tzname_data.ps1 */ +{L"Dateline Standard Time","Etc/GMT+12"}, +{L"UTC-11","Etc/GMT+11"}, +{L"Aleutian Standard Time","America/Adak"}, +{L"Hawaiian Standard Time","Pacific/Honolulu"}, +{L"Marquesas Standard Time","Pacific/Marquesas"}, +{L"Alaskan Standard Time","America/Anchorage"}, +{L"UTC-09","Etc/GMT+9"}, +{L"Pacific Standard Time (Mexico)","America/Tijuana"}, +{L"UTC-08","Etc/GMT+8"}, +{L"Pacific Standard Time","America/Los_Angeles"}, +{L"US Mountain Standard Time","America/Phoenix"}, +{L"Mountain Standard Time (Mexico)","America/Chihuahua"}, +{L"Mountain Standard Time","America/Denver"}, +{L"Central America Standard Time","America/Guatemala"}, +{L"Central Standard Time","America/Chicago"}, +{L"Easter Island Standard Time","Pacific/Easter"}, +{L"Central Standard Time (Mexico)","America/Mexico_City"}, +{L"Canada Central Standard Time","America/Regina"}, +{L"SA Pacific Standard Time","America/Bogota"}, +{L"Eastern Standard Time (Mexico)","America/Cancun"}, +{L"Eastern Standard Time","America/New_York"}, +{L"Haiti Standard Time","America/Port-au-Prince"}, +{L"Cuba Standard Time","America/Havana"}, +{L"US Eastern Standard Time","America/Indianapolis"}, +{L"Paraguay Standard Time","America/Asuncion"}, +{L"Atlantic Standard Time","America/Halifax"}, +{L"Venezuela Standard Time","America/Caracas"}, +{L"Central Brazilian Standard Time","America/Cuiaba"}, +{L"SA Western Standard Time","America/La_Paz"}, +{L"Pacific SA Standard Time","America/Santiago"}, +{L"Turks And Caicos Standard Time","America/Grand_Turk"}, +{L"Newfoundland Standard Time","America/St_Johns"}, +{L"Tocantins Standard Time","America/Araguaina"}, +{L"E. South America Standard Time","America/Sao_Paulo"}, +{L"SA Eastern Standard Time","America/Cayenne"}, +{L"Argentina Standard Time","America/Buenos_Aires"}, +{L"Greenland Standard Time","America/Godthab"}, +{L"Montevideo Standard Time","America/Montevideo"}, +{L"Magallanes Standard Time","America/Punta_Arenas"}, +{L"Saint Pierre Standard Time","America/Miquelon"}, +{L"Bahia Standard Time","America/Bahia"}, +{L"UTC-02","Etc/GMT+2"}, +{L"Azores Standard Time","Atlantic/Azores"}, +{L"Cape Verde Standard Time","Atlantic/Cape_Verde"}, +{L"UTC","Etc/GMT"}, +{L"GMT Standard Time","Europe/London"}, +{L"Greenwich Standard Time","Atlantic/Reykjavik"}, +{L"W. Europe Standard Time","Europe/Berlin"}, +{L"Central Europe Standard Time","Europe/Budapest"}, +{L"Romance Standard Time","Europe/Paris"}, +{L"Morocco Standard Time","Africa/Casablanca"}, +{L"Sao Tome Standard Time","Africa/Sao_Tome"}, +{L"Central European Standard Time","Europe/Warsaw"}, +{L"W. Central Africa Standard Time","Africa/Lagos"}, +{L"Jordan Standard Time","Asia/Amman"}, +{L"GTB Standard Time","Europe/Bucharest"}, +{L"Middle East Standard Time","Asia/Beirut"}, +{L"Egypt Standard Time","Africa/Cairo"}, +{L"E. Europe Standard Time","Europe/Chisinau"}, +{L"Syria Standard Time","Asia/Damascus"}, +{L"West Bank Standard Time","Asia/Hebron"}, +{L"South Africa Standard Time","Africa/Johannesburg"}, +{L"FLE Standard Time","Europe/Kiev"}, +{L"Israel Standard Time","Asia/Jerusalem"}, +{L"Kaliningrad Standard Time","Europe/Kaliningrad"}, +{L"Sudan Standard Time","Africa/Khartoum"}, +{L"Libya Standard Time","Africa/Tripoli"}, +{L"Namibia Standard Time","Africa/Windhoek"}, +{L"Arabic Standard Time","Asia/Baghdad"}, +{L"Turkey Standard Time","Europe/Istanbul"}, +{L"Arab Standard Time","Asia/Riyadh"}, +{L"Belarus Standard Time","Europe/Minsk"}, +{L"Russian Standard Time","Europe/Moscow"}, +{L"E. Africa Standard Time","Africa/Nairobi"}, +{L"Iran Standard Time","Asia/Tehran"}, +{L"Arabian Standard Time","Asia/Dubai"}, +{L"Astrakhan Standard Time","Europe/Astrakhan"}, +{L"Azerbaijan Standard Time","Asia/Baku"}, +{L"Russia Time Zone 3","Europe/Samara"}, +{L"Mauritius Standard Time","Indian/Mauritius"}, +{L"Saratov Standard Time","Europe/Saratov"}, +{L"Georgian Standard Time","Asia/Tbilisi"}, +{L"Caucasus Standard Time","Asia/Yerevan"}, +{L"Afghanistan Standard Time","Asia/Kabul"}, +{L"West Asia Standard Time","Asia/Tashkent"}, +{L"Ekaterinburg Standard Time","Asia/Yekaterinburg"}, +{L"Pakistan Standard Time","Asia/Karachi"}, +{L"India Standard Time","Asia/Calcutta"}, +{L"Sri Lanka Standard Time","Asia/Colombo"}, +{L"Nepal Standard Time","Asia/Katmandu"}, +{L"Central Asia Standard Time","Asia/Almaty"}, +{L"Bangladesh Standard Time","Asia/Dhaka"}, +{L"Omsk Standard Time","Asia/Omsk"}, +{L"Myanmar Standard Time","Asia/Rangoon"}, +{L"SE Asia Standard Time","Asia/Bangkok"}, +{L"Altai Standard Time","Asia/Barnaul"}, +{L"W. Mongolia Standard Time","Asia/Hovd"}, +{L"North Asia Standard Time","Asia/Krasnoyarsk"}, +{L"N. Central Asia Standard Time","Asia/Novosibirsk"}, +{L"Tomsk Standard Time","Asia/Tomsk"}, +{L"China Standard Time","Asia/Shanghai"}, +{L"North Asia East Standard Time","Asia/Irkutsk"}, +{L"Singapore Standard Time","Asia/Singapore"}, +{L"W. Australia Standard Time","Australia/Perth"}, +{L"Taipei Standard Time","Asia/Taipei"}, +{L"Ulaanbaatar Standard Time","Asia/Ulaanbaatar"}, +{L"Aus Central W. Standard Time","Australia/Eucla"}, +{L"Transbaikal Standard Time","Asia/Chita"}, +{L"Tokyo Standard Time","Asia/Tokyo"}, +{L"North Korea Standard Time","Asia/Pyongyang"}, +{L"Korea Standard Time","Asia/Seoul"}, +{L"Yakutsk Standard Time","Asia/Yakutsk"}, +{L"Cen. Australia Standard Time","Australia/Adelaide"}, +{L"AUS Central Standard Time","Australia/Darwin"}, +{L"E. Australia Standard Time","Australia/Brisbane"}, +{L"AUS Eastern Standard Time","Australia/Sydney"}, +{L"West Pacific Standard Time","Pacific/Port_Moresby"}, +{L"Tasmania Standard Time","Australia/Hobart"}, +{L"Vladivostok Standard Time","Asia/Vladivostok"}, +{L"Lord Howe Standard Time","Australia/Lord_Howe"}, +{L"Bougainville Standard Time","Pacific/Bougainville"}, +{L"Russia Time Zone 10","Asia/Srednekolymsk"}, +{L"Magadan Standard Time","Asia/Magadan"}, +{L"Norfolk Standard Time","Pacific/Norfolk"}, +{L"Sakhalin Standard Time","Asia/Sakhalin"}, +{L"Central Pacific Standard Time","Pacific/Guadalcanal"}, +{L"Russia Time Zone 11","Asia/Kamchatka"}, +{L"New Zealand Standard Time","Pacific/Auckland"}, +{L"UTC+12","Etc/GMT-12"}, +{L"Fiji Standard Time","Pacific/Fiji"}, +{L"Chatham Islands Standard Time","Pacific/Chatham"}, +{L"UTC+13","Etc/GMT-13"}, +{L"Tonga Standard Time","Pacific/Tongatapu"}, +{L"Samoa Standard Time","Pacific/Apia"}, +{L"Line Islands Standard Time","Pacific/Kiritimati"}, diff --git a/storage/connect/filter.h b/storage/connect/filter.h index c6ab8fddd35..b0fea3d69e0 100644 --- a/storage/connect/filter.h +++ b/storage/connect/filter.h @@ -48,6 +48,7 @@ class DllExport FILTER : public XOBJECT { /* Filter description block */ PVAL &Val(int i) {return Test[i].Value;} bool &Conv(int i) {return Test[i].Conv;} void SetNext(PFIL filp) {Next = filp;} + bool MakeSelector(PGLOBAL g, PSTRG s); // Methods virtual void Reset(void); diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 08c99dfdebd..d173b82dd52 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -4698,9 +4698,6 @@ int ha_connect::start_stmt(THD *thd, thr_lock_type lock_type) PGLOBAL g= GetPlug(thd, xp); DBUG_ENTER("ha_connect::start_stmt"); - if (table->triggers) - g->More= 1; // We don't know which columns are used by the trigger - if (check_privileges(thd, GetTableOptionStruct(), table->s->db.str, true)) DBUG_RETURN(HA_ERR_INTERNAL_ERROR); @@ -4728,8 +4725,24 @@ int ha_connect::start_stmt(THD *thd, thr_lock_type lock_type) break; } // endswitch mode - xmod= CheckMode(g, thd, newmode, &chk, &cras); - DBUG_RETURN((xmod == MODE_ERROR) ? HA_ERR_INTERNAL_ERROR : 0); + if (newmode == MODE_ANY) { + if (CloseTable(g)) { + // Make error a warning to avoid crash + push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message); + rc = 0; + } // endif Close + + locked = 0; + xmod = MODE_ANY; // For info commands + DBUG_RETURN(rc); + } // endif MODE_ANY + + newmode = CheckMode(g, thd, newmode, &chk, &cras); + + if (newmode == MODE_ERROR) + DBUG_RETURN(HA_ERR_INTERNAL_ERROR); + + DBUG_RETURN(check_stmt(g, newmode, cras)); } // end of start_stmt /** @@ -4911,21 +4924,16 @@ int ha_connect::external_lock(THD *thd, int lock_type) // Make it a warning to avoid crash push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message); rc= 0; - //my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); - //rc = HA_ERR_INTERNAL_ERROR; } // endif Close locked= 0; -// m_lock_type= lock_type; xmod= MODE_ANY; // For info commands DBUG_RETURN(rc); - } // endif MODE_ANY - else - if (check_privileges(thd, options, table->s->db.str)) { - strcpy(g->Message, "This operation requires the FILE privilege"); - htrc("%s\n", g->Message); - DBUG_RETURN(HA_ERR_INTERNAL_ERROR); - } // endif check_privileges + } else if (check_privileges(thd, options, table->s->db.str)) { + strcpy(g->Message, "This operation requires the FILE privilege"); + htrc("%s\n", g->Message); + DBUG_RETURN(HA_ERR_INTERNAL_ERROR); + } // endif check_privileges DBUG_ASSERT(table && table->s); @@ -4936,43 +4944,31 @@ int ha_connect::external_lock(THD *thd, int lock_type) if (newmode == MODE_ERROR) DBUG_RETURN(HA_ERR_INTERNAL_ERROR); - // If this is the start of a new query, cleanup the previous one + DBUG_RETURN(check_stmt(g, newmode, cras)); +} // end of external_lock + + +int ha_connect::check_stmt(PGLOBAL g, MODE newmode, bool cras) +{ + int rc = 0; + DBUG_ENTER("ha_connect::check_stmt"); + + // If this is the start of a new query, cleanup the previous one if (xp->CheckCleanup()) { tdbp= NULL; valid_info= false; - } // endif CheckCleanup - -#if 0 - if (xcheck) { - // This must occur after CheckCleanup - if (!g->Xchk) { - g->Xchk= new(g) XCHK; - ((PCHK)g->Xchk)->oldsep= GetBooleanOption("Sepindex", false); - ((PCHK)g->Xchk)->oldpix= GetIndexInfo(); - } // endif Xchk - - } else - g->Xchk= NULL; -#endif // 0 + } // endif CheckCleanup if (cras) g->Createas= 1; // To tell external tables of a multi-table command - if (trace(1)) { -#if 0 - htrc("xcheck=%d cras=%d\n", xcheck, cras); - - if (xcheck) - htrc("oldsep=%d oldpix=%p\n", - ((PCHK)g->Xchk)->oldsep, ((PCHK)g->Xchk)->oldpix); -#endif // 0 - htrc("Calling CntCheckDB db=%s cras=%d\n", GetDBName(NULL), cras); - } // endif trace + if (trace(1)) + htrc("Calling CntCheckDB db=%s cras=%d\n", GetDBName(NULL), cras); // Set or reset the good database environment if (CntCheckDB(g, this, GetDBName(NULL))) { - htrc("%p external_lock: %s\n", this, g->Message); - rc= HA_ERR_INTERNAL_ERROR; + htrc("%p check_stmt: %s\n", this, g->Message); + rc= HA_ERR_INTERNAL_ERROR; // This can NOT be called without open called first, but // the table can have been closed since then } else if (!tdbp || xp->CheckQuery(valid_query_id) || xmod != newmode) { @@ -4992,10 +4988,10 @@ int ha_connect::external_lock(THD *thd, int lock_type) } // endif tdbp if (trace(1)) - htrc("external_lock: rc=%d\n", rc); + htrc("check_stmt: rc=%d\n", rc); DBUG_RETURN(rc); -} // end of external_lock +} // end of check_stmt /** diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h index 789b4ba3ce6..c60b1017549 100644 --- a/storage/connect/ha_connect.h +++ b/storage/connect/ha_connect.h @@ -511,7 +511,8 @@ private: protected: bool check_privileges(THD *thd, PTOS options, const char *dbn, bool quick=false); MODE CheckMode(PGLOBAL g, THD *thd, MODE newmode, bool *chk, bool *cras); - char *GetDBfromName(const char *name); + int check_stmt(PGLOBAL g, MODE newmode, bool cras); + char *GetDBfromName(const char *name); // Members static ulong num; // Tracable handler number diff --git a/storage/connect/jmgoconn.cpp b/storage/connect/jmgoconn.cpp index 84473534747..c80800bd897 100644 --- a/storage/connect/jmgoconn.cpp +++ b/storage/connect/jmgoconn.cpp @@ -272,7 +272,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options, if (MakeSelector(g, filp, s)) { strcpy(g->Message, "Failed making selector"); - return NULL; + return true; } else s->Append('}'); @@ -340,7 +340,7 @@ bool JMgoConn::MakeCursor(PGLOBAL g, PTDB tdbp, PCSZ options, if (MakeSelector(g, filp, s)) { strcpy(g->Message, "Failed making selector"); - return NULL; + return true; } // endif Selector tdbp->SetFilter(NULL); // Not needed anymore diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp index 29cbbb35765..4f6e2c81744 100644 --- a/storage/connect/tabdos.cpp +++ b/storage/connect/tabdos.cpp @@ -1,11 +1,11 @@ /************* TabDos C++ Program Source Code File (.CPP) **************/ /* PROGRAM NAME: TABDOS */ /* ------------- */ -/* Version 4.9.3 */ +/* Version 4.9.4 */ /* */ /* COPYRIGHT: */ /* ---------- */ -/* (C) Copyright to the author Olivier BERTRAND 1998-2017 */ +/* (C) Copyright to the author Olivier BERTRAND 1998-2019 */ /* */ /* WHAT THIS PROGRAM DOES: */ /* ----------------------- */ @@ -2492,8 +2492,10 @@ bool DOSCOL::SetBuffer(PGLOBAL g, PVAL value, bool ok, bool check) } // endif's Value, Buf_Type // Allocate the buffer used in WriteColumn for numeric columns - if (!Buf && IsTypeNum(Buf_Type)) - Buf = (char*)PlugSubAlloc(g, NULL, MY_MAX(32, Long + Dcm + 1)); + if (!Buf && IsTypeNum(Buf_Type)) + Buf = (char*)PlugSubAlloc(g, NULL, MY_MAX(64, Long + 1)); + else // Text columns do not need additional buffer + Buf = (char*)Value->GetTo_Val(); // Because Colblk's have been made from a copy of the original TDB in // case of Update, we must reset them to point to the original one. @@ -2603,8 +2605,8 @@ void DOSCOL::ReadColumn(PGLOBAL g) /***********************************************************************/ void DOSCOL::WriteColumn(PGLOBAL g) { - char *p, *p2, fmt[32]; - int i, k, len, field; + char *p, fmt[32]; + int i, k, n, len, field; PTDBDOS tdbp = (PTDBDOS)To_Tdb; if (trace(2)) @@ -2679,8 +2681,8 @@ void DOSCOL::WriteColumn(PGLOBAL g) case TYPE_DOUBLE: case TYPE_DECIM: strcpy(fmt, (Ldz) ? "%0*.*lf" : "%*.*lf"); - sprintf(Buf, fmt, field + ((Nod && Dcm) ? 1 : 0), - Dcm, Value->GetFloatValue()); + len = field + ((Nod && Dcm) ? 1 : 0); + snprintf(Buf, len, fmt, len, Dcm, Value->GetFloatValue()); len = strlen(Buf); if (Nod && Dcm) @@ -2699,35 +2701,37 @@ void DOSCOL::WriteColumn(PGLOBAL g) throw 31; } // endswitch BufType - p2 = Buf; + n = strlen(Buf); } else // Standard CONNECT format - p2 = Value->ShowValue(Buf, field); + n = Value->ShowValue(Buf, field); if (trace(1)) - htrc("new length(%p)=%d\n", p2, strlen(p2)); + htrc("new length(%p)=%d\n", Buf, n); - if ((len = strlen(p2)) > field) { - sprintf(g->Message, MSG(VALUE_TOO_LONG), p2, Name, field); + if ((len = n) > field) { + char *p = Value->GetCharString(Buf); + + sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, field); throw 31; } else if (Dsp) for (i = 0; i < len; i++) - if (p2[i] == '.') - p2[i] = Dsp; + if (Buf[i] == '.') + Buf[i] = Dsp; if (trace(2)) - htrc("buffer=%s\n", p2); + htrc("buffer=%s\n", Buf); /*******************************************************************/ /* Updating must be done only when not in checking pass. */ /*******************************************************************/ if (Status) { memset(p, ' ', field); - memcpy(p, p2, len); + memcpy(p, Buf, len); if (trace(2)) htrc(" col write: '%.*s'\n", len, p); - } // endif Use + } // endif Status } else // BIN compressed table /*******************************************************************/ @@ -2738,7 +2742,7 @@ void DOSCOL::WriteColumn(PGLOBAL g) sprintf(g->Message, MSG(BIN_F_TOO_LONG), Name, Value->GetSize(), Long); throw 31; - } // endif + } // endif } // end of WriteColumn diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp index 63fa2a63668..02720a3089a 100644 --- a/storage/connect/tabfmt.cpp +++ b/storage/connect/tabfmt.cpp @@ -1485,8 +1485,8 @@ void CSVCOL::ReadColumn(PGLOBAL g) /***********************************************************************/ void CSVCOL::WriteColumn(PGLOBAL g) { - char *p, buf[64]; - int flen; + char *p; + int n, flen; PTDBCSV tdbp = (PTDBCSV)To_Tdb; if (trace(2)) @@ -1508,13 +1508,14 @@ void CSVCOL::WriteColumn(PGLOBAL g) /*********************************************************************/ /* Get the string representation of the column value. */ /*********************************************************************/ - p = Value->ShowValue(buf); + p = Value->GetCharString(Buf); + n = strlen(p); if (trace(2)) - htrc("new length(%p)=%d\n", p, strlen(p)); + htrc("new length(%p)=%d\n", p, n); - if ((signed)strlen(p) > flen) { - sprintf(g->Message, MSG(BAD_FLD_LENGTH), Name, p, flen, + if (n > flen) { + sprintf(g->Message, MSG(BAD_FLD_LENGTH), Name, p, n, tdbp->RowNumber(g), tdbp->GetFile(g)); throw 34; } else if (Dsp) diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc index a2a8faf9b38..d366e0222df 100644 --- a/storage/connect/user_connect.cc +++ b/storage/connect/user_connect.cc @@ -177,7 +177,8 @@ bool user_connect::CheckCleanup(bool force) g->Createas = 0; g->Alchecked = 0; g->Mrr = 0; - last_query_id= thdp->query_id; + g->More = 0; + last_query_id= thdp->query_id; if (trace(65) && !force) printf("=====> Begin new query %llu\n", last_query_id); diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp index e159efaa989..d9330a68a15 100644 --- a/storage/connect/value.cpp +++ b/storage/connect/value.cpp @@ -1,7 +1,7 @@ /************* Value C++ Functions Source Code File (.CPP) *************/ -/* Name: VALUE.CPP Version 2.8 */ +/* Name: VALUE.CPP Version 2.9 */ /* */ -/* (C) Copyright to the author Olivier BERTRAND 2001-2017 */ +/* (C) Copyright to the author Olivier BERTRAND 2001-2019 */ /* */ /* This file contains the VALUE and derived classes family functions. */ /* These classes contain values of different types. They are used so */ @@ -882,18 +882,16 @@ bool TYPVAL<TYPE>::GetBinValue(void *buf, int buflen, bool go) /* TYPVAL ShowValue: get string representation of a typed value. */ /***********************************************************************/ template <class TYPE> -char *TYPVAL<TYPE>::ShowValue(char *buf, int len) +int TYPVAL<TYPE>::ShowValue(char *buf, int len) { - sprintf(buf, Xfmt, len, Tval); - return buf; + return snprintf(buf, len + 1, Xfmt, len, Tval); } // end of ShowValue template <> -char *TYPVAL<double>::ShowValue(char *buf, int len) +int TYPVAL<double>::ShowValue(char *buf, int len) { - // TODO: use snprintf to avoid possible overflow - sprintf(buf, Xfmt, len, Prec, Tval); - return buf; + // TODO: use a more appropriate format to avoid possible truncation + return snprintf(buf, len + 1, Xfmt, len, Prec, Tval); } // end of ShowValue /***********************************************************************/ @@ -1588,10 +1586,17 @@ bool TYPVAL<PSZ>::GetBinValue(void *buf, int buflen, bool go) /***********************************************************************/ /* STRING ShowValue: get string representation of a char value. */ /***********************************************************************/ -char *TYPVAL<PSZ>::ShowValue(char *, int) - { - return Strp; - } // end of ShowValue +int TYPVAL<PSZ>::ShowValue(char *buf, int buflen) +{ + int len = (Null) ? 0 : strlen(Strp); + + if (buf && buf != Strp) { + memset(buf, ' ', buflen + 1); + memcpy(buf, Strp, MY_MIN(len, buflen)); + } // endif buf + + return len; +} // end of ShowValue /***********************************************************************/ /* STRING GetCharString: get string representation of a char value. */ @@ -1800,10 +1805,9 @@ void DECVAL::Reset(void) /***********************************************************************/ /* DECIMAL ShowValue: get string representation right justified. */ /***********************************************************************/ -char *DECVAL::ShowValue(char *buf, int len) +int DECVAL::ShowValue(char *buf, int len) { - sprintf(buf, Xfmt, len, Strp); - return buf; + return snprintf(buf, len + 1, Xfmt, len, Strp); } // end of ShowValue /***********************************************************************/ @@ -1868,14 +1872,13 @@ int DECVAL::CompareValue(PVAL vp) BINVAL::BINVAL(PGLOBAL g, void *p, int cl, int n) : VALUE(TYPE_BIN) { assert(g); -//Len = n; - Len = (g) ? n : (p) ? strlen((char*)p) : 0; + Len = n; Clen = cl; Binp = PlugSubAlloc(g, NULL, Clen + 1); memset(Binp, 0, Clen + 1); if (p) - memcpy(Binp, p, Len); + memcpy(Binp, p, MY_MIN(Len,Clen)); Chrp = NULL; } // end of BINVAL constructor @@ -2264,14 +2267,12 @@ bool BINVAL::GetBinValue(void *buf, int buflen, bool go) /***********************************************************************/ /* BINVAL ShowValue: get string representation of a binary value. */ /***********************************************************************/ -char *BINVAL::ShowValue(char *buf, int len) - { - //int n = MY_MIN(Len, len / 2); - - //sprintf(buf, GetXfmt(), n, Binp); - //return buf; - return (char*)Binp; - } // end of ShowValue +int BINVAL::ShowValue(char *buf, int len) +{ + memset(buf, 0, len + 1); + memcpy(buf, Binp, MY_MIN(len, Len)); + return Len; +} // end of ShowValue /***********************************************************************/ /* BINVAL GetCharString: get string representation of a binary value. */ @@ -2749,43 +2750,33 @@ char *DTVAL::GetCharString(char *p) /***********************************************************************/ /* DTVAL ShowValue: get string representation of a date value. */ /***********************************************************************/ -char *DTVAL::ShowValue(char *buf, int len) - { - if (Pdtp) { - char *p; +int DTVAL::ShowValue(char *buf, int len) +{ + int rv = 0; + if (Pdtp) { if (!Null) { - size_t m, n = 0; + size_t n = 0, m = len + 1; struct tm tm, *ptm = GetGmTime(&tm); - - - - if (Len < len) { - p = buf; - m = len; - } else { - p = Sdate; - m = Len + 1; - } // endif Len if (ptm) - n = strftime(p, m, Pdtp->OutFmt, ptm); + n = strftime(buf, m, Pdtp->OutFmt, ptm); if (!n) { - *p = '\0'; - strncat(p, "Error", m); - } // endif n + *buf = '\0'; + strncat(buf, "Error", m); + rv = 5; + } else + rv = (int)n; - } else { - p = buf; - *p = '\0'; // DEFAULT VALUE ??? - } // endif Null + } else + *buf = '\0'; // DEFAULT VALUE ??? - return p; } else - return TYPVAL<int>::ShowValue(buf, len); + rv = TYPVAL<int>::ShowValue(buf, len); - } // end of ShowValue + return rv; +} // end of ShowValue #if 0 // Not used by CONNECT /***********************************************************************/ diff --git a/storage/connect/value.h b/storage/connect/value.h index 6613e25100a..4f7d9a440fa 100644 --- a/storage/connect/value.h +++ b/storage/connect/value.h @@ -1,7 +1,7 @@ /**************** Value H Declares Source Code File (.H) ***************/ -/* Name: VALUE.H Version 2.3 */ +/* Name: VALUE.H Version 2.4 */ /* */ -/* (C) Copyright to the author Olivier BERTRAND 2001-2017 */ +/* (C) Copyright to the author Olivier BERTRAND 2001-2019 */ /* */ /* This file contains the VALUE and derived classes declares. */ /***********************************************************************/ @@ -117,7 +117,7 @@ class DllExport VALUE : public BLOCK { virtual void SetValue_pvblk(PVBLK blk, int n) = 0; virtual void SetBinValue(void *p) = 0; virtual bool GetBinValue(void *buf, int buflen, bool go) = 0; - virtual char *ShowValue(char *buf, int len = 0) = 0; + virtual int ShowValue(char *buf, int len) = 0; virtual char *GetCharString(char *p) = 0; virtual bool IsEqual(PVAL vp, bool chktype) = 0; virtual bool Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op); @@ -229,7 +229,7 @@ class DllExport TYPVAL : public VALUE { virtual void SetValue_pvblk(PVBLK blk, int n); virtual void SetBinValue(void *p); virtual bool GetBinValue(void *buf, int buflen, bool go); - virtual char *ShowValue(char *buf, int); + virtual int ShowValue(char *buf, int len); virtual char *GetCharString(char *p); virtual bool IsEqual(PVAL vp, bool chktype); virtual bool Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op); @@ -302,7 +302,7 @@ class DllExport TYPVAL<PSZ>: public VALUE { virtual void SetBinValue(void *p); virtual int CompareValue(PVAL vp); virtual bool GetBinValue(void *buf, int buflen, bool go); - virtual char *ShowValue(char *buf, int); + virtual int ShowValue(char *buf, int len); virtual char *GetCharString(char *p); virtual bool IsEqual(PVAL vp, bool chktype); virtual bool Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op); @@ -334,7 +334,7 @@ class DllExport DECVAL: public TYPVAL<PSZ> { // Methods virtual bool GetBinValue(void *buf, int buflen, bool go); - virtual char *ShowValue(char *buf, int); + virtual int ShowValue(char *buf, int len); virtual bool IsEqual(PVAL vp, bool chktype); virtual int CompareValue(PVAL vp); @@ -387,7 +387,7 @@ class DllExport BINVAL: public VALUE { virtual void SetBinValue(void *p); virtual bool GetBinValue(void *buf, int buflen, bool go); virtual int CompareValue(PVAL) {assert(false); return 0;} - virtual char *ShowValue(char *buf, int); + virtual int ShowValue(char *buf, int len); virtual char *GetCharString(char *p); virtual bool IsEqual(PVAL vp, bool chktype); virtual bool FormatValue(PVAL vp, PCSZ fmt); @@ -415,7 +415,7 @@ class DllExport DTVAL : public TYPVAL<int> { virtual void SetValue_psz(PCSZ s); virtual void SetValue_pvblk(PVBLK blk, int n); virtual char *GetCharString(char *p); - virtual char *ShowValue(char *buf, int); + virtual int ShowValue(char *buf, int len); virtual bool FormatValue(PVAL vp, PCSZ fmt); bool SetFormat(PGLOBAL g, PCSZ fmt, int len, int year = 0); bool SetFormat(PGLOBAL g, PVAL valp); diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 74d7c6ab475..cd9e280e215 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -649,18 +649,13 @@ bad: ulint decomp = fil_page_decompress(buf, page); if (!decomp || (decomp != srv_page_size && page_size.is_compressed())) { - goto bad_doublewrite; + continue; } if (expect_encrypted && mach_read_from_4( page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) ? !fil_space_verify_crypt_checksum(page, page_size) : buf_page_is_corrupted(true, page, page_size, space)) { - if (!is_all_zero) { -bad_doublewrite: - ib::warn() << "A doublewrite copy of page " - << page_id << " is corrupted."; - } /* Theoretically we could have another good copy for this page in the doublewrite buffer. If not, we will report a fatal error diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index b9185b99aa4..1c837c48269 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2009, 2018, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2009, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2015, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -3111,6 +3111,8 @@ dict_stats_update_for_index( if (dict_stats_persistent_storage_check(false)) { dict_table_stats_lock(index->table, RW_X_LATCH); dict_stats_analyze_index(index); + index->table->stat_sum_of_other_index_sizes + += index->stat_index_size; dict_table_stats_unlock(index->table, RW_X_LATCH); dict_stats_save(index->table, &index->id); DBUG_VOID_RETURN; diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 30ff70b78e3..f933c5fa283 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -2497,8 +2497,7 @@ but only by InnoDB table locks, which may be broken by lock_remove_all_on_table().) @param[in] table persistent table checked @return whether the table is accessible */ -bool -fil_table_accessible(const dict_table_t* table) +bool fil_table_accessible(const dict_table_t* table) { if (UNIV_UNLIKELY(!table->is_readable() || table->corrupted)) { return(false); diff --git a/storage/innobase/fts/fts0config.cc b/storage/innobase/fts/fts0config.cc index 6b6042dee66..ef996cbbbb6 100644 --- a/storage/innobase/fts/fts0config.cc +++ b/storage/innobase/fts/fts0config.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -215,8 +215,11 @@ fts_config_set_value( pars_info_bind_varchar_literal(info, "value", value->f_str, value->f_len); + const bool dict_locked = fts_table->table->fts->fts_status + & TABLE_DICT_LOCKED; + fts_table->suffix = "CONFIG"; - fts_get_table_name(fts_table, table_name); + fts_get_table_name(fts_table, table_name, dict_locked); pars_info_bind_id(info, true, "table_name", table_name); graph = fts_parse_sql( @@ -244,7 +247,7 @@ fts_config_set_value( pars_info_bind_varchar_literal( info, "value", value->f_str, value->f_len); - fts_get_table_name(fts_table, table_name); + fts_get_table_name(fts_table, table_name, dict_locked); pars_info_bind_id(info, true, "table_name", table_name); graph = fts_parse_sql( diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 59d60ec4a15..5e5077f3481 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -249,7 +249,6 @@ dberr_t fts_update_sync_doc_id( /*===================*/ const dict_table_t* table, /*!< in: table */ - const char* table_name, /*!< in: table name, or NULL */ doc_id_t doc_id, /*!< in: last document id */ trx_t* trx) /*!< in: update trx, or NULL */ MY_ATTRIBUTE((nonnull(1))); @@ -1531,14 +1530,13 @@ fts_rename_aux_tables( FTS_INIT_FTS_TABLE(&fts_table, NULL, FTS_COMMON_TABLE, table); + dberr_t err = DB_SUCCESS; + char old_table_name[MAX_FULL_NAME_LEN]; + /* Rename common auxiliary tables */ for (i = 0; fts_common_tables[i] != NULL; ++i) { - char old_table_name[MAX_FULL_NAME_LEN]; - dberr_t err = DB_SUCCESS; - fts_table.suffix = fts_common_tables[i]; - - fts_get_table_name(&fts_table, old_table_name); + fts_get_table_name(&fts_table, old_table_name, true); err = fts_rename_one_aux_table(new_name, old_table_name, trx); @@ -1560,12 +1558,8 @@ fts_rename_aux_tables( FTS_INIT_INDEX_TABLE(&fts_table, NULL, FTS_INDEX_TABLE, index); for (ulint j = 0; j < FTS_NUM_AUX_INDEX; ++j) { - dberr_t err; - char old_table_name[MAX_FULL_NAME_LEN]; - fts_table.suffix = fts_get_suffix(j); - - fts_get_table_name(&fts_table, old_table_name); + fts_get_table_name(&fts_table, old_table_name, true); err = fts_rename_one_aux_table( new_name, old_table_name, trx); @@ -1604,8 +1598,7 @@ fts_drop_common_tables( char table_name[MAX_FULL_NAME_LEN]; fts_table->suffix = fts_common_tables[i]; - - fts_get_table_name(fts_table, table_name); + fts_get_table_name(fts_table, table_name, true); err = fts_drop_table(trx, table_name); @@ -1641,8 +1634,7 @@ fts_drop_index_split_tables( char table_name[MAX_FULL_NAME_LEN]; fts_table.suffix = fts_get_suffix(i); - - fts_get_table_name(&fts_table, table_name); + fts_get_table_name(&fts_table, table_name, true); err = fts_drop_table(trx, table_name); @@ -1888,7 +1880,7 @@ fts_create_common_tables( for (ulint i = 0; fts_common_tables[i] != NULL; ++i) { fts_table.suffix = fts_common_tables[i]; - fts_get_table_name(&fts_table, full_name[i]); + fts_get_table_name(&fts_table, full_name[i], true); dict_table_t* common_table = fts_create_one_common_table( trx, table, full_name[i], fts_table.suffix, heap); @@ -1915,7 +1907,7 @@ fts_create_common_tables( info = pars_info_create(); fts_table.suffix = "CONFIG"; - fts_get_table_name(&fts_table, fts_name); + fts_get_table_name(&fts_table, fts_name, true); pars_info_bind_id(info, true, "config_table", fts_name); graph = fts_parse_sql_no_dict_lock( @@ -1978,7 +1970,7 @@ fts_create_one_index_table( ut_ad(index->type & DICT_FTS); - fts_get_table_name(fts_table, table_name); + fts_get_table_name(fts_table, table_name, true); new_table = fts_create_in_mem_aux_table( table_name, fts_table->table, @@ -2074,7 +2066,6 @@ fts_create_index_tables(trx_t* trx, const dict_index_t* index, table_id_t id) fts_table.type = FTS_INDEX_TABLE; fts_table.index_id = index->id; fts_table.table_id = id; - fts_table.parent = index->table->name.m_name; fts_table.table = index->table; /* aux_idx_tables vector is used for dropping FTS AUX INDEX @@ -2583,7 +2574,6 @@ fts_update_next_doc_id( /*===================*/ trx_t* trx, /*!< in/out: transaction */ const dict_table_t* table, /*!< in: table */ - const char* table_name, /*!< in: table name, or NULL */ doc_id_t doc_id) /*!< in: DOC ID to set */ { table->fts->cache->synced_doc_id = doc_id; @@ -2592,7 +2582,7 @@ fts_update_next_doc_id( table->fts->cache->first_doc_id = table->fts->cache->next_doc_id; fts_update_sync_doc_id( - table, table_name, table->fts->cache->synced_doc_id, trx); + table, table->fts->cache->synced_doc_id, trx); } @@ -2659,8 +2649,6 @@ retry: fts_table.type = FTS_COMMON_TABLE; fts_table.table = table; - fts_table.parent = table->name.m_name; - trx = trx_create(); if (srv_read_only_mode) { trx_start_internal_read_only(trx); @@ -2725,7 +2713,7 @@ retry: if (doc_id_cmp > *doc_id) { error = fts_update_sync_doc_id( - table, table->name.m_name, cache->synced_doc_id, trx); + table, cache->synced_doc_id, trx); } *doc_id = cache->next_doc_id; @@ -2761,7 +2749,6 @@ dberr_t fts_update_sync_doc_id( /*===================*/ const dict_table_t* table, /*!< in: table */ - const char* table_name, /*!< in: table name, or NULL */ doc_id_t doc_id, /*!< in: last document id */ trx_t* trx) /*!< in: update trx, or NULL */ { @@ -2783,11 +2770,6 @@ fts_update_sync_doc_id( fts_table.table_id = table->id; fts_table.type = FTS_COMMON_TABLE; fts_table.table = table; - if (table_name) { - fts_table.parent = table_name; - } else { - fts_table.parent = table->name.m_name; - } if (!trx) { trx = trx_create(); @@ -2804,7 +2786,8 @@ fts_update_sync_doc_id( pars_info_bind_varchar_literal(info, "doc_id", id, id_len); - fts_get_table_name(&fts_table, fts_name); + fts_get_table_name(&fts_table, fts_name, + table->fts->fts_status & TABLE_DICT_LOCKED); pars_info_bind_id(info, true, "table_name", fts_name); graph = fts_parse_sql( @@ -6220,7 +6203,6 @@ fts_rename_one_aux_table_to_hex_format( ut_a(fts_table.suffix != NULL); - fts_table.parent = parent_table->name.m_name; fts_table.table_id = aux_table->parent_id; fts_table.index_id = aux_table->index_id; fts_table.table = parent_table; diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index f91ebcbf2a6..42d3eb158ce 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -60,15 +60,6 @@ static const ulint FTS_WORD_NODES_INIT_SIZE = 64; /** Last time we did check whether system need a sync */ static ib_time_t last_check_sync_time; -/** State of a table within the optimization sub system. */ -enum fts_state_t { - FTS_STATE_LOADED, - FTS_STATE_RUNNING, - FTS_STATE_SUSPENDED, - FTS_STATE_DONE, - FTS_STATE_EMPTY -}; - /** FTS optimize thread message types. */ enum fts_msg_type_t { FTS_MSG_STOP, /*!< Stop optimizing and exit thread */ @@ -177,11 +168,11 @@ struct fts_encode_t { /** We use this information to determine when to start the optimize cycle for a table. */ struct fts_slot_t { - dict_table_t* table; /*!< Table to optimize */ + /** table identifier, or 0 if the slot is empty */ + table_id_t table_id; - table_id_t table_id; /*!< Table id */ - - fts_state_t state; /*!< State of this slot */ + /** whether this slot is being processed */ + bool running; ulint added; /*!< Number of doc ids added since the last time this table was optimized */ @@ -1608,12 +1599,10 @@ fts_optimize_create( optim->trx = trx_create(); trx_start_internal(optim->trx); - optim->fts_common_table.parent = table->name.m_name; optim->fts_common_table.table_id = table->id; optim->fts_common_table.type = FTS_COMMON_TABLE; optim->fts_common_table.table = table; - optim->fts_index_table.parent = table->name.m_name; optim->fts_index_table.table_id = table->id; optim->fts_index_table.type = FTS_INDEX_TABLE; optim->fts_index_table.table = table; @@ -2392,31 +2381,35 @@ fts_optimize_table_bk( fts_slot_t* slot) /*!< in: table to optimiza */ { dberr_t error; - dict_table_t* table = slot->table; - fts_t* fts = table->fts; /* Avoid optimizing tables that were optimized recently. */ if (slot->last_run > 0 && (ut_time() - slot->last_run) < slot->interval_time) { return(DB_SUCCESS); + } - } else if (fts && fts->cache - && fts->cache->deleted >= FTS_OPTIMIZE_THRESHOLD) { + dict_table_t* table = dict_table_open_on_id( + slot->table_id, FALSE, DICT_TABLE_OP_NORMAL); + if (table && fil_table_accessible(table) + && table->fts && table->fts->cache + && table->fts->cache->deleted >= FTS_OPTIMIZE_THRESHOLD) { error = fts_optimize_table(table); + slot->last_run = ut_time(); + if (error == DB_SUCCESS) { - slot->state = FTS_STATE_DONE; - slot->last_run = 0; - slot->completed = ut_time(); + slot->running = false; + slot->completed = slot->last_run; } } else { + /* Note time this run completed. */ + slot->last_run = ut_time(); error = DB_SUCCESS; } - /* Note time this run completed. */ - slot->last_run = ut_time(); + dict_table_close(table, FALSE, FALSE); return(error); } @@ -2633,85 +2626,59 @@ fts_optimize_request_sync_table( ib_wqueue_add(fts_optimize_wq, msg, msg->heap); } -/**********************************************************************//** -Add the table to the vector if it doesn't already exist. */ -static -ibool -fts_optimize_new_table( -/*===================*/ - ib_vector_t* tables, /*!< in/out: vector of tables */ - dict_table_t* table) /*!< in: table to add */ +/** Add a table to fts_slots if it doesn't already exist. */ +static bool fts_optimize_new_table(dict_table_t* table) { ulint i; fts_slot_t* slot; - ulint empty_slot = ULINT_UNDEFINED; + fts_slot_t* empty = NULL; + const table_id_t table_id = table->id; + ut_ad(table_id); /* Search for duplicates, also find a free slot if one exists. */ - for (i = 0; i < ib_vector_size(tables); ++i) { + for (i = 0; i < ib_vector_size(fts_slots); ++i) { - slot = static_cast<fts_slot_t*>( - ib_vector_get(tables, i)); + slot = static_cast<fts_slot_t*>(ib_vector_get(fts_slots, i)); - if (slot->state == FTS_STATE_EMPTY) { - empty_slot = i; - } else if (slot->table == table) { + if (!slot->table_id) { + empty = slot; + } else if (slot->table_id == table_id) { /* Already exists in our optimize queue. */ - ut_ad(slot->table_id == table->id); return(FALSE); } } - /* Reuse old slot. */ - if (empty_slot != ULINT_UNDEFINED) { - - slot = static_cast<fts_slot_t*>( - ib_vector_get(tables, empty_slot)); - - ut_a(slot->state == FTS_STATE_EMPTY); - - } else { /* Create a new slot. */ - - slot = static_cast<fts_slot_t*>(ib_vector_push(tables, NULL)); - } + slot = empty ? empty : static_cast<fts_slot_t*>( + ib_vector_push(fts_slots, NULL)); memset(slot, 0x0, sizeof(*slot)); - slot->table = table; slot->table_id = table->id; - slot->state = FTS_STATE_LOADED; + slot->running = false; slot->interval_time = FTS_OPTIMIZE_INTERVAL_IN_SECS; return(TRUE); } -/**********************************************************************//** -Remove the table from the vector if it exists. */ -static -ibool -fts_optimize_del_table( -/*===================*/ - ib_vector_t* tables, /*!< in/out: vector of tables */ - fts_msg_del_t* msg) /*!< in: table to delete */ +/** Remove a table from fts_slots if it exists. +@param[in,out] table table to be removed from fts_slots */ +static bool fts_optimize_del_table(const dict_table_t* table) { - ulint i; - dict_table_t* table = msg->table; + const table_id_t table_id = table->id; + ut_ad(table_id); - for (i = 0; i < ib_vector_size(tables); ++i) { + for (ulint i = 0; i < ib_vector_size(fts_slots); ++i) { fts_slot_t* slot; - slot = static_cast<fts_slot_t*>(ib_vector_get(tables, i)); - - if (slot->state != FTS_STATE_EMPTY - && slot->table == table) { + slot = static_cast<fts_slot_t*>(ib_vector_get(fts_slots, i)); + if (slot->table_id == table_id) { if (fts_enable_diag_print) { ib::info() << "FTS Optimize Removing table " << table->name; } - slot->table = NULL; - slot->state = FTS_STATE_EMPTY; - + slot->table_id = 0; return(TRUE); } } @@ -2720,14 +2687,9 @@ fts_optimize_del_table( } /**********************************************************************//** -Calculate how many of the registered tables need to be optimized. +Calculate how many tables in fts_slots need to be optimized. @return no. of tables to optimize */ -static -ulint -fts_optimize_how_many( -/*==================*/ - const ib_vector_t* tables) /*!< in: registered tables - vector*/ +static ulint fts_optimize_how_many() { ulint i; ib_time_t delta; @@ -2736,15 +2698,14 @@ fts_optimize_how_many( current_time = ut_time(); - for (i = 0; i < ib_vector_size(tables); ++i) { - const fts_slot_t* slot; - - slot = static_cast<const fts_slot_t*>( - ib_vector_get_const(tables, i)); + for (i = 0; i < ib_vector_size(fts_slots); ++i) { + const fts_slot_t* slot = static_cast<const fts_slot_t*>( + ib_vector_get_const(fts_slots, i)); + if (slot->table_id == 0) { + continue; + } - switch (slot->state) { - case FTS_STATE_DONE: - case FTS_STATE_LOADED: + if (!slot->running) { ut_a(slot->completed <= current_time); delta = current_time - slot->completed; @@ -2753,9 +2714,7 @@ fts_optimize_how_many( if (delta >= slot->interval_time) { ++n_tables; } - break; - - case FTS_STATE_RUNNING: + } else { ut_a(slot->last_run <= current_time); delta = current_time - slot->last_run; @@ -2763,15 +2722,7 @@ fts_optimize_how_many( if (delta > slot->interval_time) { ++n_tables; } - break; - - /* Slots in a state other than the above - are ignored. */ - case FTS_STATE_EMPTY: - case FTS_STATE_SUSPENDED: - break; } - } return(n_tables); @@ -2780,12 +2731,7 @@ fts_optimize_how_many( /**********************************************************************//** Check if the total memory used by all FTS table exceeds the maximum limit. @return true if a sync is needed, false otherwise */ -static -bool -fts_is_sync_needed( -/*===============*/ - const ib_vector_t* tables) /*!< in: registered tables - vector*/ +static bool fts_is_sync_needed() { ulint total_memory = 0; double time_diff = difftime(ut_time(), last_check_sync_time); @@ -2796,17 +2742,26 @@ fts_is_sync_needed( last_check_sync_time = ut_time(); - for (ulint i = 0; i < ib_vector_size(tables); ++i) { - const fts_slot_t* slot; + for (ulint i = 0; i < ib_vector_size(fts_slots); ++i) { + const fts_slot_t* slot = static_cast<const fts_slot_t*>( + ib_vector_get_const(fts_slots, i)); - slot = static_cast<const fts_slot_t*>( - ib_vector_get_const(tables, i)); + if (slot->table_id == 0) { + continue; + } + + dict_table_t* table = dict_table_open_on_id( + slot->table_id, FALSE, DICT_TABLE_OP_NORMAL); + if (!table) { + continue; + } - if (slot->state != FTS_STATE_EMPTY && slot->table - && slot->table->fts && slot->table->fts->cache) { - total_memory += slot->table->fts->cache->total_size; + if (table->fts && table->fts->cache) { + total_memory += table->fts->cache->total_size; } + dict_table_close(table, FALSE, FALSE); + if (total_memory > fts_max_total_cache_size) { return(true); } @@ -2817,16 +2772,12 @@ fts_is_sync_needed( /** Sync fts cache of a table @param[in] table_id table id */ -void -fts_optimize_sync_table( - table_id_t table_id) +static void fts_optimize_sync_table(table_id_t table_id) { - dict_table_t* table = NULL; - - table = dict_table_open_on_id(table_id, FALSE, DICT_TABLE_OP_NORMAL); - - if (table) { - if (dict_table_has_fts_index(table) && table->fts->cache) { + if (dict_table_t* table = dict_table_open_on_id( + table_id, FALSE, DICT_TABLE_OP_NORMAL)) { + if (fil_table_accessible(table) + && table->fts && table->fts->cache) { fts_sync_table(table, true, false, false); } @@ -2866,28 +2817,18 @@ DECLARE_THREAD(fts_optimize_thread)( && ib_wqueue_is_empty(wq) && n_tables > 0 && n_optimize > 0) { - - fts_slot_t* slot; - - ut_a(ib_vector_size(fts_slots) > 0); - - slot = static_cast<fts_slot_t*>( + fts_slot_t* slot = static_cast<fts_slot_t*>( ib_vector_get(fts_slots, current)); /* Handle the case of empty slots. */ - if (slot->state != FTS_STATE_EMPTY) { - - slot->state = FTS_STATE_RUNNING; - + if (slot->table_id) { + slot->running = true; fts_optimize_table_bk(slot); } - ++current; - /* Wrap around the counter. */ - if (current >= ib_vector_size(fts_slots)) { - n_optimize = fts_optimize_how_many(fts_slots); - + if (++current >= ib_vector_size(fts_slots)) { + n_optimize = fts_optimize_how_many(); current = 0; } @@ -2899,7 +2840,7 @@ DECLARE_THREAD(fts_optimize_thread)( /* Timeout ? */ if (msg == NULL) { - if (fts_is_sync_needed(fts_slots)) { + if (fts_is_sync_needed()) { fts_need_sync = true; } @@ -2914,17 +2855,16 @@ DECLARE_THREAD(fts_optimize_thread)( case FTS_MSG_ADD_TABLE: ut_a(!done); if (fts_optimize_new_table( - fts_slots, - static_cast<dict_table_t*>( - msg->ptr))) { + static_cast<dict_table_t*>( + msg->ptr))) { ++n_tables; } break; case FTS_MSG_DEL_TABLE: if (fts_optimize_del_table( - fts_slots, static_cast<fts_msg_del_t*>( - msg->ptr))) { + static_cast<fts_msg_del_t*>( + msg->ptr)->table)) { --n_tables; } @@ -2948,33 +2888,25 @@ DECLARE_THREAD(fts_optimize_thread)( } mem_heap_free(msg->heap); - - if (!done) { - n_optimize = fts_optimize_how_many(fts_slots); - } else { - n_optimize = 0; - } + n_optimize = done ? 0 : fts_optimize_how_many(); } } /* Server is being shutdown, sync the data from FTS cache to disk if needed */ if (n_tables > 0) { - ulint i; - - for (i = 0; i < ib_vector_size(fts_slots); i++) { - fts_slot_t* slot; - - slot = static_cast<fts_slot_t*>( + for (ulint i = 0; i < ib_vector_size(fts_slots); i++) { + fts_slot_t* slot = static_cast<fts_slot_t*>( ib_vector_get(fts_slots, i)); - if (slot->state != FTS_STATE_EMPTY) { - fts_optimize_sync_table(slot->table_id); + if (table_id_t table_id = slot->table_id) { + fts_optimize_sync_table(table_id); } } } ib_vector_free(fts_slots); + fts_slots = NULL; ib::info() << "FTS optimize thread exiting."; @@ -3022,8 +2954,7 @@ fts_optimize_init(void) table = UT_LIST_GET_NEXT(table_LRU, table)) { if (table->fts && dict_table_has_fts_index(table)) { - if (fts_optimize_new_table(fts_slots, - table)){ + if (fts_optimize_new_table(table)){ table_vector.push_back(table); } } diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc index 00f3b9aedf0..ed50e0924df 100644 --- a/storage/innobase/fts/fts0que.cc +++ b/storage/innobase/fts/fts0que.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -3961,7 +3961,6 @@ fts_query( query.fts_common_table.type = FTS_COMMON_TABLE; query.fts_common_table.table_id = index->table->id; - query.fts_common_table.parent = index->table->name.m_name; query.fts_common_table.table = index->table; charset = fts_index_get_charset(index); @@ -3969,7 +3968,6 @@ fts_query( query.fts_index_table.type = FTS_INDEX_TABLE; query.fts_index_table.index_id = index->id; query.fts_index_table.table_id = index->table->id; - query.fts_index_table.parent = index->table->name.m_name; query.fts_index_table.charset = charset; query.fts_index_table.table = index->table; diff --git a/storage/innobase/fts/fts0sql.cc b/storage/innobase/fts/fts0sql.cc index 6f66486ed6e..4a770187975 100644 --- a/storage/innobase/fts/fts0sql.cc +++ b/storage/innobase/fts/fts0sql.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -88,70 +89,52 @@ fts_get_table_id( return(len); } -/******************************************************************//** -Construct the prefix name of an FTS table. -@return own: table name, must be freed with ut_free() */ -char* -fts_get_table_name_prefix( -/*======================*/ - const fts_table_t* - fts_table) /*!< in: Auxiliary table type */ +/** Construct the name of an internal FTS table for the given table. +@param[in] fts_table metadata on fulltext-indexed table +@param[in] dict_locked whether dict_sys->mutex is being held +@return the prefix, must be freed with ut_free() */ +char* fts_get_table_name_prefix(const fts_table_t* fts_table) { - int len; - const char* slash; - char* prefix_name; - int dbname_len = 0; - int prefix_name_len; char table_id[FTS_AUX_MIN_TABLE_ID_LENGTH]; - - slash = static_cast<const char*>( - memchr(fts_table->parent, '/', strlen(fts_table->parent))); - - if (slash) { - /* Print up to and including the separator. */ - dbname_len = static_cast<int>(slash - fts_table->parent) + 1; - } - - len = fts_get_table_id(fts_table, table_id); - - prefix_name_len = dbname_len + 4 + len + 1; - - prefix_name = static_cast<char*>( - ut_malloc_nokey(unsigned(prefix_name_len))); - - len = sprintf(prefix_name, "%.*sFTS_%s", - dbname_len, fts_table->parent, table_id); - - ut_a(len > 0); - ut_a(len == prefix_name_len - 1); - - return(prefix_name); + const size_t table_id_len = size_t(fts_get_table_id(fts_table, + table_id)) + 1; + mutex_enter(&dict_sys->mutex); + /* Include the separator as well. */ + const size_t dbname_len = fts_table->table->name.dblen() + 1; + ut_ad(dbname_len > 1); + const size_t prefix_name_len = dbname_len + 4 + table_id_len; + char* prefix_name = static_cast<char*>( + ut_malloc_nokey(prefix_name_len)); + memcpy(prefix_name, fts_table->table->name.m_name, dbname_len); + mutex_exit(&dict_sys->mutex); + memcpy(prefix_name + dbname_len, "FTS_", 4); + memcpy(prefix_name + dbname_len + 4, table_id, table_id_len); + return prefix_name; } -/******************************************************************//** -Construct the name of an ancillary FTS table for the given table. -Caller must allocate enough memory(usually size of MAX_FULL_NAME_LEN) -for param 'table_name'. */ -void -fts_get_table_name( -/*===============*/ - const fts_table_t* fts_table, - /*!< in: Auxiliary table type */ - char* table_name) - /*!< in/out: aux table name */ +/** Construct the name of an internal FTS table for the given table. +@param[in] fts_table metadata on fulltext-indexed table +@param[out] table_name a name up to MAX_FULL_NAME_LEN +@param[in] dict_locked whether dict_sys->mutex is being held */ +void fts_get_table_name(const fts_table_t* fts_table, char* table_name, + bool dict_locked) { - int len; - char* prefix_name; - - prefix_name = fts_get_table_name_prefix(fts_table); - - len = sprintf(table_name, "%s_%s", prefix_name, fts_table->suffix); - - ut_a(len > 0); - ut_a(strlen(prefix_name) + 1 + strlen(fts_table->suffix) - == static_cast<uint>(len)); - - ut_free(prefix_name); + if (!dict_locked) { + mutex_enter(&dict_sys->mutex); + } + ut_ad(mutex_own(&dict_sys->mutex)); + /* Include the separator as well. */ + const size_t dbname_len = fts_table->table->name.dblen() + 1; + ut_ad(dbname_len > 1); + memcpy(table_name, fts_table->table->name.m_name, dbname_len); + if (!dict_locked) { + mutex_exit(&dict_sys->mutex); + } + memcpy(table_name += dbname_len, "FTS_", 4); + table_name += 4; + table_name += fts_get_table_id(fts_table, table_name); + *table_name++ = '_'; + strcpy(table_name, fts_table->suffix); } /******************************************************************//** @@ -209,8 +192,6 @@ fts_parse_sql_no_dict_lock( str = ut_str3cat(fts_sql_begin, sql, fts_sql_end); - //fprintf(stderr, "%s\n", str); - graph = pars_sql(info, str); ut_a(graph); diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc index 9ddfa42cf98..b588ca71f34 100644 --- a/storage/innobase/gis/gis0rtree.cc +++ b/storage/innobase/gis/gis0rtree.cc @@ -720,15 +720,22 @@ rtr_adjust_upper_level( cursor.rtr_info = sea_cur->rtr_info; cursor.tree_height = sea_cur->tree_height; + /* Recreate a memory heap as input parameter for + btr_cur_pessimistic_insert(), because the heap may be + emptied in btr_cur_pessimistic_insert(). */ + mem_heap_t* new_heap = mem_heap_create(1024); + err = btr_cur_pessimistic_insert(flags | BTR_NO_LOCKING_FLAG | BTR_KEEP_SYS_FLAG | BTR_NO_UNDO_LOG_FLAG, - &cursor, &offsets, &heap, + &cursor, &offsets, &new_heap, node_ptr_upper, &rec, &dummy_big_rec, 0, NULL, mtr); cursor.rtr_info = NULL; ut_a(err == DB_SUCCESS); + + mem_heap_free(new_heap); } prdt.data = static_cast<void*>(mbr); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 35f748d4754..3f810ba0e03 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -14810,6 +14810,10 @@ get_foreign_key_info( LEX_CSTRING* referenced_key_name; LEX_CSTRING* name = NULL; + if (dict_table_t::is_temporary_name(foreign->foreign_table_name)) { + return NULL; + } + ptr = dict_remove_db_name(foreign->id); f_key_info.foreign_id = thd_make_lex_string( thd, 0, ptr, strlen(ptr), 1); diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 70f2c1940fc..a2e503de88f 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2005, 2018, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2005, 2019, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2013, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -289,12 +289,16 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx { UT_DELETE(m_stage); if (instant_table) { + ut_ad(!instant_table->id); while (dict_index_t* index = UT_LIST_GET_LAST(instant_table->indexes)) { UT_LIST_REMOVE(instant_table->indexes, index); rw_lock_free(&index->lock); dict_mem_index_free(index); } + if (instant_table->fts) { + fts_free(instant_table); + } dict_mem_table_free(instant_table); } mem_heap_free(heap); @@ -344,6 +348,23 @@ struct ha_innobase_inplace_ctx : public inplace_alter_handler_ctx return instant_table; } + /** Share context between partitions. + @param[in] ctx context from another partition of the table */ + void set_shared_data(const inplace_alter_handler_ctx& ctx) + { + if (add_autoinc != ULINT_UNDEFINED) { + const ha_innobase_inplace_ctx& ha_ctx = + static_cast<const ha_innobase_inplace_ctx&> + (ctx); + /* When adding an AUTO_INCREMENT column to a + partitioned InnoDB table, we must share the + sequence for all partitions. */ + ut_ad(ha_ctx.add_autoinc == add_autoinc); + ut_ad(ha_ctx.sequence.last()); + sequence = ha_ctx.sequence; + } + } + private: // Disable copying ha_innobase_inplace_ctx(const ha_innobase_inplace_ctx&); @@ -4836,7 +4857,7 @@ prepare_inplace_alter_table_dict( (ha_alter_info->handler_ctx); DBUG_ASSERT((ctx->add_autoinc != ULINT_UNDEFINED) - == (ctx->sequence.m_max_value > 0)); + == (ctx->sequence.max_value() > 0)); DBUG_ASSERT(!ctx->num_to_drop_index == !ctx->drop_index); DBUG_ASSERT(!ctx->num_to_drop_fk == !ctx->drop_fk); DBUG_ASSERT(!add_fts_doc_id || add_fts_doc_id_idx); diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 85526bc763f..99cdca40257 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -883,8 +883,7 @@ but only by InnoDB table locks, which may be broken by lock_remove_all_on_table().) @param[in] table persistent table checked @return whether the table is accessible */ -bool -fil_table_accessible(const dict_table_t* table) +bool fil_table_accessible(const dict_table_t* table) MY_ATTRIBUTE((warn_unused_result, nonnull)); /** Delete a tablespace and associated .ibd file. diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h index 4c4647dba95..53a78e18618 100644 --- a/storage/innobase/include/fts0fts.h +++ b/storage/innobase/include/fts0fts.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2017, MariaDB Corporation. +Copyright (c) 2016, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -176,7 +176,6 @@ do { \ (fts_table)->suffix = m_suffix; \ (fts_table)->type = m_type; \ (fts_table)->table_id = m_table->id; \ - (fts_table)->parent = m_table->name.m_name; \ (fts_table)->table = m_table; \ } while (0); @@ -185,7 +184,6 @@ do { \ (fts_table)->suffix = m_suffix; \ (fts_table)->type = m_type; \ (fts_table)->table_id = m_index->table->id; \ - (fts_table)->parent = m_index->table->name.m_name; \ (fts_table)->table = m_index->table; \ (fts_table)->index_id = m_index->id; \ } while (0); @@ -290,10 +288,6 @@ struct fts_result_t { table id and the index id to generate the column specific FTS auxiliary table name. */ struct fts_table_t { - const char* parent; /*!< Parent table name, this is - required only for the database - name */ - fts_table_type_t type; /*!< The auxiliary table type */ @@ -448,8 +442,8 @@ fts_update_next_doc_id( /*===================*/ trx_t* trx, /*!< in/out: transaction */ const dict_table_t* table, /*!< in: table */ - const char* table_name, /*!< in: table name, or NULL */ - doc_id_t doc_id); /*!< in: DOC ID to set */ + doc_id_t doc_id) /*!< in: DOC ID to set */ + MY_ATTRIBUTE((nonnull(2))); /******************************************************************//** Create a new fts_doc_ids_t. diff --git a/storage/innobase/include/fts0priv.h b/storage/innobase/include/fts0priv.h index 85331cbd31e..a86dbd149b1 100644 --- a/storage/innobase/include/fts0priv.h +++ b/storage/innobase/include/fts0priv.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -121,8 +121,7 @@ fts_parse_sql( fts_table_t* fts_table, /*!< in: FTS aux table */ pars_info_t* info, /*!< in: info struct, or NULL */ const char* sql) /*!< in: SQL string to evaluate */ - MY_ATTRIBUTE((warn_unused_result)); - + MY_ATTRIBUTE((nonnull(3), malloc, warn_unused_result)); /******************************************************************//** Evaluate a parsed SQL statement @return DB_SUCCESS or error code */ @@ -131,19 +130,15 @@ fts_eval_sql( /*=========*/ trx_t* trx, /*!< in: transaction */ que_t* graph) /*!< in: Parsed statement */ - MY_ATTRIBUTE((warn_unused_result)); - -/******************************************************************//** -Construct the name of an ancillary FTS table for the given table. -Caller must allocate enough memory(usually size of MAX_FULL_NAME_LEN) -for param 'table_name'. */ -void -fts_get_table_name( -/*===============*/ - const fts_table_t* - fts_table, /*!< in: FTS aux table info */ - char* table_name); /*!< in/out: aux table name */ + MY_ATTRIBUTE((nonnull, warn_unused_result)); +/** Construct the name of an internal FTS table for the given table. +@param[in] fts_table metadata on fulltext-indexed table +@param[out] table_name a name up to MAX_FULL_NAME_LEN +@param[in] dict_locked whether dict_sys->mutex is being held */ +void fts_get_table_name(const fts_table_t* fts_table, char* table_name, + bool dict_locked = false) + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Construct the column specification part of the SQL string for selecting the indexed FTS columns for the given table. Adds the necessary bound @@ -165,7 +160,7 @@ fts_get_select_columns_str( dict_index_t* index, /*!< in: FTS index */ pars_info_t* info, /*!< in/out: parser info */ mem_heap_t* heap) /*!< in: memory heap */ - MY_ATTRIBUTE((warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** define for fts_doc_fetch_by_doc_id() "option" value, defines whether we want to get Doc whose ID is equal to or greater or smaller than supplied @@ -190,7 +185,8 @@ fts_doc_fetch_by_doc_id( fts_sql_callback callback, /*!< in: callback to read records */ - void* arg); /*!< in: callback arg */ + void* arg) /*!< in: callback arg */ + MY_ATTRIBUTE((nonnull(6))); /*******************************************************************//** Callback function for fetch that stores the text of an FTS document, @@ -200,8 +196,8 @@ ibool fts_query_expansion_fetch_doc( /*==========================*/ void* row, /*!< in: sel_node_t* */ - void* user_arg); /*!< in: fts_doc_t* */ - + void* user_arg) /*!< in: fts_doc_t* */ + MY_ATTRIBUTE((nonnull)); /******************************************************************** Write out a single word's data as new entry/entries in the INDEX table. @return DB_SUCCESS if all OK. */ @@ -213,7 +209,7 @@ fts_write_node( fts_table_t* fts_table, /*!< in: the FTS aux index */ fts_string_t* word, /*!< in: word in UTF-8 */ fts_node_t* node) /*!< in: node columns */ - MY_ATTRIBUTE((warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Check if a fts token is a stopword or less than fts_min_token_size or greater than fts_max_token_size. @@ -233,7 +229,8 @@ Initialize a document. */ void fts_doc_init( /*=========*/ - fts_doc_t* doc); /*!< in: doc to initialize */ + fts_doc_t* doc) /*!< in: doc to initialize */ + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Do a binary search for a doc id in the array @@ -246,21 +243,21 @@ fts_bsearch( int lower, /*!< in: lower bound of array*/ int upper, /*!< in: upper bound of array*/ doc_id_t doc_id) /*!< in: doc id to lookup */ - MY_ATTRIBUTE((warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Free document. */ void fts_doc_free( /*=========*/ - fts_doc_t* doc); /*!< in: document */ - + fts_doc_t* doc) /*!< in: document */ + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Free fts_optimizer_word_t instanace.*/ void fts_word_free( /*==========*/ - fts_word_t* word); /*!< in: instance to free.*/ - + fts_word_t* word) /*!< in: instance to free.*/ + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Read the rows from the FTS inde @return DB_SUCCESS or error code */ @@ -272,8 +269,8 @@ fts_index_fetch_nodes( fts_table_t* fts_table, /*!< in: FTS aux table */ const fts_string_t* word, /*!< in: the word to fetch */ - fts_fetch_t* fetch); /*!< in: fetch callback.*/ - + fts_fetch_t* fetch) /*!< in: fetch callback.*/ + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Compare two fts_trx_table_t instances, we actually compare the table id's here. @@ -283,8 +280,8 @@ int fts_trx_table_cmp( /*==============*/ const void* v1, /*!< in: id1 */ - const void* v2); /*!< in: id2 */ - + const void* v2) /*!< in: id2 */ + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Compare a table id with a trx_table_t table id. @return < 0 if n1 < n2, 0 if n1 == n2, > 0 if n1 > n2 */ @@ -293,24 +290,24 @@ int fts_trx_table_id_cmp( /*=================*/ const void* p1, /*!< in: id1 */ - const void* p2); /*!< in: id2 */ - + const void* p2) /*!< in: id2 */ + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Commit a transaction. @return DB_SUCCESS if all OK */ dberr_t fts_sql_commit( /*===========*/ - trx_t* trx); /*!< in: transaction */ - + trx_t* trx) /*!< in: transaction */ + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Rollback a transaction. @return DB_SUCCESS if all OK */ dberr_t fts_sql_rollback( /*=============*/ - trx_t* trx); /*!< in: transaction */ - + trx_t* trx) /*!< in: transaction */ + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Parse an SQL string. %s is replaced with the table's id. Don't acquire the dict mutex @@ -320,8 +317,7 @@ fts_parse_sql_no_dict_lock( /*=======================*/ pars_info_t* info, /*!< in: parser info */ const char* sql) /*!< in: SQL string to evaluate */ - MY_ATTRIBUTE((warn_unused_result)); - + MY_ATTRIBUTE((nonnull(2), malloc, warn_unused_result)); /******************************************************************//** Get value from config table. The caller must ensure that enough space is allocated for value to hold the column contents @@ -333,8 +329,9 @@ fts_config_get_value( fts_table_t* fts_table, /*!< in: the indexed FTS table */ const char* name, /*!< in: get config value for this parameter name */ - fts_string_t* value); /*!< out: value read from + fts_string_t* value) /*!< out: value read from config table */ + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Get value specific to an FTS index from the config table. The caller must ensure that enough space is allocated for value to hold the @@ -349,8 +346,7 @@ fts_config_get_index_value( this parameter name */ fts_string_t* value) /*!< out: value read from config table */ - MY_ATTRIBUTE((warn_unused_result)); - + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Set the value in the config table for name. @return DB_SUCCESS or error code */ @@ -362,8 +358,8 @@ fts_config_set_value( const char* name, /*!< in: get config value for this parameter name */ const fts_string_t* - value); /*!< in: value to update */ - + value) /*!< in: value to update */ + MY_ATTRIBUTE((nonnull)); /****************************************************************//** Set an ulint value in the config table. @return DB_SUCCESS if all OK else error code */ @@ -374,8 +370,7 @@ fts_config_set_ulint( fts_table_t* fts_table, /*!< in: the indexed FTS table */ const char* name, /*!< in: param name */ ulint int_value) /*!< in: value */ - MY_ATTRIBUTE((warn_unused_result)); - + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Set the value specific to an FTS index in the config table. @return DB_SUCCESS or error code */ @@ -388,7 +383,7 @@ fts_config_set_index_value( this parameter name */ fts_string_t* value) /*!< out: value read from config table */ - MY_ATTRIBUTE((warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifdef FTS_OPTIMIZE_DEBUG /******************************************************************//** @@ -401,7 +396,7 @@ fts_config_get_index_ulint( dict_index_t* index, /*!< in: FTS index */ const char* name, /*!< in: param name */ ulint* int_value) /*!< out: value */ - MY_ATTRIBUTE((warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* FTS_OPTIMIZE_DEBUG */ /******************************************************************//** @@ -414,8 +409,7 @@ fts_config_set_index_ulint( dict_index_t* index, /*!< in: FTS index */ const char* name, /*!< in: param name */ ulint int_value) /*!< in: value */ - MY_ATTRIBUTE((warn_unused_result)); - + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Get an ulint value from the config table. @return DB_SUCCESS or error code */ @@ -425,8 +419,8 @@ fts_config_get_ulint( trx_t* trx, /*!< in: transaction */ fts_table_t* fts_table, /*!< in: the indexed FTS table */ const char* name, /*!< in: param name */ - ulint* int_value); /*!< out: value */ - + ulint* int_value) /*!< out: value */ + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Search cache for word. @return the word node vector if found else NULL */ @@ -437,7 +431,7 @@ fts_cache_find_word( index_cache, /*!< in: cache to search */ const fts_string_t* text) /*!< in: word to search for */ - MY_ATTRIBUTE((warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Append deleted doc ids to vector and sort the vector. */ @@ -470,8 +464,7 @@ fts_find_index_cache( cache, /*!< in: cache to search */ const dict_index_t* index) /*!< in: index to search for */ - MY_ATTRIBUTE((warn_unused_result)); - + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Write the table id to the given buffer (including final NUL). Buffer must be at least FTS_AUX_MIN_TABLE_ID_LENGTH bytes long. @@ -482,10 +475,10 @@ fts_write_object_id( /*================*/ ib_id_t id, /*!< in: a table/index id */ char* str, /*!< in: buffer to write the id to */ - bool hex_format MY_ATTRIBUTE((unused))); + bool hex_format MY_ATTRIBUTE((unused))) /*!< in: true for fixed hex format, false for old ambiguous format */ - + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Read the table id from the string generated by fts_write_object_id(). @return TRUE if parse successful */ @@ -495,8 +488,7 @@ fts_read_object_id( /*===============*/ ib_id_t* id, /*!< out: a table id */ const char* str) /*!< in: buffer to read from */ - MY_ATTRIBUTE((warn_unused_result)); - + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Get the table id. @return number of bytes written */ @@ -508,18 +500,13 @@ fts_get_table_id( char* table_id) /*!< out: table id, must be at least FTS_AUX_MIN_TABLE_ID_LENGTH bytes long */ - MY_ATTRIBUTE((warn_unused_result)); - -/******************************************************************//** -Construct the prefix name of an FTS table. -@return own: table name, must be freed with ut_free() */ -char* -fts_get_table_name_prefix( -/*======================*/ - const fts_table_t* - fts_table) /*!< in: Auxiliary table type */ - MY_ATTRIBUTE((warn_unused_result)); - + MY_ATTRIBUTE((nonnull, warn_unused_result)); +/** Construct the name of an internal FTS table for the given table. +@param[in] fts_table metadata on fulltext-indexed table +@param[in] dict_locked whether dict_sys->mutex is being held +@return the prefix, must be freed with ut_free() */ +char* fts_get_table_name_prefix(const fts_table_t* fts_table) + MY_ATTRIBUTE((nonnull, malloc, warn_unused_result)); /******************************************************************//** Add node positions. */ void @@ -528,7 +515,8 @@ fts_cache_node_add_positions( fts_cache_t* cache, /*!< in: cache */ fts_node_t* node, /*!< in: word node */ doc_id_t doc_id, /*!< in: doc id */ - ib_vector_t* positions); /*!< in: fts_token_t::positions */ + ib_vector_t* positions) /*!< in: fts_token_t::positions */ + MY_ATTRIBUTE((nonnull(2,4))); /******************************************************************//** Create the config table name for retrieving index specific value. @@ -538,7 +526,7 @@ fts_config_create_index_param_name( /*===============================*/ const char* param, /*!< in: base name of param */ const dict_index_t* index) /*!< in: index for config */ - MY_ATTRIBUTE((warn_unused_result)); + MY_ATTRIBUTE((nonnull, malloc, warn_unused_result)); #include "fts0priv.ic" diff --git a/storage/innobase/include/handler0alter.h b/storage/innobase/include/handler0alter.h index 81c0fd18a29..7071d1ad2b5 100644 --- a/storage/innobase/include/handler0alter.h +++ b/storage/innobase/include/handler0alter.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -83,9 +84,13 @@ struct ib_sequence_t { return(m_next_value); } - /** Maximum calumn value if adding an AUTOINC column else 0. Once - we reach the end of the sequence it will be set to ~0. */ - const ulonglong m_max_value; + /** @return maximum column value + @retval 0 if not adding AUTO_INCREMENT column */ + ulonglong max_value() const { return m_max_value; } + +private: + /** Maximum value if adding an AUTO_INCREMENT column, else 0 */ + ulonglong m_max_value; /** Value of auto_increment_increment */ ulong m_increment; diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 409b42c452a..1cefc848fa3 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -712,8 +712,6 @@ log_file_header_flush( log_sys.n_log_ios++; - MONITOR_INC(MONITOR_LOG_IO); - srv_stats.os_log_pending_writes.inc(); const ulint page_no = ulint(dest_offset >> srv_page_size_shift); @@ -829,8 +827,6 @@ loop: log_sys.n_log_ios++; - MONITOR_INC(MONITOR_LOG_IO); - srv_stats.os_log_pending_writes.inc(); ut_a((next_offset >> srv_page_size_shift) <= ULINT_MAX); @@ -874,7 +870,6 @@ log_write_flush_to_disk_low() fil_flush(SRV_LOG_SPACE_FIRST_ID); } - MONITOR_DEC(MONITOR_PENDING_LOG_FLUSH); log_mutex_enter(); if (do_flush) { @@ -1018,7 +1013,6 @@ loop: if (flush_to_disk) { log_sys.n_pending_flushes++; log_sys.current_flush_lsn = log_sys.lsn; - MONITOR_INC(MONITOR_PENDING_LOG_FLUSH); os_event_reset(log_sys.flush_event); if (log_sys.buf_free == log_sys.buf_next_to_write) { diff --git a/storage/innobase/read/read0read.cc b/storage/innobase/read/read0read.cc index 470c8ec63f1..79084d3b591 100644 --- a/storage/innobase/read/read0read.cc +++ b/storage/innobase/read/read0read.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, MariaDB Corporation. +Copyright (c) 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc index 8afee045493..8a85d9d83fd 100644 --- a/storage/innobase/row/row0ftsort.cc +++ b/storage/innobase/row/row0ftsort.cc @@ -1652,7 +1652,6 @@ row_fts_merge_insert( fts_table.type = FTS_INDEX_TABLE; fts_table.index_id = index->id; fts_table.table_id = table->id; - fts_table.parent = index->table->name.m_name; fts_table.table = index->table; fts_table.suffix = fts_get_suffix(id); diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index edf76eb2192..b5afa332a9f 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -2870,9 +2870,7 @@ wait_again: false, true, false); if (err == DB_SUCCESS) { - fts_update_next_doc_id( - 0, new_table, - old_table->name.m_name, max_doc_id); + fts_update_next_doc_id(NULL, new_table, max_doc_id); } } diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 2fc465e7726..eb836de9748 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -891,6 +891,14 @@ row_purge_upd_exist_or_extern_func( node->row, NULL, node->index, heap, ROW_BUILD_FOR_PURGE); row_purge_remove_sec_if_poss(node, node->index, entry); + + if (node->vcol_op_failed()) { + ut_ad(!node->table); + mem_heap_free(heap); + return; + } + ut_ad(node->table); + mem_heap_empty(heap); } diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc index dbad142f3f4..fae0792e239 100644 --- a/storage/innobase/row/row0trunc.cc +++ b/storage/innobase/row/row0trunc.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2013, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2018, MariaDB Corporation. +Copyright (c) 2017, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc index 85d9f0522aa..090cea262fa 100644 --- a/storage/innobase/srv/srv0mon.cc +++ b/storage/innobase/srv/srv0mon.cc @@ -922,15 +922,18 @@ static monitor_info_t innodb_counter_info[] = MONITOR_DEFAULT_START, MONITOR_OVLD_MAX_AGE_SYNC}, {"log_pending_log_flushes", "recovery", "Pending log flushes", - MONITOR_NONE, + static_cast<monitor_type_t>( + MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT), MONITOR_DEFAULT_START, MONITOR_PENDING_LOG_FLUSH}, {"log_pending_checkpoint_writes", "recovery", "Pending checkpoints", - MONITOR_NONE, + static_cast<monitor_type_t>( + MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT), MONITOR_DEFAULT_START, MONITOR_PENDING_CHECKPOINT_WRITE}, {"log_num_log_io", "recovery", "Number of log I/Os", - MONITOR_NONE, + static_cast<monitor_type_t>( + MONITOR_EXISTING | MONITOR_DISPLAY_CURRENT), MONITOR_DEFAULT_START, MONITOR_LOG_IO}, {"log_waits", "recovery", @@ -2007,6 +2010,25 @@ srv_mon_process_existing_counter( value = (mon_type_t) log_sys.lsn; break; + case MONITOR_PENDING_LOG_FLUSH: + mutex_enter(&log_sys.mutex); + value = static_cast<mon_type_t>(log_sys.n_pending_flushes); + mutex_exit(&log_sys.mutex); + break; + + case MONITOR_PENDING_CHECKPOINT_WRITE: + mutex_enter(&log_sys.mutex); + value = static_cast<mon_type_t>( + log_sys.n_pending_checkpoint_writes); + mutex_exit(&log_sys.mutex); + break; + + case MONITOR_LOG_IO: + mutex_enter(&log_sys.mutex); + value = static_cast<mon_type_t>(log_sys.n_log_ios); + mutex_exit(&log_sys.mutex); + break; + case MONITOR_OVLD_BUF_OLDEST_LSN: value = (mon_type_t) buf_pool_get_oldest_modification(); break; diff --git a/storage/innobase/ut/ut0timer.cc b/storage/innobase/ut/ut0timer.cc index 85292cce28c..abb2326d8a5 100644 --- a/storage/innobase/ut/ut0timer.cc +++ b/storage/innobase/ut/ut0timer.cc @@ -46,6 +46,7 @@ Function pointer to point selected timer function. ulonglong (*ut_timer_now)(void) = &ut_timer_none; struct my_timer_unit_info ut_timer; +extern MYSQL_PLUGIN_IMPORT MY_TIMER_INFO sys_timer_info; /**************************************************************//** Sets up the data required for use of my_timer_* functions. @@ -57,30 +58,27 @@ void ut_init_timer(void) /*===============*/ { - MY_TIMER_INFO all_timer_info; - my_timer_init(&all_timer_info); - - if (all_timer_info.cycles.frequency > 1000000 && - all_timer_info.cycles.resolution == 1) { - ut_timer = all_timer_info.cycles; + if (sys_timer_info.cycles.frequency > 1000000 && + sys_timer_info.cycles.resolution == 1) { + ut_timer = sys_timer_info.cycles; ut_timer_now = &my_timer_cycles; - } else if (all_timer_info.nanoseconds.frequency > 1000000 && - all_timer_info.nanoseconds.resolution == 1) { - ut_timer = all_timer_info.nanoseconds; + } else if (sys_timer_info.nanoseconds.frequency > 1000000 && + sys_timer_info.nanoseconds.resolution == 1) { + ut_timer = sys_timer_info.nanoseconds; ut_timer_now = &my_timer_nanoseconds; - } else if (all_timer_info.microseconds.frequency >= 1000000 && - all_timer_info.microseconds.resolution == 1) { - ut_timer = all_timer_info.microseconds; + } else if (sys_timer_info.microseconds.frequency >= 1000000 && + sys_timer_info.microseconds.resolution == 1) { + ut_timer = sys_timer_info.microseconds; ut_timer_now = &my_timer_microseconds; - } else if (all_timer_info.milliseconds.frequency >= 1000 && - all_timer_info.milliseconds.resolution == 1) { - ut_timer = all_timer_info.milliseconds; + } else if (sys_timer_info.milliseconds.frequency >= 1000 && + sys_timer_info.milliseconds.resolution == 1) { + ut_timer = sys_timer_info.milliseconds; ut_timer_now = &my_timer_milliseconds; - } else if (all_timer_info.ticks.frequency >= 1000 && + } else if (sys_timer_info.ticks.frequency >= 1000 && /* Will probably be false */ - all_timer_info.ticks.resolution == 1) { - ut_timer = all_timer_info.ticks; + sys_timer_info.ticks.resolution == 1) { + ut_timer = sys_timer_info.ticks; ut_timer_now = &my_timer_ticks; } else { /* None are acceptable, so leave it as "None", and fill in struct */ diff --git a/storage/perfschema/pfs_timer.cc b/storage/perfschema/pfs_timer.cc index 8348f165e5c..cc99e69c3cc 100644 --- a/storage/perfschema/pfs_timer.cc +++ b/storage/perfschema/pfs_timer.cc @@ -26,7 +26,6 @@ enum_timer_name idle_timer= TIMER_NAME_MICROSEC; enum_timer_name wait_timer= TIMER_NAME_CYCLE; enum_timer_name stage_timer= TIMER_NAME_NANOSEC; enum_timer_name statement_timer= TIMER_NAME_NANOSEC; -MY_TIMER_INFO pfs_timer_info; static ulonglong cycle_v0; static ulonglong nanosec_v0; @@ -65,41 +64,39 @@ void init_timers(void) { double pico_frequency= 1.0e12; - my_timer_init(&pfs_timer_info); - cycle_v0= my_timer_cycles(); nanosec_v0= my_timer_nanoseconds(); microsec_v0= my_timer_microseconds(); millisec_v0= my_timer_milliseconds(); tick_v0= my_timer_ticks(); - if (pfs_timer_info.cycles.frequency > 0) + if (sys_timer_info.cycles.frequency > 0) cycle_to_pico= round_to_ulong(pico_frequency/ - (double)pfs_timer_info.cycles.frequency); + (double)sys_timer_info.cycles.frequency); else cycle_to_pico= 0; - if (pfs_timer_info.nanoseconds.frequency > 0) + if (sys_timer_info.nanoseconds.frequency > 0) nanosec_to_pico= round_to_ulong(pico_frequency/ - (double)pfs_timer_info.nanoseconds.frequency); + (double)sys_timer_info.nanoseconds.frequency); else nanosec_to_pico= 0; - if (pfs_timer_info.microseconds.frequency > 0) + if (sys_timer_info.microseconds.frequency > 0) microsec_to_pico= round_to_ulong(pico_frequency/ - (double)pfs_timer_info.microseconds.frequency); + (double)sys_timer_info.microseconds.frequency); else microsec_to_pico= 0; - if (pfs_timer_info.milliseconds.frequency > 0) + if (sys_timer_info.milliseconds.frequency > 0) millisec_to_pico= round_to_ulong(pico_frequency/ - (double)pfs_timer_info.milliseconds.frequency); + (double)sys_timer_info.milliseconds.frequency); else millisec_to_pico= 0; - if (pfs_timer_info.ticks.frequency > 0) + if (sys_timer_info.ticks.frequency > 0) tick_to_pico= round_to_ulonglong(pico_frequency/ - (double)pfs_timer_info.ticks.frequency); + (double)sys_timer_info.ticks.frequency); else tick_to_pico= 0; diff --git a/storage/perfschema/pfs_timer.h b/storage/perfschema/pfs_timer.h index 1cae20e89dd..1b167a46dad 100644 --- a/storage/perfschema/pfs_timer.h +++ b/storage/perfschema/pfs_timer.h @@ -102,7 +102,7 @@ extern enum_timer_name statement_timer; Timer information data. Characteristics about each suported timer. */ -extern MY_TIMER_INFO pfs_timer_info; +extern MYSQL_PLUGIN_IMPORT MY_TIMER_INFO sys_timer_info; /** Initialize the timer component. */ void init_timers(); diff --git a/storage/perfschema/table_performance_timers.cc b/storage/perfschema/table_performance_timers.cc index 780d507a64b..dc36874d6e9 100644 --- a/storage/perfschema/table_performance_timers.cc +++ b/storage/perfschema/table_performance_timers.cc @@ -58,23 +58,23 @@ table_performance_timers::table_performance_timers() index= (int)TIMER_NAME_CYCLE - FIRST_TIMER_NAME; m_data[index].m_timer_name= TIMER_NAME_CYCLE; - m_data[index].m_info= pfs_timer_info.cycles; + m_data[index].m_info= sys_timer_info.cycles; index= (int)TIMER_NAME_NANOSEC - FIRST_TIMER_NAME; m_data[index].m_timer_name= TIMER_NAME_NANOSEC; - m_data[index].m_info= pfs_timer_info.nanoseconds; + m_data[index].m_info= sys_timer_info.nanoseconds; index= (int)TIMER_NAME_MICROSEC - FIRST_TIMER_NAME; m_data[index].m_timer_name= TIMER_NAME_MICROSEC; - m_data[index].m_info= pfs_timer_info.microseconds; + m_data[index].m_info= sys_timer_info.microseconds; index= (int)TIMER_NAME_MILLISEC - FIRST_TIMER_NAME; m_data[index].m_timer_name= TIMER_NAME_MILLISEC; - m_data[index].m_info= pfs_timer_info.milliseconds; + m_data[index].m_info= sys_timer_info.milliseconds; index= (int)TIMER_NAME_TICK - FIRST_TIMER_NAME; m_data[index].m_timer_name= TIMER_NAME_TICK; - m_data[index].m_info= pfs_timer_info.ticks; + m_data[index].m_info= sys_timer_info.ticks; } void table_performance_timers::reset_position(void) diff --git a/storage/perfschema/unittest/pfs_server_stubs.cc b/storage/perfschema/unittest/pfs_server_stubs.cc index d7154067fc2..1093b6a859b 100644 --- a/storage/perfschema/unittest/pfs_server_stubs.cc +++ b/storage/perfschema/unittest/pfs_server_stubs.cc @@ -43,3 +43,5 @@ enum sys_var::where get_sys_var_value_origin(void *ptr) { return sys_var::AUTO; } + +MY_TIMER_INFO sys_timer_info; diff --git a/storage/perfschema/unittest/pfs_timer-t.cc b/storage/perfschema/unittest/pfs_timer-t.cc index 55113860532..f2752191447 100644 --- a/storage/perfschema/unittest/pfs_timer-t.cc +++ b/storage/perfschema/unittest/pfs_timer-t.cc @@ -33,6 +33,8 @@ void test_timers() ulonglong t4_b; ulonglong t5_b; + my_timer_init(&sys_timer_info); + init_timers(); t1_a= get_timer_pico_value(TIMER_NAME_CYCLE); diff --git a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result new file mode 100644 index 00000000000..8d5b6270318 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result @@ -0,0 +1,344 @@ +SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX; +trx_id trx_state trx_started trx_requested_lock_id trx_wait_started trx_weight trx_mysql_thread_id trx_query trx_operation_state trx_tables_in_use trx_tables_locked trx_lock_structs trx_lock_memory_bytes trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks trx_foreign_key_checks trx_last_foreign_key_error trx_is_read_only trx_autocommit_non_locking +SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS; +lock_id lock_trx_id lock_mode lock_type lock_table lock_index lock_space lock_page lock_rec lock_data +SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS; +requesting_trx_id requested_lock_id blocking_trx_id blocking_lock_id +SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP; +page_size compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time +SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_RESET; +page_size compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time +SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX; +database_name table_name index_name compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time +SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX_RESET; +database_name table_name index_name compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time +SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM; +page_size buffer_pool_instance pages_used pages_free relocation_ops relocation_time +SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM_RESET; +page_size buffer_pool_instance pages_used pages_free relocation_ops relocation_time +SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS; +NAME SUBSYSTEM COUNT MAX_COUNT MIN_COUNT AVG_COUNT COUNT_RESET MAX_COUNT_RESET MIN_COUNT_RESET AVG_COUNT_RESET TIME_ENABLED TIME_DISABLED TIME_ELAPSED TIME_RESET STATUS TYPE COMMENT +metadata_table_handles_opened metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table handles opened +metadata_table_handles_closed metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table handles closed +metadata_table_reference_count metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Table reference counter +lock_deadlocks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of deadlocks +lock_timeouts lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of lock timeouts +lock_rec_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times enqueued into record lock wait queue +lock_table_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times enqueued into table lock wait queue +lock_rec_lock_requests lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of record locks requested +lock_rec_lock_created lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of record locks created +lock_rec_lock_removed lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of record locks removed from the lock queue +lock_rec_locks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Current number of record locks on tables +lock_table_lock_created lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table locks created +lock_table_lock_removed lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table locks removed from the lock queue +lock_table_locks lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Current number of table locks on tables +lock_row_lock_current_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of row locks currently being waited for (innodb_row_lock_current_waits) +lock_row_lock_time lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Time spent in acquiring row locks, in milliseconds (innodb_row_lock_time) +lock_row_lock_time_max lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value The maximum time to acquire a row lock, in milliseconds (innodb_row_lock_time_max) +lock_row_lock_waits lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of times a row lock had to be waited for (innodb_row_lock_waits) +lock_row_lock_time_avg lock 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value The average time to acquire a row lock, in milliseconds (innodb_row_lock_time_avg) +buffer_pool_size server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Server buffer pool size (all buffer pools) in bytes +buffer_pool_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of reads directly from disk (innodb_buffer_pool_reads) +buffer_pool_read_requests buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of logical read requests (innodb_buffer_pool_read_requests) +buffer_pool_write_requests buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of write requests (innodb_buffer_pool_write_requests) +buffer_pool_wait_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of times waited for free buffer (innodb_buffer_pool_wait_free) +buffer_pool_read_ahead buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages read as read ahead (innodb_buffer_pool_read_ahead) +buffer_pool_read_ahead_evicted buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Read-ahead pages evicted without being accessed (innodb_buffer_pool_read_ahead_evicted) +buffer_pool_pages_total buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Total buffer pool size in pages (innodb_buffer_pool_pages_total) +buffer_pool_pages_misc buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages for misc use such as row locks or the adaptive hash index (innodb_buffer_pool_pages_misc) +buffer_pool_pages_data buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages containing data (innodb_buffer_pool_pages_data) +buffer_pool_bytes_data buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer bytes containing data (innodb_buffer_pool_bytes_data) +buffer_pool_pages_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages currently dirty (innodb_buffer_pool_pages_dirty) +buffer_pool_bytes_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer bytes currently dirty (innodb_buffer_pool_bytes_dirty) +buffer_pool_pages_free buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Buffer pages currently free (innodb_buffer_pool_pages_free) +buffer_pages_created buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages created (innodb_pages_created) +buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages written (innodb_pages_written) +buffer_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of index pages written (innodb_index_pages_written) +buffer_non_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of non index pages written (innodb_non_index_pages_written) +buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages read (innodb_pages_read) +buffer_pages0_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of page 0 read (innodb_pages0_read) +buffer_index_sec_rec_cluster_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of secondary record reads triggered cluster read +buffer_index_sec_rec_cluster_reads_avoided buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of secondary record reads avoided triggering cluster read +buffer_data_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Amount of data read in bytes (innodb_data_reads) +buffer_data_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Amount of data written in bytes (innodb_data_written) +buffer_flush_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of flush batch +buffer_flush_batch_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times buffer flush list flush is called +buffer_flush_batch_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages scanned per flush batch scan +buffer_flush_batch_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of flush batch +buffer_flush_batches buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of flush batches +buffer_flush_batch_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a flush batch +buffer_flush_neighbor_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total neighbors flushed as part of neighbor flush +buffer_flush_neighbor buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times neighbors flushing is invoked +buffer_flush_neighbor_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a neighbor batch +buffer_flush_n_to_flush_requested buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages requested for flushing. +buffer_flush_n_to_flush_by_age buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages target by LSN Age for flushing. +buffer_flush_adaptive_avg_time_slot buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for adaptive flushing recently per slot. +buffer_LRU_batch_flush_avg_time_slot buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for LRU batch flushing recently per slot. +buffer_flush_adaptive_avg_time_thread buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for adaptive flushing recently per thread. +buffer_LRU_batch_flush_avg_time_thread buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for LRU batch flushing recently per thread. +buffer_flush_adaptive_avg_time_est buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Estimated time (ms) spent for adaptive flushing recently. +buffer_LRU_batch_flush_avg_time_est buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Estimated time (ms) spent for LRU batch flushing recently. +buffer_flush_avg_time buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for flushing recently. +buffer_flush_adaptive_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Numner of adaptive flushes passed during the recent Avg period. +buffer_LRU_batch_flush_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of LRU batch flushes passed during the recent Avg period. +buffer_flush_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of flushes passed during the recent Avg period. +buffer_LRU_get_free_loops buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Total loops in LRU get free. +buffer_LRU_get_free_waits buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Total sleep waits in LRU get free. +buffer_flush_avg_page_rate buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Average number of pages at which flushing is happening +buffer_flush_lsn_avg_rate buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Average redo generation rate +buffer_flush_pct_for_dirty buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Percent of IO capacity used to avoid max dirty page limit +buffer_flush_pct_for_lsn buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Percent of IO capacity used to avoid reusable redo space limit +buffer_flush_sync_waits buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times a wait happens due to sync flushing +buffer_flush_adaptive_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of adaptive flushing +buffer_flush_adaptive buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of adaptive batches +buffer_flush_adaptive_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as an adaptive batch +buffer_flush_sync_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of sync batches +buffer_flush_sync buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of sync batches +buffer_flush_sync_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a sync batch +buffer_flush_background_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of background batches +buffer_flush_background buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of background batches +buffer_flush_background_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as a background batch +buffer_LRU_batch_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of LRU batch +buffer_LRU_batch_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times LRU batch is called +buffer_LRU_batch_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages scanned per LRU batch call +buffer_LRU_batch_flush_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages flushed as part of LRU batches +buffer_LRU_batches_flush buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of LRU batches +buffer_LRU_batch_flush_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as an LRU batch +buffer_LRU_batch_evict_total_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages evicted as part of LRU batches +buffer_LRU_batches_evict buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of LRU batches +buffer_LRU_batch_evict_pages buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Pages queued as an LRU batch +buffer_LRU_single_flush_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of single page LRU flush +buffer_LRU_single_flush_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times single page LRU flush is called +buffer_LRU_single_flush_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Page scanned per single LRU flush +buffer_LRU_single_flush_failure_count Buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times attempt to flush a single page from LRU failed +buffer_LRU_get_free_search Buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of searches performed for a clean page +buffer_LRU_search_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of LRU search +buffer_LRU_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times LRU search is performed +buffer_LRU_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Page scanned per single LRU search +buffer_LRU_unzip_search_scanned buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_owner Total pages scanned as part of LRU unzip search +buffer_LRU_unzip_search_num_scan buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Number of times LRU unzip search is performed +buffer_LRU_unzip_search_scanned_per_call buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled set_member Page scanned per single LRU unzip search +buffer_page_read_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Leaf Pages read +buffer_page_read_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Non-leaf Pages read +buffer_page_read_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Leaf Pages read +buffer_page_read_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Non-Leaf Pages read +buffer_page_read_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Undo Log Pages read +buffer_page_read_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Inode Pages read +buffer_page_read_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Free List Pages read +buffer_page_read_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Bitmap Pages read +buffer_page_read_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of System Pages read +buffer_page_read_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Transaction System Pages read +buffer_page_read_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of File Space Header Pages read +buffer_page_read_xdes buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Extent Descriptor Pages read +buffer_page_read_blob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Uncompressed BLOB Pages read +buffer_page_read_zblob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of First Compressed BLOB Pages read +buffer_page_read_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Subsequent Compressed BLOB Pages read +buffer_page_read_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of other/unknown (old version of InnoDB) Pages read +buffer_page_written_index_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Leaf Pages written +buffer_page_written_index_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Non-leaf Pages written +buffer_page_written_index_ibuf_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Leaf Pages written +buffer_page_written_index_ibuf_non_leaf buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Index Non-Leaf Pages written +buffer_page_written_undo_log buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Undo Log Pages written +buffer_page_written_index_inode buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Index Inode Pages written +buffer_page_written_ibuf_free_list buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Free List Pages written +buffer_page_written_ibuf_bitmap buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Insert Buffer Bitmap Pages written +buffer_page_written_system_page buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of System Pages written +buffer_page_written_trx_system buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Transaction System Pages written +buffer_page_written_fsp_hdr buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of File Space Header Pages written +buffer_page_written_xdes buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Extent Descriptor Pages written +buffer_page_written_blob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Uncompressed BLOB Pages written +buffer_page_written_zblob buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of First Compressed BLOB Pages written +buffer_page_written_zblob2 buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Subsequent Compressed BLOB Pages written +buffer_page_written_other buffer_page_io 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of other/unknown (old version InnoDB) Pages written +os_data_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of reads initiated (innodb_data_reads) +os_data_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of writes initiated (innodb_data_writes) +os_data_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of fsync() calls (innodb_data_fsyncs) +os_pending_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of reads pending +os_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of writes pending +os_log_bytes_written os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Bytes of log written (innodb_os_log_written) +os_log_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of fsync log writes (innodb_os_log_fsyncs) +os_log_pending_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pending fsync write (innodb_os_log_pending_fsyncs) +os_log_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pending log file writes (innodb_os_log_pending_writes) +trx_rw_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of read-write transactions committed +trx_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of read-only transactions committed +trx_nl_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of non-locking auto-commit read-only transactions committed +trx_commits_insert_update transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions committed with inserts and updates +trx_rollbacks transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions rolled back +trx_rollbacks_savepoint transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of transactions rolled back to savepoint +trx_rollback_active transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of resurrected active transactions rolled back +trx_active_transactions transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of active transactions +trx_rseg_history_len transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Length of the TRX_RSEG_HISTORY list +trx_undo_slots_used transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of undo slots used +trx_undo_slots_cached transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of undo slots cached +trx_rseg_current_size transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Current rollback segment size in pages +purge_del_mark_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of delete-marked rows purged +purge_upd_exist_or_extern_records purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of purges on updates of existing records and updates on delete marked record with externally stored field +purge_invoked purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times purge was invoked +purge_undo_log_pages purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of undo log pages handled by the purge +purge_dml_delay_usec purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Microseconds DML to be delayed due to purge lagging +purge_stop_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of times purge was stopped +purge_resume_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of times purge was resumed +log_checkpoints recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of checkpoints +log_lsn_last_flush recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value LSN of Last flush +log_lsn_last_checkpoint recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value LSN at last checkpoint +log_lsn_current recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Current LSN value +log_lsn_checkpoint_age recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Current LSN value minus LSN at last checkpoint +log_lsn_buf_pool_oldest recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value The oldest modified block LSN in the buffer pool +log_max_modified_age_async recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Maximum LSN difference; when exceeded, start asynchronous preflush +log_max_modified_age_sync recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Maximum LSN difference; when exceeded, start synchronous preflush +log_pending_log_flushes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Pending log flushes +log_pending_checkpoint_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Pending checkpoints +log_num_log_io recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of log I/Os +log_waits recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log waits due to small log buffer (innodb_log_waits) +log_write_requests recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log write requests (innodb_log_write_requests) +log_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of log writes (innodb_log_writes) +log_padded recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Bytes of log padded for log write ahead +compress_pages_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages compressed +compress_pages_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages decompressed +compression_pad_increments compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times padding is incremented to avoid compression failures +compression_pad_decrements compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times padding is decremented due to good compressibility +compress_saved compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of bytes saved by page compression +compress_pages_page_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages compressed by page compression +compress_page_compressed_trim_op compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of TRIM operation performed by page compression +compress_pages_page_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages decompressed by page compression +compress_pages_page_compression_error compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of page compression errors +compress_pages_encrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages encrypted +compress_pages_decrypted compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of pages decrypted +index_page_splits index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index page splits +index_page_merge_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index page merge attempts +index_page_merge_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of successful index page merges +index_page_reorg_attempts index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index page reorganization attempts +index_page_reorg_successful index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of successful index page reorganizations +index_page_discards index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index pages discarded +adaptive_hash_searches adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of successful searches using Adaptive Hash Index +adaptive_hash_searches_btree adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of searches using B-tree on an index search +adaptive_hash_pages_added adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index pages on which the Adaptive Hash Index is built +adaptive_hash_pages_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of index pages whose corresponding Adaptive Hash Index entries were removed +adaptive_hash_rows_added adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Adaptive Hash Index rows added +adaptive_hash_rows_removed adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Adaptive Hash Index rows removed +adaptive_hash_rows_deleted_no_hash_entry adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of rows deleted that did not have corresponding Adaptive Hash Index entries +adaptive_hash_rows_updated adaptive_hash_index 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of Adaptive Hash Index rows updated +file_num_open_files file_system 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value Number of files currently open (innodb_num_open_files) +ibuf_merges_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of inserted records merged by change buffering +ibuf_merges_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of deleted records merged by change buffering +ibuf_merges_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of purge records merged by change buffering +ibuf_merges_discard_insert change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of insert merged operations discarded +ibuf_merges_discard_delete_mark change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of deleted merged operations discarded +ibuf_merges_discard_delete change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of purge merged operations discarded +ibuf_merges change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of change buffer merges +ibuf_size change_buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Change buffer size in pages +innodb_master_thread_sleeps server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times (seconds) master thread sleeps +innodb_activity_count server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Current server activity count +innodb_master_active_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times master thread performs its tasks when server is active +innodb_master_idle_loops server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of times master thread performs its tasks when server is idle +innodb_background_drop_table_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to process drop table list +innodb_ibuf_merge_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to process change buffer merge +innodb_log_flush_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to flush log records +innodb_mem_validate_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to do memory validation +innodb_master_purge_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent by master thread to purge records +innodb_dict_lru_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent to process DICT LRU list +innodb_dict_lru_count_active server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of tables evicted from DICT LRU list in the active loop +innodb_dict_lru_count_idle server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of tables evicted from DICT LRU list in the idle loop +innodb_checkpoint_usec server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Time (in microseconds) spent by master thread to do checkpoint +innodb_dblwr_writes server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of doublewrite operations that have been performed (innodb_dblwr_writes) +innodb_dblwr_pages_written server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages that have been written for doublewrite operations (innodb_dblwr_pages_written) +innodb_page_size server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled value InnoDB page size in bytes (innodb_page_size) +innodb_rwlock_s_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin waits due to shared latch request +innodb_rwlock_x_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin waits due to exclusive latch request +innodb_rwlock_sx_spin_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin waits due to sx latch request +innodb_rwlock_s_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin loop rounds due to shared latch request +innodb_rwlock_x_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin loop rounds due to exclusive latch request +innodb_rwlock_sx_spin_rounds server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rwlock spin loop rounds due to sx latch request +innodb_rwlock_s_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of OS waits due to shared latch request +innodb_rwlock_x_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of OS waits due to exclusive latch request +innodb_rwlock_sx_os_waits server 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of OS waits due to sx latch request +dml_reads dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows read +dml_inserts dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows inserted +dml_deletes dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows deleted +dml_updates dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of rows updated +dml_system_reads dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows read +dml_system_inserts dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows inserted +dml_system_deletes dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows deleted +dml_system_updates dml 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of system rows updated +ddl_background_drop_indexes ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of indexes waiting to be dropped after failed index creation +ddl_background_drop_tables ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of tables in background drop table list +ddl_online_create_index ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of indexes being created online +ddl_pending_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of ALTER TABLE, CREATE INDEX, DROP INDEX in progress +ddl_sort_file_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of sort files created during alter table +ddl_log_file_alter_table ddl 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of log files created during alter table +icp_attempts icp 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of attempts for index push-down condition checks +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 +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD; +value +a +about +an +are +as +at +be +by +com +de +en +for +from +how +i +in +is +it +la +of +on +or +that +the +this +to +was +what +when +where +who +will +with +und +the +www +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; +DOC_ID +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; +DOC_ID +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; +WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; +KEY VALUE +SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS; +POOL_ID POOL_SIZE FREE_BUFFERS DATABASE_PAGES OLD_DATABASE_PAGES MODIFIED_DATABASE_PAGES PENDING_DECOMPRESS PENDING_READS PENDING_FLUSH_LRU PENDING_FLUSH_LIST PAGES_MADE_YOUNG PAGES_NOT_MADE_YOUNG PAGES_MADE_YOUNG_RATE PAGES_MADE_NOT_YOUNG_RATE NUMBER_PAGES_READ NUMBER_PAGES_CREATED NUMBER_PAGES_WRITTEN PAGES_READ_RATE PAGES_CREATE_RATE PAGES_WRITTEN_RATE NUMBER_PAGES_GET HIT_RATE YOUNG_MAKE_PER_THOUSAND_GETS NOT_YOUNG_MAKE_PER_THOUSAND_GETS NUMBER_PAGES_READ_AHEAD NUMBER_READ_AHEAD_EVICTED READ_AHEAD_RATE READ_AHEAD_EVICTED_RATE LRU_IO_TOTAL LRU_IO_CURRENT UNCOMPRESS_TOTAL UNCOMPRESS_CURRENT +SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE; +POOL_ID BLOCK_ID SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE PAGE_STATE IO_FIX IS_OLD FREE_PAGE_CLOCK +SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU; +POOL_ID LRU_POSITION SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE COMPRESSED IO_FIX IS_OLD FREE_PAGE_CLOCK +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES; +TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS; +TABLE_ID NAME STATS_INITIALIZED NUM_ROWS CLUST_INDEX_SIZE OTHER_INDEX_SIZE MODIFIED_COUNTER AUTOINC REF_COUNT +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES; +INDEX_ID NAME TABLE_ID TYPE N_FIELDS PAGE_NO SPACE MERGE_THRESHOLD +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS; +TABLE_ID NAME POS MTYPE PRTYPE LEN +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS; +INDEX_ID NAME POS +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; +ID FOR_NAME REF_NAME N_COLS TYPE +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; +ID FOR_COL_NAME REF_COL_NAME POS +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES; +SPACE NAME FLAG ROW_FORMAT PAGE_SIZE ZIP_PAGE_SIZE SPACE_TYPE FS_BLOCK_SIZE FILE_SIZE ALLOCATED_SIZE +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_DATAFILES; +SPACE PATH diff --git a/storage/rocksdb/mysql-test/rocksdb/t/innodb_i_s_tables_disabled-master.opt b/storage/rocksdb/mysql-test/rocksdb/t/innodb_i_s_tables_disabled-master.opt new file mode 100644 index 00000000000..b3565b5fa82 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/innodb_i_s_tables_disabled-master.opt @@ -0,0 +1,30 @@ +--loose-enable-innodb_trx +--loose-enable-innodb_file_status +--loose-enable-innodb_locks +--loose-enable-innodb_lock_waits +--loose-enable-innodb_cmp +--loose-enable-innodb_cmp_reset +--loose-enable-innodb_cmp_per_index +--loose-enable-innodb_cmp_per_index_reset +--loose-enable-innodb_cmpmem +--loose-enable-innodb_cmpmem_reset +--loose-enable-innodb_metrics +--loose-enable-innodb_ft_default_stopword +--loose-enable-innodb_ft_deleted +--loose-enable-innodb_ft_being_deleted +--loose-enable-innodb_ft_index_cache +--loose-enable-innodb_ft_index_table +--loose-enable-innodb_ft_config +--loose-enable-innodb_buffer_pool_stats +--loose-enable-innodb_buffer_page +--loose-enable-innodb_buffer_page_lru +--loose-enable-innodb_sys_tables +--loose-enable-innodb_sys_tablestats +--loose-enable-innodb_sys_indexes +--loose-enable-innodb_sys_columns +--loose-enable-innodb_sys_fields +--loose-enable-innodb_sys_foreign +--loose-enable-innodb_sys_foreign_cols +--loose-enable-innodb_sys_tablespaces +--loose-enable-innodb_sys_datafiles +--loose-enable-innodb_sys_docstore_fields diff --git a/storage/rocksdb/mysql-test/rocksdb/t/innodb_i_s_tables_disabled.test b/storage/rocksdb/mysql-test/rocksdb/t/innodb_i_s_tables_disabled.test new file mode 100644 index 00000000000..4ff48e13089 --- /dev/null +++ b/storage/rocksdb/mysql-test/rocksdb/t/innodb_i_s_tables_disabled.test @@ -0,0 +1,43 @@ +--source include/have_rocksdb.inc + +# Make sure that the InnoDb information schema tables are disabled when InnoDB +# is turned off and attempting to access them doesn't crash. + +# Disable warnings, as the table names in warnings appear in lower or uppercase +# depending on platform + +--disable_warnings + +SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX; +#Not in MariaDB: SELECT * FROM INFORMATION_SCHEMA.INNODB_FILE_STATUS; + +SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS; +SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS; +SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP; +SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_RESET; +SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX; +SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX_RESET; +SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM; +SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM_RESET; +SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS; +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD; +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; +SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; +SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS; +SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE; +SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES; +SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_DATAFILES; +#Not in MariaDB: SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_DOCSTORE_FIELDS; + +--enable_warnings diff --git a/storage/tokudb/.clang-format b/storage/tokudb/.clang-format new file mode 100644 index 00000000000..2ccc4b3fb24 --- /dev/null +++ b/storage/tokudb/.clang-format @@ -0,0 +1,40 @@ +# .clang-format file for Percona TokuDB +# Minimum required version of clang-format is 5.0.1. Earlier versions will work +# but may need removal of some parameters. +Language: Cpp +BasedOnStyle: Google + +# The following parameters are default for Google style, +# but as they are important for our project they +# are set explicitly here +AlignAfterOpenBracket: Align +BreakBeforeBinaryOperators: None +ColumnLimit: 80 +PointerAlignment: Left +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +UseTab: Never + +# Non-default parameters +NamespaceIndentation: All +IndentWidth: 4 +TabWidth: 4 +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +BinPackParameters: false +BinPackArguments: false +ExperimentalAutoDetectBinPacking: false +AllowAllParametersOfDeclarationOnNextLine: false +# not supported in 5.0.1 +#AlignConsecutiveAssignments: yes +#AlignConsecutiveDeclarations: yes +BreakStringLiterals: false +ReflowComments: true diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index b8f6a732585..ae816eb60a0 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -3368,15 +3368,17 @@ void ha_tokudb::start_bulk_insert(ha_rows rows) { int ha_tokudb::bulk_insert_poll(void* extra, float progress) { LOADER_CONTEXT context = (LOADER_CONTEXT)extra; if (thd_killed(context->thd)) { - sprintf(context->write_status_msg, - "The process has been killed, aborting bulk load."); + snprintf(context->write_status_msg, + sizeof(context->write_status_msg), + "The process has been killed, aborting bulk load."); return ER_ABORTING_CONNECTION; } float percentage = progress * 100; - sprintf(context->write_status_msg, - "Loading of data t %s about %.1f%% done", - context->ha->share->full_table_name(), - percentage); + snprintf(context->write_status_msg, + sizeof(context->write_status_msg), + "Loading of data t %s about %.1f%% done", + context->ha->share->full_table_name(), + percentage); thd_proc_info(context->thd, context->write_status_msg); #ifdef HA_TOKUDB_HAS_THD_PROGRESS thd_progress_report(context->thd, (unsigned long long)percentage, 100); @@ -8536,15 +8538,17 @@ cleanup: int ha_tokudb::tokudb_add_index_poll(void* extra, float progress) { LOADER_CONTEXT context = (LOADER_CONTEXT)extra; if (thd_killed(context->thd)) { - sprintf(context->write_status_msg, - "The process has been killed, aborting add index."); + snprintf(context->write_status_msg, + sizeof(context->write_status_msg), + "The process has been killed, aborting add index."); return ER_ABORTING_CONNECTION; } float percentage = progress * 100; - sprintf(context->write_status_msg, - "Adding of indexes to %s about %.1f%% done", - context->ha->share->full_table_name(), - percentage); + snprintf(context->write_status_msg, + sizeof(context->write_status_msg), + "Adding of indexes to %s about %.1f%% done", + context->ha->share->full_table_name(), + percentage); thd_proc_info(context->thd, context->write_status_msg); #ifdef HA_TOKUDB_HAS_THD_PROGRESS thd_progress_report(context->thd, (unsigned long long)percentage, 100); diff --git a/storage/tokudb/ha_tokudb.h b/storage/tokudb/ha_tokudb.h index 75fabbf8849..5d8137274a7 100644 --- a/storage/tokudb/ha_tokudb.h +++ b/storage/tokudb/ha_tokudb.h @@ -41,7 +41,7 @@ class ha_tokudb; typedef struct loader_context { THD* thd; - char write_status_msg[200]; + char write_status_msg[1024]; ha_tokudb* ha; } *LOADER_CONTEXT; diff --git a/storage/tokudb/ha_tokudb_mrr_mysql.cc b/storage/tokudb/ha_tokudb_mrr_mysql.cc index 84b64009ef2..480ae23802b 100644 --- a/storage/tokudb/ha_tokudb_mrr_mysql.cc +++ b/storage/tokudb/ha_tokudb_mrr_mysql.cc @@ -31,6 +31,7 @@ int ha_tokudb::multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint mode, HANDLER_BUFFER *buf) { + ds_mrr.init(this, table); return ds_mrr.dsmrr_init(this, seq, seq_init_param, n_ranges, mode, buf); } diff --git a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_mixed_dml.result b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_mixed_dml.result index 65057791b48..5f41fd328c9 100644 --- a/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_mixed_dml.result +++ b/storage/tokudb/mysql-test/rpl/r/rpl_tokudb_mixed_dml.result @@ -682,6 +682,8 @@ DROP TRIGGER tr1; GRANT EVENT ON *.* TO 'root'@'localhost'; INSERT INTO t1 VALUES(1, 'test1'); CREATE EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1; +Warnings: +Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it. SHOW EVENTS; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation test_rpl e1 root@localhost SYSTEM RECURRING NULL 1 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/PS-5158.result b/storage/tokudb/mysql-test/tokudb_bugs/r/PS-5158.result new file mode 100644 index 00000000000..3dfbb95aed9 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/r/PS-5158.result @@ -0,0 +1,6 @@ +CREATE DATABASE `new..............................................end`; +USE `new..............................................end`; +CREATE TABLE t1(a INT KEY,b INT)ENGINE=TokuDB; +INSERT INTO t1 VALUES(1,11),(2,12),(3,13),(4,14),(5,15); +USE test; +DROP DATABASE `new..............................................end`; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/PS-5163.result b/storage/tokudb/mysql-test/tokudb_bugs/r/PS-5163.result new file mode 100644 index 00000000000..27e19150945 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/r/PS-5163.result @@ -0,0 +1,5 @@ +CREATE TABLE t1(c1 INT default 0,c2 INT,c3 CHAR(10),c4 CHAR(10),c5 CHAR(10),PRIMARY KEY(c1),INDEX(c3,c4(1),c5(1)),INDEX(c2)) ENGINE=TokuDB; +INSERT INTO t1 VALUES(),(),(),(),(); +ERROR 23000: Duplicate entry '0' for key 'PRIMARY' +UPDATE t1 SET c1=1 WHERE c1=1 OR c2=1; +DROP TABLE t1; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/PS-5158-master.opt b/storage/tokudb/mysql-test/tokudb_bugs/t/PS-5158-master.opt new file mode 100644 index 00000000000..eb850c4bd78 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/PS-5158-master.opt @@ -0,0 +1,2 @@ +--loose-tokudb_dir_per_db=ON + diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/PS-5158.test b/storage/tokudb/mysql-test/tokudb_bugs/t/PS-5158.test new file mode 100644 index 00000000000..e0235e7cebd --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/PS-5158.test @@ -0,0 +1,27 @@ +# Test for PS-5163 : [PS8QA] handle_fatal_signal (sig=11) in DsMrr_impl::dsmrr_init +# and PS-4828 : Inserting data into TokuDB database with name that contains non-alphanumerical characters can lead to the ZN9ha_tokudb16bulk_insert_pollEPvf assertion +# +# The cause is a buffer overrun in LOADER_CONTEXT where the char buffer used for +# maintaining the proc info string was too small and no validation or prevention +# was being done to ensure the string stayed within the limits of the buffer. +# Normally this would have been difficult to hit, but, now with the combination +# of tokudb_dir_per_db=ON and the expansion of the database name from latin1 +# (or whatever) to the fscs encoding the space required for a max length +# db.table name could be quite larger than the buffer was originally sized. + +--source include/have_tokudb.inc + +if (`SELECT @@tokudb_dir_per_db != 1`) { + skip Requires tokudb_dir_per_db=1; +} + +CREATE DATABASE `new..............................................end`; +USE `new..............................................end`; +CREATE TABLE t1(a INT KEY,b INT)ENGINE=TokuDB; + +# +# TokuDB bulk_insert_poll would crash here +# +INSERT INTO t1 VALUES(1,11),(2,12),(3,13),(4,14),(5,15); +USE test; +DROP DATABASE `new..............................................end`; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/PS-5163.test b/storage/tokudb/mysql-test/tokudb_bugs/t/PS-5163.test new file mode 100644 index 00000000000..d370bab6517 --- /dev/null +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/PS-5163.test @@ -0,0 +1,11 @@ +--source include/have_tokudb.inc + +CREATE TABLE t1(c1 INT default 0,c2 INT,c3 CHAR(10),c4 CHAR(10),c5 CHAR(10),PRIMARY KEY(c1),INDEX(c3,c4(1),c5(1)),INDEX(c2)) ENGINE=TokuDB; +--error ER_DUP_ENTRY +INSERT INTO t1 VALUES(),(),(),(),(); + +# 8.0 asserts here down in data dictionary because ha_tokudb::ds_mrr did not +# properly call ds_mrr.init(this, table) +UPDATE t1 SET c1=1 WHERE c1=1 OR c2=1; + +DROP TABLE t1; diff --git a/support-files/rpm/server-postin.sh b/support-files/rpm/server-postin.sh index 08b046dc272..0a5bac73f0b 100644 --- a/support-files/rpm/server-postin.sh +++ b/support-files/rpm/server-postin.sh @@ -17,9 +17,7 @@ fi if [ $1 = 1 ] ; then if [ -x /usr/bin/systemctl ] ; then /usr/bin/systemctl daemon-reload >/dev/null 2>&1 - fi - - if [ -x /sbin/chkconfig ] ; then + elif [ -x /sbin/chkconfig ] ; then /sbin/chkconfig --add mysql fi @@ -56,7 +54,7 @@ if [ $1 = 1 ] ; then if [ ! -e $datadir/mysql ]; then # Create data directory - mkdir -p $datadir/{mysql,test} + mkdir -p $datadir # Initiate databases %{_bindir}/mysql_install_db --rpm --user=%{mysqld_user} diff --git a/support-files/rpm/server-posttrans.sh b/support-files/rpm/server-posttrans.sh index 0d242596185..1406c78a5f5 100644 --- a/support-files/rpm/server-posttrans.sh +++ b/support-files/rpm/server-posttrans.sh @@ -2,10 +2,9 @@ if [ -r %{restart_flag} ] ; then rm %{restart_flag} if [ -x /usr/bin/systemctl ] ; then /usr/bin/systemctl daemon-reload > /dev/null 2>&1 - fi - - # only restart the server if it was alredy running - if %{_sysconfdir}/init.d/mysql status > /dev/null 2>&1; then + /usr/bin/systemctl try-restart mariadb.service > /dev/null 2>&1 + elif %{_sysconfdir}/init.d/mysql status > /dev/null 2>&1; then + # only restart the server if it was alredy running %{_sysconfdir}/init.d/mysql restart fi fi diff --git a/support-files/rpm/server-preun.sh b/support-files/rpm/server-preun.sh index 7ef48f1c8d4..1d733a7d899 100644 --- a/support-files/rpm/server-preun.sh +++ b/support-files/rpm/server-preun.sh @@ -1,12 +1,16 @@ if [ $1 = 0 ] ; then - # Stop MySQL before uninstalling it - if [ -x %{_sysconfdir}/init.d/mysql ] ; then - %{_sysconfdir}/init.d/mysql stop > /dev/null - fi + # Stop MySQL before uninstalling it # Don't start it automatically anymore - if [ -x /sbin/chkconfig ] ; then - /sbin/chkconfig --del mysql - fi + if [ -x /usr/bin/systemctl ] ; then + /usr/bin/systemctl stop mariadb.service > /dev/null 2>&1 + /usr/bin/systemctl disable mariadb.service > /dev/null 2>&1 + fi + if [ -x %{_sysconfdir}/init.d/mysql ] ; then + %{_sysconfdir}/init.d/mysql stop > /dev/null + fi + if [ -x /sbin/chkconfig ] ; then + /sbin/chkconfig --del mysql > /dev/null 2>&1 + fi fi # We do not remove the mysql user since it may still own a lot of |