From ceba41c0951d1d8c9b4961772b4a088769814a66 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 24 Jan 2016 17:41:11 +0100 Subject: MDEV-9299 Test main.events_2 incompatible with Debian reproducibility testing framework Debian tests are run in 2017, update the test to use 2027 as a "future". --- mysql-test/r/events_2.result | 4 ++-- mysql-test/t/events_2.test | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/events_2.result b/mysql-test/r/events_2.result index 66ec00d7357..17eee91f918 100644 --- a/mysql-test/r/events_2.result +++ b/mysql-test/r/events_2.result @@ -1,10 +1,10 @@ drop database if exists events_test; create database events_test; use events_test; -create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5; +create event e_26 on schedule at '2027-01-01 00:00:00' disable do set @a = 5; 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 2017-01-01 00:00:00 DROP +events_test e_26 set @a = 5 root@localhost 2027-01-01 00:00:00 DROP drop event e_26; create event e_26 on schedule at NULL disable do set @a = 5; ERROR HY000: Incorrect AT value: 'NULL' diff --git a/mysql-test/t/events_2.test b/mysql-test/t/events_2.test index 3d609654b21..48949d5630b 100644 --- a/mysql-test/t/events_2.test +++ b/mysql-test/t/events_2.test @@ -13,7 +13,7 @@ use events_test; # mysql.event intact checking end # -create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5; +create event e_26 on schedule at '2027-01-01 00:00:00' disable do set @a = 5; select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event; drop event e_26; --error ER_WRONG_VALUE -- cgit v1.2.1 From 01897db10203312ccd20f2b76ba957825ccef613 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Wed, 24 Feb 2016 17:40:12 -0500 Subject: Skip galera_sync_wait_show.test on non-debug builds. The test uses a debug feature SHOW PROCEDURE|FUNCTION CODE. --- mysql-test/suite/galera/t/galera_sync_wait_show.test | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/galera/t/galera_sync_wait_show.test b/mysql-test/suite/galera/t/galera_sync_wait_show.test index 0d0207a2ebe..250b1f76e98 100644 --- a/mysql-test/suite/galera/t/galera_sync_wait_show.test +++ b/mysql-test/suite/galera/t/galera_sync_wait_show.test @@ -4,6 +4,7 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_debug.inc --connection node_2 SET SESSION wsrep_sync_wait = 1; -- cgit v1.2.1 From e7d50efc458b95d5fad92f6020758d7c63b0dc0b Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 26 Feb 2016 00:25:55 +0200 Subject: MDEV-7907 tokudb.cluster_filter_unpack_varchar_hidden fails sporadically in buildbot Index access becomes range every once in a while. Masked the value in addition to other already masked columns --- .../mysql-test/tokudb/r/cluster_filter_unpack_varchar_hidden.result | 4 ++-- .../mysql-test/tokudb/t/cluster_filter_unpack_varchar_hidden.test | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/tokudb/mysql-test/tokudb/r/cluster_filter_unpack_varchar_hidden.result b/storage/tokudb/mysql-test/tokudb/r/cluster_filter_unpack_varchar_hidden.result index 640c7badc71..6269b8f2d71 100644 --- a/storage/tokudb/mysql-test/tokudb/r/cluster_filter_unpack_varchar_hidden.result +++ b/storage/tokudb/mysql-test/tokudb/r/cluster_filter_unpack_varchar_hidden.result @@ -182,14 +182,14 @@ a b c d e f 3 30 200 2000 20000 200000 explain select * from t1 where b > "0"; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index b b NULL NULL NULL; Using where; Using index +1 SIMPLE t1 b b NULL NULL NULL; Using where; Using index select * from t1 where b > "0"; a b c d e f 2 20 100 1000 10000 100000 3 30 200 2000 20000 200000 explain select * from t1 where d > "0"; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index d d NULL NULL NULL; Using where; Using index +1 SIMPLE t1 d d NULL NULL NULL; Using where; Using index select * from t1 where d > "0"; a b c d e f 2 20 100 1000 10000 100000 diff --git a/storage/tokudb/mysql-test/tokudb/t/cluster_filter_unpack_varchar_hidden.test b/storage/tokudb/mysql-test/tokudb/t/cluster_filter_unpack_varchar_hidden.test index d1be871c7d2..e9bb18a586e 100644 --- a/storage/tokudb/mysql-test/tokudb/t/cluster_filter_unpack_varchar_hidden.test +++ b/storage/tokudb/mysql-test/tokudb/t/cluster_filter_unpack_varchar_hidden.test @@ -82,11 +82,11 @@ alter table t1 add key d(d,a) clustering=yes, add key b(b) clustering=yes; explain select * from t1; select * from t1; ---replace_column 7 NULL 9 NULL; +--replace_column 4 7 NULL 9 NULL; explain select * from t1 where b > "0"; select * from t1 where b > "0"; ---replace_column 7 NULL 9 NULL; +--replace_column 4 7 NULL 9 NULL; explain select * from t1 where d > "0"; select * from t1 where d > "0"; -- cgit v1.2.1 From c29e450e372239be08e0a30b28fc96c4ca2952e3 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 26 Feb 2016 03:02:07 +0200 Subject: MDEV-4070 sys_vars.secure_file_priv fails sporadically if it's executed with --mem The test created a file in location relative to the datadir (a few levels above datadir). The file was created by MariaDB server (via INTO OUTFILE), and later removed by mysqltest (via remove_file). The problem is that when the vardir is a symlink, MariaDB server and mysqltest can resolve such paths differently. MariaDB server would return back to where the symlink is located, while mysqltest would go above the real directory. For example, if the test is run with --mem, and /bld/5.5/mysql-test/var points at /dev/shm/var_auto_X, then SELECT INTO OUTFILE created a file in /bld/5.5/mysql-test , but remove_file would look for it in /dev/shm/. The test is re-written so that all paths are resolved in perl, the logic itself hasn't changed. --- mysql-test/suite/sys_vars/t/secure_file_priv.test | 40 ++++++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/mysql-test/suite/sys_vars/t/secure_file_priv.test b/mysql-test/suite/sys_vars/t/secure_file_priv.test index 3e2a4fa467a..5c53da58275 100644 --- a/mysql-test/suite/sys_vars/t/secure_file_priv.test +++ b/mysql-test/suite/sys_vars/t/secure_file_priv.test @@ -5,17 +5,39 @@ CREATE TABLE t1 (c1 VARCHAR(50)); INSERT INTO t1 VALUES ("one"),("two"),("three"),("four"),("five"); SHOW VARIABLES LIKE 'secure_file_priv'; --disable_query_log + # Atempt to create a file where we normally aren't allowed to create one. +# # Doing this in a portable manner is difficult but we should be able to -# count on the depth of the directory hierarchy used. Three steps up from -# the datadir is the 'mysql_test' directory. ---let $PROTECTED_FILE=`SELECT concat(@@datadir,'/../../../bug50373.txt')` ---eval SELECT * FROM t1 INTO OUTFILE '$PROTECTED_FILE'; -DELETE FROM t1; ---eval LOAD DATA INFILE '$PROTECTED_FILE' INTO TABLE t1; -SELECT * FROM t1; ---eval SELECT load_file('$PROTECTED_FILE') AS loaded_file; +# count on the directory hierarchy used. A step up from MYSQLTEST_VARDIR +# should definitely lead us to a "protected" directory, +# but at the same time should still be writable since MTR was able +# to create the vardir itself there. +# If we run tests normally, it will be mysql-test directory. +# If we run tests with --mem, it will be /dev/shm. +# If we run tests with --parallel, it will be mysql-test/var +# (because MYSQLTEST_VARDIR in this case is mysql-test/var/N). + +--perl +use File::Basename; +my $protected_file= dirname($ENV{MYSQLTEST_VARDIR}).'/bug50373.txt'; +open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/bug50373.inc") or die; +print FILE "SELECT * FROM t1 INTO OUTFILE '".$protected_file."';\n"; +print FILE "DELETE FROM t1;\n"; +print FILE "LOAD DATA INFILE '".$protected_file."' INTO TABLE t1;\n"; +print FILE "SELECT * FROM t1;\n"; +print FILE "SELECT load_file('",$protected_file,"') AS loaded_file;\n"; +close(FILE); +EOF + +--source $MYSQL_TMP_DIR/bug50373.inc +--remove_file $MYSQL_TMP_DIR/bug50373.inc --enable_query_log -remove_file $PROTECTED_FILE; + DROP TABLE t1; +--perl +use File::Basename; +unlink dirname($ENV{MYSQLTEST_VARDIR}).'/bug50373.txt'; +EOF + -- cgit v1.2.1 From 66832b619510f5b9724d8db1eac48bdafb9225e9 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Fri, 26 Feb 2016 10:49:19 -0500 Subject: MDEV-9598: Donor's rsync SST script hangs if FTWRL fails During SST, since wsrep_sst_rsync waits for mysqld to create "tables_flushed" file after it has successfully executed FTWRL, it would wait forever if FTWRL fails. Fixed by introducing a mechanism to report failure to the script. --- scripts/wsrep_sst_rsync.sh | 17 +++++- sql/wsrep_sst.cc | 128 +++++++++++++++++++++++++++++++-------------- 2 files changed, 104 insertions(+), 41 deletions(-) diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index a93ab940593..7e895aa4eb2 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -127,7 +127,10 @@ then then FLUSHED="$WSREP_SST_OPT_DATA/tables_flushed" + ERROR="$WSREP_SST_OPT_DATA/sst_error" + rm -rf "$FLUSHED" + rm -rf "$ERROR" # Use deltaxfer only for WAN inv=$(basename $0) @@ -137,10 +140,20 @@ then echo "flush tables" # Wait for : - # (a) tables to be flushed, and - # (b) state ID & wsrep_gtid_domain_id to be written to the file. + # (a) Tables to be flushed, AND + # (b) Cluster state ID & wsrep_gtid_domain_id to be written to the file, OR + # (c) ERROR file, in case flush tables operation failed. + while [ ! -r "$FLUSHED" ] && ! grep -q ':' "$FLUSHED" >/dev/null 2>&1 do + # Check whether ERROR file exists. + if [ -f "$ERROR" ] + then + # Flush tables operation failed. + rm -rf "$ERROR" + exit 255 + fi + sleep 0.2 done diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index c75f2c116ec..43528e642eb 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -896,6 +896,56 @@ static int sst_donate_mysqldump (const char* addr, wsrep_seqno_t wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; + +/* + Create a file under data directory. +*/ +static int sst_create_file(const char *name, const char *content) +{ + int err= 0; + char *real_name; + char *tmp_name; + ssize_t len; + FILE *file; + + len= strlen(mysql_real_data_home) + strlen(name) + 2; + real_name= (char *) alloca(len); + + snprintf(real_name, (size_t) len, "%s/%s", mysql_real_data_home, name); + + tmp_name= (char *) alloca(len + 4); + snprintf(tmp_name, (size_t) len + 4, "%s.tmp", real_name); + + file= fopen(tmp_name, "w+"); + + if (0 == file) + { + err= errno; + WSREP_ERROR("Failed to open '%s': %d (%s)", tmp_name, err, strerror(err)); + } + else + { + // Write the specified content into the file. + if (content != NULL) + { + fprintf(file, "%s\n", content); + fsync(fileno(file)); + } + + fclose(file); + + if (rename(tmp_name, real_name) == -1) + { + err= errno; + WSREP_ERROR("Failed to rename '%s' to '%s': %d (%s)", tmp_name, + real_name, err, strerror(err)); + } + } + + return err; +} + + static int run_sql_command(THD *thd, const char *query) { thd->set_query((char *)query, strlen(query)); @@ -911,7 +961,7 @@ static int run_sql_command(THD *thd, const char *query) if (thd->is_error()) { int const err= thd->get_stmt_da()->sql_errno(); - WSREP_WARN ("error executing '%s': %d (%s)%s", + WSREP_WARN ("Error executing '%s': %d (%s)%s", query, err, thd->get_stmt_da()->message(), err == ER_UNKNOWN_SYSTEM_VARIABLE ? ". Was mysqld built with --with-innodb-disallow-writes ?" : ""); @@ -921,15 +971,21 @@ static int run_sql_command(THD *thd, const char *query) return 0; } + static int sst_flush_tables(THD* thd) { WSREP_INFO("Flushing tables for SST..."); int err; int not_used; - CHARSET_INFO *current_charset; + /* + Files created to notify the SST script about the outcome of table flush + operation. + */ + const char *flush_success= "tables_flushed"; + const char *flush_error= "sst_error"; - current_charset = thd->variables.character_set_client; + CHARSET_INFO *current_charset= thd->variables.character_set_client; if (!is_supported_parser_charset(current_charset)) { @@ -942,61 +998,55 @@ static int sst_flush_tables(THD* thd) if (run_sql_command(thd, "FLUSH TABLES WITH READ LOCK")) { - WSREP_ERROR("Failed to flush and lock tables"); - err = -1; + err= -1; } else { - /* make sure logs are flushed after global read lock acquired */ - err= reload_acl_and_cache(thd, REFRESH_ENGINE_LOG | REFRESH_BINARY_LOG, - (TABLE_LIST*) 0, ¬_used); + /* + Make sure logs are flushed after global read lock acquired. In case + reload fails, we must also release the acquired FTWRL. + */ + if (reload_acl_and_cache(thd, REFRESH_ENGINE_LOG | REFRESH_BINARY_LOG, + (TABLE_LIST*) 0, ¬_used)) + { + thd->global_read_lock.unlock_global_read_lock(thd); + err= -1; + } } thd->variables.character_set_client = current_charset; - if (err) { - WSREP_ERROR("Failed to flush tables: %d (%s)", err, strerror(err)); + WSREP_ERROR("Failed to flush and lock tables"); + + /* + The SST must be aborted as the flush tables failed. Notify this to SST + script by creating the error file. + */ + int tmp; + if ((tmp= sst_create_file(flush_error, NULL))) { + err= tmp; + } } else { WSREP_INFO("Tables flushed."); - const char base_name[]= "tables_flushed"; - - ssize_t const full_len= strlen(mysql_real_data_home) + strlen(base_name)+2; - char *real_name= (char *) alloca(full_len); - snprintf(real_name, (size_t) full_len, "%s/%s", mysql_real_data_home, - base_name); - char *tmp_name= (char *) alloca(full_len + 4); - snprintf(tmp_name, (size_t) full_len + 4, "%s.tmp", real_name); - FILE* file= fopen(tmp_name, "w+"); - if (0 == file) - { - err= errno; - WSREP_ERROR("Failed to open '%s': %d (%s)", tmp_name, err,strerror(err)); - } - else - { - // Write cluster state ID and wsrep_gtid_domain_id. - fprintf(file, "%s:%lld %d\n", - wsrep_cluster_state_uuid, (long long)wsrep_locked_seqno, - wsrep_gtid_domain_id); - fsync(fileno(file)); - fclose(file); - if (rename(tmp_name, real_name) == -1) - { - err= errno; - WSREP_ERROR("Failed to rename '%s' to '%s': %d (%s)", - tmp_name, real_name, err,strerror(err)); - } - } + /* + Tables have been flushed. Create a file with cluster state ID and + wsrep_gtid_domain_id. + */ + char content[100]; + snprintf(content, sizeof(content), "%s:%lld %d\n", wsrep_cluster_state_uuid, + (long long)wsrep_locked_seqno, wsrep_gtid_domain_id); + err= sst_create_file(flush_success, content); } return err; } + static void sst_disallow_writes (THD* thd, bool yes) { char query_str[64] = { 0, }; -- cgit v1.2.1 From 802843eda080c95180f194e1d137ba180cf6ca61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Kek=C3=A4l=C3=A4inen?= Date: Mon, 29 Feb 2016 23:02:53 +0200 Subject: MDEV-9643: Don't emit any "deb-systemd-helper not found" warnings --- debian/dist/Debian/mariadb-server-10.0.postinst | 6 ++++-- debian/dist/Ubuntu/mariadb-server-10.0.postinst | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/debian/dist/Debian/mariadb-server-10.0.postinst b/debian/dist/Debian/mariadb-server-10.0.postinst index 19a69ed00cb..5179fd4944a 100644 --- a/debian/dist/Debian/mariadb-server-10.0.postinst +++ b/debian/dist/Debian/mariadb-server-10.0.postinst @@ -266,8 +266,10 @@ db_stop # in case invoke failes # If we upgrade from MySQL mysql.service may be masked, which also # means init.d script is disabled. Unmask mysql service explicitely. -# Ignore exit code as command is not available everywhere. -deb-systemd-helper unmask mysql.service > /dev/null || true +# Check first that the command exists, to avoid emitting any warning messages. +if [ -x "$(command -v deb-systemd-helper)" ]; then + deb-systemd-helper unmask mysql.service > /dev/null +fi #DEBHELPER# diff --git a/debian/dist/Ubuntu/mariadb-server-10.0.postinst b/debian/dist/Ubuntu/mariadb-server-10.0.postinst index 2486a09a5af..e90ef045e2c 100644 --- a/debian/dist/Ubuntu/mariadb-server-10.0.postinst +++ b/debian/dist/Ubuntu/mariadb-server-10.0.postinst @@ -282,8 +282,10 @@ db_stop # in case invoke failes # If we upgrade from MySQL mysql.service may be masked, which also # means init.d script is disabled. Unmask mysql service explicitely. -# Ignore exit code as command is not available everywhere. -deb-systemd-helper unmask mysql.service > /dev/null || true +# Check first that the command exists, to avoid emitting any warning messages. +if [ -x "$(command -v deb-systemd-helper)" ]; then + deb-systemd-helper unmask mysql.service > /dev/null +fi #DEBHELPER# -- cgit v1.2.1 From 6c414fcf89510215d6d3466eb9992d444eadae89 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Tue, 1 Mar 2016 21:10:59 +0100 Subject: MDEV-5542: GROUP_CONCAT truncate output to 65.536 chars when using DISTINCT or ORDER BY port of mysql fix WL#6098 --- mysql-test/r/func_gconcat.result | 81 ++++++++++++++++++++++++++++++++++++ mysql-test/r/subselect_mat.result | 24 +++++++++++ mysql-test/r/subselect_sj_mat.result | 24 +++++++++++ mysql-test/t/func_gconcat.test | 41 ++++++++++++++++++ sql/field.cc | 33 ++++++++++++--- sql/field_conv.cc | 3 -- sql/item_sum.cc | 67 +++++++++++++++-------------- sql/item_sum.h | 10 ++--- sql/sql_class.h | 4 +- sql/sql_insert.cc | 2 +- sql/sql_select.cc | 60 ++++++-------------------- sql/sql_select.h | 7 ++-- sql/table.h | 57 +++++++++++++++++++++++++ 13 files changed, 312 insertions(+), 101 deletions(-) diff --git a/mysql-test/r/func_gconcat.result b/mysql-test/r/func_gconcat.result index 0bc31a5e85b..9014450bef3 100644 --- a/mysql-test/r/func_gconcat.result +++ b/mysql-test/r/func_gconcat.result @@ -1119,3 +1119,84 @@ GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0) 1,1 2,2 DROP TABLE t1; +# +# WL#6098 Eliminate GROUP_CONCAT intermediate result limitation. +# Bug#13387020 GROUP_CONCAT WITH ORDER BY RESULTS ARE TRUNCATED. +# +SET group_concat_max_len= 9999999; +CREATE TABLE t1 (f1 LONGTEXT , f2 INTEGER); +INSERT INTO t1 VALUES (REPEAT('a', 500000), 0), (REPEAT('b', 500000), 1), (REPEAT('c', 500000), 2); +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +1500002 +SELECT LENGTH(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC)) FROM t1; +LENGTH(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC)) +1500002 +SELECT SUBSTRING(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC), 1, 5) FROM t1; +SUBSTRING(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC), 1, 5) +ccccc +SELECT LENGTH(GROUP_CONCAT(DISTINCT f1)) FROM t1; +LENGTH(GROUP_CONCAT(DISTINCT f1)) +1500002 +SELECT LENGTH(GROUP_CONCAT(UPPER(f1) ORDER BY f2)) FROM t1; +LENGTH(GROUP_CONCAT(UPPER(f1) ORDER BY f2)) +1500002 +SELECT LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1)) FROM t1; +LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1)) +1500002 +SELECT SUBSTRING(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1), 1, 5) FROM t1; +SUBSTRING(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1), 1, 5) +AAAAA +SELECT LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1))) FROM t1; +LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1))) +1500002 +CREATE TABLE t2 SELECT GROUP_CONCAT(f1 order by f2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `GROUP_CONCAT(f1 order by f2)` mediumtext +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +CREATE TABLE t2 SELECT GROUP_CONCAT(UPPER(f1) ORDER BY f2) FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `GROUP_CONCAT(UPPER(f1) ORDER BY f2)` mediumtext +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +SET group_concat_max_len= DEFAULT; +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +1024 +Warnings: +Warning 1260 Row 2 was cut by GROUP_CONCAT() +SET group_concat_max_len= 499999; +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 WHERE f2 = 0; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +499999 +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 GROUP BY f2; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +499999 +499999 +499999 +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() +INSERT INTO t1 VALUES (REPEAT('a', 499999), 3), (REPEAT('b', 500000), 4); +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 GROUP BY f2; +LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) +499999 +499999 +499999 +499999 +499999 +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +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; diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result index b5ec6082d68..c9fa7c0c672 100644 --- a/mysql-test/r/subselect_mat.result +++ b/mysql-test/r/subselect_mat.result @@ -762,6 +762,10 @@ select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_512 @@ -775,6 +779,10 @@ select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() drop table t1_512, t2_512, t3_512; set @blob_len = 1024; set @suffix_len = @blob_len - @prefix_len; @@ -855,6 +863,10 @@ select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_1024 @@ -868,6 +880,10 @@ select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() drop table t1_1024, t2_1024, t3_1024; set @blob_len = 1025; set @suffix_len = @blob_len - @prefix_len; @@ -948,6 +964,10 @@ select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_1025 @@ -961,6 +981,10 @@ select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() drop table t1_1025, t2_1025, t3_1025; create table t1bit (a1 bit(3), a2 bit(3)); create table t2bit (b1 bit(3), b2 bit(3)); diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result index d5e9fc776f8..2f3777a47fd 100644 --- a/mysql-test/r/subselect_sj_mat.result +++ b/mysql-test/r/subselect_sj_mat.result @@ -787,6 +787,10 @@ select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_512 @@ -801,6 +805,10 @@ select left(a1,7), left(a2,7) from t1_512 where a1 in (select group_concat(b1) from t2_512 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() drop table t1_512, t2_512, t3_512; set @blob_len = 1024; set @suffix_len = @blob_len - @prefix_len; @@ -882,6 +890,10 @@ select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_1024 @@ -896,6 +908,10 @@ select left(a1,7), left(a2,7) from t1_1024 where a1 in (select group_concat(b1) from t2_1024 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() drop table t1_1024, t2_1024, t3_1024; set @blob_len = 1025; set @suffix_len = @blob_len - @prefix_len; @@ -977,6 +993,10 @@ select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() set @@group_concat_max_len = 256; explain extended select left(a1,7), left(a2,7) from t1_1025 @@ -991,6 +1011,10 @@ select left(a1,7), left(a2,7) from t1_1025 where a1 in (select group_concat(b1) from t2_1025 group by b2); left(a1,7) left(a2,7) +Warnings: +Warning 1260 Row 1 was cut by GROUP_CONCAT() +Warning 1260 Row 2 was cut by GROUP_CONCAT() +Warning 1260 Row 3 was cut by GROUP_CONCAT() drop table t1_1025, t2_1025, t3_1025; create table t1bit (a1 bit(3), a2 bit(3)); create table t2bit (b1 bit(3), b2 bit(3)); diff --git a/mysql-test/t/func_gconcat.test b/mysql-test/t/func_gconcat.test index 5550eebf1a3..3cc244339d3 100644 --- a/mysql-test/t/func_gconcat.test +++ b/mysql-test/t/func_gconcat.test @@ -832,3 +832,44 @@ PREPARE stmt FROM "SELECT GROUP_CONCAT(t1a.a ORDER BY 1, t1a.a=0) FROM t1 AS t1a EXECUTE stmt; EXECUTE stmt; DROP TABLE t1; + +--echo # +--echo # WL#6098 Eliminate GROUP_CONCAT intermediate result limitation. +--echo # Bug#13387020 GROUP_CONCAT WITH ORDER BY RESULTS ARE TRUNCATED. +--echo # + + +SET group_concat_max_len= 9999999; +CREATE TABLE t1 (f1 LONGTEXT , f2 INTEGER); +INSERT INTO t1 VALUES (REPEAT('a', 500000), 0), (REPEAT('b', 500000), 1), (REPEAT('c', 500000), 2); + +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1; +SELECT LENGTH(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC)) FROM t1; +SELECT SUBSTRING(GROUP_CONCAT(DISTINCT f1 ORDER BY f1 DESC), 1, 5) FROM t1; +SELECT LENGTH(GROUP_CONCAT(DISTINCT f1)) FROM t1; + +SELECT LENGTH(GROUP_CONCAT(UPPER(f1) ORDER BY f2)) FROM t1; +SELECT LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1)) FROM t1; +SELECT SUBSTRING(GROUP_CONCAT(DISTINCT UPPER(f1) ORDER BY f1), 1, 5) FROM t1; +SELECT LENGTH(GROUP_CONCAT(DISTINCT UPPER(f1))) FROM t1; + +CREATE TABLE t2 SELECT GROUP_CONCAT(f1 order by f2) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +CREATE TABLE t2 SELECT GROUP_CONCAT(UPPER(f1) ORDER BY f2) FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; + +SET group_concat_max_len= DEFAULT; +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1; + +SET group_concat_max_len= 499999; +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 WHERE f2 = 0; +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 GROUP BY f2; + +INSERT INTO t1 VALUES (REPEAT('a', 499999), 3), (REPEAT('b', 500000), 4); +SELECT LENGTH(GROUP_CONCAT(f1 ORDER BY f2)) FROM t1 GROUP BY f2; + +DROP TABLE t1; +SET group_concat_max_len= DEFAULT; diff --git a/sql/field.cc b/sql/field.cc index a7984c290de..895f8a00f10 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -7845,7 +7845,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs) ASSERT_COLUMN_MARKED_FOR_WRITE_OR_COMPUTED; uint copy_length, new_length; String_copier copier; - const char *tmp; + char *tmp; char buff[STRING_BUFFER_USUAL_SIZE]; String tmpstr(buff,sizeof(buff), &my_charset_bin); @@ -7855,6 +7855,29 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs) return 0; } + if (table->blob_storage) // GROUP_CONCAT with ORDER BY | DISTINCT + { + DBUG_ASSERT(!f_is_hex_escape(flags)); + DBUG_ASSERT(field_charset == cs); + DBUG_ASSERT(length <= max_data_length()); + + new_length= length; + copy_length= table->in_use->variables.group_concat_max_len; + if (new_length > copy_length) + { + int well_formed_error; + new_length= cs->cset->well_formed_len(cs, from, from + copy_length, + new_length, &well_formed_error); + table->blob_storage->set_truncated_value(true); + } + if (!(tmp= table->blob_storage->store(from, new_length))) + goto oom_error; + + Field_blob::store_length(new_length); + bmove(ptr + packlength, (uchar*) &tmp, sizeof(char*)); + return 0; + } + /* If the 'from' address is in the range of the temporary 'value'- object we need to copy the content to a different location or it will be @@ -7881,15 +7904,14 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs) new_length= MY_MIN(max_data_length(), field_charset->mbmaxlen * length); if (value.alloc(new_length)) goto oom_error; - + tmp= const_cast(value.ptr()); if (f_is_hex_escape(flags)) { copy_length= my_copy_with_hex_escaping(field_charset, - (char*) value.ptr(), new_length, - from, length); + tmp, new_length, + from, length); Field_blob::store_length(copy_length); - tmp= value.ptr(); bmove(ptr + packlength, (uchar*) &tmp, sizeof(char*)); return 0; } @@ -7897,7 +7919,6 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs) (char*) value.ptr(), new_length, cs, from, length); Field_blob::store_length(copy_length); - tmp= value.ptr(); bmove(ptr+packlength,(uchar*) &tmp,sizeof(char*)); return check_conversion_status(&copier, from + length, cs, true); diff --git a/sql/field_conv.cc b/sql/field_conv.cc index 555709a9e6e..7b57c7da104 100644 --- a/sql/field_conv.cc +++ b/sql/field_conv.cc @@ -629,9 +629,6 @@ void Copy_field::set(uchar *to,Field *from) Field_blob::store. Is this in order to trigger the call to well_formed_copy_nchars, by changing the pointer copy->tmp.ptr()? That call will take place anyway in all known cases. - - - The above causes a truncation to MAX_FIELD_WIDTH. Is this the intended - effect? Truncation is handled by well_formed_copy_nchars anyway. */ void Copy_field::set(Field *to,Field *from,bool save) { diff --git a/sql/item_sum.cc b/sql/item_sum.cc index e44a371d264..1cfee1a9241 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -496,8 +496,7 @@ Item *Item_sum::get_tmp_table_item(THD *thd) } -Field *Item_sum::create_tmp_field(bool group, TABLE *table, - uint convert_blob_length) +Field *Item_sum::create_tmp_field(bool group, TABLE *table) { Field *UNINIT_VAR(field); MEM_ROOT *mem_root= table->in_use->mem_root; @@ -512,13 +511,7 @@ Field *Item_sum::create_tmp_field(bool group, TABLE *table, Field_longlong(max_length, maybe_null, name, unsigned_flag); break; case STRING_RESULT: - if (max_length/collation.collation->mbmaxlen <= 255 || - convert_blob_length > Field_varstring::MAX_SIZE || - !convert_blob_length) - return make_string_field(table); - field= new (mem_root) Field_varstring(convert_blob_length, maybe_null, - name, table->s, collation.collation); - break; + return make_string_field(table); case DECIMAL_RESULT: field= Field_new_decimal::create_from_item(mem_root, this); break; @@ -1264,8 +1257,7 @@ void Item_sum_hybrid::setup_hybrid(THD *thd, Item *item, Item *value_arg) } -Field *Item_sum_hybrid::create_tmp_field(bool group, TABLE *table, - uint convert_blob_length) +Field *Item_sum_hybrid::create_tmp_field(bool group, TABLE *table) { Field *field; MEM_ROOT *mem_root; @@ -1273,9 +1265,9 @@ Field *Item_sum_hybrid::create_tmp_field(bool group, TABLE *table, if (args[0]->type() == Item::FIELD_ITEM) { field= ((Item_field*) args[0])->field; - + if ((field= create_tmp_field_from_field(table->in_use, field, name, table, - NULL, convert_blob_length))) + NULL))) field->flags&= ~NOT_NULL_FLAG; return field; } @@ -1301,7 +1293,7 @@ Field *Item_sum_hybrid::create_tmp_field(bool group, TABLE *table, Field::NONE, name, decimals); break; default: - return Item_sum::create_tmp_field(group, table, convert_blob_length); + return Item_sum::create_tmp_field(group, table); } if (field) field->init(table); @@ -1658,8 +1650,7 @@ Item *Item_sum_avg::copy_or_same(THD* thd) } -Field *Item_sum_avg::create_tmp_field(bool group, TABLE *table, - uint convert_blob_len) +Field *Item_sum_avg::create_tmp_field(bool group, TABLE *table) { Field *field; MEM_ROOT *mem_root= table->in_use->mem_root; @@ -1885,8 +1876,7 @@ Item *Item_sum_variance::copy_or_same(THD* thd) If we're grouping, then we need some space to serialize variables into, to pass around. */ -Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table, - uint convert_blob_len) +Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table) { Field *field; if (group) @@ -3067,6 +3057,11 @@ int dump_leaf_key(void* key_arg, element_count count __attribute__((unused)), ER_THD(thd, ER_CUT_VALUE_GROUP_CONCAT), item->row_count); + /** + To avoid duplicated warnings in Item_func_group_concat::val_str() + */ + if (table && table->blob_storage) + table->blob_storage->set_truncated_value(false); return 1; } return 0; @@ -3204,6 +3199,8 @@ void Item_func_group_concat::cleanup() if (table) { THD *thd= table->in_use; + if (table->blob_storage) + delete table->blob_storage; free_tmp_table(thd, table); table= 0; if (tree) @@ -3271,6 +3268,8 @@ void Item_func_group_concat::clear() reset_tree(tree); if (unique_filter) unique_filter->reset(); + if (table && table->blob_storage) + table->blob_storage->reset(); /* No need to reset the table as we never call write_row */ } @@ -3397,6 +3396,7 @@ bool Item_func_group_concat::setup(THD *thd) { List list; SELECT_LEX *select_lex= thd->lex->current_select; + const bool order_or_distinct= MY_TEST(arg_count_order > 0 || distinct); DBUG_ENTER("Item_func_group_concat::setup"); /* @@ -3409,9 +3409,6 @@ bool Item_func_group_concat::setup(THD *thd) if (!(tmp_table_param= new TMP_TABLE_PARAM)) DBUG_RETURN(TRUE); - /* We'll convert all blobs to varchar fields in the temporary table */ - tmp_table_param->convert_blob_length= max_length * - collation.collation->mbmaxlen; /* Push all not constant fields to the list and create a temp table */ always_null= 0; for (uint i= 0; i < arg_count_field; i++) @@ -3451,17 +3448,8 @@ bool Item_func_group_concat::setup(THD *thd) count_field_types(select_lex, tmp_table_param, all_fields, 0); tmp_table_param->force_copy_fields= force_copy_fields; DBUG_ASSERT(table == 0); - if (arg_count_order > 0 || distinct) + if (order_or_distinct) { - /* - Currently we have to force conversion of BLOB values to VARCHAR's - if we are to store them in TREE objects used for ORDER BY and - DISTINCT. This leads to truncation if the BLOB's size exceeds - Field_varstring::MAX_SIZE. - */ - set_if_smaller(tmp_table_param->convert_blob_length, - Field_varstring::MAX_SIZE); - /* Force the create_tmp_table() to convert BIT columns to INT as we cannot compare two table records containg BIT fields @@ -3495,6 +3483,13 @@ bool Item_func_group_concat::setup(THD *thd) table->file->extra(HA_EXTRA_NO_ROWS); table->no_rows= 1; + /** + Initialize blob_storage if GROUP_CONCAT is used + with ORDER BY | DISTINCT and BLOB field count > 0. + */ + if (order_or_distinct && table->s->blob_fields) + table->blob_storage= new Blob_mem_storage(); + /* Need sorting or uniqueness: init tree and choose a function to sort. Don't reserve space for NULLs: if any of gconcat arguments is NULL, @@ -3547,6 +3542,16 @@ String* Item_func_group_concat::val_str(String* str) if (no_appended && tree) /* Tree is used for sorting as in ORDER BY */ tree_walk(tree, &dump_leaf_key, this, left_root_right); + + if (table && table->blob_storage && + table->blob_storage->is_truncated_value()) + { + warning_for_row= true; + push_warning_printf(current_thd, Sql_condition::WARN_LEVEL_WARN, + ER_CUT_VALUE_GROUP_CONCAT, ER(ER_CUT_VALUE_GROUP_CONCAT), + row_count); + } + return &result; } diff --git a/sql/item_sum.h b/sql/item_sum.h index db3312c42f4..db38cf56723 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -481,8 +481,7 @@ public: } virtual void make_unique() { force_copy_fields= TRUE; } Item *get_tmp_table_item(THD *thd); - virtual Field *create_tmp_field(bool group, TABLE *table, - uint convert_blob_length); + virtual Field *create_tmp_field(bool group, TABLE *table); virtual bool collect_outer_ref_processor(uchar *param); bool init_sum_func_check(THD *thd); bool check_sum_func(THD *thd, Item **ref); @@ -845,7 +844,7 @@ public: return has_with_distinct() ? "avg(distinct " : "avg("; } Item *copy_or_same(THD* thd); - Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length); + Field *create_tmp_field(bool group, TABLE *table); void cleanup() { count= 0; @@ -901,7 +900,7 @@ public: const char *func_name() const { return sample ? "var_samp(" : "variance("; } Item *copy_or_same(THD* thd); - Field *create_tmp_field(bool group, TABLE *table, uint convert_blob_length); + Field *create_tmp_field(bool group, TABLE *table); enum Item_result result_type () const { return REAL_RESULT; } enum_field_types field_type() const { return MYSQL_TYPE_DOUBLE;} void cleanup() @@ -979,8 +978,7 @@ protected: bool any_value() { return was_values; } void no_rows_in_result(); void restore_to_before_no_rows_in_result(); - Field *create_tmp_field(bool group, TABLE *table, - uint convert_blob_length); + Field *create_tmp_field(bool group, TABLE *table); }; diff --git a/sql/sql_class.h b/sql/sql_class.h index ac2b666c9e9..314d29219a8 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -4529,8 +4529,6 @@ public: uint group_parts,group_length,group_null_parts; uint quick_group; bool using_indirect_summary_function; - /* If >0 convert all blob fields to varchar(convert_blob_length) */ - uint convert_blob_length; CHARSET_INFO *table_charset; bool schema_table; /* TRUE if the temp table is created for subquery materialization. */ @@ -4559,7 +4557,7 @@ public: TMP_TABLE_PARAM() :copy_field(0), group_parts(0), - group_length(0), group_null_parts(0), convert_blob_length(0), + group_length(0), group_null_parts(0), schema_table(0), materialized_subquery(0), force_not_null_cols(0), precomputed_group_by(0), force_copy_fields(0), bit_fields_as_long(0), skip_create_table(0) diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 7122fbb16b3..f8a755c8d5e 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3893,7 +3893,7 @@ Field *Item::create_field_for_create_select(THD *thd, TABLE *table) { Field *def_field, *tmp_field; return create_tmp_field(thd, table, this, type(), - (Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0, 0); + (Item ***) 0, &tmp_field, &def_field, 0, 0, 0, 0); } diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 4759af038f9..fff24b97e6a 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -15751,8 +15751,6 @@ const_expression_in_where(COND *cond, Item *comp_item, Field *comp_field, the record in the original table. If item == NULL then fill_record() will update the temporary table - @param convert_blob_length If >0 create a varstring(convert_blob_length) - field instead of blob. @retval NULL on error @@ -15762,23 +15760,12 @@ const_expression_in_where(COND *cond, Item *comp_item, Field *comp_field, Field *create_tmp_field_from_field(THD *thd, Field *org_field, const char *name, TABLE *table, - Item_field *item, uint convert_blob_length) + Item_field *item) { Field *new_field; - /* - Make sure that the blob fits into a Field_varstring which has - 2-byte lenght. - */ - if (convert_blob_length && convert_blob_length <= Field_varstring::MAX_SIZE && - (org_field->flags & BLOB_FLAG)) - new_field= new Field_varstring(convert_blob_length, - org_field->maybe_null(), - org_field->field_name, table->s, - org_field->charset()); - else - new_field= org_field->make_new_field(thd->mem_root, table, - table == org_field->table); + new_field= org_field->make_new_field(thd->mem_root, table, + table == org_field->table); if (new_field) { new_field->init(table); @@ -15820,8 +15807,6 @@ Field *create_tmp_field_from_field(THD *thd, Field *org_field, update the record in the original table. If modify_item is 0 then fill_record() will update the temporary table - @param convert_blob_length If >0 create a varstring(convert_blob_length) - field instead of blob. @retval 0 on error @@ -15830,8 +15815,7 @@ Field *create_tmp_field_from_field(THD *thd, Field *org_field, */ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table, - Item ***copy_func, bool modify_item, - uint convert_blob_length) + Item ***copy_func, bool modify_item) { bool maybe_null= item->maybe_null; Field *UNINIT_VAR(new_field); @@ -15869,17 +15853,6 @@ static Field *create_tmp_field_from_item(THD *thd, Item *item, TABLE *table, if (item->cmp_type() == TIME_RESULT || item->field_type() == MYSQL_TYPE_GEOMETRY) new_field= item->tmp_table_field_from_field_type(table, true, false); - /* - Make sure that the blob fits into a Field_varstring which has - 2-byte lenght. - */ - else if (item->max_length/item->collation.collation->mbmaxlen > 255 && - convert_blob_length <= Field_varstring::MAX_SIZE && - convert_blob_length) - new_field= new (mem_root) - Field_varstring(convert_blob_length, maybe_null, - item->name, table->s, - item->collation.collation); else new_field= item->make_string_field(table); new_field->set_derivation(item->collation.derivation); @@ -15958,8 +15931,6 @@ Field *Item::create_field_for_schema(THD *thd, TABLE *table) the record in the original table. If modify_item is 0 then fill_record() will update the temporary table - @param convert_blob_length If >0 create a varstring(convert_blob_length) - field instead of blob. @retval 0 on error @@ -15972,8 +15943,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, Field **default_field, bool group, bool modify_item, bool table_cant_handle_bit_fields, - bool make_copy_field, - uint convert_blob_length) + bool make_copy_field) { Field *result; Item::Type orig_type= type; @@ -15991,7 +15961,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, case Item::SUM_FUNC_ITEM: { Item_sum *item_sum=(Item_sum*) item; - result= item_sum->create_tmp_field(group, table, convert_blob_length); + result= item_sum->create_tmp_field(group, table); if (!result) my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATALERROR)); return result; @@ -16027,7 +15997,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, item->maybe_null= orig_item->maybe_null; } result= create_tmp_field_from_item(thd, item, table, NULL, - modify_item, convert_blob_length); + modify_item); *from_field= field->field; if (result && modify_item) field->result_field= result; @@ -16039,7 +16009,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, { *from_field= field->field; result= create_tmp_field_from_item(thd, item, table, copy_func, - modify_item, convert_blob_length); + modify_item); if (result && modify_item) field->result_field= result; } @@ -16049,8 +16019,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, item->name, table, modify_item ? field : - NULL, - convert_blob_length); + NULL); if (orig_type == Item::REF_ITEM && orig_modify) ((Item_ref*)orig_item)->set_result_field(result); /* @@ -16084,8 +16053,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, sp_result_field, item_func_sp->name, table, - NULL, - convert_blob_length); + NULL); if (modify_item) item->set_result_field(result_field); @@ -16117,7 +16085,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, } return create_tmp_field_from_item(thd, item, table, (make_copy_field ? 0 : copy_func), - modify_item, convert_blob_length); + modify_item); case Item::TYPE_HOLDER: result= ((Item_type_holder *)item)->make_field_by_type(table); result->set_derivation(item->collation.derivation); @@ -16420,8 +16388,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List &fields, create_tmp_field(thd, table, arg, arg->type(), ©_func, tmp_from_field, &default_field[fieldnr], group != 0,not_all_columns, - distinct, 0, - param->convert_blob_length); + distinct, false); if (!new_field) goto err; // Should be OOM tmp_from_field++; @@ -16491,8 +16458,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List &fields, to be usable in this case too. */ item->marker == 4 || param->bit_fields_as_long, - force_copy_fields, - param->convert_blob_length); + force_copy_fields); if (!new_field) { diff --git a/sql/sql_select.h b/sql/sql_select.h index 9989ececdec..91f7d1619ea 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1590,8 +1590,8 @@ bool copy_funcs(Item **func_ptr, const THD *thd); uint find_shortest_key(TABLE *table, const key_map *usable_keys); Field* create_tmp_field_from_field(THD *thd, Field* org_field, const char *name, TABLE *table, - Item_field *item, uint convert_blob_length); - + Item_field *item); + bool is_indexed_agg_distinct(JOIN *join, List *out_args); /* functions from opt_sum.cc */ @@ -1849,8 +1849,7 @@ Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, Field **def_field, bool group, bool modify_item, bool table_cant_handle_bit_fields, - bool make_copy_field, - uint convert_blob_length); + bool make_copy_field); /* General routine to change field->ptr of a NULL-terminated array of Field diff --git a/sql/table.h b/sql/table.h index c45e86b695e..023d5e542b8 100644 --- a/sql/table.h +++ b/sql/table.h @@ -977,6 +977,57 @@ struct TABLE_SHARE }; +/** + Class is used as a BLOB field value storage for + intermediate GROUP_CONCAT results. Used only for + GROUP_CONCAT with DISTINCT or ORDER BY options. + */ + +class Blob_mem_storage: public Sql_alloc +{ +private: + MEM_ROOT storage; + /** + Sign that some values were cut + during saving into the storage. + */ + bool truncated_value; +public: + Blob_mem_storage() :truncated_value(false) + { + init_alloc_root(&storage, MAX_FIELD_VARCHARLENGTH, 0, MYF(0)); + } + ~ Blob_mem_storage() + { + free_root(&storage, MYF(0)); + } + void reset() + { + free_root(&storage, MYF(MY_MARK_BLOCKS_FREE)); + truncated_value= false; + } + /** + Fuction creates duplicate of 'from' + string in 'storage' MEM_ROOT. + + @param from string to copy + @param length string length + + @retval Pointer to the copied string. + @retval 0 if an error occured. + */ + char *store(const char *from, uint length) + { + return (char*) memdup_root(&storage, from, length); + } + void set_truncated_value(bool is_truncated_value) + { + truncated_value= is_truncated_value; + } + bool is_truncated_value() { return truncated_value; } +}; + + /* Information for one open table */ enum index_hint_type { @@ -1247,6 +1298,12 @@ public: REGINFO reginfo; /* field connections */ MEM_ROOT mem_root; + /** + Initialized in Item_func_group_concat::setup for appropriate + temporary table if GROUP_CONCAT is used with ORDER BY | DISTINCT + and BLOB field count > 0. + */ + Blob_mem_storage *blob_storage; GRANT_INFO grant; Filesort_info sort; /* -- cgit v1.2.1 From f8251911a44f6b65c2377e9945e208e240dfec33 Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Thu, 3 Mar 2016 08:40:49 +0100 Subject: MDEV-9595: Shutdown takes forever with many replication channels There was a race between end_slave() and cleanup code at the end of handle_slave_sql(). This could cause access to master_info_index and global_rpl_thread_pool after they had been freed. Fix by skipping that cleanup if server shutdown is in progress, as is done in other parts of the code as well (the cleanup, which stops worker threads that are not needed anymore, is redundant anyway when the server is shutting down). --- sql/slave.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/slave.cc b/sql/slave.cc index e3209ab31f5..651d5ba0171 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -4848,6 +4848,7 @@ err_during_init: */ mysql_mutex_lock(&LOCK_active_mi); if (opt_slave_parallel_threads > 0 && + master_info_index &&// master_info_index is set to NULL on server shutdown !master_info_index->any_slave_sql_running()) rpl_parallel_inactivate_pool(&global_rpl_thread_pool); mysql_mutex_unlock(&LOCK_active_mi); -- cgit v1.2.1 From 1777fd5f556a9c68cae01ad2aadaf4865984e649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Kek=C3=A4l=C3=A4inen?= Date: Fri, 4 Mar 2016 02:09:37 +0200 Subject: Fix spelling: occurred, execute, which etc --- Docs/sp-imp-spec.txt | 4 ++-- client/mysql.cc | 2 +- client/mysql_upgrade.c | 2 +- client/mysqltest.cc | 6 +++--- debian/additions/innotop/innotop | 4 ++-- debian/additions/innotop/innotop.1 | 2 +- debian/additions/mysqlreport | 2 +- extra/yassl/src/yassl_error.cpp | 4 ++-- include/my_context.h | 2 +- libmysql/libmysql.c | 2 +- man/mysql-test-run.pl.1 | 2 +- mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test | 2 +- mysql-test/include/mtr_warnings.sql | 2 +- mysql-test/lib/My/SafeProcess.pm | 2 +- mysql-test/lib/v1/mtr_report.pl | 2 +- mysql-test/mysql-test-run.pl | 2 +- mysql-test/r/events_bugs.result | 2 +- mysql-test/r/index_merge_myisam.result | 2 +- mysql-test/r/mysqldump.result | 2 +- mysql-test/suite/multi_source/gtid_ignore_duplicates.test | 2 +- .../perfschema/t/socket_summary_by_instance_func.test | 2 +- .../perfschema/t/socket_summary_by_instance_func_win.test | 2 +- mysql-test/suite/rpl/r/rpl_checksum.result | 2 +- mysql-test/suite/rpl/r/rpl_incident.result | 4 ++-- .../suite/rpl/r/rpl_mixed_binlog_max_cache_size.result | 2 +- .../suite/rpl/r/rpl_row_binlog_max_cache_size.result | 2 +- .../suite/rpl/r/rpl_stm_binlog_max_cache_size.result | 2 +- mysql-test/suite/rpl/t/rpl_checksum.test | 2 +- mysql-test/suite/rpl/t/rpl_gtid_errorlog.test | 2 +- mysql-test/suite/rpl/t/rpl_incident.test | 2 +- mysql-test/suite/stress/include/ddl1.inc | 4 ++-- mysql-test/t/events_bugs.test | 2 +- mysql-test/t/index_merge_myisam.test | 2 +- mysql-test/t/merge.test | 2 +- mysql-test/t/mysqldump.test | 2 +- mysys/mf_iocache2.c | 2 +- mysys/mf_keycache.c | 2 +- mysys/my_default.c | 2 +- mysys/my_delete.c | 2 +- mysys/my_lock.c | 4 ++-- plugin/handler_socket/docs-en/perl-client.en.txt | 6 +++--- plugin/semisync/semisync_master.h | 6 +++--- scripts/mysqlaccess.sh | 14 +++++++------- sql-bench/bench-init.pl.sh | 4 ++-- sql-common/client_plugin.c | 2 +- sql-common/mysql_async.c | 12 ++++++------ sql/event_db_repository.cc | 2 +- sql/event_queue.cc | 2 +- sql/ha_ndbcluster.cc | 2 +- sql/ha_ndbcluster_binlog.cc | 2 +- sql/ha_partition.cc | 2 +- sql/handler.cc | 2 +- sql/handler.h | 2 +- sql/item.cc | 4 ++-- sql/item.h | 4 ++-- sql/item_func.cc | 4 ++-- sql/item_subselect.cc | 2 +- sql/log.cc | 14 +++++++------- sql/log_event.cc | 4 ++-- sql/log_event_old.cc | 4 ++-- sql/my_apc.cc | 2 +- sql/rpl_parallel.cc | 6 +++--- sql/rpl_parallel.h | 2 +- sql/share/errmsg-utf8.txt | 2 +- sql/signal_handler.cc | 2 +- sql/sp_head.h | 2 +- sql/sql_acl.cc | 2 +- sql/sql_base.cc | 10 +++++----- sql/sql_join_cache.cc | 2 +- sql/sql_lex.h | 2 +- sql/sql_parse.cc | 2 +- sql/sql_prepare.cc | 2 +- sql/sql_repl.cc | 4 ++-- sql/sql_select.cc | 8 ++++---- sql/sql_select.h | 2 +- sql/sql_show.cc | 4 ++-- sql/sql_string.cc | 4 ++-- sql/sql_trigger.cc | 2 +- sql/sql_update.cc | 2 +- sql/sql_view.cc | 4 ++-- sql/threadpool_win.cc | 4 ++-- sql/tztime.cc | 8 ++++---- storage/archive/ha_archive.cc | 2 +- storage/connect/plgcnx.h | 2 +- storage/connect/tabdos.cpp | 2 +- storage/connect/tabmysql.cpp | 2 +- storage/connect/tabodbc.cpp | 2 +- storage/connect/value.cpp | 4 ++-- storage/csv/ha_tina.h | 2 +- storage/federated/ha_federated.cc | 2 +- storage/federatedx/ha_federatedx.cc | 2 +- storage/innobase/fts/fts0opt.cc | 2 +- storage/innobase/os/os0file.cc | 4 ++-- storage/maria/ma_packrec.c | 2 +- storage/myisam/ha_myisam.cc | 2 +- storage/myisam/mi_packrec.c | 2 +- storage/myisam/myisamlog.c | 2 +- storage/ndb/include/ndbapi/NdbEventOperation.hpp | 6 +++--- storage/ndb/include/ndbapi/NdbOperation.hpp | 4 ++-- storage/ndb/include/ndbapi/NdbTransaction.hpp | 4 ++-- storage/ndb/include/newtonapi/dba.h | 2 +- storage/ndb/src/cw/cpcd/CPCD.hpp | 10 +++++----- storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp | 2 +- storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp | 2 +- storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp | 2 +- storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp | 2 +- storage/ndb/src/kernel/vm/Emulator.cpp | 2 +- storage/ndb/src/mgmsrv/MgmtSrvr.hpp | 2 +- storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp | 2 +- storage/ndb/src/ndbapi/NdbTransaction.cpp | 4 ++-- storage/ndb/src/ndbapi/Ndbif.cpp | 4 ++-- storage/ndb/test/include/NDBT_Error.hpp | 2 +- storage/ndb/test/ndbapi/flexAsynch.cpp | 2 +- storage/ndb/test/ndbapi/flexTimedAsynch.cpp | 2 +- storage/ndb/test/ndbapi/initronja.cpp | 8 ++++---- storage/ndb/test/ndbapi/testNdbApi.cpp | 2 +- storage/ndb/test/ndbapi/testTimeout.cpp | 4 ++-- storage/ndb/test/ndbapi/test_event.cpp | 4 ++-- storage/ndb/test/ndbapi/test_event_multi_table.cpp | 2 +- storage/ndb/tools/restore/restore_main.cpp | 4 ++-- storage/xtradb/fts/fts0opt.cc | 2 +- storage/xtradb/os/os0file.cc | 4 ++-- strings/str2int.c | 2 +- tests/async_queries.c | 2 +- tests/mysql_client_test.c | 8 ++++---- tests/nonblock-wrappers.h | 2 +- 126 files changed, 200 insertions(+), 200 deletions(-) diff --git a/Docs/sp-imp-spec.txt b/Docs/sp-imp-spec.txt index 9795dd72252..259d76ab5bb 100644 --- a/Docs/sp-imp-spec.txt +++ b/Docs/sp-imp-spec.txt @@ -243,7 +243,7 @@ in the caller's frame is set in the new context as well. 4) For each instruction, call its execute() method. The result is a pointer to the next instruction to execute (or NULL) - if an error occured. + if an error occurred. 5) On success, set the new values of the OUT and INOUT parameters in the caller's frame. @@ -853,7 +853,7 @@ // '*nextp' will be set to the index of the next instruction // to execute. (For most instruction this will be the // instruction following this one.) - // Returns 0 on success, non-zero if some error occured. + // Returns 0 on success, non-zero if some error occurred. virtual int execute(THD *, uint *nextp) } diff --git a/client/mysql.cc b/client/mysql.cc index f1346395dfe..ea7d17abafc 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -3358,7 +3358,7 @@ com_go(String *buffer,char *line __attribute__((unused))) end: - /* Show warnings if any or error occured */ + /* Show warnings if any or error occurred */ if (show_warnings == 1 && (warnings >= 1 || error)) print_warnings(); diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index b84caa541c1..06b6f991567 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -644,7 +644,7 @@ static int get_upgrade_info_file_name(char* name) /* Read the content of mysql_upgrade_info file and compare the version number form file against - version number wich mysql_upgrade was compiled for + version number which mysql_upgrade was compiled for NOTE This is an optimization to avoid running mysql_upgrade diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 026934a2feb..ec5bf0957df 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -1104,7 +1104,7 @@ void do_eval(DYNAMIC_STRING *query_eval, const char *query, Run query and dump the result to stderr in vertical format NOTE! This function should be safe to call when an error - has occured and thus any further errors will be ignored(although logged) + has occurred and thus any further errors will be ignored (although logged) SYNOPSIS show_query @@ -1170,7 +1170,7 @@ static void show_query(MYSQL* mysql, const char* query) is added to the warning stack, only print @@warning_count-1 warnings. NOTE! This function should be safe to call when an error - has occured and this any further errors will be ignored(although logged) + has occurred and this any further errors will be ignored(although logged) SYNOPSIS show_warnings_before_error @@ -4701,7 +4701,7 @@ void do_sync_with_master2(struct st_command *command, long offset, master_pos_wait returned NULL. This indicates that slave SQL thread is not started, the slave's master information is not initialized, the arguments are - incorrect, or an error has occured + incorrect, or an error has occurred */ die("%.*s failed: '%s' returned NULL " \ "indicating slave SQL thread failure", diff --git a/debian/additions/innotop/innotop b/debian/additions/innotop/innotop index 646f0d7f0fb..9179a0d7a81 100644 --- a/debian/additions/innotop/innotop +++ b/debian/additions/innotop/innotop @@ -1503,7 +1503,7 @@ my %exprs = ( my %columns = ( active_secs => { hdr => 'SecsActive', num => 1, label => 'Seconds transaction has been active', }, - add_pool_alloc => { hdr => 'Add\'l Pool', num => 1, label => 'Additonal pool allocated' }, + add_pool_alloc => { hdr => 'Add\'l Pool', num => 1, label => 'Additional pool allocated' }, attempted_op => { hdr => 'Action', num => 0, label => 'The action that caused the error' }, awe_mem_alloc => { hdr => 'AWE Memory', num => 1, label => '[Windows] AWE memory allocated' }, binlog_cache_overflow => { hdr => 'Binlog Cache', num => 1, label => 'Transactions too big for binlog cache that went to disk' }, @@ -10365,7 +10365,7 @@ show you something like this: pages_modified Dirty Pages Pages modified (dirty IB_bp_pages_m buf_pool_hit_rate Hit Rate Buffer pool hit rate IB_bp_buf_poo total_mem_alloc Memory Total memory allocate IB_bp_total_m - add_pool_alloc Add'l Pool Additonal pool alloca IB_bp_add_poo + add_pool_alloc Add'l Pool Additional pool alloca IB_bp_add_poo The first line shows which table you're editing, and reminds you again to press '?' for a list of key mappings. The rest is a tabular representation of the diff --git a/debian/additions/innotop/innotop.1 b/debian/additions/innotop/innotop.1 index b2e7fce084e..fbb481f9b94 100644 --- a/debian/additions/innotop/innotop.1 +++ b/debian/additions/innotop/innotop.1 @@ -1579,7 +1579,7 @@ show you something like this: \& pages_modified Dirty Pages Pages modified (dirty IB_bp_pages_m \& buf_pool_hit_rate Hit Rate Buffer pool hit rate IB_bp_buf_poo \& total_mem_alloc Memory Total memory allocate IB_bp_total_m -\& add_pool_alloc Add\*(Aql Pool Additonal pool alloca IB_bp_add_poo +\& add_pool_alloc Add\*(Aql Pool Additional pool alloca IB_bp_add_poo .Ve .PP The first line shows which table you're editing, and reminds you again to press diff --git a/debian/additions/mysqlreport b/debian/additions/mysqlreport index 402a5be835d..5cd46441d8a 100755 --- a/debian/additions/mysqlreport +++ b/debian/additions/mysqlreport @@ -350,7 +350,7 @@ sub read_relative_infiles # The infile must begin with the system variable values. # Therefore, the first occurance of Aborted_clients indicates the beginning - # of the first set of status values if no sets have occured yet ($stat_n == 0). + # of the first set of status values if no sets have occurred yet ($stat_n == 0). # In this case, the following status values are printed to the current fh, # along with the system variable values read thus far, until Aborted_clients # occurs again. Then begins the second and subsequent sets of status values. diff --git a/extra/yassl/src/yassl_error.cpp b/extra/yassl/src/yassl_error.cpp index fec6a3394ca..f339655be3d 100644 --- a/extra/yassl/src/yassl_error.cpp +++ b/extra/yassl/src/yassl_error.cpp @@ -121,11 +121,11 @@ void SetErrorString(YasslError error, char* buffer) break; case certificate_error : - strncpy(buffer, "unable to proccess cerificate", max); + strncpy(buffer, "unable to process cerificate", max); break; case privateKey_error : - strncpy(buffer, "unable to proccess private key, bad format", max); + strncpy(buffer, "unable to process private key, bad format", max); break; case badVersion_error : diff --git a/include/my_context.h b/include/my_context.h index 976ed9850cc..c59d6ce3577 100644 --- a/include/my_context.h +++ b/include/my_context.h @@ -178,7 +178,7 @@ struct mysql_async_context { resumed, eg. whether we woke up due to connection completed or timeout in mysql_real_connect_cont(). */ - unsigned int events_occured; + unsigned int events_occurred; /* This is set to the result of the whole asynchronous operation when it completes. It uses a union, as different calls have different return diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 3af4a032e5b..446f1da0b0c 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -2232,7 +2232,7 @@ static int stmt_read_row_buffered(MYSQL_STMT *stmt, unsigned char **row) /* Read one row from network: unbuffered non-cursor fetch. - If last row was read, or error occured, erase this statement + If last row was read, or error occurred, erase this statement from record pointing to object unbuffered fetch is performed from. SYNOPSIS diff --git a/man/mysql-test-run.pl.1 b/man/mysql-test-run.pl.1 index 495c0c50338..303c8877e87 100644 --- a/man/mysql-test-run.pl.1 +++ b/man/mysql-test-run.pl.1 @@ -1602,7 +1602,7 @@ may fail in total, as each repetition is considered a new test case, which may i \fB\-\-retry\-failure=\fR\fB\fIN\fR\fR .sp When using the \fB-\-retry\fR option to retry failed tests, -stop when N failures have occured (default 2)\&. Setting it to 0 or 1 effectively turns off retries\&. +stop when N failures have occurred (default 2)\&. Setting it to 0 or 1 effectively turns off retries\&. .RE .sp .RS 4 diff --git a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test index e1faec8440b..0f46b00f683 100644 --- a/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test +++ b/mysql-test/extra/rpl_tests/rpl_binlog_max_cache_size.test @@ -375,7 +375,7 @@ source include/start_slave.inc; CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage.*"); CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_stmt_cache_size' bytes of storage.*"); CALL mtr.add_suppression("Writing one row to the row-based binary log failed.*"); -CALL mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occured on the master. Message: error writing to the binary log"); +CALL mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master. Message: error writing to the binary log"); connection master; TRUNCATE t1; diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index 345968cd3f0..8f5a4fe6685 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -136,7 +136,7 @@ INSERT INTO global_suppressions VALUES ("Slave: Query caused different errors on master and slave"), ("Slave: Table .* doesn't exist"), ("Slave: Table width mismatch"), - ("Slave: The incident LOST_EVENTS occured on the master"), + ("Slave: The incident LOST_EVENTS occurred on the master"), ("Slave: Unknown error.* 1105"), ("Slave: Can't drop database.* database doesn't exist"), ("Time-out in NDB"), diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm index e7917f8fb16..a9b4f9a4ecc 100644 --- a/mysql-test/lib/My/SafeProcess.pm +++ b/mysql-test/lib/My/SafeProcess.pm @@ -34,7 +34,7 @@ package My::SafeProcess; # will zap the "monitored process" and exit # - the "monitored process" to exit, in which case it will exit # itself with same exit code as the "monitored process" -# - the parent process to send the "shutdown" signal in wich case +# - the parent process to send the "shutdown" signal in which case # monitor will kill the "monitored process" hard and exit # # diff --git a/mysql-test/lib/v1/mtr_report.pl b/mysql-test/lib/v1/mtr_report.pl index accf00dbb5d..9c957ea29c3 100644 --- a/mysql-test/lib/v1/mtr_report.pl +++ b/mysql-test/lib/v1/mtr_report.pl @@ -309,7 +309,7 @@ sub mtr_report_stats ($) { /Slave: Query caused different errors on master and slave/ or /Slave: Table .* doesn't exist/ or /Slave: Table width mismatch/ or - /Slave: The incident LOST_EVENTS occured on the master/ or + /Slave: The incident LOST_EVENTS occurred on the master/ or /Slave: Unknown error.* 1105/ or /Slave: Can't drop database.* database doesn't exist/ or /Slave SQL:.*(?:error.* \d+|Query:.*)/ or diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 9158a70d9cc..e90e464d118 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -6601,7 +6601,7 @@ Misc options failures before stopping, set with the --retry-failure option retry-failure=N When using the --retry option to retry failed tests, - stop when N failures have occured (default $opt_retry_failure) + stop when N failures have occurred (default $opt_retry_failure) reorder Reorder tests to get fewer server restarts help Get this help text diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result index f1ff0faaa47..3e12b43e72c 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -602,7 +602,7 @@ INSERT INTO events_test.event_log VALUES (NULL,@evname,@cnt+1,current_timestamp( ROLLBACK; END IF; END;| -Sleep till the first INSERT into events_test.event_log occured +Sleep till the first INSERT into events_test.event_log occurred SELECT COUNT(*) > 0 AS "Expect 1" FROM events_test.event_log; Expect 1 1 diff --git a/mysql-test/r/index_merge_myisam.result b/mysql-test/r/index_merge_myisam.result index c907997573a..fcd5eebefa4 100644 --- a/mysql-test/r/index_merge_myisam.result +++ b/mysql-test/r/index_merge_myisam.result @@ -1595,7 +1595,7 @@ explain select * from t1 where a=10 and b=10 or c=10; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index_merge a,b,c a,c 5,5 NULL 54 Using union(a,c); Using where This will switch to sort-union (intersection will be gone, too, -thats a known limitation: +that's a known limitation: set optimizer_switch='default,index_merge_union=off'; explain select * from t1 where a=10 and b=10 or c=10; id select_type table type possible_keys key key_len ref rows Extra diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 1725291d4c6..b6de51c8b03 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -1821,7 +1821,7 @@ a b Osnabrück Köln drop table t1; # -# Bug#15328 Segmentation fault occured if my.cnf is invalid for escape sequence +# Bug#15328 Segmentation fault occurred if my.cnf is invalid for escape sequence # --fields-optionally-enclosed-by=" # diff --git a/mysql-test/suite/multi_source/gtid_ignore_duplicates.test b/mysql-test/suite/multi_source/gtid_ignore_duplicates.test index 1eea038f8c9..4d98b5c2ee7 100644 --- a/mysql-test/suite/multi_source/gtid_ignore_duplicates.test +++ b/mysql-test/suite/multi_source/gtid_ignore_duplicates.test @@ -337,7 +337,7 @@ START SLAVE; --source include/wait_for_slave_to_start.inc --replace_result $gtid GTID eval SELECT MASTER_GTID_WAIT("$gtid", 30); -# The bug occured here, the slave would get an out-of-order binlog error +# The bug occurred here, the slave would get an out-of-order binlog error # due to trying to re-apply the 100-x-x transaction. # Restart stopped multi-source connections, and sync up. diff --git a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test index d06edb0d78f..086d31113f8 100644 --- a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test +++ b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func.test @@ -1651,7 +1651,7 @@ if($print_details) --enable_result_log --horizontal_results --echo # Dump detailed differences after - before statement execution - --echo # 1. The statement executing connection and hopefully noone else + --echo # 1. The statement executing connection and hopefully no one else SELECT @default_object_instance_begin; SELECT EVENT_NAME, OBJECT_INSTANCE_BEGIN, COUNT_READ, SUM_NUMBER_OF_BYTES_READ, diff --git a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test index cefaf1de549..0ecb51af203 100644 --- a/mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test +++ b/mysql-test/suite/perfschema/t/socket_summary_by_instance_func_win.test @@ -1663,7 +1663,7 @@ if($print_details) --enable_result_log --horizontal_results --echo # Dump detailed differences after - before statement execution - --echo # 1. The statement executing connection and hopefully noone else + --echo # 1. The statement executing connection and hopefully no one else SELECT @default_object_instance_begin; SELECT EVENT_NAME, OBJECT_INSTANCE_BEGIN, COUNT_READ, SUM_NUMBER_OF_BYTES_READ, diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result index d88258f3b65..94d215e596a 100644 --- a/mysql-test/suite/rpl/r/rpl_checksum.result +++ b/mysql-test/suite/rpl/r/rpl_checksum.result @@ -142,7 +142,7 @@ ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) SET debug_dbug= @old_dbug; INSERT INTO t4 VALUES (2); include/wait_for_slave_sql_error.inc [errno=1590] -Last_SQL_Error = 'The incident LOST_EVENTS occured on the master. Message: error writing to the binary log' +Last_SQL_Error = 'The incident LOST_EVENTS occurred on the master. Message: error writing to the binary log' SELECT * FROM t4 ORDER BY a; a 1 diff --git a/mysql-test/suite/rpl/r/rpl_incident.result b/mysql-test/suite/rpl/r/rpl_incident.result index 5e725e36389..7cb8168c6a9 100644 --- a/mysql-test/suite/rpl/r/rpl_incident.result +++ b/mysql-test/suite/rpl/r/rpl_incident.result @@ -16,9 +16,9 @@ a 2 3 4 -call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occured on the master.* 1590"); +call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590"); include/wait_for_slave_sql_error.inc [errno=1590] -Last_SQL_Error = 'The incident LOST_EVENTS occured on the master. Message: ' +Last_SQL_Error = 'The incident LOST_EVENTS occurred on the master. Message: ' **** On Slave **** SELECT * FROM t1; a diff --git a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result index 06f9f5617b5..80f76169472 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_binlog_max_cache_size.result @@ -151,7 +151,7 @@ include/start_slave.inc CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage.*"); CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_stmt_cache_size' bytes of storage.*"); CALL mtr.add_suppression("Writing one row to the row-based binary log failed.*"); -CALL mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occured on the master. Message: error writing to the binary log"); +CALL mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master. Message: error writing to the binary log"); TRUNCATE t1; SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE; SET GLOBAL binlog_cache_size= ORIGINAL_VALUE; diff --git a/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result index a4f76da1872..71edcd749e5 100644 --- a/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result +++ b/mysql-test/suite/rpl/r/rpl_row_binlog_max_cache_size.result @@ -152,7 +152,7 @@ include/start_slave.inc CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage.*"); CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_stmt_cache_size' bytes of storage.*"); CALL mtr.add_suppression("Writing one row to the row-based binary log failed.*"); -CALL mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occured on the master. Message: error writing to the binary log"); +CALL mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master. Message: error writing to the binary log"); TRUNCATE t1; SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE; SET GLOBAL binlog_cache_size= ORIGINAL_VALUE; diff --git a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result index 06f9f5617b5..80f76169472 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result +++ b/mysql-test/suite/rpl/r/rpl_stm_binlog_max_cache_size.result @@ -151,7 +151,7 @@ include/start_slave.inc CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_cache_size' bytes of storage.*"); CALL mtr.add_suppression("Multi-statement transaction required more than 'max_binlog_stmt_cache_size' bytes of storage.*"); CALL mtr.add_suppression("Writing one row to the row-based binary log failed.*"); -CALL mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occured on the master. Message: error writing to the binary log"); +CALL mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master. Message: error writing to the binary log"); TRUNCATE t1; SET GLOBAL max_binlog_cache_size= ORIGINAL_VALUE; SET GLOBAL binlog_cache_size= ORIGINAL_VALUE; diff --git a/mysql-test/suite/rpl/t/rpl_checksum.test b/mysql-test/suite/rpl/t/rpl_checksum.test index bd0ab7ecc9c..1cf9091033e 100644 --- a/mysql-test/suite/rpl/t/rpl_checksum.test +++ b/mysql-test/suite/rpl/t/rpl_checksum.test @@ -298,7 +298,7 @@ if(!$log_error_) } --let SEARCH_FILE= $log_error_ --let SEARCH_RANGE=-50000 ---let SEARCH_PATTERN= Slave SQL: The incident LOST_EVENTS occured on the master\. Message: error writing to the binary log, Internal MariaDB error code: 1590 +--let SEARCH_PATTERN= Slave SQL: The incident LOST_EVENTS occurred on the master\. Message: error writing to the binary log, Internal MariaDB error code: 1590 --source include/search_pattern_in_file.inc SELECT * FROM t4 ORDER BY a; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_errorlog.test b/mysql-test/suite/rpl/t/rpl_gtid_errorlog.test index 24298e9893a..137ac6c0f5d 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_errorlog.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_errorlog.test @@ -66,7 +66,7 @@ if(!$log_error_) --let SEARCH_RANGE=-50000 --let SEARCH_PATTERN=Slave SQL: Error 'Duplicate entry .* on query\. .*Query: '.*', Gtid 0-1-100, Internal MariaDB error code:|Slave SQL: Could not execute Write_rows.*table test.t1; Duplicate entry.*, Gtid 0-1-100, Internal MariaDB error --source include/search_pattern_in_file.inc ---let SEARCH_PATTERN=Slave SQL: The incident LOST_EVENTS occured on the master\. Message: , Internal MariaDB error code: 1590 +--let SEARCH_PATTERN=Slave SQL: The incident LOST_EVENTS occurred on the master\. Message: , Internal MariaDB error code: 1590 --source include/search_pattern_in_file.inc diff --git a/mysql-test/suite/rpl/t/rpl_incident.test b/mysql-test/suite/rpl/t/rpl_incident.test index c591a8261c4..adf20953b0f 100644 --- a/mysql-test/suite/rpl/t/rpl_incident.test +++ b/mysql-test/suite/rpl/t/rpl_incident.test @@ -22,7 +22,7 @@ eval SET GLOBAL debug_dbug= '$debug_save'; connection slave; # Wait until SQL thread stops with error LOST_EVENT on master -call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occured on the master.* 1590"); +call mtr.add_suppression("Slave SQL.*The incident LOST_EVENTS occurred on the master.* 1590"); let $slave_sql_errno= 1590; let $show_slave_sql_error= 1; source include/wait_for_slave_sql_error.inc; diff --git a/mysql-test/suite/stress/include/ddl1.inc b/mysql-test/suite/stress/include/ddl1.inc index 96adadc5af5..00e64cee395 100644 --- a/mysql-test/suite/stress/include/ddl1.inc +++ b/mysql-test/suite/stress/include/ddl1.inc @@ -111,10 +111,10 @@ # # 6. Hints for analysis of test failures: # 1. Look into the protocol and check in which ddl*.inc -# script the difference to the expected result occured. +# script the difference to the expected result occurred. # 2. Comment the sourcing of all other ddl*.inc scripts # out. -# 3. Edit the ddl*.inc script where the error occured and +# 3. Edit the ddl*.inc script where the error occurred and # remove all # - "--disable_query_log", "--disable_result_log" # - successful passed subtests. diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test index 5b5123ad295..c33497f643d 100644 --- a/mysql-test/t/events_bugs.test +++ b/mysql-test/t/events_bugs.test @@ -943,7 +943,7 @@ DELIMITER ;| # reasonable time like 4 seconds. Till ~ 2 seconds could pass on a heavy # loaded testing box before something gets executed). # Detection of execution is via the records inserted by the event. ---echo Sleep till the first INSERT into events_test.event_log occured +--echo Sleep till the first INSERT into events_test.event_log occurred let $wait_timeout= 4; let $wait_condition= SELECT COUNT(*) > 0 FROM events_test.event_log; diff --git a/mysql-test/t/index_merge_myisam.test b/mysql-test/t/index_merge_myisam.test index 82d0474e28e..d265007431e 100644 --- a/mysql-test/t/index_merge_myisam.test +++ b/mysql-test/t/index_merge_myisam.test @@ -117,7 +117,7 @@ set optimizer_switch='default,index_merge_intersection=off'; explain select * from t1 where a=10 and b=10 or c=10; --echo This will switch to sort-union (intersection will be gone, too, ---echo thats a known limitation: +--echo that's a known limitation: set optimizer_switch='default,index_merge_union=off'; explain select * from t1 where a=10 and b=10 or c=10; diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 2697e3b9a5f..77e896c7c05 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -655,7 +655,7 @@ insert into t1 values (1); flush tables; # Open t2 and (implicitly) t1. select * from t2; -# Truncate t1, wich was not recognized as open without the bugfix. +# Truncate t1, which was not recognized as open without the bugfix. # After fix for Bug#8306 and before fix for Bug#26379, # it should fail with a table-in-use error message, otherwise succeed. truncate table t1; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index 8a9fd4ba91d..fd50896b71f 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -701,7 +701,7 @@ drop table t1; --echo # ---echo # Bug#15328 Segmentation fault occured if my.cnf is invalid for escape sequence +--echo # Bug#15328 Segmentation fault occurred if my.cnf is invalid for escape sequence --echo # --exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c index 06dfc9f2079..9e693209445 100644 --- a/mysys/mf_iocache2.c +++ b/mysys/mf_iocache2.c @@ -44,7 +44,7 @@ RETURN VALUE 0 All OK - 1 An error occured + 1 An error occurred */ int my_b_copy_to_file(IO_CACHE *cache, FILE *file) diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 16ac749fa09..0e7c43cc4c4 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -274,7 +274,7 @@ struct st_hash_link }; /* simple states of a block */ -#define BLOCK_ERROR 1 /* an error occured when performing file i/o */ +#define BLOCK_ERROR 1 /* an error occurred when performing file i/o */ #define BLOCK_READ 2 /* file block is in the block buffer */ #define BLOCK_IN_SWITCH 4 /* block is preparing to read new page */ #define BLOCK_REASSIGNED 8 /* blk does not accept requests for old page */ diff --git a/mysys/my_default.c b/mysys/my_default.c index d1fbcb8f865..0f9b70ca326 100644 --- a/mysys/my_default.c +++ b/mysys/my_default.c @@ -364,7 +364,7 @@ err: RETURN 0 - ok - 1 - error occured + 1 - error occurred */ static int handle_default_option(void *in_ctx, const char *group_name, diff --git a/mysys/my_delete.c b/mysys/my_delete.c index e99c7ff5fcb..3dfe290dabe 100644 --- a/mysys/my_delete.c +++ b/mysys/my_delete.c @@ -110,7 +110,7 @@ static int my_win_unlink(const char *name) if (handle != INVALID_HANDLE_VALUE) { /* - We opened file without sharing flags (exclusive), noone else has this file + We opened file without sharing flags (exclusive), no one else has this file opened, thus it is save to close handle to remove it. No renaming is necessary. */ diff --git a/mysys/my_lock.c b/mysys/my_lock.c index 0abbc6c3084..082d8e9f5a0 100644 --- a/mysys/my_lock.c +++ b/mysys/my_lock.c @@ -131,7 +131,7 @@ error: RETURN VALUE 0 Success - -1 An error has occured and 'my_errno' is set + -1 An error has occurred and 'my_errno' is set to indicate the actual error code. */ @@ -203,7 +203,7 @@ int my_lock(File fd, int locktype, my_off_t start, my_off_t length, == MY_FILEPOS_ERROR) { /* - If an error has occured in my_seek then we will already + If an error has occurred in my_seek then we will already have an error code in my_errno; Just return error code. */ DBUG_RETURN(-1); diff --git a/plugin/handler_socket/docs-en/perl-client.en.txt b/plugin/handler_socket/docs-en/perl-client.en.txt index 448d33b5f12..cc9138518ee 100644 --- a/plugin/handler_socket/docs-en/perl-client.en.txt +++ b/plugin/handler_socket/docs-en/perl-client.en.txt @@ -42,7 +42,7 @@ to be retrieved are specified by the 5th argument for the corresponding open_index call. The execute_single method always returns an arrayref. The first -element is the error code, which is 0 when no error is occured. +element is the error code, which is 0 when no error is occurred. The remaining are the field values. If more than one record is returned, it is flatten to an 1-dimensional array. For example, when 5 records that have 3 columns are returned, you can retrieve @@ -125,9 +125,9 @@ methods. die $hs->get_error() if $res->[0] != 0; ----------------------------------------------------------------- -When an error is occured, the first element of the returned +When an error is occurred, the first element of the returned arrayref becomes a non-zero value. A negative value indicates -that an I/O error is occured and the Net::HandlerSocket object +that an I/O error is occurred and the Net::HandlerSocket object should be disposed. A positive value means that the connection is still active and the Net::HandlerSocket object can be reused later. diff --git a/plugin/semisync/semisync_master.h b/plugin/semisync/semisync_master.h index 66fa176624b..e68795bcab4 100644 --- a/plugin/semisync/semisync_master.h +++ b/plugin/semisync/semisync_master.h @@ -102,7 +102,7 @@ public: it are in use. A new Block is allocated and is put into the rear of the Block link table if no Block is free. - @return Return a TranxNode *, or NULL if an error occured. + @return Return a TranxNode *, or NULL if an error occurred. */ TranxNode *allocate_node() { @@ -134,7 +134,7 @@ public: /** All nodes are freed. - @return Return 0, or 1 if an error occured. + @return Return 0, or 1 if an error occurred. */ int free_all_nodes() { @@ -150,7 +150,7 @@ public: @param node All nodes before 'node' will be freed - @return Return 0, or 1 if an error occured. + @return Return 0, or 1 if an error occurred. */ int free_nodes_before(TranxNode* node) { diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh index d8fd239585c..621e2b7fda9 100644 --- a/scripts/mysqlaccess.sh +++ b/scripts/mysqlaccess.sh @@ -441,7 +441,7 @@ use IPC::Open3; $DEBUG = 0; # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>8 -# Normaly nothing should be changed beneeth this line +# Normally nothing should be changed beneeth this line # **************************** @@ -2342,7 +2342,7 @@ BEGIN { ."of `$MySQLaccess::script'." ,'Access_denied' => "Sorry,\n" - ."An error occured when trying to connect to the database\n" + ."An error occurred when trying to connect to the database\n" ."with the grant-tables:\n" ."* Maybe YOU do not have READ-access to this database?\n" ."* If you used the -U option, you may have supplied an invalid username?\n" @@ -2352,24 +2352,24 @@ BEGIN { ."* If you used the -P option, you may have supplied an invalid password?\n" ,'Dbaccess_denied' => "Sorry,\n" - ."An error occured when trying to connect to the database\n" + ."An error occurred when trying to connect to the database\n" ."with the grant-tables. (dbaccess denied)\n" ,'Unknown_tmp_table' => "Sorry,\n" - ."An error occured when trying to work with the temporary tables in the database\n" + ."An error occurred when trying to work with the temporary tables in the database\n" ."with the grant-tables. (One of the temporary tables does not exist)\n" ,'Unknown_table' => "Sorry,\n" - ."An error occured when trying to work with some tables in the database\n" + ."An error occurred when trying to work with some tables in the database\n" ."with the grant-tables. (table does not exist)\n" ,'use_old_server' => "Sorry,\n" - ."An error occured when executing an SQL statement.\n" + ."An error occurred when executing an SQL statement.\n" ."You might consider altering the use of the parameter `--old_server' when \n" ."calling `$MySQLaccess::script'." ,'unknown_error' => "Sorry,\n" - ."An error occured when trying to connect to the database\n" + ."An error occurred when trying to connect to the database\n" ."with the grant-tables. (unknown error)\n" ,'anonymous_access' => "Accessing the db as an anonymous user.\n" diff --git a/sql-bench/bench-init.pl.sh b/sql-bench/bench-init.pl.sh index a46bb2d7a49..7bc7c23be66 100644 --- a/sql-bench/bench-init.pl.sh +++ b/sql-bench/bench-init.pl.sh @@ -265,7 +265,7 @@ sub fetch_all_rows if (!($sth= $dbh->prepare($query))) { print "\n" if ($opt_debug); - die "Error occured with prepare($query)\n -> $DBI::errstr\n"; + die "Error occurred with prepare($query)\n -> $DBI::errstr\n"; return undef; } if (!$sth->execute) @@ -282,7 +282,7 @@ sub fetch_all_rows print "0\n" if ($opt_debug); return 0; } - die "Error occured with execute($query)\n -> $DBI::errstr\n"; + die "Error occurred with execute($query)\n -> $DBI::errstr\n"; $sth->finish; return undef; } diff --git a/sql-common/client_plugin.c b/sql-common/client_plugin.c index 063fc5c6dc6..dd87b01d932 100644 --- a/sql-common/client_plugin.c +++ b/sql-common/client_plugin.c @@ -235,7 +235,7 @@ static void load_env_plugins(MYSQL *mysql) This function must be called before any other client plugin function. @retval 0 successful - @retval != 0 error occured + @retval != 0 error occurred */ int mysql_client_plugin_init() { diff --git a/sql-common/mysql_async.c b/sql-common/mysql_async.c index ef01f292180..80b4f390641 100644 --- a/sql-common/mysql_async.c +++ b/sql-common/mysql_async.c @@ -102,7 +102,7 @@ my_connect_async(struct mysql_async_context *b, my_socket fd, my_context_yield(&b->async_context); if (b->suspend_resume_hook) (*b->suspend_resume_hook)(FALSE, b->suspend_resume_hook_user_data); - if (b->events_occured & MYSQL_WAIT_TIMEOUT) + if (b->events_occurred & MYSQL_WAIT_TIMEOUT) return -1; s_err_size= sizeof(res); @@ -149,7 +149,7 @@ my_recv_async(struct mysql_async_context *b, int fd, my_context_yield(&b->async_context); if (b->suspend_resume_hook) (*b->suspend_resume_hook)(FALSE, b->suspend_resume_hook_user_data); - if (b->events_occured & MYSQL_WAIT_TIMEOUT) + if (b->events_occurred & MYSQL_WAIT_TIMEOUT) return -1; } } @@ -177,7 +177,7 @@ my_send_async(struct mysql_async_context *b, int fd, my_context_yield(&b->async_context); if (b->suspend_resume_hook) (*b->suspend_resume_hook)(FALSE, b->suspend_resume_hook_user_data); - if (b->events_occured & MYSQL_WAIT_TIMEOUT) + if (b->events_occurred & MYSQL_WAIT_TIMEOUT) return -1; } } @@ -210,7 +210,7 @@ my_io_wait_async(struct mysql_async_context *b, enum enum_vio_io_event event, my_context_yield(&b->async_context); if (b->suspend_resume_hook) (*b->suspend_resume_hook)(FALSE, b->suspend_resume_hook_user_data); - return (b->events_occured & MYSQL_WAIT_TIMEOUT) ? 0 : 1; + return (b->events_occurred & MYSQL_WAIT_TIMEOUT) ? 0 : 1; } @@ -349,7 +349,7 @@ mysql_get_timeout_value_ms(const MYSQL *mysql) } \ \ b->active= 1; \ - b->events_occured= ready_status; \ + b->events_occurred= ready_status; \ res= my_context_continue(&b->async_context); \ b->active= 0; \ if (res > 0) \ @@ -405,7 +405,7 @@ mysql_get_timeout_value_ms(const MYSQL *mysql) } \ \ b->active= 1; \ - b->events_occured= ready_status; \ + b->events_occurred= ready_status; \ res= my_context_continue(&b->async_context); \ b->active= 0; \ if (res > 0) \ diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index 30dffc30edd..6785b46d0da 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -938,7 +938,7 @@ end: @retval FALSE an event with such db/name key exists - @retval TRUE no record found or an error occured. + @retval TRUE no record found or an error occurred. */ bool diff --git a/sql/event_queue.cc b/sql/event_queue.cc index 35187af23ac..ae8ba258717 100644 --- a/sql/event_queue.cc +++ b/sql/event_queue.cc @@ -191,7 +191,7 @@ Event_queue::deinit_queue() @param[out] created set to TRUE if no error and the element is added to the queue, FALSE otherwise - @retval TRUE an error occured. The value of created is undefined, + @retval TRUE an error occurred. The value of created is undefined, the element was not deleted. @retval FALSE success */ diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index ed05521a473..1daf7f9b944 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -8123,7 +8123,7 @@ uint8 ha_ndbcluster::table_cache_type() @param[out] commit_count Commit count for the table. @return 0 on success. - @return 1 if an error occured. + @return 1 if an error occurred. */ uint ndb_get_commitcount(THD *thd, char *norm_name, diff --git a/sql/ha_ndbcluster_binlog.cc b/sql/ha_ndbcluster_binlog.cc index 64ae31ce231..6ee8fde3e42 100644 --- a/sql/ha_ndbcluster_binlog.cc +++ b/sql/ha_ndbcluster_binlog.cc @@ -3875,7 +3875,7 @@ restart: else if (ndb_latest_applied_binlog_epoch > 0) { sql_print_warning("NDB Binlog: cluster has reconnected. " - "Changes to the database that occured while " + "Changes to the database that occurred while " "disconnected will not be in the binlog"); } if (opt_ndb_extra_logging) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index e59954e13c2..69cc78588a8 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -8307,7 +8307,7 @@ bool ha_partition::inplace_alter_table(TABLE *altered_table, /* Note that this function will try rollback failed ADD INDEX by executing DROP INDEX for the indexes that were committed (if any) - before the error occured. This means that the underlying storage + before the error occurred. This means that the underlying storage engine must be able to drop index in-place with X-lock held. (As X-lock will be held here if new indexes are to be committed) */ diff --git a/sql/handler.cc b/sql/handler.cc index 51a608304aa..9b217c60100 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -313,7 +313,7 @@ int ha_init_errors(void) /* Set the dedicated error messages. */ SETMSG(HA_ERR_KEY_NOT_FOUND, ER_DEFAULT(ER_KEY_NOT_FOUND)); SETMSG(HA_ERR_FOUND_DUPP_KEY, ER_DEFAULT(ER_DUP_KEY)); - SETMSG(HA_ERR_RECORD_CHANGED, "Update wich is recoverable"); + SETMSG(HA_ERR_RECORD_CHANGED, "Update which is recoverable"); SETMSG(HA_ERR_WRONG_INDEX, "Wrong index given to function"); SETMSG(HA_ERR_CRASHED, ER_DEFAULT(ER_NOT_KEYFILE)); SETMSG(HA_ERR_WRONG_IN_RECORD, ER_DEFAULT(ER_CRASHED_ON_USAGE)); diff --git a/sql/handler.h b/sql/handler.h index 2e219d5f3cc..e3dcf4fa63a 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -3502,7 +3502,7 @@ public: *) a) If the previous step succeeds, handler::ha_commit_inplace_alter_table() is called to allow the storage engine to do any final updates to its structures, to make all earlier changes durable and visible to other connections. - b) If we have failed to upgrade lock or any errors have occured during the + b) If we have failed to upgrade lock or any errors have occurred during the handler functions calls (including commit), we call handler::ha_commit_inplace_alter_table() to rollback all changes which were done during previous steps. diff --git a/sql/item.cc b/sql/item.cc index bed8824f68f..d9d1409572c 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -4752,7 +4752,7 @@ bool is_outer_table(TABLE_LIST *table, SELECT_LEX *select) @retval 0 column fully fixed and fix_fields() should return FALSE @retval - -1 error occured + -1 error occurred */ int @@ -6703,7 +6703,7 @@ void Item_field::update_null_value() UPDATE statement. RETURN - 0 if error occured + 0 if error occurred ref if all conditions are met this field otherwise */ diff --git a/sql/item.h b/sql/item.h index 4347bdb6c07..b45faaf45ce 100644 --- a/sql/item.h +++ b/sql/item.h @@ -523,7 +523,7 @@ public: RETURN FALSE if parameter value has been set, - TRUE if error has occured. + TRUE if error has occurred. */ virtual bool set_value(THD *thd, sp_rcontext *ctx, Item **it)= 0; @@ -2513,7 +2513,7 @@ public: /* If value for parameter was not set we treat it as non-const - so noone will use parameters value in fix_fields still + so no one will use parameters value in fix_fields still parameter is constant during execution. */ virtual table_map used_tables() const diff --git a/sql/item_func.cc b/sql/item_func.cc index f597bf73617..6c205b6afa7 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -227,7 +227,7 @@ Item_func::fix_fields(THD *thd, Item **ref) } } fix_length_and_dec(); - if (thd->is_error()) // An error inside fix_length_and_dec occured + if (thd->is_error()) // An error inside fix_length_and_dec occurred return TRUE; fixed= 1; return FALSE; @@ -5639,7 +5639,7 @@ void Item_func_get_user_var::fix_length_and_dec() /* If the variable didn't exist it has been created as a STRING-type. - 'var_entry' is NULL only if there occured an error during the call to + 'var_entry' is NULL only if there occurred an error during the call to get_var_with_binlog. */ if (!error && var_entry) diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 7d361263548..5070fc5a646 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -5854,7 +5854,7 @@ int subselect_partial_match_engine::exec() /* Search for a complete match. */ if ((lookup_res= lookup_engine->index_lookup())) { - /* An error occured during lookup(). */ + /* An error occurred during lookup(). */ item_in->value= 0; item_in->null_value= 0; return lookup_res; diff --git a/sql/log.cc b/sql/log.cc index f8c9b6991cd..efc3b120437 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -628,7 +628,7 @@ void Log_to_csv_event_handler::cleanup() indicated in the return value. @retval FALSE OK - @retval TRUE error occured + @retval TRUE error occurred */ bool Log_to_csv_event_handler:: @@ -793,7 +793,7 @@ err: RETURN FALSE - OK - TRUE - error occured + TRUE - error occurred */ bool Log_to_csv_event_handler:: @@ -1098,7 +1098,7 @@ void Log_to_file_event_handler::flush() RETURN FALSE - OK - TRUE - error occured + TRUE - error occurred */ bool LOGGER::error_log_print(enum loglevel level, const char *format, @@ -1256,7 +1256,7 @@ bool LOGGER::flush_general_log() RETURN FALSE OK - TRUE error occured + TRUE error occurred */ bool LOGGER::slow_log_print(THD *thd, const char *query, uint query_length, @@ -2752,7 +2752,7 @@ void MYSQL_QUERY_LOG::reopen_file() RETURN FASE - OK - TRUE - error occured + TRUE - error occurred */ bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host, @@ -2854,7 +2854,7 @@ err: RETURN FALSE - OK - TRUE - error occured + TRUE - error occurred */ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, @@ -6130,7 +6130,7 @@ binlog_checkpoint_callback(void *cookie) /* For every supporting engine, we increment the xid_count and issue a commit_checkpoint_request(). Then we can count when all - commit_checkpoint_notify() callbacks have occured, and then log a new + commit_checkpoint_notify() callbacks have occurred, and then log a new binlog checkpoint event. */ mysql_bin_log.mark_xids_active(entry->binlog_id, 1); diff --git a/sql/log_event.cc b/sql/log_event.cc index 40da25dd62f..30634c4e73b 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1348,9 +1348,9 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet, if (packet->append(file, data_len)) { /* - Fatal error occured when appending rest of the event + Fatal error occurred when appending rest of the event to packet, possible failures: - 1. EOF occured when reading from file, it's really an error + 1. EOF occurred when reading from file, it's really an error as data_len is >=0 there's supposed to be more bytes available. file->error will have been set to number of bytes left to read 2. Read was interrupted, file->error would normally be set to -1 diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index e6c05aeb849..ad68275a274 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -249,7 +249,7 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, rpl_group_info *rgi) } if (error) - { /* error has occured during the transaction */ + { /* error has occurred during the transaction */ rli->report(ERROR_LEVEL, ev_thd->get_stmt_da()->sql_errno(), NULL, "Error in %s event: error during transaction execution " "on table %s.%s. %s", @@ -1690,7 +1690,7 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi) } // if (table) if (error) - { /* error has occured during the transaction */ + { /* error has occurred during the transaction */ rli->report(ERROR_LEVEL, thd->net.last_errno, NULL, "Error in %s event: error during transaction execution " "on table %s.%s. %s", diff --git a/sql/my_apc.cc b/sql/my_apc.cc index 17660688be0..0b9fe9899b9 100644 --- a/sql/my_apc.cc +++ b/sql/my_apc.cc @@ -158,7 +158,7 @@ void init_show_explain_psi_keys(void) @retval FALSE - Ok, the call has been made @retval TRUE - Call wasnt made (either the target is in disabled state or - timeout occured) + timeout occurred) */ bool Apc_target::make_apc_call(THD *caller_thd, Apc_call *call, diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index b2e957a3e6e..98712f18c1b 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -698,7 +698,7 @@ do_retry: thd->clear_error(); /* - If we retry due to a deadlock kill that occured during the commit step, we + If we retry due to a deadlock kill that occurred during the commit step, we might have already updated (but not committed) an update of table mysql.gtid_slave_pos, and cleared the gtid_pending flag. Now we have rolled back any such update, so we must set the gtid_pending flag back to @@ -1100,7 +1100,7 @@ handle_rpl_parallel_thread(void *arg) /* Register ourself to wait for the previous commit, if we need to do such registration _and_ that previous commit has not already - occured. + occurred. */ register_wait_for_prior_event_group_commit(rgi, entry); @@ -1149,7 +1149,7 @@ handle_rpl_parallel_thread(void *arg) { /* Do an extra check for (deadlock) kill here. This helps prevent a - lingering deadlock kill that occured during normal DML processing to + lingering deadlock kill that occurred during normal DML processing to propagate past the mark_start_commit(). If we detect a deadlock only after mark_start_commit(), we have to unmark, which has at least a theoretical possibility of leaving a window where it looks like all diff --git a/sql/rpl_parallel.h b/sql/rpl_parallel.h index 3012daa8763..a02c1af3b3e 100644 --- a/sql/rpl_parallel.h +++ b/sql/rpl_parallel.h @@ -296,7 +296,7 @@ struct rpl_parallel_entry { group here. Then later event groups (with higher sub_id) can know not to try to start (event groups that already started will be rolled back when wait_for_prior_commit() returns error). - The value is ULONGLONG_MAX when no error occured. + The value is ULONGLONG_MAX when no error occurred. */ uint64 stop_on_error_sub_id; /* diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 4394e796a1a..627f54631a3 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -6035,7 +6035,7 @@ ER_EVENT_CANNOT_ALTER_IN_THE_PAST eng "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." ger "Execution Zeitpunkt des Ereignisses in der Vergangenheit liegt, und es war NACH ABSCHLUSS Set nicht erhalten. Die Veranstaltung wurde nicht verändert. Geben Sie einen Zeitpunkt in der Zukunft." ER_SLAVE_INCIDENT - eng "The incident %s occured on the master. Message: %-.64s" + eng "The incident %s occurred on the master. Message: %-.64s" ger "Der Vorfall %s passierte auf dem Master. Meldung: %-.64s" ER_NO_PARTITION_FOR_GIVEN_VALUE_SILENT eng "Table has no partition for some existing values" diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 3fadbcd088f..4591d379777 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -216,7 +216,7 @@ extern "C" sig_handler handle_fatal_signal(int sig) if (calling_initgroups) { my_safe_printf_stderr("%s", "\n" - "This crash occured while the server was calling initgroups(). This is\n" + "This crash occurred while the server was calling initgroups(). This is\n" "often due to the use of a mysqld that is statically linked against \n" "glibc and configured to use LDAP in /etc/nsswitch.conf.\n" "You will need to either upgrade to a version of glibc that does not\n" diff --git a/sql/sp_head.h b/sql/sp_head.h index dbdb957aa79..71a64d9a5af 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -608,7 +608,7 @@ public: instruction for CONTINUE error handlers. @retval 0 on success, - @retval other if some error occured + @retval other if some error occurred */ virtual int execute(THD *thd, uint *nextp) = 0; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 63d7d7a0399..a70afe4fca9 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -9895,7 +9895,7 @@ bool sp_revoke_privileges(THD *thd, const char *sp_db, const char *sp_name, @return @retval FALSE Success - @retval TRUE An error occured. Error message not yet sent. + @retval TRUE An error occurred. Error message not yet sent. */ bool sp_grant_privileges(THD *thd, const char *sp_db, const char *sp_name, diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 01878d57b13..fc1d716667e 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8531,7 +8531,7 @@ bool setup_on_expr(THD *thd, TABLE_LIST *table, bool is_update) TODO RETURN - TRUE if some error occured (e.g. out of memory) + TRUE if some error occurred (e.g. out of memory) FALSE if all is OK */ @@ -8641,7 +8641,7 @@ err_no_arena: function. @return Status - @retval true An error occured. + @retval true An error occurred. @retval false OK. */ @@ -8749,7 +8749,7 @@ err: record[1] buffers correspond to new and old versions of row respectively. @return Status - @retval true An error occured. + @retval true An error occurred. @retval false OK. */ @@ -8805,7 +8805,7 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, List &fields, function. @return Status - @retval true An error occured. + @retval true An error occurred. @retval false OK. */ @@ -8897,7 +8897,7 @@ err: record[1] buffers correspond to new and old versions of row respectively. @return Status - @retval true An error occured. + @retval true An error occurred. @retval false OK. */ diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc index 254b7026e96..f701c424f63 100644 --- a/sql/sql_join_cache.cc +++ b/sql/sql_join_cache.cc @@ -2206,7 +2206,7 @@ finish: for a match for any record from join_tab. To iterate over the candidates for a match the virtual function get_next_candidate_for_match is used, while the virtual function prepare_look_for_matches is called to prepare - for such iteration proccess. + for such iteration process. NOTES The function produces all matching extensions for the records in the diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 6ba384e93a0..019231e2004 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -590,7 +590,7 @@ public: global parameters for union */ st_select_lex *global_parameters; - //node on wich we should return current_select pointer after parsing subquery + //node on which we should return current_select pointer after parsing subquery st_select_lex *return_to; /* LIMIT clause runtime counters */ ha_rows select_limit_cnt, offset_limit_cnt; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 8373ddabe3c..d2fed787ba9 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -7306,7 +7306,7 @@ bool st_select_lex_unit::add_fake_select_lex(THD *thd_arg) @retval FALSE if all is OK @retval - TRUE if a memory allocation error occured + TRUE if a memory allocation error occurred */ bool diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index ec7cdc4852b..5fe30f21b32 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1820,7 +1820,7 @@ static bool mysql_test_create_table(Prepared_statement *stmt) @note This function handles create view commands. @retval FALSE Operation was a success. - @retval TRUE An error occured. + @retval TRUE An error occurred. */ static bool mysql_test_create_view(Prepared_statement *stmt) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index cceab00ac60..4505ad69880 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -3078,7 +3078,7 @@ int reset_slave(THD *thd, Master_info* mi) char fname[FN_REFLEN]; int thread_mask= 0, error= 0; uint sql_errno=ER_UNKNOWN_ERROR; - const char* errmsg= "Unknown error occured while reseting slave"; + const char* errmsg= "Unknown error occurred while reseting slave"; char master_info_file_tmp[FN_REFLEN]; char relay_log_info_file_tmp[FN_REFLEN]; DBUG_ENTER("reset_slave"); @@ -3660,7 +3660,7 @@ bool mysql_show_binlog_events(THD* thd) DBUG_ASSERT(thd->lex->sql_command == SQLCOM_SHOW_BINLOG_EVENTS || thd->lex->sql_command == SQLCOM_SHOW_RELAYLOG_EVENTS); - /* select wich binary log to use: binlog or relay */ + /* select which binary log to use: binlog or relay */ if ( thd->lex->sql_command == SQLCOM_SHOW_BINLOG_EVENTS ) { /* diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 514ba947172..28f59047b43 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -443,7 +443,7 @@ bool handle_select(THD *thd, LEX *lex, select_result *result, this field from inner subqueries. @return Status - @retval true An error occured. + @retval true An error occurred. @retval false OK. */ @@ -12702,7 +12702,7 @@ static bool check_equality(THD *thd, Item *item, COND_EQUAL *cond_equal, equality predicates that is equivalent to the conjunction. Thus, =(a1,a2,a3) can substitute for ((a1=a3) AND (a2=a3) AND (a2=a1)) as it is equivalent to ((a1=a2) AND (a2=a3)). - The function always makes a substitution of all equality predicates occured + The function always makes a substitution of all equality predicates occurred in a conjuction for a minimal set of multiple equality predicates. This set can be considered as a canonical representation of the sub-conjunction of the equality predicates. @@ -21380,7 +21380,7 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, select_item= find_item_in_list(order_item, fields, &counter, REPORT_EXCEPT_NOT_FOUND, &resolution); if (!select_item) - return TRUE; /* The item is not unique, or some other error occured. */ + return TRUE; /* The item is not unique, or some other error occurred. */ /* Check whether the resolved field is not ambiguos. */ @@ -24736,7 +24736,7 @@ void JOIN::restore_query_plan(Join_plan_state *restore_from) @retval REOPT_NEW_PLAN there is a new plan. @retval REOPT_OLD_PLAN no new improved plan was produced, use the old one. - @retval REOPT_ERROR an irrecovarable error occured during reoptimization. + @retval REOPT_ERROR an irrecovarable error occurred during reoptimization. */ JOIN::enum_reopt_result diff --git a/sql/sql_select.h b/sql/sql_select.h index 18a649bc47a..cbad287c5e5 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -908,7 +908,7 @@ protected: enum enum_reopt_result { REOPT_NEW_PLAN, /* there is a new reoptimized plan */ REOPT_OLD_PLAN, /* no new improved plan can be found, use the old one */ - REOPT_ERROR, /* an irrecovarable error occured during reoptimization */ + REOPT_ERROR, /* an irrecovarable error occurred during reoptimization */ REOPT_NONE /* not yet reoptimized */ }; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index f4c2424f65d..b8926b986b0 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -4448,7 +4448,7 @@ uint get_table_open_method(TABLE_LIST *tables, @retval FALSE No error, if lock was obtained TABLE_LIST::mdl_request::ticket is set to non-NULL value. - @retval TRUE Some error occured (probably thread was killed). + @retval TRUE Some error occurred (probably thread was killed). */ static bool @@ -4556,7 +4556,7 @@ static int fill_schema_table_from_frm(THD *thd, TABLE_LIST *tables, if (try_acquire_high_prio_shared_mdl_lock(thd, &table_list, can_deadlock)) { /* - Some error occured (most probably we have been killed while + Some error occurred (most probably we have been killed while waiting for conflicting locks to go away), let the caller to handle the situation. */ diff --git a/sql/sql_string.cc b/sql/sql_string.cc index a7bfa6c1455..b94bd6a0175 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -76,9 +76,9 @@ bool String::real_alloc(uint32 length) @retval false Either the copy operation is complete or, if the size of the new buffer is smaller than the currently allocated buffer (if one exists), - no allocation occured. + no allocation occurred. - @retval true An error occured when attempting to allocate memory. + @retval true An error occurred when attempting to allocate memory. */ bool String::realloc_raw(uint32 alloc_length) { diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index a59bbb5bc61..198f414eb85 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -2232,7 +2232,7 @@ void Table_triggers_list::mark_fields_used(trg_event_type event) /** - Signals to the Table_triggers_list that a parse error has occured when + Signals to the Table_triggers_list that a parse error has occurred when reading a trigger from file. This makes the Table_triggers_list enter an error state flagged by m_has_unparseable_trigger == true. The error message will be used whenever a statement invoking or manipulating triggers is diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 1220c39cf85..a59e635afaa 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -2552,7 +2552,7 @@ bool multi_update::send_eof() if (local_error > 0) // if the above log write did not fail ... { /* Safety: If we haven't got an error before (can happen in do_updates) */ - my_message(ER_UNKNOWN_ERROR, "An error occured in multi-table update", + my_message(ER_UNKNOWN_ERROR, "An error occurred in multi-table update", MYF(0)); DBUG_RETURN(TRUE); } diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 0d88b3a1eda..f3717e3ded2 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -245,7 +245,7 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view) @param mode VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE @retval FALSE Operation was a success. - @retval TRUE An error occured. + @retval TRUE An error occurred. */ bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view, @@ -388,7 +388,7 @@ bool create_view_precheck(THD *thd, TABLE_LIST *tables, TABLE_LIST *view, @note This function handles both create and alter view commands. @retval FALSE Operation was a success. - @retval TRUE An error occured. + @retval TRUE An error occurred. */ bool mysql_create_view(THD *thd, TABLE_LIST *views, diff --git a/sql/threadpool_win.cc b/sql/threadpool_win.cc index 4be51f3d6e9..8ae3252caa3 100644 --- a/sql/threadpool_win.cc +++ b/sql/threadpool_win.cc @@ -388,7 +388,7 @@ int start_io(connection_t *connection, PTP_CALLBACK_INSTANCE instance) return 0; } - /* Some error occured */ + /* Some error occurred */ CancelThreadpoolIo(io); return -1; } @@ -575,7 +575,7 @@ static VOID CALLBACK io_completion_callback(PTP_CALLBACK_INSTANCE instance, return; error: - /* Some error has occured. */ + /* Some error has occurred. */ destroy_connection(connection, instance); free(connection); diff --git a/sql/tztime.cc b/sql/tztime.cc index 9791e218108..75b732f4436 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -309,7 +309,7 @@ tz_load(const char *name, TIME_ZONE_INFO *sp, MEM_ROOT *storage) Note: See description of TIME_to_gmt_sec() function first. In order to perform MYSQL_TIME -> my_time_t conversion we need to build table which defines "shifted by tz offset and leap seconds my_time_t" -> - my_time_t function wich is almost the same (except ranges of ambiguity) + my_time_t function which is almost the same (except ranges of ambiguity) as reverse function to piecewise linear function used for my_time_t -> "shifted my_time_t" conversion and which is also specified as table in zoneinfo file or in our db (It is specified as start of time type ranges @@ -614,7 +614,7 @@ sec_to_TIME(MYSQL_TIME * tmp, my_time_t t, long offset) /* - Find time range wich contains given my_time_t value + Find time range which contains given my_time_t value SYNOPSIS find_time_range() @@ -710,7 +710,7 @@ find_transition_type(my_time_t t, const TIME_ZONE_INFO *sp) TODO We can improve this function by creating joined array of transitions and leap corrections. This will require adding extra field to TRAN_TYPE_INFO - for storing number of "extra" seconds to minute occured due to correction + for storing number of "extra" seconds to minute occurred due to correction (60th and 61st second, look how we calculate them as "hit" in this function). Under realistic assumptions about frequency of transitions the same array @@ -2763,7 +2763,7 @@ main(int argc, char **argv) #ifdef TESTTIME /* - Some simple brute-force test wich allowed to catch a pair of bugs. + Some simple brute-force test which allowed to catch a pair of bugs. Also can provide interesting facts about system's time zone support implementation. */ diff --git a/storage/archive/ha_archive.cc b/storage/archive/ha_archive.cc index c1acef4596f..00f3adb07ee 100644 --- a/storage/archive/ha_archive.cc +++ b/storage/archive/ha_archive.cc @@ -56,7 +56,7 @@ meta file is first opened it is marked as dirty. It is opened when the table itself is opened for writing. When the table is closed the new count for rows is written to the meta file and the file is marked as clean. If the meta file - is opened and it is marked as dirty, it is assumed that a crash occured. At + is opened and it is marked as dirty, it is assumed that a crash occurred. At this point an error occurs and the user is told to rebuild the file. A rebuild scans the rows and rewrites the meta file. If corruption is found in the data file then the meta file is not repaired. diff --git a/storage/connect/plgcnx.h b/storage/connect/plgcnx.h index a1208f9b885..1b341bc5275 100644 --- a/storage/connect/plgcnx.h +++ b/storage/connect/plgcnx.h @@ -25,7 +25,7 @@ enum FNRC {RC_LICENSE = 7, /* PLGConnect prompt for license key */ RC_SUCCESS = 0, /* Successful function (must be 0) */ RC_MEMORY = -1, /* Storage allocation error */ RC_TRUNCATED = -2, /* Result has been truncated */ - RC_TIMEOUT = -3, /* Connection timeout occured */ + RC_TIMEOUT = -3, /* Connection timeout occurred */ RC_TOOBIG = -4, /* Data is too big for connection */ RC_KEY = -5, /* Null ptr to key in Connect */ /* or bad key in other functions */ diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp index 7906f6c9219..98633f49d23 100644 --- a/storage/connect/tabdos.cpp +++ b/storage/connect/tabdos.cpp @@ -184,7 +184,7 @@ bool DOSDEF::GetOptFileName(PGLOBAL g, char *filename) } // end of GetOptFileName /***********************************************************************/ -/* After an optimize error occured, remove all set optimize values. */ +/* After an optimize error occurred, remove all set optimize values. */ /***********************************************************************/ void DOSDEF::RemoveOptValues(PGLOBAL g) { diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index 5a8bb17bd50..98887269c2e 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -806,7 +806,7 @@ int TDBMYSQL::GetMaxSize(PGLOBAL g) else if (!Cardinality(NULL)) MaxSize = 10; // To make MySQL happy else if ((MaxSize = Cardinality(g)) < 0) - MaxSize = 12; // So we can see an error occured + MaxSize = 12; // So we can see an error occurred } // endif MaxSize diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index fd9a049a05a..2c039c97a30 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -818,7 +818,7 @@ int TDBODBC::GetMaxSize(PGLOBAL g) else if (!Cardinality(NULL)) MaxSize = 10; // To make MySQL happy else if ((MaxSize = Cardinality(g)) < 0) - MaxSize = 12; // So we can see an error occured + MaxSize = 12; // So we can see an error occurred } // endif MaxSize diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp index f9597cb842b..80a694bfc26 100644 --- a/storage/connect/value.cpp +++ b/storage/connect/value.cpp @@ -989,7 +989,7 @@ uchar TYPVAL::MinMaxVal(bool b) {return (b) ? UINT_MAX8 : 0;} /***********************************************************************/ -/* SafeAdd: adds a value and test whether overflow/underflow occured. */ +/* SafeAdd: adds a value and test whether overflow/underflow occurred. */ /***********************************************************************/ template TYPE TYPVAL::SafeAdd(TYPE n1, TYPE n2) @@ -1017,7 +1017,7 @@ inline double TYPVAL::SafeAdd(double n1, double n2) } // end of SafeAdd /***********************************************************************/ -/* SafeMult: multiply values and test whether overflow occured. */ +/* SafeMult: multiply values and test whether overflow occurred. */ /***********************************************************************/ template TYPE TYPVAL::SafeMult(TYPE n1, TYPE n2) diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index 000b46b2bb2..127c6053a53 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -71,7 +71,7 @@ class ha_tina: public handler File update_temp_file; String buffer; /* - The chain contains "holes" in the file, occured because of + The chain contains "holes" in the file, occurred because of deletes/updates. It is used in rnd_end() to get rid of them in the end of the query. */ diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 4ea91dd9e68..97baa27aba6 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -2016,7 +2016,7 @@ void ha_federated::start_bulk_insert(ha_rows rows, uint flags) @return Operation status @retval 0 No error - @retval != 0 Error occured at remote server. Also sets my_errno. + @retval != 0 Error occurred at remote server. Also sets my_errno. */ int ha_federated::end_bulk_insert() diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index 132cccc9c0f..9ee9a8d030f 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -2157,7 +2157,7 @@ void ha_federatedx::start_bulk_insert(ha_rows rows, uint flags) @return Operation status @retval 0 No error - @retval != 0 Error occured at remote server. Also sets my_errno. + @retval != 0 Error occurred at remote server. Also sets my_errno. */ int ha_federatedx::end_bulk_insert() diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index 2a0aa4daf12..00b3b4682c3 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -598,7 +598,7 @@ fts_zip_read_word( /* Finished decompressing block. */ if (zip->zp->avail_in == 0) { - /* Free the block thats been decompressed. */ + /* Free the block that's been decompressed. */ if (zip->pos > 0) { ulint prev = zip->pos - 1; diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index c5ba4280c17..1c8861154ad 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -2677,7 +2677,7 @@ try_again: "Error in system call pread(). The operating" " system error number is %lu.",(ulint) errno); } else { - /* Partial read occured */ + /* Partial read occurred */ ib_logf(IB_LOG_LEVEL_ERROR, "Tried to read " ULINTPF " bytes at offset " UINT64PF ". Was only able to read %ld.", @@ -2808,7 +2808,7 @@ try_again: "Error in system call pread(). The operating" " system error number is %lu.",(ulint) errno); } else { - /* Partial read occured */ + /* Partial read occurred */ ib_logf(IB_LOG_LEVEL_ERROR, "Tried to read " ULINTPF " bytes at offset " UINT64PF ". Was only able to read %ld.", diff --git a/storage/maria/ma_packrec.c b/storage/maria/ma_packrec.c index a541a657ed2..6a4e7ea99cf 100644 --- a/storage/maria/ma_packrec.c +++ b/storage/maria/ma_packrec.c @@ -1204,7 +1204,7 @@ static void decode_bytes(MARIA_COLUMNDEF *rec,MARIA_BIT_BUFF *bit_buff, /* This means that the Huffman code must be longer than table_bits. */ pos=decode_tree->table+low_byte; bits-=table_bits; - /* NOTE: decode_bytes_test_bit() is a macro wich contains a break !!! */ + /* NOTE: decode_bytes_test_bit() is a macro which contains a break !!! */ for (;;) { low_byte=(uint) (bit_buff->current_byte >> (bits-8)); diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 2fe519da794..d97aa503d42 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -2405,7 +2405,7 @@ maria_declare_plugin_end; @return The error code. The engine_data and engine_callback will be set to 0. @retval TRUE Success - @retval FALSE An error occured + @retval FALSE An error occurred */ my_bool ha_myisam::register_query_cache_table(THD *thd, char *table_name, diff --git a/storage/myisam/mi_packrec.c b/storage/myisam/mi_packrec.c index d1ad911d334..eeadb70ae81 100644 --- a/storage/myisam/mi_packrec.c +++ b/storage/myisam/mi_packrec.c @@ -1158,7 +1158,7 @@ static void decode_bytes(MI_COLUMNDEF *rec,MI_BIT_BUFF *bit_buff,uchar *to, /* This means that the Huffman code must be longer than table_bits. */ pos=decode_tree->table+low_byte; bits-=table_bits; - /* NOTE: decode_bytes_test_bit() is a macro wich contains a break !!! */ + /* NOTE: decode_bytes_test_bit() is a macro which contains a break !!! */ for (;;) { low_byte=(uint) (bit_buff->current_byte >> (bits-8)); diff --git a/storage/myisam/myisamlog.c b/storage/myisam/myisamlog.c index d549dd76037..7ce03ca9485 100644 --- a/storage/myisam/myisamlog.c +++ b/storage/myisam/myisamlog.c @@ -266,7 +266,7 @@ static void get_options(register int *argc, register char ***argv) puts(" -u \"update\" -v \"verbose\" -w \"write file\""); puts(" -D \"myisam compiled with DBUG\" -P \"processes\""); puts("\nOne can give a second and a third '-v' for more verbose."); - puts("Normaly one does a update (-u)."); + puts("Normally one does a update (-u)."); puts("If a recover is done all writes and all possibly updates and deletes is done\nand errors are only counted."); puts("If one gives table names as arguments only these tables will be updated\n"); help=1; diff --git a/storage/ndb/include/ndbapi/NdbEventOperation.hpp b/storage/ndb/include/ndbapi/NdbEventOperation.hpp index 5f41f30a38b..62a85bb3149 100644 --- a/storage/ndb/include/ndbapi/NdbEventOperation.hpp +++ b/storage/ndb/include/ndbapi/NdbEventOperation.hpp @@ -34,7 +34,7 @@ class NdbEventOperationImpl; * Ndb::createEventOperation() * - execute() starts the event flow. Use Ndb::pollEvents() to wait * for an event to occur. Use Ndb::nextEvent() to iterate - * through the events that have occured. + * through the events that have occurred. * - The instance is removed by Ndb::dropEventOperation() * * For more info see: @@ -63,7 +63,7 @@ class NdbEventOperationImpl; * - Event code does not check table schema version. Make sure to drop events * after table is dropped. Will be fixed in later * versions. - * - If a node failure has occured not all events will be recieved + * - If a node failure has occurred not all events will be recieved * anymore. Drop NdbEventOperation and Create again after nodes are up * again. Will be fixed in later versions. * @@ -167,7 +167,7 @@ public: bool isConsistent() const; /** - * Query for occured event type. + * Query for occurred event type. * * @note Only valid after Ndb::nextEvent() has been called and * returned a not NULL value diff --git a/storage/ndb/include/ndbapi/NdbOperation.hpp b/storage/ndb/include/ndbapi/NdbOperation.hpp index 9049c8cdd22..9b2b2f92818 100644 --- a/storage/ndb/include/ndbapi/NdbOperation.hpp +++ b/storage/ndb/include/ndbapi/NdbOperation.hpp @@ -761,9 +761,9 @@ public: const NdbError & getNdbError() const; /** - * Get the method number where the error occured. + * Get the method number where the error occurred. * - * @return method number where the error occured. + * @return method number where the error occurred. */ int getNdbErrorLine(); diff --git a/storage/ndb/include/ndbapi/NdbTransaction.hpp b/storage/ndb/include/ndbapi/NdbTransaction.hpp index f3eea49d19d..b11ce87e680 100644 --- a/storage/ndb/include/ndbapi/NdbTransaction.hpp +++ b/storage/ndb/include/ndbapi/NdbTransaction.hpp @@ -521,9 +521,9 @@ public: NdbOperation* getNdbErrorOperation(); /** - * Get the method number where the latest error occured. + * Get the method number where the latest error occurred. * - * @return Line number where latest error occured. + * @return Line number where latest error occurred. */ int getNdbErrorLine(); diff --git a/storage/ndb/include/newtonapi/dba.h b/storage/ndb/include/newtonapi/dba.h index b02a7abb8af..c38545c9ec8 100644 --- a/storage/ndb/include/newtonapi/dba.h +++ b/storage/ndb/include/newtonapi/dba.h @@ -124,7 +124,7 @@ typedef enum { DBA_SCHEMA_ERROR = 4, /**< Table already exists */ DBA_INSUFFICIENT_SPACE = 5, /**< The DB is full */ - DBA_TEMPORARY_ERROR = 6, /**< Some temporary problem occured */ + DBA_TEMPORARY_ERROR = 6, /**< Some temporary problem occurred */ DBA_TIMEOUT = 7, /**< The request timed out, probably due to dead-lock */ DBA_OVERLOAD = 8, /**< The DB is overloaded */ diff --git a/storage/ndb/src/cw/cpcd/CPCD.hpp b/storage/ndb/src/cw/cpcd/CPCD.hpp index 3c2934c0f49..38c498f3b67 100644 --- a/storage/ndb/src/cw/cpcd/CPCD.hpp +++ b/storage/ndb/src/cw/cpcd/CPCD.hpp @@ -148,7 +148,7 @@ public: * * @return * - 0 if successful - - -1 and sets errno if an error occured + - -1 and sets errno if an error occurred */ int writePid(int pid); @@ -308,7 +308,7 @@ public: * - true if the addition was successful, * - false if not * - RequestStatus will be filled in with a suitable error - * if an error occured. + * if an error occurred. */ bool defineProcess(RequestStatus *rs, Process * arg); @@ -320,7 +320,7 @@ public: * - true if the removal was successful, * - false if not * - The RequestStatus will be filled in with a suitable error - * if an error occured. + * if an error occurred. */ bool undefineProcess(RequestStatus *rs, int id); @@ -334,7 +334,7 @@ public: * - true if the marking was successful * - false if not * - RequestStatus will be filled in with a suitable error - * if an error occured. + * if an error occurred. */ bool startProcess(RequestStatus *rs, int id); @@ -344,7 +344,7 @@ public: * - true if the marking was successful * - false if not * - The RequestStatus will be filled in with a suitable error - * if an error occured. + * if an error occurred. */ bool stopProcess(RequestStatus *rs, int id); diff --git a/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp b/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp index da614b0276c..e63d7e523b9 100644 --- a/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp +++ b/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp @@ -8107,7 +8107,7 @@ void Dbacc::seizeOverRec(Signal* signal) { /** - * A ZPAGESIZE_ERROR has occured, out of index pages + * A ZPAGESIZE_ERROR has occurred, out of index pages * Print some debug info if debug compiled */ void Dbacc::zpagesize_error(const char* where){ diff --git a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp index e0e0a496e0a..c80e1455b31 100644 --- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp +++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp @@ -10860,7 +10860,7 @@ Dbdict::execSUB_REMOVE_REF(Signal* signal) OpSubEventPtr subbPtr; c_opSubEvent.getPtr(subbPtr, ref->senderData); if (err == 1407) { - // conf this since this may occur if a nodefailure has occured + // conf this since this may occur if a nodefailure has occurred // earlier so that the systable was not cleared SubRemoveConf* conf = (SubRemoveConf*) signal->getDataPtrSend(); conf->senderRef = reference(); diff --git a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp index f4b0e07854c..419725b3487 100644 --- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp +++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp @@ -6941,7 +6941,7 @@ void Dbtc::execSCAN_HBREP(Signal* signal) }//execSCAN_HBREP() /*--------------------------------------------------------------------------*/ -/* Timeout has occured on a fragment which means a scan has timed out. */ +/* Timeout has occurred on a fragment which means a scan has timed out. */ /* If this is true we have an error in LQH/ACC. */ /*--------------------------------------------------------------------------*/ void Dbtc::timeOutFoundFragLab(Signal* signal, UintR TscanConPtr) diff --git a/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp b/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp index 1a309e34c2d..a6b05283521 100644 --- a/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp +++ b/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp @@ -3817,7 +3817,7 @@ void Qmgr::systemErrorLab(Signal* signal, Uint32 line, const char * message) // Broadcast that this node is failing to other nodes failReport(signal, getOwnNodeId(), (UintR)ZTRUE, FailRep::ZOWN_FAILURE); - // If it's known why shutdown occured + // If it's known why shutdown occurred // an error message has been passed to this function progError(line, NDBD_EXIT_NDBREQUIRE, message); diff --git a/storage/ndb/src/kernel/vm/Emulator.cpp b/storage/ndb/src/kernel/vm/Emulator.cpp index 6610d88fba0..ca278ccbc3c 100644 --- a/storage/ndb/src/kernel/vm/Emulator.cpp +++ b/storage/ndb/src/kernel/vm/Emulator.cpp @@ -246,7 +246,7 @@ NdbShutdown(NdbShutdownType type, } if(type != NST_Normal && type != NST_Restart){ - // Signal parent that error occured during startup + // Signal parent that error occurred during startup if (type == NST_ErrorHandlerStartup) kill(getppid(), SIGUSR1); g_eventLogger.info("Error handler shutdown completed - %s", exitAbort); diff --git a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp index 255a3e962ea..49533667b39 100644 --- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp +++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp @@ -627,7 +627,7 @@ private: NodeId m_master_node; /** - * Handles the thread wich upon a 'Node is started' event will + * Handles the thread which upon a 'Node is started' event will * set the node's previous loglevel settings. */ struct NdbThread* _logLevelThread; diff --git a/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp b/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp index e3cf3488ce7..a647d387142 100644 --- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp +++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp @@ -437,7 +437,7 @@ public: bool setTransporter(class Ndb * ndb, class TransporterFacade * tf); bool setTransporter(class TransporterFacade * tf); - // To abstract the stuff thats made in all create/drop/lists below + // To abstract the stuff that's made in all create/drop/lists below int dictSignal(NdbApiSignal* signal, LinearSectionPtr ptr[3], int secs, int nodeId, // -1 any, 0 = master, >1 = specified WaitSignalType wst, diff --git a/storage/ndb/src/ndbapi/NdbTransaction.cpp b/storage/ndb/src/ndbapi/NdbTransaction.cpp index f446267f3b2..7c3e360b9fc 100644 --- a/storage/ndb/src/ndbapi/NdbTransaction.cpp +++ b/storage/ndb/src/ndbapi/NdbTransaction.cpp @@ -1747,7 +1747,7 @@ transactions. } /**********************************************************************/ - /* A serious error has occured. This could be due to deadlock or */ + /* A serious error has occurred. This could be due to deadlock or */ /* lack of resources or simply a programming error in NDB. This */ /* transaction will be aborted. Actually it has already been */ /* and we only need to report completion and return with the */ @@ -1869,7 +1869,7 @@ NdbTransaction::receiveTCKEY_FAILCONF(const TcKeyFailConf * failConf) */ if(checkState_TransId(&failConf->transId1)){ /* - A node failure of the TC node occured. The transaction has + A node failure of the TC node occurred. The transaction has been committed. */ theCommitStatus = Committed; diff --git a/storage/ndb/src/ndbapi/Ndbif.cpp b/storage/ndb/src/ndbapi/Ndbif.cpp index ba3aebc5800..3608ec962f9 100644 --- a/storage/ndb/src/ndbapi/Ndbif.cpp +++ b/storage/ndb/src/ndbapi/Ndbif.cpp @@ -1315,7 +1315,7 @@ int sendPollNdb(int aMillisecondNumber, int minNoOfEventsToWakeup = 1, int force Remark: First send all prepared operations and then check if there are any transactions already completed. Wait for not completed transactions until the specified number have completed or until the - timeout has occured. Timeout zero means no waiting time. + timeout has occurred. Timeout zero means no waiting time. ******************************************************************************/ int Ndb::sendPollNdb(int aMillisecondNumber, int minNoOfEventsToWakeup, int forceSend) @@ -1359,7 +1359,7 @@ int pollNdb(int aMillisecondNumber, int minNoOfEventsToWakeup); Remark: Check if there are any transactions already completed. Wait for not completed transactions until the specified number have completed or - until the timeout has occured. Timeout zero means no waiting time. + until the timeout has occurred. Timeout zero means no waiting time. ******************************************************************************/ int Ndb::pollNdb(int aMillisecondNumber, int minNoOfEventsToWakeup) diff --git a/storage/ndb/test/include/NDBT_Error.hpp b/storage/ndb/test/include/NDBT_Error.hpp index 1d057d6b90f..9b04b76cf0e 100644 --- a/storage/ndb/test/include/NDBT_Error.hpp +++ b/storage/ndb/test/include/NDBT_Error.hpp @@ -79,7 +79,7 @@ private: // // ERR prints an NdbError object together with a description of where the -// error occured +// error occurred // #define ERR_OUT(where, error) \ { where << "ERROR: " << error.code << " " \ diff --git a/storage/ndb/test/ndbapi/flexAsynch.cpp b/storage/ndb/test/ndbapi/flexAsynch.cpp index d24965a9134..182baec2b91 100644 --- a/storage/ndb/test/ndbapi/flexAsynch.cpp +++ b/storage/ndb/test/ndbapi/flexAsynch.cpp @@ -618,7 +618,7 @@ executeCallback(int result, NdbConnection* NdbObject, void* aObject) ndbout_c("execute: %s", NdbObject->getNdbError().message); }//if(retCode == 3) - // ndbout << "Error occured in poll:" << endl; + // ndbout << "Error occurred in poll:" << endl; // ndbout << NdbObject->getNdbError() << endl; failed++ ; return; diff --git a/storage/ndb/test/ndbapi/flexTimedAsynch.cpp b/storage/ndb/test/ndbapi/flexTimedAsynch.cpp index 2a846008c56..c3b176fbaa8 100644 --- a/storage/ndb/test/ndbapi/flexTimedAsynch.cpp +++ b/storage/ndb/test/ndbapi/flexTimedAsynch.cpp @@ -512,7 +512,7 @@ executeCallback(int result, NdbConnection* NdbObject, void* aObject) ndbout_c("execute: %s", NdbObject->getNdbError().message); }//if(retCode == 3) - // ndbout << "Error occured in poll:" << NdbObject->getNdbError() << + // ndbout << "Error occurred in poll:" << NdbObject->getNdbError() << // " ErrorCode = " << NdbObject->getNdbError() << endl; ndbout << "executeCallback threadInfo->transactionCompleted = " << threadInfo->transactionCompleted << endl; diff --git a/storage/ndb/test/ndbapi/initronja.cpp b/storage/ndb/test/ndbapi/initronja.cpp index 9b96e7e8625..2aa7d575710 100644 --- a/storage/ndb/test/ndbapi/initronja.cpp +++ b/storage/ndb/test/ndbapi/initronja.cpp @@ -302,13 +302,13 @@ inline int InsertRecords(Ndb* pNdb, int nNoRecords){ return 0; error_handler1: - ndbout << "Error occured in getNdbOperation " << endl; + ndbout << "Error occurred in getNdbOperation " << endl; ndbout << MyTransaction->getNdbError() << endl; pNdb->closeTransaction(MyTransaction); return -1 ; error_handler2: - ndbout << "Error occured in defining operation " << endl; + ndbout << "Error occurred in defining operation " << endl; ndbout << MyOperation[count_tables]->getNdbError() << endl; pNdb->closeTransaction(MyTransaction); return -1 ; @@ -318,13 +318,13 @@ error_handler3: return -1 ; error_handler4: - ndbout << "Error occured in equal " << endl; + ndbout << "Error occurred in equal " << endl; ndbout << MyOperation[count_tables]->getNdbError() << endl; pNdb->closeTransaction(MyTransaction); return -1 ; error_handler5: - ndbout << "Error occured in get/setValue " << endl; + ndbout << "Error occurred in get/setValue " << endl; ndbout << MyOperation[count_tables]->getNdbError() << endl; pNdb->closeTransaction(MyTransaction); return -1 ; diff --git a/storage/ndb/test/ndbapi/testNdbApi.cpp b/storage/ndb/test/ndbapi/testNdbApi.cpp index 0d631023f75..c4d313a267b 100644 --- a/storage/ndb/test/ndbapi/testNdbApi.cpp +++ b/storage/ndb/test/ndbapi/testNdbApi.cpp @@ -1011,7 +1011,7 @@ int runCheckGetNdbErrorOperation(NDBT_Context* ctx, NDBT_Step* step){ for(int a = 0; agetNoOfColumns(); a++){ if (pTab->getColumn(a)->getPrimaryKey() == true){ if(hugoOps.equalForAttr(pOp, a, 1) != 0){ - // An error has occured, check that + // An error has occurred, check that // it's possible to get the NdbErrorOperation const NdbError err = pCon->getNdbError(); ERR(err); diff --git a/storage/ndb/test/ndbapi/testTimeout.cpp b/storage/ndb/test/ndbapi/testTimeout.cpp index 711a943f965..519946d83d7 100644 --- a/storage/ndb/test/ndbapi/testTimeout.cpp +++ b/storage/ndb/test/ndbapi/testTimeout.cpp @@ -511,7 +511,7 @@ TESTCASE("TimeoutRandTransaction", } TESTCASE("BuddyTransNoTimeout", "Start a transaction and perform an insert with NoCommit. " \ - "Start a buddy transaction wich performs long running scans " \ + "Start a buddy transaction which performs long running scans " \ "and sleeps. " \ "The total sleep time is longer than TransactionInactiveTimeout" \ "Commit the first transaction, it should not have timed out."){ @@ -523,7 +523,7 @@ TESTCASE("BuddyTransNoTimeout", } TESTCASE("BuddyTransNoTimeout5", "Start a transaction and perform an insert with NoCommit. " \ - "Start a buddy transaction wich performs long running scans " \ + "Start a buddy transaction which performs long running scans " \ "and sleeps. " \ "The total sleep time is longer than TransactionInactiveTimeout" \ "Commit the first transaction, it should not have timed out." \ diff --git a/storage/ndb/test/ndbapi/test_event.cpp b/storage/ndb/test/ndbapi/test_event.cpp index e435c59e457..92856d38602 100644 --- a/storage/ndb/test/ndbapi/test_event.cpp +++ b/storage/ndb/test/ndbapi/test_event.cpp @@ -254,7 +254,7 @@ eventOperation(Ndb* pNdb, const NdbDictionary::Table &tab, void* pstats, int rec last_inconsitant_gci = gci; stats.n_inconsistent_gcis++; } - g_warning << "A node failure has occured and events might be missing\n"; + g_warning << "A node failure has occurred and events might be missing\n"; } g_info << function << "GCI " << gci << ": " << count; struct receivedEvent* recEvent; @@ -1166,7 +1166,7 @@ static int copy_events(Ndb *ndb) r++; if (!pOp->isConsistent()) { - g_err << "A node failure has occured and events might be missing\n"; + g_err << "A node failure has occurred and events might be missing\n"; DBUG_RETURN(-1); } diff --git a/storage/ndb/test/ndbapi/test_event_multi_table.cpp b/storage/ndb/test/ndbapi/test_event_multi_table.cpp index a8cf0fa86c0..04e5caa7e9c 100644 --- a/storage/ndb/test/ndbapi/test_event_multi_table.cpp +++ b/storage/ndb/test/ndbapi/test_event_multi_table.cpp @@ -95,7 +95,7 @@ static int copy_events(Ndb *ndb) Uint32 gci= pOp->getGCI(); if (!pOp->isConsistent()) { - g_err << "A node failure has occured and events might be missing\n"; + g_err << "A node failure has occurred and events might be missing\n"; DBUG_RETURN(-1); } diff --git a/storage/ndb/tools/restore/restore_main.cpp b/storage/ndb/tools/restore/restore_main.cpp index 9af989e457a..c8e9b3e0f6e 100644 --- a/storage/ndb/tools/restore/restore_main.cpp +++ b/storage/ndb/tools/restore/restore_main.cpp @@ -862,7 +862,7 @@ main(int argc, char** argv) if (res < 0) { - err <<" Restore: An error occured while restoring data. Exiting..."; + err <<" Restore: An error occurred while restoring data. Exiting..."; err << endl; exitHandler(NDBT_FAILED); } @@ -875,7 +875,7 @@ main(int argc, char** argv) if (res < 0) { - err << "Restore: An error occured while restoring data. Exiting... " + err << "Restore: An error occurred while restoring data. Exiting... " << "res= " << res << endl; exitHandler(NDBT_FAILED); } diff --git a/storage/xtradb/fts/fts0opt.cc b/storage/xtradb/fts/fts0opt.cc index e096b8bf6d6..0703b050848 100644 --- a/storage/xtradb/fts/fts0opt.cc +++ b/storage/xtradb/fts/fts0opt.cc @@ -598,7 +598,7 @@ fts_zip_read_word( /* Finished decompressing block. */ if (zip->zp->avail_in == 0) { - /* Free the block thats been decompressed. */ + /* Free the block that's been decompressed. */ if (zip->pos > 0) { ulint prev = zip->pos - 1; diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc index 9851ec132e5..7e4e59278fa 100644 --- a/storage/xtradb/os/os0file.cc +++ b/storage/xtradb/os/os0file.cc @@ -2931,7 +2931,7 @@ try_again: "Error in system call pread(). The operating" " system error number is %lu.",(ulint) errno); } else { - /* Partial read occured */ + /* Partial read occurred */ ib_logf(IB_LOG_LEVEL_ERROR, "Tried to read " ULINTPF " bytes at offset " UINT64PF ". Was only able to read %ld.", @@ -3035,7 +3035,7 @@ try_again: "Error in system call pread(). The operating" " system error number is %lu.",(ulint) errno); } else { - /* Partial read occured */ + /* Partial read occurred */ ib_logf(IB_LOG_LEVEL_ERROR, "Tried to read " ULINTPF " bytes at offset " UINT64PF ". Was only able to read %ld.", diff --git a/strings/str2int.c b/strings/str2int.c index ec89503af5e..fe6cd6b793e 100644 --- a/strings/str2int.c +++ b/strings/str2int.c @@ -45,7 +45,7 @@ easy task. Coping with integer overflow and the asymmetric range of twos complement machines is anything but easy. - So that users of atoi and atol can check whether an error occured, + So that users of atoi and atol can check whether an error occurred, I have taken a wholly unprecedented step: errno is CLEARED if this call has no problems. */ diff --git a/tests/async_queries.c b/tests/async_queries.c index 75229eec4b4..76e884e6a69 100644 --- a/tests/async_queries.c +++ b/tests/async_queries.c @@ -265,7 +265,7 @@ again: { if (mysql_errno(&sd->mysql)) { - /* An error occured. */ + /* An error occurred. */ printf("%d | Error: %s\n", sd->index, mysql_error(&sd->mysql)); } else diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 51e549d9d1b..473084e1b57 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -11725,10 +11725,10 @@ static void test_bug5315() rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); DIE_UNLESS(rc == 0); if (!opt_silent) - printf("Excuting mysql_change_user\n"); + printf("Executing mysql_change_user\n"); mysql_change_user(mysql, opt_user, opt_password, current_db); if (!opt_silent) - printf("Excuting mysql_stmt_execute\n"); + printf("Executing mysql_stmt_execute\n"); rc= mysql_stmt_execute(stmt); DIE_UNLESS(rc != 0); if (rc) @@ -11738,10 +11738,10 @@ static void test_bug5315() } /* check that connection is OK */ if (!opt_silent) - printf("Excuting mysql_stmt_close\n"); + printf("Executing mysql_stmt_close\n"); mysql_stmt_close(stmt); if (!opt_silent) - printf("Excuting mysql_stmt_init\n"); + printf("Executing mysql_stmt_init\n"); stmt= mysql_stmt_init(mysql); rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text)); DIE_UNLESS(rc == 0); diff --git a/tests/nonblock-wrappers.h b/tests/nonblock-wrappers.h index 3ed470b3400..d6f42511f3a 100644 --- a/tests/nonblock-wrappers.h +++ b/tests/nonblock-wrappers.h @@ -30,7 +30,7 @@ /* Run the appropriate poll() syscall to wait for the event that libmysql - requested. Return which event(s) occured. + requested. Return which event(s) occurred. */ static int wait_for_mysql(MYSQL *mysql, int status) -- cgit v1.2.1 From c689e93500589fd653c15166f64d12038594855e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 5 Mar 2016 16:25:23 +0100 Subject: update sysvar_innodb,32bit,xtradb.rdiff --- .../sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff | 41 +++++++++++----------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff index 4ac8b9fb53b..cad46e36f42 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff @@ -1119,14 +1119,21 @@ VARIABLE_COMMENT Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1000000 -@@ -2203,6 +2637,34 @@ +@@ -2203,14 +2637,28 @@ ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +-VARIABLE_NAME INNODB_TMPDIR +-SESSION_VALUE +-GLOBAL_VALUE +VARIABLE_NAME INNODB_TRACK_CHANGED_PAGES +SESSION_VALUE NULL +GLOBAL_VALUE OFF -+GLOBAL_VALUE_ORIGIN COMPILE-TIME + GLOBAL_VALUE_ORIGIN COMPILE-TIME +-DEFAULT_VALUE +-VARIABLE_SCOPE SESSION +-VARIABLE_TYPE VARCHAR +-VARIABLE_COMMENT Directory for temporary non-tablespace files. +DEFAULT_VALUE OFF +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN @@ -1145,16 +1152,10 @@ +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Force log tracker to catch up with checkpoint now -+NUMERIC_MIN_VALUE NULL -+NUMERIC_MAX_VALUE NULL -+NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL -+READ_ONLY NO -+COMMAND_LINE_ARGUMENT OPTIONAL - VARIABLE_NAME INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG - SESSION_VALUE NULL - GLOBAL_VALUE OFF -@@ -2251,7 +2713,7 @@ + NUMERIC_MIN_VALUE NULL + NUMERIC_MAX_VALUE NULL + NUMERIC_BLOCK_SIZE NULL +@@ -2265,7 +2713,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 128 VARIABLE_SCOPE GLOBAL @@ -1163,7 +1164,7 @@ VARIABLE_COMMENT Number of undo logs to use. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 128 -@@ -2265,7 +2727,7 @@ +@@ -2279,7 +2727,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1172,7 +1173,7 @@ VARIABLE_COMMENT Number of undo tablespaces to use. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 126 -@@ -2280,7 +2742,7 @@ +@@ -2294,7 +2742,7 @@ DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN @@ -1181,7 +1182,7 @@ NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -@@ -2301,6 +2763,20 @@ +@@ -2315,6 +2763,20 @@ ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT NONE @@ -1202,7 +1203,7 @@ VARIABLE_NAME INNODB_USE_MTFLUSH SESSION_VALUE NULL GLOBAL_VALUE OFF -@@ -2315,6 +2791,20 @@ +@@ -2329,6 +2791,20 @@ ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT NONE @@ -1223,12 +1224,12 @@ VARIABLE_NAME INNODB_USE_SYS_MALLOC SESSION_VALUE NULL GLOBAL_VALUE ON -@@ -2345,12 +2835,12 @@ +@@ -2359,12 +2835,12 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL --GLOBAL_VALUE 5.6.27 -+GLOBAL_VALUE 5.6.26-76.0 +-GLOBAL_VALUE 5.6.29 ++GLOBAL_VALUE 5.6.28-76.1 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL @@ -1238,7 +1239,7 @@ NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -@@ -2363,7 +2853,7 @@ +@@ -2377,7 +2853,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 4 VARIABLE_SCOPE GLOBAL -- cgit v1.2.1 From 5a3a79ce5f20a862abdde505a683df1148e0dc37 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 26 Feb 2016 12:07:07 +0100 Subject: MDEV-9637 select nullif(count(col1),0) gives wrong result if in a view don't do special SUM_FUNC_ITEM treatment in NULLIF for views (as before), but do it for derived tables (when context_analysis_only == CONTEXT_ANALYSIS_ONLY_DERIVED) --- mysql-test/r/null.result | 11 +++++++++++ mysql-test/t/null.test | 11 +++++++++++ sql/item_cmpfunc.cc | 3 ++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index cd4fa259b3f..382551b39ff 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -1531,6 +1531,17 @@ View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select nullif(count(distinct `t1`.`col1`),0) AS `nullif(count(distinct col1),0)` from `t1` latin1 latin1_swedish_ci drop view v1; drop table t1; +create table t1 (col1 varchar(50) default null); +insert into t1 (col1) values ('hello'), ('hello'), ('hello'); +create view v1 as select nullif(count(col1),0) from t1; +select * from v1; +nullif(count(col1),0) +3 +select nullif(count(col1),0) from t1; +nullif(count(col1),0) +3 +drop view v1; +drop table t1; # # End of 10.1 tests # diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index 8857195d0e1..0302ce17bce 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -958,6 +958,17 @@ show create view v1; drop view v1; drop table t1; +# +# MDEV-9637 select nullif(count(col1),0) gives wrong result if in a view +# +create table t1 (col1 varchar(50) default null); +insert into t1 (col1) values ('hello'), ('hello'), ('hello'); +create view v1 as select nullif(count(col1),0) from t1; +select * from v1; +select nullif(count(col1),0) from t1; +drop view v1; +drop table t1; + --echo # --echo # End of 10.1 tests --echo # diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 86247e070e5..b88d80f633c 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2584,7 +2584,8 @@ Item_func_nullif::fix_length_and_dec() args[0] and args[2] should still point to the same original l_expr. */ DBUG_ASSERT(args[0] == args[2] || thd->stmt_arena->is_stmt_execute()); - if (args[0]->type() == SUM_FUNC_ITEM && !thd->lex->context_analysis_only) + if (args[0]->type() == SUM_FUNC_ITEM && + !thd->lex->is_ps_or_view_context_analysis()) { /* NULLIF(l_expr, r_expr) -- cgit v1.2.1 From ff93b77fd62bdb708e2b2b34f4e2202c12e727c4 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 3 Mar 2016 18:44:10 +0100 Subject: MDEV-9641 MDEV-9644 NULLIF assertions * only copy args[0] to args[2] after fix_fields (when all item substitutions have already happened) * change QT_ITEM_FUNC_NULLIF_TO_CASE (that allows to print NULLIF as CASE) to QT_ITEM_ORIGINAL_FUNC_NULLIF (that prohibits it). So that NULLIF-to-CASE is allowed by default and only disabled explicitly for SHOW VIEW|FUNCTION|PROCEDURE and mysql_make_view. By default it is allowed (in particular in error messages and debug output, that can happen anytime before or after optimizer). --- mysql-test/r/null.result | 16 ++++++++++++++++ mysql-test/t/null.test | 19 +++++++++++++++++++ sql/item_cmpfunc.cc | 26 +++++++++++++++----------- sql/item_cmpfunc.h | 11 +++++++++-- sql/mysqld.h | 15 ++++++++------- sql/sp_head.cc | 18 ++++++++++++------ sql/sql_lex.cc | 2 +- sql/sql_show.cc | 3 ++- sql/sql_view.cc | 8 +++++--- 9 files changed, 87 insertions(+), 31 deletions(-) diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index 382551b39ff..b8acc3e7319 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -1542,6 +1542,22 @@ nullif(count(col1),0) 3 drop view v1; drop table t1; +select nullif((select 1), (select 2)); +nullif((select 1), (select 2)) +1 +create table t1 (f int); +insert into t1 values (1),(2); +select nullif( not f, 1 ) from t1; +nullif( not f, 1 ) +0 +0 +drop table t1; +set names utf8; +create table t1 (f1 varchar(10)); +insert into t1 values ('2015-12-31'); +select power( timestamp( nullif( '2002-09-08', f1 ) ), 24 ) from t1; +ERROR 22003: DOUBLE value is out of range in 'pow(cast((case when '2002-09-08' = '2015-12-31' then NULL else '2002-09-08' end) as datetime(6)),24)' +drop table t1; # # End of 10.1 tests # diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index 0302ce17bce..85c7131c33b 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -969,6 +969,25 @@ select nullif(count(col1),0) from t1; drop view v1; drop table t1; +# +# MDEV-9644 Assertion `args[0] == args[2] || thd->stmt_arena->is_stmt_execute()' failed in Item_func_nullif::fix_length_and_dec() +# +select nullif((select 1), (select 2)); +create table t1 (f int); +insert into t1 values (1),(2); +select nullif( not f, 1 ) from t1; +drop table t1; + +# +# MDEV-9641 Assertion `args[0] == args[2] || _current_thd()->lex->context_analysis_only' failed in Item_func_nullif::print(String*, enum_query_type) +# +set names utf8; +create table t1 (f1 varchar(10)); +insert into t1 values ('2015-12-31'); +--error ER_DATA_OUT_OF_RANGE +select power( timestamp( nullif( '2002-09-08', f1 ) ), 24 ) from t1; +drop table t1; + --echo # --echo # End of 10.1 tests --echo # diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index b88d80f633c..2783a0500df 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2566,8 +2566,15 @@ void Item_func_nullif::update_used_tables() void Item_func_nullif::fix_length_and_dec() { - if (!args[2]) // Only false if EOM - return; + /* + If this is the first invocation of fix_length_and_dec(), create the + third argument as a copy of the first. This cannot be done before + fix_fields(), because fix_fields() might replace items, + for exampe NOT x --> x==0, or (SELECT 1) --> 1. + See also class Item_func_nullif declaration. + */ + if (arg_count == 2) + args[arg_count++]= args[0]; THD *thd= current_thd; /* @@ -2706,7 +2713,7 @@ Item_func_nullif::fix_length_and_dec() m_cache= args[0]->cmp_type() == STRING_RESULT ? new (thd->mem_root) Item_cache_str_for_nullif(thd, args[0]) : Item_cache::get_cache(thd, args[0]); - m_cache->setup(current_thd, args[0]); + m_cache->setup(thd, args[0]); m_cache->store(args[0]); m_cache->set_used_tables(args[0]->used_tables()); thd->change_item_tree(&args[0], m_cache); @@ -2718,7 +2725,7 @@ Item_func_nullif::fix_length_and_dec() unsigned_flag= args[2]->unsigned_flag; fix_char_length(args[2]->max_char_length()); maybe_null=1; - setup_args_and_comparator(current_thd, &cmp); + setup_args_and_comparator(thd, &cmp); } @@ -2737,10 +2744,10 @@ void Item_func_nullif::print(String *str, enum_query_type query_type) Therefore, after equal field propagation args[0] and args[2] can point to different items. */ - if (!(query_type & QT_ITEM_FUNC_NULLIF_TO_CASE) || args[0] == args[2]) + if ((query_type & QT_ITEM_ORIGINAL_FUNC_NULLIF) || args[0] == args[2]) { /* - If no QT_ITEM_FUNC_NULLIF_TO_CASE is requested, + If QT_ITEM_ORIGINAL_FUNC_NULLIF is requested, that means we want the original NULLIF() representation, e.g. when we are in: SHOW CREATE {VIEW|FUNCTION|PROCEDURE} @@ -2748,15 +2755,12 @@ void Item_func_nullif::print(String *str, enum_query_type query_type) The original representation is possible only if args[0] and args[2] still point to the same Item. - The caller must pass call print() with QT_ITEM_FUNC_NULLIF_TO_CASE + The caller must never pass call print() with QT_ITEM_ORIGINAL_FUNC_NULLIF if an expression has undergone some optimization (e.g. equal field propagation done in optimize_cond()) already and NULLIF() potentially has two different representations of "a": - one "a" for comparison - another "a" for the returned value! - - Note, the EXPLAIN EXTENDED and EXPLAIN FORMAT=JSON routines - do pass QT_ITEM_FUNC_NULLIF_TO_CASE to print(). */ DBUG_ASSERT(args[0] == args[2] || current_thd->lex->context_analysis_only); str->append(func_name()); @@ -5789,7 +5793,7 @@ bool Item_func_not::fix_fields(THD *thd, Item **ref) args[0]->under_not(this); if (args[0]->type() == FIELD_ITEM) { - /* replace "NOT " with " == 0" */ + /* replace "NOT " with " == 0" */ Query_arena backup, *arena; Item *new_item; bool rc= TRUE; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 39d9aa67819..f17167b5140 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -998,11 +998,18 @@ class Item_func_nullif :public Item_func_hybrid_field_type Item_cache *m_cache; int compare(); public: - // Put "a" to args[0] for comparison and to args[2] for the returned value. + /* + Here we pass three arguments to the parent constructor, as NULLIF + is a three-argument function, it needs two copies of the first argument + (see above). But fix_fields() will be confused if we try to prepare the + same Item twice (if args[0]==args[2]), so we hide the third argument + (decrementing arg_count) and copy args[2]=args[0] again after fix_fields(). + See also Item_func_nullif::fix_length_and_dec(). + */ Item_func_nullif(THD *thd, Item *a, Item *b): Item_func_hybrid_field_type(thd, a, b, a), m_cache(NULL) - {} + { arg_count--; } bool date_op(MYSQL_TIME *ltime, uint fuzzydate); double real_op(); longlong int_op(); diff --git a/sql/mysqld.h b/sql/mysqld.h index 1c1478f8a63..30120d66113 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -665,15 +665,16 @@ enum enum_query_type /// If NULLIF(a,b) should print itself as /// CASE WHEN a_for_comparison=b THEN NULL ELSE a_for_return_value END /// when "a" was replaced to two different items - /// (e.g. by equal fields propagation in optimize_cond()). - /// The default behaviour is to print as NULLIF(a_for_return, b) - /// which should be Ok for SHOW CREATE {VIEW|PROCEDURE|FUNCTION} - /// as they are not affected by WHERE optimization. - QT_ITEM_FUNC_NULLIF_TO_CASE= (1 <<6), + /// (e.g. by equal fields propagation in optimize_cond()) + /// or always as NULLIF(a, b). + /// The default behaviour is to use CASE syntax when + /// a_for_return_value is not the same as a_for_comparison. + /// SHOW CREATE {VIEW|PROCEDURE|FUNCTION} and other cases where the + /// original representation is required, should set this flag. + QT_ITEM_ORIGINAL_FUNC_NULLIF= (1 <<6), /// This value means focus on readability, not on ability to parse back, etc. QT_EXPLAIN= QT_TO_SYSTEM_CHARSET | - QT_ITEM_FUNC_NULLIF_TO_CASE | QT_ITEM_IDENT_SKIP_CURRENT_DATABASE | QT_ITEM_CACHE_WRAPPER_SKIP_DETAILS | QT_ITEM_SUBSELECT_ID_ONLY, @@ -682,7 +683,7 @@ enum enum_query_type /// Be more detailed than QT_EXPLAIN. /// Perhaps we should eventually include QT_ITEM_IDENT_SKIP_CURRENT_DATABASE /// here, as it would give better readable results - QT_EXPLAIN_EXTENDED= QT_TO_SYSTEM_CHARSET | QT_ITEM_FUNC_NULLIF_TO_CASE + QT_EXPLAIN_EXTENDED= QT_TO_SYSTEM_CHARSET }; diff --git a/sql/sp_head.cc b/sql/sp_head.cc index ea112bc8296..cb598b367e7 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -3272,7 +3272,8 @@ sp_instr_set::print(String *str) } str->qs_append(m_offset); str->qs_append(' '); - m_value->print(str, QT_ORDINARY); + m_value->print(str, enum_query_type(QT_ORDINARY | + QT_ITEM_ORIGINAL_FUNC_NULLIF)); } @@ -3304,9 +3305,11 @@ void sp_instr_set_trigger_field::print(String *str) { str->append(STRING_WITH_LEN("set_trigger_field ")); - trigger_field->print(str, QT_ORDINARY); + trigger_field->print(str, enum_query_type(QT_ORDINARY | + QT_ITEM_ORIGINAL_FUNC_NULLIF)); str->append(STRING_WITH_LEN(":=")); - value->print(str, QT_ORDINARY); + value->print(str, enum_query_type(QT_ORDINARY | + QT_ITEM_ORIGINAL_FUNC_NULLIF)); } /* @@ -3432,7 +3435,8 @@ sp_instr_jump_if_not::print(String *str) str->qs_append('('); str->qs_append(m_cont_dest); str->qs_append(STRING_WITH_LEN(") ")); - m_expr->print(str, QT_ORDINARY); + m_expr->print(str, enum_query_type(QT_ORDINARY | + QT_ITEM_ORIGINAL_FUNC_NULLIF)); } @@ -3528,7 +3532,8 @@ sp_instr_freturn::print(String *str) str->qs_append(STRING_WITH_LEN("freturn ")); str->qs_append((uint)m_type); str->qs_append(' '); - m_value->print(str, QT_ORDINARY); + m_value->print(str, enum_query_type(QT_ORDINARY | + QT_ITEM_ORIGINAL_FUNC_NULLIF)); } /* @@ -4000,7 +4005,8 @@ sp_instr_set_case_expr::print(String *str) str->qs_append(STRING_WITH_LEN(") ")); str->qs_append(m_case_expr_id); str->qs_append(' '); - m_case_expr->print(str, QT_ORDINARY); + m_case_expr->print(str, enum_query_type(QT_ORDINARY | + QT_ITEM_ORIGINAL_FUNC_NULLIF)); } uint diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 54d75338970..fd841094e68 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2689,7 +2689,7 @@ void st_select_lex::print_order(String *str, { if (order->counter_used) { - if (query_type != QT_VIEW_INTERNAL) + if (!(query_type & QT_VIEW_INTERNAL)) { char buffer[20]; size_t length= my_snprintf(buffer, 20, "%d", order->counter); diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 4adc0eccc06..b6a753f993c 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2352,7 +2352,8 @@ static int show_create_view(THD *thd, TABLE_LIST *table, String *buff) We can't just use table->query, because our SQL_MODE may trigger a different syntax, like when ANSI_QUOTES is defined. */ - table->view->unit.print(buff, QT_ORDINARY); + table->view->unit.print(buff, enum_query_type(QT_ORDINARY | + QT_ITEM_ORIGINAL_FUNC_NULLIF)); if (table->with_check != VIEW_CHECK_NONE) { diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 418ce5a3426..48b4699ea46 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -901,9 +901,11 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, ulong sql_mode= thd->variables.sql_mode & MODE_ANSI_QUOTES; thd->variables.sql_mode&= ~MODE_ANSI_QUOTES; - lex->unit.print(&view_query, QT_VIEW_INTERNAL); - lex->unit.print(&is_query, - enum_query_type(QT_TO_SYSTEM_CHARSET | QT_WITHOUT_INTRODUCERS)); + lex->unit.print(&view_query, enum_query_type(QT_VIEW_INTERNAL | + QT_ITEM_ORIGINAL_FUNC_NULLIF)); + lex->unit.print(&is_query, enum_query_type(QT_TO_SYSTEM_CHARSET | + QT_WITHOUT_INTRODUCERS | + QT_ITEM_ORIGINAL_FUNC_NULLIF)); thd->variables.sql_mode|= sql_mode; } -- cgit v1.2.1 From 70f5fabdbf50abb494304baaf863feac3fbd5dd9 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 4 Mar 2016 10:09:17 +0100 Subject: MDEV-9682 Assertion `0' failed in Item_cache_row::illegal_method_call on 2nd execution of PS with NULLIF don't cache Item_cache --- mysql-test/r/null.result | 8 ++++++++ mysql-test/r/type_time.result | 16 ++++++++-------- mysql-test/t/null.test | 9 +++++++++ sql/item.cc | 1 + 4 files changed, 26 insertions(+), 8 deletions(-) diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index b8acc3e7319..f321ac978f5 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -1558,6 +1558,14 @@ insert into t1 values ('2015-12-31'); select power( timestamp( nullif( '2002-09-08', f1 ) ), 24 ) from t1; ERROR 22003: DOUBLE value is out of range in 'pow(cast((case when '2002-09-08' = '2015-12-31' then NULL else '2002-09-08' end) as datetime(6)),24)' drop table t1; +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (1),(2); +PREPARE stmt FROM "SELECT * FROM t1 WHERE NULLIF( ( 1, 2 ) IN ( SELECT 3, 4 ), 1 )"; +EXECUTE stmt; +f1 +EXECUTE stmt; +f1 +DROP TABLE t1; # # End of 10.1 tests # diff --git a/mysql-test/r/type_time.result b/mysql-test/r/type_time.result index bdcffc8d824..b5689d31aef 100644 --- a/mysql-test/r/type_time.result +++ b/mysql-test/r/type_time.result @@ -989,7 +989,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE('2015-0 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = (00:00:00)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 00:00:00) # TIME cast + DATE literal SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09-11'; a @@ -999,7 +999,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=TIME('00:00:00') AND COALESCE(a)=DATE'2015-09 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = (00:00:00)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 00:00:00) # TIME literal + DATE cast SELECT * FROM t1 WHERE COALESCE(a)=TIME'00:00:00' AND COALESCE(a)=DATE('2015-09-11'); a @@ -1029,7 +1029,7 @@ SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE('2015-09-11') id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = '00:00:00') and (coalesce(`test`.`t1`.`a`) = (2015-09-11 00:00:00))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = '00:00:00') and (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00)) # TIME-alike string literal + DATE literal SELECT * FROM t1 WHERE COALESCE(a)='00:00:00' AND COALESCE(a)=DATE'2015-09-11'; a @@ -1049,7 +1049,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE('2015-09-11'); id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 0) and (coalesce(`test`.`t1`.`a`) = (2015-09-11 00:00:00))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 0) and (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00)) # TIME-alike integer literal + DATE literal SELECT * FROM t1 WHERE COALESCE(a)=0 AND COALESCE(a)=DATE'2015-09-11'; a @@ -1069,7 +1069,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME('00:0 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = (2015-09-11 00:00:00)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00) # DATE cast + TIME literal SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00:00'; a @@ -1079,7 +1079,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=TIME'00:00 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = (2015-09-11 00:00:00)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00) # DATE cast + TIME-alike string literal SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00'; a @@ -1089,7 +1089,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)='00:00:00' id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = (2015-09-11 00:00:00)) and (coalesce(`test`.`t1`.`a`) = '00:00:00')) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00) and (coalesce(`test`.`t1`.`a`) = '00:00:00')) # DATE cast + TIME-alike integer literal SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0; a @@ -1099,7 +1099,7 @@ SELECT * FROM t1 WHERE COALESCE(a)=DATE('2015-09-11') AND COALESCE(a)=0; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = (2015-09-11 00:00:00)) and (coalesce(`test`.`t1`.`a`) = 0)) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((coalesce(`test`.`t1`.`a`) = 2015-09-11 00:00:00) and (coalesce(`test`.`t1`.`a`) = 0)) # DATE literal + TIME cast SELECT * FROM t1 WHERE COALESCE(a)=DATE'2015-09-11' AND COALESCE(a)=TIME('00:00:00'); a diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index 85c7131c33b..cdc9ceb27e0 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -988,6 +988,15 @@ insert into t1 values ('2015-12-31'); select power( timestamp( nullif( '2002-09-08', f1 ) ), 24 ) from t1; drop table t1; +# +# MDEV-9682 Assertion `0' failed in Item_cache_row::illegal_method_call on 2nd execution of PS with NULLIF +# +CREATE TABLE t1 (f1 INT); +INSERT INTO t1 VALUES (1),(2); +PREPARE stmt FROM "SELECT * FROM t1 WHERE NULLIF( ( 1, 2 ) IN ( SELECT 3, 4 ), 1 )"; +EXECUTE stmt; +EXECUTE stmt; +DROP TABLE t1; --echo # --echo # End of 10.1 tests --echo # diff --git a/sql/item.cc b/sql/item.cc index d6132ccfbcf..a330cee716a 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -6503,6 +6503,7 @@ bool Item::cache_const_expr_analyzer(uchar **arg) !(basic_const_item() || item->basic_const_item() || item->type() == Item::FIELD_ITEM || item->type() == SUBSELECT_ITEM || + item->type() == CACHE_ITEM || /* Do not cache GET_USER_VAR() function as its const_item() may return TRUE for the current thread but it still may change -- cgit v1.2.1 From 33d298493df7659f17c7825ee17ecb068402d29a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 4 Mar 2016 10:13:41 +0100 Subject: MDEV-9683 Server crashes in Item::basic_const_item on numerous nested NULLIFs test case only --- mysql-test/r/null.result | 5 +++++ mysql-test/t/null.test | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/mysql-test/r/null.result b/mysql-test/r/null.result index f321ac978f5..3da7e4805c2 100644 --- a/mysql-test/r/null.result +++ b/mysql-test/r/null.result @@ -1566,6 +1566,11 @@ f1 EXECUTE stmt; f1 DROP TABLE t1; +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 WHERE NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(i = ROUND(0), 14), 13), 12), 11), 10), 9), 8), 7), 6), 5), 4), 3), 2), 1); +i +DROP TABLE t1; # # End of 10.1 tests # diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index cdc9ceb27e0..a5db4442183 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -997,6 +997,16 @@ PREPARE stmt FROM "SELECT * FROM t1 WHERE NULLIF( ( 1, 2 ) IN ( SELECT 3, 4 ), 1 EXECUTE stmt; EXECUTE stmt; DROP TABLE t1; + +# +# MDEV-9683 Server crashes in Item::basic_const_item on numerous nested NULLIFs +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 WHERE NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(NULLIF(i = ROUND(0), 14), 13), 12), 11), 10), 9), 8), 7), 6), 5), 4), 3), 2), 1); +DROP TABLE t1; + + --echo # --echo # End of 10.1 tests --echo # -- cgit v1.2.1 From 5ea894a7c8cbeb77f71b6061e9de49a538a0e6c3 Mon Sep 17 00:00:00 2001 From: Anton Blanchard Date: Tue, 8 Mar 2016 11:31:45 +1100 Subject: MDEV-9699: power crc32: Per the PPC64 ABI, v20-v31 are non-volatile registers These where modified and not restored. Corrected as per upstream: https://github.com/antonblanchard/crc32-vpmsum/compare/f2145e5858c283d6a95ea1bc613db50b4d514303...aaf0ac4 --- storage/innobase/ut/crc32_power8/crc32.S | 51 +++++++++++++++++++++++++------- storage/xtradb/ut/crc32_power8/crc32.S | 51 +++++++++++++++++++++++++------- 2 files changed, 82 insertions(+), 20 deletions(-) diff --git a/storage/innobase/ut/crc32_power8/crc32.S b/storage/innobase/ut/crc32_power8/crc32.S index 52046bb9002..b064ce3dc96 100644 --- a/storage/innobase/ut/crc32_power8/crc32.S +++ b/storage/innobase/ut/crc32_power8/crc32.S @@ -67,14 +67,13 @@ #define off96 r30 #define off112 r31 -#define const1 v25 -#define const2 v26 +#define const1 v24 +#define const2 v25 -#define byteswap v27 -#define mask_32bit v28 -#define mask_64bit v29 -#define zeroes v30 -#define ones v31 +#define byteswap v26 +#define mask_32bit v27 +#define mask_64bit v28 +#define zeroes v29 #ifdef BYTESWAP_DATA #define VPERM(A, B, C, D) vperm A, B, C, D @@ -101,13 +100,28 @@ FUNC_START(__crc32_vpmsum) li off112,112 li r0,0 + /* Enough room for saving 10 non volatile VMX registers */ + subi r6,r1,56+10*16 + subi r7,r1,56+2*16 + + stvx v20,0,r6 + stvx v21,off16,r6 + stvx v22,off32,r6 + stvx v23,off48,r6 + stvx v24,off64,r6 + stvx v25,off80,r6 + stvx v26,off96,r6 + stvx v27,off112,r6 + stvx v28,0,r7 + stvx v29,off16,r7 + mr r10,r3 vxor zeroes,zeroes,zeroes - vspltisw ones,-1 + vspltisw v0,-1 - vsldoi mask_32bit,zeroes,ones,4 - vsldoi mask_64bit,zeroes,ones,8 + vsldoi mask_32bit,zeroes,v0,4 + vsldoi mask_64bit,zeroes,v0,8 /* Get the initial value into v8 */ vxor v8,v8,v8 @@ -570,6 +584,21 @@ FUNC_START(__crc32_vpmsum) vsldoi v0,v0,zeroes,4 /* shift result into top 64 bits of */ #endif +.Lout: + subi r6,r1,56+10*16 + subi r7,r1,56+2*16 + + lvx v20,0,r6 + lvx v21,off16,r6 + lvx v22,off32,r6 + lvx v23,off48,r6 + lvx v24,off64,r6 + lvx v25,off80,r6 + lvx v26,off96,r6 + lvx v27,off112,r6 + lvx v28,0,r7 + lvx v29,off16,r7 + /* Get it into r3 */ MFVRD(r3, v0) @@ -739,6 +768,8 @@ FUNC_START(__crc32_vpmsum) .Lzero: mr r3,r10 blr + b .Lout + FUNC_END(__crc32_vpmsum) #endif /* __powerpc__ */ diff --git a/storage/xtradb/ut/crc32_power8/crc32.S b/storage/xtradb/ut/crc32_power8/crc32.S index 52046bb9002..b064ce3dc96 100644 --- a/storage/xtradb/ut/crc32_power8/crc32.S +++ b/storage/xtradb/ut/crc32_power8/crc32.S @@ -67,14 +67,13 @@ #define off96 r30 #define off112 r31 -#define const1 v25 -#define const2 v26 +#define const1 v24 +#define const2 v25 -#define byteswap v27 -#define mask_32bit v28 -#define mask_64bit v29 -#define zeroes v30 -#define ones v31 +#define byteswap v26 +#define mask_32bit v27 +#define mask_64bit v28 +#define zeroes v29 #ifdef BYTESWAP_DATA #define VPERM(A, B, C, D) vperm A, B, C, D @@ -101,13 +100,28 @@ FUNC_START(__crc32_vpmsum) li off112,112 li r0,0 + /* Enough room for saving 10 non volatile VMX registers */ + subi r6,r1,56+10*16 + subi r7,r1,56+2*16 + + stvx v20,0,r6 + stvx v21,off16,r6 + stvx v22,off32,r6 + stvx v23,off48,r6 + stvx v24,off64,r6 + stvx v25,off80,r6 + stvx v26,off96,r6 + stvx v27,off112,r6 + stvx v28,0,r7 + stvx v29,off16,r7 + mr r10,r3 vxor zeroes,zeroes,zeroes - vspltisw ones,-1 + vspltisw v0,-1 - vsldoi mask_32bit,zeroes,ones,4 - vsldoi mask_64bit,zeroes,ones,8 + vsldoi mask_32bit,zeroes,v0,4 + vsldoi mask_64bit,zeroes,v0,8 /* Get the initial value into v8 */ vxor v8,v8,v8 @@ -570,6 +584,21 @@ FUNC_START(__crc32_vpmsum) vsldoi v0,v0,zeroes,4 /* shift result into top 64 bits of */ #endif +.Lout: + subi r6,r1,56+10*16 + subi r7,r1,56+2*16 + + lvx v20,0,r6 + lvx v21,off16,r6 + lvx v22,off32,r6 + lvx v23,off48,r6 + lvx v24,off64,r6 + lvx v25,off80,r6 + lvx v26,off96,r6 + lvx v27,off112,r6 + lvx v28,0,r7 + lvx v29,off16,r7 + /* Get it into r3 */ MFVRD(r3, v0) @@ -739,6 +768,8 @@ FUNC_START(__crc32_vpmsum) .Lzero: mr r3,r10 blr + b .Lout + FUNC_END(__crc32_vpmsum) #endif /* __powerpc__ */ -- cgit v1.2.1 From 8c2fd5537b1029a514591f622674f1ceb04fa67e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 8 Mar 2016 09:06:02 +0100 Subject: bump the version --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index c885d93a3be..ea72c43ee64 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=1 -MYSQL_VERSION_PATCH=12 +MYSQL_VERSION_PATCH=13 -- cgit v1.2.1 From 6befd842025a5e08b0af67ccf092e0881dd2efdf Mon Sep 17 00:00:00 2001 From: iangilfillan Date: Tue, 8 Mar 2016 15:24:01 +0200 Subject: Update AskMonty and Atlassian references to MariaDB --- Docs/mysql.info | 6 +++--- INSTALL-SOURCE | 2 +- INSTALL-WIN-SOURCE | 2 +- client/mysqlcheck.c | 4 ++-- cmake/cpack_rpm.cmake | 4 ++-- debian/copyright | 2 +- include/mysql/service_progress_report.h | 2 +- mysql-test/README | 2 +- scripts/mysqlaccess.sh | 4 ++-- sql/mysql_install_db.cc | 6 +++--- sql/signal_handler.cc | 2 +- 11 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Docs/mysql.info b/Docs/mysql.info index 684c0d23437..02692f341d3 100644 --- a/Docs/mysql.info +++ b/Docs/mysql.info @@ -1,11 +1,11 @@ MariaDB is in most aspects identical to MySQL. Differences between MySQL and MariaDB can be found at: -http://kb.askmonty.org/en/mariadb-versus-mysql-features/ -http://kb.askmonty.org/en/mariadb-versus-mysql-compatibility/ +https://mariadb.com/kb/en/mariadb-vs-mysql-features/ +https://mariadb.com/kb/en/mariadb-vs-mysql-compatibility/ The MariaDB manual can be found at: -http://kb.askmonty.org/ +https://mariadb.com/kb/ The MySQL Reference Manual is available in various formats on http://dev.mysql.com/doc. diff --git a/INSTALL-SOURCE b/INSTALL-SOURCE index 32cfa9792a7..93c985f2c1d 100644 --- a/INSTALL-SOURCE +++ b/INSTALL-SOURCE @@ -1,3 +1,3 @@ Instructions for building MariaDB can be found at: -https://kb.askmonty.org/en/compiling-mariadb-from-source/ +https://mariadb.com/kb/en/compiling-mariadb-from-source diff --git a/INSTALL-WIN-SOURCE b/INSTALL-WIN-SOURCE index 269bc2c3d1c..f10d13aa93b 100644 --- a/INSTALL-WIN-SOURCE +++ b/INSTALL-WIN-SOURCE @@ -1,3 +1,3 @@ Up-to-date instructions about building MariaDB on Windows can be found -at: http://kb.askmonty.org/en/building-mariadb-on-windows +at: https://mariadb.com/kb/en/Building_MariaDB_on_Windows diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 9b6934d204f..3b08c892288 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -277,8 +277,8 @@ static void usage(void) printf("Usage: %s [OPTIONS] database [tables]\n", my_progname); printf("OR %s [OPTIONS] --databases DB1 [DB2 DB3...]\n", my_progname); - puts("Please consult the MariaDB/MySQL knowledgebase at"); - puts("http://kb.askmonty.org/v/mysqlcheck for latest information about"); + puts("Please consult the MariaDB Knowledge Base at"); + puts("https://mariadb.com/kb/en/mysqlcheck for latest information about"); puts("this program."); print_defaults("my", load_default_groups); puts(""); diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index c00cdd29b24..fa7c563e57d 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -43,8 +43,8 @@ SET(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_RPM_PACKAGE_SUMMARY} It is GPL v2 licensed, which means you can use the it free of charge under the conditions of the GNU General Public License Version 2 (http://www.gnu.org/licenses/). -MariaDB documentation can be found at http://kb.askmonty.org/ -MariaDB bug reports should be submitted through https://mariadb.atlassian.net/ +MariaDB documentation can be found at https://mariadb.com/kb +MariaDB bug reports should be submitted through https://jira.mariadb.org ") diff --git a/debian/copyright b/debian/copyright index 5207620b411..1a31a958b99 100644 --- a/debian/copyright +++ b/debian/copyright @@ -9,7 +9,7 @@ The MariaDB packages were initally made by http://ourdelta.org/, and are now managed by the MariaDB development team, maria-developers@lists.launchpad.net -MariaDB can be downloaded from http://downloads.askmonty.org/mariadb/ +MariaDB can be downloaded from https://downloads.mariadb.org/ Copyright: diff --git a/include/mysql/service_progress_report.h b/include/mysql/service_progress_report.h index 670b1c37630..7ec3aa4c946 100644 --- a/include/mysql/service_progress_report.h +++ b/include/mysql/service_progress_report.h @@ -22,7 +22,7 @@ if requested. The functions are documented at - http://kb.askmonty.org/en/progress-reporting#how-to-add-support-for-progress-reporting-to-a-storage-engine + https://mariadb.com/kb/en/progress-reporting/#how-to-add-support-for-progress-reporting-to-a-storage-engine */ #ifdef __cplusplus diff --git a/mysql-test/README b/mysql-test/README index 162551ad69c..0fba1cc07e3 100644 --- a/mysql-test/README +++ b/mysql-test/README @@ -11,7 +11,7 @@ All tests must pass. If one or more of them fail on your system, please read the following manual section for instructions on how to report the problem: -http://kb.askmonty.org/v/reporting-bugs +https://mariadb.com/kb/en/reporting-bugs If you want to use an already running MySQL server for specific tests, use the --extern option to mysql-test-run. Please note that in this mode, diff --git a/scripts/mysqlaccess.sh b/scripts/mysqlaccess.sh index 621e2b7fda9..3626794d533 100644 --- a/scripts/mysqlaccess.sh +++ b/scripts/mysqlaccess.sh @@ -2422,7 +2422,7 @@ sub Print_Header { sub Print_Footer { if ($MySQLaccess::CMD) { #command-line mode print "\n" - ."BUGs can be reported at https://mariadb.atlassian.net/browse/MDEV\n"; + ."BUGs can be reported at https://jira.mariadb.org\n"; } if ($MySQLaccess::CGI) { #CGI-BIN mode if ($MySQLaccess::Param{'brief'}) { @@ -2430,7 +2430,7 @@ sub Print_Footer { } print "
\n" ."
\n" - ."BUGs can be reported at MariaDB JIRA
\n" + ."BUGs can be reported at MariaDB JIRA
\n" # ."Don't forget to mention the version $VERSION!
\n" ."
\n" ."\n" diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc index 9b4f45a9971..c39789f7c97 100644 --- a/sql/mysql_install_db.cc +++ b/sql/mysql_install_db.cc @@ -119,10 +119,10 @@ static void die(const char *fmt, ...) if (verbose_errors) { fprintf(stderr, - "http://kb.askmonty.org/v/installation-issues-on-windows contains some help\n" + "https://mariadb.com/kb/en/installation-issues-on-windows contains some help\n" "for solving the most common problems. If this doesn't help you, please\n" - "leave a comment in the Knowledgebase or file a bug report at\n" - "http://mariadb.org/jira"); + "leave a comment in the Knowledge Base or file a bug report at\n" + "https://jira.mariadb.org"); } fflush(stderr); va_end(args); diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 4591d379777..bb1e6321042 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -100,7 +100,7 @@ extern "C" sig_handler handle_fatal_signal(int sig) "or misconfigured. This error can also be caused by malfunctioning hardware.\n\n"); my_safe_printf_stderr("%s", - "To report this bug, see http://kb.askmonty.org/en/reporting-bugs\n\n"); + "To report this bug, see https://mariadb.com/kb/en/reporting-bugs\n\n"); my_safe_printf_stderr("%s", "We will try our best to scrape up some info that will hopefully help\n" -- cgit v1.2.1 From 8942824a5304e23f765b88d07498786d80092843 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 10 Mar 2016 13:08:34 +0400 Subject: Fixed false errors returned by logrotate script Logrotate script assumed an error if mysqladmin failed to connect to server and there's mysqld process exists. However there can be non-system instance of mysqld running (e.g. in docker) making this assumption wrong. Check pid file existance instead. --- debian/mariadb-server-10.0.mysql-server.logrotate | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/debian/mariadb-server-10.0.mysql-server.logrotate b/debian/mariadb-server-10.0.mysql-server.logrotate index 789ad353e43..a19e9ec46a2 100644 --- a/debian/mariadb-server-10.0.mysql-server.logrotate +++ b/debian/mariadb-server-10.0.mysql-server.logrotate @@ -10,18 +10,11 @@ compress sharedscripts postrotate - test -x /usr/bin/mysqladmin || exit 0 + test -x /usr/bin/mysqladmin || exit 0 - # If this fails, check debian.conf! - MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" - if [ -z "`$MYADMIN ping 2>/dev/null`" ]; then - # Really no mysqld or rather a missing debian-sys-maint user? - # If this occurs and is not a error please report a bug. - if ps cax | grep -q mysqld; then - exit 1 - fi - else - $MYADMIN flush-logs - fi + if [ -f `my_print_defaults --mysqld | grep -oP "pid-file=\K[^$]+"` ]; then + # If this fails, check debian.conf! + mysqladmin --defaults-file=/etc/mysql/debian.cnf flush-logs + fi endscript } -- cgit v1.2.1 From 8103526b38391e41be4b410b52eed9ff1c2ea698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 11 Mar 2016 13:36:29 +0200 Subject: MDEV-9667: Server hangs after select count(distinct name) from t2 where a=8366 and b>=5 and b<=5; In row_search_for_mysql function on XtraDB there was a old logic where null bytes were inited. This caused server to think that key value is null and continue on incorrect path. --- mysql-test/suite/innodb/r/innodb-agregate.result | 21 +++++++++++++++++++++ mysql-test/suite/innodb/t/innodb-agregate.test | 18 ++++++++++++++++++ storage/xtradb/handler/ha_innodb.cc | 18 +++++++++--------- storage/xtradb/row/row0sel.cc | 6 ------ 4 files changed, 48 insertions(+), 15 deletions(-) create mode 100644 mysql-test/suite/innodb/r/innodb-agregate.result create mode 100644 mysql-test/suite/innodb/t/innodb-agregate.test diff --git a/mysql-test/suite/innodb/r/innodb-agregate.result b/mysql-test/suite/innodb/r/innodb-agregate.result new file mode 100644 index 00000000000..d3e096c7eb0 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-agregate.result @@ -0,0 +1,21 @@ +create table t2 (a smallint(6) not null, b int(10) not null, name varchar(20), primary key(a,b), key(name)) engine=InnoDB; +insert into t2 values (8355,3,"sanja"),(8355,4,"wlad"),(8366,5, "lawrin"),(8366,6,"markusjm"); +select count(distinct name) from t2 where a=8366 and b>=5 and b<=5; +count(distinct name) +1 +select count(distinct name) from t2 where a=8366 and b=5; +count(distinct name) +1 +select count(distinct name) from t2 where a=8366 and b between 5 and 5.5; +count(distinct name) +1 +select sum(distinct a) from t2 where a=8366 and b>=5 and b<=5; +sum(distinct a) +8366 +select sum(distinct a) from t2 where a=8366 and b=5; +sum(distinct a) +8366 +select sum(distinct a) from t2 where a=8366 and b between 5 and 5.5; +sum(distinct a) +8366 +drop table t2; diff --git a/mysql-test/suite/innodb/t/innodb-agregate.test b/mysql-test/suite/innodb/t/innodb-agregate.test new file mode 100644 index 00000000000..e15548c087a --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-agregate.test @@ -0,0 +1,18 @@ +--source include/have_innodb.inc + +# +# MDEV-9667: Server hangs after select count(distinct name) from t2 where a=8366 and b>=5 and b<=5; +# + +create table t2 (a smallint(6) not null, b int(10) not null, name varchar(20), primary key(a,b), key(name)) engine=InnoDB; + +insert into t2 values (8355,3,"sanja"),(8355,4,"wlad"),(8366,5, "lawrin"),(8366,6,"markusjm"); + +select count(distinct name) from t2 where a=8366 and b>=5 and b<=5; +select count(distinct name) from t2 where a=8366 and b=5; +select count(distinct name) from t2 where a=8366 and b between 5 and 5.5; +select sum(distinct a) from t2 where a=8366 and b>=5 and b<=5; +select sum(distinct a) from t2 where a=8366 and b=5; +select sum(distinct a) from t2 where a=8366 and b between 5 and 5.5; + +drop table t2; diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 28c04ef1783..a3e9166c15e 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -7559,7 +7559,7 @@ ha_innobase::write_row( if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -7801,7 +7801,7 @@ func_exit: if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -8139,7 +8139,7 @@ ha_innobase::update_row( if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -8242,7 +8242,7 @@ func_exit: if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -11117,7 +11117,7 @@ ha_innobase::truncate() if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -11138,7 +11138,7 @@ ha_innobase::truncate() if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -12439,7 +12439,7 @@ ha_innobase::analyze( if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -12455,7 +12455,7 @@ ha_innobase::analyze( if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -13629,7 +13629,7 @@ ha_innobase::transactional_table_lock( if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } diff --git a/storage/xtradb/row/row0sel.cc b/storage/xtradb/row/row0sel.cc index 457e8361331..3aaf8cd5878 100644 --- a/storage/xtradb/row/row0sel.cc +++ b/storage/xtradb/row/row0sel.cc @@ -3738,12 +3738,6 @@ row_search_for_mysql( ut_error; } - /* init null bytes with default values as they might be - left uninitialized in some cases and these uninited bytes - might be copied into mysql record buffer that leads to - valgrind warnings */ - memcpy(buf, prebuilt->default_rec, prebuilt->null_bitmap_len); - #if 0 /* August 19, 2005 by Heikki: temporarily disable this error print until the cursor lock count is done correctly. -- cgit v1.2.1 From f341d94423daa37bf4bee4d9b96ba8e8d93484c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Sat, 12 Mar 2016 13:43:33 +0200 Subject: MDEV-9549: Trying to decrypt a not encrypted page Make sure that on decrypt we do not try to reference NULL pointer and if page contains undefined FIL_PAGE_FILE_FLUSH_LSN field on when page is not the first page or page is not in system tablespace, clear it. --- storage/innobase/fil/fil0crypt.cc | 32 ++++++++++++++++++++++++-------- storage/xtradb/fil/fil0crypt.cc | 32 ++++++++++++++++++++++++-------- 2 files changed, 48 insertions(+), 16 deletions(-) diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 03020896542..01b3991af24 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -712,21 +712,37 @@ fil_space_decrypt( ulint page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE); uint key_version = mach_read_from_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED); - + ulint offset = mach_read_from_4(src_frame + FIL_PAGE_OFFSET); + ulint space = mach_read_from_4(src_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); + ib_uint64_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN); *err = DB_SUCCESS; if (key_version == ENCRYPTION_KEY_NOT_ENCRYPTED) { return false; } - ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF); + if (crypt_data == NULL) { + if (space != 0 && offset != 0 && key_version != 0) { + /* FIL_PAGE_FILE_FLUSH_LSN field i.e. + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + should be only defined for the + first page in a system tablespace + data file (ibdata*, not *.ibd), if not + clear it. */ +#ifdef UNIV_DEBUG + ib_logf(IB_LOG_LEVEL_WARN, + "Page on space %lu offset %lu has key_version %u" + " when it shoud be undefined.", + space, offset, key_version); +#endif + mach_write_to_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0); + } + return false; + } - /* read space & offset & lsn */ - ulint space = mach_read_from_4( - src_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); - ulint offset = mach_read_from_4( - src_frame + FIL_PAGE_OFFSET); - ib_uint64_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN); + ut_ad(crypt_data != NULL && crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF); + + /* read space & lsn */ ulint header_len = FIL_PAGE_DATA; if (page_compressed) { diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc index 03020896542..01b3991af24 100644 --- a/storage/xtradb/fil/fil0crypt.cc +++ b/storage/xtradb/fil/fil0crypt.cc @@ -712,21 +712,37 @@ fil_space_decrypt( ulint page_type = mach_read_from_2(src_frame+FIL_PAGE_TYPE); uint key_version = mach_read_from_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED); - + ulint offset = mach_read_from_4(src_frame + FIL_PAGE_OFFSET); + ulint space = mach_read_from_4(src_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); + ib_uint64_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN); *err = DB_SUCCESS; if (key_version == ENCRYPTION_KEY_NOT_ENCRYPTED) { return false; } - ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF); + if (crypt_data == NULL) { + if (space != 0 && offset != 0 && key_version != 0) { + /* FIL_PAGE_FILE_FLUSH_LSN field i.e. + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + should be only defined for the + first page in a system tablespace + data file (ibdata*, not *.ibd), if not + clear it. */ +#ifdef UNIV_DEBUG + ib_logf(IB_LOG_LEVEL_WARN, + "Page on space %lu offset %lu has key_version %u" + " when it shoud be undefined.", + space, offset, key_version); +#endif + mach_write_to_4(src_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0); + } + return false; + } - /* read space & offset & lsn */ - ulint space = mach_read_from_4( - src_frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID); - ulint offset = mach_read_from_4( - src_frame + FIL_PAGE_OFFSET); - ib_uint64_t lsn = mach_read_from_8(src_frame + FIL_PAGE_LSN); + ut_ad(crypt_data != NULL && crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF); + + /* read space & lsn */ ulint header_len = FIL_PAGE_DATA; if (page_compressed) { -- cgit v1.2.1 From 0125e588f3967bcaf01cf60b6a64e92758158ac4 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Sat, 12 Mar 2016 17:50:57 +0200 Subject: MDEV-9713 Sporadic test failure: sys_vars.innodb_buffer_pool_load_now_basic It could have happened that one of previous tests already executed buffer pool dump and set the status variable value, so when it's been checked, the check passes too early, before the dump starts and the dump file is created. See more detailed explanation in MDEV-9713. Fixed by waiting for the current time to change in case it equals to the timestamp in the status variable, and then checking that the status variable not only matches the expected pattern, but also differs from the previous value, whatever it was. --- .../sys_vars/t/innodb_buffer_pool_load_now_basic.test | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test index fe376a3032e..160b3ba52cc 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test @@ -8,12 +8,24 @@ SET @orig = @@global.innodb_buffer_pool_load_now; SELECT @orig; +let $old_status= `SELECT variable_value FROM information_schema.global_status + WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'`; + +# A previous test could have run buffer pool dump already; +# in this case we want to make sure that the current time is different +# from the timestamp in the status variable + +let $wait_condition = + SELECT TRIM(SUBSTR('$old_status', -8)) != DATE_FORMAT(CURTIME(), '%k:%i:%s'); +-- source include/wait_condition.inc + # Do the dump SET GLOBAL innodb_buffer_pool_dump_now = ON; # Wait for the dump to complete let $wait_condition = - SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at ' + SELECT variable_value != '$old_status' + AND SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at ' FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'; -- source include/wait_condition.inc -- cgit v1.2.1 From a12326458dde270c9df7aeef3684d5c5d8fd4402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Sun, 13 Mar 2016 15:37:47 +0200 Subject: Add check to avoid NULL-pointer access if encryption information is not available. Clarify system tablespace page 0 check. --- storage/innobase/fil/fil0crypt.cc | 6 +++--- storage/xtradb/fil/fil0crypt.cc | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 01b3991af24..79a2eca56d5 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -662,7 +662,7 @@ fil_space_encrypt( return src_frame; } - ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF); + ut_a(crypt_data != NULL && crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF); byte* tmp = fil_encrypt_buf(crypt_data, space, offset, lsn, src_frame, zip_size, dst_frame); @@ -722,7 +722,7 @@ fil_space_decrypt( } if (crypt_data == NULL) { - if (space != 0 && offset != 0 && key_version != 0) { + if (!(space == 0 && offset == 0) && key_version != 0) { /* FIL_PAGE_FILE_FLUSH_LSN field i.e. FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION should be only defined for the @@ -740,7 +740,7 @@ fil_space_decrypt( return false; } - ut_ad(crypt_data != NULL && crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF); + ut_a(crypt_data != NULL && crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF); /* read space & lsn */ ulint header_len = FIL_PAGE_DATA; diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc index 01b3991af24..79a2eca56d5 100644 --- a/storage/xtradb/fil/fil0crypt.cc +++ b/storage/xtradb/fil/fil0crypt.cc @@ -662,7 +662,7 @@ fil_space_encrypt( return src_frame; } - ut_ad(crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF); + ut_a(crypt_data != NULL && crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF); byte* tmp = fil_encrypt_buf(crypt_data, space, offset, lsn, src_frame, zip_size, dst_frame); @@ -722,7 +722,7 @@ fil_space_decrypt( } if (crypt_data == NULL) { - if (space != 0 && offset != 0 && key_version != 0) { + if (!(space == 0 && offset == 0) && key_version != 0) { /* FIL_PAGE_FILE_FLUSH_LSN field i.e. FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION should be only defined for the @@ -740,7 +740,7 @@ fil_space_decrypt( return false; } - ut_ad(crypt_data != NULL && crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF); + ut_a(crypt_data != NULL && crypt_data->encryption != FIL_SPACE_ENCRYPTION_OFF); /* read space & lsn */ ulint header_len = FIL_PAGE_DATA; -- cgit v1.2.1 From 517584dde0b42f261ac92751c7c7b1959f7c2d9b Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 10 Mar 2016 17:12:58 +0100 Subject: Provide a way to reenable DISABLED plugin with -DPLUGIN_${NAME}=STATIC|DYNAMIC --- cmake/plugin.cmake | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index c24239cca84..361cb597cac 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -74,7 +74,9 @@ MACRO(MYSQL_ADD_PLUGIN) SET(compat "with${compat}") ENDIF() - IF (compat STREQUAL ".") + IF (ARG_DISABLED) + SET(howtobuild NO) + ELSEIF (compat STREQUAL ".") SET(howtobuild DYNAMIC) ELSEIF (compat STREQUAL "with.") IF (NOT ARG_MODULE_ONLY) @@ -122,7 +124,7 @@ MACRO(MYSQL_ADD_PLUGIN) # Build either static library or module IF (PLUGIN_${plugin} MATCHES "(STATIC|AUTO|YES)" AND NOT ARG_MODULE_ONLY - AND NOT ARG_DISABLED AND NOT ARG_CLIENT) + AND NOT ARG_CLIENT) IF(CMAKE_GENERATOR MATCHES "Makefiles|Ninja") # If there is a shared library from previous shared build, @@ -178,8 +180,7 @@ MACRO(MYSQL_ADD_PLUGIN) SET (mysql_optional_plugins ${mysql_optional_plugins} PARENT_SCOPE) ENDIF() ELSEIF(PLUGIN_${plugin} MATCHES "(DYNAMIC|AUTO|YES)" - AND NOT ARG_STATIC_ONLY AND NOT WITHOUT_DYNAMIC_PLUGINS - AND NOT ARG_DISABLED) + AND NOT ARG_STATIC_ONLY AND NOT WITHOUT_DYNAMIC_PLUGINS) ADD_VERSION_INFO(${target} MODULE SOURCES) ADD_LIBRARY(${target} MODULE ${SOURCES}) -- cgit v1.2.1 From 46089d76911accc48684417c5936d71bb9547912 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sun, 13 Mar 2016 20:29:14 +0100 Subject: MDEV-9659 : AWS KMS encryption plugin --- plugin/aws_key_management/CMakeLists.txt | 151 ++++++ .../aws_key_management_plugin.cc | 587 +++++++++++++++++++++ win/packaging/CPackWixConfig.cmake | 4 +- 3 files changed, 740 insertions(+), 2 deletions(-) create mode 100644 plugin/aws_key_management/CMakeLists.txt create mode 100644 plugin/aws_key_management/aws_key_management_plugin.cc diff --git a/plugin/aws_key_management/CMakeLists.txt b/plugin/aws_key_management/CMakeLists.txt new file mode 100644 index 00000000000..6b491186576 --- /dev/null +++ b/plugin/aws_key_management/CMakeLists.txt @@ -0,0 +1,151 @@ +# We build parts of AWS C++ SDK as CMake external project +# The restrictions of the SDK (https://github.com/awslabs/aws-sdk-cpp/blob/master/README.md) +# are + +# - OS : Windows,Linux or OSX +# - C++11 compiler : VS2013+, gcc 4.7+, clang 3.3+ +# - libcurl development package needs to be present on Unixes +# +# If we build SDK outselves, we'll need require GIT to be present on the build machine + + +# Give message why the building this plugin is skipped (only if -DVERBOSE is defined) +# or if plugin is explicitely requested to build. Then bail out. +MACRO(SKIP_AWS_PLUGIN msg) + IF(VERBOSE OR "${PLUGIN_AWS_KEY_MANAGEMENT}" MATCHES "^(STATIC|DYNAMIC)$") + MESSAGE(STATUS "Skip aws_key_management - ${msg}") + ENDIF() + RETURN() +ENDMACRO() + + +# This plugin needs recent C++ compilers (AWS C++ SDK header files are using C++11 features) +SET(CXX11_FLAGS) +SET(OLD_COMPILER_MSG "AWS SDK requires c++11 -capable compiler (minimal supported versions are g++ 4.7, clang 3.3, VS2103)") + +IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) + IF (GCC_VERSION VERSION_LESS 4.8) + SKIP_AWS_PLUGIN("${OLD_COMPILER_MSG}") + ENDIF() + SET(CXX11_FLAGS "-std=c++11") +ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + IF ((CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) OR + (CLANG_VERSION_STRING AND CLANG_VERSION_STRING VERSION_LESS 3.3)) + SKIP_AWS_PLUGIN("${OLD_COMPILER_MSG}") + ENDIF() + SET(CXX11_FLAGS "-stdlib=libc++") +ELSEIF(MSVC) + IF (MSVC_VERSION LESS 1800) + SKIP_AWS_PLUGIN("${OLD_COMPILER_MSG}") + ENDIF() +ELSE() + SKIP_AWS_PLUGIN("Compiler not supported by AWS C++ SDK") +ENDIF() + +IF (NOT(WIN32 OR APPLE OR (CMAKE_SYSTEM_NAME MATCHES "Linux"))) + SKIP_AWS_PLUGIN("OS unsupported by AWS SDK") +ENDIF() + + +# Figure out where AWS installs SDK libraries +# The below is defined in AWS SDK's CMakeLists.txt +# (and their handling is weird, every OS has special install directory) +IF(WIN32) + SET(SDK_INSTALL_BINARY_PREFIX "windows") +ELSEIF(APPLE) + SET(SDK_INSTALL_BINARY_PREFIX "mac") +ELSEIF(UNIX) + SET(SDK_INSTALL_BINARY_PREFIX "linux") +ENDIF() +IF(NOT APPLE) + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(SDK_INSTALL_BINARY_PREFIX "${SDK_INSTALL_BINARY_PREFIX}/intel64") + ELSE() + SET(SDK_INSTALL_BINARY_PREFIX "${SDK_INSTALL_BINARY_PREFIX}/ia32") + ENDIF() +ENDIF() +IF(CMAKE_CONFIGURATION_TYPES) + SET(SDK_INSTALL_BINARY_PREFIX "${SDK_INSTALL_BINARY_PREFIX}/${CMAKE_CFG_INTDIR}") +ENDIF() + +FIND_LIBRARY(AWS_CPP_SDK_CORE NAMES aws-cpp-sdk-core PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}") +FIND_LIBRARY(AWS_CPP_SDK_KMS NAMES aws-cpp-sdk-core PATH_SUFFIXES "${SDK_INSTALL_BINARY_PREFIX}") +SET(CMAKE_REQUIRED_FLAGS ${CXX11_FLAGS}) +CHECK_INCLUDE_FILE_CXX(aws/kms/KMSClient.h HAVE_AWS_HEADERS) + +IF(AWS_CPP_SDK_CORE AND AWS_CPP_SDK_KMS AND HAVE_AWS_HEADERS) + # AWS C++ SDK installed + SET(AWS_SDK_LIBS ${AWS_CPP_SDK_CORE} ${AWS_CPP_SDK_KMS}) +ELSE() + # Build from source, using ExternalProject_Add + IF(CMAKE_VERSION VERSION_LESS "2.8.8") + SKIP_AWS_PLUGIN("CMake is too old") + ENDIF() + FIND_PACKAGE(Git) + IF(NOT GIT_FOUND) + SKIP_AWS_PLUGIN("no GIT") + ENDIF() + INCLUDE(ExternalProject) + IF(UNIX) + FIND_PACKAGE(CURL) + IF(NOT CURL_FOUND) + SKIP_AWS_PLUGIN("AWS C++ SDK requires libcurl development package") + ENDIF() + SET(PIC_FLAG -fPIC) + ENDIF() + IF(MSVC) + SET(EXTRA_SDK_CMAKE_FLAGS -DCMAKE_CXX_FLAGS_DEBUGOPT="" -DCMAKE_EXE_LINKER_FLAGS_DEBUGOPT="" -DCMAKE_CXX_FLAGS=/wd4592) + ENDIF() + IF(CMAKE_CXX_COMPILER) + SET(EXTRA_SDK_CMAKE_FLAGS ${EXTRA_SDK_CMAKE_FLAGS} -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}) + ENDIF() + + # Relax AWS C++ SDK unreasonably high requirements for CMake version. Use replace utility (from MariaDB build) + # to patch their CMakeLists.txt + SET(AWS_SDK_PATCH_COMMAND ) + ExternalProject_Add( + aws_sdk_cpp + GIT_REPOSITORY "https://github.com/awslabs/aws-sdk-cpp.git" + GIT_TAG "0.9.6" # single tag + UPDATE_COMMAND "" + PATCH_COMMAND replace 3.1.2 2.8 -- ${CMAKE_BINARY_DIR}/aws-sdk-cpp/CMakeLists.txt + SOURCE_DIR "${CMAKE_BINARY_DIR}/aws-sdk-cpp" + CMAKE_ARGS + -DBUILD_ONLY=aws-cpp-sdk-kms -DSTATIC_LINKING=1 + "-DCMAKE_CXX_FLAGS_DEBUG=${CMAKE_CXX_FLAGS_DEBUG} ${PIC_FLAG}" + "-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${PIC_FLAG}" + "-DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} ${PIC_FLAG}" + "-DCMAKE_CXX_FLAGS_MINSIZEREL=${CMAKE_CXX_FLAGS_MINSIZEREL} ${PIC_FLAG}" + ${EXTRA_SDK_CMAKE_FLAGS} + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/aws_sdk_cpp + TEST_COMMAND "" + ) + + # We do not need to build the whole SDK , just 2 of its libs + set(AWS_SDK_LIBS aws-cpp-sdk-core aws-cpp-sdk-kms) + FOREACH(lib ${AWS_SDK_LIBS}) + ADD_LIBRARY(${lib} STATIC IMPORTED GLOBAL) + ADD_DEPENDENCIES(${lib} aws_sdk_cpp) + SET(loc "${CMAKE_BINARY_DIR}/aws_sdk_cpp/lib/${SDK_INSTALL_BINARY_PREFIX}/${CMAKE_STATIC_LIBRARY_PREFIX}${lib}${CMAKE_STATIC_LIBRARY_SUFFIX}") + SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LOCATION ${loc}) + IF(WIN32) + SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "bcrypt;winhttp;wininet;userenv") + ELSE() + SET_TARGET_PROPERTIES(${lib} PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES "${SSL_LIBRARIES};${CURL_LIBRARIES}") + ENDIF() + ENDFOREACH() + + IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + # Need whole-archive , otherwise static libraries are not linked + SET(AWS_SDK_LIBS -Wl,--whole-archive ${AWS_SDK_LIBS} -Wl,--no-whole-archive) + ENDIF() + SET_TARGET_PROPERTIES(aws_sdk_cpp PROPERTIES EXCLUDE_FROM_ALL TRUE) + INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}/aws_sdk_cpp/include) +ENDIF() + +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}") +MYSQL_ADD_PLUGIN(aws_key_management aws_key_management_plugin.cc + COMPONENT aws-key-management + LINK_LIBRARIES ${AWS_SDK_LIBS} + DISABLED) diff --git a/plugin/aws_key_management/aws_key_management_plugin.cc b/plugin/aws_key_management/aws_key_management_plugin.cc new file mode 100644 index 00000000000..3913d2c3145 --- /dev/null +++ b/plugin/aws_key_management/aws_key_management_plugin.cc @@ -0,0 +1,587 @@ +/* + Copyright (c) 2016 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 Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace Aws::KMS; +using namespace Aws::KMS::Model; +using namespace Aws::Utils::Logging; +extern void sql_print_error(const char *format, ...); +extern void sql_print_warning(const char *format, ...); +extern void sql_print_information(const char *format, ...); + + +/* Plaintext key info struct */ +struct KEY_INFO +{ + unsigned int key_id; + unsigned int key_version; + unsigned int length; + unsigned char data[MY_AES_MAX_KEY_LENGTH]; + bool load_failed; /* if true, do not attempt to reload?*/ +public: + KEY_INFO() : key_id(0), key_version(0), length(0), load_failed(false){}; +}; +#define KEY_ID_AND_VERSION(key_id,version) ((longlong)key_id << 32 | version) + +/* Cache for the latest version, per key id */ +static std::map latest_version_cache; + +/* Cache for plaintext keys */ +static std::map key_info_cache; + +static const char *key_spec_names[]={ "AES_128", "AES_256", 0 }; + +/* Plugin variables */ +static char* master_key_id; +static unsigned long key_spec; +static unsigned long log_level; +static int rotate_key; + +/* AWS functionality*/ +static int aws_decrypt_key(const char *path, KEY_INFO *info); +static int aws_generate_datakey(uint key_id, uint version); + +static int extract_id_and_version(const char *name, uint *id, uint *ver); +static unsigned int get_latest_key_version(unsigned int key_id); +static unsigned int get_latest_key_version_nolock(unsigned int key_id); +static int load_key(KEY_INFO *info); + +/* Mutex to serialize access to caches */ +static mysql_mutex_t mtx; + +#ifdef HAVE_PSI_INTERFACE +static uint mtx_key; +static PSI_mutex_info mtx_info = {&mtx_key, "mtx", 0}; +#endif + +static Aws::KMS::KMSClient *client; + +/* Redirect AWS trace to error log */ +class MySQLLogSystem : public Aws::Utils::Logging::FormattedLogSystem +{ +public: + + using Base = FormattedLogSystem; + MySQLLogSystem(LogLevel logLevel) : + Base(logLevel) + { + } + virtual LogLevel GetLogLevel(void) const override + { + return (LogLevel)log_level; + } + virtual ~MySQLLogSystem() + { + } + +protected: + virtual void ProcessFormattedStatement(Aws::String&& statement) override + { +#ifdef _WIN32 + /* + On Windows, we can't use C runtime functions to write to stdout, + because we compile with static C runtime, so plugin has a stdout + different from server. Thus we're using WriteFile(). + */ + DWORD nSize= (DWORD)statement.size(); + DWORD nWritten; + const char *s= statement.c_str(); + HANDLE h= GetStdHandle(STD_OUTPUT_HANDLE); + + WriteFile(h, s, nSize, &nWritten, NULL); +#else + printf("%s", statement.c_str()); +#endif + } +}; + + +/* + Plugin initialization. + + Create KMS client and scan datadir to find out which keys and versions + are present. +*/ +static int plugin_init(void *p) +{ + DBUG_ENTER("plugin_init"); + client = new KMSClient(); + if (!client) + { + sql_print_error("Can not initialize KMS client"); + DBUG_RETURN(-1); + } + InitializeAWSLogging(Aws::MakeShared("aws_key_management_plugin", (Aws::Utils::Logging::LogLevel) log_level)); +#ifdef HAVE_PSI_INTERFACE + mysql_mutex_register("aws_key_management", &mtx_info, 1); +#endif + mysql_mutex_init(mtx_key, &mtx, NULL); + + MY_DIR *dirp = my_dir(".", MYF(0)); + if (!dirp) + { + sql_print_error("Can't scan current directory"); + DBUG_RETURN(-1); + } + for (unsigned int i=0; i < dirp->number_of_files; i++) + { + + KEY_INFO info; + if (extract_id_and_version(dirp->dir_entry[i].name, &info.key_id, &info.key_version) == 0) + { + key_info_cache[KEY_ID_AND_VERSION(info.key_id, info.key_version)]= info; + latest_version_cache[info.key_id]= max(info.key_version, latest_version_cache[info.key_id]); + } + } + my_dirend(dirp); + DBUG_RETURN(0); +} + + +static int plugin_deinit(void *p) +{ + DBUG_ENTER("plugin_deinit"); + latest_version_cache.clear(); + key_info_cache.clear(); + mysql_mutex_destroy(&mtx); + delete client; + ShutdownAWSLogging(); + DBUG_RETURN(0); +} + +/* Generate filename to store the ciphered key */ +static void format_keyfile_name(char *buf, size_t size, uint key_id, uint version) +{ + snprintf(buf, size, "aws-kms-key.%u.%u", key_id, version); +} + +/* Extract key id and version from file name */ +static int extract_id_and_version(const char *name, uint *id, uint *ver) +{ + int len; + int n= sscanf(name, "aws-kms-key.%u.%u%n", id, ver, &len); + if (n == 2 && *id > 0 && *ver > 0 && len == (int)strlen(name)) + return 0; + return 1; +} + +/* + Decrypt key stored in aws-kms-key.. + Cache the decrypted key. +*/ +static int load_key(KEY_INFO *info) +{ + int ret; + char path[256]; + DBUG_ENTER("load_key"); + DBUG_PRINT("enter", ("id=%u,ver=%u", info->key_id, info->key_version)); + format_keyfile_name(path, sizeof(path), info->key_id, info->key_version); + ret= aws_decrypt_key(path, info); + if (ret) + info->load_failed= true; + + latest_version_cache[info->key_id]= max(latest_version_cache[info->key_id], info->key_version); + key_info_cache[KEY_ID_AND_VERSION(info->key_id, info->key_version)]= *info; + + if (!ret) + { + sql_print_information("AWS KMS plugin: loaded key %u, version %u, key length %u bit", + info->key_id, info->key_version,(uint)info->length*8); + } + else + { + sql_print_warning("AWS KMS plugin: key %u, version %u could not be decrypted", + info->key_id, info->key_version); + } + DBUG_RETURN(ret); +} + + +/* + Get latest version for the key. + + If key is not decrypted yet, this function also decrypt the key + and error will be returned if decryption fails. + + The reason for that is that Innodb crashes + in case errors are returned by get_key(), + + A new key will be created if it does not exist, provided there is + valid master_key_id. +*/ +static unsigned int get_latest_key_version(unsigned int key_id) +{ + unsigned int ret; + DBUG_ENTER("get_latest_key_version"); + mysql_mutex_lock(&mtx); + ret= get_latest_key_version_nolock(key_id); + mysql_mutex_unlock(&mtx); + DBUG_PRINT("info", ("key=%u,ret=%u", key_id, ret)); + DBUG_RETURN(ret); +} + +static unsigned int get_latest_key_version_nolock(unsigned int key_id) +{ + KEY_INFO info; + uint ver; + DBUG_ENTER("get_latest_key_version_nolock"); + ver= latest_version_cache[key_id]; + if (ver > 0) + { + info= key_info_cache[KEY_ID_AND_VERSION(key_id, ver)]; + } + if (info.load_failed) + { + /* Decryption failed previously, don't retry */ + DBUG_RETURN(ENCRYPTION_KEY_VERSION_INVALID); + } + else if (ver > 0) + { + /* Key exists already, return it*/ + if (info.length > 0) + DBUG_RETURN(ver); + } + else // (ver == 0) + { + /* Generate a new key, version 1 */ + if (!master_key_id[0]) + { + my_printf_error(ER_UNKNOWN_ERROR, + "Can't generate encryption key %u, because 'aws_key_management_master_key_id' parameter is not set", + MYF(0), key_id); + DBUG_RETURN(ENCRYPTION_KEY_VERSION_INVALID); + } + if (aws_generate_datakey(key_id, 1) != 0) + DBUG_RETURN(ENCRYPTION_KEY_VERSION_INVALID); + info.key_id= key_id; + info.key_version= 1; + info.length= 0; + } + + if (load_key(&info)) + DBUG_RETURN(ENCRYPTION_KEY_VERSION_INVALID); + DBUG_RETURN(info.key_version); +} + + +/* + Decrypt a file with KMS +*/ +static int aws_decrypt_key(const char *path, KEY_INFO *info) +{ + DBUG_ENTER("aws_decrypt_key"); + + /* Read file content into memory */ + ifstream ifs(path, ios::binary | ios::ate); + if (!ifs.good()) + { + sql_print_error("can't open file %s", path); + DBUG_RETURN(-1); + } + size_t pos = (size_t)ifs.tellg(); + if (!pos || pos == SIZE_T_MAX) + { + sql_print_error("invalid key file %s", path); + DBUG_RETURN(-1); + } + std::vector contents(pos); + ifs.seekg(0, ios::beg); + ifs.read(&contents[0], pos); + + /* Decrypt data the with AWS */ + DecryptRequest request; + Aws::Utils::ByteBuffer byteBuffer((unsigned char *)contents.data(), pos); + request.SetCiphertextBlob(byteBuffer); + DecryptOutcome outcome = client->Decrypt(request); + if (!outcome.IsSuccess()) + { + sql_print_error("AWS KMS plugin: Decrypt failed for %s : %s", path, + outcome.GetError().GetMessage().c_str()); + DBUG_RETURN(-1); + } + Aws::Utils::ByteBuffer plaintext = outcome.GetResult().GetPlaintext(); + size_t len = plaintext.GetLength(); + + if (len > (int)sizeof(info->data)) + { + sql_print_error("AWS KMS plugin: encoding key too large for %s", path); + DBUG_RETURN(ENCRYPTION_KEY_BUFFER_TOO_SMALL); + } + memcpy(info->data, plaintext.GetUnderlyingData(), len); + info->length= len; + DBUG_RETURN(0); +} + + +/* Generate a new datakey and store it a file */ +static int aws_generate_datakey(uint keyid, uint version) +{ + + DBUG_ENTER("aws_generate_datakey"); + GenerateDataKeyWithoutPlaintextRequest request; + request.SetKeyId(master_key_id); + request.SetKeySpec(DataKeySpecMapper::GetDataKeySpecForName(key_spec_names[key_spec])); + + GenerateDataKeyWithoutPlaintextOutcome outcome; + outcome= client->GenerateDataKeyWithoutPlaintext(request); + if (!outcome.IsSuccess()) + { + sql_print_error("AWS KMS plugin : GenerateDataKeyWithoutPlaintext failed : %s - %s", + outcome.GetError().GetExceptionName().c_str(), + outcome.GetError().GetMessage().c_str()); + DBUG_RETURN(-1); + } + + string out; + char filename[20]; + Aws::Utils::ByteBuffer byteBuffer = outcome.GetResult().GetCiphertextBlob(); + + format_keyfile_name(filename, sizeof(filename), keyid, version); + int fd= my_open(filename, O_RDWR | O_CREAT, 0); + if (fd < 0) + { + sql_print_error("AWS KMS plugin: Can't create file %s", filename); + DBUG_RETURN(-1); + } + size_t len= byteBuffer.GetLength(); + if (my_write(fd, byteBuffer.GetUnderlyingData(), len, 0) != len) + { + sql_print_error("AWS KMS plugin: can't write to %s", filename); + my_close(fd, 0); + my_delete(filename, 0); + DBUG_RETURN(-1); + } + my_close(fd, 0); + sql_print_information("AWS KMS plugin: generated encrypted datakey for key id=%u, version=%u", + keyid, version); + DBUG_RETURN(0); +} + +/* Key rotation for a single key */ +static int rotate_single_key(uint key_id) +{ + uint ver; + ver= latest_version_cache[key_id]; + + if (!ver) + { + my_printf_error(ER_UNKNOWN_ERROR, "key %u does not exist", MYF(ME_JUST_WARNING), key_id); + return -1; + } + else if (aws_generate_datakey(key_id, ver + 1)) + { + my_printf_error(ER_UNKNOWN_ERROR, "Could not generate datakey for key id= %u, ver= %u", + MYF(ME_JUST_WARNING), key_id, ver); + return -1; + } + else + { + KEY_INFO info; + info.key_id= key_id; + info.key_version = ver + 1; + if (load_key(&info)) + { + my_printf_error(ER_UNKNOWN_ERROR, "Could not load datakey for key id= %u, ver= %u", + MYF(ME_JUST_WARNING), key_id, ver); + return -1; + } + } + return 0; +} + +/* Key rotation for all key ids */ +static int rotate_all_keys() +{ + int ret= 0; + for (map::iterator it= latest_version_cache.begin(); it != latest_version_cache.end(); it++) + { + ret= rotate_single_key(it->first); + if (ret) + break; + } + return ret; +} + +static void update_rotate(MYSQL_THD, struct st_mysql_sys_var *, void *, const void *val) +{ + if (!master_key_id[0]) + { + my_printf_error(ER_UNKNOWN_ERROR, + "aws_key_management_master_key_id must be set to generate new data keys", MYF(ME_JUST_WARNING)); + return; + } + mysql_mutex_lock(&mtx); + rotate_key= *(int *)val; + switch (rotate_key) + { + case 0: + break; + case -1: + rotate_all_keys(); + break; + default: + rotate_single_key(rotate_key); + break; + } + rotate_key= 0; + mysql_mutex_unlock(&mtx); +} + +static unsigned int get_key( + unsigned int key_id, + unsigned int version, + unsigned char* dstbuf, + unsigned int* buflen) +{ + KEY_INFO info; + + DBUG_ENTER("get_key"); + mysql_mutex_lock(&mtx); + info= key_info_cache[KEY_ID_AND_VERSION(key_id, version)]; + if (info.length == 0 && !info.load_failed) + { + info.key_id= key_id; + info.key_version= version; + load_key(&info); + } + mysql_mutex_unlock(&mtx); + if (info.load_failed) + DBUG_RETURN(ENCRYPTION_KEY_VERSION_INVALID); + if (*buflen < info.length) + { + *buflen= info.length; + DBUG_RETURN(ENCRYPTION_KEY_BUFFER_TOO_SMALL); + } + *buflen= info.length; + memcpy(dstbuf, info.data, info.length); + DBUG_RETURN(0); +} + + +/* Plugin defs */ +struct st_mariadb_encryption aws_key_management_plugin= { + MariaDB_ENCRYPTION_INTERFACE_VERSION, + get_latest_key_version, + get_key, + // use default encrypt/decrypt functions + 0, 0, 0, 0, 0 +}; + + +static TYPELIB key_spec_typelib = +{ + array_elements(key_spec_names) - 1, "", + key_spec_names, NULL +}; + +const char *log_level_names[] = +{ + "Off", + "Fatal", + "Error", + "Warn", + "Info", + "Debug", + "Trace", + 0 +}; + +static TYPELIB log_level_typelib = +{ + array_elements(log_level_names) - 1, "", + log_level_names, NULL +}; + +static MYSQL_SYSVAR_STR(master_key_id, master_key_id, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + "Key id for master encryption key. Used to create new datakeys. If not set, no new keys will be created", + NULL, NULL, ""); + +static MYSQL_SYSVAR_ENUM(key_spec, key_spec, + PLUGIN_VAR_RQCMDARG, + "Encryption algorithm used to create new keys.", + NULL, NULL, 0, &key_spec_typelib); + + +static MYSQL_SYSVAR_ENUM(log_level, log_level, + PLUGIN_VAR_RQCMDARG, + "Logging for AWS API", + NULL, NULL, 0, &log_level_typelib); + + +static MYSQL_SYSVAR_INT(rotate_key, rotate_key, + PLUGIN_VAR_RQCMDARG, + "Set this variable to key id to perform rotation of the key. Specify -1 to rotate all keys", + NULL, update_rotate, 0, -1, INT_MAX, 1); + +static struct st_mysql_sys_var* settings[]= { + MYSQL_SYSVAR(master_key_id), + MYSQL_SYSVAR(key_spec), + MYSQL_SYSVAR(rotate_key), + MYSQL_SYSVAR(log_level), + NULL +}; + +/* + Plugin library descriptor +*/ +maria_declare_plugin(aws_key_management) +{ + MariaDB_ENCRYPTION_PLUGIN, + &aws_key_management_plugin, + "aws_key_management", + "MariaDB Corporation", + "AWS key management plugin", + PLUGIN_LICENSE_GPL, + plugin_init, + plugin_deinit, + 0x0100, + NULL, + settings, + "1.0", + MariaDB_PLUGIN_MATURITY_EXPERIMENTAL +} +maria_declare_plugin_end; diff --git a/win/packaging/CPackWixConfig.cmake b/win/packaging/CPackWixConfig.cmake index af2cb1af802..6df49678d52 100644 --- a/win/packaging/CPackWixConfig.cmake +++ b/win/packaging/CPackWixConfig.cmake @@ -9,7 +9,7 @@ IF(ESSENTIALS) ENDIF() ELSE() SET(CPACK_COMPONENTS_USED - "Server;Client;Development;SharedLibraries;Embedded;Documentation;IniFiles;Readme;Debuginfo;Common;connect-engine;ClientPlugins;gssapi-server;gssapi-client") + "Server;Client;Development;SharedLibraries;Embedded;Documentation;IniFiles;Readme;Debuginfo;Common;connect-engine;ClientPlugins;gssapi-server;gssapi-client;aws-key-management") ENDIF() SET( WIX_FEATURE_MySQLServer_EXTRA_FEATURES "DBInstance;SharedClientServerComponents") @@ -57,7 +57,7 @@ SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install server") #Miscellaneous (hidden) components, part of server / or client programs - FOREACH(comp connect-engine ClientPlugins gssapi-server gssapi-client) + FOREACH(comp connect-engine ClientPlugins gssapi-server gssapi-client aws-key-management) STRING(TOUPPER "${comp}" comp) SET(CPACK_COMPONENT_${comp}_GROUP "MySQLServer") SET(CPACK_COMPONENT_${comp}_HIDDEN 1) -- cgit v1.2.1 From 497800ee647a450e76fa94603b341133370a4137 Mon Sep 17 00:00:00 2001 From: iangilfillan Date: Tue, 15 Mar 2016 14:41:29 +0200 Subject: Update sponsors --- mysql-test/r/contributors.result | 6 +++--- sql/contributors.h | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/contributors.result b/mysql-test/r/contributors.result index 5669c6b5269..a7db5d98d30 100644 --- a/mysql-test/r/contributors.result +++ b/mysql-test/r/contributors.result @@ -3,12 +3,12 @@ Name Location Comment Booking.com http://www.booking.com Founding member of the MariaDB Foundation MariaDB Corporation https://mariadb.com Founding member of the MariaDB Foundation Auttomattic http://automattic.com Member of the MariaDB Foundation -Parallels http://www.parallels.com/products/plesk Founding member of the MariaDB Foundation +Visma http://visma.com Member of the MariaDB Foundation +Nexedi http://www.nexedi.com Member of the MariaDB Foundation Acronis http://www.acronis.com Member of the MariaDB Foundation Verkkokauppa.com Finland Sponsor of the MariaDB Foundation Webyog Bangalore Sponsor of the MariaDB Foundation -Wikimedia Foundation USA Sponsor of the MariaDB Foundation -Google USA Sponsoring parallel replication and GTID +Google USA Sponsoring encryption, parallel replication and GTID Facebook USA Sponsoring non-blocking API, LIMIT ROWS EXAMINED etc Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction Sheeri Kritzer Boston, Mass. USA EFF contribution for UC2006 Auction diff --git a/sql/contributors.h b/sql/contributors.h index 255decd19cc..04f8b74aa65 100644 --- a/sql/contributors.h +++ b/sql/contributors.h @@ -39,17 +39,17 @@ struct show_table_contributors_st show_table_contributors[]= { /* MariaDB foundation members, in contribution, size , time order */ {"Booking.com", "http://www.booking.com", "Founding member of the MariaDB Foundation"}, {"MariaDB Corporation", "https://mariadb.com", "Founding member of the MariaDB Foundation"}, - {"Auttomattic", "http://automattic.com", "Member of the MariaDB Foundation"}, - {"Parallels", "http://www.parallels.com/products/plesk", "Founding member of the MariaDB Foundation"}, + {"Auttomattic", "http://automattic.com", "Member of the MariaDB Foundation"}, + {"Visma", "http://visma.com", "Member of the MariaDB Foundation"}, + {"Nexedi", "http://www.nexedi.com", "Member of the MariaDB Foundation"}, {"Acronis", "http://www.acronis.com", "Member of the MariaDB Foundation"}, /* Smaller sponsors, newer per year */ {"Verkkokauppa.com", "Finland", "Sponsor of the MariaDB Foundation"}, {"Webyog", "Bangalore", "Sponsor of the MariaDB Foundation"}, - {"Wikimedia Foundation", "USA", "Sponsor of the MariaDB Foundation"}, /* Sponsors of important features */ - {"Google", "USA", "Sponsoring parallel replication and GTID" }, + {"Google", "USA", "Sponsoring encryption, parallel replication and GTID"}, {"Facebook", "USA", "Sponsoring non-blocking API, LIMIT ROWS EXAMINED etc"}, /* Individual contributors, names in historical order, newer first */ -- cgit v1.2.1 From 9b53d84d14a9b031d193f6beae382a232aa738e3 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 16 Mar 2016 13:43:06 +0400 Subject: MDEV-9656 Assertion `0' failed in Item_sum_field::get_tmp_table_field(). Removing a wrong ASSERT. Item_sum_field now uses the inherited Item::get_tmp_table_field(). --- mysql-test/r/func_group.result | 9 +++++++++ mysql-test/t/func_group.test | 8 ++++++++ sql/item_sum.h | 1 - 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 659580059b5..0d9d4ffff9f 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -2298,6 +2298,15 @@ id avg cast_avg 2 9223372036854775807.0000 9223372036854775807 DROP TABLE t1; # +# MDEV-9656 Assertion `0' failed in Item_sum_field::get_tmp_table_field() +# +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT DISTINCT VAR_POP(1) FROM t1 GROUP BY @a := 's'; +VAR_POP(1) +0.0000 +DROP TABLE t1; +# # MDEV-8921 Wrong result for CAST(AVG(double_column) AS SIGNED) # CREATE TABLE t1 (id INT, a DOUBLE); diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index b5270743465..47477c72004 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -1581,6 +1581,14 @@ SELECT id, AVG(a) AS avg, CAST(MIN(a) AS SIGNED) AS cast_min FROM t1 GROUP BY id SELECT id, AVG(a) AS avg, CAST(AVG(a) AS SIGNED) AS cast_avg FROM t1 GROUP BY id HAVING avg!=123 ORDER BY id; DROP TABLE t1; +--echo # +--echo # MDEV-9656 Assertion `0' failed in Item_sum_field::get_tmp_table_field() +--echo # +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT DISTINCT VAR_POP(1) FROM t1 GROUP BY @a := 's'; +DROP TABLE t1; + --echo # --echo # MDEV-8921 Wrong result for CAST(AVG(double_column) AS SIGNED) --echo # diff --git a/sql/item_sum.h b/sql/item_sum.h index db38cf56723..11d2f802af7 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -1084,7 +1084,6 @@ public: fixed= true; } table_map used_tables() const { return (table_map) 1L; } - Field *get_tmp_table_field() { DBUG_ASSERT(0); return NULL; } Field *tmp_table_field(TABLE *) { DBUG_ASSERT(0); return NULL; } void set_result_field(Field *) { DBUG_ASSERT(0); } void save_in_result_field(bool no_conversions) { DBUG_ASSERT(0); } -- cgit v1.2.1 From 7829cefa412bab21048d1ef150c54d407466023d Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Wed, 16 Mar 2016 18:53:56 +0100 Subject: - Fix MDEV-9603 compiler error. modified: storage/connect/tabmysql.cpp - Test invalid CSV separator when creating the table (MDEV-9714) modified: storage/connect/ha_connect.cc - Stop using SQLDescribeParam anymore modified: storage/connect/odbconn.cpp - Fix MDEV-9723 Regression due to calling Cardinality instead of GetMaxSize in info. modified: storage/connect/tabtbl.h modified: storage/connect/mysql-test/connect/r/tbl.result modified: storage/connect/mysql-test/connect/t/tbl.test - Typo modified: storage/connect/tabodbc.cpp --- storage/connect/ha_connect.cc | 29 +++++++++++----- storage/connect/mysql-test/connect/r/tbl.result | 45 ++++++++++++++++++------- storage/connect/mysql-test/connect/t/tbl.test | 45 +++++++++++++++++-------- storage/connect/odbconn.cpp | 9 +++-- storage/connect/tabmysql.cpp | 2 +- storage/connect/tabodbc.cpp | 2 +- storage/connect/tabtbl.h | 3 +- 7 files changed, 94 insertions(+), 41 deletions(-) diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 81e373a62d2..d82c6a278d8 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -169,9 +169,9 @@ #define JSONMAX 10 // JSON Default max grp size extern "C" { - char version[]= "Version 1.04.0005 January 24, 2016"; + char version[]= "Version 1.04.0006 March 12, 2016"; #if defined(__WIN__) - char compver[]= "Version 1.04.0005 " __DATE__ " " __TIME__; + char compver[]= "Version 1.04.0006 " __DATE__ " " __TIME__; char slash= '\\'; #else // !__WIN__ char slash= '/'; @@ -5160,7 +5160,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, fncn= topt->catfunc; fnc= GetFuncID(fncn); sep= topt->separator; - spc= (!sep) ? ',' : (!strcmp(sep, "\\t")) ? '\t' : *sep; + spc= (!sep) ? ',' : *sep; qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0; hdr= (int)topt->header; tbl= topt->tablist; @@ -5227,7 +5227,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd, goto err; } // endif rc - if (!tab) { if (ttp == TAB_TBL) { // Make tab the first table of the list @@ -5296,8 +5295,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd, case TAB_CSV: if (!fn && fnc != FNC_NO) sprintf(g->Message, "Missing %s file name", topt->type); - else - ok= true; + else if (sep && strlen(sep) > 1) + sprintf(g->Message, "Invalid separator %s", sep); + else + ok= true; break; case TAB_MYSQL: @@ -5978,7 +5979,19 @@ int ha_connect::create(const char *name, TABLE *table_arg, DBUG_RETURN(rc); } // endif lrecl - } // endif type + } // endif type JSON + + if (type == TAB_CSV) { + const char *sep = options->separator; + + if (sep && strlen(sep) > 1) { + sprintf(g->Message, "Invalid separator %s", sep); + my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0)); + rc= HA_ERR_INTERNAL_ERROR; + DBUG_RETURN(rc); + } // endif sep + + } // endif type CSV // Check column types for (field= table_arg->field; *field; field++) { @@ -6766,7 +6779,7 @@ maria_declare_plugin(connect) 0x0104, /* version number (1.04) */ NULL, /* status variables */ connect_system_variables, /* system variables */ - "1.04.0005", /* string version */ + "1.04.0006", /* string version */ MariaDB_PLUGIN_MATURITY_BETA /* maturity */ } maria_declare_plugin_end; diff --git a/storage/connect/mysql-test/connect/r/tbl.result b/storage/connect/mysql-test/connect/r/tbl.result index bc77516c22d..c584a9dd61f 100644 --- a/storage/connect/mysql-test/connect/r/tbl.result +++ b/storage/connect/mysql-test/connect/r/tbl.result @@ -44,8 +44,8 @@ ta message 1 Testing 2 myisam table 3 t4 -CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) engine=CONNECT table_type=TBL table_list='t1,t2,t3,t4' option_list='port=PORT'; -select * from total; +CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4' OPTION_LIST='port=PORT'; +SELECT * FROM total; tabname ta message t1 1 Testing t1 2 dos table @@ -59,15 +59,15 @@ t3 3 t3 t4 1 Testing t4 2 myisam table t4 3 t4 -select * from total where tabname = 't2'; +SELECT * FROM total WHERE tabname = 't2'; tabname ta message t2 1 Testing t2 2 NULL t2 3 t2 -select * from total where tabname = 't2' and ta = 3; +SELECT * FROM total WHERE tabname = 't2' AND ta = 3; tabname ta message t2 3 t2 -select * from total where tabname in ('t1','t4'); +SELECT * FROM total WHERE tabname IN ('t1','t4'); tabname ta message t1 1 Testing t1 2 dos table @@ -75,11 +75,11 @@ t1 3 t1 t4 1 Testing t4 2 myisam table t4 3 t4 -select * from total where ta = 3 and tabname in ('t1','t2'); +SELECT * FROM total WHERE ta = 3 AND tabname IN ('t1','t2'); tabname ta message t1 3 t1 t2 3 t2 -select * from total where tabname <> 't2'; +SELECT * FROM total WHERE tabname <> 't2'; tabname ta message t1 1 Testing t1 2 dos table @@ -90,12 +90,12 @@ t3 3 t3 t4 1 Testing t4 2 myisam table t4 3 t4 -select * from total where tabname != 't2' and ta = 3; +SELECT * FROM total WHERE tabname != 't2' AND ta = 3; tabname ta message t1 3 t1 t3 3 t3 t4 3 t4 -select * from total where tabname not in ('t2','t3'); +SELECT * FROM total WHERE tabname NOT IN ('t2','t3'); tabname ta message t1 1 Testing t1 2 dos table @@ -103,11 +103,11 @@ t1 3 t1 t4 1 Testing t4 2 myisam table t4 3 t4 -select * from total where ta = 3 and tabname in ('t2','t3'); +SELECT * FROM total WHERE ta = 3 AND tabname IN ('t2','t3'); tabname ta message t2 3 t2 t3 3 t3 -select * from total where ta = 3 or tabname in ('t2','t4'); +SELECT * FROM total WHERE ta = 3 OR tabname IN ('t2','t4'); tabname ta message t1 3 t1 t2 1 Testing @@ -117,7 +117,7 @@ t3 3 t3 t4 1 Testing t4 2 myisam table t4 3 t4 -select * from total where not tabname = 't2'; +SELECT * FROM total WHERE NOT tabname = 't2'; tabname ta message t1 1 Testing t1 2 dos table @@ -128,7 +128,7 @@ t3 3 t3 t4 1 Testing t4 2 myisam table t4 3 t4 -select * from total where tabname = 't2' or tabname = 't1'; +SELECT * FROM total WHERE tabname = 't2' OR tabname = 't1'; tabname ta message t1 1 Testing t1 2 dos table @@ -141,3 +141,22 @@ DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; DROP TABLE t4; +# +# Checking thread TBL tables +# +CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 11 as v'; +SELECT * FROM t1; +v +11 +CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 22 as v'; +SELECT * FROM t2; +v +22 +CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';; +SELECT * FROM total; +v +22 +11 +DROP TABLE total; +DROP TABLE t1; +DROP TABLE t2; diff --git a/storage/connect/mysql-test/connect/t/tbl.test b/storage/connect/mysql-test/connect/t/tbl.test index 43c506c9403..8478679d22c 100644 --- a/storage/connect/mysql-test/connect/t/tbl.test +++ b/storage/connect/mysql-test/connect/t/tbl.test @@ -31,23 +31,40 @@ INSERT INTO t4 (message) VALUES ('Testing'),('myisam table'),('t4'); SELECT * FROM t4; --replace_result $PORT PORT ---eval CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) engine=CONNECT table_type=TBL table_list='t1,t2,t3,t4' option_list='port=$PORT' - -select * from total; -select * from total where tabname = 't2'; -select * from total where tabname = 't2' and ta = 3; -select * from total where tabname in ('t1','t4'); -select * from total where ta = 3 and tabname in ('t1','t2'); -select * from total where tabname <> 't2'; -select * from total where tabname != 't2' and ta = 3; -select * from total where tabname not in ('t2','t3'); -select * from total where ta = 3 and tabname in ('t2','t3'); -select * from total where ta = 3 or tabname in ('t2','t4'); -select * from total where not tabname = 't2'; -select * from total where tabname = 't2' or tabname = 't1'; +--eval CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4' OPTION_LIST='port=$PORT' + +SELECT * FROM total; +SELECT * FROM total WHERE tabname = 't2'; +SELECT * FROM total WHERE tabname = 't2' AND ta = 3; +SELECT * FROM total WHERE tabname IN ('t1','t4'); +SELECT * FROM total WHERE ta = 3 AND tabname IN ('t1','t2'); +SELECT * FROM total WHERE tabname <> 't2'; +SELECT * FROM total WHERE tabname != 't2' AND ta = 3; +SELECT * FROM total WHERE tabname NOT IN ('t2','t3'); +SELECT * FROM total WHERE ta = 3 AND tabname IN ('t2','t3'); +SELECT * FROM total WHERE ta = 3 OR tabname IN ('t2','t4'); +SELECT * FROM total WHERE NOT tabname = 't2'; +SELECT * FROM total WHERE tabname = 't2' OR tabname = 't1'; DROP TABLE total; DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; DROP TABLE t4; + +--echo # +--echo # Checking thread TBL tables +--echo # +CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 11 as v'; +SELECT * FROM t1; + +CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 22 as v'; +SELECT * FROM t2; + +--replace_result $PORT PORT +--eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT'; +SELECT * FROM total; + +DROP TABLE total; +DROP TABLE t1; +DROP TABLE t2; diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index cb21a8bda15..55ccbdbada1 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -1758,7 +1758,9 @@ bool ODBConn::BindParam(ODBCCOL *colp) SQLLEN *strlen = colp->GetStrLen(); SQLRETURN rc; +#if 0 try { + // This function is often not or badly implemented by data sources rc = SQLDescribeParam(m_hstmt, n, &sqlt, &colsize, &dec, &nul); if (!Check(rc)) @@ -1766,11 +1768,12 @@ bool ODBConn::BindParam(ODBCCOL *colp) } catch(DBX *x) { sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0)); +#endif // 0 colsize = colp->GetPrecision(); sqlt = GetSQLType(buftype); - dec = IsTypeChar(buftype) ? 0 : colp->GetScale(); - nul = SQL_NULLABLE_UNKNOWN; - } // end try/catch + dec = IsTypeNum(buftype) ? colp->GetScale() : 0; + nul = colp->IsNullable() ? SQL_NULLABLE : SQL_NO_NULLS; +//} // end try/catch buf = colp->GetBuffer(0); len = IsTypeChar(buftype) ? colp->GetBuflen() : 0; diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index b9cede52a21..77be29ac12d 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -334,7 +334,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int) Delayed = !!GetIntCatInfo("Delayed", 0); } else { // MYSQL access from a PROXY table - Database = GetStringCatInfo(g, "Database", Schema ? Schema : "*"); + Database = GetStringCatInfo(g, "Database", Schema ? Schema : (PSZ)"*"); Isview = GetBoolCatInfo("View", false); // We must get other connection parms from the calling table diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index 501a814721d..b8961789ccd 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -5,7 +5,7 @@ /* */ /* COPYRIGHT: */ /* ---------- */ -/* (C) Copyright to the author Olivier BERTRAND 2000-2015 */ +/* (C) Copyright to the author Olivier BERTRAND 2000-2016 */ /* */ /* WHAT THIS PROGRAM DOES: */ /* ----------------------- */ diff --git a/storage/connect/tabtbl.h b/storage/connect/tabtbl.h index 9d3f297f9e7..3a5ec45d025 100644 --- a/storage/connect/tabtbl.h +++ b/storage/connect/tabtbl.h @@ -138,7 +138,8 @@ class DllExport TDBTBM : public TDBTBL { virtual void ResetDB(void); // Database routines - virtual int GetMaxSize(PGLOBAL g) {return 10;} // Temporary + virtual int Cardinality(PGLOBAL g) { return 10; } + virtual int GetMaxSize(PGLOBAL g) { return 10; } // Temporary virtual int RowNumber(PGLOBAL g, bool b = FALSE); virtual bool OpenDB(PGLOBAL g); virtual int ReadDB(PGLOBAL g); -- cgit v1.2.1 From b80b2921176cbcbb3395772e4c10e64411212075 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Thu, 17 Mar 2016 00:08:00 +0100 Subject: - Fix crash when sorting a TBL table with thread=yes. This was because Tablist can be NULL when no lacal tables are in the list. modified: storage/connect/tabtbl.cpp modified: storage/connect/mysql-test/connect/r/tbl.result modified: storage/connect/mysql-test/connect/t/tbl.test --- storage/connect/mysql-test/connect/r/tbl.result | 2 +- storage/connect/mysql-test/connect/t/tbl.test | 2 +- storage/connect/tabtbl.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/connect/mysql-test/connect/r/tbl.result b/storage/connect/mysql-test/connect/r/tbl.result index c584a9dd61f..f51b4dfa57f 100644 --- a/storage/connect/mysql-test/connect/r/tbl.result +++ b/storage/connect/mysql-test/connect/r/tbl.result @@ -153,7 +153,7 @@ SELECT * FROM t2; v 22 CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';; -SELECT * FROM total; +SELECT * FROM total order by v desc; v 22 11 diff --git a/storage/connect/mysql-test/connect/t/tbl.test b/storage/connect/mysql-test/connect/t/tbl.test index 8478679d22c..3dc4b2e64b0 100644 --- a/storage/connect/mysql-test/connect/t/tbl.test +++ b/storage/connect/mysql-test/connect/t/tbl.test @@ -63,7 +63,7 @@ SELECT * FROM t2; --replace_result $PORT PORT --eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT'; -SELECT * FROM total; +SELECT * FROM total order by v desc; DROP TABLE total; DROP TABLE t1; diff --git a/storage/connect/tabtbl.cpp b/storage/connect/tabtbl.cpp index 6b72c715517..36849146746 100644 --- a/storage/connect/tabtbl.cpp +++ b/storage/connect/tabtbl.cpp @@ -607,7 +607,7 @@ void TDBTBM::ResetDB(void) for (PTABLE tabp = Tablist; tabp; tabp = tabp->GetNext()) ((PTDBASE)tabp->GetTo_Tdb())->ResetDB(); - Tdbp = (PTDBASE)Tablist->GetTo_Tdb(); + Tdbp = (Tablist) ? (PTDBASE)Tablist->GetTo_Tdb() : NULL; Crp = 0; } // end of ResetDB @@ -679,7 +679,7 @@ bool TDBTBM::OpenDB(PGLOBAL g) /* Table already open, replace it at its beginning. */ /*******************************************************************/ ResetDB(); - return Tdbp->OpenDB(g); // Re-open fist table + return (Tdbp) ? Tdbp->OpenDB(g) : false; // Re-open fist table } // endif use #if 0 -- cgit v1.2.1 From 0b9fb9aea98dbe727ea0693ba91679b61885dcd9 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2016 10:45:15 +0100 Subject: MDEV-9568 mysqlcheck crashes with nonexistent table name remove erroneous free() call --- client/mysqlcheck.c | 1 - 1 file changed, 1 deletion(-) diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 267d847aa52..57b61574627 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -512,7 +512,6 @@ static int is_view(const char *table) { fprintf(stderr, "Failed to %s\n", query); fprintf(stderr, "Error: %s\n", mysql_error(sock)); - my_free(query); DBUG_RETURN(-1); } res= mysql_store_result(sock); -- cgit v1.2.1 From d1e6c40294446ebf2cb34233fa934640a1f4da4c Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 17 Mar 2016 17:58:40 +0100 Subject: mtr complains about klist is not found, if Kerberos is not installed on machines --- plugin/auth_gssapi/mysql-test/auth_gssapi/suite.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/auth_gssapi/mysql-test/auth_gssapi/suite.pm b/plugin/auth_gssapi/mysql-test/auth_gssapi/suite.pm index 50137ca0211..aa225536a1e 100644 --- a/plugin/auth_gssapi/mysql-test/auth_gssapi/suite.pm +++ b/plugin/auth_gssapi/mysql-test/auth_gssapi/suite.pm @@ -19,7 +19,7 @@ else { if (!$ENV{'GSSAPI_FULLNAME'}) { - my $s = `klist |grep 'Default principal: '`; + my $s = `klist 2>/dev/null |grep 'Default principal: '`; if ($s) { chomp($s); -- cgit v1.2.1 From fc2c1e4385d1b70e891548de7eb238cd4b4571aa Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2016 21:29:52 +0100 Subject: MDEV-9733 Server crashes in lf_pinbox_real_free on replication slaves don't allocate all the stack, leave some stack for function calls. To test I added the following line: alloca_size = available_stack_size() - X at X=4096 or less mysqld crashed, at 8192 mtr test passed. --- mysys/lf_alloc-pin.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mysys/lf_alloc-pin.c b/mysys/lf_alloc-pin.c index 6ab6ba3aae0..59f60f06696 100644 --- a/mysys/lf_alloc-pin.c +++ b/mysys/lf_alloc-pin.c @@ -103,6 +103,12 @@ #include #include +/* + when using alloca() leave at least that many bytes of the stack - + for functions we might be calling from within this stack frame +*/ +#define ALLOCA_SAFETY_MARGIN 8192 + #define LF_PINBOX_MAX_PINS 65536 static void _lf_pinbox_real_free(LF_PINS *pins); @@ -349,7 +355,8 @@ static void _lf_pinbox_real_free(LF_PINS *pins) { int alloca_size= sizeof(void *)*LF_PINBOX_PINS*npins; /* create a sorted list of pinned addresses, to speed up searches */ - if (available_stack_size(&pinbox, *pins->stack_ends_here) > alloca_size) + if (available_stack_size(&pinbox, *pins->stack_ends_here) > + alloca_size + ALLOCA_SAFETY_MARGIN) { struct st_harvester hv; addr= (void **) alloca(alloca_size); -- cgit v1.2.1 From 96a7e74ed350063d47b2b625cbfbad1e65706da2 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 18 Mar 2016 00:28:18 +0200 Subject: Extra space in the result file --- mysql-test/r/contributors.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/r/contributors.result b/mysql-test/r/contributors.result index a7db5d98d30..1820c0a5f06 100644 --- a/mysql-test/r/contributors.result +++ b/mysql-test/r/contributors.result @@ -3,7 +3,7 @@ Name Location Comment Booking.com http://www.booking.com Founding member of the MariaDB Foundation MariaDB Corporation https://mariadb.com Founding member of the MariaDB Foundation Auttomattic http://automattic.com Member of the MariaDB Foundation -Visma http://visma.com Member of the MariaDB Foundation +Visma http://visma.com Member of the MariaDB Foundation Nexedi http://www.nexedi.com Member of the MariaDB Foundation Acronis http://www.acronis.com Member of the MariaDB Foundation Verkkokauppa.com Finland Sponsor of the MariaDB Foundation -- cgit v1.2.1 From f448a800e173980c18023934f662fe7b8f7e2b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 17 Mar 2016 16:24:49 +0200 Subject: MDEV-9422: Checksum errors on restart when killing busy instance that uses encrypted XtraDB tables Analysis: -- InnoDB has n (>0) redo-log files. -- In the first page of redo-log there is 2 checkpoint records on fixed location (checkpoint is not encrypted) -- On every checkpoint record there is up to 5 crypt_keys containing the keys used for encryption/decryption -- On crash recovery we read all checkpoints on every file -- Recovery starts by reading from the latest checkpoint forward -- Problem is that latest checkpoint might not always contain the key we need to decrypt all the redo-log blocks (see MDEV-9422 for one example) -- Furthermore, there is no way to identify is the log block corrupted or encrypted For example checkpoint can contain following keys : write chk: 4 [ chk key ]: [ 5 1 ] [ 4 1 ] [ 3 1 ] [ 2 1 ] [ 1 1 ] so over time we could have a checkpoint write chk: 13 [ chk key ]: [ 14 1 ] [ 13 1 ] [ 12 1 ] [ 11 1 ] [ 10 1 ] killall -9 mysqld causes crash recovery and on crash recovery we read as many checkpoints as there is log files, e.g. read [ chk key ]: [ 13 1 ] [ 12 1 ] [ 11 1 ] [ 10 1 ] [ 9 1 ] read [ chk key ]: [ 14 1 ] [ 13 1 ] [ 12 1 ] [ 11 1 ] [ 10 1 ] [ 9 1 ] This is problematic, as we could still scan log blocks e.g. from checkpoint 4 and we do not know anymore the correct key. CRYPT INFO: for checkpoint 14 search 4 CRYPT INFO: for checkpoint 13 search 4 CRYPT INFO: for checkpoint 12 search 4 CRYPT INFO: for checkpoint 11 search 4 CRYPT INFO: for checkpoint 10 search 4 CRYPT INFO: for checkpoint 9 search 4 (NOTE: NOT FOUND) For every checkpoint, code generated a new encrypted key based on key from encryption plugin and random numbers. Only random numbers are stored on checkpoint. Fix: Generate only one key for every log file. If checkpoint contains only one key, use that key to encrypt/decrypt all log blocks. If checkpoint contains more than one key (this is case for databases created using MariaDB server version 10.1.0 - 10.1.12 if log encryption was used). If looked checkpoint_no is found from keys on checkpoint we use that key to decrypt the log block. For encryption we use always the first key. If the looked checkpoint_no is not found from keys on checkpoint we use the first key. Modified code also so that if log is not encrypted, we do not generate any empty keys. If we have a log block and no keys is found from checkpoint we assume that log block is unencrypted. Log corruption or missing keys is found by comparing log block checksums. If we have a keys but current log block checksum is correct we again assume log block to be unencrypted. This is because current implementation stores checksum only before encryption and new checksum after encryption but before disk write is not stored anywhere. --- .../encryption/r/innodb-log-encrypt-crash.result | 19 ++++++++++ .../suite/encryption/r/innodb-log-encrypt.result | 36 +++++++++---------- .../encryption/t/innodb-log-encrypt-crash.opt | 6 ++++ .../encryption/t/innodb-log-encrypt-crash.test | 38 ++++++++++++++++++++ .../suite/encryption/t/innodb-log-encrypt.test | 20 ++++++----- storage/innobase/include/log0recv.h | 12 +++++++ storage/innobase/log/log0crypt.cc | 13 +++++-- storage/innobase/log/log0log.cc | 21 ++++++++++- storage/innobase/log/log0recv.cc | 20 ++++++----- storage/xtradb/include/log0recv.h | 3 +- storage/xtradb/log/log0crypt.cc | 41 +++++++++++++++++----- storage/xtradb/log/log0log.cc | 36 +++++++++++++++++-- storage/xtradb/log/log0online.cc | 2 +- storage/xtradb/log/log0recv.cc | 37 +++++++++++-------- 14 files changed, 237 insertions(+), 67 deletions(-) create mode 100644 mysql-test/suite/encryption/r/innodb-log-encrypt-crash.result create mode 100644 mysql-test/suite/encryption/t/innodb-log-encrypt-crash.opt create mode 100644 mysql-test/suite/encryption/t/innodb-log-encrypt-crash.test diff --git a/mysql-test/suite/encryption/r/innodb-log-encrypt-crash.result b/mysql-test/suite/encryption/r/innodb-log-encrypt-crash.result new file mode 100644 index 00000000000..5310fb6ace2 --- /dev/null +++ b/mysql-test/suite/encryption/r/innodb-log-encrypt-crash.result @@ -0,0 +1,19 @@ +call mtr.add_suppression("InnoDB: New log files created, LSN=.*"); +call mtr.add_suppression("InnoDB: Creating foreign key constraint system tables."); +call mtr.add_suppression("InnoDB: Error: Table .*"); +CREATE TABLE t1 ( +pk bigint auto_increment, +col_int int, +col_int_key int, +col_char char(12), +col_char_key char(12), +primary key (pk), +key (`col_int_key` ), +key (`col_char_key` ) +) ENGINE=InnoDB; +CREATE TABLE t2 LIKE t1; +INSERT INTO t1 VALUES (NULL,1,1,'foo','foo'),(NULL,2,2,'bar','bar'),(NULL,3,3,'baz','baz'),(NULL,4,4,'qux','qux'); +INSERT INTO t2 +SELECT NULL, a1.col_int, a1.col_int_key, a1.col_char, a1.col_char_key +FROM t1 a1, t1 a2, t1 a3, t1 a4, t1 a5, t1 a6, t1 a7, t1 a8, t1 a9, t1 a10; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/encryption/r/innodb-log-encrypt.result b/mysql-test/suite/encryption/r/innodb-log-encrypt.result index 3e281efd08a..655e3023f7a 100644 --- a/mysql-test/suite/encryption/r/innodb-log-encrypt.result +++ b/mysql-test/suite/encryption/r/innodb-log-encrypt.result @@ -8,7 +8,7 @@ begin declare current_num int; set current_num = 0; while current_num < repeat_count do -insert into t1 values(current_num, substring(MD5(RAND()), -64), REPEAT('secredsecredsecred',10)); +insert into t1 values(current_num, substring(MD5(RAND()), -64), REPEAT('privatejanprivate',10)); set current_num = current_num + 1; end while; end// @@ -22,34 +22,34 @@ select count(*) from t1; count(*) 2000 # ibdata1 yes on expecting NOT FOUND -NOT FOUND /secredsecred/ in ibdata1 +NOT FOUND /privatejanprivate/ in ibdata1 # t1 yes on expecting NOT FOUND -NOT FOUND /secredsecred/ in t1.ibd +NOT FOUND /privatejanprivate/ in t1.ibd # log0 yes on expecting NOT FOUND -NOT FOUND /secredsecred/ in ib_logfile0 +NOT FOUND /privatejanprivate/ in ib_logfile0 # log1 yes on expecting NOT FOUND -NOT FOUND /secredsecred/ in ib_logfile1 +NOT FOUND /privatejanprivate/ in ib_logfile1 # Restart mysqld --innodb_encrypt_log=0 -insert into t1 values(5000, substring(MD5(RAND()), -64), REPEAT('notsecred',10)); -insert into t1 values(5001, substring(MD5(RAND()), -64), REPEAT('notsecred',10)); -insert into t1 values(5002, substring(MD5(RAND()), -64), REPEAT('notsecred',10)); -insert into t1 values(5003, substring(MD5(RAND()), -64), REPEAT('notsecred',10)); -insert into t1 values(5004, substring(MD5(RAND()), -64), REPEAT('notsecred',10)); +insert into t1 values(5000, substring(MD5(RAND()), -64), REPEAT('publicmessage',10)); +insert into t1 values(5001, substring(MD5(RAND()), -64), REPEAT('publicmessage',10)); +insert into t1 values(5002, substring(MD5(RAND()), -64), REPEAT('publicmessage',10)); +insert into t1 values(5003, substring(MD5(RAND()), -64), REPEAT('publicmessage',10)); +insert into t1 values(5004, substring(MD5(RAND()), -64), REPEAT('publicmessage',10)); # ibdata1 yes on expecting NOT FOUND -NOT FOUND /secredsecred/ in ibdata1 +NOT FOUND /privatejanprivate/ in ibdata1 # t1 yes on expecting NOT FOUND -NOT FOUND /secredsecred/ in t1.ibd +NOT FOUND /privatejanprivate/ in t1.ibd # log0 yes on expecting NOT FOUND -NOT FOUND /secredsecred/ in ib_logfile0 +NOT FOUND /privatejanprivate/ in ib_logfile0 # log1 yes on expecting NOT FOUND -NOT FOUND /secredsecred/ in ib_logfile1 +NOT FOUND /privatejanprivate/ in ib_logfile1 # ibdata1 yes on expecting NOT FOUND -NOT FOUND /notsecred/ in ibdata1 +NOT FOUND /publicmessage/ in ibdata1 # t1 yes on expecting NOT FOUND -NOT FOUND /notsecred/ in t1.ibd +NOT FOUND /publicmessage/ in t1.ibd # log0 no on expecting FOUND/NOTFOUND depending where insert goes -FOUND /notsecred/ in ib_logfile0 +FOUND /publicmessage/ in ib_logfile0 # log1 no on expecting FOUND/NOTFOUND depending where insert goes -NOT FOUND /notsecred/ in ib_logfile1 +NOT FOUND /publicmessage/ in ib_logfile1 drop procedure innodb_insert_proc; drop table t1; diff --git a/mysql-test/suite/encryption/t/innodb-log-encrypt-crash.opt b/mysql-test/suite/encryption/t/innodb-log-encrypt-crash.opt new file mode 100644 index 00000000000..e76aa060879 --- /dev/null +++ b/mysql-test/suite/encryption/t/innodb-log-encrypt-crash.opt @@ -0,0 +1,6 @@ +--innodb-encrypt-log=ON +--plugin-load-add=$FILE_KEY_MANAGEMENT_SO +--loose-file-key-management +--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/logkey.txt +--file-key-management-encryption-algorithm=aes_cbc +--innodb-buffer-pool-size=128M diff --git a/mysql-test/suite/encryption/t/innodb-log-encrypt-crash.test b/mysql-test/suite/encryption/t/innodb-log-encrypt-crash.test new file mode 100644 index 00000000000..8bb5f9f2c49 --- /dev/null +++ b/mysql-test/suite/encryption/t/innodb-log-encrypt-crash.test @@ -0,0 +1,38 @@ +-- source include/have_innodb.inc +-- source include/not_embedded.inc +-- source filekeys_plugin.inc + +call mtr.add_suppression("InnoDB: New log files created, LSN=.*"); +call mtr.add_suppression("InnoDB: Creating foreign key constraint system tables."); +call mtr.add_suppression("InnoDB: Error: Table .*"); + +# +# MDEV-9422: Checksum errors on restart when killing busy instance that uses encrypted XtraDB tables +# + +CREATE TABLE t1 ( + pk bigint auto_increment, + col_int int, + col_int_key int, + col_char char(12), + col_char_key char(12), + primary key (pk), + key (`col_int_key` ), + key (`col_char_key` ) +) ENGINE=InnoDB; +CREATE TABLE t2 LIKE t1; + +INSERT INTO t1 VALUES (NULL,1,1,'foo','foo'),(NULL,2,2,'bar','bar'),(NULL,3,3,'baz','baz'),(NULL,4,4,'qux','qux'); +INSERT INTO t2 + SELECT NULL, a1.col_int, a1.col_int_key, a1.col_char, a1.col_char_key + FROM t1 a1, t1 a2, t1 a3, t1 a4, t1 a5, t1 a6, t1 a7, t1 a8, t1 a9, t1 a10; + +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--shutdown_server 0 +--source include/wait_until_disconnected.inc + +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect +--enable_reconnect +--source include/wait_until_connected_again.inc + +DROP TABLE t1, t2; diff --git a/mysql-test/suite/encryption/t/innodb-log-encrypt.test b/mysql-test/suite/encryption/t/innodb-log-encrypt.test index b2abfadccc2..7c2e6f847b1 100644 --- a/mysql-test/suite/encryption/t/innodb-log-encrypt.test +++ b/mysql-test/suite/encryption/t/innodb-log-encrypt.test @@ -28,7 +28,7 @@ begin declare current_num int; set current_num = 0; while current_num < repeat_count do - insert into t1 values(current_num, substring(MD5(RAND()), -64), REPEAT('secredsecredsecred',10)); + insert into t1 values(current_num, substring(MD5(RAND()), -64), REPEAT('privatejanprivate',10)); set current_num = current_num + 1; end while; end// @@ -43,13 +43,15 @@ set autocommit=1; update t1 set c1 = c1 +1; select count(*) from t1; +-- source include/restart_mysqld.inc + --let $MYSQLD_DATADIR=`select @@datadir` --let ib1_IBD = $MYSQLD_DATADIR/ibdata1 --let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd --let log0 = $MYSQLD_DATADIR/ib_logfile0 --let log1 = $MYSQLD_DATADIR/ib_logfile1 --let SEARCH_RANGE = 10000000 ---let SEARCH_PATTERN=secredsecred +--let SEARCH_PATTERN=privatejanprivate --echo # ibdata1 yes on expecting NOT FOUND -- let SEARCH_FILE=$ib1_IBD @@ -68,13 +70,13 @@ select count(*) from t1; -- let $restart_parameters=--innodb_encrypt_log=0 -- source include/restart_mysqld.inc -insert into t1 values(5000, substring(MD5(RAND()), -64), REPEAT('notsecred',10)); -insert into t1 values(5001, substring(MD5(RAND()), -64), REPEAT('notsecred',10)); -insert into t1 values(5002, substring(MD5(RAND()), -64), REPEAT('notsecred',10)); -insert into t1 values(5003, substring(MD5(RAND()), -64), REPEAT('notsecred',10)); -insert into t1 values(5004, substring(MD5(RAND()), -64), REPEAT('notsecred',10)); +insert into t1 values(5000, substring(MD5(RAND()), -64), REPEAT('publicmessage',10)); +insert into t1 values(5001, substring(MD5(RAND()), -64), REPEAT('publicmessage',10)); +insert into t1 values(5002, substring(MD5(RAND()), -64), REPEAT('publicmessage',10)); +insert into t1 values(5003, substring(MD5(RAND()), -64), REPEAT('publicmessage',10)); +insert into t1 values(5004, substring(MD5(RAND()), -64), REPEAT('publicmessage',10)); ---let SEARCH_PATTERN=secredsecred +--let SEARCH_PATTERN=privatejanprivate --echo # ibdata1 yes on expecting NOT FOUND -- let SEARCH_FILE=$ib1_IBD -- source include/search_pattern_in_file.inc @@ -88,7 +90,7 @@ insert into t1 values(5004, substring(MD5(RAND()), -64), REPEAT('notsecred',10)) -- let SEARCH_FILE=$log1 -- source include/search_pattern_in_file.inc ---let SEARCH_PATTERN=notsecred +--let SEARCH_PATTERN=publicmessage --echo # ibdata1 yes on expecting NOT FOUND -- let SEARCH_FILE=$ib1_IBD -- source include/search_pattern_in_file.inc diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index e4a06fcc532..292953854f7 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -498,6 +498,18 @@ use these free frames to read in pages when we start applying the log records to the database. */ extern ulint recv_n_pool_free_frames; +/******************************************************//** +Checks the 4-byte checksum to the trailer checksum field of a log +block. We also accept a log block in the old format before +InnoDB-3.23.52 where the checksum field contains the log block number. +@return TRUE if ok, or if the log block may be in the format of InnoDB +version predating 3.23.52 */ +ibool +log_block_checksum_is_ok_or_old_format( +/*===================================*/ + const byte* block, /*!< in: pointer to a log block */ + bool print_err); /*!< in print error ? */ + #ifndef UNIV_NONINL #include "log0recv.ic" #endif diff --git a/storage/innobase/log/log0crypt.cc b/storage/innobase/log/log0crypt.cc index e90533c2e76..00de0252d6e 100644 --- a/storage/innobase/log/log0crypt.cc +++ b/storage/innobase/log/log0crypt.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. -Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved. +Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -156,12 +156,21 @@ log_blocks_crypt( info ? info->key_version : 0, log_block_start_lsn); #endif + /* If no key is found from checkpoint assume the log_block + to be unencrypted. If checkpoint contains the encryption key + compare log_block current checksum, if checksum matches, + block can't be encrypted. */ if (info == NULL || - info->key_version == UNENCRYPTED_KEY_VER) { + info->key_version == UNENCRYPTED_KEY_VER || + (log_block_checksum_is_ok_or_old_format(log_block, false) && + what == ENCRYPTION_FLAG_DECRYPT)) { memcpy(dst_block, log_block, OS_FILE_LOG_BLOCK_SIZE); goto next; } + ut_ad(what == ENCRYPTION_FLAG_DECRYPT ? !log_block_checksum_is_ok_or_old_format(log_block, false) : + log_block_checksum_is_ok_or_old_format(log_block, false)); + // Assume log block header is not encrypted memcpy(dst_block, log_block, LOG_BLOCK_HDR_SIZE); diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index fd3646a1691..31104b395c1 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Google Inc. -Copyright (c) 2013, SkySQL Ab. All Rights Reserved. +Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -52,6 +52,9 @@ Created 12/9/1995 Heikki Tuuri #include "trx0roll.h" #include "srv0mon.h" +/* Used for debugging */ +// #define DEBUG_CRYPT 1 + /* General philosophy of InnoDB redo-logs: @@ -2358,8 +2361,24 @@ loop: (ulint) (source_offset % UNIV_PAGE_SIZE), len, buf, NULL, 0); +#ifdef DEBUG_CRYPT + fprintf(stderr, "BEFORE DECRYPT: block: %lu checkpoint: %lu %.8lx %.8lx offset %lu\n", + log_block_get_hdr_no(buf), + log_block_get_checkpoint_no(buf), + log_block_calc_checksum(buf), + log_block_get_checksum(buf), source_offset); +#endif + log_decrypt_after_read(buf, len); +#ifdef DEBUG_CRYPT + fprintf(stderr, "AFTER DECRYPT: block: %lu checkpoint: %lu %.8lx %.8lx\n", + log_block_get_hdr_no(buf), + log_block_get_checkpoint_no(buf), + log_block_calc_checksum(buf), + log_block_get_checksum(buf)); +#endif + start_lsn += len; buf += len; diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index c84e8277f07..6e09143fb96 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -923,11 +923,11 @@ block. We also accept a log block in the old format before InnoDB-3.23.52 where the checksum field contains the log block number. @return TRUE if ok, or if the log block may be in the format of InnoDB version predating 3.23.52 */ -static ibool log_block_checksum_is_ok_or_old_format( /*===================================*/ - const byte* block) /*!< in: pointer to a log block */ + const byte* block, /*!< in: pointer to a log block */ + bool print_err) /*!< in print error ? */ { #ifdef UNIV_LOG_DEBUG return(TRUE); @@ -950,11 +950,13 @@ log_block_checksum_is_ok_or_old_format( return(TRUE); } - fprintf(stderr, "BROKEN: block: %lu checkpoint: %lu %.8lx %.8lx\n", - log_block_get_hdr_no(block), - log_block_get_checkpoint_no(block), - log_block_calc_checksum(block), - log_block_get_checksum(block)); + if (print_err) { + fprintf(stderr, "BROKEN: block: %lu checkpoint: %lu %.8lx %.8lx\n", + log_block_get_hdr_no(block), + log_block_get_checkpoint_no(block), + log_block_calc_checksum(block), + log_block_get_checksum(block)); + } return(FALSE); } @@ -2686,12 +2688,12 @@ recv_scan_log_recs( log_block_convert_lsn_to_no(scanned_lsn)); */ if (no != log_block_convert_lsn_to_no(scanned_lsn) - || !log_block_checksum_is_ok_or_old_format(log_block)) { + || !log_block_checksum_is_ok_or_old_format(log_block, true)) { log_crypt_err_t log_crypt_err; if (no == log_block_convert_lsn_to_no(scanned_lsn) && !log_block_checksum_is_ok_or_old_format( - log_block)) { + log_block, true)) { fprintf(stderr, "InnoDB: Log block no %lu at" " lsn " LSN_PF " has\n" diff --git a/storage/xtradb/include/log0recv.h b/storage/xtradb/include/log0recv.h index b23a140aac2..8fc5daaef1d 100644 --- a/storage/xtradb/include/log0recv.h +++ b/storage/xtradb/include/log0recv.h @@ -43,7 +43,8 @@ UNIV_INTERN ibool log_block_checksum_is_ok_or_old_format( /*===================================*/ - const byte* block); /*!< in: pointer to a log block */ + const byte* block, /*!< in: pointer to a log block */ + bool print_err); /*!< in print error ? */ /*******************************************************//** Calculates the new value for lsn when more data is added to the log. */ diff --git a/storage/xtradb/log/log0crypt.cc b/storage/xtradb/log/log0crypt.cc index e90533c2e76..852148899e9 100644 --- a/storage/xtradb/log/log0crypt.cc +++ b/storage/xtradb/log/log0crypt.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. -Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved. +Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -36,6 +36,8 @@ Modified Jan Lindström jan.lindstrom@mariadb.com #include "my_crypt.h" +/* Used for debugging */ +// #define DEBUG_CRYPT 1 #define UNENCRYPTED_KEY_VER 0 /* If true, enable redo log encryption. */ @@ -97,16 +99,24 @@ get_crypt_info( { /* so that no one is modifying array while we search */ ut_ad(mutex_own(&(log_sys->mutex))); + size_t items = crypt_info.size(); /* a log block only stores 4-bytes of checkpoint no */ checkpoint_no &= 0xFFFFFFFF; - for (size_t i = 0; i < crypt_info.size(); i++) { + for (size_t i = 0; i < items; i++) { struct crypt_info_t* it = &crypt_info[i]; if (it->checkpoint_no == checkpoint_no) { return it; } } + + /* If checkpoint contains more than one key and we did not + find the correct one use the first one. */ + if (items) { + return (&crypt_info[0]); + } + return NULL; } @@ -131,7 +141,8 @@ log_blocks_crypt( const byte* block, /*!< in: blocks before encrypt/decrypt*/ ulint size, /*!< in: size of block */ byte* dst_block, /*!< out: blocks after encrypt/decrypt */ - int what) /*!< in: encrypt or decrypt*/ + int what, /*!< in: encrypt or decrypt*/ + const crypt_info_t* crypt_info) /*!< in: crypt info or NULL */ { byte *log_block = (byte*)block; Crypt_result rc = MY_AES_OK; @@ -146,7 +157,8 @@ log_blocks_crypt( lsn_t log_block_start_lsn = log_block_get_start_lsn( lsn, log_block_no); - const crypt_info_t* info = get_crypt_info(log_block); + const crypt_info_t* info = crypt_info == NULL ? get_crypt_info(log_block) : + crypt_info; #ifdef DEBUG_CRYPT fprintf(stderr, "%s %lu chkpt: %lu key: %u lsn: %lu\n", @@ -156,12 +168,21 @@ log_blocks_crypt( info ? info->key_version : 0, log_block_start_lsn); #endif + /* If no key is found from checkpoint assume the log_block + to be unencrypted. If checkpoint contains the encryption key + compare log_block current checksum, if checksum matches, + block can't be encrypted. */ if (info == NULL || - info->key_version == UNENCRYPTED_KEY_VER) { + info->key_version == UNENCRYPTED_KEY_VER || + (log_block_checksum_is_ok_or_old_format(log_block, false) && + what == ENCRYPTION_FLAG_DECRYPT)) { memcpy(dst_block, log_block, OS_FILE_LOG_BLOCK_SIZE); goto next; } + ut_ad(what == ENCRYPTION_FLAG_DECRYPT ? !log_block_checksum_is_ok_or_old_format(log_block, false) : + log_block_checksum_is_ok_or_old_format(log_block, false)); + // Assume log block header is not encrypted memcpy(dst_block, log_block, LOG_BLOCK_HDR_SIZE); @@ -292,7 +313,7 @@ log_blocks_encrypt( const ulint size, /*!< in: size of blocks, must be multiple of a log block */ byte* dst_block) /*!< out: blocks after encryption */ { - return log_blocks_crypt(block, size, dst_block, ENCRYPTION_FLAG_ENCRYPT); + return log_blocks_crypt(block, size, dst_block, ENCRYPTION_FLAG_ENCRYPT, NULL); } /*********************************************************************//** @@ -355,14 +376,16 @@ log_encrypt_before_write( return; } - if (info->key_version == UNENCRYPTED_KEY_VER) { + /* If the key is not encrypted or user has requested not to + encrypt, do not change log block. */ + if (info->key_version == UNENCRYPTED_KEY_VER || !srv_encrypt_log) { return; } byte* dst_frame = (byte*)malloc(size); //encrypt log blocks content - Crypt_result result = log_blocks_crypt(block, size, dst_frame, ENCRYPTION_FLAG_ENCRYPT); + Crypt_result result = log_blocks_crypt(block, size, dst_frame, ENCRYPTION_FLAG_ENCRYPT, NULL); if (result == MY_AES_OK) { ut_ad(block[0] == dst_frame[0]); @@ -388,7 +411,7 @@ log_decrypt_after_read( byte* dst_frame = (byte*)malloc(size); // decrypt log blocks content - Crypt_result result = log_blocks_crypt(frame, size, dst_frame, ENCRYPTION_FLAG_DECRYPT); + Crypt_result result = log_blocks_crypt(frame, size, dst_frame, ENCRYPTION_FLAG_DECRYPT, NULL); if (result == MY_AES_OK) { memcpy(frame, dst_frame, size); diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc index 853afe70100..36531f3c6f4 100644 --- a/storage/xtradb/log/log0log.cc +++ b/storage/xtradb/log/log0log.cc @@ -2,6 +2,7 @@ Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Google Inc. +Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -33,10 +34,13 @@ Created 12/9/1995 Heikki Tuuri #include "config.h" #ifdef HAVE_ALLOCA_H #include "alloca.h" -#elif defined(HAVE_MALLOC_H) +#elif defined(HAVE_MALLOC_H) #include "malloc.h" #endif +/* Used for debugging */ +// #define DEBUG_CRYPT 1 + #include "log0log.h" #ifdef UNIV_NONINL @@ -1394,7 +1398,6 @@ log_group_file_header_flush( Stores a 4-byte checksum to the trailer checksum field of a log block before writing it to a log file. This checksum is used in recovery to check the consistency of a log block. */ -static void log_block_store_checksum( /*=====================*/ @@ -1512,6 +1515,14 @@ loop: log_encrypt_before_write(log_sys->next_checkpoint_no, buf, write_len); +#ifdef DEBUG_CRYPT + fprintf(stderr, "WRITE: block: %lu checkpoint: %lu %.8lx %.8lx\n", + log_block_get_hdr_no(buf), + log_block_get_checkpoint_no(buf), + log_block_calc_checksum(buf), + log_block_get_checksum(buf)); +#endif + fil_io(OS_FILE_WRITE | OS_FILE_LOG, true, group->space_id, 0, (ulint) (next_offset / UNIV_PAGE_SIZE), (ulint) (next_offset % UNIV_PAGE_SIZE), write_len, buf, @@ -2320,7 +2331,10 @@ log_checkpoint( * the checkpoint info has been written and THEN blocks will be encrypted * with new key */ - log_crypt_set_ver_and_key(log_sys->next_checkpoint_no + 1); + if (srv_encrypt_log) { + log_crypt_set_ver_and_key(log_sys->next_checkpoint_no + 1); + } + log_groups_write_checkpoint_info(); MONITOR_INC(MONITOR_NUM_CHECKPOINT); @@ -2585,8 +2599,24 @@ loop: mutex_enter(&log_sys->mutex); } +#ifdef DEBUG_CRYPT + fprintf(stderr, "BEFORE DECRYPT: block: %lu checkpoint: %lu %.8lx %.8lx offset %lu\n", + log_block_get_hdr_no(buf), + log_block_get_checkpoint_no(buf), + log_block_calc_checksum(buf), + log_block_get_checksum(buf), source_offset); +#endif + log_decrypt_after_read(buf, len); +#ifdef DEBUG_CRYPT + fprintf(stderr, "AFTER DECRYPT: block: %lu checkpoint: %lu %.8lx %.8lx\n", + log_block_get_hdr_no(buf), + log_block_get_checkpoint_no(buf), + log_block_calc_checksum(buf), + log_block_get_checksum(buf)); +#endif + if (release_mutex) { mutex_exit(&log_sys->mutex); } diff --git a/storage/xtradb/log/log0online.cc b/storage/xtradb/log/log0online.cc index 92f03f0e6a9..51a9fa8f6c5 100644 --- a/storage/xtradb/log/log0online.cc +++ b/storage/xtradb/log/log0online.cc @@ -905,7 +905,7 @@ log_online_is_valid_log_seg( const byte* log_block) /*!< in: read log data */ { ibool checksum_is_ok - = log_block_checksum_is_ok_or_old_format(log_block); + = log_block_checksum_is_ok_or_old_format(log_block, true); if (!checksum_is_ok) { diff --git a/storage/xtradb/log/log0recv.cc b/storage/xtradb/log/log0recv.cc index c9bf5cf3f9e..f98adbbca08 100644 --- a/storage/xtradb/log/log0recv.cc +++ b/storage/xtradb/log/log0recv.cc @@ -2,7 +2,7 @@ Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2013, 2016, MariaDB Corporation. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -43,7 +43,7 @@ Created 9/20/1997 Heikki Tuuri #include "config.h" #ifdef HAVE_ALLOCA_H #include "alloca.h" -#elif defined(HAVE_MALLOC_H) +#elif defined(HAVE_MALLOC_H) #include "malloc.h" #endif @@ -932,7 +932,8 @@ UNIV_INTERN ibool log_block_checksum_is_ok_or_old_format( /*===================================*/ - const byte* block) /*!< in: pointer to a log block */ + const byte* block, /*!< in: pointer to a log block */ + bool print_err) /*!< in print if error found */ { #ifdef UNIV_LOG_DEBUG return(TRUE); @@ -1015,11 +1016,13 @@ log_block_checksum_is_ok_or_old_format( return(TRUE); } - fprintf(stderr, "BROKEN: block: %lu checkpoint: %lu %.8lx %.8lx\n", - log_block_get_hdr_no(block), - log_block_get_checkpoint_no(block), - log_block_calc_checksum(block), - log_block_get_checksum(block)); + if (print_err) { + fprintf(stderr, "BROKEN: block: %lu checkpoint: %lu %.8lx %.8lx\n", + log_block_get_hdr_no(block), + log_block_get_checkpoint_no(block), + log_block_calc_checksum(block), + log_block_get_checksum(block)); + } return(FALSE); } @@ -2734,6 +2737,7 @@ recv_scan_log_recs( ibool finished; ulint data_len; ibool more_data; + bool maybe_encrypted=false; ut_ad(start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0); ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0); @@ -2748,6 +2752,8 @@ recv_scan_log_recs( *err = DB_SUCCESS; do { + log_crypt_err_t log_crypt_err; + no = log_block_get_hdr_no(log_block); /* fprintf(stderr, "Log block header no %lu\n", no); @@ -2755,13 +2761,13 @@ recv_scan_log_recs( fprintf(stderr, "Scanned lsn no %lu\n", log_block_convert_lsn_to_no(scanned_lsn)); */ + if (no != log_block_convert_lsn_to_no(scanned_lsn) - || !log_block_checksum_is_ok_or_old_format(log_block)) { - log_crypt_err_t log_crypt_err; + || !log_block_checksum_is_ok_or_old_format(log_block, true)) { if (no == log_block_convert_lsn_to_no(scanned_lsn) && !log_block_checksum_is_ok_or_old_format( - log_block)) { + log_block, true)) { fprintf(stderr, "InnoDB: Log block no %lu at" " lsn " LSN_PF " has\n" @@ -2775,12 +2781,14 @@ recv_scan_log_recs( log_block)); } + maybe_encrypted = log_crypt_block_maybe_encrypted(log_block, + &log_crypt_err); + /* Garbage or an incompletely written log block */ finished = TRUE; - if (log_crypt_block_maybe_encrypted(log_block, - &log_crypt_err)) { + if (maybe_encrypted) { /* Log block maybe encrypted finish processing*/ log_crypt_print_error(log_crypt_err); *err = DB_ERROR; @@ -2790,12 +2798,13 @@ recv_scan_log_recs( /* Stop if we encounter a garbage log block */ if (!srv_force_recovery) { fputs("InnoDB: Set innodb_force_recovery" - " to ignore this error.\n", stderr); + " to ignore this error.\n", stderr); *err = DB_ERROR; return (TRUE); } break; + } if (log_block_get_flush_bit(log_block)) { -- cgit v1.2.1 From 4aac51db9a55a11574cbfa60484d4329d35b6f2c Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 16 Mar 2016 17:04:32 +0400 Subject: MDEV-9587 - Debian packaging for GSSAPI plugin --- debian/control | 13 +++++++++++++ debian/mariadb-gssapi-client-10.1.files | 1 + debian/mariadb-gssapi-server-10.1.files | 1 + 3 files changed, 15 insertions(+) create mode 100644 debian/mariadb-gssapi-client-10.1.files create mode 100644 debian/mariadb-gssapi-server-10.1.files diff --git a/debian/control b/debian/control index 91e5fff32c2..218f9544e46 100644 --- a/debian/control +++ b/debian/control @@ -12,6 +12,7 @@ Build-Depends: bison, libaio-dev, libboost-dev, libjudy-dev, + libkrb5-dev, libncurses5-dev (>= 5.0-6~), libpam0g-dev, libreadline-gplv2-dev, @@ -429,3 +430,15 @@ Depends: libcrack2 (>= 2.9.0), mariadb-server-10.1 Description: CrackLib Password Validation Plugin for MariaDB This password validation plugin uses cracklib to allow only sufficiently secure (as defined by cracklib) user passwords in MariaDB. + +Package: mariadb-gssapi-server-10.1 +Section: database +Architecture: any +Depends: libgssapi-krb5-2, mariadb-server-10.1 +Description: GSSAPI authentication plugin for MariaDB server + +Package: mariadb-gssapi-client-10.1 +Section: database +Architecture: any +Depends: libgssapi-krb5-2, mariadb-client-10.1 +Description: GSSAPI authentication plugin for MariaDB client diff --git a/debian/mariadb-gssapi-client-10.1.files b/debian/mariadb-gssapi-client-10.1.files new file mode 100644 index 00000000000..5a089e9352e --- /dev/null +++ b/debian/mariadb-gssapi-client-10.1.files @@ -0,0 +1 @@ +usr/lib/mysql/plugin/auth_gssapi_client.so diff --git a/debian/mariadb-gssapi-server-10.1.files b/debian/mariadb-gssapi-server-10.1.files new file mode 100644 index 00000000000..d5e7b362a74 --- /dev/null +++ b/debian/mariadb-gssapi-server-10.1.files @@ -0,0 +1 @@ +usr/lib/mysql/plugin/auth_gssapi.so -- cgit v1.2.1 From ee768d8e0e17b655f8f51bc631fb77c68f48c722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 18 Mar 2016 11:48:49 +0200 Subject: MDEV-9640: Add used key_id to INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION --- .../suite/encryption/r/innodb_encryption.result | 1 + .../suite/encryption/r/innodb_encryption_is.result | 14 ++++++++++ .../suite/encryption/t/innodb_encryption_is.opt | 1 + .../suite/encryption/t/innodb_encryption_is.test | 31 ++++++++++++++++++++++ .../innodb/r/innodb_skip_innodb_is_tables.result | 2 +- storage/innobase/fil/fil0crypt.cc | 3 ++- storage/innobase/handler/i_s.cc | 13 ++++++++- storage/innobase/include/fil0crypt.h | 1 + storage/xtradb/fil/fil0crypt.cc | 3 ++- storage/xtradb/handler/ha_innodb.cc | 21 +++++++-------- storage/xtradb/handler/i_s.cc | 13 ++++++++- storage/xtradb/include/fil0crypt.h | 1 + 12 files changed, 88 insertions(+), 16 deletions(-) create mode 100644 mysql-test/suite/encryption/r/innodb_encryption_is.result create mode 100644 mysql-test/suite/encryption/t/innodb_encryption_is.opt create mode 100644 mysql-test/suite/encryption/t/innodb_encryption_is.test diff --git a/mysql-test/suite/encryption/r/innodb_encryption.result b/mysql-test/suite/encryption/r/innodb_encryption.result index 283c78e33d3..9b762bbba11 100644 --- a/mysql-test/suite/encryption/r/innodb_encryption.result +++ b/mysql-test/suite/encryption/r/innodb_encryption.result @@ -16,6 +16,7 @@ MIN_KEY_VERSION int(11) unsigned NO 0 CURRENT_KEY_VERSION int(11) unsigned NO 0 KEY_ROTATION_PAGE_NUMBER bigint(21) unsigned YES NULL KEY_ROTATION_MAX_PAGE_NUMBER bigint(21) unsigned YES NULL +CURRENT_KEY_ID int(11) unsigned NO 0 # Wait max 5 min for key encryption threads to encrypt one space # Success! # Wait max 10 min for key encryption threads to encrypt all space diff --git a/mysql-test/suite/encryption/r/innodb_encryption_is.result b/mysql-test/suite/encryption/r/innodb_encryption_is.result new file mode 100644 index 00000000000..5bbcbbe6bb6 --- /dev/null +++ b/mysql-test/suite/encryption/r/innodb_encryption_is.result @@ -0,0 +1,14 @@ +SET GLOBAL innodb_file_format = `Barracuda`; +SET GLOBAL innodb_file_per_table = ON; +CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1; +CREATE TABLE t2 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2; +INSERT INTO t1 VALUES ('foobar'); +INSERT INTO t2 VALUES ('foobar'); +SELECT NAME, ENCRYPTION_SCHEME, MIN_KEY_VERSION, CURRENT_KEY_VERSION, +CURRENT_KEY_ID +FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION +WHERE NAME LIKE '%t1' OR NAME LIKE '%t2'; +NAME ENCRYPTION_SCHEME MIN_KEY_VERSION CURRENT_KEY_VERSION CURRENT_KEY_ID +test/t1 1 1 1 1 +test/t2 1 1 1 2 +DROP TABLE t1, t2; diff --git a/mysql-test/suite/encryption/t/innodb_encryption_is.opt b/mysql-test/suite/encryption/t/innodb_encryption_is.opt new file mode 100644 index 00000000000..26c706840e8 --- /dev/null +++ b/mysql-test/suite/encryption/t/innodb_encryption_is.opt @@ -0,0 +1 @@ +--loose-innodb-tablespaces-encryption diff --git a/mysql-test/suite/encryption/t/innodb_encryption_is.test b/mysql-test/suite/encryption/t/innodb_encryption_is.test new file mode 100644 index 00000000000..333bb84c634 --- /dev/null +++ b/mysql-test/suite/encryption/t/innodb_encryption_is.test @@ -0,0 +1,31 @@ +-- source include/have_innodb.inc +-- source include/have_file_key_management_plugin.inc + +--disable_query_log +let $innodb_file_format_orig = `SELECT @@innodb_file_format`; +let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; +--enable_query_log + +SET GLOBAL innodb_file_format = `Barracuda`; +SET GLOBAL innodb_file_per_table = ON; + +CREATE TABLE t1 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=1; +CREATE TABLE t2 (c VARCHAR(8)) ENGINE=InnoDB ENCRYPTED=YES ENCRYPTION_KEY_ID=2; +INSERT INTO t1 VALUES ('foobar'); +INSERT INTO t2 VALUES ('foobar'); + +# +# MDEV-9640: Add used key_id to INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION +# +SELECT NAME, ENCRYPTION_SCHEME, MIN_KEY_VERSION, CURRENT_KEY_VERSION, +CURRENT_KEY_ID +FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION +WHERE NAME LIKE '%t1' OR NAME LIKE '%t2'; + +DROP TABLE t1, t2; + +# reset system +--disable_query_log +EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig; +EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig; +--enable_query_log 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 db7be5c9586..3280726729f 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 @@ -376,7 +376,7 @@ space_id page_id start_lsn end_lsn Warnings: Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_changed_pages but the InnoDB storage engine is not installed select * from information_schema.innodb_tablespaces_encryption; -SPACE NAME ENCRYPTION_SCHEME KEYSERVER_REQUESTS MIN_KEY_VERSION CURRENT_KEY_VERSION KEY_ROTATION_PAGE_NUMBER KEY_ROTATION_MAX_PAGE_NUMBER +SPACE NAME ENCRYPTION_SCHEME KEYSERVER_REQUESTS MIN_KEY_VERSION CURRENT_KEY_VERSION KEY_ROTATION_PAGE_NUMBER KEY_ROTATION_MAX_PAGE_NUMBER CURRENT_KEY_ID Warnings: Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_tablespaces_encryption but the InnoDB storage engine is not installed select * from information_schema.innodb_tablespaces_scrubbing; diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 79a2eca56d5..ceffa950739 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1,6 +1,6 @@ /***************************************************************************** Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. -Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved. +Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -2522,6 +2522,7 @@ fil_space_crypt_get_status( mutex_enter(&crypt_data->mutex); status->keyserver_requests = crypt_data->keyserver_requests; status->min_key_version = crypt_data->min_key_version; + status->key_id = crypt_data->key_id; if (crypt_data->rotate_state.active_threads > 0 || crypt_data->rotate_state.flushing) { diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index ef69e7df29d..991e1b9f47f 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2015, Oracle and/or its affiliates. -Copyrigth (c) 2014, 2015, MariaDB Corporation +Copyrigth (c) 2014, 2016, 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 @@ -8134,6 +8134,15 @@ static ST_FIELD_INFO innodb_tablespaces_encryption_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, +#define TABLESPACES_ENCRYPTION_CURRENT_KEY_ID 8 + {STRUCT_FLD(field_name, "CURRENT_KEY_ID"), + STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + END_OF_ST_FIELD_INFO }; @@ -8172,6 +8181,8 @@ i_s_dict_fill_tablespaces_encryption( status.min_key_version)); OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_VERSION]->store( status.current_key_version)); + OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_ID]->store( + status.key_id)); if (status.rotating) { fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->set_notnull(); OK(fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->store( diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h index aa601f28e25..fdc413e7520 100644 --- a/storage/innobase/include/fil0crypt.h +++ b/storage/innobase/include/fil0crypt.h @@ -333,6 +333,7 @@ struct fil_space_crypt_status_t { uint min_key_version; /*!< min key version */ uint current_key_version;/*!< current key version */ uint keyserver_requests;/*!< no of key requests to key server */ + ulint key_id; /*!< current key_id */ bool rotating; /*!< is key rotation ongoing */ bool flushing; /*!< is flush at end of rotation ongoing */ ulint rotate_next_page_number; /*!< next page if key rotating */ diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc index 79a2eca56d5..ceffa950739 100644 --- a/storage/xtradb/fil/fil0crypt.cc +++ b/storage/xtradb/fil/fil0crypt.cc @@ -1,6 +1,6 @@ /***************************************************************************** Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. -Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved. +Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -2522,6 +2522,7 @@ fil_space_crypt_get_status( mutex_enter(&crypt_data->mutex); status->keyserver_requests = crypt_data->keyserver_requests; status->min_key_version = crypt_data->min_key_version; + status->key_id = crypt_data->key_id; if (crypt_data->rotate_state.active_threads > 0 || crypt_data->rotate_state.flushing) { diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index f459f41fbc7..e11982de694 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -1,11 +1,10 @@ /***************************************************************************** Copyright (c) 2000, 2015, Oracle and/or its affiliates. -Copyright (c) 2013, 2015, MariaDB Corporation. +Copyright (c) 2013, 2016, MariaDB Corporation. Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2009, Percona Inc. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2014 SkySQL Ab. All Rights Reserved. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -8317,7 +8316,7 @@ ha_innobase::write_row( if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -8670,7 +8669,7 @@ func_exit: if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -9090,7 +9089,7 @@ ha_innobase::update_row( if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -9211,7 +9210,7 @@ wsrep_error: if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -12739,7 +12738,7 @@ ha_innobase::truncate() if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -12760,7 +12759,7 @@ ha_innobase::truncate() if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -14156,7 +14155,7 @@ ha_innobase::analyze( if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -14172,7 +14171,7 @@ ha_innobase::analyze( if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } @@ -15387,7 +15386,7 @@ ha_innobase::transactional_table_lock( if (share->ib_table != prebuilt->table) { fprintf(stderr, - "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %d.", + "InnoDB: Warning: share->ib_table %p prebuilt->table %p table %s is_corrupt %lu.", share->ib_table, prebuilt->table, prebuilt->table->name, prebuilt->table->is_corrupt); } diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc index e124cb98f99..09e72114711 100644 --- a/storage/xtradb/handler/i_s.cc +++ b/storage/xtradb/handler/i_s.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyrigth (c) 2014, 2015, MariaDB Corporation +Copyrigth (c) 2014, 2016, 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 @@ -8468,6 +8468,15 @@ static ST_FIELD_INFO innodb_tablespaces_encryption_fields_info[] = STRUCT_FLD(old_name, ""), STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, +#define TABLESPACES_ENCRYPTION_CURRENT_KEY_ID 8 + {STRUCT_FLD(field_name, "CURRENT_KEY_ID"), + STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + END_OF_ST_FIELD_INFO }; @@ -8506,6 +8515,8 @@ i_s_dict_fill_tablespaces_encryption( status.min_key_version)); OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_VERSION]->store( status.current_key_version)); + OK(fields[TABLESPACES_ENCRYPTION_CURRENT_KEY_ID]->store( + status.key_id)); if (status.rotating) { fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->set_notnull(); OK(fields[TABLESPACES_ENCRYPTION_KEY_ROTATION_PAGE_NUMBER]->store( diff --git a/storage/xtradb/include/fil0crypt.h b/storage/xtradb/include/fil0crypt.h index 32462661cd6..5deed1f001c 100644 --- a/storage/xtradb/include/fil0crypt.h +++ b/storage/xtradb/include/fil0crypt.h @@ -333,6 +333,7 @@ struct fil_space_crypt_status_t { uint min_key_version; /*!< min key version */ uint current_key_version;/*!< current key version */ uint keyserver_requests;/*!< no of key requests to key server */ + ulint key_id; /*!< current key_id */ bool rotating; /*!< is key rotation ongoing */ bool flushing; /*!< is flush at end of rotation ongoing */ ulint rotate_next_page_number; /*!< next page if key rotating */ -- cgit v1.2.1 From 4f0fc0f91281004fb91cf293e691a52125c4069d Mon Sep 17 00:00:00 2001 From: Akira Higuchi Date: Tue, 11 Aug 2015 15:42:25 +0900 Subject: fix a memory leak in handlersocket --- plugin/handler_socket/handlersocket/database.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/plugin/handler_socket/handlersocket/database.cpp b/plugin/handler_socket/handlersocket/database.cpp index 8ea7b5061a1..7c2c5e797d2 100644 --- a/plugin/handler_socket/handlersocket/database.cpp +++ b/plugin/handler_socket/handlersocket/database.cpp @@ -304,6 +304,7 @@ dbcontext::init_thread(const void *stack_bottom, volatile int& shutdown_flag) thd->db = 0; thd->db = my_strdup("handlersocket", MYF(0)); } + thd->variables.option_bits |= OPTION_TABLE_LOCK; my_pthread_setspecific_ptr(THR_THD, thd); DBG_THR(fprintf(stderr, "HNDSOCK x0 %p\n", thd)); } -- cgit v1.2.1 From 1c84836819b3cfdb8e357896f8b2a3f15e573f9b Mon Sep 17 00:00:00 2001 From: Akira Higuchi Date: Tue, 11 Aug 2015 15:51:54 +0900 Subject: fix that mysqld aborts on exit if an open handlersocket connection remains --- plugin/handler_socket/handlersocket/database.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/handler_socket/handlersocket/database.cpp b/plugin/handler_socket/handlersocket/database.cpp index 7c2c5e797d2..b05b6384565 100644 --- a/plugin/handler_socket/handlersocket/database.cpp +++ b/plugin/handler_socket/handlersocket/database.cpp @@ -344,7 +344,7 @@ void dbcontext::term_thread() { DBG_THR(fprintf(stderr, "HNDSOCK thread end %p\n", thd)); - unlock_tables_if(); + close_tables_if(); my_pthread_setspecific_ptr(THR_THD, 0); { pthread_mutex_lock(&LOCK_thread_count); -- cgit v1.2.1 From 546e9139abadc016b93c6cef610efcc627bfe016 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Sun, 28 Feb 2016 20:53:07 +0400 Subject: Fixed plugins.cracklib_password_check failure In RHEL7/RHEL7.1 libcrack behavior seem to have been modified so that "foobar" password is considered bad (due to descending "ba") earlier than expected. For details google for cracklib-2.9.0-simplistic.patch. Adjusted affected passwords not to have descending and ascending sequences. --- mysql-test/suite/plugins/r/cracklib_password_check.result | 4 ++-- mysql-test/suite/plugins/t/cracklib_password_check.test | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/plugins/r/cracklib_password_check.result b/mysql-test/suite/plugins/r/cracklib_password_check.result index 62f0e32b66a..9a58c169177 100644 --- a/mysql-test/suite/plugins/r/cracklib_password_check.result +++ b/mysql-test/suite/plugins/r/cracklib_password_check.result @@ -13,13 +13,13 @@ PLUGIN_LICENSE GPL LOAD_OPTION ON PLUGIN_MATURITY Alpha PLUGIN_AUTH_VERSION 1.0 -grant select on *.* to foobar identified by 'foobar'; +grant select on *.* to foocar identified by 'foocar'; ERROR HY000: Your password does not satisfy the current policy requirements show warnings; Level Code Message Warning 1819 cracklib: it is based on your username Error 1819 Your password does not satisfy the current policy requirements -grant select on *.* to foobar identified by 'raboof'; +grant select on *.* to foocar identified by 'racoof'; ERROR HY000: Your password does not satisfy the current policy requirements show warnings; Level Code Message diff --git a/mysql-test/suite/plugins/t/cracklib_password_check.test b/mysql-test/suite/plugins/t/cracklib_password_check.test index a8f404009d0..d0e05fed926 100644 --- a/mysql-test/suite/plugins/t/cracklib_password_check.test +++ b/mysql-test/suite/plugins/t/cracklib_password_check.test @@ -12,11 +12,11 @@ select * from information_schema.plugins where plugin_name='cracklib_password_ch --horizontal_results --error ER_NOT_VALID_PASSWORD -grant select on *.* to foobar identified by 'foobar'; +grant select on *.* to foocar identified by 'foocar'; show warnings; --error ER_NOT_VALID_PASSWORD -grant select on *.* to foobar identified by 'raboof'; +grant select on *.* to foocar identified by 'racoof'; show warnings; --error ER_NOT_VALID_PASSWORD -- cgit v1.2.1 From b25373beb52af6de43a70a0883918a0d2fd60c53 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 18 Mar 2016 17:50:18 +0400 Subject: MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool) MDEV-9752 Wrong data type for COALEASCE(?,1) in prepared statements --- mysql-test/r/func_hybrid_type.result | 39 +++++++++++++-- mysql-test/r/type_num.result | 28 +++++++++++ mysql-test/t/func_hybrid_type.test | 23 +++++++++ mysql-test/t/type_num.test | 24 ++++++++++ sql/item_cmpfunc.cc | 93 +++++------------------------------- sql/item_cmpfunc.h | 17 +++++-- sql/item_func.cc | 34 ++++++------- sql/item_func.h | 16 ++++--- 8 files changed, 161 insertions(+), 113 deletions(-) diff --git a/mysql-test/r/func_hybrid_type.result b/mysql-test/r/func_hybrid_type.result index 95a8a8235d4..eeaa79e7dce 100644 --- a/mysql-test/r/func_hybrid_type.result +++ b/mysql-test/r/func_hybrid_type.result @@ -2175,10 +2175,10 @@ def case_____a_b 12 19 19 Y 128 0 63 def case_____b_a 12 19 19 Y 128 0 63 def coalesce_a_b 12 19 19 Y 128 0 63 def coalesce_b_a 12 19 19 Y 128 0 63 -def if_______a_b 12 10 19 Y 128 0 63 -def if_______b_a 12 10 19 Y 128 0 63 -def ifnull___a_b 12 10 19 Y 128 0 63 -def ifnull___b_a 12 10 19 Y 128 0 63 +def if_______a_b 12 19 19 Y 128 0 63 +def if_______b_a 12 19 19 Y 128 0 63 +def ifnull___a_b 12 19 19 Y 128 0 63 +def ifnull___b_a 12 19 19 Y 128 0 63 def least____a_b 12 10 19 Y 128 0 63 def least____b_a 12 10 19 Y 128 0 63 def greatest_a_b 12 10 19 Y 128 0 63 @@ -3396,5 +3396,36 @@ c1 DROP TABLE t2; DROP TABLE t1; # +# MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool) +# +SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END; +CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END +NULL +SELECT CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END; +CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END +NULL +SELECT CASE WHEN TRUE THEN COALESCE(NULL) ELSE 4 END; +CASE WHEN TRUE THEN COALESCE(NULL) ELSE 4 END +NULL +SELECT COALESCE(COALESCE(NULL), 1.1) AS c0, IF(0, COALESCE(NULL), 1.1) AS c1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0 246 4 3 Y 32896 1 63 +def c1 246 4 3 Y 32896 1 63 +c0 c1 +1.1 1.1 +# +# MDEV-9752 Wrong data type for COALEASCE(?,1) in prepared statements +# +PREPARE stmt FROM "CREATE TABLE t1 AS SELECT CONCAT(COALESCE(?,1)) AS a, CONCAT(CASE WHEN TRUE THEN ? ELSE 1 END) AS b"; +SET @a=1; +EXECUTE stmt USING @a,@a; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(21) DEFAULT NULL, + `b` varchar(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# # End of 10.1 tests # diff --git a/mysql-test/r/type_num.result b/mysql-test/r/type_num.result index cbac7b6f445..9ee67ac8f33 100644 --- a/mysql-test/r/type_num.result +++ b/mysql-test/r/type_num.result @@ -1220,3 +1220,31 @@ Warning 1292 Truncated incorrect DOUBLE value: '1E+' # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool) +# +SELECT NULL+1 AS c0, +COALESCE(NULL)+1 AS c2, +COALESCE(COALESCE(NULL))+1 AS c3, +''+1 AS c4, +COALESCE('')+1 AS c5, +COALESCE(COALESCE(''))+1 AS c6; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def c0 5 17 0 Y 32896 0 63 +def c2 5 17 0 Y 32896 0 63 +def c3 5 17 0 Y 32896 0 63 +def c4 5 23 1 N 32897 31 63 +def c5 5 17 1 N 32897 0 63 +def c6 5 17 1 N 32897 0 63 +c0 c2 c3 c4 c5 c6 +NULL NULL NULL 1 1 1 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '' +Warning 1292 Truncated incorrect DOUBLE value: '' +Warning 1292 Truncated incorrect DOUBLE value: '' +# +# Start of 10.1 tests +# diff --git a/mysql-test/t/func_hybrid_type.test b/mysql-test/t/func_hybrid_type.test index 047e5f7b72e..dd8a399025b 100644 --- a/mysql-test/t/func_hybrid_type.test +++ b/mysql-test/t/func_hybrid_type.test @@ -433,6 +433,29 @@ DROP TABLE t2; DROP TABLE t1; +--echo # +--echo # MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool) +--echo # +SELECT CASE 0 WHEN 1 THEN (CASE 2 WHEN 3 THEN NULL END) WHEN 4 THEN 5 END; +SELECT CASE 0 WHEN 1 THEN (COALESCE(NULL)) WHEN 4 THEN 5 END; +SELECT CASE WHEN TRUE THEN COALESCE(NULL) ELSE 4 END; + +--disable_ps_protocol +--enable_metadata +SELECT COALESCE(COALESCE(NULL), 1.1) AS c0, IF(0, COALESCE(NULL), 1.1) AS c1; +--disable_metadata +--enable_ps_protocol + + +--echo # +--echo # MDEV-9752 Wrong data type for COALEASCE(?,1) in prepared statements +--echo # +PREPARE stmt FROM "CREATE TABLE t1 AS SELECT CONCAT(COALESCE(?,1)) AS a, CONCAT(CASE WHEN TRUE THEN ? ELSE 1 END) AS b"; +SET @a=1; +EXECUTE stmt USING @a,@a; +SHOW CREATE TABLE t1; +DROP TABLE t1; + --echo # --echo # End of 10.1 tests --echo # diff --git a/mysql-test/t/type_num.test b/mysql-test/t/type_num.test index 6ed04c8e1d3..64242e34160 100644 --- a/mysql-test/t/type_num.test +++ b/mysql-test/t/type_num.test @@ -681,3 +681,27 @@ SELECT --echo # --echo # End of 10.0 tests --echo # + +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-9653 Assertion `length || !scale' failed in uint my_decimal_length_to_precision(uint, uint, bool) +--echo # + +--disable_ps_protocol +--enable_metadata +SELECT NULL+1 AS c0, + COALESCE(NULL)+1 AS c2, + COALESCE(COALESCE(NULL))+1 AS c3, + ''+1 AS c4, + COALESCE('')+1 AS c5, + COALESCE(COALESCE(''))+1 AS c6; +--disable_metadata +--enable_ps_protocol + + +--echo # +--echo # Start of 10.1 tests +--echo # diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 2783a0500df..4819a7a9086 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2246,50 +2246,6 @@ void Item_func_between::print(String *str, enum_query_type query_type) } -void -Item_func_case_abbreviation2::fix_length_and_dec2(Item **args) -{ - uint32 char_length; - set_handler_by_field_type(agg_field_type(args, 2, true)); - maybe_null=args[0]->maybe_null || args[1]->maybe_null; - decimals= MY_MAX(args[0]->decimals, args[1]->decimals); - unsigned_flag= args[0]->unsigned_flag && args[1]->unsigned_flag; - - if (Item_func_case_abbreviation2::result_type() == DECIMAL_RESULT || - Item_func_case_abbreviation2::result_type() == INT_RESULT) - { - int len0= args[0]->max_char_length() - args[0]->decimals - - (args[0]->unsigned_flag ? 0 : 1); - - int len1= args[1]->max_char_length() - args[1]->decimals - - (args[1]->unsigned_flag ? 0 : 1); - - char_length= MY_MAX(len0, len1) + decimals + (unsigned_flag ? 0 : 1); - } - else - char_length= MY_MAX(args[0]->max_char_length(), args[1]->max_char_length()); - - switch (Item_func_case_abbreviation2::result_type()) { - case STRING_RESULT: - if (count_string_result_length(Item_func_case_abbreviation2::field_type(), - args, 2)) - return; - break; - case DECIMAL_RESULT: - case REAL_RESULT: - break; - case INT_RESULT: - decimals= 0; - break; - case ROW_RESULT: - case TIME_RESULT: - DBUG_ASSERT(0); - } - fix_char_length(char_length); -} - - - uint Item_func_case_abbreviation2::decimal_precision2(Item **args) const { int arg0_int_part= args[0]->decimal_int_part(); @@ -3076,24 +3032,6 @@ bool Item_func_case::fix_fields(THD *thd, Item **ref) } -void Item_func_case::agg_str_lengths(Item* arg) -{ - fix_char_length(MY_MAX(max_char_length(), arg->max_char_length())); - set_if_bigger(decimals, arg->decimals); - unsigned_flag= unsigned_flag && arg->unsigned_flag; -} - - -void Item_func_case::agg_num_lengths(Item *arg) -{ - uint len= my_decimal_length_to_precision(arg->max_length, arg->decimals, - arg->unsigned_flag) - arg->decimals; - set_if_bigger(max_length, len); - set_if_bigger(decimals, arg->decimals); - unsigned_flag= unsigned_flag && arg->unsigned_flag; -} - - /** Check if (*place) and new_value points to different Items and call THD::change_item_tree() if needed. @@ -3155,18 +3093,7 @@ void Item_func_case::fix_length_and_dec() } else { - collation.set_numeric(); - max_length=0; - decimals=0; - unsigned_flag= TRUE; - for (uint i= 0; i < ncases; i+= 2) - agg_num_lengths(args[i + 1]); - if (else_expr_num != -1) - agg_num_lengths(args[else_expr_num]); - max_length= my_decimal_precision_to_length_no_truncation(max_length + - decimals, - decimals, - unsigned_flag); + fix_attributes(agg, nagg); } /* @@ -3468,23 +3395,25 @@ my_decimal *Item_func_coalesce::decimal_op(my_decimal *decimal_value) } -void Item_func_coalesce::fix_length_and_dec() +void Item_hybrid_func::fix_attributes(Item **items, uint nitems) { - set_handler_by_field_type(agg_field_type(args, arg_count, true)); - switch (Item_func_coalesce::result_type()) { + switch (Item_hybrid_func::result_type()) { case STRING_RESULT: - if (count_string_result_length(Item_func_coalesce::field_type(), - args, arg_count)) + if (count_string_result_length(Item_hybrid_func::field_type(), + items, nitems)) return; break; case DECIMAL_RESULT: - count_decimal_length(); + collation.set_numeric(); + count_decimal_length(items, nitems); break; case REAL_RESULT: - count_real_length(); + collation.set_numeric(); + count_real_length(items, nitems); break; case INT_RESULT: - count_only_length(args, arg_count); + collation.set_numeric(); + count_only_length(items, nitems); decimals= 0; break; case ROW_RESULT: diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index f17167b5140..cd19ba72c07 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -902,7 +902,11 @@ public: String *str_op(String *); my_decimal *decimal_op(my_decimal *); bool date_op(MYSQL_TIME *ltime,uint fuzzydate); - void fix_length_and_dec(); + void fix_length_and_dec() + { + set_handler_by_field_type(agg_field_type(args, arg_count, true)); + fix_attributes(args, arg_count); + } const char *func_name() const { return "coalesce"; } table_map not_null_tables() const { return 0; } }; @@ -915,13 +919,18 @@ public: */ class Item_func_case_abbreviation2 :public Item_func_hybrid_field_type { +protected: + void fix_length_and_dec2(Item **items) + { + set_handler_by_field_type(agg_field_type(items, 2, true)); + fix_attributes(items, 2); + } + uint decimal_precision2(Item **args) const; public: Item_func_case_abbreviation2(THD *thd, Item *a, Item *b): Item_func_hybrid_field_type(thd, a, b) { } Item_func_case_abbreviation2(THD *thd, Item *a, Item *b, Item *c): Item_func_hybrid_field_type(thd, a, b, c) { } - void fix_length_and_dec2(Item **args); - uint decimal_precision2(Item **args) const; }; @@ -1454,8 +1463,6 @@ public: Item *find_item(String *str); CHARSET_INFO *compare_collation() const { return cmp_collation.collation; } void cleanup(); - void agg_str_lengths(Item *arg); - void agg_num_lengths(Item *arg); Item* propagate_equal_fields(THD *thd, const Context &ctx, COND_EQUAL *cond); }; diff --git a/sql/item_func.cc b/sql/item_func.cc index 52575a82e03..f61270ee208 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -612,18 +612,19 @@ void Item_udf_func::fix_num_length_and_dec() @retval False on success, true on error. */ -void Item_func::count_datetime_length(Item **item, uint nitems) +void Item_func::count_datetime_length(enum_field_types field_type_arg, + Item **item, uint nitems) { unsigned_flag= 0; decimals= 0; - if (field_type() != MYSQL_TYPE_DATE) + if (field_type_arg != MYSQL_TYPE_DATE) { for (uint i= 0; i < nitems; i++) set_if_bigger(decimals, item[i]->decimals); } set_if_smaller(decimals, TIME_SECOND_PART_DIGITS); uint len= decimals ? (decimals + 1) : 0; - len+= mysql_temporal_int_part_length(field_type()); + len+= mysql_temporal_int_part_length(field_type_arg); fix_char_length(len); } @@ -632,16 +633,16 @@ void Item_func::count_datetime_length(Item **item, uint nitems) result length/precision depends on argument ones. */ -void Item_func::count_decimal_length() +void Item_func::count_decimal_length(Item **item, uint nitems) { int max_int_part= 0; decimals= 0; unsigned_flag= 1; - for (uint i=0 ; i < arg_count ; i++) + for (uint i=0 ; i < nitems ; i++) { - set_if_bigger(decimals, args[i]->decimals); - set_if_bigger(max_int_part, args[i]->decimal_int_part()); - set_if_smaller(unsigned_flag, args[i]->unsigned_flag); + set_if_bigger(decimals, item[i]->decimals); + set_if_bigger(max_int_part, item[i]->decimal_int_part()); + set_if_smaller(unsigned_flag, item[i]->unsigned_flag); } int precision= MY_MIN(max_int_part + decimals, DECIMAL_MAX_PRECISION); fix_char_length(my_decimal_precision_to_length_no_truncation(precision, @@ -672,19 +673,20 @@ void Item_func::count_only_length(Item **item, uint nitems) result length/precision depends on argument ones. */ -void Item_func::count_real_length() +void Item_func::count_real_length(Item **items, uint nitems) { uint32 length= 0; decimals= 0; max_length= 0; - for (uint i=0 ; i < arg_count ; i++) + unsigned_flag= false; + for (uint i=0 ; i < nitems ; i++) { if (decimals != NOT_FIXED_DEC) { - set_if_bigger(decimals, args[i]->decimals); - set_if_bigger(length, (args[i]->max_length - args[i]->decimals)); + set_if_bigger(decimals, items[i]->decimals); + set_if_bigger(length, (items[i]->max_length - items[i]->decimals)); } - set_if_bigger(max_length, args[i]->max_length); + set_if_bigger(max_length, items[i]->max_length); } if (decimals != NOT_FIXED_DEC) { @@ -713,11 +715,11 @@ bool Item_func::count_string_result_length(enum_field_types field_type_arg, if (agg_arg_charsets_for_string_result(collation, items, nitems, 1)) return true; if (is_temporal_type(field_type_arg)) - count_datetime_length(items, nitems); + count_datetime_length(field_type_arg, items, nitems); else { - decimals= NOT_FIXED_DEC; count_only_length(items, nitems); + decimals= max_length ? NOT_FIXED_DEC : 0; } return false; } @@ -792,7 +794,7 @@ void Item_num_op::fix_length_and_dec(void) if (r0 == REAL_RESULT || r1 == REAL_RESULT || r0 == STRING_RESULT || r1 ==STRING_RESULT) { - count_real_length(); + count_real_length(args, arg_count); max_length= float_length(decimals); set_handler_by_result_type(REAL_RESULT); } diff --git a/sql/item_func.h b/sql/item_func.h index 6230550067b..a5f6bf26134 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -41,6 +41,14 @@ protected: */ uint allowed_arg_cols; String *val_str_from_val_str_ascii(String *str, String *str2); + + void count_only_length(Item **item, uint nitems); + void count_real_length(Item **item, uint nitems); + void count_decimal_length(Item **item, uint nitems); + void count_datetime_length(enum_field_types field_type, + Item **item, uint nitems); + bool count_string_result_length(enum_field_types field_type, + Item **item, uint nitems); public: table_map not_null_tables_cache; @@ -148,16 +156,10 @@ public: virtual void print(String *str, enum_query_type query_type); void print_op(String *str, enum_query_type query_type); void print_args(String *str, uint from, enum_query_type query_type); - void count_only_length(Item **item, uint nitems); - void count_real_length(); - void count_decimal_length(); inline bool get_arg0_date(MYSQL_TIME *ltime, ulonglong fuzzy_date) { return (null_value=args[0]->get_date_with_conversion(ltime, fuzzy_date)); } - void count_datetime_length(Item **item, uint nitems); - bool count_string_result_length(enum_field_types field_type, - Item **item, uint nitems); inline bool get_arg0_time(MYSQL_TIME *ltime) { null_value= args[0]->get_time(ltime); @@ -387,6 +389,8 @@ public: class Item_hybrid_func: public Item_func, public Type_handler_hybrid_field_type { +protected: + void fix_attributes(Item **item, uint nitems); public: Item_hybrid_func(THD *thd): Item_func(thd) { } Item_hybrid_func(THD *thd, Item *a): Item_func(thd, a) { } -- cgit v1.2.1 From 9c89b84d46e0645820acb9e3cc339af10c68cfb7 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Fri, 18 Mar 2016 11:27:32 -0400 Subject: MDEV-9401: wsrep_forced_binlog_format with binlog causes crash Some statements are always replicated in STATEMENT binlog format. So upon their execution, the current binlog format is temporarily switched to STATEMENT even though the session's format is different. This state, stored in THD's current_stmt_binlog_format, was getting incorrectly masked by wsrep_forced_binlog_format, causing assertions and unintended generation of row events. Backported galera.galera_forced_binlog_format and added a test specific to this case. --- .../galera/r/galera_forced_binlog_format.result | 40 +++++++++++++++++++ .../t/galera_forced_binlog_format-master.opt | 1 + .../galera/t/galera_forced_binlog_format.test | 45 ++++++++++++++++++++++ sql/sql_class.h | 3 +- 4 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_forced_binlog_format.result create mode 100644 mysql-test/suite/galera/t/galera_forced_binlog_format-master.opt create mode 100644 mysql-test/suite/galera/t/galera_forced_binlog_format.test diff --git a/mysql-test/suite/galera/r/galera_forced_binlog_format.result b/mysql-test/suite/galera/r/galera_forced_binlog_format.result new file mode 100644 index 00000000000..f08aad8be1a --- /dev/null +++ b/mysql-test/suite/galera/r/galera_forced_binlog_format.result @@ -0,0 +1,40 @@ +RESET MASTER; +SET SESSION binlog_format = 'STATEMENT'; +Warnings: +Warning 1105 MariaDB Galera does not support binlog format: STATEMENT +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +SET SESSION binlog_format = 'MIXED'; +Warnings: +Warning 1105 MariaDB Galera does not support binlog format: MIXED +INSERT INTO t1 VALUES (2); +SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 245; +Log_name Pos Event_type Server_id End_log_pos Info +mysqld-bin.000001 Query 1 use `test`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB +mysqld-bin.000001 Query 1 BEGIN +mysqld-bin.000001 Table_map 1 table_id: ### (test.t1) +mysqld-bin.000001 Write_rows 1 table_id: ### flags: STMT_END_F +mysqld-bin.000001 Xid 1 COMMIT /* xid=### */ +mysqld-bin.000001 Query 1 BEGIN +mysqld-bin.000001 Table_map 1 table_id: ### (test.t1) +mysqld-bin.000001 Write_rows 1 table_id: ### flags: STMT_END_F +mysqld-bin.000001 Xid 1 COMMIT /* xid=### */ +DROP TABLE t1; +# +# MDEV-9401: wsrep_forced_binlog_format with binlog causes crash +# +SET SESSION binlog_format = 'ROW'; +CREATE DATABASE testdb_9401; +USE testdb_9401; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +CREATE USER dummy@localhost; +GRANT ALL PRIVILEGES ON testdb_9401.t1 TO dummy@localhost; +FLUSH PRIVILEGES; +SHOW GRANTS FOR dummy@localhost; +Grants for dummy@localhost +GRANT USAGE ON *.* TO 'dummy'@'localhost' +GRANT ALL PRIVILEGES ON `testdb_9401`.`t1` TO 'dummy'@'localhost' +REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost; +DROP USER dummy@localhost; +DROP DATABASE testdb_9401; +# End of tests diff --git a/mysql-test/suite/galera/t/galera_forced_binlog_format-master.opt b/mysql-test/suite/galera/t/galera_forced_binlog_format-master.opt new file mode 100644 index 00000000000..8c58b59b45d --- /dev/null +++ b/mysql-test/suite/galera/t/galera_forced_binlog_format-master.opt @@ -0,0 +1 @@ +--log-bin --wsrep_forced_binlog_format=ROW diff --git a/mysql-test/suite/galera/t/galera_forced_binlog_format.test b/mysql-test/suite/galera/t/galera_forced_binlog_format.test new file mode 100644 index 00000000000..38e07526de1 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_forced_binlog_format.test @@ -0,0 +1,45 @@ +# +# Test that wsrep_forced_binlog_format=ROW indeed prevents the log to be switched to STATEMENT format on a per-connection basis +# + +--source include/have_log_bin.inc +--source include/have_innodb.inc +--source include/galera_cluster.inc + +--connection node_1 +RESET MASTER; + +SET SESSION binlog_format = 'STATEMENT'; + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +SET SESSION binlog_format = 'MIXED'; + +INSERT INTO t1 VALUES (2); + +--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/ +--replace_column 2 5 +SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 245; + +DROP TABLE t1; + +--echo # +--echo # MDEV-9401: wsrep_forced_binlog_format with binlog causes crash +--echo # +SET SESSION binlog_format = 'ROW'; +CREATE DATABASE testdb_9401; +USE testdb_9401; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +CREATE USER dummy@localhost; +GRANT ALL PRIVILEGES ON testdb_9401.t1 TO dummy@localhost; +FLUSH PRIVILEGES; +SHOW GRANTS FOR dummy@localhost; +# Cleanup +REVOKE ALL PRIVILEGES, GRANT OPTION FROM dummy@localhost; +DROP USER dummy@localhost; +DROP DATABASE testdb_9401; + +--source include/galera_end.inc +--echo # End of tests + diff --git a/sql/sql_class.h b/sql/sql_class.h index 6c072fe513e..48f0776c340 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1824,8 +1824,7 @@ public: int is_current_stmt_binlog_format_row() const { DBUG_ASSERT(current_stmt_binlog_format == BINLOG_FORMAT_STMT || current_stmt_binlog_format == BINLOG_FORMAT_ROW); - return (WSREP_BINLOG_FORMAT((ulong)current_stmt_binlog_format) == - BINLOG_FORMAT_ROW); + return current_stmt_binlog_format == BINLOG_FORMAT_ROW; } private: -- cgit v1.2.1 From 11b77e9b18a8d97063b4c4a96e40bf9c75bd0e8b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Mar 2016 16:55:11 +0100 Subject: MDEV-9527 build FAILs with GCC 5.1 with release supported "-std=c+11" 5.5 part of the fix --- sql/gcalc_slicescan.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/gcalc_slicescan.h b/sql/gcalc_slicescan.h index 5a0399bc8da..4996287ca88 100644 --- a/sql/gcalc_slicescan.h +++ b/sql/gcalc_slicescan.h @@ -26,7 +26,7 @@ #ifndef GCALC_DBUG_OFF #define GCALC_DBUG_PRINT(b) DBUG_PRINT("Gcalc", b) -#define GCALC_DBUG_ENTER(a) DBUG_ENTER("Gcalc "a) +#define GCALC_DBUG_ENTER(a) DBUG_ENTER("Gcalc " a) #define GCALC_DBUG_RETURN(r) DBUG_RETURN(r) #define GCALC_DBUG_VOID_RETURN DBUG_VOID_RETURN #define GCALC_DBUG_ASSERT(r) DBUG_ASSERT(r) -- cgit v1.2.1 From 4fdac6c07e1b896cbf6060d61b47669a48a1ebc9 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Wed, 16 Mar 2016 19:49:17 +0100 Subject: MDEV-9701: CREATE VIEW with GROUP BY or ORDER BY and constant produces invalid definition Fixed printing integer constant in the ORDER clause (MySQL solution) Removed workaround for double resolving counter in the ORDER. --- mysql-test/r/view.result | 19 +++++++++++++++++++ mysql-test/t/view.test | 17 +++++++++++++++++ sql/sql_lex.cc | 32 ++++++++++++-------------------- sql/sql_select.cc | 6 +++++- sql/sql_union.cc | 11 +++++++++++ 5 files changed, 64 insertions(+), 21 deletions(-) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 8ee72c35d0b..d4a2a9b1b79 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -826,6 +826,9 @@ drop table t2; create table t1 (a int); insert into t1 values (1), (2); create view v1 as select 5 from t1 order by 1; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 5 AS `5` from `t1` order by 1 latin1 latin1_swedish_ci select * from v1; 5 5 @@ -5884,5 +5887,21 @@ a DROP VIEW v1; DROP TABLE t1; # +# MDEV-9701: CREATE VIEW with GROUP BY or ORDER BY and constant +# produces invalid definition +# +CREATE TABLE t1 ( i INT ); +INSERT INTO t1 VALUES (1),(2); +CREATE VIEW v1 AS +SELECT 3 AS three, COUNT(*) FROM t1 GROUP BY three; +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 3 AS `three`,count(0) AS `COUNT(*)` from `t1` group by '' latin1 latin1_swedish_ci +SELECT * FROM v1; +three COUNT(*) +3 2 +drop view v1; +drop table t1; +# # End of 10.1 tests # diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index 3132b99b2b7..f1288e6a63d 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -731,6 +731,7 @@ drop table t2; create table t1 (a int); insert into t1 values (1), (2); create view v1 as select 5 from t1 order by 1; +show create view v1; select * from v1; drop view v1; drop table t1; @@ -5747,6 +5748,22 @@ SELECT * FROM v1 WHERE a=_latin1'a' COLLATE latin1_bin; DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # MDEV-9701: CREATE VIEW with GROUP BY or ORDER BY and constant +--echo # produces invalid definition +--echo # +CREATE TABLE t1 ( i INT ); +INSERT INTO t1 VALUES (1),(2); + +CREATE VIEW v1 AS +SELECT 3 AS three, COUNT(*) FROM t1 GROUP BY three; + +show create view v1; + +SELECT * FROM v1; + +drop view v1; +drop table t1; --echo # --echo # End of 10.1 tests diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index fd841094e68..31fc5f9712c 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -2689,30 +2689,22 @@ void st_select_lex::print_order(String *str, { if (order->counter_used) { - if (!(query_type & QT_VIEW_INTERNAL)) + char buffer[20]; + size_t length= my_snprintf(buffer, 20, "%d", order->counter); + str->append(buffer, (uint) length); + } + else + { + /* replace numeric reference with equivalent for ORDER constant */ + if (order->item[0]->type() == Item::INT_ITEM && + order->item[0]->basic_const_item()) { - char buffer[20]; - size_t length= my_snprintf(buffer, 20, "%d", order->counter); - str->append(buffer, (uint) length); + /* make it expression instead of integer constant */ + str->append(STRING_WITH_LEN("''")); } else - { - /* replace numeric reference with expression */ - if (order->item[0]->type() == Item::INT_ITEM && - order->item[0]->basic_const_item()) - { - char buffer[20]; - size_t length= my_snprintf(buffer, 20, "%d", order->counter); - str->append(buffer, (uint) length); - /* make it expression instead of integer constant */ - str->append(STRING_WITH_LEN("+0")); - } - else - (*order->item)->print(str, query_type); - } + (*order->item)->print(str, query_type); } - else - (*order->item)->print(str, query_type); if (!order->asc) str->append(STRING_WITH_LEN(" desc")); if (order->next) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index fff24b97e6a..f14e8b1a5f8 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -21874,7 +21874,11 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, */ if (order_item->type() == Item::INT_ITEM && order_item->basic_const_item()) { /* Order by position */ - uint count= (uint) order_item->val_int(); + uint count; + if (order->counter_used) + count= order->counter; // counter was once resolved + else + count= (uint) order_item->val_int(); if (!count || count > fields.elements) { my_error(ER_BAD_FIELD_ERROR, MYF(0), diff --git a/sql/sql_union.cc b/sql/sql_union.cc index c8350838ee8..8145cec5f25 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -1161,11 +1161,22 @@ List *st_select_lex_unit::get_unit_column_types() return &sl->item_list; } + +static void cleanup_order(ORDER *order) +{ + for (; order; order= order->next) + order->counter_used= 0; +} + + bool st_select_lex::cleanup() { bool error= FALSE; DBUG_ENTER("st_select_lex::cleanup()"); + cleanup_order(order_list.first); + cleanup_order(group_list.first); + if (join) { DBUG_ASSERT((st_select_lex*)join->select_lex == this); -- cgit v1.2.1 From 7cb16dc2a369058b31df1b3999989f6beff94d07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 18 Mar 2016 20:53:18 +0200 Subject: MDEV-9422: Checksum errors on restart when killing busy instance that uses encrypted XtraDB tables Fix incorrectly merged files on innodb_plugin. --- storage/innobase/log/log0crypt.cc | 28 +++++++++++++++++++++------- storage/innobase/log/log0recv.cc | 12 ++++++++---- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/storage/innobase/log/log0crypt.cc b/storage/innobase/log/log0crypt.cc index 00de0252d6e..852148899e9 100644 --- a/storage/innobase/log/log0crypt.cc +++ b/storage/innobase/log/log0crypt.cc @@ -36,6 +36,8 @@ Modified Jan Lindström jan.lindstrom@mariadb.com #include "my_crypt.h" +/* Used for debugging */ +// #define DEBUG_CRYPT 1 #define UNENCRYPTED_KEY_VER 0 /* If true, enable redo log encryption. */ @@ -97,16 +99,24 @@ get_crypt_info( { /* so that no one is modifying array while we search */ ut_ad(mutex_own(&(log_sys->mutex))); + size_t items = crypt_info.size(); /* a log block only stores 4-bytes of checkpoint no */ checkpoint_no &= 0xFFFFFFFF; - for (size_t i = 0; i < crypt_info.size(); i++) { + for (size_t i = 0; i < items; i++) { struct crypt_info_t* it = &crypt_info[i]; if (it->checkpoint_no == checkpoint_no) { return it; } } + + /* If checkpoint contains more than one key and we did not + find the correct one use the first one. */ + if (items) { + return (&crypt_info[0]); + } + return NULL; } @@ -131,7 +141,8 @@ log_blocks_crypt( const byte* block, /*!< in: blocks before encrypt/decrypt*/ ulint size, /*!< in: size of block */ byte* dst_block, /*!< out: blocks after encrypt/decrypt */ - int what) /*!< in: encrypt or decrypt*/ + int what, /*!< in: encrypt or decrypt*/ + const crypt_info_t* crypt_info) /*!< in: crypt info or NULL */ { byte *log_block = (byte*)block; Crypt_result rc = MY_AES_OK; @@ -146,7 +157,8 @@ log_blocks_crypt( lsn_t log_block_start_lsn = log_block_get_start_lsn( lsn, log_block_no); - const crypt_info_t* info = get_crypt_info(log_block); + const crypt_info_t* info = crypt_info == NULL ? get_crypt_info(log_block) : + crypt_info; #ifdef DEBUG_CRYPT fprintf(stderr, "%s %lu chkpt: %lu key: %u lsn: %lu\n", @@ -301,7 +313,7 @@ log_blocks_encrypt( const ulint size, /*!< in: size of blocks, must be multiple of a log block */ byte* dst_block) /*!< out: blocks after encryption */ { - return log_blocks_crypt(block, size, dst_block, ENCRYPTION_FLAG_ENCRYPT); + return log_blocks_crypt(block, size, dst_block, ENCRYPTION_FLAG_ENCRYPT, NULL); } /*********************************************************************//** @@ -364,14 +376,16 @@ log_encrypt_before_write( return; } - if (info->key_version == UNENCRYPTED_KEY_VER) { + /* If the key is not encrypted or user has requested not to + encrypt, do not change log block. */ + if (info->key_version == UNENCRYPTED_KEY_VER || !srv_encrypt_log) { return; } byte* dst_frame = (byte*)malloc(size); //encrypt log blocks content - Crypt_result result = log_blocks_crypt(block, size, dst_frame, ENCRYPTION_FLAG_ENCRYPT); + Crypt_result result = log_blocks_crypt(block, size, dst_frame, ENCRYPTION_FLAG_ENCRYPT, NULL); if (result == MY_AES_OK) { ut_ad(block[0] == dst_frame[0]); @@ -397,7 +411,7 @@ log_decrypt_after_read( byte* dst_frame = (byte*)malloc(size); // decrypt log blocks content - Crypt_result result = log_blocks_crypt(frame, size, dst_frame, ENCRYPTION_FLAG_DECRYPT); + Crypt_result result = log_blocks_crypt(frame, size, dst_frame, ENCRYPTION_FLAG_DECRYPT, NULL); if (result == MY_AES_OK) { memcpy(frame, dst_frame, size); diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 6e09143fb96..2304f4885c2 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -2,7 +2,7 @@ Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2013, 2016, MariaDB Corporation. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -2666,6 +2666,7 @@ recv_scan_log_recs( ibool finished; ulint data_len; ibool more_data; + bool maybe_encrypted=false; ut_ad(start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0); ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0); @@ -2680,6 +2681,8 @@ recv_scan_log_recs( *err = DB_SUCCESS; do { + log_crypt_err_t log_crypt_err; + no = log_block_get_hdr_no(log_block); /* fprintf(stderr, "Log block header no %lu\n", no); @@ -2689,7 +2692,6 @@ recv_scan_log_recs( */ if (no != log_block_convert_lsn_to_no(scanned_lsn) || !log_block_checksum_is_ok_or_old_format(log_block, true)) { - log_crypt_err_t log_crypt_err; if (no == log_block_convert_lsn_to_no(scanned_lsn) && !log_block_checksum_is_ok_or_old_format( @@ -2707,12 +2709,14 @@ recv_scan_log_recs( log_block)); } + maybe_encrypted = log_crypt_block_maybe_encrypted(log_block, + &log_crypt_err); + /* Garbage or an incompletely written log block */ finished = TRUE; - if (log_crypt_block_maybe_encrypted(log_block, - &log_crypt_err)) { + if (maybe_encrypted) { /* Log block maybe encrypted finish processing*/ log_crypt_print_error(log_crypt_err); *err = DB_ERROR; -- cgit v1.2.1 From 3fdc6140a358161e6dff054134f08333e8f9f44d Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 11 Mar 2016 08:59:51 +0100 Subject: update plugins' maturity levels --- .../suite/plugins/r/simple_password_check.result | 2 +- .../cracklib_password_check.c | 2 +- .../file_key_management_plugin.cc | 2 +- plugin/locale_info/locale_info.cc | 2 +- plugin/metadata_lock_info/metadata_lock_info.cc | 2 +- plugin/qc_info/qc_info.cc | 2 +- .../mysql-test/query_response_time/basic.result | 2 +- plugin/query_response_time/plugin.cc | 2 +- plugin/semisync/semisync_master_plugin.cc | 2 +- plugin/semisync/semisync_slave_plugin.cc | 2 +- .../simple_password_check/simple_password_check.c | 2 +- plugin/sql_errlog/sql_errlog.c | 2 +- plugin/userstat/userstat.cc | 4 +- plugin/wsrep_info/plugin.cc | 4 +- storage/connect/ha_connect.cc | 2 +- storage/innobase/handler/ha_innodb.cc | 2 +- storage/innobase/handler/i_s.cc | 64 ++++++++++---------- storage/oqgraph/ha_oqgraph.cc | 2 +- storage/xtradb/handler/ha_innodb.cc | 2 +- storage/xtradb/handler/i_s.cc | 68 +++++++++++----------- storage/xtradb/handler/xtradb_i_s.cc | 6 +- 21 files changed, 89 insertions(+), 89 deletions(-) diff --git a/mysql-test/suite/plugins/r/simple_password_check.result b/mysql-test/suite/plugins/r/simple_password_check.result index c74b4e99992..a0b43a94137 100644 --- a/mysql-test/suite/plugins/r/simple_password_check.result +++ b/mysql-test/suite/plugins/r/simple_password_check.result @@ -11,7 +11,7 @@ PLUGIN_AUTHOR Sergei Golubchik PLUGIN_DESCRIPTION Simple password strength checks PLUGIN_LICENSE GPL LOAD_OPTION ON -PLUGIN_MATURITY Alpha +PLUGIN_MATURITY Gamma PLUGIN_AUTH_VERSION 1.0 select * from information_schema.system_variables where variable_name like 'simple_password_check%' order by 1; VARIABLE_NAME SIMPLE_PASSWORD_CHECK_DIGITS diff --git a/plugin/cracklib_password_check/cracklib_password_check.c b/plugin/cracklib_password_check/cracklib_password_check.c index c16075df74b..c593173942d 100644 --- a/plugin/cracklib_password_check/cracklib_password_check.c +++ b/plugin/cracklib_password_check/cracklib_password_check.c @@ -78,6 +78,6 @@ maria_declare_plugin(cracklib_password_check) NULL, sysvars, "1.0", - MariaDB_PLUGIN_MATURITY_ALPHA, + MariaDB_PLUGIN_MATURITY_GAMMA, } maria_declare_plugin_end; diff --git a/plugin/file_key_management/file_key_management_plugin.cc b/plugin/file_key_management/file_key_management_plugin.cc index 970fae9c189..e0afbd68cc9 100644 --- a/plugin/file_key_management/file_key_management_plugin.cc +++ b/plugin/file_key_management/file_key_management_plugin.cc @@ -186,6 +186,6 @@ maria_declare_plugin(file_key_management) NULL, /* status variables */ settings, "1.0", - MariaDB_PLUGIN_MATURITY_ALPHA + MariaDB_PLUGIN_MATURITY_GAMMA } maria_declare_plugin_end; diff --git a/plugin/locale_info/locale_info.cc b/plugin/locale_info/locale_info.cc index dd14dcbb769..3d775c0be7c 100644 --- a/plugin/locale_info/locale_info.cc +++ b/plugin/locale_info/locale_info.cc @@ -117,6 +117,6 @@ maria_declare_plugin(locales) NULL, /* Status variables */ NULL, /* System variables */ "1.0", /* String version representation */ - MariaDB_PLUGIN_MATURITY_GAMMA /* Maturity (see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_STABLE /* Maturity (see include/mysql/plugin.h)*/ } maria_declare_plugin_end; diff --git a/plugin/metadata_lock_info/metadata_lock_info.cc b/plugin/metadata_lock_info/metadata_lock_info.cc index fcfdb59da30..83db2c7ca5c 100644 --- a/plugin/metadata_lock_info/metadata_lock_info.cc +++ b/plugin/metadata_lock_info/metadata_lock_info.cc @@ -164,7 +164,7 @@ maria_declare_plugin(metadata_lock_info) NULL, NULL, NULL, - MariaDB_PLUGIN_MATURITY_GAMMA, + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; #else diff --git a/plugin/qc_info/qc_info.cc b/plugin/qc_info/qc_info.cc index 998076dadf7..4ccfdc8f8c2 100644 --- a/plugin/qc_info/qc_info.cc +++ b/plugin/qc_info/qc_info.cc @@ -282,7 +282,7 @@ maria_declare_plugin(query_cache_info) NULL, /* status variables */ NULL, /* system variables */ "1.1", /* version as a string */ - MariaDB_PLUGIN_MATURITY_GAMMA + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/plugin/query_response_time/mysql-test/query_response_time/basic.result b/plugin/query_response_time/mysql-test/query_response_time/basic.result index 15746424b1d..86fba87e056 100644 --- a/plugin/query_response_time/mysql-test/query_response_time/basic.result +++ b/plugin/query_response_time/mysql-test/query_response_time/basic.result @@ -17,7 +17,7 @@ PLUGIN_TYPE INFORMATION SCHEMA PLUGIN_AUTHOR Percona and Sergey Vojtovich PLUGIN_DESCRIPTION Query Response Time Distribution INFORMATION_SCHEMA Plugin PLUGIN_LICENSE GPL -PLUGIN_MATURITY Gamma +PLUGIN_MATURITY Stable PLUGIN_NAME QUERY_RESPONSE_TIME_AUDIT PLUGIN_VERSION 1.0 PLUGIN_TYPE AUDIT diff --git a/plugin/query_response_time/plugin.cc b/plugin/query_response_time/plugin.cc index c34e4cb6e02..37d52c3ce85 100644 --- a/plugin/query_response_time/plugin.cc +++ b/plugin/query_response_time/plugin.cc @@ -144,7 +144,7 @@ maria_declare_plugin(query_response_time) NULL, query_response_time_info_vars, "1.0", - MariaDB_PLUGIN_MATURITY_GAMMA + MariaDB_PLUGIN_MATURITY_STABLE }, { MYSQL_AUDIT_PLUGIN, diff --git a/plugin/semisync/semisync_master_plugin.cc b/plugin/semisync/semisync_master_plugin.cc index 7bb0eea44ee..309910312c4 100644 --- a/plugin/semisync/semisync_master_plugin.cc +++ b/plugin/semisync/semisync_master_plugin.cc @@ -489,7 +489,7 @@ maria_declare_plugin(semisync_master) semi_sync_master_status_vars, /* status variables */ semi_sync_master_system_vars, /* system variables */ "1.0", - MariaDB_PLUGIN_MATURITY_GAMMA + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/plugin/semisync/semisync_slave_plugin.cc b/plugin/semisync/semisync_slave_plugin.cc index 572ead214de..3a6c7625d93 100644 --- a/plugin/semisync/semisync_slave_plugin.cc +++ b/plugin/semisync/semisync_slave_plugin.cc @@ -227,7 +227,7 @@ maria_declare_plugin(semisync_slave) semi_sync_slave_status_vars, /* status variables */ semi_sync_slave_system_vars, /* system variables */ "1.0", - MariaDB_PLUGIN_MATURITY_GAMMA + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/plugin/simple_password_check/simple_password_check.c b/plugin/simple_password_check/simple_password_check.c index dadaa0191a2..1b7668204b6 100644 --- a/plugin/simple_password_check/simple_password_check.c +++ b/plugin/simple_password_check/simple_password_check.c @@ -101,6 +101,6 @@ maria_declare_plugin(simple_password_check) NULL, sysvars, "1.0", - MariaDB_PLUGIN_MATURITY_ALPHA, + MariaDB_PLUGIN_MATURITY_GAMMA } maria_declare_plugin_end; diff --git a/plugin/sql_errlog/sql_errlog.c b/plugin/sql_errlog/sql_errlog.c index 1c7e141c022..6ec4659d407 100644 --- a/plugin/sql_errlog/sql_errlog.c +++ b/plugin/sql_errlog/sql_errlog.c @@ -158,6 +158,6 @@ maria_declare_plugin(sql_errlog) NULL, vars, "1.0", - MariaDB_PLUGIN_MATURITY_GAMMA + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/plugin/userstat/userstat.cc b/plugin/userstat/userstat.cc index 6ffee44f43c..69832f817c1 100644 --- a/plugin/userstat/userstat.cc +++ b/plugin/userstat/userstat.cc @@ -31,7 +31,7 @@ maria_declare_plugin(userstat) NULL, NULL, "2.0", - MariaDB_PLUGIN_MATURITY_GAMMA + MariaDB_PLUGIN_MATURITY_STABLE }, { MYSQL_INFORMATION_SCHEMA_PLUGIN, @@ -46,7 +46,7 @@ maria_declare_plugin(userstat) NULL, NULL, "2.0", - MariaDB_PLUGIN_MATURITY_GAMMA + MariaDB_PLUGIN_MATURITY_STABLE }, { MYSQL_INFORMATION_SCHEMA_PLUGIN, diff --git a/plugin/wsrep_info/plugin.cc b/plugin/wsrep_info/plugin.cc index f3de177c85f..b8aaee5a132 100644 --- a/plugin/wsrep_info/plugin.cc +++ b/plugin/wsrep_info/plugin.cc @@ -245,7 +245,7 @@ maria_declare_plugin(wsrep_info) NULL, /* Status variables */ NULL, /* System variables */ "1.0", /* Version (string) */ - MariaDB_PLUGIN_MATURITY_ALPHA /* Maturity */ + MariaDB_PLUGIN_MATURITY_GAMMA /* Maturity */ }, { MYSQL_INFORMATION_SCHEMA_PLUGIN, @@ -260,7 +260,7 @@ maria_declare_plugin(wsrep_info) NULL, /* Status variables */ NULL, /* System variables */ "1.0", /* Version (string) */ - MariaDB_PLUGIN_MATURITY_ALPHA /* Maturity */ + MariaDB_PLUGIN_MATURITY_GAMMA /* Maturity */ } maria_declare_plugin_end; diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 8eb0d32c897..758aee949fb 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -6767,6 +6767,6 @@ maria_declare_plugin(connect) NULL, /* status variables */ connect_system_variables, /* system variables */ "1.04.0005", /* string version */ - MariaDB_PLUGIN_MATURITY_BETA /* maturity */ + MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ } maria_declare_plugin_end; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 62be0d5219d..d9c2cef7d07 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -19937,7 +19937,7 @@ maria_declare_plugin(innobase) innodb_status_variables_export,/* status variables */ innobase_system_variables, /* system variables */ INNODB_VERSION_STR, /* string version */ - MariaDB_PLUGIN_MATURITY_BETA /* maturity */ + MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ }, i_s_innodb_trx, i_s_innodb_locks, diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 991e1b9f47f..0bb10f435af 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -783,7 +783,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_trx = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */ @@ -1043,7 +1043,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_locks = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */ @@ -1226,7 +1226,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_lock_waits = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /*******************************************************************//** @@ -1562,7 +1562,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset = @@ -1612,7 +1612,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic tables @@ -1912,7 +1912,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_per_index = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_per_index_reset = @@ -1962,7 +1962,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_per_index_reset = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table information_schema.innodb_cmpmem. */ @@ -2205,7 +2205,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset = @@ -2255,7 +2255,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_metrics */ @@ -2779,7 +2779,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_metrics = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_ft_default_stopword */ static ST_FIELD_INFO i_s_stopword_fields_info[] = @@ -2892,7 +2892,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_default_stopword = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_DELETED @@ -3060,7 +3060,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_deleted = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /*******************************************************************//** @@ -3143,7 +3143,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_being_deleted = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHED and @@ -3432,7 +3432,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_index_cache = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /*******************************************************************//** @@ -3867,7 +3867,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_index_table = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_CONFIG */ @@ -4065,7 +4065,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_config = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table INNODB_BUFFER_POOL_STATS. */ @@ -4614,7 +4614,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_stats = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table INNODB_BUFFER_POOL_PAGE. */ @@ -5326,7 +5326,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = @@ -5873,7 +5873,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page_lru = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /*******************************************************************//** @@ -6167,7 +6167,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tables = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /** SYS_TABLESTATS ***********************************************/ @@ -6457,7 +6457,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tablestats = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /** SYS_INDEXES **************************************************/ @@ -6709,7 +6709,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_indexes = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /** SYS_COLUMNS **************************************************/ @@ -6946,7 +6946,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_columns = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /** SYS_FIELDS ***************************************************/ @@ -7156,7 +7156,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_fields = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /** SYS_FOREIGN ********************************************/ @@ -7381,7 +7381,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /** SYS_FOREIGN_COLS ********************************************/ @@ -7598,7 +7598,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign_cols = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /** SYS_TABLESPACES ********************************************/ @@ -7866,7 +7866,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tablespaces = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /** SYS_DATAFILES ************************************************/ @@ -8055,7 +8055,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_datafiles = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /** TABLESPACES_ENCRYPTION ********************************************/ @@ -8349,7 +8349,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_encryption = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA) + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA) }; /** TABLESPACES_SCRUBBING ********************************************/ @@ -8648,7 +8648,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_scrubbing = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA) + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA) }; /** INNODB_MUTEXES *********************************************/ @@ -8862,7 +8862,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_mutexes = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /** SYS_SEMAPHORE_WAITS ************************************************/ @@ -9139,5 +9139,5 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_semaphore_waits = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc index 6f142a213b7..b8e1a673670 100644 --- a/storage/oqgraph/ha_oqgraph.cc +++ b/storage/oqgraph/ha_oqgraph.cc @@ -1372,6 +1372,6 @@ maria_declare_plugin(oqgraph) oqgraph_status, /* status variables */ oqgraph_sysvars, /* system variables */ "3.0", - MariaDB_PLUGIN_MATURITY_BETA + MariaDB_PLUGIN_MATURITY_GAMMA } maria_declare_plugin_end; diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index e11982de694..065f1bd2ca0 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -21123,7 +21123,7 @@ maria_declare_plugin(xtradb) innodb_status_variables_export,/* status variables */ innobase_system_variables, /* system variables */ INNODB_VERSION_STR, /* string version */ - MariaDB_PLUGIN_MATURITY_BETA /* maturity */ + MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ }, i_s_xtradb_read_view, i_s_xtradb_internal_hash_tables, diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc index 09e72114711..a131a50458a 100644 --- a/storage/xtradb/handler/i_s.cc +++ b/storage/xtradb/handler/i_s.cc @@ -792,7 +792,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_trx = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */ @@ -1050,7 +1050,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_locks = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */ @@ -1231,7 +1231,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_lock_waits = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /*******************************************************************//** @@ -1565,7 +1565,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset = @@ -1613,7 +1613,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /* Fields of the dynamic tables @@ -1912,7 +1912,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_per_index = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_per_index_reset = @@ -1961,7 +1961,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_per_index_reset = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table information_schema.innodb_cmpmem. */ @@ -2203,7 +2203,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset = @@ -2251,7 +2251,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_metrics */ @@ -2774,7 +2774,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_metrics = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_ft_default_stopword */ static ST_FIELD_INFO i_s_stopword_fields_info[] = @@ -2886,7 +2886,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_default_stopword = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_DELETED @@ -3053,7 +3053,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_deleted = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /*******************************************************************//** @@ -3135,7 +3135,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_being_deleted = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHED and @@ -3423,7 +3423,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_index_cache = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /*******************************************************************//** @@ -3857,7 +3857,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_index_table = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_CONFIG */ @@ -4054,7 +4054,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_config = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /* Fields of the dynamic table INNODB_BUFFER_POOL_STATS. */ @@ -4601,7 +4601,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_stats = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /* Fields of the dynamic table INNODB_BUFFER_POOL_PAGE. */ @@ -5310,7 +5310,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = @@ -5855,7 +5855,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page_lru = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /*******************************************************************//** @@ -6147,7 +6147,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tables = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /** SYS_TABLESTATS ***********************************************/ @@ -6435,7 +6435,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tablestats = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /** SYS_INDEXES **************************************************/ @@ -6685,7 +6685,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_indexes = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /** SYS_COLUMNS **************************************************/ @@ -6920,7 +6920,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_columns = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /** SYS_FIELDS ***************************************************/ @@ -7128,7 +7128,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_fields = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /** SYS_FOREIGN ********************************************/ @@ -7351,7 +7351,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /** SYS_FOREIGN_COLS ********************************************/ @@ -7566,7 +7566,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign_cols = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /** SYS_TABLESPACES ********************************************/ @@ -7833,7 +7833,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tablespaces = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /** SYS_DATAFILES ************************************************/ @@ -8020,7 +8020,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_datafiles = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; static ST_FIELD_INFO i_s_innodb_changed_pages_info[] = @@ -8389,7 +8389,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_changed_pages = STRUCT_FLD(version, 0x0100 /* 1.0 */), STRUCT_FLD(status_vars, NULL), STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /** TABLESPACES_ENCRYPTION ********************************************/ @@ -8681,7 +8681,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_encryption = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_BETA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA }; /** TABLESPACES_SCRUBBING ********************************************/ @@ -8980,7 +8980,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_scrubbing = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA) + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA) }; /** INNODB_MUTEXES *********************************************/ @@ -9194,7 +9194,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_mutexes = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; /** SYS_SEMAPHORE_WAITS ************************************************/ @@ -9471,7 +9471,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_semaphore_waits = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; static ST_FIELD_INFO innodb_changed_page_bitmaps_fields_info[] = @@ -9595,6 +9595,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_changed_page_bitmaps = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; diff --git a/storage/xtradb/handler/xtradb_i_s.cc b/storage/xtradb/handler/xtradb_i_s.cc index 207682e3154..a0ff959013a 100644 --- a/storage/xtradb/handler/xtradb_i_s.cc +++ b/storage/xtradb/handler/xtradb_i_s.cc @@ -176,7 +176,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_xtradb_read_view = STRUCT_FLD(status_vars, NULL), STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; static ST_FIELD_INFO xtradb_internal_hash_tables_fields_info[] = @@ -381,7 +381,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_xtradb_internal_hash_tables = STRUCT_FLD(status_vars, NULL), STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; @@ -514,5 +514,5 @@ UNIV_INTERN struct st_mysql_plugin i_s_xtradb_rseg = STRUCT_FLD(status_vars, NULL), STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_BETA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), }; -- cgit v1.2.1 From d70697b6f8844a07f603caac8ababaeb5331c972 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2016 18:06:25 +0100 Subject: main.mysqld--help failure with cracklib plugin don't fail if cracklib_password_check is statically compiled in --- mysql-test/t/mysqld--help.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/t/mysqld--help.test b/mysql-test/t/mysqld--help.test index 2ddb58e6de4..d7aba43999e 100644 --- a/mysql-test/t/mysqld--help.test +++ b/mysql-test/t/mysqld--help.test @@ -31,7 +31,7 @@ perl; connect null-audit aria oqgraph sphinx thread-handling test-sql-discovery rpl-semi-sync query-cache-info query-response-time metadata-lock-info locales unix-socket - wsrep file-key-management/; + wsrep file-key-management cracklib-password-check/; # And substitute the content some environment variables with their # names: -- cgit v1.2.1 From 59c4675c6b50bd0df60b56a2e34f37c6f616fc3f Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Sat, 19 Mar 2016 12:02:03 +0100 Subject: - Fix compile error when copying a string on itself. modified: storage/connect/value.cpp - Fix compile error of MDEV-9603 modified: storage/connect/tabmysql.cpp --- storage/connect/tabmysql.cpp | 2 +- storage/connect/value.cpp | 29 ++++++++++++++--------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index 77be29ac12d..ed474de036a 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -334,7 +334,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int) Delayed = !!GetIntCatInfo("Delayed", 0); } else { // MYSQL access from a PROXY table - Database = GetStringCatInfo(g, "Database", Schema ? Schema : (PSZ)"*"); + Database = GetStringCatInfo(g, "Database", Schema ? Schema : PlugDup(g, "*")); Isview = GetBoolCatInfo("View", false); // We must get other connection parms from the calling table diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp index 60471c9b0d8..74ab9806e5c 100644 --- a/storage/connect/value.cpp +++ b/storage/connect/value.cpp @@ -1344,10 +1344,13 @@ bool TYPVAL::SetValue_pval(PVAL valp, bool chktype) /***********************************************************************/ bool TYPVAL::SetValue_char(char *p, int n) { - bool rc; + bool rc = false; - if (p && n > 0) { - rc = n > Len; + if (!p || n == 0) { + Reset(); + Null = Nullable; + } else if (p != Strp) { + rc = n > Len; if ((n = MY_MIN(n, Len))) { strncpy(Strp, p, n); @@ -1366,10 +1369,6 @@ bool TYPVAL::SetValue_char(char *p, int n) Reset(); Null = false; - } else { - rc = false; - Reset(); - Null = Nullable; } // endif p return rc; @@ -1380,12 +1379,12 @@ bool TYPVAL::SetValue_char(char *p, int n) /***********************************************************************/ void TYPVAL::SetValue_psz(PSZ s) { - if (s) { - strncpy(Strp, s, Len); + if (!s) { + Reset(); + Null = Nullable; + } else if (s != Strp) { + strncpy(Strp, s, Len); Null = false; - } else { - Reset(); - Null = Nullable; } // endif s } // end of SetValue_psz @@ -1643,7 +1642,7 @@ bool TYPVAL::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) assert(np == 1 || np == 2); if (np == 2) - strncpy(Strp, p[0], Len); + SetValue_psz(p[0]); if ((i = Len - (signed)strlen(Strp)) > 0) strncat(Strp, p[np - 1], i); @@ -1651,11 +1650,11 @@ bool TYPVAL::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) break; case OP_MIN: assert(np == 2); - strcpy(Strp, (strcmp(p[0], p[1]) < 0) ? p[0] : p[1]); + SetValue_psz((strcmp(p[0], p[1]) < 0) ? p[0] : p[1]); break; case OP_MAX: assert(np == 2); - strcpy(Strp, (strcmp(p[0], p[1]) > 0) ? p[0] : p[1]); + SetValue_psz((strcmp(p[0], p[1]) > 0) ? p[0] : p[1]); break; default: // sprintf(g->Message, MSG(BAD_EXP_OPER), op); -- cgit v1.2.1 From a1782b4ab92acddc326a6b9342d5e6b11bb24952 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 19 Mar 2016 19:40:25 +0100 Subject: MDEV-9739 Assertion `m_status == DA_ERROR || m_status == DA_OK' failed in Diagnostics_area::message() ; connect.xml* tests fail in buildbot --- sql/sql_show.cc | 3 +++ storage/connect/mysql-test/connect/r/infoschema-9739.result | 12 ++++++++++++ storage/connect/mysql-test/connect/t/infoschema-9739.test | 9 +++++++++ 3 files changed, 24 insertions(+) create mode 100644 storage/connect/mysql-test/connect/r/infoschema-9739.result create mode 100644 storage/connect/mysql-test/connect/t/infoschema-9739.test diff --git a/sql/sql_show.cc b/sql/sql_show.cc index b6a753f993c..686f6ecb1ca 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -5063,7 +5063,10 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables, HA_STATUS_TIME | HA_STATUS_VARIABLE_EXTRA | HA_STATUS_AUTO)) != 0) + { + file->print_error(info_error, MYF(0)); goto err; + } enum row_type row_type = file->get_row_type(); switch (row_type) { diff --git a/storage/connect/mysql-test/connect/r/infoschema-9739.result b/storage/connect/mysql-test/connect/r/infoschema-9739.result new file mode 100644 index 00000000000..bcebec1d0e0 --- /dev/null +++ b/storage/connect/mysql-test/connect/r/infoschema-9739.result @@ -0,0 +1,12 @@ +Warnings: +Warning 1105 No file name. Table will use t1.xml +create table t1 (i int) engine=Connect table_type=XML; +Warnings: +Warning 1105 No file name. Table will use t1.xml +select * from information_schema.tables where create_options like '%table_type=XML%'; +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 +Warnings: +Warning 1286 Unknown storage engine 'InnoDB' +Warning 1286 Unknown storage engine 'InnoDB' +Warning 1296 Got error 174 'File t1.xml not found' from CONNECT +drop table t1; diff --git a/storage/connect/mysql-test/connect/t/infoschema-9739.test b/storage/connect/mysql-test/connect/t/infoschema-9739.test new file mode 100644 index 00000000000..e9eb7fb796e --- /dev/null +++ b/storage/connect/mysql-test/connect/t/infoschema-9739.test @@ -0,0 +1,9 @@ +# +# MDEV-9739 Assertion `m_status == DA_ERROR || m_status == DA_OK' failed in Diagnostics_area::message() ; connect.xml* tests fail in buildbot +# + +--source have_libxml2.inc + +create table t1 (i int) engine=Connect table_type=XML; +select * from information_schema.tables where create_options like '%table_type=XML%'; +drop table t1; -- cgit v1.2.1 From b24a04c6e04ba3e1488426d7fd333ee564858be5 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2016 18:55:39 +0100 Subject: don't do anything for AWS plugin unless it's enabled in particular, don't do ExternalProject_Add() that starts creating build directories for a disabled plugin --- plugin/aws_key_management/CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plugin/aws_key_management/CMakeLists.txt b/plugin/aws_key_management/CMakeLists.txt index 6b491186576..97bcfbb04db 100644 --- a/plugin/aws_key_management/CMakeLists.txt +++ b/plugin/aws_key_management/CMakeLists.txt @@ -18,6 +18,12 @@ MACRO(SKIP_AWS_PLUGIN msg) RETURN() ENDMACRO() +MYSQL_ADD_PLUGIN(aws_key_management aws_key_management_plugin.cc DISABLED + COMPONENT aws-key-management) + +IF(NOT TARGET aws_key_management) + RETURN() +ENDIF() # This plugin needs recent C++ compilers (AWS C++ SDK header files are using C++11 features) SET(CXX11_FLAGS) @@ -145,7 +151,4 @@ ELSE() ENDIF() SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX11_FLAGS}") -MYSQL_ADD_PLUGIN(aws_key_management aws_key_management_plugin.cc - COMPONENT aws-key-management - LINK_LIBRARIES ${AWS_SDK_LIBS} - DISABLED) +TARGET_LINK_LIBRARIES(aws_key_management ${AWS_SDK_LIBS}) -- cgit v1.2.1 From 23903255d82b77c77b734fa328ee01ca1a1ae8db Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2016 22:03:09 +0100 Subject: MDEV-9629 Disappearing PRI from Key column after creating a trigger when creating shadow nullable fields, preserve all original field flags (because we swap flags back and forth in not_null_fields_have_null_values()) --- mysql-test/r/trigger_null-8605.result | 14 ++++++++++++++ mysql-test/t/trigger_null-8605.test | 12 ++++++++++++ sql/sql_trigger.cc | 1 + 3 files changed, 27 insertions(+) diff --git a/mysql-test/r/trigger_null-8605.result b/mysql-test/r/trigger_null-8605.result index 85fc51987d7..e024bc6b7d2 100644 --- a/mysql-test/r/trigger_null-8605.result +++ b/mysql-test/r/trigger_null-8605.result @@ -341,3 +341,17 @@ create trigger tr1 before update on t1 for each row do 1; create trigger tr2 after update on t2 for each row update t1 set a=new.f2; update t2 set f2=1 where f1=1; drop table t1, t2; +create table t1 (a int not null, primary key (a)); +insert into t1 (a) values (1); +show columns from t1; +Field Type Null Key Default Extra +a int(11) NO PRI NULL +create trigger t1bu before update on t1 for each row begin end; +show columns from t1; +Field Type Null Key Default Extra +a int(11) NO PRI NULL +insert into t1 (a) values (3); +show columns from t1; +Field Type Null Key Default Extra +a int(11) NO PRI NULL +drop table t1; diff --git a/mysql-test/t/trigger_null-8605.test b/mysql-test/t/trigger_null-8605.test index c9b0257afc8..4b51ccd5606 100644 --- a/mysql-test/t/trigger_null-8605.test +++ b/mysql-test/t/trigger_null-8605.test @@ -360,3 +360,15 @@ create trigger tr1 before update on t1 for each row do 1; create trigger tr2 after update on t2 for each row update t1 set a=new.f2; update t2 set f2=1 where f1=1; drop table t1, t2; + +# +# MDEV-9629 Disappearing PRI from Key column after creating a trigger +# +create table t1 (a int not null, primary key (a)); +insert into t1 (a) values (1); +show columns from t1; +create trigger t1bu before update on t1 for each row begin end; +show columns from t1; +insert into t1 (a) values (3); +show columns from t1; +drop table t1; diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 272e1445273..18563ff9b85 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1101,6 +1101,7 @@ bool Table_triggers_list::prepare_record_accessors(TABLE *table) table == (*fld)->table))) return 1; + f->flags= (*fld)->flags; f->null_ptr= null_ptr; f->null_bit= null_bit; if (null_bit == 128) -- cgit v1.2.1 From 94768542115289272996f6450b7d3cafa75dcead Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 21 Mar 2016 11:21:44 +0400 Subject: MDEV-9369 IN operator with ( num, NULL ) gives inconsistent result Based on this commit into MySQL-5.7: > commit 8e51b845aafc8b4cdebd763c8aebda262ac2d4cd > Author: Guilhem Bichot > Date: Mon Nov 4 15:44:55 2013 +0100 > > Bug#13944462 'NULL IN (XX)' RETURNS WRONG RESULTS --- mysql-test/r/row.result | 14 +++++- mysql-test/t/row.test | 11 ++++- sql/item_cmpfunc.cc | 119 ++++++++++++++++++++++++++++++++---------------- sql/item_cmpfunc.h | 86 +++++++++++++++++++++++----------- sql/item_row.h | 11 ++++- 5 files changed, 173 insertions(+), 68 deletions(-) diff --git a/mysql-test/r/row.result b/mysql-test/r/row.result index 59a606128f5..9a19c3b0604 100644 --- a/mysql-test/r/row.result +++ b/mysql-test/r/row.result @@ -50,6 +50,12 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select ((1,2,(3,4)) in ((3,2,(3,4)),(1,2,(3,NULL)))) AS `row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL)))` +select row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(4,5))); +row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(4,5))) +0 +select row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(3,5))); +row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(3,5))) +NULL SELECT (1,2,3)=(0,NULL,3); (1,2,3)=(0,NULL,3) 0 @@ -130,7 +136,7 @@ ROW(c,2,3) IN(row(1,b,a), row(2,3,1)) 0 0 1 -NULL +0 select ROW(a,b,c) IN(row(1,2,3), row(3,2,1)) from t1; ROW(a,b,c) IN(row(1,2,3), row(3,2,1)) 1 @@ -509,5 +515,11 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where ((`test`.`t1`.`a` = 10) and (`test`.`t1`.`b` = 10)) DROP TABLE t1; # +# MDEV-9369 IN operator with ( num, NULL ) gives inconsistent result +# +SELECT (1,null) NOT IN ((2,2),(3,3)), (1,null) NOT IN ((2,2)), (1,null) NOT IN ((3,3)); +(1,null) NOT IN ((2,2),(3,3)) (1,null) NOT IN ((2,2)) (1,null) NOT IN ((3,3)) +1 1 1 +# # End of 10.1 tests # diff --git a/mysql-test/t/row.test b/mysql-test/t/row.test index 9268a3e1086..1c1d1b00910 100644 --- a/mysql-test/t/row.test +++ b/mysql-test/t/row.test @@ -19,10 +19,12 @@ select (1,2,(3,4)) IN ((3,2,(3,4)), (1,2,(3,4))); select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,4)); select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL))); explain extended select row(1,2,row(3,4)) IN (row(3,2,row(3,4)), row(1,2,row(3,NULL))); +select row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(4,5))); +select row(1,2,row(3,null)) IN (row(3,2,row(3,4)), row(1,2,row(3,5))); + SELECT (1,2,3)=(0,NULL,3); SELECT (1,2,3)=(1,NULL,3); -# here's something for Sanja to fix :) SELECT (1,2,3)=(1,NULL,0); SELECT ROW(1,2,3)=ROW(1,2,3); @@ -300,6 +302,13 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=10 AND b=10 AND a>=10; EXPLAIN EXTENDED SELECT * FROM t1 WHERE (a,b)=(10,10) AND a>=10; DROP TABLE t1; + +--echo # +--echo # MDEV-9369 IN operator with ( num, NULL ) gives inconsistent result +--echo # +SELECT (1,null) NOT IN ((2,2),(3,3)), (1,null) NOT IN ((2,2)), (1,null) NOT IN ((3,3)); + + --echo # --echo # End of 10.1 tests --echo # diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 4819a7a9086..1ce8bad933b 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -2914,7 +2914,7 @@ Item *Item_func_case::find_item(String *str) return else_expr_num != -1 ? args[else_expr_num] : 0; value_added_map|= 1U << (uint)cmp_type; } - if (!cmp_items[(uint)cmp_type]->cmp(args[i]) && !args[i]->null_value) + if (cmp_items[(uint)cmp_type]->cmp(args[i]) == FALSE) return args[i + 1]; } } @@ -3545,11 +3545,11 @@ static int cmp_decimal(void *cmp_arg, my_decimal *a, my_decimal *b) } -int in_vector::find(Item *item) +bool in_vector::find(Item *item) { uchar *result=get_value(item); if (!result || !used_count) - return 0; // Null value + return false; // Null value uint start,end; start=0; end=used_count-1; @@ -3558,13 +3558,13 @@ int in_vector::find(Item *item) uint mid=(start+end+1)/2; int res; if ((res=(*compare)(collation, base+mid*size, result)) == 0) - return 1; + return true; if (res < 0) start=mid; else end=mid-1; } - return (int) ((*compare)(collation, base+start*size, result) == 0); + return ((*compare)(collation, base+start*size, result) == 0); } in_string::in_string(uint elements,qsort2_cmp cmp_func, CHARSET_INFO *cs) @@ -3894,14 +3894,20 @@ int cmp_item_row::cmp(Item *arg) arg->bring_value(); for (uint i=0; i < n; i++) { - if (comparators[i]->cmp(arg->element_index(i))) + const int rc= comparators[i]->cmp(arg->element_index(i)); + switch (rc) { - if (!arg->element_index(i)->null_value) - return 1; - was_null= 1; + case UNKNOWN: + was_null= true; + break; + case TRUE: + return TRUE; + case FALSE: + break; // elements #i are equal } + arg->null_value|= arg->element_index(i)->null_value; } - return (arg->null_value= was_null); + return was_null ? UNKNOWN : FALSE; } @@ -3924,15 +3930,15 @@ void cmp_item_decimal::store_value(Item *item) /* val may be zero if item is nnull */ if (val && val != &value) my_decimal2decimal(val, &value); + m_null_value= item->null_value; } int cmp_item_decimal::cmp(Item *arg) { my_decimal tmp_buf, *tmp= arg->val_decimal(&tmp_buf); - if (arg->null_value) - return 1; - return my_decimal_cmp(&value, tmp); + return (m_null_value || arg->null_value) ? + UNKNOWN : (my_decimal_cmp(&value, tmp) != 0); } @@ -3956,12 +3962,14 @@ void cmp_item_datetime::store_value(Item *item) enum_field_types f_type= tmp_item[0]->field_type_for_temporal_comparison(warn_item); value= get_datetime_value(thd, &tmp_item, &lval_cache, f_type, &is_null); + m_null_value= item->null_value; } int cmp_item_datetime::cmp(Item *arg) { - return value != arg->val_temporal_packed(warn_item); + const bool rc= value != arg->val_temporal_packed(warn_item); + return (m_null_value || arg->null_value) ? UNKNOWN : rc; } @@ -3985,10 +3993,10 @@ bool Item_func_in::count_sargable_conds(uchar *arg) } -bool Item_func_in::nulls_in_row() +bool Item_func_in::list_contains_null() { Item **arg,**arg_end; - for (arg= args+1, arg_end= args+arg_count; arg != arg_end ; arg++) + for (arg= args + 1, arg_end= args+arg_count; arg != arg_end ; arg++) { if ((*arg)->null_inside()) return 1; @@ -4103,6 +4111,32 @@ void Item_func_in::fix_length_and_dec() } } + /* + First conditions for bisection to be possible: + 1. All types are similar, and + 2. All expressions in are const + */ + bool bisection_possible= + type_cnt == 1 && // 1 + const_itm; // 2 + if (bisection_possible) + { + /* + In the presence of NULLs, the correct result of evaluating this item + must be UNKNOWN or FALSE. To achieve that: + - If type is scalar, we can use bisection and the "have_null" boolean. + - If type is ROW, we will need to scan all of when + searching, so bisection is impossible. Unless: + 3. UNKNOWN and FALSE are equivalent results + 4. Neither left expression nor contain any NULL value + */ + + if (m_compare_type == ROW_RESULT && + ((!is_top_level_item() || negated) && // 3 + (list_contains_null() || args[0]->maybe_null))) // 4 + bisection_possible= false; + } + if (type_cnt == 1) { if (m_compare_type == STRING_RESULT && @@ -4115,7 +4149,7 @@ void Item_func_in::fix_length_and_dec() uint cols= args[0]->cols(); cmp_item_row *cmp= 0; - if (const_itm && !nulls_in_row()) + if (bisection_possible) { array= new (thd->mem_root) in_row(thd, arg_count-1, 0); cmp= &((in_row*)array)->tmp; @@ -4144,11 +4178,8 @@ void Item_func_in::fix_length_and_dec() } } } - /* - Row item with NULLs inside can return NULL or FALSE => - they can't be processed as static - */ - if (type_cnt == 1 && const_itm && !nulls_in_row()) + + if (bisection_possible) { /* IN must compare INT columns and constants as int values (the same @@ -4203,20 +4234,25 @@ void Item_func_in::fix_length_and_dec() array= new (thd->mem_root) in_datetime(date_arg, arg_count - 1); break; } - if (array && !(thd->is_fatal_error)) // If not EOM + if (!array || thd->is_fatal_error) // OOM + return; + uint j=0; + for (uint i=1 ; i < arg_count ; i++) { - uint j=0; - for (uint i=1 ; i < arg_count ; i++) + array->set(j,args[i]); + if (!args[i]->null_value) + j++; // include this cell in the array. + else { - array->set(j,args[i]); - if (!args[i]->null_value) // Skip NULL values - j++; - else - have_null= 1; + /* + We don't put NULL values in array, to avoid erronous matches in + bisection. + */ + have_null= 1; } - if ((array->used_count= j)) - array->sort(); } + if ((array->used_count= j)) + array->sort(); } else { @@ -4284,7 +4320,14 @@ longlong Item_func_in::val_int() uint value_added_map= 0; if (array) { - int tmp=array->find(args[0]); + bool tmp=array->find(args[0]); + /* + NULL on left -> UNKNOWN. + Found no match, and NULL on right -> UNKNOWN. + NULL on right can never give a match, as it is not stored in + array. + See also the 'bisection_possible' variable in fix_length_and_dec(). + */ null_value=args[0]->null_value || (!tmp && have_null); return (longlong) (!null_value && tmp != negated); } @@ -4306,13 +4349,12 @@ longlong Item_func_in::val_int() if (!(value_added_map & (1U << (uint)cmp_type))) { in_item->store_value(args[0]); - if ((null_value= args[0]->null_value)) - return 0; value_added_map|= 1U << (uint)cmp_type; } - if (!in_item->cmp(args[i]) && !args[i]->null_value) + const int rc= in_item->cmp(args[i]); + if (rc == FALSE) return (longlong) (!negated); - have_null|= args[i]->null_value; + have_null|= (rc == UNKNOWN); } null_value= have_null; @@ -6434,7 +6476,8 @@ longlong Item_equal::val_int() /* Skip fields of tables that has not been read yet */ if (!field->table->status || (field->table->status & STATUS_NULL_ROW)) { - if (eval_item->cmp(item) || (null_value= item->null_value)) + const int rc= eval_item->cmp(item); + if ((rc == TRUE) || (null_value= (rc == UNKNOWN))) return 0; } } diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index cd19ba72c07..39f2cf5590d 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -796,6 +796,7 @@ public: public: inline void negate() { negated= !negated; } inline void top_level_item() { pred_level= 1; } + bool is_top_level_item() const { return pred_level; } Item *neg_transformer(THD *thd) { negated= !negated; @@ -1075,7 +1076,7 @@ public: { my_qsort2(base,used_count,size,compare,(void*)collation); } - int find(Item *item); + bool find(Item *item); /* Create an instance of Item_{type} (e.g. Item_decimal) constant object @@ -1243,6 +1244,10 @@ public: cmp_item() { cmp_charset= &my_charset_bin; } virtual ~cmp_item() {} virtual void store_value(Item *item)= 0; + /** + @returns result (TRUE, FALSE or UNKNOWN) of + "stored argument's value <> item's value" + */ virtual int cmp(Item *item)= 0; // for optimized IN with row virtual int compare(cmp_item *item)= 0; @@ -1255,7 +1260,14 @@ public: } }; -class cmp_item_string :public cmp_item +/// cmp_item which stores a scalar (i.e. non-ROW). +class cmp_item_scalar : public cmp_item +{ +protected: + bool m_null_value; ///< If stored value is NULL +}; + +class cmp_item_string : public cmp_item_scalar { protected: String *value_res; @@ -1281,14 +1293,20 @@ public: void store_value(Item *item) { value_res= item->val_str(&value); + m_null_value= item->null_value; } int cmp(Item *arg) { char buff[STRING_BUFFER_USUAL_SIZE]; - String tmp(buff, sizeof(buff), cmp_charset), *res; - res= arg->val_str(&tmp); - return (value_res ? (res ? sortcmp(value_res, res, cmp_charset) : 1) : - (res ? -1 : 0)); + String tmp(buff, sizeof(buff), cmp_charset), *res= arg->val_str(&tmp); + if (m_null_value || arg->null_value) + return UNKNOWN; + if (value_res && res) + return sortcmp(value_res, res, cmp_charset) != 0; + else if (!value_res && !res) + return FALSE; + else + return TRUE; } int compare(cmp_item *ci) { @@ -1303,7 +1321,7 @@ public: } }; -class cmp_item_int :public cmp_item +class cmp_item_int : public cmp_item_scalar { longlong value; public: @@ -1311,10 +1329,12 @@ public: void store_value(Item *item) { value= item->val_int(); + m_null_value= item->null_value; } int cmp(Item *arg) { - return value != arg->val_int(); + const bool rc= value != arg->val_int(); + return (m_null_value || arg->null_value) ? UNKNOWN : rc; } int compare(cmp_item *ci) { @@ -1330,7 +1350,7 @@ public: If the left item is a constant one then its value is cached in the lval_cache variable. */ -class cmp_item_datetime :public cmp_item +class cmp_item_datetime : public cmp_item_scalar { longlong value; public: @@ -1348,7 +1368,7 @@ public: cmp_item *make_same(); }; -class cmp_item_real :public cmp_item +class cmp_item_real : public cmp_item_scalar { double value; public: @@ -1356,10 +1376,12 @@ public: void store_value(Item *item) { value= item->val_real(); + m_null_value= item->null_value; } int cmp(Item *arg) { - return value != arg->val_real(); + const bool rc= value != arg->val_real(); + return (m_null_value || arg->null_value) ? UNKNOWN : rc; } int compare(cmp_item *ci) { @@ -1370,7 +1392,7 @@ public: }; -class cmp_item_decimal :public cmp_item +class cmp_item_decimal : public cmp_item_scalar { my_decimal value; public: @@ -1397,12 +1419,13 @@ public: void store_value(Item *item) { value_res= item->val_str(&value); + m_null_value= item->null_value; } int cmp(Item *item) { // Should never be called - DBUG_ASSERT(0); - return 1; + DBUG_ASSERT(false); + return TRUE; } int compare(cmp_item *ci) { @@ -1467,33 +1490,43 @@ public: }; /* - The Item_func_in class implements the in_expr IN(values_list) function. + The Item_func_in class implements + in_expr IN () + and + in_expr NOT IN () The current implementation distinguishes 2 cases: - 1) all items in the value_list are constants and have the same + 1) all items in are constants and have the same result type. This case is handled by in_vector class. - 2) items in the value_list have different result types or there is some - non-constant items. - In this case Item_func_in employs several cmp_item objects to performs - comparisons of in_expr and an item from the values_list. One cmp_item + 2) otherwise Item_func_in employs several cmp_item objects to perform + comparisons of in_expr and an item from . One cmp_item object for each result type. Different result types are collected in the fix_length_and_dec() member function by means of collect_cmp_types() function. */ class Item_func_in :public Item_func_opt_neg { + /** + Usable if is made only of constants. Returns true if one + of these constants contains a NULL. Example: + IN ( (-5, (12,NULL)), ... ). + */ + bool list_contains_null(); protected: SEL_TREE *get_func_mm_tree(RANGE_OPT_PARAM *param, Field *field, Item *value); public: - /* - an array of values when the right hand arguments of IN - are all SQL constant and there are no nulls - */ + /// An array of values, created when the bisection lookup method is used in_vector *array; + /** + If there is some NULL among , during a val_int() call; for + example + IN ( (1,(3,'col')), ... ), where 'col' is a column which evaluates to + NULL. + */ bool have_null; - /* - true when all arguments of the IN clause are of compatible types + /** + true when all arguments of the IN list are of compatible types and can be used safely as comparisons for key conditions */ bool arg_types_compatible; @@ -1547,7 +1580,6 @@ public: virtual void print(String *str, enum_query_type query_type); enum Functype functype() const { return IN_FUNC; } const char *func_name() const { return " IN "; } - bool nulls_in_row(); bool eval_not_null_tables(uchar *opt_arg); void fix_after_pullout(st_select_lex *new_parent, Item **ref); bool count_sargable_conds(uchar *arg); diff --git a/sql/item_row.h b/sql/item_row.h index cf55eddc19c..25c9ec7915b 100644 --- a/sql/item_row.h +++ b/sql/item_row.h @@ -2,7 +2,7 @@ #define ITEM_ROW_INCLUDED /* - Copyright (c) 2002, 2010, Oracle and/or its affiliates. + Copyright (c) 2002, 2013, Oracle and/or its affiliates. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -28,11 +28,20 @@ @endverbatim */ + +/** + Item which stores (x,y,...) and ROW(x,y,...). + Note that this can be recursive: ((x,y),(z,t)) is a ROW of ROWs. +*/ class Item_row: public Item, private Item_args, private Used_tables_and_const_cache { table_map not_null_tables_cache; + /** + If elements are made only of constants, of which one or more are + NULL. For example, this item is (1,2,NULL), or ( (1,NULL), (2,3) ). + */ bool with_null; public: Item_row(THD *thd, List &list): -- cgit v1.2.1 From 14771bd044bc46b47b11c33b69b37d0d484af51a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Mar 2016 13:28:58 +0100 Subject: MDEV-9660 yum/rpm update from 10.0 to 10.1 replaces/obsoletes ? MariaDB-server-10.1 should obsolete MariaDB-Galera-server --- cmake/cpack_rpm.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 4ec16369354..72f2275cba7 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -123,6 +123,7 @@ SETA(CPACK_RPM_server_PACKAGE_OBSOLETES "MySQL" "mysql-server" "MySQL-server" + "MariaDB-Galera-server" "MySQL-OurDelta-server") SETA(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB" -- cgit v1.2.1 From c03433dea75435762c404dd02c123c0d05c106c8 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Mar 2016 21:59:24 +0100 Subject: rpm: ignore /usr/lib/systemd and /usr/lib/systemd/system --- cmake/cpack_rpm.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 72f2275cba7..efd68b863f4 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -78,14 +78,16 @@ SET(ignored "%ignore ${CMAKE_INSTALL_PREFIX}/bin" "%ignore ${CMAKE_INSTALL_PREFIX}/include" "%ignore ${CMAKE_INSTALL_PREFIX}/lib" + "%ignore ${CMAKE_INSTALL_PREFIX}/lib/systemd" + "%ignore ${CMAKE_INSTALL_PREFIX}/lib/systemd/system" "%ignore ${CMAKE_INSTALL_PREFIX}/lib64" "%ignore ${CMAKE_INSTALL_PREFIX}/sbin" "%ignore ${CMAKE_INSTALL_PREFIX}/share" "%ignore ${CMAKE_INSTALL_PREFIX}/share/aclocal" "%ignore ${CMAKE_INSTALL_PREFIX}/share/doc" "%ignore ${CMAKE_INSTALL_PREFIX}/share/man" - "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man1*" - "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man8*" + "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man1" + "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man8" "%ignore ${CMAKE_INSTALL_PREFIX}/share/pkgconfig" ) -- cgit v1.2.1 From e7cf898d6dc3dcac41f58db4761df3a6d1dffc03 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 21 Mar 2016 11:35:48 +0100 Subject: rpm: prefer the conditional %{?...} syntax --- cmake/cpack_rpm.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index efd68b863f4..f7eb335b966 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -179,7 +179,7 @@ MACRO(ALTERNATIVE_NAME real alt) SET(p "CPACK_RPM_${real}_PACKAGE_PROVIDES") SET(${p} "${${p}} ${alt} = ${ver} ${alt}%{?_isa} = ${ver} config(${alt}) = ${ver}") SET(o "CPACK_RPM_${real}_PACKAGE_OBSOLETES") - SET(${o} "${${o}} ${alt} ${alt}%{_isa}") + SET(${o} "${${o}} ${alt} ${alt}%{?_isa}") ENDMACRO(ALTERNATIVE_NAME) ALTERNATIVE_NAME("devel" "mysql-devel") -- cgit v1.2.1 From e69c6e81a89c4b284cc9c34af66403a1153cd492 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 18 Feb 2016 21:43:19 +0100 Subject: MDEV-9560 Mariadb 10.1 Crashes when replicating from 10.0 don't crash in debug builds. issue an error message on corrupt event --- sql/log_event.cc | 7 +++++-- sql/rpl_record.cc | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sql/log_event.cc b/sql/log_event.cc index 30634c4e73b..93704e7c235 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -11394,7 +11394,10 @@ Rows_log_event::write_row(rpl_group_info *rgi, /* unpack row into table->record[0] */ if ((error= unpack_current_row(rgi))) + { + table->file->print_error(error, MYF(0)); DBUG_RETURN(error); + } if (m_curr_row == m_rows_buf && !invoke_triggers) { @@ -12453,8 +12456,8 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi) We need to read the second image in the event of error to be able to skip to the next pair of updates */ - m_curr_row= m_curr_row_end; - unpack_current_row(rgi); + if ((m_curr_row= m_curr_row_end)) + unpack_current_row(rgi); return error; } diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index f0308308fea..183248ad1b8 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -185,7 +185,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols, @retval HA_ERR_GENERIC A generic, internal, error caused the unpacking to fail. - @retval ER_SLAVE_CORRUPT_EVENT + @retval HA_ERR_CORRUPT_EVENT Found error when trying to unpack fields. */ #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) @@ -322,7 +322,7 @@ unpack_row(rpl_group_info *rgi, "Could not read field '%s' of table '%s.%s'", f->field_name, table->s->db.str, table->s->table_name.str); - DBUG_RETURN(ER_SLAVE_CORRUPT_EVENT); + DBUG_RETURN(HA_ERR_CORRUPT_EVENT); } } -- cgit v1.2.1 From ee687771eedd2dd63d6fa094360f88a2b83f2db9 Mon Sep 17 00:00:00 2001 From: Bernard Spil Date: Sat, 27 Feb 2016 20:08:59 +0100 Subject: Use /bin/sh Remove Linuxism. Works fine with a POSIX-compat shell --- storage/tokudb/PerconaFT/buildheader/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/tokudb/PerconaFT/buildheader/CMakeLists.txt b/storage/tokudb/PerconaFT/buildheader/CMakeLists.txt index 5da3c98ff48..6d5cbb94358 100644 --- a/storage/tokudb/PerconaFT/buildheader/CMakeLists.txt +++ b/storage/tokudb/PerconaFT/buildheader/CMakeLists.txt @@ -1,6 +1,6 @@ set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "") -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/runcat.sh" "#!/bin/bash +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/runcat.sh" "#!/bin/sh out=$1; shift exec \"$@\" >$out") @@ -8,7 +8,7 @@ add_executable(make_tdb make_tdb.cc) set_property(TARGET make_tdb APPEND PROPERTY COMPILE_DEFINITIONS _GNU_SOURCE) add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/db.h" - COMMAND bash runcat.sh "${CMAKE_CURRENT_BINARY_DIR}/db.h" $ + COMMAND sh runcat.sh "${CMAKE_CURRENT_BINARY_DIR}/db.h" $ DEPENDS make_tdb) add_custom_target(install_tdb_h DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/db.h") -- cgit v1.2.1 From 8b9432ffacd6843c4b61192866f2d81aa1cad346 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2016 12:02:28 +0100 Subject: MDEV-9698 Buffer overflow in extension_based_table_discovery() fix a buffer overflow in extension_based_table_discovery (that only happens in debug builds) --- sql/discover.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/discover.cc b/sql/discover.cc index 82648e94bc5..36e3ef72c44 100644 --- a/sql/discover.cc +++ b/sql/discover.cc @@ -206,7 +206,8 @@ int extension_based_table_discovery(MY_DIR *dirp, const char *ext_meta, { size_t len= (octothorp ? octothorp : ext) - cur->name; if (from != cur && - (my_strnncoll(cs, (uchar*)from->name, len, (uchar*)cur->name, len) || + (strlen(from->name) <= len || + my_strnncoll(cs, (uchar*)from->name, len, (uchar*)cur->name, len) || (from->name[len] != FN_EXTCHAR && from->name[len] != '#'))) advance(from, to, cur, skip); -- cgit v1.2.1 From 7baff9f68763d737c5eb612e455861a1cd05349f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2016 13:08:06 +0100 Subject: fix extension_based_table_discovery for partitioned tables typo. the code was not matching the comment --- mysql-test/suite/archive/partition_archive.result | 6 ++++++ mysql-test/suite/archive/partition_archive.test | 7 +++++++ sql/discover.cc | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/archive/partition_archive.result b/mysql-test/suite/archive/partition_archive.result index eb1fca46522..c4cccc03a04 100644 --- a/mysql-test/suite/archive/partition_archive.result +++ b/mysql-test/suite/archive/partition_archive.result @@ -153,3 +153,9 @@ t1 CREATE TABLE `t1` ( PARTITIONS 5 */ #Cleanup. DROP TABLE t1; +create database mysqltest1; +create table mysqltest1.t1 (a int not null, b int not null) engine=archive +partition by list(a) subpartition by hash(b) +(partition p1 values in (1), +partition p2 values in (2)); +drop database mysqltest1; diff --git a/mysql-test/suite/archive/partition_archive.test b/mysql-test/suite/archive/partition_archive.test index 899f266c09c..aa2adb7e44d 100644 --- a/mysql-test/suite/archive/partition_archive.test +++ b/mysql-test/suite/archive/partition_archive.test @@ -147,3 +147,10 @@ SHOW CREATE TABLE t1; --echo #Cleanup. DROP TABLE t1; + +create database mysqltest1; +create table mysqltest1.t1 (a int not null, b int not null) engine=archive + partition by list(a) subpartition by hash(b) + (partition p1 values in (1), + partition p2 values in (2)); +drop database mysqltest1; diff --git a/sql/discover.cc b/sql/discover.cc index 36e3ef72c44..d8ed718fc58 100644 --- a/sql/discover.cc +++ b/sql/discover.cc @@ -199,7 +199,7 @@ int extension_based_table_discovery(MY_DIR *dirp, const char *ext_meta, end= cur + dirp->number_of_files; while (cur < end) { - char *octothorp= strrchr(cur->name + 1, '#'); + char *octothorp= strchr(cur->name + 1, '#'); char *ext= strchr(octothorp ? octothorp : cur->name, FN_EXTCHAR); if (ext) -- cgit v1.2.1 From 620d975ecd05fe9d91e3860e6af0a674da433acf Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2016 13:08:17 +0100 Subject: typo in a comment --- sql/handler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/handler.h b/sql/handler.h index e3dcf4fa63a..8dc05a1d9df 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -1293,7 +1293,7 @@ struct handlerton }; /* - By default (if not implemented by the engine, but the discovery_table() is + By default (if not implemented by the engine, but the discover_table() is implemented) it will perform a file-based discovery: - if tablefile_extensions[0] is not null, this will discovers all tables -- cgit v1.2.1 From 2ed882f9c454e7c05b9ee81f7af37015fb8e7c68 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2016 17:38:12 +0100 Subject: update tests and results s/Execute/Query/ to account for --ps-protocol --- storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock.test | 3 +++ storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock_3.test | 3 +++ 2 files changed, 6 insertions(+) diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock.test b/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock.test index d57a59b22e5..607b1991e26 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock.test +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock.test @@ -8,8 +8,10 @@ connect (conn1,localhost,root,,); connection default; --sleep 2 +--replace_result Execute Query select DB, command, state, info from information_schema.processlist order by info; flush logs; +--replace_result Execute Query select DB, command, state, info from information_schema.processlist order by info; connection conn1; @@ -20,6 +22,7 @@ connection default; connection conn1; --sleep 2 +--replace_result Execute Query select DB, command, state, info from information_schema.processlist order by info; set tokudb_checkpoint_lock=0; diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock_3.test b/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock_3.test index 64c0f491f9a..91d7e59bee6 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock_3.test +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/checkpoint_lock_3.test @@ -7,8 +7,10 @@ connect (conn1,localhost,root,,); connection default; --sleep 2 +--replace_result Execute Query select DB, command, state, info from information_schema.processlist order by info; flush logs; +--replace_result Execute Query select DB, command, state, info from information_schema.processlist order by info; connection conn1; @@ -19,6 +21,7 @@ connection default; connection conn1; --sleep 2 +--replace_result Execute Query select DB, command, state, info from information_schema.processlist order by info; set tokudb_checkpoint_lock=0; -- cgit v1.2.1 From a2de604309e9b95292bfe81310ae247f6bfbee90 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2016 17:40:53 +0100 Subject: ASAN error in CONNECT engine don't strcpy a string to itself --- storage/connect/value.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp index 80a694bfc26..422853f7cba 100644 --- a/storage/connect/value.cpp +++ b/storage/connect/value.cpp @@ -1627,6 +1627,12 @@ int TYPVAL::CompareValue(PVAL vp) return (n > 0) ? 1 : (n < 0) ? -1 : 0; } // end of CompareValue +static inline void v_strcpy(char *dest, const char *src) +{ + if (dest != src) + strcpy(dest, src); +} + /***********************************************************************/ /* Compute a function on a string. */ /***********************************************************************/ @@ -1651,11 +1657,11 @@ bool TYPVAL::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) break; case OP_MIN: assert(np == 2); - strcpy(Strp, (strcmp(p[0], p[1]) < 0) ? p[0] : p[1]); + v_strcpy(Strp, (strcmp(p[0], p[1]) < 0) ? p[0] : p[1]); break; case OP_MAX: assert(np == 2); - strcpy(Strp, (strcmp(p[0], p[1]) > 0) ? p[0] : p[1]); + v_strcpy(Strp, (strcmp(p[0], p[1]) > 0) ? p[0] : p[1]); break; default: // sprintf(g->Message, MSG(BAD_EXP_OPER), op); -- cgit v1.2.1 From d158ba62f71ddcc09ecbaff9a73e456e62e2f2e8 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 17 Mar 2016 17:41:45 +0100 Subject: ASAN error in OQGraph engine Fixed more cases for MDEV-6282 --- storage/oqgraph/ha_oqgraph.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/storage/oqgraph/ha_oqgraph.cc b/storage/oqgraph/ha_oqgraph.cc index 89bc9128c29..f5412c3b83a 100644 --- a/storage/oqgraph/ha_oqgraph.cc +++ b/storage/oqgraph/ha_oqgraph.cc @@ -715,6 +715,10 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked) int ha_oqgraph::close(void) { DBUG_PRINT( "oq-debug", ("close()")); + if (graph->get_thd() != current_thd) { + DBUG_PRINT( "oq-debug", ("index_next_same g->table->in_use: 0x%lx <-- current_thd 0x%lx", (long) graph->get_thd(), (long) current_thd)); + graph->set_thd(current_thd); + } oqgraph::free(graph); graph= 0; oqgraph::free(graph_share); graph_share= 0; -- cgit v1.2.1 From b9e571882b3801f53d30bb77155743af39c1b719 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Mar 2016 13:57:46 +0100 Subject: MDEV-9679 main.delayed fails sporadically update main.delayed test after 38b89a61 ALTER TABLE ... COMMENT is no longer blocking, use a different ALTER TABLE variant. --- mysql-test/r/delayed.result | 2 +- mysql-test/t/delayed.test | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result index 0eb0661b0e2..98c8b599e88 100644 --- a/mysql-test/r/delayed.result +++ b/mysql-test/r/delayed.result @@ -379,7 +379,7 @@ SELECT * FROM t1 WHERE a=0; a # Connection con1 # Sending: -ALTER TABLE t1 COMMENT 'test'; +ALTER TABLE t1 MODIFY a INT UNSIGNED;; # Connection default # Wait until ALTER TABLE is blocked on table 't1'. INSERT DELAYED INTO t1 VALUES (3); diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test index 1898d1a4691..2886dff8f91 100644 --- a/mysql-test/t/delayed.test +++ b/mysql-test/t/delayed.test @@ -457,7 +457,7 @@ SELECT * FROM t1 WHERE a=0; --echo # Connection con1 connection con1; --echo # Sending: ---send ALTER TABLE t1 COMMENT 'test' +--send ALTER TABLE t1 MODIFY a INT UNSIGNED; --echo # Connection default connection default; @@ -465,7 +465,7 @@ connection default; let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for table metadata lock" - AND info = "ALTER TABLE t1 COMMENT 'test'"; + AND info LIKE "ALTER TABLE t1%"; --source include/wait_condition.inc --error ER_LOCK_DEADLOCK INSERT DELAYED INTO t1 VALUES (3); -- cgit v1.2.1 From e8af217e16837000b8a3809e9fa48a5e75088cd0 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 17 Mar 2016 15:12:57 +0100 Subject: MDEV-9590: Always print "Engine-independent statistic" warnings and might be filtering columns unintentionally from engines Do not issue the warning in case we are not going to collect the statistics. --- mysql-test/r/analyze.result | 2 - mysql-test/r/mysqlcheck.result | 60 +++----------- mysql-test/r/statistics.result | 14 ++++ .../suite/innodb_fts/r/innodb-fts-fic.result | 1 - .../suite/innodb_fts/r/innodb-fts-stopword.result | 2 - mysql-test/suite/innodb_zip/r/innodb-zip.result | 2 - .../suite/parts/r/partition_repair_myisam.result | 1 - mysql-test/t/statistics.test | 13 +++ sql/sql_admin.cc | 94 ++++++++++++---------- 9 files changed, 88 insertions(+), 101 deletions(-) diff --git a/mysql-test/r/analyze.result b/mysql-test/r/analyze.result index 5a05d1c5da8..9dff94ab08c 100644 --- a/mysql-test/r/analyze.result +++ b/mysql-test/r/analyze.result @@ -34,11 +34,9 @@ create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_g insert into t1 values ('hello'); analyze table t1; Table Op Msg_type Msg_text -test.t1 analyze Warning Engine-independent statistics are not collected for column 'a' test.t1 analyze status OK analyze table t1; Table Op Msg_type Msg_text -test.t1 analyze Warning Engine-independent statistics are not collected for column 'a' test.t1 analyze status Table is already up to date drop table t1; CREATE TABLE t1 (a int); diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index eb05f056321..033b4086985 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -7,34 +7,19 @@ mtr.test_suppressions OK mysql.column_stats OK mysql.columns_priv OK mysql.db OK -mysql.event -Warning : Engine-independent statistics are not collected for column 'body' -Warning : Engine-independent statistics are not collected for column 'body_utf8' -status : OK +mysql.event OK mysql.func OK mysql.gtid_slave_pos OK -mysql.help_category -Warning : Engine-independent statistics are not collected for column 'url' -status : OK +mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK -mysql.help_topic -Warning : Engine-independent statistics are not collected for column 'description' -Warning : Engine-independent statistics are not collected for column 'example' -Warning : Engine-independent statistics are not collected for column 'url' -status : OK +mysql.help_topic OK mysql.host OK mysql.index_stats OK mysql.innodb_index_stats OK mysql.innodb_table_stats OK mysql.plugin OK -mysql.proc -Warning : Engine-independent statistics are not collected for column 'param_list' -Warning : Engine-independent statistics are not collected for column 'returns' -Warning : Engine-independent statistics are not collected for column 'body' -Warning : Engine-independent statistics are not collected for column 'comment' -Warning : Engine-independent statistics are not collected for column 'body_utf8' -status : OK +mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK mysql.roles_mapping OK @@ -46,12 +31,7 @@ mysql.time_zone_leap_second OK mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK -mysql.user -Warning : Engine-independent statistics are not collected for column 'ssl_cipher' -Warning : Engine-independent statistics are not collected for column 'x509_issuer' -Warning : Engine-independent statistics are not collected for column 'x509_subject' -Warning : Engine-independent statistics are not collected for column 'authentication_string' -status : OK +mysql.user OK mtr.global_suppressions Table is already up to date mtr.test_suppressions Table is already up to date mysql.column_stats OK @@ -89,34 +69,19 @@ mysql.user OK mysql.column_stats OK mysql.columns_priv OK mysql.db OK -mysql.event -Warning : Engine-independent statistics are not collected for column 'body' -Warning : Engine-independent statistics are not collected for column 'body_utf8' -status : OK +mysql.event OK mysql.func OK mysql.gtid_slave_pos OK -mysql.help_category -Warning : Engine-independent statistics are not collected for column 'url' -status : OK +mysql.help_category OK mysql.help_keyword OK mysql.help_relation OK -mysql.help_topic -Warning : Engine-independent statistics are not collected for column 'description' -Warning : Engine-independent statistics are not collected for column 'example' -Warning : Engine-independent statistics are not collected for column 'url' -status : OK +mysql.help_topic OK mysql.host OK mysql.index_stats OK mysql.innodb_index_stats OK mysql.innodb_table_stats OK mysql.plugin OK -mysql.proc -Warning : Engine-independent statistics are not collected for column 'param_list' -Warning : Engine-independent statistics are not collected for column 'returns' -Warning : Engine-independent statistics are not collected for column 'body' -Warning : Engine-independent statistics are not collected for column 'comment' -Warning : Engine-independent statistics are not collected for column 'body_utf8' -status : OK +mysql.proc OK mysql.procs_priv OK mysql.proxies_priv OK mysql.roles_mapping OK @@ -128,12 +93,7 @@ mysql.time_zone_leap_second OK mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK -mysql.user -Warning : Engine-independent statistics are not collected for column 'ssl_cipher' -Warning : Engine-independent statistics are not collected for column 'x509_issuer' -Warning : Engine-independent statistics are not collected for column 'x509_subject' -Warning : Engine-independent statistics are not collected for column 'authentication_string' -status : OK +mysql.user OK mysql.column_stats Table is already up to date mysql.columns_priv Table is already up to date mysql.db Table is already up to date diff --git a/mysql-test/r/statistics.result b/mysql-test/r/statistics.result index fdda572f396..be2e39665b3 100644 --- a/mysql-test/r/statistics.result +++ b/mysql-test/r/statistics.result @@ -1663,3 +1663,17 @@ FROM mysql.column_stats; db_name table_name column_name HEX(min_value) HEX(max_value) nulls_ratio avg_frequency hist_size hist_type HEX(histogram) test t1 a D879626AF872675F73E662F8 D879626AF872675F73E662F8 0.0000 1.0000 0 NULL NULL drop table t1; +# +# MDEV-9590: Always print "Engine-independent statistic" warnings and +# might be filtering columns unintentionally from engines +# +set use_stat_tables='NEVER'; +create table t1 (test blob); +show variables like 'use_stat_tables'; +Variable_name Value +use_stat_tables NEVER +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Table is already up to date +drop table t1; +set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-fic.result b/mysql-test/suite/innodb_fts/r/innodb-fts-fic.result index ee7277af640..e5df6ca8b05 100644 --- a/mysql-test/suite/innodb_fts/r/innodb-fts-fic.result +++ b/mysql-test/suite/innodb_fts/r/innodb-fts-fic.result @@ -36,7 +36,6 @@ count 2 ANALYZE TABLE articles; Table Op Msg_type Msg_text -test.articles analyze Warning Engine-independent statistics are not collected for column 'body' test.articles analyze status OK SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result b/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result index e0ba456b51c..ea0ec381faa 100644 --- a/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result +++ b/mysql-test/suite/innodb_fts/r/innodb-fts-stopword.result @@ -247,7 +247,6 @@ articles CREATE TABLE `articles` ( ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body); ANALYZE TABLE articles; Table Op Msg_type Msg_text -test.articles analyze Warning Engine-independent statistics are not collected for column 'body' test.articles analyze status OK SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); id title body @@ -570,7 +569,6 @@ select @@innodb_ft_enable_stopword; 1 ANALYZE TABLE articles; Table Op Msg_type Msg_text -test.articles analyze Warning Engine-independent statistics are not collected for column 'body' test.articles analyze status OK SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will"); id title body diff --git a/mysql-test/suite/innodb_zip/r/innodb-zip.result b/mysql-test/suite/innodb_zip/r/innodb-zip.result index 2113c6e1069..dbfae3c0630 100644 --- a/mysql-test/suite/innodb_zip/r/innodb-zip.result +++ b/mysql-test/suite/innodb_zip/r/innodb-zip.result @@ -122,11 +122,9 @@ a left(b,40) 1 1abcdefghijklmnopqrstuvwxyzAAAAAAAAAAAAA analyze table t1; Table Op Msg_type Msg_text -mysqltest_innodb_zip.t1 analyze Warning Engine-independent statistics are not collected for column 'b' mysqltest_innodb_zip.t1 analyze status OK analyze table t2; Table Op Msg_type Msg_text -mysqltest_innodb_zip.t2 analyze Warning Engine-independent statistics are not collected for column 'b' mysqltest_innodb_zip.t2 analyze status OK SELECT table_schema, table_name, row_format, data_length, index_length FROM information_schema.tables WHERE engine='innodb' AND table_schema != 'mysql'; table_schema table_name row_format data_length index_length diff --git a/mysql-test/suite/parts/r/partition_repair_myisam.result b/mysql-test/suite/parts/r/partition_repair_myisam.result index cbc425b48db..3652698f634 100644 --- a/mysql-test/suite/parts/r/partition_repair_myisam.result +++ b/mysql-test/suite/parts/r/partition_repair_myisam.result @@ -322,7 +322,6 @@ FLUSH TABLES; # replacing p6 with a crashed MYD file (1) (splitted dynamic record) ANALYZE TABLE t1_will_crash; Table Op Msg_type Msg_text -test.t1_will_crash analyze Warning Engine-independent statistics are not collected for column 'c' test.t1_will_crash analyze status OK OPTIMIZE TABLE t1_will_crash; Table Op Msg_type Msg_text diff --git a/mysql-test/t/statistics.test b/mysql-test/t/statistics.test index 3b57b8f2c52..805c169b2a4 100644 --- a/mysql-test/t/statistics.test +++ b/mysql-test/t/statistics.test @@ -728,3 +728,16 @@ select db_name, table_name, column_name, FROM mysql.column_stats; drop table t1; + +--echo # +--echo # MDEV-9590: Always print "Engine-independent statistic" warnings and +--echo # might be filtering columns unintentionally from engines +--echo # + +set use_stat_tables='NEVER'; +create table t1 (test blob); +show variables like 'use_stat_tables'; +analyze table t1; +drop table t1; + +set use_stat_tables=@save_use_stat_tables; diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 8b58f062a3e..f27cdcc41f2 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -369,6 +369,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, char* db = table->db; bool fatal_error=0; bool open_error; + bool collect_eis= FALSE; DBUG_PRINT("admin", ("table: '%s'.'%s'", table->db, table->table_name)); strxmov(table_name, db, ".", table->table_name, NullS); @@ -697,53 +698,64 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, { compl_result_code= result_code= HA_ADMIN_INVALID; } + collect_eis= + (table->table->s->table_category == TABLE_CATEGORY_USER && + (get_use_stat_tables_mode(thd) > NEVER || + lex->with_persistent_for_clause)); - if (!lex->column_list) + if (collect_eis) { - bitmap_clear_all(tab->read_set); - for (uint fields= 0; *field_ptr; field_ptr++, fields++) + if (!lex->column_list) { - enum enum_field_types type= (*field_ptr)->type(); - if (type < MYSQL_TYPE_MEDIUM_BLOB || - type > MYSQL_TYPE_BLOB) - bitmap_set_bit(tab->read_set, fields); - else - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_NO_EIS_FOR_FIELD, - ER_THD(thd, ER_NO_EIS_FOR_FIELD), - (*field_ptr)->field_name); + bitmap_clear_all(tab->read_set); + for (uint fields= 0; *field_ptr; field_ptr++, fields++) + { + enum enum_field_types type= (*field_ptr)->type(); + if (type < MYSQL_TYPE_MEDIUM_BLOB || + type > MYSQL_TYPE_BLOB) + bitmap_set_bit(tab->read_set, fields); + else if (collect_eis) + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_NO_EIS_FOR_FIELD, + ER_THD(thd, ER_NO_EIS_FOR_FIELD), + (*field_ptr)->field_name); + } } - } - else - { - int pos; - LEX_STRING *column_name; - List_iterator_fast it(*lex->column_list); + else + { + int pos; + LEX_STRING *column_name; + List_iterator_fast it(*lex->column_list); - bitmap_clear_all(tab->read_set); - while ((column_name= it++)) - { - if (tab->s->fieldnames.type_names == 0 || - (pos= find_type(&tab->s->fieldnames, column_name->str, - column_name->length, 1)) <= 0) + bitmap_clear_all(tab->read_set); + while ((column_name= it++)) { - compl_result_code= result_code= HA_ADMIN_INVALID; - break; + if (tab->s->fieldnames.type_names == 0 || + (pos= find_type(&tab->s->fieldnames, column_name->str, + column_name->length, 1)) <= 0) + { + compl_result_code= result_code= HA_ADMIN_INVALID; + break; + } + pos--; + enum enum_field_types type= tab->field[pos]->type(); + if (type < MYSQL_TYPE_MEDIUM_BLOB || + type > MYSQL_TYPE_BLOB) + bitmap_set_bit(tab->read_set, pos); + else if (collect_eis) + push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, + ER_NO_EIS_FOR_FIELD, + ER_THD(thd, ER_NO_EIS_FOR_FIELD), + column_name->str); } - pos--; - enum enum_field_types type= tab->field[pos]->type(); - if (type < MYSQL_TYPE_MEDIUM_BLOB || - type > MYSQL_TYPE_BLOB) - bitmap_set_bit(tab->read_set, pos); - else - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_NO_EIS_FOR_FIELD, - ER_THD(thd, ER_NO_EIS_FOR_FIELD), - column_name->str); + tab->file->column_bitmaps_signal(); } - tab->file->column_bitmaps_signal(); } - + else + { + DBUG_ASSERT(!lex->column_list); + } + if (!lex->index_list) { tab->keys_in_use_for_query.init(tab->s->keys); @@ -778,11 +790,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, DBUG_PRINT("admin", ("operator_func returned: %d", result_code)); } - if (compl_result_code == HA_ADMIN_OK && - operator_func == &handler::ha_analyze && - table->table->s->table_category == TABLE_CATEGORY_USER && - (get_use_stat_tables_mode(thd) > NEVER || - lex->with_persistent_for_clause)) + if (compl_result_code == HA_ADMIN_OK && collect_eis) { if (!(compl_result_code= alloc_statistics_for_table(thd, table->table)) && -- cgit v1.2.1 From 22ebf3cb456e0d8db295e7cc93f08e3d3ecfea47 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Mar 2016 16:54:38 +0100 Subject: MDEV-9527 build FAILs with GCC 5.1 with release supported "-std=c+11" 10.0 part of the fix --- storage/innobase/fts/fts0fts.cc | 2 +- storage/innobase/include/fts0priv.ic | 4 ++-- storage/mroonga/mrn_table.cpp | 8 ++++---- storage/oqgraph/graphcore.cc | 6 +++--- storage/spider/spd_copy_tables.cc | 20 ++++++++++---------- storage/spider/spd_direct_sql.cc | 20 ++++++++++---------- storage/spider/spd_table.cc | 34 +++++++++++++++++----------------- storage/xtradb/fts/fts0fts.cc | 2 +- storage/xtradb/include/fts0priv.ic | 4 ++-- 9 files changed, 50 insertions(+), 50 deletions(-) diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 4351dc0b765..1c416adade6 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -6274,7 +6274,7 @@ fts_fake_hex_to_dec( #ifdef _WIN32 ret = sscanf(tmp_id, "%016llu", &dec_id); #else - ret = sscanf(tmp_id, "%016"PRIu64, &dec_id); + ret = sscanf(tmp_id, "%016" PRIu64, &dec_id); #endif /* _WIN32 */ ut_ad(ret == 1); diff --git a/storage/innobase/include/fts0priv.ic b/storage/innobase/include/fts0priv.ic index 2d07c60f980..ec61691870b 100644 --- a/storage/innobase/include/fts0priv.ic +++ b/storage/innobase/include/fts0priv.ic @@ -53,7 +53,7 @@ fts_write_object_id( /* Use this to construct old(5.6.14 and 5.7.3) windows ambiguous aux table names */ DBUG_EXECUTE_IF("innodb_test_wrong_windows_fts_aux_table_name", - return(sprintf(str, "%016"PRIu64, id));); + return(sprintf(str, "%016" PRIu64, id));); DBUG_EXECUTE_IF("innodb_test_wrong_fts_aux_table_name", return(sprintf(str, UINT64PFx, id));); @@ -66,7 +66,7 @@ fts_write_object_id( // FIXME: Use ut_snprintf(), so does following one. return(sprintf(str, "%016llu", id)); #else /* _WIN32 */ - return(sprintf(str, "%016"PRIu64, id)); + return(sprintf(str, "%016" PRIu64, id)); #endif /* _WIN32 */ } diff --git a/storage/mroonga/mrn_table.cpp b/storage/mroonga/mrn_table.cpp index ebd3e7e0528..ca5646b3e0b 100644 --- a/storage/mroonga/mrn_table.cpp +++ b/storage/mroonga/mrn_table.cpp @@ -272,7 +272,7 @@ void mrn_get_partition_info(const char *table_name, uint table_name_length, #define MRN_PARAM_STR(title_name, param_name) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info", ("mroonga "title_name" start")); \ + DBUG_PRINT("info", ("mroonga " title_name " start")); \ if (!share->param_name) \ { \ if ((share->param_name = mrn_get_string_between_quote( \ @@ -284,7 +284,7 @@ void mrn_get_partition_info(const char *table_name, uint table_name_length, MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info", ("mroonga "title_name"=%s", share->param_name)); \ + DBUG_PRINT("info", ("mroonga " title_name "=%s", share->param_name)); \ } \ break; \ } @@ -292,7 +292,7 @@ void mrn_get_partition_info(const char *table_name, uint table_name_length, #define MRN_PARAM_STR_LIST(title_name, param_name, param_pos) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info", ("mroonga "title_name" start")); \ + DBUG_PRINT("info", ("mroonga " title_name " start")); \ if (share->param_name && !share->param_name[param_pos]) \ { \ if ((share->param_name[param_pos] = mrn_get_string_between_quote( \ @@ -305,7 +305,7 @@ void mrn_get_partition_info(const char *table_name, uint table_name_length, MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info", ("mroonga "title_name"[%d]=%s", param_pos, \ + DBUG_PRINT("info", ("mroonga " title_name "[%d]=%s", param_pos, \ share->param_name[param_pos])); \ } \ break; \ diff --git a/storage/oqgraph/graphcore.cc b/storage/oqgraph/graphcore.cc index 73433fc8219..4346b94805c 100644 --- a/storage/oqgraph/graphcore.cc +++ b/storage/oqgraph/graphcore.cc @@ -1036,11 +1036,11 @@ int stack_cursor::fetch_row(const row &row_info, row &result, optional w; optional v; result= row_info; - if ((result.seq_indicator= seq= last.sequence())) + if ((result.seq_indicator= static_cast(seq= last.sequence()))) result.seq= *seq; - if ((result.link_indicator= v= last.vertex())) + if ((result.link_indicator= static_cast(v= last.vertex()))) result.link= get(boost::vertex_index, share->g, *v); - if ((result.weight_indicator= w= last.weight())) + if ((result.weight_indicator= static_cast(w= last.weight()))) result.weight= *w; return oqgraph::OK; } diff --git a/storage/spider/spd_copy_tables.cc b/storage/spider/spd_copy_tables.cc index c01549f8e99..7e7845635af 100644 --- a/storage/spider/spd_copy_tables.cc +++ b/storage/spider/spd_copy_tables.cc @@ -81,7 +81,7 @@ int spider_udf_set_copy_tables_param_default( #define SPIDER_PARAM_STR(title_name, param_name) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (!copy_tables->param_name) \ { \ if ((copy_tables->param_name = spider_get_string_between_quote( \ @@ -94,14 +94,14 @@ int spider_udf_set_copy_tables_param_default( MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"=%s", copy_tables->param_name)); \ + DBUG_PRINT("info",("spider " title_name "=%s", copy_tables->param_name)); \ } \ break; \ } #define SPIDER_PARAM_HINT_WITH_MAX(title_name, param_name, check_length, max_size, min_val, max_val) \ if (!strncasecmp(tmp_ptr, title_name, check_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ DBUG_PRINT("info",("spider max_size=%d", max_size)); \ int hint_num = atoi(tmp_ptr + check_length) - 1; \ DBUG_PRINT("info",("spider hint_num=%d", hint_num)); \ @@ -131,7 +131,7 @@ int spider_udf_set_copy_tables_param_default( MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"[%d]=%d", hint_num, \ + DBUG_PRINT("info",("spider " title_name "[%d]=%d", hint_num, \ copy_tables->param_name[hint_num])); \ } else { \ error_num = ER_SPIDER_INVALID_UDF_PARAM_NUM; \ @@ -144,7 +144,7 @@ int spider_udf_set_copy_tables_param_default( #define SPIDER_PARAM_INT_WITH_MAX(title_name, param_name, min_val, max_val) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (copy_tables->param_name == -1) \ { \ if ((tmp_ptr2 = spider_get_string_between_quote( \ @@ -161,14 +161,14 @@ int spider_udf_set_copy_tables_param_default( MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"=%d", copy_tables->param_name)); \ + DBUG_PRINT("info",("spider " title_name "=%d", copy_tables->param_name)); \ } \ break; \ } #define SPIDER_PARAM_INT(title_name, param_name, min_val) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (copy_tables->param_name == -1) \ { \ if ((tmp_ptr2 = spider_get_string_between_quote( \ @@ -183,14 +183,14 @@ int spider_udf_set_copy_tables_param_default( MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"=%d", copy_tables->param_name)); \ + DBUG_PRINT("info",("spider " title_name "=%d", copy_tables->param_name)); \ } \ break; \ } #define SPIDER_PARAM_LONGLONG(title_name, param_name, min_val) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (copy_tables->param_name == -1) \ { \ if ((tmp_ptr2 = spider_get_string_between_quote( \ @@ -206,7 +206,7 @@ int spider_udf_set_copy_tables_param_default( MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"=%lld", \ + DBUG_PRINT("info",("spider " title_name "=%lld", \ copy_tables->param_name)); \ } \ break; \ diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc index 7de31e34e94..c0eb7806bb0 100644 --- a/storage/spider/spd_direct_sql.cc +++ b/storage/spider/spd_direct_sql.cc @@ -896,7 +896,7 @@ error: #define SPIDER_PARAM_STR(title_name, param_name) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (!direct_sql->param_name) \ { \ if ((direct_sql->param_name = spider_get_string_between_quote( \ @@ -909,14 +909,14 @@ error: MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"=%s", direct_sql->param_name)); \ + DBUG_PRINT("info",("spider " title_name "=%s", direct_sql->param_name)); \ } \ break; \ } #define SPIDER_PARAM_HINT_WITH_MAX(title_name, param_name, check_length, max_size, min_val, max_val) \ if (!strncasecmp(tmp_ptr, title_name, check_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ DBUG_PRINT("info",("spider max_size=%d", max_size)); \ int hint_num = atoi(tmp_ptr + check_length) - 1; \ DBUG_PRINT("info",("spider hint_num=%d", hint_num)); \ @@ -946,7 +946,7 @@ error: MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"[%d]=%d", hint_num, \ + DBUG_PRINT("info",("spider " title_name "[%d]=%d", hint_num, \ direct_sql->param_name[hint_num])); \ } else { \ error_num = ER_SPIDER_INVALID_CONNECT_INFO_NUM; \ @@ -959,7 +959,7 @@ error: #define SPIDER_PARAM_INT_WITH_MAX(title_name, param_name, min_val, max_val) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (direct_sql->param_name == -1) \ { \ if ((tmp_ptr2 = spider_get_string_between_quote( \ @@ -976,7 +976,7 @@ error: MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"=%d", \ + DBUG_PRINT("info",("spider " title_name "=%d", \ (int) direct_sql->param_name)); \ } \ break; \ @@ -984,7 +984,7 @@ error: #define SPIDER_PARAM_INT(title_name, param_name, min_val) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (direct_sql->param_name == -1) \ { \ if ((tmp_ptr2 = spider_get_string_between_quote( \ @@ -999,14 +999,14 @@ error: MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"=%d", direct_sql->param_name)); \ + DBUG_PRINT("info",("spider " title_name "=%d", direct_sql->param_name)); \ } \ break; \ } #define SPIDER_PARAM_LONGLONG(title_name, param_name, min_val) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (direct_sql->param_name == -1) \ { \ if ((tmp_ptr2 = spider_get_string_between_quote( \ @@ -1022,7 +1022,7 @@ error: MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"=%lld", \ + DBUG_PRINT("info",("spider " title_name "=%lld", \ direct_sql->param_name)); \ } \ break; \ diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index a20598969ee..07572fa7973 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -1500,7 +1500,7 @@ static int spider_set_ll_value( #define SPIDER_PARAM_STR(title_name, param_name) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (!share->param_name) \ { \ if ((share->param_name = spider_get_string_between_quote( \ @@ -1512,7 +1512,7 @@ static int spider_set_ll_value( MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"=%s", share->param_name)); \ + DBUG_PRINT("info",("spider " title_name "=%s", share->param_name)); \ } \ break; \ } @@ -1521,7 +1521,7 @@ static int spider_set_ll_value( #define SPIDER_PARAM_STR_LIST(title_name, param_name) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (!share->param_name) \ { \ if ((tmp_ptr2 = spider_get_string_between_quote( \ @@ -1547,7 +1547,7 @@ static int spider_set_ll_value( #define SPIDER_PARAM_HINT(title_name, param_name, check_length, max_size, append_method) \ if (!strncasecmp(tmp_ptr, title_name, check_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ DBUG_PRINT("info",("spider max_size=%d", max_size)); \ int hint_num = atoi(tmp_ptr + check_length); \ DBUG_PRINT("info",("spider hint_num=%d", hint_num)); \ @@ -1566,7 +1566,7 @@ static int spider_set_ll_value( if ((error_num = \ append_method(&share->param_name[hint_num], hint_str))) \ goto error; \ - DBUG_PRINT("info",("spider "title_name"[%d]=%s", hint_num, \ + DBUG_PRINT("info",("spider " title_name "[%d]=%s", hint_num, \ share->param_name[hint_num].ptr())); \ } else { \ error_num = ER_SPIDER_INVALID_CONNECT_INFO_NUM; \ @@ -1579,7 +1579,7 @@ static int spider_set_ll_value( #define SPIDER_PARAM_NUMHINT(title_name, param_name, check_length, max_size, append_method) \ if (!strncasecmp(tmp_ptr, title_name, check_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ DBUG_PRINT("info",("spider max_size=%d", max_size)); \ int hint_num = atoi(tmp_ptr + check_length); \ DBUG_PRINT("info",("spider hint_num=%d", hint_num)); \ @@ -1598,7 +1598,7 @@ static int spider_set_ll_value( if ((error_num = \ append_method(&share->param_name[hint_num], hint_str))) \ goto error; \ - DBUG_PRINT("info",("spider "title_name"[%d]=%lld", hint_num, \ + DBUG_PRINT("info",("spider " title_name "[%d]=%lld", hint_num, \ share->param_name[hint_num])); \ } else { \ error_num = ER_SPIDER_INVALID_CONNECT_INFO_NUM; \ @@ -1613,7 +1613,7 @@ static int spider_set_ll_value( min_val, max_val) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (!share->param_name) \ { \ if ((tmp_ptr2 = spider_get_string_between_quote( \ @@ -1640,7 +1640,7 @@ static int spider_set_ll_value( min_val, max_val) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (!share->param_name) \ { \ if ((tmp_ptr2 = spider_get_string_between_quote( \ @@ -1665,7 +1665,7 @@ static int spider_set_ll_value( #define SPIDER_PARAM_INT_WITH_MAX(title_name, param_name, min_val, max_val) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (share->param_name == -1) \ { \ if ((tmp_ptr2 = spider_get_string_between_quote( \ @@ -1682,14 +1682,14 @@ static int spider_set_ll_value( MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"=%d", share->param_name)); \ + DBUG_PRINT("info",("spider " title_name "=%d", share->param_name)); \ } \ break; \ } #define SPIDER_PARAM_INT(title_name, param_name, min_val) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (share->param_name == -1) \ { \ if ((tmp_ptr2 = spider_get_string_between_quote( \ @@ -1704,14 +1704,14 @@ static int spider_set_ll_value( MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"=%d", share->param_name)); \ + DBUG_PRINT("info",("spider " title_name "=%d", share->param_name)); \ } \ break; \ } #define SPIDER_PARAM_DOUBLE(title_name, param_name, min_val) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (share->param_name == -1) \ { \ if ((tmp_ptr2 = spider_get_string_between_quote( \ @@ -1726,14 +1726,14 @@ static int spider_set_ll_value( MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"=%f", share->param_name)); \ + DBUG_PRINT("info",("spider " title_name "=%f", share->param_name)); \ } \ break; \ } #define SPIDER_PARAM_LONGLONG(title_name, param_name, min_val) \ if (!strncasecmp(tmp_ptr, title_name, title_length)) \ { \ - DBUG_PRINT("info",("spider "title_name" start")); \ + DBUG_PRINT("info",("spider " title_name " start")); \ if (share->param_name == -1) \ { \ if ((tmp_ptr2 = spider_get_string_between_quote( \ @@ -1748,7 +1748,7 @@ static int spider_set_ll_value( MYF(0), tmp_ptr); \ goto error; \ } \ - DBUG_PRINT("info",("spider "title_name"=%lld", share->param_name)); \ + DBUG_PRINT("info",("spider " title_name "=%lld", share->param_name)); \ } \ break; \ } diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc index 5adda1fad6c..267d95a71ed 100644 --- a/storage/xtradb/fts/fts0fts.cc +++ b/storage/xtradb/fts/fts0fts.cc @@ -6274,7 +6274,7 @@ fts_fake_hex_to_dec( #ifdef _WIN32 ret = sscanf(tmp_id, "%016llu", &dec_id); #else - ret = sscanf(tmp_id, "%016"PRIu64, &dec_id); + ret = sscanf(tmp_id, "%016" PRIu64, &dec_id); #endif /* _WIN32 */ ut_ad(ret == 1); diff --git a/storage/xtradb/include/fts0priv.ic b/storage/xtradb/include/fts0priv.ic index 2d07c60f980..ec61691870b 100644 --- a/storage/xtradb/include/fts0priv.ic +++ b/storage/xtradb/include/fts0priv.ic @@ -53,7 +53,7 @@ fts_write_object_id( /* Use this to construct old(5.6.14 and 5.7.3) windows ambiguous aux table names */ DBUG_EXECUTE_IF("innodb_test_wrong_windows_fts_aux_table_name", - return(sprintf(str, "%016"PRIu64, id));); + return(sprintf(str, "%016" PRIu64, id));); DBUG_EXECUTE_IF("innodb_test_wrong_fts_aux_table_name", return(sprintf(str, UINT64PFx, id));); @@ -66,7 +66,7 @@ fts_write_object_id( // FIXME: Use ut_snprintf(), so does following one. return(sprintf(str, "%016llu", id)); #else /* _WIN32 */ - return(sprintf(str, "%016"PRIu64, id)); + return(sprintf(str, "%016" PRIu64, id)); #endif /* _WIN32 */ } -- cgit v1.2.1 From e984159e39c7338565a7d927084b78008e95972e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 18 Mar 2016 16:54:05 +0100 Subject: MDEV-9527 build FAILs with GCC 5.1 with release supported "-std=c+11" 10.1 part of the fix --- sql/wsrep_sst.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 43528e642eb..08a7e3aec2c 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -875,7 +875,7 @@ static int sst_donate_mysqldump (const char* addr, host, port, mysqld_port, mysqld_unix_port, wsrep_defaults_file, uuid_str, (long long)seqno, wsrep_gtid_domain_id, - bypass ? " "WSREP_SST_OPT_BYPASS : ""); + bypass ? " " WSREP_SST_OPT_BYPASS : ""); if (ret < 0 || ret >= cmd_len) { @@ -1220,7 +1220,7 @@ static int sst_donate_other (const char* method, wsrep_defaults_file, binlog_opt, binlog_opt_val, uuid, (long long) seqno, wsrep_gtid_domain_id, - bypass ? " "WSREP_SST_OPT_BYPASS : ""); + bypass ? " " WSREP_SST_OPT_BYPASS : ""); my_free(binlog_opt_val); if (ret < 0 || ret >= cmd_len) -- cgit v1.2.1 From 537fc572d451888d26c26d3e89c3237d1213be4d Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 22 Mar 2016 00:09:04 +0400 Subject: MDEV-9516 type error when setting session variable Allowing assigning of DECIMAL(N,0) values to INT-alike system variables. --- .../sys_vars/r/innodb_thread_sleep_delay_basic.result | 4 +++- mysql-test/suite/sys_vars/r/wait_timeout_basic.result | 12 ++++++++++++ .../suite/sys_vars/t/innodb_thread_sleep_delay_basic.test | 2 +- mysql-test/suite/sys_vars/t/wait_timeout_basic.test | 14 ++++++++++++++ sql/set_var.cc | 2 +- sql/set_var.h | 6 ++++-- 6 files changed, 35 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/innodb_thread_sleep_delay_basic.result b/mysql-test/suite/sys_vars/r/innodb_thread_sleep_delay_basic.result index 0335db8e859..ebb99559255 100644 --- a/mysql-test/suite/sys_vars/r/innodb_thread_sleep_delay_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_thread_sleep_delay_basic.result @@ -42,7 +42,9 @@ ERROR 42000: Incorrect argument type to variable 'innodb_thread_sleep_delay' set global innodb_thread_sleep_delay="foo"; ERROR 42000: Incorrect argument type to variable 'innodb_thread_sleep_delay' set global innodb_thread_sleep_delay=18446744073709551616; -ERROR 42000: Incorrect argument type to variable 'innodb_thread_sleep_delay' +Warnings: +Warning 1916 Got overflow when converting '18446744073709551616' to INT. Value truncated. +Warning 1292 Truncated incorrect innodb_thread_sleep_delay value: '9223372036854775807' set global innodb_thread_sleep_delay=-7; Warnings: Warning 1292 Truncated incorrect innodb_thread_sleep_delay value: '-7' diff --git a/mysql-test/suite/sys_vars/r/wait_timeout_basic.result b/mysql-test/suite/sys_vars/r/wait_timeout_basic.result index 6dc99dcd5e3..d0e5188b508 100644 --- a/mysql-test/suite/sys_vars/r/wait_timeout_basic.result +++ b/mysql-test/suite/sys_vars/r/wait_timeout_basic.result @@ -124,5 +124,17 @@ SELECT session.wait_timeout; ERROR 42S02: Unknown table 'session' in field list SELECT wait_timeout = @@session.wait_timeout; ERROR 42S22: Unknown column 'wait_timeout' in 'field list' +# +# MDEV-9516 type error when setting session variable +# +SET SESSION wait_timeout= 28000; +SET SESSION wait_timeout= GREATEST(28000, @@wait_timeout); +SET SESSION wait_timeout= COALESCE(28000, @@wait_timeout); +SET SESSION wait_timeout= IFNULL(28000, @@wait_timeout); +SET SESSION wait_timeout= CASE WHEN TRUE THEN 28000 ELSE @@wait_timeout END; +SET SESSION wait_timeout= 28000.0; +ERROR 42000: Incorrect argument type to variable 'wait_timeout' +SET SESSION wait_timeout= 28000.1; +ERROR 42000: Incorrect argument type to variable 'wait_timeout' SET @@global.wait_timeout = @start_global_value; SET @@session.wait_timeout = @start_session_value; diff --git a/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test b/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test index 85ae2358db5..bc4efdd1d6f 100644 --- a/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_thread_sleep_delay_basic.test @@ -39,7 +39,7 @@ set global innodb_thread_sleep_delay=1.1; set global innodb_thread_sleep_delay=1e1; --error ER_WRONG_TYPE_FOR_VAR set global innodb_thread_sleep_delay="foo"; ---error ER_WRONG_TYPE_FOR_VAR + set global innodb_thread_sleep_delay=18446744073709551616; set global innodb_thread_sleep_delay=-7; diff --git a/mysql-test/suite/sys_vars/t/wait_timeout_basic.test b/mysql-test/suite/sys_vars/t/wait_timeout_basic.test index e92a3294b86..598f6cb44fd 100644 --- a/mysql-test/suite/sys_vars/t/wait_timeout_basic.test +++ b/mysql-test/suite/sys_vars/t/wait_timeout_basic.test @@ -203,6 +203,20 @@ SELECT session.wait_timeout; --Error ER_BAD_FIELD_ERROR SELECT wait_timeout = @@session.wait_timeout; +--echo # +--echo # MDEV-9516 type error when setting session variable +--echo # + +SET SESSION wait_timeout= 28000; +SET SESSION wait_timeout= GREATEST(28000, @@wait_timeout); +SET SESSION wait_timeout= COALESCE(28000, @@wait_timeout); +SET SESSION wait_timeout= IFNULL(28000, @@wait_timeout); +SET SESSION wait_timeout= CASE WHEN TRUE THEN 28000 ELSE @@wait_timeout END; + +--error ER_WRONG_TYPE_FOR_VAR +SET SESSION wait_timeout= 28000.0; +--error ER_WRONG_TYPE_FOR_VAR +SET SESSION wait_timeout= 28000.1; #################################### # Restore initial value # diff --git a/sql/set_var.cc b/sql/set_var.cc index 18f6cbc41fd..b5430c56865 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -739,7 +739,7 @@ int set_var::check(THD *thd) if ((!value->fixed && value->fix_fields(thd, &value)) || value->check_cols(1)) return -1; - if (var->check_update_type(value->result_type())) + if (var->check_update_type(value)) { my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), var->name.str); return -1; diff --git a/sql/set_var.h b/sql/set_var.h index b8192e67ca9..cf86ecf18fa 100644 --- a/sql/set_var.h +++ b/sql/set_var.h @@ -137,8 +137,9 @@ public: bool is_set_stmt_ok() const { return !(flags & NO_SET_STATEMENT); } bool is_written_to_binlog(enum_var_type type) { return type != OPT_GLOBAL && binlog_status == SESSION_VARIABLE_IN_BINLOG; } - bool check_update_type(Item_result type) + bool check_update_type(const Item *item) { + Item_result type= item->result_type(); switch (option.var_type & GET_TYPE_MASK) { case GET_INT: case GET_UINT: @@ -146,7 +147,8 @@ public: case GET_ULONG: case GET_LL: case GET_ULL: - return type != INT_RESULT; + return type != INT_RESULT && + (type != DECIMAL_RESULT || item->decimals != 0); case GET_STR: case GET_STR_ALLOC: return type != STRING_RESULT; -- cgit v1.2.1 From 000f76d886b15454140c886b99ced0a0a3743941 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Wed, 2 Mar 2016 09:19:36 -0500 Subject: Fix galera_sync_wait_show test. --- mysql-test/suite/galera/r/galera_sync_wait_show.result | 8 ++++---- mysql-test/suite/galera/t/galera_sync_wait_show.test | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_sync_wait_show.result b/mysql-test/suite/galera/r/galera_sync_wait_show.result index c719aaab5d8..2f030c26bb8 100644 --- a/mysql-test/suite/galera/r/galera_sync_wait_show.result +++ b/mysql-test/suite/galera/r/galera_sync_wait_show.result @@ -7,7 +7,7 @@ DROP DATABASE db1; CREATE PROCEDURE p1 () SELECT 1 FROM DUAL; SHOW CREATE PROCEDURE p1; Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation -p1 CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() +p1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`() SELECT 1 FROM DUAL latin1 latin1_swedish_ci latin1_swedish_ci DROP PROCEDURE p1; CREATE PROCEDURE p1 () SELECT 1 FROM DUAL; @@ -18,7 +18,7 @@ DROP PROCEDURE p1; CREATE FUNCTION f1 () RETURNS INTEGER RETURN 123; SHOW CREATE FUNCTION f1; Function sql_mode Create Function character_set_client collation_connection Database Collation -f1 CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) +f1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` FUNCTION `f1`() RETURNS int(11) RETURN 123 latin1 latin1_swedish_ci latin1_swedish_ci DROP FUNCTION f1; CREATE FUNCTION f1 () RETURNS INTEGER RETURN 123; @@ -30,10 +30,10 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f1 = 'a'; SHOW CREATE TRIGGER tr1; Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation -tr1 CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f1 = 'a' latin1 latin1_swedish_ci latin1_swedish_ci +tr1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f1 = 'a' latin1 latin1_swedish_ci latin1_swedish_ci DROP TABLE t1; CREATE EVENT event1 ON SCHEDULE AT '2038-01-01 23:59:59' DO SELECT 1; SHOW CREATE EVENT event1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation -event1 SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `event1` ON SCHEDULE AT '2038-01-01 23:59:59' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci +event1 NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION SYSTEM CREATE DEFINER=`root`@`localhost` EVENT `event1` ON SCHEDULE AT '2038-01-01 23:59:59' ON COMPLETION NOT PRESERVE DISABLE ON SLAVE DO SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci DROP EVENT event1; diff --git a/mysql-test/suite/galera/t/galera_sync_wait_show.test b/mysql-test/suite/galera/t/galera_sync_wait_show.test index 0d0207a2ebe..250b1f76e98 100644 --- a/mysql-test/suite/galera/t/galera_sync_wait_show.test +++ b/mysql-test/suite/galera/t/galera_sync_wait_show.test @@ -4,6 +4,7 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_debug.inc --connection node_2 SET SESSION wsrep_sync_wait = 1; -- cgit v1.2.1 From d31d6d31bb121150a99d95d2af0cab17396fbfc6 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Wed, 16 Mar 2016 16:44:43 -0400 Subject: MDEV-9696: CREATE SERVER statement does not replicate in Galera Cluster Enable replication of CREATE/ALTER/DROP SERVER statements in Galera cluster. --- mysql-test/suite/galera/r/galera_server.result | 20 ++++++++++++++++++ mysql-test/suite/galera/t/galera_server.test | 28 ++++++++++++++++++++++++++ sql/sql_parse.cc | 6 ++++++ 3 files changed, 54 insertions(+) create mode 100644 mysql-test/suite/galera/r/galera_server.result create mode 100644 mysql-test/suite/galera/t/galera_server.test diff --git a/mysql-test/suite/galera/r/galera_server.result b/mysql-test/suite/galera/r/galera_server.result new file mode 100644 index 00000000000..ef81bf376b0 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_server.result @@ -0,0 +1,20 @@ +# On node_1 +CREATE SERVER s1 +FOREIGN DATA WRAPPER mysql +OPTIONS (HOST 'foo'); +# On node_2 +SELECT * FROM mysql.servers; +Server_name Host Db Username Password Port Socket Wrapper Owner +s1 foo 3306 mysql +ALTER SERVER s1 +OPTIONS (HOST 'bar'); +# On node_1 +SELECT * FROM mysql.servers; +Server_name Host Db Username Password Port Socket Wrapper Owner +s1 bar 3306 mysql +DROP SERVER s1; +# On node_2 +SELECT COUNT(*)=0 FROM mysql.servers; +COUNT(*)=0 +1 +# End of test diff --git a/mysql-test/suite/galera/t/galera_server.test b/mysql-test/suite/galera/t/galera_server.test new file mode 100644 index 00000000000..30b39028b96 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_server.test @@ -0,0 +1,28 @@ +# Test for CREATE/ALTER/DROP SERVER in Galera cluster + +--source include/galera_cluster.inc + +--connection node_1 +--echo # On node_1 +CREATE SERVER s1 + FOREIGN DATA WRAPPER mysql + OPTIONS (HOST 'foo'); + +--connection node_2 +--echo # On node_2 +SELECT * FROM mysql.servers; +ALTER SERVER s1 + OPTIONS (HOST 'bar'); + +--connection node_1 +--echo # On node_1 +SELECT * FROM mysql.servers; +DROP SERVER s1; + +--connection node_2 +--echo # On node_2 +SELECT COUNT(*)=0 FROM mysql.servers; + +--source include/galera_end.inc +--echo # End of test + diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 177e61a4c98..176b2e9768d 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5649,6 +5649,8 @@ create_sp_error: if (check_global_access(thd, SUPER_ACL)) break; + WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + res= create_server(thd, &lex->server_options); break; } @@ -5660,6 +5662,8 @@ create_sp_error: if (check_global_access(thd, SUPER_ACL)) break; + WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + if ((error= alter_server(thd, &lex->server_options))) { DBUG_PRINT("info", ("problem altering server <%s>", @@ -5678,6 +5682,8 @@ create_sp_error: if (check_global_access(thd, SUPER_ACL)) break; + WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) + if ((err_code= drop_server(thd, &lex->server_options))) { if (! lex->if_exists() && err_code == ER_FOREIGN_SERVER_DOESNT_EXIST) -- cgit v1.2.1 From df3ad1109765a4e207dede13769e993ab34903c5 Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Wed, 16 Mar 2016 16:48:24 -0400 Subject: MDEV-9598: Donor's rsync SST script hangs if FTWRL fails Post-fix: initialize err --- sql/wsrep_sst.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 43528e642eb..c31873656a8 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -976,7 +976,7 @@ static int sst_flush_tables(THD* thd) { WSREP_INFO("Flushing tables for SST..."); - int err; + int err= 0; int not_used; /* Files created to notify the SST script about the outcome of table flush -- cgit v1.2.1 From 52ce743bbf0264808d422c09638e13f2042fbf7e Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Wed, 16 Mar 2016 19:39:19 -0400 Subject: MDEV-9382: After updating mariadb server apt-configure fails When acting as a Galera receiver node, server startup may take more than 30 secs (the current default) as it has to wait for SST/IST operation to complete besides spending some time doing wsrep recovery. Fixed by raising the default value of MYSQLD_STARTUP_TIMEOUT to 60 secs. Also sourced /etc/default/mariadb into the init script so that it can be used to set MYSQLD_STARTUP_TIMEOUT. --- debian/mariadb-server-10.1.mysql.init | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/mariadb-server-10.1.mysql.init b/debian/mariadb-server-10.1.mysql.init index 9e098b4d87c..91d07e8de3e 100644 --- a/debian/mariadb-server-10.1.mysql.init +++ b/debian/mariadb-server-10.1.mysql.init @@ -37,6 +37,9 @@ umask 077 # so break my scripts. export HOME=/etc/mysql/ +# Source default config file. +[ -r /etc/default/mariadb ] && . /etc/default/mariadb + ## Fetch a particular option from mysql's invocation. # # Usage: void mysqld_get_param option @@ -109,7 +112,7 @@ case "${1:-''}" in /usr/bin/mysqld_safe "${@:2}" > /dev/null 2>&1 & # 6s was reported in #352070 to be too little - for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-30}"); do + for i in $(seq 1 "${MYSQLD_STARTUP_TIMEOUT:-60}"); do sleep 1 if mysqld_status check_alive nowarn ; then break; fi log_progress_msg "." -- cgit v1.2.1 From e0c136b4f0481b5b5a87567e66da75308cbf7bda Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 22 Mar 2016 10:53:28 +0100 Subject: MDEV-9737 Duplicate error in replication with slave triggers and auto increment delete deferred events after they're executed (otherwise they can be executed again for a sub-statement) See also commit 0e78d1d Author: Venkatesh Duggirala Date: Wed Mar 20 11:20:47 2013 +0530 BUG#15850951-DUPLICATE ERROR IN REPLICATION WITH SLAVE TRIGGERS AND AUTO INCREMENT --- .../suite/rpl/r/ignore_table_autoinc-9737.result | 19 ++++++++++++ .../suite/rpl/t/ignore_table_autoinc-9737.test | 35 ++++++++++++++++++++++ sql/log_event.cc | 1 + 3 files changed, 55 insertions(+) create mode 100644 mysql-test/suite/rpl/r/ignore_table_autoinc-9737.result create mode 100644 mysql-test/suite/rpl/t/ignore_table_autoinc-9737.test diff --git a/mysql-test/suite/rpl/r/ignore_table_autoinc-9737.result b/mysql-test/suite/rpl/r/ignore_table_autoinc-9737.result new file mode 100644 index 00000000000..b036bde349a --- /dev/null +++ b/mysql-test/suite/rpl/r/ignore_table_autoinc-9737.result @@ -0,0 +1,19 @@ +include/master-slave.inc +[connection master] +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); +create table t1(id int auto_increment primary key); +create table t2(id int auto_increment primary key); +create table slave_only(id int auto_increment primary key); +insert into slave_only values(NULL); +create trigger t1i after insert on t1 for each row insert into slave_only values(NULL); +stop slave; +set global replicate_ignore_table="test.t2"; +start slave; +insert into t2 values(NULL); +insert into t1 values(NULL); +drop table t1, t2, slave_only; +stop slave; +set global replicate_ignore_table=""; +start slave; +drop table t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/ignore_table_autoinc-9737.test b/mysql-test/suite/rpl/t/ignore_table_autoinc-9737.test new file mode 100644 index 00000000000..405d1a929f1 --- /dev/null +++ b/mysql-test/suite/rpl/t/ignore_table_autoinc-9737.test @@ -0,0 +1,35 @@ +# +# MDEV-9737 Duplicate error in replication with slave triggers and auto increment +# +source include/master-slave.inc; +call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); + + +create table t1(id int auto_increment primary key); +create table t2(id int auto_increment primary key); + +sync_slave_with_master; +create table slave_only(id int auto_increment primary key); +insert into slave_only values(NULL); +create trigger t1i after insert on t1 for each row insert into slave_only values(NULL); + +stop slave; +set global replicate_ignore_table="test.t2"; +start slave; + +connection master; +insert into t2 values(NULL); +insert into t1 values(NULL); + +sync_slave_with_master; + +drop table t1, t2, slave_only; +stop slave; +set global replicate_ignore_table=""; +start slave; + +connection master; +drop table t1, t2; + +source include/rpl_end.inc; + diff --git a/sql/log_event.cc b/sql/log_event.cc index b4be9c740d2..98165cc4797 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -7463,6 +7463,7 @@ bool slave_execute_deferred_events(THD *thd) return res; res= rgi->deferred_events->execute(rgi); + rgi->deferred_events->rewind(); return res; } -- cgit v1.2.1 From f71c45c71db8c7862fc50b8382ccdbff4772e258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 22 Mar 2016 17:55:23 +0200 Subject: MDEV-9678: Data Directory bug Problem was that link file (.isl) is also opened using O_DIRECT mode and if this fails the whole create table fails on internal error. Fixed by not using O_DIRECT on link files as they are used only on create table and startup and do not contain real data. O_DIRECT failures are successfully ignored for data files if O_DIRECT is not supported by file system on used data directory. --- storage/innobase/fil/fil0fil.cc | 8 +++-- storage/innobase/include/os0file.h | 7 +++-- storage/innobase/os/os0file.cc | 62 ++++++++++++++++++++++++++------------ storage/innobase/row/row0merge.cc | 2 +- storage/xtradb/fil/fil0fil.cc | 5 ++- storage/xtradb/os/os0file.cc | 20 +++++++----- 6 files changed, 69 insertions(+), 35 deletions(-) diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 928c72cf546..d918b21d779 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2015, Oracle and/or its affiliates. -Copyright (c) 2013, 2015, MariaDB Corporation. +Copyright (c) 2013, 2016, 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 @@ -3207,10 +3207,12 @@ fil_create_link_file( } link_filepath = fil_make_isl_name(tablename); - + /* Note that OS_FILE_READ_WRITE_CACHED used here to avoid + unnecessary errors on O_DIRECT, link files are not really + a data files. */ file = os_file_create_simple_no_error_handling( innodb_file_data_key, link_filepath, - OS_FILE_CREATE, OS_FILE_READ_WRITE, &success, 0); + OS_FILE_CREATE, OS_FILE_READ_WRITE_CACHED, &success, 0); if (!success) { /* The following call will print an error message */ diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index c610e1790eb..dff5ebd524c 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -128,7 +128,10 @@ enum os_file_create_t { #define OS_FILE_READ_ONLY 333 #define OS_FILE_READ_WRITE 444 #define OS_FILE_READ_ALLOW_DELETE 555 /* for mysqlbackup */ - +#define OS_FILE_READ_WRITE_CACHED 666 /* OS_FILE_READ_WRITE but never + O_DIRECT. Only for + os_file_create_simple_no_error_handling + currently. */ /* Options for file_create */ #define OS_FILE_AIO 61 #define OS_FILE_NORMAL 62 @@ -542,7 +545,7 @@ UNIV_INTERN void os_file_set_nocache( /*================*/ - int fd, /*!< in: file descriptor to alter */ + os_file_t fd, /*!< in: file descriptor to alter */ const char* file_name, /*!< in: file name, used in the diagnostic message */ const char* operation_name);/*!< in: "open" or "create"; used in the diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index dd6b066c647..965a978b962 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2015, MariaDB Corporation. +Copyright (c) 2013, 2016, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Percona Inc.. Those modifications are @@ -1350,7 +1350,8 @@ os_file_create_simple_func( access = GENERIC_READ; - } else if (access_type == OS_FILE_READ_WRITE) { + } else if (access_type == OS_FILE_READ_WRITE + || access_type == OS_FILE_READ_WRITE_CACHED) { access = GENERIC_READ | GENERIC_WRITE; } else { ib_logf(IB_LOG_LEVEL_ERROR, @@ -1454,7 +1455,8 @@ os_file_create_simple_func( #ifdef USE_FILE_LOCK if (!srv_read_only_mode && *success - && access_type == OS_FILE_READ_WRITE + && (access_type == OS_FILE_READ_WRITE + || access_type == OS_FILE_READ_WRITE_CACHED) && os_file_lock(file, name)) { *success = FALSE; @@ -1468,6 +1470,31 @@ os_file_create_simple_func( return(file); } +/** Disable OS I/O caching on the file if the file type and server +configuration requires it. +@param file handle to the file +@param name name of the file, for diagnostics +@param mode_str operation on the file, for diagnostics +@param type OS_LOG_FILE or OS_DATA_FILE +@param access_type if OS_FILE_READ_WRITE_CACHED, then caching will be disabled +unconditionally, ignored otherwise */ +static +void +os_file_set_nocache_if_needed(os_file_t file, const char* name, + const char *mode_str, ulint type, + ulint access_type) +{ + if (srv_read_only_mode || access_type == OS_FILE_READ_WRITE_CACHED) { + return; + } + + if (type == OS_DATA_FILE + && (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT + || (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC))) { + os_file_set_nocache(file, name, mode_str); + } +} + /****************************************************************//** NOTE! Use the corresponding macro os_file_create_simple_no_error_handling(), not directly this function! @@ -1523,7 +1550,8 @@ os_file_create_simple_no_error_handling_func( access = GENERIC_READ; } else if (srv_read_only_mode) { access = GENERIC_READ; - } else if (access_type == OS_FILE_READ_WRITE) { + } else if (access_type == OS_FILE_READ_WRITE + || access_type == OS_FILE_READ_WRITE_CACHED) { access = GENERIC_READ | GENERIC_WRITE; } else if (access_type == OS_FILE_READ_ALLOW_DELETE) { @@ -1595,7 +1623,8 @@ os_file_create_simple_no_error_handling_func( } else { ut_a(access_type == OS_FILE_READ_WRITE - || access_type == OS_FILE_READ_ALLOW_DELETE); + || access_type == OS_FILE_READ_ALLOW_DELETE + || access_type == OS_FILE_READ_WRITE_CACHED); create_flag = O_RDWR; } @@ -1627,18 +1656,16 @@ os_file_create_simple_no_error_handling_func( /* This function is always called for data files, we should disable OS caching (O_DIRECT) here as we do in os_file_create_func(), so we open the same file in the same mode, see man page of open(2). */ - if (!srv_read_only_mode - && *success - && (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT - || srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)) { - - os_file_set_nocache(file, name, mode_str); + if (*success) { + os_file_set_nocache_if_needed(file, name, mode_str, + OS_DATA_FILE, access_type); } #ifdef USE_FILE_LOCK if (!srv_read_only_mode && *success - && access_type == OS_FILE_READ_WRITE + && (access_type == OS_FILE_READ_WRITE + || access_type == OS_FILE_READ_WRITE_CACHED) && os_file_lock(file, name)) { *success = FALSE; @@ -1677,7 +1704,7 @@ UNIV_INTERN void os_file_set_nocache( /*================*/ - int fd /*!< in: file descriptor to alter */ + os_file_t fd /*!< in: file descriptor to alter */ __attribute__((unused)), const char* file_name /*!< in: used in the diagnostic message */ @@ -2007,13 +2034,8 @@ os_file_create_func( /* We disable OS caching (O_DIRECT) only on data files */ - if (!srv_read_only_mode - && *success - && type != OS_LOG_FILE - && (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT - || srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)) { - - os_file_set_nocache(file, name, mode_str); + if (*success) { + os_file_set_nocache_if_needed(file, name, mode_str, type, 0); } #ifdef USE_FILE_LOCK diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 94cf20b79f6..294facf9723 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -3454,7 +3454,7 @@ row_merge_file_create( if (merge_file->fd >= 0) { if (srv_disable_sort_file_cache) { - os_file_set_nocache(merge_file->fd, + os_file_set_nocache((os_file_t)merge_file->fd, "row0merge.cc", "sort"); } } diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index 5f0c52b5cc8..b60a0e9ddaf 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -3240,9 +3240,12 @@ fil_create_link_file( link_filepath = fil_make_isl_name(tablename); + /* Note that OS_FILE_READ_WRITE_CACHED used here to avoid + unnecessary errors on O_DIRECT, link files are not really + a data files. */ file = os_file_create_simple_no_error_handling( innodb_file_data_key, link_filepath, - OS_FILE_CREATE, OS_FILE_READ_WRITE, &success, 0); + OS_FILE_CREATE, OS_FILE_READ_WRITE_CACHED, &success, 0); if (!success) { /* The following call will print an error message */ diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc index 7f13c1656ee..a8533f1bb9e 100644 --- a/storage/xtradb/os/os0file.cc +++ b/storage/xtradb/os/os0file.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2015, MariaDB Corporation. +Copyright (c) 2013, 2016, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Percona Inc.. Those modifications are @@ -1422,7 +1422,8 @@ os_file_create_simple_func( access = GENERIC_READ; - } else if (access_type == OS_FILE_READ_WRITE) { + } else if (access_type == OS_FILE_READ_WRITE + || access_type == OS_FILE_READ_WRITE_CACHED) { access = GENERIC_READ | GENERIC_WRITE; } else { ib_logf(IB_LOG_LEVEL_ERROR, @@ -1526,7 +1527,8 @@ os_file_create_simple_func( #ifdef USE_FILE_LOCK if (!srv_read_only_mode && *success - && access_type == OS_FILE_READ_WRITE + && (access_type == OS_FILE_READ_WRITE + || access_type == OS_FILE_READ_WRITE_CACHED) && os_file_lock(file, name)) { *success = FALSE; @@ -1554,15 +1556,16 @@ os_file_set_nocache_if_needed(os_file_t file, const char* name, const char *mode_str, ulint type, ulint access_type) { - if (srv_read_only_mode || access_type == OS_FILE_READ_WRITE_CACHED) + if (srv_read_only_mode || access_type == OS_FILE_READ_WRITE_CACHED) { return; + } if (srv_unix_file_flush_method == SRV_UNIX_ALL_O_DIRECT - || (type != OS_LOG_FILE + || (type == OS_LOG_FILE && (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT - || (srv_unix_file_flush_method - == SRV_UNIX_O_DIRECT_NO_FSYNC)))) + || (srv_unix_file_flush_method == SRV_UNIX_O_DIRECT_NO_FSYNC)))) { os_file_set_nocache(file, name, mode_str); + } } /****************************************************************//** @@ -2154,8 +2157,9 @@ os_file_create_func( } while (retry); - if (*success) { + /* We disable OS caching (O_DIRECT) only on data files */ + if (*success) { os_file_set_nocache_if_needed(file, name, mode_str, type, 0); } -- cgit v1.2.1 From 0a4a78ae8cd6844c34f9ed391dfb0eb71244f229 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Tue, 22 Mar 2016 23:26:39 +0400 Subject: MDEV-6058 MySQL Bug #11766693: LOG-SLOW-ADMIN-STATEMENTS AND LOG-SLOW-SLAVE-STATEMENTS NOT DISPLAYED. These parameters were moved from the command line options to the system variables section. Treatment of the opt_log_slow_slave_statements changed to let the dynamic change of the variable. --- mysql-test/r/log_slow.result | 2 + mysql-test/suite/rpl/r/rpl_slow_query_log.result | 15 ++++++ mysql-test/suite/rpl/t/rpl_slow_query_log.test | 33 ++++++++++++ .../r/log_slow_admin_statements_func.result | 46 ++++++++++++++++ .../sys_vars/r/sysvars_server_notembedded.result | 28 ++++++++++ .../sys_vars/t/log_slow_admin_statements_func.test | 61 ++++++++++++++++++++++ sql/log_event.cc | 9 ++++ sql/mysqld.cc | 8 --- sql/sys_vars.cc | 13 +++++ 9 files changed, 207 insertions(+), 8 deletions(-) create mode 100644 mysql-test/suite/sys_vars/r/log_slow_admin_statements_func.result create mode 100644 mysql-test/suite/sys_vars/t/log_slow_admin_statements_func.test diff --git a/mysql-test/r/log_slow.result b/mysql-test/r/log_slow.result index f7670f3d3db..6a3f48506e3 100644 --- a/mysql-test/r/log_slow.result +++ b/mysql-test/r/log_slow.result @@ -9,8 +9,10 @@ select @@log_slow_verbosity; show variables like "log_slow%"; Variable_name Value +log_slow_admin_statements OFF log_slow_filter admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk log_slow_rate_limit 1 +log_slow_slave_statements OFF log_slow_verbosity set @org_slow_query_log= @@global.slow_query_log; set @@log_slow_filter= "filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk,admin"; diff --git a/mysql-test/suite/rpl/r/rpl_slow_query_log.result b/mysql-test/suite/rpl/r/rpl_slow_query_log.result index 79b83b4ceb9..2de0f5ccd82 100644 --- a/mysql-test/suite/rpl/r/rpl_slow_query_log.result +++ b/mysql-test/suite/rpl/r/rpl_slow_query_log.result @@ -76,6 +76,21 @@ ALTER TABLE t1 ADD INDEX id1(a); INSERT INTO t1 values(1, sleep(3)); ### Assertion is good. Both Master and Slave exhibit the ### same number of queries in slow log: 1 +******************************************************************** +**** TRUNCATE the slow log then check whether runtime changes of +**** log_slow_slave_statements work without slave restart. +******************************************************************** +SET @old_log_slow_slave_statements= @@global.log_slow_slave_statements; +SET @@global.log_slow_slave_statements = off; +TRUNCATE mysql.slow_log; +INSERT INTO t1 values(1, sleep(3));; +SELECT sql_text FROM mysql.slow_log WHERE sql_text like 'INSERT INTO t1 values(1, sleep(3))'; +sql_text +SET @@global.log_slow_slave_statements = on; +INSERT INTO t1 values(1, sleep(3));; +SELECT sql_text FROM mysql.slow_log WHERE sql_text like 'INSERT INTO t1 values(1, sleep(3))'; +sql_text +INSERT INTO t1 values(1, sleep(3)) SET @@global.log_output= @old_log_output; SET @@global.long_query_time= @old_long_query_time; DROP TABLE t1; diff --git a/mysql-test/suite/rpl/t/rpl_slow_query_log.test b/mysql-test/suite/rpl/t/rpl_slow_query_log.test index faf037a9dff..3505883c58e 100644 --- a/mysql-test/suite/rpl/t/rpl_slow_query_log.test +++ b/mysql-test/suite/rpl/t/rpl_slow_query_log.test @@ -299,6 +299,39 @@ if ($master_slow_query == $slave_slow_query) -- echo ### same number of queries in slow log: $master_slow_query } +-- echo ******************************************************************** +-- echo **** TRUNCATE the slow log then check whether runtime changes of +-- echo **** log_slow_slave_statements work without slave restart. +-- echo ******************************************************************** + +SET @old_log_slow_slave_statements= @@global.log_slow_slave_statements; +SET @@global.log_slow_slave_statements = off; +TRUNCATE mysql.slow_log; + +-- connection master + +--disable_warnings +-- eval $slow_query; +--enable_warnings +sync_slave_with_master; + +-- connection slave + +eval SELECT sql_text FROM mysql.slow_log WHERE sql_text like '$slow_query'; + +SET @@global.log_slow_slave_statements = on; + +-- connection master + +--disable_warnings +-- eval $slow_query; +--enable_warnings +sync_slave_with_master; + +-- connection slave + +eval SELECT sql_text FROM mysql.slow_log WHERE sql_text like '$slow_query'; + -- connection master SET @@global.log_output= @old_log_output; SET @@global.long_query_time= @old_long_query_time; diff --git a/mysql-test/suite/sys_vars/r/log_slow_admin_statements_func.result b/mysql-test/suite/sys_vars/r/log_slow_admin_statements_func.result new file mode 100644 index 00000000000..daddc4af627 --- /dev/null +++ b/mysql-test/suite/sys_vars/r/log_slow_admin_statements_func.result @@ -0,0 +1,46 @@ +SET @old_log_output= @@global.log_output; +SET @old_slow_query_log= @@global.slow_query_log; +SET @old_long_query_time= @@session.long_query_time; +SET @old_log_slow_admin_statements= @@global.log_slow_admin_statements; +USE test; +CREATE TABLE log_slow_admin_statements ( +i INT PRIMARY KEY AUTO_INCREMENT, +j VARCHAR(255) +) ENGINE=InnoDB; +SET GLOBAL log_output = 'file,table'; +SET GLOBAL slow_query_log = on; +SET SESSION long_query_time = 0; +SET GLOBAL log_slow_admin_statements = on; +ALTER TABLE log_slow_admin_statements ADD COLUMN k INT DEFAULT 17; +CREATE PROCEDURE add_rows() +BEGIN +DECLARE count INT; +SET count = 1; +INSERT INTO log_slow_admin_statements(j) values (REPEAT('A', 255)); +WHILE count <= 15 DO +INSERT INTO log_slow_admin_statements(j) SELECT j FROM log_slow_admin_statements; +SET count = count + 1; +END WHILE; +END +$ +CALL add_rows(); +OPTIMIZE TABLE log_slow_admin_statements; +Table Op Msg_type Msg_text +test.log_slow_admin_statements optimize note Table does not support optimize, doing recreate + analyze instead +test.log_slow_admin_statements optimize status OK +CHECK TABLE log_slow_admin_statements EXTENDED; +Table Op Msg_type Msg_text +test.log_slow_admin_statements check status OK +DROP TABLE log_slow_admin_statements; +SELECT sql_text FROM mysql.slow_log WHERE sql_text LIKE '%TABLE log_slow_admin_statements%'; +sql_text +ALTER TABLE log_slow_admin_statements ADD COLUMN k INT DEFAULT 17 +OPTIMIZE TABLE log_slow_admin_statements +CHECK TABLE log_slow_admin_statements EXTENDED +DROP TABLE log_slow_admin_statements +SET @@global.log_output= @old_log_output; +SET @@global.slow_query_log= @old_slow_query_log; +SET @@session.long_query_time= @old_long_query_time; +SET @@global.log_slow_admin_statements= @old_log_slow_admin_statements; +DROP PROCEDURE add_rows; +TRUNCATE TABLE mysql.slow_log; diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 26e67fc2fdb..81cc32016e2 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -1829,6 +1829,20 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME LOG_SLOW_ADMIN_STATEMENTS +SESSION_VALUE NULL +GLOBAL_VALUE OFF +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE OFF +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME LOG_SLOW_FILTER SESSION_VALUE admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk GLOBAL_VALUE admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk @@ -1857,6 +1871,20 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME LOG_SLOW_SLAVE_STATEMENTS +SESSION_VALUE NULL +GLOBAL_VALUE OFF +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE OFF +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Log slow statements executed by slave thread to the slow log if it is open. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME LOG_SLOW_VERBOSITY SESSION_VALUE GLOBAL_VALUE diff --git a/mysql-test/suite/sys_vars/t/log_slow_admin_statements_func.test b/mysql-test/suite/sys_vars/t/log_slow_admin_statements_func.test new file mode 100644 index 00000000000..78e4d35f69a --- /dev/null +++ b/mysql-test/suite/sys_vars/t/log_slow_admin_statements_func.test @@ -0,0 +1,61 @@ +--source include/no_valgrind_without_big.inc +-- source include/have_innodb.inc + +SET @old_log_output= @@global.log_output; +SET @old_slow_query_log= @@global.slow_query_log; +SET @old_long_query_time= @@session.long_query_time; +SET @old_log_slow_admin_statements= @@global.log_slow_admin_statements; + +USE test; +CREATE TABLE log_slow_admin_statements ( + i INT PRIMARY KEY AUTO_INCREMENT, + j VARCHAR(255) +) ENGINE=InnoDB; + +# enable slow logging to table +SET GLOBAL log_output = 'file,table'; +SET GLOBAL slow_query_log = on; +SET SESSION long_query_time = 0; +SET GLOBAL log_slow_admin_statements = on; + +# test ALTER, OPTIMIZE and CHECK against the table shown up +ALTER TABLE log_slow_admin_statements ADD COLUMN k INT DEFAULT 17; + +# add rows so OPTIMIZE and CHECK runs +DELIMITER $; + +CREATE PROCEDURE add_rows() +BEGIN + DECLARE count INT; + SET count = 1; + INSERT INTO log_slow_admin_statements(j) values (REPEAT('A', 255)); + WHILE count <= 15 DO + INSERT INTO log_slow_admin_statements(j) SELECT j FROM log_slow_admin_statements; + SET count = count + 1; + END WHILE; +END +$ + +DELIMITER ;$ + +CALL add_rows(); + +# OPTIMIZE TABLE +OPTIMIZE TABLE log_slow_admin_statements; + +# CHECK TABLE +CHECK TABLE log_slow_admin_statements EXTENDED; + +# DROP TABLE +DROP TABLE log_slow_admin_statements; + +# ALTER, OPTIMIZE, CHECK and DROP operations should be logged in slow query log. +SELECT sql_text FROM mysql.slow_log WHERE sql_text LIKE '%TABLE log_slow_admin_statements%'; + +SET @@global.log_output= @old_log_output; +SET @@global.slow_query_log= @old_slow_query_log; +SET @@session.long_query_time= @old_long_query_time; +SET @@global.log_slow_admin_statements= @old_log_slow_admin_statements; + +DROP PROCEDURE add_rows; +TRUNCATE TABLE mysql.slow_log; diff --git a/sql/log_event.cc b/sql/log_event.cc index 98165cc4797..ea0afddafbe 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -4428,6 +4428,15 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi, if (thd->m_digest != NULL) thd->m_digest->reset(thd->m_token_array, max_digest_length); + if (thd->slave_thread) + { + /* + The opt_log_slow_slave_statements variable can be changed + dynamically, so we have to set the sql_log_slow respectively. + */ + thd->variables.sql_log_slow= opt_log_slow_slave_statements; + } + thd->enable_slow_log= thd->variables.sql_log_slow; mysql_parse(thd, thd->query(), thd->query_length(), &parser_state); /* Finalize server status flags after executing a statement. */ diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ac433853c2f..ced922536fc 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7372,14 +7372,6 @@ struct my_option my_long_options[]= "Don't log extra information to update and slow-query logs.", &opt_short_log_format, &opt_short_log_format, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"log-slow-admin-statements", 0, - "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to " - "the slow log if it is open.", &opt_log_slow_admin_statements, - &opt_log_slow_admin_statements, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"log-slow-slave-statements", 0, - "Log slow statements executed by slave thread to the slow log if it is open.", - &opt_log_slow_slave_statements, &opt_log_slow_slave_statements, - 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"log-tc", 0, "Path to transaction coordinator log (used for transactions that affect " "more than one storage engine, when binary log is disabled).", diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 403b6a5bec7..e3ff327404f 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1183,6 +1183,19 @@ static Sys_var_mybool Sys_log_queries_not_using_indexes( GLOBAL_VAR(opt_log_queries_not_using_indexes), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); +static Sys_var_mybool Sys_log_slow_admin_statements( + "log_slow_admin_statements", + "Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to " + "the slow log if it is open.", + GLOBAL_VAR(opt_log_slow_admin_statements), + CMD_LINE(OPT_ARG), DEFAULT(FALSE)); + +static Sys_var_mybool Sys_log_slow_slave_statements( + "log_slow_slave_statements", + "Log slow statements executed by slave thread to the slow log if it is open.", + GLOBAL_VAR(opt_log_slow_slave_statements), + CMD_LINE(OPT_ARG), DEFAULT(FALSE)); + static Sys_var_ulong Sys_log_warnings( "log_warnings", "Log some not critical warnings to the general log file." -- cgit v1.2.1 From 8e048579cdafd6656ebc7dd5bee919c0899e4d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Mon, 21 Mar 2016 17:38:52 +0200 Subject: Add an empty file to std_data for future testing purposes --- mysql-test/std_data/empty_file | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 mysql-test/std_data/empty_file diff --git a/mysql-test/std_data/empty_file b/mysql-test/std_data/empty_file new file mode 100644 index 00000000000..e69de29bb2d -- cgit v1.2.1 From 16ddd1824c679751deb0ab89b40c1375f6540c3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Mon, 21 Mar 2016 17:47:15 +0200 Subject: MDEV-9613: keyfile without any keys crashes mysqld on loading file_key_management plugin Code was assuming that the keys file would contain at least one valid key. This caused a Dynamic_array::at(0) call that lead to the crash. --- mysql-test/suite/encryption/r/filekeys_emptyfile.result | 10 ++++++++++ mysql-test/suite/encryption/t/filekeys_emptyfile.opt | 1 + mysql-test/suite/encryption/t/filekeys_emptyfile.test | 4 ++++ plugin/file_key_management/parser.cc | 2 +- 4 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/encryption/r/filekeys_emptyfile.result create mode 100644 mysql-test/suite/encryption/t/filekeys_emptyfile.opt create mode 100644 mysql-test/suite/encryption/t/filekeys_emptyfile.test diff --git a/mysql-test/suite/encryption/r/filekeys_emptyfile.result b/mysql-test/suite/encryption/r/filekeys_emptyfile.result new file mode 100644 index 00000000000..f94f11d9f08 --- /dev/null +++ b/mysql-test/suite/encryption/r/filekeys_emptyfile.result @@ -0,0 +1,10 @@ +call mtr.add_suppression("System key id 1 is missing at"); +call mtr.add_suppression("Plugin 'file_key_management' init function returned error"); +call mtr.add_suppression("Plugin 'file_key_management' registration.*failed"); +FOUND /System key id 1 is missing at/ in mysqld.1.err +create table t1(c1 bigint not null, b char(200)) engine=innodb encrypted=yes encryption_key_id=1; +ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options") +select plugin_status from information_schema.plugins +where plugin_name = 'file_key_management'; +plugin_status +# Test checks if opening an empty filekeys does not crash the server. diff --git a/mysql-test/suite/encryption/t/filekeys_emptyfile.opt b/mysql-test/suite/encryption/t/filekeys_emptyfile.opt new file mode 100644 index 00000000000..7c5f6d05dde --- /dev/null +++ b/mysql-test/suite/encryption/t/filekeys_emptyfile.opt @@ -0,0 +1 @@ +--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/empty_file diff --git a/mysql-test/suite/encryption/t/filekeys_emptyfile.test b/mysql-test/suite/encryption/t/filekeys_emptyfile.test new file mode 100644 index 00000000000..39f2ccf260a --- /dev/null +++ b/mysql-test/suite/encryption/t/filekeys_emptyfile.test @@ -0,0 +1,4 @@ +let SEARCH_PATTERN=System key id 1 is missing at; +source filekeys_badtest.inc; + +--echo # Test checks if opening an empty filekeys does not crash the server. diff --git a/plugin/file_key_management/parser.cc b/plugin/file_key_management/parser.cc index 28cd981df79..628412bc171 100644 --- a/plugin/file_key_management/parser.cc +++ b/plugin/file_key_management/parser.cc @@ -220,7 +220,7 @@ bool Parser::parse_file(Dynamic_array *keys, const char *secret) keys->sort(sort_keys); my_free(buffer); - if (keys->at(0).id != 1) + if (keys->elements() == 0 || keys->at(0).id != 1) { report_error("System key id 1 is missing", 0); return 1; -- cgit v1.2.1 From c4bef7ad3c1528e902e88aa8b2446f29ffc1b0e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Mon, 21 Mar 2016 22:14:49 +0200 Subject: MDEV-9443: Roles aren't supported in prepared statements Make role statements work with the PREPARE keyword. --- .../suite/roles/prepare_stmt_with_role.result | 62 ++++++++++++++++++++++ mysql-test/suite/roles/prepare_stmt_with_role.test | 52 ++++++++++++++++++ sql/sql_prepare.cc | 3 ++ 3 files changed, 117 insertions(+) create mode 100644 mysql-test/suite/roles/prepare_stmt_with_role.result create mode 100644 mysql-test/suite/roles/prepare_stmt_with_role.test diff --git a/mysql-test/suite/roles/prepare_stmt_with_role.result b/mysql-test/suite/roles/prepare_stmt_with_role.result new file mode 100644 index 00000000000..8b647bf2849 --- /dev/null +++ b/mysql-test/suite/roles/prepare_stmt_with_role.result @@ -0,0 +1,62 @@ +# +# Test user to check if we can grant the created role to it. +# +create user test_user; +# +# First create the role. +# +SET @createRole = 'CREATE ROLE developers'; +PREPARE stmtCreateRole FROM @createRole; +EXECUTE stmtCreateRole; +# +# Test to see if the role is created. +# +SELECT user, host,is_role FROM mysql.user +WHERE user = 'developers'; +user host is_role +developers Y +SHOW GRANTS; +Grants for root@localhost +GRANT developers TO 'root'@'localhost' WITH ADMIN OPTION +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +# +# Now grant the role to the test user. +# +SET @grantRole = 'GRANT developers to test_user'; +PREPARE stmtGrantRole FROM @grantRole; +EXECUTE stmtGrantRole; +# +# We should see 2 entries in the roles_mapping table. +# +SELECT * FROM mysql.roles_mapping; +Host User Role Admin_option +% test_user developers N +localhost root developers Y +SHOW GRANTS FOR test_user; +Grants for test_user@% +GRANT developers TO 'test_user'@'%' +GRANT USAGE ON *.* TO 'test_user'@'%' +# +# Now drop the role. +# +SET @dropRole = 'DROP ROLE developers'; +PREPARE stmtDropRole FROM @dropRole; +EXECUTE stmtDropRole; +# +# Check both user and roles_mapping table for traces of our role. +# +SELECT user, host,is_role FROM mysql.user +WHERE user = 'developers'; +user host is_role +SELECT * FROM mysql.roles_mapping; +Host User Role Admin_option +SHOW GRANTS; +Grants for root@localhost +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +SHOW GRANTS FOR test_user; +Grants for test_user@% +GRANT USAGE ON *.* TO 'test_user'@'%' +# Cleanup. +DROP USER test_user; diff --git a/mysql-test/suite/roles/prepare_stmt_with_role.test b/mysql-test/suite/roles/prepare_stmt_with_role.test new file mode 100644 index 00000000000..233249521b6 --- /dev/null +++ b/mysql-test/suite/roles/prepare_stmt_with_role.test @@ -0,0 +1,52 @@ +--source include/not_embedded.inc + + +--echo # +--echo # Test user to check if we can grant the created role to it. +--echo # +create user test_user; +--echo # +--echo # First create the role. +--echo # +SET @createRole = 'CREATE ROLE developers'; +PREPARE stmtCreateRole FROM @createRole; +EXECUTE stmtCreateRole; +--echo # +--echo # Test to see if the role is created. +--echo # +SELECT user, host,is_role FROM mysql.user +WHERE user = 'developers'; +SHOW GRANTS; + +--echo # +--echo # Now grant the role to the test user. +--echo # +SET @grantRole = 'GRANT developers to test_user'; +PREPARE stmtGrantRole FROM @grantRole; +EXECUTE stmtGrantRole; + +--echo # +--echo # We should see 2 entries in the roles_mapping table. +--echo # +--sorted_result +SELECT * FROM mysql.roles_mapping; +SHOW GRANTS FOR test_user; + +--echo # +--echo # Now drop the role. +--echo # +SET @dropRole = 'DROP ROLE developers'; +PREPARE stmtDropRole FROM @dropRole; +EXECUTE stmtDropRole; + +--echo # +--echo # Check both user and roles_mapping table for traces of our role. +--echo # +SELECT user, host,is_role FROM mysql.user +WHERE user = 'developers'; +SELECT * FROM mysql.roles_mapping; +SHOW GRANTS; +SHOW GRANTS FOR test_user; + +--echo # Cleanup. +DROP USER test_user; diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 492c20206a0..104046395c4 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2458,9 +2458,12 @@ static bool check_prepared_statement(Prepared_statement *stmt) case SQLCOM_CREATE_USER: case SQLCOM_RENAME_USER: case SQLCOM_DROP_USER: + case SQLCOM_CREATE_ROLE: + case SQLCOM_DROP_ROLE: case SQLCOM_ASSIGN_TO_KEYCACHE: case SQLCOM_PRELOAD_KEYS: case SQLCOM_GRANT: + case SQLCOM_GRANT_ROLE: case SQLCOM_REVOKE: case SQLCOM_KILL: case SQLCOM_COMPOUND: -- cgit v1.2.1 From 287f2d2947c15d1e7ff35ba123b37291147e1c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Tue, 22 Mar 2016 13:45:51 +0200 Subject: MDEV-9443: Add REVOKE as a command to PREPARE --- mysql-test/suite/roles/prepare_stmt_with_role.result | 9 +++++++++ mysql-test/suite/roles/prepare_stmt_with_role.test | 9 +++++++++ sql/sql_prepare.cc | 1 + 3 files changed, 19 insertions(+) diff --git a/mysql-test/suite/roles/prepare_stmt_with_role.result b/mysql-test/suite/roles/prepare_stmt_with_role.result index 8b647bf2849..71dffaafa92 100644 --- a/mysql-test/suite/roles/prepare_stmt_with_role.result +++ b/mysql-test/suite/roles/prepare_stmt_with_role.result @@ -38,6 +38,15 @@ Grants for test_user@% GRANT developers TO 'test_user'@'%' GRANT USAGE ON *.* TO 'test_user'@'%' # +# Test revoking a role. +# +SET @revokeRole = 'REVOKE developers FROM test_user'; +PREPARE stmtRevokeRole FROM @revokeRole; +EXECUTE stmtRevokeRole; +SHOW GRANTS FOR test_user; +Grants for test_user@% +GRANT USAGE ON *.* TO 'test_user'@'%' +# # Now drop the role. # SET @dropRole = 'DROP ROLE developers'; diff --git a/mysql-test/suite/roles/prepare_stmt_with_role.test b/mysql-test/suite/roles/prepare_stmt_with_role.test index 233249521b6..be2c92b3e36 100644 --- a/mysql-test/suite/roles/prepare_stmt_with_role.test +++ b/mysql-test/suite/roles/prepare_stmt_with_role.test @@ -32,6 +32,15 @@ EXECUTE stmtGrantRole; SELECT * FROM mysql.roles_mapping; SHOW GRANTS FOR test_user; +--echo # +--echo # Test revoking a role. +--echo # +SET @revokeRole = 'REVOKE developers FROM test_user'; +PREPARE stmtRevokeRole FROM @revokeRole; +EXECUTE stmtRevokeRole; + +SHOW GRANTS FOR test_user; + --echo # --echo # Now drop the role. --echo # diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 104046395c4..0db1daa378e 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2465,6 +2465,7 @@ static bool check_prepared_statement(Prepared_statement *stmt) case SQLCOM_GRANT: case SQLCOM_GRANT_ROLE: case SQLCOM_REVOKE: + case SQLCOM_REVOKE_ROLE: case SQLCOM_KILL: case SQLCOM_COMPOUND: case SQLCOM_SHUTDOWN: -- cgit v1.2.1 From 29753fb9f285afa0550c54409a985970460b9172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Tue, 22 Mar 2016 22:18:33 +0200 Subject: MDEV-9443: Add reexecution test cases. --- .../suite/roles/prepare_stmt_with_role.result | 36 ++++++++++++++++++++++ mysql-test/suite/roles/prepare_stmt_with_role.test | 24 +++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/mysql-test/suite/roles/prepare_stmt_with_role.result b/mysql-test/suite/roles/prepare_stmt_with_role.result index 71dffaafa92..e859b2e304b 100644 --- a/mysql-test/suite/roles/prepare_stmt_with_role.result +++ b/mysql-test/suite/roles/prepare_stmt_with_role.result @@ -20,12 +20,17 @@ Grants for root@localhost GRANT developers TO 'root'@'localhost' WITH ADMIN OPTION GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +# Test reexecution. +EXECUTE stmtCreateRole; +ERROR HY000: Operation CREATE ROLE failed for 'developers' # # Now grant the role to the test user. # SET @grantRole = 'GRANT developers to test_user'; PREPARE stmtGrantRole FROM @grantRole; EXECUTE stmtGrantRole; +# Test reexecution. +EXECUTE stmtGrantRole; # # We should see 2 entries in the roles_mapping table. # @@ -43,6 +48,17 @@ GRANT USAGE ON *.* TO 'test_user'@'%' SET @revokeRole = 'REVOKE developers FROM test_user'; PREPARE stmtRevokeRole FROM @revokeRole; EXECUTE stmtRevokeRole; +EXECUTE stmtRevokeRole; +ERROR HY000: Cannot revoke role 'developers' from: 'test_user'@'%'. +SHOW GRANTS FOR test_user; +Grants for test_user@% +GRANT USAGE ON *.* TO 'test_user'@'%' +EXECUTE stmtGrantRole; +SHOW GRANTS FOR test_user; +Grants for test_user@% +GRANT developers TO 'test_user'@'%' +GRANT USAGE ON *.* TO 'test_user'@'%' +EXECUTE stmtRevokeRole; SHOW GRANTS FOR test_user; Grants for test_user@% GRANT USAGE ON *.* TO 'test_user'@'%' @@ -67,5 +83,25 @@ GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION SHOW GRANTS FOR test_user; Grants for test_user@% GRANT USAGE ON *.* TO 'test_user'@'%' +# +# Test reexecution. +# +EXECUTE stmtCreateRole; +SELECT user, host,is_role FROM mysql.user +WHERE user = 'developers'; +user host is_role +developers Y +SELECT * FROM mysql.roles_mapping; +Host User Role Admin_option +localhost root developers Y +SHOW GRANTS; +Grants for root@localhost +GRANT developers TO 'root'@'localhost' WITH ADMIN OPTION +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION +GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +SHOW GRANTS FOR test_user; +Grants for test_user@% +GRANT USAGE ON *.* TO 'test_user'@'%' +EXECUTE stmtDropRole; # Cleanup. DROP USER test_user; diff --git a/mysql-test/suite/roles/prepare_stmt_with_role.test b/mysql-test/suite/roles/prepare_stmt_with_role.test index be2c92b3e36..516e9ddab34 100644 --- a/mysql-test/suite/roles/prepare_stmt_with_role.test +++ b/mysql-test/suite/roles/prepare_stmt_with_role.test @@ -18,12 +18,18 @@ SELECT user, host,is_role FROM mysql.user WHERE user = 'developers'; SHOW GRANTS; +--echo # Test reexecution. +--error ER_CANNOT_USER +EXECUTE stmtCreateRole; + --echo # --echo # Now grant the role to the test user. --echo # SET @grantRole = 'GRANT developers to test_user'; PREPARE stmtGrantRole FROM @grantRole; EXECUTE stmtGrantRole; +--echo # Test reexecution. +EXECUTE stmtGrantRole; --echo # --echo # We should see 2 entries in the roles_mapping table. @@ -38,7 +44,13 @@ SHOW GRANTS FOR test_user; SET @revokeRole = 'REVOKE developers FROM test_user'; PREPARE stmtRevokeRole FROM @revokeRole; EXECUTE stmtRevokeRole; +--error ER_CANNOT_REVOKE_ROLE +EXECUTE stmtRevokeRole; +SHOW GRANTS FOR test_user; +EXECUTE stmtGrantRole; +SHOW GRANTS FOR test_user; +EXECUTE stmtRevokeRole; SHOW GRANTS FOR test_user; --echo # @@ -57,5 +69,17 @@ SELECT * FROM mysql.roles_mapping; SHOW GRANTS; SHOW GRANTS FOR test_user; +--echo # +--echo # Test reexecution. +--echo # +EXECUTE stmtCreateRole; +SELECT user, host,is_role FROM mysql.user +WHERE user = 'developers'; +SELECT * FROM mysql.roles_mapping; + +SHOW GRANTS; +SHOW GRANTS FOR test_user; +EXECUTE stmtDropRole; + --echo # Cleanup. DROP USER test_user; -- cgit v1.2.1 From f66303dcf9fc9b7d5244be8b3c724387a5da7988 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Wed, 23 Mar 2016 02:22:09 +0200 Subject: Fix sysvar tests - embedded and 32-bit --- .../sys_vars/r/sysvars_server_embedded,32bit.rdiff | 230 ++++++++++---------- .../sys_vars/r/sysvars_server_embedded.result | 28 +++ .../r/sysvars_server_notembedded,32bit.rdiff | 238 ++++++++++----------- 3 files changed, 262 insertions(+), 234 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff index 170989d9fa0..6d6dcda7bae 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded,32bit.rdiff @@ -1,5 +1,5 @@ ---- suite/sys_vars/r/sysvars_server_embedded.result 2015-09-04 13:17:44.407031503 +0000 -+++ suite/sys_vars/r/sysvars_server_embedded,32bit.reject 2015-09-04 13:39:45.098389360 +0000 +--- suite/sys_vars/r/sysvars_server_embedded.result 2016-03-23 01:02:33.000000000 +0100 ++++ suite/sys_vars/r/sysvars_server_embedded.reject 2016-03-23 01:09:44.000000000 +0100 @@ -57,7 +57,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 1 @@ -179,7 +179,7 @@ VARIABLE_COMMENT If non-zero, binary logs will be purged after expire_logs_days days; possible purges happen at startup and at binary log rotation NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 99 -@@ -813,7 +813,7 @@ +@@ -827,7 +827,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -188,7 +188,7 @@ VARIABLE_COMMENT The number of connections on extra-port NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100000 -@@ -855,7 +855,7 @@ +@@ -869,7 +869,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -197,7 +197,7 @@ VARIABLE_COMMENT A dedicated thread is created to flush all tables at the given interval NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -897,7 +897,7 @@ +@@ -911,7 +911,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 84 VARIABLE_SCOPE GLOBAL @@ -206,7 +206,7 @@ VARIABLE_COMMENT The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 84 -@@ -911,7 +911,7 @@ +@@ -925,7 +925,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4 VARIABLE_SCOPE GLOBAL @@ -215,7 +215,7 @@ VARIABLE_COMMENT The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 84 -@@ -925,7 +925,7 @@ +@@ -939,7 +939,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 20 VARIABLE_SCOPE GLOBAL @@ -224,7 +224,7 @@ VARIABLE_COMMENT Number of best matches to use for query expansion NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1000 -@@ -984,7 +984,7 @@ +@@ -998,7 +998,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The maximum length of the result of function GROUP_CONCAT() NUMERIC_MIN_VALUE 4 @@ -233,7 +233,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1135,7 +1135,7 @@ +@@ -1149,7 +1149,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -242,7 +242,7 @@ VARIABLE_COMMENT Number of bytes used for a histogram. If set to 0, no histograms are created by ANALYZE. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -1163,7 +1163,7 @@ +@@ -1177,7 +1177,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 128 VARIABLE_SCOPE GLOBAL @@ -251,7 +251,7 @@ VARIABLE_COMMENT How many host names should be cached to avoid resolving. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65536 -@@ -1275,7 +1275,7 @@ +@@ -1289,7 +1289,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 28800 VARIABLE_SCOPE SESSION @@ -260,7 +260,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on an interactive connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -1306,7 +1306,7 @@ +@@ -1320,7 +1320,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the buffer that is used for joins NUMERIC_MIN_VALUE 128 @@ -269,7 +269,7 @@ NUMERIC_BLOCK_SIZE 128 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1331,7 +1331,7 @@ +@@ -1345,7 +1345,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2 VARIABLE_SCOPE SESSION @@ -278,7 +278,7 @@ VARIABLE_COMMENT Controls what join operations can be executed with join buffers. Odd numbers are used for plain join buffers while even numbers are used for linked buffers NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 8 -@@ -1362,7 +1362,7 @@ +@@ -1376,7 +1376,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford NUMERIC_MIN_VALUE 0 @@ -287,7 +287,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1569,7 +1569,7 @@ +@@ -1583,7 +1583,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 31536000 VARIABLE_SCOPE SESSION @@ -296,7 +296,7 @@ VARIABLE_COMMENT Timeout in seconds to wait for a lock before returning an error. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -1667,7 +1667,7 @@ +@@ -1695,7 +1695,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -305,7 +305,7 @@ VARIABLE_COMMENT Write to slow log every #th slow query. Set to 1 to log everything. Increase it to reduce the size of the slow or the performance impact of slow logging NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -1695,7 +1695,7 @@ +@@ -1737,7 +1737,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -314,7 +314,7 @@ VARIABLE_COMMENT Log some not critical warnings to the general log file.Value can be between 0 and 11. Higher values mean more verbosity NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -1737,7 +1737,7 @@ +@@ -1779,7 +1779,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4194304 VARIABLE_SCOPE SESSION @@ -323,7 +323,7 @@ VARIABLE_COMMENT Max packet length to send to or receive from the server NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -1747,14 +1747,14 @@ +@@ -1789,14 +1789,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_BINLOG_CACHE_SIZE SESSION_VALUE NULL @@ -341,7 +341,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1765,7 +1765,7 @@ +@@ -1807,7 +1807,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1073741824 VARIABLE_SCOPE GLOBAL @@ -350,7 +350,7 @@ VARIABLE_COMMENT Binary log will be rotated automatically when the size exceeds this value. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 1073741824 -@@ -1775,14 +1775,14 @@ +@@ -1817,14 +1817,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_BINLOG_STMT_CACHE_SIZE SESSION_VALUE NULL @@ -368,7 +368,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1793,7 +1793,7 @@ +@@ -1835,7 +1835,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 151 VARIABLE_SCOPE GLOBAL @@ -377,7 +377,7 @@ VARIABLE_COMMENT The number of simultaneous clients allowed NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100000 -@@ -1807,7 +1807,7 @@ +@@ -1849,7 +1849,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -386,7 +386,7 @@ VARIABLE_COMMENT If there is more than this number of interrupted connections from a host this host will be blocked from further connections NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -1821,7 +1821,7 @@ +@@ -1863,7 +1863,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 20 VARIABLE_SCOPE SESSION @@ -395,7 +395,7 @@ VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -1849,7 +1849,7 @@ +@@ -1891,7 +1891,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 64 VARIABLE_SCOPE SESSION @@ -404,7 +404,7 @@ VARIABLE_COMMENT Max number of errors/warnings to store for a statement NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65535 -@@ -1866,7 +1866,7 @@ +@@ -1908,7 +1908,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Don't allow creation of heap tables bigger than this NUMERIC_MIN_VALUE 16384 @@ -413,7 +413,7 @@ NUMERIC_BLOCK_SIZE 1024 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1877,7 +1877,7 @@ +@@ -1919,7 +1919,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 20 VARIABLE_SCOPE SESSION @@ -422,7 +422,7 @@ VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -1905,7 +1905,7 @@ +@@ -1947,7 +1947,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE SESSION @@ -431,7 +431,7 @@ VARIABLE_COMMENT Max number of bytes in sorted records NUMERIC_MIN_VALUE 4 NUMERIC_MAX_VALUE 8388608 -@@ -1919,7 +1919,7 @@ +@@ -1961,7 +1961,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -440,7 +440,7 @@ VARIABLE_COMMENT The maximum BLOB length to send to server from mysql_send_long_data API. Deprecated option; use max_allowed_packet instead. NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -1933,7 +1933,7 @@ +@@ -1975,7 +1975,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16382 VARIABLE_SCOPE GLOBAL @@ -449,7 +449,7 @@ VARIABLE_COMMENT Maximum number of prepared statements in the server NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -1947,7 +1947,7 @@ +@@ -1989,7 +1989,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4294967295 VARIABLE_SCOPE SESSION @@ -458,7 +458,7 @@ VARIABLE_COMMENT Limit assumed max number of seeks when looking up rows based on a key NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -1961,7 +1961,7 @@ +@@ -2003,7 +2003,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE SESSION @@ -467,7 +467,7 @@ VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored) NUMERIC_MIN_VALUE 4 NUMERIC_MAX_VALUE 8388608 -@@ -1975,7 +1975,7 @@ +@@ -2017,7 +2017,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -476,7 +476,7 @@ VARIABLE_COMMENT Maximum stored procedure recursion depth NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -2003,7 +2003,7 @@ +@@ -2045,7 +2045,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32 VARIABLE_SCOPE SESSION @@ -485,7 +485,7 @@ VARIABLE_COMMENT Unused, will be removed. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2031,7 +2031,7 @@ +@@ -2073,7 +2073,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4294967295 VARIABLE_SCOPE GLOBAL @@ -494,7 +494,7 @@ VARIABLE_COMMENT After this many write locks, allow some read locks to run in between NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2045,7 +2045,7 @@ +@@ -2087,7 +2087,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -503,7 +503,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1048576 -@@ -2059,7 +2059,7 @@ +@@ -2101,7 +2101,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8 VARIABLE_SCOPE GLOBAL @@ -512,7 +512,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1024 -@@ -2073,7 +2073,7 @@ +@@ -2115,7 +2115,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -521,7 +521,7 @@ VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2087,7 +2087,7 @@ +@@ -2129,7 +2129,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 262144 VARIABLE_SCOPE SESSION @@ -530,7 +530,7 @@ VARIABLE_COMMENT Size of buffer to use when using MRR with range access NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -2101,10 +2101,10 @@ +@@ -2143,10 +2143,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 256 VARIABLE_SCOPE SESSION @@ -543,7 +543,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2115,7 +2115,7 @@ +@@ -2157,7 +2157,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -552,7 +552,7 @@ VARIABLE_COMMENT Block size to be used for MyISAM index pages NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 16384 -@@ -2129,7 +2129,7 @@ +@@ -2171,7 +2171,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 6 VARIABLE_SCOPE GLOBAL @@ -561,7 +561,7 @@ VARIABLE_COMMENT Default pointer size to be used for MyISAM tables NUMERIC_MIN_VALUE 2 NUMERIC_MAX_VALUE 7 -@@ -2139,9 +2139,9 @@ +@@ -2181,9 +2181,9 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_MAX_SORT_FILE_SIZE SESSION_VALUE NULL @@ -573,7 +573,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Don't use the fast sort index method to created index if the temporary file would get bigger than this -@@ -2153,14 +2153,14 @@ +@@ -2195,14 +2195,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_MMAP_SIZE SESSION_VALUE NULL @@ -591,7 +591,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -2185,10 +2185,10 @@ +@@ -2227,10 +2227,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -604,7 +604,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2202,7 +2202,7 @@ +@@ -2244,7 +2244,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE NUMERIC_MIN_VALUE 4096 @@ -613,7 +613,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2255,7 +2255,7 @@ +@@ -2297,7 +2297,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16384 VARIABLE_SCOPE SESSION @@ -622,7 +622,7 @@ VARIABLE_COMMENT Buffer length for TCP/IP and socket communication NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1048576 -@@ -2269,7 +2269,7 @@ +@@ -2311,7 +2311,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 30 VARIABLE_SCOPE SESSION @@ -631,7 +631,7 @@ VARIABLE_COMMENT Number of seconds to wait for more data from a connection before aborting the read NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2283,7 +2283,7 @@ +@@ -2325,7 +2325,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE SESSION @@ -640,7 +640,7 @@ VARIABLE_COMMENT If a read on a communication port is interrupted, retry this many times before giving up NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2297,7 +2297,7 @@ +@@ -2339,7 +2339,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 60 VARIABLE_SCOPE SESSION @@ -649,7 +649,7 @@ VARIABLE_COMMENT Number of seconds to wait for a block to be written to a connection before aborting the write NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2367,7 +2367,7 @@ +@@ -2409,7 +2409,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -658,7 +658,7 @@ VARIABLE_COMMENT Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1 -@@ -2381,7 +2381,7 @@ +@@ -2423,7 +2423,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 62 VARIABLE_SCOPE SESSION @@ -667,7 +667,7 @@ VARIABLE_COMMENT Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Values smaller than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value; if set to 63, the optimizer will switch to the original find_best search. NOTE: The value 63 and its associated behaviour is deprecated NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 63 -@@ -2395,7 +2395,7 @@ +@@ -2437,7 +2437,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE SESSION @@ -676,7 +676,7 @@ VARIABLE_COMMENT Controls number of record samples to check condition selectivity NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 4294967295 -@@ -2423,7 +2423,7 @@ +@@ -2465,7 +2465,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -685,7 +685,7 @@ VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 5 -@@ -2451,7 +2451,7 @@ +@@ -2493,7 +2493,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -694,7 +694,7 @@ VARIABLE_COMMENT Maximum number of instrumented user@host accounts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2465,7 +2465,7 @@ +@@ -2507,7 +2507,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -703,7 +703,7 @@ VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 200 -@@ -2479,7 +2479,7 @@ +@@ -2521,7 +2521,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -712,7 +712,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STAGES_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2493,7 +2493,7 @@ +@@ -2535,7 +2535,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -721,7 +721,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STAGES_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2507,7 +2507,7 @@ +@@ -2549,7 +2549,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -730,7 +730,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2521,7 +2521,7 @@ +@@ -2563,7 +2563,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -739,7 +739,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2535,7 +2535,7 @@ +@@ -2577,7 +2577,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -748,7 +748,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_WAITS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2549,7 +2549,7 @@ +@@ -2591,7 +2591,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -757,7 +757,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_WAITS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2563,7 +2563,7 @@ +@@ -2605,7 +2605,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -766,7 +766,7 @@ VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2577,7 +2577,7 @@ +@@ -2619,7 +2619,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 80 VARIABLE_SCOPE GLOBAL @@ -775,7 +775,7 @@ VARIABLE_COMMENT Maximum number of condition instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2591,7 +2591,7 @@ +@@ -2633,7 +2633,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -784,7 +784,7 @@ VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2605,7 +2605,7 @@ +@@ -2647,7 +2647,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -793,7 +793,7 @@ VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2619,7 +2619,7 @@ +@@ -2661,7 +2661,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -802,7 +802,7 @@ VARIABLE_COMMENT Maximum number of file instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2633,7 +2633,7 @@ +@@ -2675,7 +2675,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32768 VARIABLE_SCOPE GLOBAL @@ -811,7 +811,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented files. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2647,7 +2647,7 @@ +@@ -2689,7 +2689,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -820,7 +820,7 @@ VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2661,7 +2661,7 @@ +@@ -2703,7 +2703,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 200 VARIABLE_SCOPE GLOBAL @@ -829,7 +829,7 @@ VARIABLE_COMMENT Maximum number of mutex instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2675,7 +2675,7 @@ +@@ -2717,7 +2717,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -838,7 +838,7 @@ VARIABLE_COMMENT Maximum number of instrumented MUTEX objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2689,7 +2689,7 @@ +@@ -2731,7 +2731,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 40 VARIABLE_SCOPE GLOBAL @@ -847,7 +847,7 @@ VARIABLE_COMMENT Maximum number of rwlock instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2703,7 +2703,7 @@ +@@ -2745,7 +2745,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -856,7 +856,7 @@ VARIABLE_COMMENT Maximum number of instrumented RWLOCK objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2717,7 +2717,7 @@ +@@ -2759,7 +2759,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -865,7 +865,7 @@ VARIABLE_COMMENT Maximum number of socket instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2731,7 +2731,7 @@ +@@ -2773,7 +2773,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -874,7 +874,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented sockets. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2745,7 +2745,7 @@ +@@ -2787,7 +2787,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 150 VARIABLE_SCOPE GLOBAL @@ -883,7 +883,7 @@ VARIABLE_COMMENT Maximum number of stage instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2759,7 +2759,7 @@ +@@ -2801,7 +2801,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 178 VARIABLE_SCOPE GLOBAL @@ -892,7 +892,7 @@ VARIABLE_COMMENT Maximum number of statement instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2773,7 +2773,7 @@ +@@ -2815,7 +2815,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -901,7 +901,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2787,7 +2787,7 @@ +@@ -2829,7 +2829,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -910,7 +910,7 @@ VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2801,7 +2801,7 @@ +@@ -2843,7 +2843,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -919,7 +919,7 @@ VARIABLE_COMMENT Maximum number of thread instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2815,7 +2815,7 @@ +@@ -2857,7 +2857,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -928,7 +928,7 @@ VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2829,7 +2829,7 @@ +@@ -2871,7 +2871,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -937,7 +937,7 @@ VARIABLE_COMMENT Size of session attribute string buffer per thread. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2843,7 +2843,7 @@ +@@ -2885,7 +2885,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -946,7 +946,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1024 -@@ -2857,7 +2857,7 @@ +@@ -2899,7 +2899,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -955,7 +955,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2871,7 +2871,7 @@ +@@ -2913,7 +2913,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -964,7 +964,7 @@ VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2941,7 +2941,7 @@ +@@ -2983,7 +2983,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32768 VARIABLE_SCOPE SESSION @@ -973,7 +973,7 @@ VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -2969,7 +2969,7 @@ +@@ -3011,7 +3011,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 15 VARIABLE_SCOPE SESSION @@ -982,7 +982,7 @@ VARIABLE_COMMENT Limit of query profiling memory NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -2983,7 +2983,7 @@ +@@ -3025,7 +3025,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 5 VARIABLE_SCOPE SESSION @@ -991,7 +991,7 @@ VARIABLE_COMMENT Seconds between sending progress reports to the client for time-consuming statements. Set to 0 to disable progress reporting. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3039,10 +3039,10 @@ +@@ -3081,10 +3081,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION ONLY @@ -1004,7 +1004,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3053,7 +3053,7 @@ +@@ -3095,7 +3095,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16384 VARIABLE_SCOPE SESSION @@ -1013,7 +1013,7 @@ VARIABLE_COMMENT Allocation block size for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -3067,7 +3067,7 @@ +@@ -3109,7 +3109,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -1022,7 +1022,7 @@ VARIABLE_COMMENT Don't cache results that are bigger than this NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3081,7 +3081,7 @@ +@@ -3123,7 +3123,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE GLOBAL @@ -1031,7 +1031,7 @@ VARIABLE_COMMENT The minimum size for blocks allocated by the query cache NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3098,7 +3098,7 @@ +@@ -3140,7 +3140,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The memory allocated to store results from old queries NUMERIC_MIN_VALUE 0 @@ -1040,7 +1040,7 @@ NUMERIC_BLOCK_SIZE 1024 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3151,7 +3151,7 @@ +@@ -3193,7 +3193,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 24576 VARIABLE_SCOPE SESSION @@ -1049,7 +1049,7 @@ VARIABLE_COMMENT Persistent buffer for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -3165,7 +3165,7 @@ +@@ -3207,7 +3207,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE SESSION @@ -1058,7 +1058,7 @@ VARIABLE_COMMENT Allocation block size for storing ranges during optimization NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 4294967295 -@@ -3179,7 +3179,7 @@ +@@ -3221,7 +3221,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 131072 VARIABLE_SCOPE SESSION @@ -1067,7 +1067,7 @@ VARIABLE_COMMENT Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -3207,7 +3207,7 @@ +@@ -3249,7 +3249,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 262144 VARIABLE_SCOPE SESSION @@ -1076,7 +1076,7 @@ VARIABLE_COMMENT When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 2147483647 -@@ -3221,10 +3221,10 @@ +@@ -3263,10 +3263,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8388608 VARIABLE_SCOPE SESSION @@ -1089,7 +1089,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3263,7 +3263,7 @@ +@@ -3305,7 +3305,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -1098,7 +1098,7 @@ VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3361,7 +3361,7 @@ +@@ -3403,7 +3403,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1073741824 VARIABLE_SCOPE GLOBAL @@ -1107,7 +1107,7 @@ VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave. NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -3375,7 +3375,7 @@ +@@ -3417,7 +3417,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2 VARIABLE_SCOPE GLOBAL @@ -1116,7 +1116,7 @@ VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -3434,7 +3434,7 @@ +@@ -3476,7 +3476,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size NUMERIC_MIN_VALUE 1024 @@ -1125,7 +1125,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3711,7 +3711,7 @@ +@@ -3753,7 +3753,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 256 VARIABLE_SCOPE GLOBAL @@ -1134,7 +1134,7 @@ VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 524288 -@@ -3781,7 +3781,7 @@ +@@ -3823,7 +3823,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 400 VARIABLE_SCOPE GLOBAL @@ -1143,7 +1143,7 @@ VARIABLE_COMMENT The number of cached table definitions NUMERIC_MIN_VALUE 400 NUMERIC_MAX_VALUE 524288 -@@ -3795,7 +3795,7 @@ +@@ -3837,7 +3837,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL @@ -1152,7 +1152,7 @@ VARIABLE_COMMENT The number of cached open tables NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 524288 -@@ -3809,7 +3809,7 @@ +@@ -3851,7 +3851,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1161,7 +1161,7 @@ VARIABLE_COMMENT How many threads we should keep in a cache for reuse NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -3823,7 +3823,7 @@ +@@ -3865,7 +3865,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -1170,7 +1170,7 @@ VARIABLE_COMMENT Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.This variable has no effect, and is deprecated. It will be removed in a future release. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 -@@ -3938,7 +3938,7 @@ +@@ -3980,7 +3980,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM or Aria table NUMERIC_MIN_VALUE 1024 @@ -1179,7 +1179,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3949,7 +3949,7 @@ +@@ -3991,7 +3991,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8192 VARIABLE_SCOPE SESSION @@ -1188,7 +1188,7 @@ VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -3963,7 +3963,7 @@ +@@ -4005,7 +4005,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE SESSION @@ -1197,7 +1197,7 @@ VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -4061,7 +4061,7 @@ +@@ -4103,7 +4103,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 28800 VARIABLE_SCOPE SESSION @@ -1206,7 +1206,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -4165,7 +4165,7 @@ +@@ -4207,7 +4207,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME OPEN_FILES_LIMIT VARIABLE_SCOPE GLOBAL @@ -1215,7 +1215,7 @@ VARIABLE_COMMENT If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of file descriptors NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -4178,7 +4178,7 @@ +@@ -4220,7 +4220,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1224,7 +1224,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4188,7 +4188,7 @@ +@@ -4230,7 +4230,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1233,7 +1233,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4273,7 +4273,7 @@ +@@ -4315,7 +4315,7 @@ VARIABLE_NAME LOG_TC_SIZE GLOBAL_VALUE_ORIGIN AUTO VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index fd003588668..b5676810987 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -1661,6 +1661,20 @@ NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME LOG_SLOW_ADMIN_STATEMENTS +SESSION_VALUE NULL +GLOBAL_VALUE OFF +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE OFF +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Log slow OPTIMIZE, ANALYZE, ALTER and other administrative statements to the slow log if it is open. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME LOG_SLOW_FILTER SESSION_VALUE admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk GLOBAL_VALUE admin,filesort,filesort_on_disk,full_join,full_scan,query_cache,query_cache_miss,tmp_table,tmp_table_on_disk @@ -1689,6 +1703,20 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME LOG_SLOW_SLAVE_STATEMENTS +SESSION_VALUE NULL +GLOBAL_VALUE OFF +GLOBAL_VALUE_ORIGIN COMPILE-TIME +DEFAULT_VALUE OFF +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BOOLEAN +VARIABLE_COMMENT Log slow statements executed by slave thread to the slow log if it is open. +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL +ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME LOG_SLOW_VERBOSITY SESSION_VALUE GLOBAL_VALUE diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff index e87f2647f69..6661ea288fd 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded,32bit.rdiff @@ -1,5 +1,5 @@ ---- suite/sys_vars/r/sysvars_server_notembedded.result -+++ suite/sys_vars/r/sysvars_server_notembedded,32bit.reject +--- suite/sys_vars/r/sysvars_server_notembedded.result 2016-03-22 21:25:49.000000000 +0100 ++++ suite/sys_vars/r/sysvars_server_notembedded.reject 2016-03-23 01:11:50.000000000 +0100 @@ -57,7 +57,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 1 @@ -179,7 +179,7 @@ VARIABLE_COMMENT If non-zero, binary logs will be purged after expire_logs_days days; possible purges happen at startup and at binary log rotation NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 99 -@@ -841,7 +841,7 @@ +@@ -855,7 +855,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -188,7 +188,7 @@ VARIABLE_COMMENT The number of connections on extra-port NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100000 -@@ -883,7 +883,7 @@ +@@ -897,7 +897,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -197,7 +197,7 @@ VARIABLE_COMMENT A dedicated thread is created to flush all tables at the given interval NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -925,7 +925,7 @@ +@@ -939,7 +939,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 84 VARIABLE_SCOPE GLOBAL @@ -206,7 +206,7 @@ VARIABLE_COMMENT The maximum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 84 -@@ -939,7 +939,7 @@ +@@ -953,7 +953,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4 VARIABLE_SCOPE GLOBAL @@ -215,7 +215,7 @@ VARIABLE_COMMENT The minimum length of the word to be included in a FULLTEXT index. Note: FULLTEXT indexes must be rebuilt after changing this variable NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 84 -@@ -953,7 +953,7 @@ +@@ -967,7 +967,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 20 VARIABLE_SCOPE GLOBAL @@ -224,7 +224,7 @@ VARIABLE_COMMENT Number of best matches to use for query expansion NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1000 -@@ -1012,7 +1012,7 @@ +@@ -1026,7 +1026,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The maximum length of the result of function GROUP_CONCAT() NUMERIC_MIN_VALUE 4 @@ -233,7 +233,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1247,7 +1247,7 @@ +@@ -1261,7 +1261,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -242,7 +242,7 @@ VARIABLE_COMMENT Number of bytes used for a histogram. If set to 0, no histograms are created by ANALYZE. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -1275,7 +1275,7 @@ +@@ -1289,7 +1289,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 128 VARIABLE_SCOPE GLOBAL @@ -251,7 +251,7 @@ VARIABLE_COMMENT How many host names should be cached to avoid resolving. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65536 -@@ -1387,7 +1387,7 @@ +@@ -1401,7 +1401,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 28800 VARIABLE_SCOPE SESSION @@ -260,7 +260,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on an interactive connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -1418,7 +1418,7 @@ +@@ -1432,7 +1432,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the buffer that is used for joins NUMERIC_MIN_VALUE 128 @@ -269,7 +269,7 @@ NUMERIC_BLOCK_SIZE 128 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1443,7 +1443,7 @@ +@@ -1457,7 +1457,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2 VARIABLE_SCOPE SESSION @@ -278,7 +278,7 @@ VARIABLE_COMMENT Controls what join operations can be executed with join buffers. Odd numbers are used for plain join buffers while even numbers are used for linked buffers NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 8 -@@ -1474,7 +1474,7 @@ +@@ -1488,7 +1488,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the buffer used for index blocks for MyISAM tables. Increase this to get better index handling (for all reads and multiple writes) to as much as you can afford NUMERIC_MIN_VALUE 0 @@ -287,7 +287,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1695,7 +1695,7 @@ +@@ -1709,7 +1709,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 31536000 VARIABLE_SCOPE SESSION @@ -296,7 +296,7 @@ VARIABLE_COMMENT Timeout in seconds to wait for a lock before returning an error. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -1835,7 +1835,7 @@ +@@ -1863,7 +1863,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -305,7 +305,7 @@ VARIABLE_COMMENT Write to slow log every #th slow query. Set to 1 to log everything. Increase it to reduce the size of the slow or the performance impact of slow logging NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -1863,7 +1863,7 @@ +@@ -1905,7 +1905,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -314,7 +314,7 @@ VARIABLE_COMMENT Log some not critical warnings to the general log file.Value can be between 0 and 11. Higher values mean more verbosity NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -1919,7 +1919,7 @@ +@@ -1961,7 +1961,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4194304 VARIABLE_SCOPE SESSION @@ -323,7 +323,7 @@ VARIABLE_COMMENT Max packet length to send to or receive from the server NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -1929,14 +1929,14 @@ +@@ -1971,14 +1971,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_BINLOG_CACHE_SIZE SESSION_VALUE NULL @@ -341,7 +341,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1947,7 +1947,7 @@ +@@ -1989,7 +1989,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1073741824 VARIABLE_SCOPE GLOBAL @@ -350,7 +350,7 @@ VARIABLE_COMMENT Binary log will be rotated automatically when the size exceeds this value. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 1073741824 -@@ -1957,14 +1957,14 @@ +@@ -1999,14 +1999,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MAX_BINLOG_STMT_CACHE_SIZE SESSION_VALUE NULL @@ -368,7 +368,7 @@ NUMERIC_BLOCK_SIZE 4096 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1975,7 +1975,7 @@ +@@ -2017,7 +2017,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 151 VARIABLE_SCOPE GLOBAL @@ -377,7 +377,7 @@ VARIABLE_COMMENT The number of simultaneous clients allowed NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100000 -@@ -1989,7 +1989,7 @@ +@@ -2031,7 +2031,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -386,7 +386,7 @@ VARIABLE_COMMENT If there is more than this number of interrupted connections from a host this host will be blocked from further connections NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2003,7 +2003,7 @@ +@@ -2045,7 +2045,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 20 VARIABLE_SCOPE SESSION @@ -395,7 +395,7 @@ VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -2031,7 +2031,7 @@ +@@ -2073,7 +2073,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 64 VARIABLE_SCOPE SESSION @@ -404,7 +404,7 @@ VARIABLE_COMMENT Max number of errors/warnings to store for a statement NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 65535 -@@ -2048,7 +2048,7 @@ +@@ -2090,7 +2090,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Don't allow creation of heap tables bigger than this NUMERIC_MIN_VALUE 16384 @@ -413,7 +413,7 @@ NUMERIC_BLOCK_SIZE 1024 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2059,7 +2059,7 @@ +@@ -2101,7 +2101,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 20 VARIABLE_SCOPE SESSION @@ -422,7 +422,7 @@ VARIABLE_COMMENT Don't start more than this number of threads to handle INSERT DELAYED statements. If set to zero INSERT DELAYED will be not used NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -2087,7 +2087,7 @@ +@@ -2129,7 +2129,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE SESSION @@ -431,7 +431,7 @@ VARIABLE_COMMENT Max number of bytes in sorted records NUMERIC_MIN_VALUE 4 NUMERIC_MAX_VALUE 8388608 -@@ -2101,7 +2101,7 @@ +@@ -2143,7 +2143,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -440,7 +440,7 @@ VARIABLE_COMMENT The maximum BLOB length to send to server from mysql_send_long_data API. Deprecated option; use max_allowed_packet instead. NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -2115,7 +2115,7 @@ +@@ -2157,7 +2157,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16382 VARIABLE_SCOPE GLOBAL @@ -449,7 +449,7 @@ VARIABLE_COMMENT Maximum number of prepared statements in the server NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2143,7 +2143,7 @@ +@@ -2185,7 +2185,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4294967295 VARIABLE_SCOPE SESSION @@ -458,7 +458,7 @@ VARIABLE_COMMENT Limit assumed max number of seeks when looking up rows based on a key NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2157,7 +2157,7 @@ +@@ -2199,7 +2199,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE SESSION @@ -467,7 +467,7 @@ VARIABLE_COMMENT The number of bytes to use when sorting BLOB or TEXT values (only the first max_sort_length bytes of each value are used; the rest are ignored) NUMERIC_MIN_VALUE 4 NUMERIC_MAX_VALUE 8388608 -@@ -2171,7 +2171,7 @@ +@@ -2213,7 +2213,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -476,7 +476,7 @@ VARIABLE_COMMENT Maximum stored procedure recursion depth NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 255 -@@ -2199,7 +2199,7 @@ +@@ -2241,7 +2241,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32 VARIABLE_SCOPE SESSION @@ -485,7 +485,7 @@ VARIABLE_COMMENT Unused, will be removed. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2227,7 +2227,7 @@ +@@ -2269,7 +2269,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4294967295 VARIABLE_SCOPE GLOBAL @@ -494,7 +494,7 @@ VARIABLE_COMMENT After this many write locks, allow some read locks to run in between NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2241,7 +2241,7 @@ +@@ -2283,7 +2283,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -503,7 +503,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1048576 -@@ -2255,7 +2255,7 @@ +@@ -2297,7 +2297,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8 VARIABLE_SCOPE GLOBAL @@ -512,7 +512,7 @@ VARIABLE_COMMENT Unused NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1024 -@@ -2269,7 +2269,7 @@ +@@ -2311,7 +2311,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -521,7 +521,7 @@ VARIABLE_COMMENT Don't write queries to slow log that examine fewer rows than that NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -2283,7 +2283,7 @@ +@@ -2325,7 +2325,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 262144 VARIABLE_SCOPE SESSION @@ -530,7 +530,7 @@ VARIABLE_COMMENT Size of buffer to use when using MRR with range access NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -2297,10 +2297,10 @@ +@@ -2339,10 +2339,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 256 VARIABLE_SCOPE SESSION @@ -543,7 +543,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2311,7 +2311,7 @@ +@@ -2353,7 +2353,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -552,7 +552,7 @@ VARIABLE_COMMENT Block size to be used for MyISAM index pages NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 16384 -@@ -2325,7 +2325,7 @@ +@@ -2367,7 +2367,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 6 VARIABLE_SCOPE GLOBAL @@ -561,7 +561,7 @@ VARIABLE_COMMENT Default pointer size to be used for MyISAM tables NUMERIC_MIN_VALUE 2 NUMERIC_MAX_VALUE 7 -@@ -2335,9 +2335,9 @@ +@@ -2377,9 +2377,9 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_MAX_SORT_FILE_SIZE SESSION_VALUE NULL @@ -573,7 +573,7 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Don't use the fast sort index method to created index if the temporary file would get bigger than this -@@ -2349,14 +2349,14 @@ +@@ -2391,14 +2391,14 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME MYISAM_MMAP_SIZE SESSION_VALUE NULL @@ -591,7 +591,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -2381,10 +2381,10 @@ +@@ -2423,10 +2423,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -604,7 +604,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2398,7 +2398,7 @@ +@@ -2440,7 +2440,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE NUMERIC_MIN_VALUE 4096 @@ -613,7 +613,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -2451,7 +2451,7 @@ +@@ -2493,7 +2493,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16384 VARIABLE_SCOPE SESSION @@ -622,7 +622,7 @@ VARIABLE_COMMENT Buffer length for TCP/IP and socket communication NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1048576 -@@ -2465,7 +2465,7 @@ +@@ -2507,7 +2507,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 30 VARIABLE_SCOPE SESSION @@ -631,7 +631,7 @@ VARIABLE_COMMENT Number of seconds to wait for more data from a connection before aborting the read NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2479,7 +2479,7 @@ +@@ -2521,7 +2521,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE SESSION @@ -640,7 +640,7 @@ VARIABLE_COMMENT If a read on a communication port is interrupted, retry this many times before giving up NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -2493,7 +2493,7 @@ +@@ -2535,7 +2535,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 60 VARIABLE_SCOPE SESSION @@ -649,7 +649,7 @@ VARIABLE_COMMENT Number of seconds to wait for a block to be written to a connection before aborting the write NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -2563,7 +2563,7 @@ +@@ -2605,7 +2605,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -658,7 +658,7 @@ VARIABLE_COMMENT Controls the heuristic(s) applied during query optimization to prune less-promising partial plans from the optimizer search space. Meaning: 0 - do not apply any heuristic, thus perform exhaustive search; 1 - prune plans based on number of retrieved rows NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1 -@@ -2577,7 +2577,7 @@ +@@ -2619,7 +2619,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 62 VARIABLE_SCOPE SESSION @@ -667,7 +667,7 @@ VARIABLE_COMMENT Maximum depth of search performed by the query optimizer. Values larger than the number of relations in a query result in better query plans, but take longer to compile a query. Values smaller than the number of tables in a relation result in faster optimization, but may produce very bad query plans. If set to 0, the system will automatically pick a reasonable value; if set to 63, the optimizer will switch to the original find_best search. NOTE: The value 63 and its associated behaviour is deprecated NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 63 -@@ -2591,7 +2591,7 @@ +@@ -2633,7 +2633,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE SESSION @@ -676,7 +676,7 @@ VARIABLE_COMMENT Controls number of record samples to check condition selectivity NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 4294967295 -@@ -2619,7 +2619,7 @@ +@@ -2661,7 +2661,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1 VARIABLE_SCOPE SESSION @@ -685,7 +685,7 @@ VARIABLE_COMMENT Controls selectivity of which conditions the optimizer takes into account to calculate cardinality of a partial join when it searches for the best execution plan Meaning: 1 - use selectivity of index backed range conditions to calculate the cardinality of a partial join if the last joined table is accessed by full table scan or an index scan, 2 - use selectivity of index backed range conditions to calculate the cardinality of a partial join in any case, 3 - additionally always use selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join, 4 - use histograms to calculate selectivity of range conditions that are not backed by any index to calculate the cardinality of a partial join.5 - additionally use selectivity of certain non-range predicates calculated on record samples NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 5 -@@ -2647,7 +2647,7 @@ +@@ -2689,7 +2689,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -694,7 +694,7 @@ VARIABLE_COMMENT Maximum number of instrumented user@host accounts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2661,7 +2661,7 @@ +@@ -2703,7 +2703,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -703,7 +703,7 @@ VARIABLE_COMMENT Size of the statement digest. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 200 -@@ -2675,7 +2675,7 @@ +@@ -2717,7 +2717,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -712,7 +712,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STAGES_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2689,7 +2689,7 @@ +@@ -2731,7 +2731,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -721,7 +721,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STAGES_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2703,7 +2703,7 @@ +@@ -2745,7 +2745,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -730,7 +730,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_STATEMENTS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2717,7 +2717,7 @@ +@@ -2759,7 +2759,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -739,7 +739,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_STATEMENTS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2731,7 +2731,7 @@ +@@ -2773,7 +2773,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -748,7 +748,7 @@ VARIABLE_COMMENT Number of rows in EVENTS_WAITS_HISTORY_LONG. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2745,7 +2745,7 @@ +@@ -2787,7 +2787,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -757,7 +757,7 @@ VARIABLE_COMMENT Number of rows per thread in EVENTS_WAITS_HISTORY. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1024 -@@ -2759,7 +2759,7 @@ +@@ -2801,7 +2801,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -766,7 +766,7 @@ VARIABLE_COMMENT Maximum number of instrumented hosts. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2773,7 +2773,7 @@ +@@ -2815,7 +2815,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 80 VARIABLE_SCOPE GLOBAL @@ -775,7 +775,7 @@ VARIABLE_COMMENT Maximum number of condition instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2787,7 +2787,7 @@ +@@ -2829,7 +2829,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -784,7 +784,7 @@ VARIABLE_COMMENT Maximum number of instrumented condition objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2801,7 +2801,7 @@ +@@ -2843,7 +2843,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1024 VARIABLE_SCOPE GLOBAL @@ -793,7 +793,7 @@ VARIABLE_COMMENT Maximum length considered for digest text, when stored in performance_schema tables. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2801,7 +2801,7 @@ +@@ -2857,7 +2857,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -802,7 +802,7 @@ VARIABLE_COMMENT Maximum number of file instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2815,7 +2815,7 @@ +@@ -2871,7 +2871,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32768 VARIABLE_SCOPE GLOBAL @@ -811,7 +811,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented files. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -2829,7 +2829,7 @@ +@@ -2885,7 +2885,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -820,7 +820,7 @@ VARIABLE_COMMENT Maximum number of instrumented files. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2843,7 +2843,7 @@ +@@ -2899,7 +2899,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 200 VARIABLE_SCOPE GLOBAL @@ -829,7 +829,7 @@ VARIABLE_COMMENT Maximum number of mutex instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2857,7 +2857,7 @@ +@@ -2913,7 +2913,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -838,7 +838,7 @@ VARIABLE_COMMENT Maximum number of instrumented MUTEX objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2871,7 +2871,7 @@ +@@ -2927,7 +2927,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 40 VARIABLE_SCOPE GLOBAL @@ -847,7 +847,7 @@ VARIABLE_COMMENT Maximum number of rwlock instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2885,7 +2885,7 @@ +@@ -2941,7 +2941,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -856,7 +856,7 @@ VARIABLE_COMMENT Maximum number of instrumented RWLOCK objects. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 104857600 -@@ -2899,7 +2899,7 @@ +@@ -2955,7 +2955,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -865,7 +865,7 @@ VARIABLE_COMMENT Maximum number of socket instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2913,7 +2913,7 @@ +@@ -2969,7 +2969,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -874,7 +874,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented sockets. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2927,7 +2927,7 @@ +@@ -2983,7 +2983,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 150 VARIABLE_SCOPE GLOBAL @@ -883,7 +883,7 @@ VARIABLE_COMMENT Maximum number of stage instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2941,7 +2941,7 @@ +@@ -2997,7 +2997,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 178 VARIABLE_SCOPE GLOBAL @@ -892,7 +892,7 @@ VARIABLE_COMMENT Maximum number of statement instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2955,7 +2955,7 @@ +@@ -3011,7 +3011,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -901,7 +901,7 @@ VARIABLE_COMMENT Maximum number of opened instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2969,7 +2969,7 @@ +@@ -3025,7 +3025,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -910,7 +910,7 @@ VARIABLE_COMMENT Maximum number of instrumented tables. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -2983,7 +2983,7 @@ +@@ -3039,7 +3039,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -919,7 +919,7 @@ VARIABLE_COMMENT Maximum number of thread instruments. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 256 -@@ -2997,7 +2997,7 @@ +@@ -3053,7 +3053,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -928,7 +928,7 @@ VARIABLE_COMMENT Maximum number of instrumented threads. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3011,7 +3011,7 @@ +@@ -3067,7 +3067,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -937,7 +937,7 @@ VARIABLE_COMMENT Size of session attribute string buffer per thread. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3025,7 +3025,7 @@ +@@ -3081,7 +3081,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -946,7 +946,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_ACTORS. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1024 -@@ -3039,7 +3039,7 @@ +@@ -3095,7 +3095,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 100 VARIABLE_SCOPE GLOBAL @@ -955,7 +955,7 @@ VARIABLE_COMMENT Maximum number of rows in SETUP_OBJECTS. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 -@@ -3053,7 +3053,7 @@ +@@ -3109,7 +3109,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE -1 VARIABLE_SCOPE GLOBAL @@ -964,7 +964,7 @@ VARIABLE_COMMENT Maximum number of instrumented users. Use 0 to disable, -1 for automated sizing. NUMERIC_MIN_VALUE -1 NUMERIC_MAX_VALUE 1048576 -@@ -3123,7 +3123,7 @@ +@@ -3179,7 +3179,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 32768 VARIABLE_SCOPE SESSION @@ -973,7 +973,7 @@ VARIABLE_COMMENT The size of the buffer that is allocated when preloading indexes NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -3151,7 +3151,7 @@ +@@ -3207,7 +3207,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 15 VARIABLE_SCOPE SESSION @@ -982,7 +982,7 @@ VARIABLE_COMMENT Limit of query profiling memory NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -3165,7 +3165,7 @@ +@@ -3221,7 +3221,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 5 VARIABLE_SCOPE SESSION @@ -991,7 +991,7 @@ VARIABLE_COMMENT Seconds between sending progress reports to the client for time-consuming statements. Set to 0 to disable progress reporting. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3221,10 +3221,10 @@ +@@ -3277,10 +3277,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION ONLY @@ -1004,7 +1004,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3235,7 +3235,7 @@ +@@ -3291,7 +3291,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 16384 VARIABLE_SCOPE SESSION @@ -1013,7 +1013,7 @@ VARIABLE_COMMENT Allocation block size for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -3249,7 +3249,7 @@ +@@ -3305,7 +3305,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -1022,7 +1022,7 @@ VARIABLE_COMMENT Don't cache results that are bigger than this NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3263,7 +3263,7 @@ +@@ -3319,7 +3319,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE GLOBAL @@ -1031,7 +1031,7 @@ VARIABLE_COMMENT The minimum size for blocks allocated by the query cache NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3280,7 +3280,7 @@ +@@ -3336,7 +3336,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The memory allocated to store results from old queries NUMERIC_MIN_VALUE 0 @@ -1040,7 +1040,7 @@ NUMERIC_BLOCK_SIZE 1024 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3333,7 +3333,7 @@ +@@ -3389,7 +3389,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 24576 VARIABLE_SCOPE SESSION @@ -1049,7 +1049,7 @@ VARIABLE_COMMENT Persistent buffer for query parsing and execution NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 4294967295 -@@ -3347,7 +3347,7 @@ +@@ -3403,7 +3403,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE SESSION @@ -1058,7 +1058,7 @@ VARIABLE_COMMENT Allocation block size for storing ranges during optimization NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 4294967295 -@@ -3361,7 +3361,7 @@ +@@ -3417,7 +3417,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 131072 VARIABLE_SCOPE SESSION @@ -1067,7 +1067,7 @@ VARIABLE_COMMENT Each thread that does a sequential scan allocates a buffer of this size for each table it scans. If you do many sequential scans, you may want to increase this value NUMERIC_MIN_VALUE 8192 NUMERIC_MAX_VALUE 2147483647 -@@ -3389,7 +3389,7 @@ +@@ -3445,7 +3445,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 262144 VARIABLE_SCOPE SESSION @@ -1076,7 +1076,7 @@ VARIABLE_COMMENT When reading rows in sorted order after a sort, the rows are read through this buffer to avoid a disk seeks NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 2147483647 -@@ -3669,10 +3669,10 @@ +@@ -3725,10 +3725,10 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8388608 VARIABLE_SCOPE SESSION @@ -1089,7 +1089,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -3711,7 +3711,7 @@ +@@ -3767,7 +3767,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 0 VARIABLE_SCOPE SESSION @@ -1098,7 +1098,7 @@ VARIABLE_COMMENT Uniquely identifies the server instance in the community of replication partners NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -3837,7 +3837,7 @@ +@@ -3893,7 +3893,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1107,7 +1107,7 @@ VARIABLE_COMMENT Maximum number of parallel threads to use on slave for events in a single replication domain. When using multiple domains, this can be used to limit a single domain from grabbing all threads and thus stalling other domains. The default of 0 means to allow a domain to grab as many threads as it wants, up to the value of slave_parallel_threads. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16383 -@@ -3879,7 +3879,7 @@ +@@ -3935,7 +3935,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 1073741824 VARIABLE_SCOPE GLOBAL @@ -1116,7 +1116,7 @@ VARIABLE_COMMENT The maximum packet length to sent successfully from the master to slave. NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 1073741824 -@@ -3907,7 +3907,7 @@ +@@ -3963,7 +3963,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 131072 VARIABLE_SCOPE GLOBAL @@ -1125,7 +1125,7 @@ VARIABLE_COMMENT Limit on how much memory SQL threads should use per parallel replication thread when reading ahead in the relay log looking for opportunities for parallel replication. Only used when --slave-parallel-threads > 0. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2147483647 -@@ -3935,7 +3935,7 @@ +@@ -3991,7 +3991,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1134,7 +1134,7 @@ VARIABLE_COMMENT If non-zero, number of threads to spawn to apply in parallel events on the slave that were group-committed on the master or were logged with GTID in different replication domains. Note that these threads are in addition to the IO and SQL threads, which are always created by a replication slave NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16383 -@@ -3991,7 +3991,7 @@ +@@ -4047,7 +4047,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -1143,7 +1143,7 @@ VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout, before giving up and stopping NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -4019,7 +4019,7 @@ +@@ -4075,7 +4075,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2 VARIABLE_SCOPE GLOBAL @@ -1152,7 +1152,7 @@ VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 31536000 -@@ -4078,7 +4078,7 @@ +@@ -4134,7 +4134,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size NUMERIC_MIN_VALUE 1024 @@ -1161,7 +1161,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4369,7 +4369,7 @@ +@@ -4425,7 +4425,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 256 VARIABLE_SCOPE GLOBAL @@ -1170,7 +1170,7 @@ VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 524288 -@@ -4467,7 +4467,7 @@ +@@ -4523,7 +4523,7 @@ GLOBAL_VALUE_ORIGIN AUTO DEFAULT_VALUE 400 VARIABLE_SCOPE GLOBAL @@ -1179,7 +1179,7 @@ VARIABLE_COMMENT The number of cached table definitions NUMERIC_MIN_VALUE 400 NUMERIC_MAX_VALUE 524288 -@@ -4481,7 +4481,7 @@ +@@ -4537,7 +4537,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL @@ -1188,7 +1188,7 @@ VARIABLE_COMMENT The number of cached open tables NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 524288 -@@ -4495,7 +4495,7 @@ +@@ -4551,7 +4551,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -1197,7 +1197,7 @@ VARIABLE_COMMENT How many threads we should keep in a cache for reuse NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16384 -@@ -4509,7 +4509,7 @@ +@@ -4565,7 +4565,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 10 VARIABLE_SCOPE GLOBAL @@ -1206,7 +1206,7 @@ VARIABLE_COMMENT Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.This variable has no effect, and is deprecated. It will be removed in a future release. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 -@@ -4694,7 +4694,7 @@ +@@ -4750,7 +4750,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MySQL will automatically convert it to an on-disk MyISAM or Aria table NUMERIC_MIN_VALUE 1024 @@ -1215,7 +1215,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4705,7 +4705,7 @@ +@@ -4761,7 +4761,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 8192 VARIABLE_SCOPE SESSION @@ -1224,7 +1224,7 @@ VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -4719,7 +4719,7 @@ +@@ -4775,7 +4775,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 4096 VARIABLE_SCOPE SESSION @@ -1233,7 +1233,7 @@ VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log NUMERIC_MIN_VALUE 1024 NUMERIC_MAX_VALUE 134217728 -@@ -4817,7 +4817,7 @@ +@@ -4873,7 +4873,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 28800 VARIABLE_SCOPE SESSION @@ -1242,7 +1242,7 @@ VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 31536000 -@@ -4921,7 +4921,7 @@ +@@ -4977,7 +4977,7 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME OPEN_FILES_LIMIT VARIABLE_SCOPE GLOBAL @@ -1251,7 +1251,7 @@ VARIABLE_COMMENT If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of file descriptors NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 4294967295 -@@ -4934,7 +4934,7 @@ +@@ -4990,7 +4990,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1260,7 +1260,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -4944,7 +4944,7 @@ +@@ -5000,7 +5000,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes NUMERIC_MIN_VALUE 0 @@ -1269,7 +1269,7 @@ NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -5029,7 +5029,7 @@ +@@ -5085,7 +5085,7 @@ VARIABLE_NAME LOG_TC_SIZE GLOBAL_VALUE_ORIGIN AUTO VARIABLE_SCOPE GLOBAL -- cgit v1.2.1 From e4435b5ec304be1439475f6f6084fbf9f1fd9e1f Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 23 Mar 2016 08:26:40 +0400 Subject: MDEV-9604 crash in Item::save_in_field with empty enum value 1. Fixing Field_time::get_equal_const_item() to pass TIME_FUZZY_DATES and TIME_INVALID_DATES to get_time_with_conversion(). This is needed to make the recursively called Item::get_date() return non-NULL values on garbage input. This makes Field_time::get_equal_const_item() work consistently with how Item::val_time_packed() works. 2. Fixing Item::get_date() to return TIME'00:00:00' rather than DATE'0000-00-00' on empty or garbage input when: - TIME_FUZZY_DATES is enabled - The caller requested a TIME value (by passing TIME_TIME_ONLY). This is needed to avoid conversion of DATE'0000-00-00' to TIME in get_time_with_conversion(), which would erroneously try to subtract CURRENT_DATE from DATE'0000-00-00' and return TIME'-838:59:59' rather than the desired zero value TIME'00:00:00'. #1 and #2 fix these type of scripts to return one row with both MyISAM and InnoDB, with and without an index on t1.b: CREATE TABLE t1 (a ENUM('a'), b TIME, c INT, KEY(b)); INSERT INTO t1 VALUES ('','00:00:00',0); SELECT * FROM t1 WHERE b=''; SELECT * FROM t1 WHERE a=b; SELECT * FROM t1 IGNORE INDEX(b) WHERE b=''; SELECT * FROM t1 IGNORE INDEX(b) WHERE a=b; Additionally, #1 and #2 fix the originally reported in MDEV-9604 crash in Item::save_in_field(), because now execution goes through a different path, so save_in_field() is called for a Item_time_literal instance (which is non-NULL) rather than a Item_cache_str instance (which could return NULL without setting null_value). 3. Fixing Field_temporal::get_equal_const_item_datetime() to enable equal field propagation for DATETIME and TIMESTAMP in case of comparison (e.g. when ANY_SUBST), for symmetry with Field_newdate::get_equal_const_item(). This fixes a number of problems with empty set returned on comparison to empty/garbage input. Now all SELECT queries in this script return one row for MyISAM and InnoDB, with and without an index on t1.b: CREATE TABLE t1 (a ENUM('a'), b DATETIME, c INT, KEY(b)); INSERT INTO t1 VALUES ('','0000-00-00 00:00:00',0); SELECT * FROM t1 WHERE b=''; SELECT * FROM t1 WHERE a=b; SELECT * FROM t1 IGNORE INDEX(b) WHERE b=''; SELECT * FROM t1 IGNORE INDEX(b) WHERE a=b; --- mysql-test/r/type_datetime.result | 17 ++-- mysql-test/r/type_temporal_innodb.result | 156 +++++++++++++++++++++++++++++++ mysql-test/r/type_timestamp.result | 15 ++- mysql-test/t/type_temporal_innodb.test | 60 ++++++++++++ sql/field.cc | 17 +++- sql/item.cc | 16 ++++ 6 files changed, 263 insertions(+), 18 deletions(-) create mode 100644 mysql-test/r/type_temporal_innodb.result create mode 100644 mysql-test/t/type_temporal_innodb.test diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result index 155e9535a0a..16990c2414d 100644 --- a/mysql-test/r/type_datetime.result +++ b/mysql-test/r/type_datetime.result @@ -747,7 +747,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 FORCE INDEX(attime) WHERE AtTime = '2010-02-22 id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ref AtTime AtTime 6 const 1 100.00 Warnings: -Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from `test`.`t1` FORCE INDEX (`attime`) where (`test`.`t1`.`AtTime` = '2010-02-22 18:40:07') +Note 1003 select `test`.`t1`.`Id` AS `Id`,`test`.`t1`.`AtTime` AS `AtTime` from `test`.`t1` FORCE INDEX (`attime`) where (`test`.`t1`.`AtTime` = TIMESTAMP'2010-02-22 18:40:07') DROP TABLE t1; SET NAMES latin1; # @@ -963,21 +963,20 @@ a 2001-01-01 00:00:00 Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' -Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a) != 20 AND a='2001-01-01 00:00:00x'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '2001-01-01 00:00:00x') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=30+RAND() AND a='2001-01-01 00:00:00x'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '2001-01-01 00:00:00x') and ((length(TIMESTAMP'2001-01-01 00:00:00')) <> (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) <> (30 + rand()))) DROP TABLE t1; CREATE TABLE t1 (a DATETIME);; INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); @@ -993,20 +992,20 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = ' 2001-01-01 00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=19+RAND() AND a=' 2001-01-01 00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' 2001-01-01 00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) = (19 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) = (19 + rand()))) EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' garbage '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Incorrect datetime value: ' garbage ' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' garbage ') and (length(`test`.`t1`.`a`) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00') and ((length(TIMESTAMP'0000-00-00 00:00:00')) = (30 + rand()))) DROP TABLE t1; CREATE TABLE t1 (a DATETIME);; INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); @@ -1076,13 +1075,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIME'00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) = (40 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) = (40 + rand()))) DROP TABLE t1; # # MDEV-8795 Equal expression propagation does not work for temporal literals diff --git a/mysql-test/r/type_temporal_innodb.result b/mysql-test/r/type_temporal_innodb.result new file mode 100644 index 00000000000..425e499a5d3 --- /dev/null +++ b/mysql-test/r/type_temporal_innodb.result @@ -0,0 +1,156 @@ +# +# MDEV-9604 crash in Item::save_in_field with empty enum value +# +SELECT TIME'00:00:00'=''; +TIME'00:00:00'='' +1 +Warnings: +Warning 1292 Truncated incorrect time value: '' +CREATE TABLE t1 (a ENUM('a'), b TIME, c INT, KEY(b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('','00:00:00',0); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +SELECT * FROM t1 WHERE b=''; +a b c + 00:00:00 0 +Warnings: +Warning 1292 Truncated incorrect time value: '' +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +a b c + 00:00:00 0 +Warnings: +Warning 1292 Truncated incorrect time value: '' +SELECT * FROM t1 WHERE a=b; +a b c + 00:00:00 0 +Warnings: +Warning 1292 Truncated incorrect time value: '' +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +1 +1 +Warnings: +Warning 1292 Truncated incorrect time value: '' +ALTER TABLE t1 ENGINE=MyISAM; +SELECT * FROM t1 WHERE b=''; +a b c + 00:00:00 0 +Warnings: +Warning 1292 Truncated incorrect time value: '' +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +a b c + 00:00:00 0 +Warnings: +Warning 1292 Truncated incorrect time value: '' +SELECT * FROM t1 WHERE a=b; +a b c + 00:00:00 0 +Warnings: +Warning 1292 Truncated incorrect time value: '' +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +1 +1 +Warnings: +Warning 1292 Truncated incorrect time value: '' +DROP TABLE t1; +SELECT DATE'0000-00-00'=''; +DATE'0000-00-00'='' +1 +Warnings: +Warning 1292 Incorrect datetime value: '' +CREATE TABLE t1 (a ENUM('a'), b DATE, c INT, KEY(b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('','0000-00-00',0); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +SELECT * FROM t1 WHERE b=''; +a b c + 0000-00-00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +a b c + 0000-00-00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 WHERE a=b; +a b c + 0000-00-00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +1 +1 +Warnings: +Warning 1292 Incorrect datetime value: '' +ALTER TABLE t1 ENGINE=MyISAM; +SELECT * FROM t1 WHERE b=''; +a b c + 0000-00-00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +a b c + 0000-00-00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 WHERE a=b; +a b c + 0000-00-00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +1 +1 +Warnings: +Warning 1292 Incorrect datetime value: '' +DROP TABLE t1; +SELECT TIMESTAMP'0000-00-00 00:00:00'=''; +TIMESTAMP'0000-00-00 00:00:00'='' +1 +Warnings: +Warning 1292 Incorrect datetime value: '' +CREATE TABLE t1 (a ENUM('a'), b DATETIME, c INT, KEY(b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('','0000-00-00 00:00:00',0); +Warnings: +Warning 1265 Data truncated for column 'a' at row 1 +SELECT * FROM t1 WHERE b=''; +a b c + 0000-00-00 00:00:00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +a b c + 0000-00-00 00:00:00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 WHERE a=b; +a b c + 0000-00-00 00:00:00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +1 +1 +Warnings: +Warning 1292 Incorrect datetime value: '' +ALTER TABLE t1 ENGINE=MyISAM; +SELECT * FROM t1 WHERE b=''; +a b c + 0000-00-00 00:00:00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +a b c + 0000-00-00 00:00:00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT * FROM t1 WHERE a=b; +a b c + 0000-00-00 00:00:00 0 +Warnings: +Warning 1292 Incorrect datetime value: '' +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +1 +1 +Warnings: +Warning 1292 Incorrect datetime value: '' +DROP TABLE t1; diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result index fcdef627ded..a579f6930a0 100644 --- a/mysql-test/r/type_timestamp.result +++ b/mysql-test/r/type_timestamp.result @@ -818,21 +818,20 @@ a 2001-01-01 00:00:00 Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' -Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a) != 20 AND a='2001-01-01 00:00:00x'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = '2001-01-01 00:00:00x') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)!=30+RAND() AND a='2001-01-01 00:00:00x'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Truncated incorrect datetime value: '2001-01-01 00:00:00x' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = '2001-01-01 00:00:00x') and ((length(TIMESTAMP'2001-01-01 00:00:00')) <> (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) <> (30 + rand()))) DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP);; INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); @@ -848,20 +847,20 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=' 2001-01-01 00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = ' 2001-01-01 00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=19+RAND() AND a=' 2001-01-01 00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' 2001-01-01 00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) = (19 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) = (19 + rand()))) EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' garbage '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Warning 1292 Incorrect datetime value: ' garbage ' -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = ' garbage ') and (length(`test`.`t1`.`a`) = (30 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00') and ((length(TIMESTAMP'0000-00-00 00:00:00')) = (30 + rand()))) DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP);; INSERT INTO t1 VALUES ('2001-01-01 00:00:00'),('2001-01-01 00:00:01'); @@ -931,13 +930,13 @@ SELECT * FROM t1 WHERE LENGTH(a)=19 AND a=TIME'00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIME'00:00:00') +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where (`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(a)=40+RAND() AND a=TIME'00:00:00'; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIME'00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) = (40 + rand()))) +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where ((`test`.`t1`.`a` = TIMESTAMP'2001-01-01 00:00:00') and ((length(TIMESTAMP'2001-01-01 00:00:00')) = (40 + rand()))) DROP TABLE t1; # # End of 10.1 tests diff --git a/mysql-test/t/type_temporal_innodb.test b/mysql-test/t/type_temporal_innodb.test new file mode 100644 index 00000000000..ac5daca6508 --- /dev/null +++ b/mysql-test/t/type_temporal_innodb.test @@ -0,0 +1,60 @@ +--source include/have_innodb.inc + +# +# testing of temporal data types with InnoDB +# + + +--echo # +--echo # MDEV-9604 crash in Item::save_in_field with empty enum value +--echo # + +SELECT TIME'00:00:00'=''; + +CREATE TABLE t1 (a ENUM('a'), b TIME, c INT, KEY(b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('','00:00:00',0); +SELECT * FROM t1 WHERE b=''; +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +SELECT * FROM t1 WHERE a=b; +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; + +ALTER TABLE t1 ENGINE=MyISAM; +SELECT * FROM t1 WHERE b=''; +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +SELECT * FROM t1 WHERE a=b; +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +DROP TABLE t1; + + +SELECT DATE'0000-00-00'=''; + +CREATE TABLE t1 (a ENUM('a'), b DATE, c INT, KEY(b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('','0000-00-00',0); +SELECT * FROM t1 WHERE b=''; +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +SELECT * FROM t1 WHERE a=b; +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; + +ALTER TABLE t1 ENGINE=MyISAM; +SELECT * FROM t1 WHERE b=''; +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +SELECT * FROM t1 WHERE a=b; +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +DROP TABLE t1; + + +SELECT TIMESTAMP'0000-00-00 00:00:00'=''; + +CREATE TABLE t1 (a ENUM('a'), b DATETIME, c INT, KEY(b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES ('','0000-00-00 00:00:00',0); +SELECT * FROM t1 WHERE b=''; +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +SELECT * FROM t1 WHERE a=b; +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; + +ALTER TABLE t1 ENGINE=MyISAM; +SELECT * FROM t1 WHERE b=''; +SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; +SELECT * FROM t1 WHERE a=b; +SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; +DROP TABLE t1; diff --git a/sql/field.cc b/sql/field.cc index 895f8a00f10..ffa7beb275b 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -5624,6 +5624,18 @@ Item *Field_temporal::get_equal_const_item_datetime(THD *thd, } break; case ANY_SUBST: + if (!is_temporal_type_with_date(const_item->field_type())) + { + MYSQL_TIME ltime; + if (const_item->get_date_with_conversion(<ime, + TIME_FUZZY_DATES | + TIME_INVALID_DATES)) + return NULL; + return new (thd->mem_root) + Item_datetime_literal_for_invalid_dates(thd, <ime, + ltime.second_part ? + TIME_SECOND_PART_DIGITS : 0); + } break; } return const_item; @@ -5932,7 +5944,10 @@ Item *Field_time::get_equal_const_item(THD *thd, const Context &ctx, { MYSQL_TIME ltime; // Get the value of const_item with conversion from DATETIME to TIME - if (const_item->get_time_with_conversion(thd, <ime, TIME_TIME_ONLY)) + if (const_item->get_time_with_conversion(thd, <ime, + TIME_TIME_ONLY | + TIME_FUZZY_DATES | + TIME_INVALID_DATES)) return NULL; /* Replace a DATE/DATETIME constant to a TIME constant: diff --git a/sql/item.cc b/sql/item.cc index 7313c5f2b27..f1362e7e5da 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1301,6 +1301,22 @@ err: if allowed, otherwise - null. */ bzero((char*) ltime,sizeof(*ltime)); + if (fuzzydate & TIME_TIME_ONLY) + { + /* + In the following scenario: + - The caller expected to get a TIME value + - Item returned a not NULL string or numeric value + - But then conversion from string or number to TIME failed + we need to change the default time_type from MYSQL_TIMESTAMP_DATE + (which was set in bzero) to MYSQL_TIMESTAMP_TIME and therefore + return TIME'00:00:00' rather than DATE'0000-00-00'. + If we don't do this, methods like Item::get_time_with_conversion() + will erroneously subtract CURRENT_DATE from '0000-00-00 00:00:00' + and return TIME'-838:59:59' instead of TIME'00:00:00' as a result. + */ + ltime->time_type= MYSQL_TIMESTAMP_TIME; + } return null_value|= !(fuzzydate & TIME_FUZZY_DATES); } -- cgit v1.2.1 From 2783fc7d14bc8ad16acfeb509d3b19615023f47a Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 23 Mar 2016 12:16:39 +0400 Subject: MDEV-717 LP:1003679 - Wrong binlog order on concurrent DROP schema and CREATE function. The cause of the issue is when DROP DATABASE takes metadata lock and is in progress through it's execution, a concurrently running CREATE FUNCTION checks for the existence of database which it succeeds and then it waits on the metadata lock. Once DROP DATABASE writes to BINLOG and finally releases the metadata lock on schema object, the CREATE FUNCTION waiting on metadata lock gets in it's code path and succeeds and writes to binlog. --- .../binlog/r/binlog_concurrent_drop_create.result | 52 +++++++++++++ .../binlog/t/binlog_concurrent_drop_create.test | 85 ++++++++++++++++++++++ sql/events.cc | 29 ++++++-- sql/sp.cc | 79 +++++++++++++------- sql/sp.h | 2 +- sql/sql_parse.cc | 54 ++------------ 6 files changed, 219 insertions(+), 82 deletions(-) create mode 100644 mysql-test/suite/binlog/r/binlog_concurrent_drop_create.result create mode 100644 mysql-test/suite/binlog/t/binlog_concurrent_drop_create.test diff --git a/mysql-test/suite/binlog/r/binlog_concurrent_drop_create.result b/mysql-test/suite/binlog/r/binlog_concurrent_drop_create.result new file mode 100644 index 00000000000..8db1dc4b75e --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_concurrent_drop_create.result @@ -0,0 +1,52 @@ +include/master-slave.inc +[connection master] +RESET MASTER; +DROP DATABASE IF EXISTS db_717; +DROP EVENT IF EXISTS test.e_x1; +set @saved_global_binlog_format = @@global.binlog_format; +set @saved_local_binlog_format = @@session.binlog_format; +SET GLOBAL BINLOG_FORMAT = STATEMENT; +SET SESSION BINLOG_FORMAT = STATEMENT; +CREATE DATABASE db_717; +CREATE FUNCTION db_717.f1() RETURNS INT RETURN 1; +DROP DATABASE db_717; +CREATE FUNCTION db_717.f2() RETURNS INT RETURN 1; +CREATE DATABASE db_717; +CREATE EVENT db_717.e_x1 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int); +DROP DATABASE db_717; +CREATE EVENT db_717.e_x2 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int); +CREATE DATABASE db_717; +CREATE EVENT test.e_x1 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int); +DROP DATABASE db_717; +ALTER EVENT test.e_x1 RENAME TO db_717.e_x2; +DROP EVENT test.e_x1; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # DROP DATABASE IF EXISTS db_717 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP EVENT IF EXISTS test.e_x1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # CREATE DATABASE db_717 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` FUNCTION `db_717`.`f1`() RETURNS int(11) +RETURN 1 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # DROP DATABASE db_717 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # CREATE DATABASE db_717 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` EVENT db_717.e_x1 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # DROP DATABASE db_717 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # CREATE DATABASE db_717 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` EVENT test.e_x1 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # DROP DATABASE db_717 +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP EVENT test.e_x1 +SET GLOBAL BINLOG_FORMAT = @saved_global_binlog_format; +SET SESSION BINLOG_FORMAT = @saved_local_binlog_format; +include/rpl_end.inc diff --git a/mysql-test/suite/binlog/t/binlog_concurrent_drop_create.test b/mysql-test/suite/binlog/t/binlog_concurrent_drop_create.test new file mode 100644 index 00000000000..c885a7291f7 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_concurrent_drop_create.test @@ -0,0 +1,85 @@ +# MDEV-717 +# DROP DATABASE and CREATE PROCEDURE|FUNCTION|EVENT +# statements can appear in wrong order in the binlog. +# +# Note - the test can be undeterministic. + +--source include/master-slave.inc +RESET MASTER; + +--disable_warnings +DROP DATABASE IF EXISTS db_717; +DROP EVENT IF EXISTS test.e_x1; +--enable_warnings + +set @saved_global_binlog_format = @@global.binlog_format; +set @saved_local_binlog_format = @@session.binlog_format; +SET GLOBAL BINLOG_FORMAT = STATEMENT; +SET SESSION BINLOG_FORMAT = STATEMENT; + +# test function creation +CREATE DATABASE db_717; + +CREATE FUNCTION db_717.f1() RETURNS INT RETURN 1; + +--send + +DROP DATABASE db_717; + +--connection master1 + +--error 0,ER_BAD_DB_ERROR + +CREATE FUNCTION db_717.f2() RETURNS INT RETURN 1; + +--connection master + +--reap + +# test event creation +CREATE DATABASE db_717; + +CREATE EVENT db_717.e_x1 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int); + +--send + +DROP DATABASE db_717; + +--connection master1 + +--error 0,ER_BAD_DB_ERROR + +CREATE EVENT db_717.e_x2 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int); + +--connection master + +--reap + +# test event modification +CREATE DATABASE db_717; + +CREATE EVENT test.e_x1 ON SCHEDULE EVERY 1000 HOUR DO CREATE TABLE t1(id int); + +--send + +DROP DATABASE db_717; + +--connection master1 + +--error 0,ER_BAD_DB_ERROR + +ALTER EVENT test.e_x1 RENAME TO db_717.e_x2; + +--connection master + +--reap + +DROP EVENT test.e_x1; + +source include/show_binlog_events.inc; + +SET GLOBAL BINLOG_FORMAT = @saved_global_binlog_format; +SET SESSION BINLOG_FORMAT = @saved_local_binlog_format; + +--source include/rpl_end.inc + diff --git a/sql/events.cc b/sql/events.cc index b80ec993ac4..77dbb8b82e5 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -333,6 +333,10 @@ Events::create_event(THD *thd, Event_parse_data *parse_data) if (check_access(thd, EVENT_ACL, parse_data->dbname.str, NULL, NULL, 0, 0)) DBUG_RETURN(TRUE); + if (lock_object_name(thd, MDL_key::EVENT, + parse_data->dbname.str, parse_data->name.str)) + DBUG_RETURN(TRUE); + if (check_db_dir_existence(parse_data->dbname.str)) { my_error(ER_BAD_DB_ERROR, MYF(0), parse_data->dbname.str); @@ -347,10 +351,6 @@ Events::create_event(THD *thd, Event_parse_data *parse_data) */ save_binlog_format= thd->set_current_stmt_binlog_format_stmt(); - if (lock_object_name(thd, MDL_key::EVENT, - parse_data->dbname.str, parse_data->name.str)) - DBUG_RETURN(TRUE); - if (thd->lex->create_info.or_replace() && event_queue) event_queue->drop_event(thd, parse_data->dbname, parse_data->name); @@ -454,6 +454,16 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, if (check_access(thd, EVENT_ACL, parse_data->dbname.str, NULL, NULL, 0, 0)) DBUG_RETURN(TRUE); + if (lock_object_name(thd, MDL_key::EVENT, + parse_data->dbname.str, parse_data->name.str)) + DBUG_RETURN(TRUE); + + if (check_db_dir_existence(parse_data->dbname.str)) + { + my_error(ER_BAD_DB_ERROR, MYF(0), parse_data->dbname.str); + DBUG_RETURN(TRUE); + } + if (new_dbname) /* It's a rename */ { @@ -476,6 +486,13 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, if (check_access(thd, EVENT_ACL, new_dbname->str, NULL, NULL, 0, 0)) DBUG_RETURN(TRUE); + /* + Acquire mdl exclusive lock on target database name. + */ + if (lock_object_name(thd, MDL_key::EVENT, + new_dbname->str, new_name->str)) + DBUG_RETURN(TRUE); + /* Check that the target database exists */ if (check_db_dir_existence(new_dbname->str)) { @@ -490,10 +507,6 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, */ save_binlog_format= thd->set_current_stmt_binlog_format_stmt(); - if (lock_object_name(thd, MDL_key::EVENT, - parse_data->dbname.str, parse_data->name.str)) - DBUG_RETURN(TRUE); - /* On error conditions my_error() is called so no need to handle here */ if (!(ret= db_repository->update_event(thd, parse_data, new_dbname, new_name))) diff --git a/sql/sp.cc b/sql/sp.cc index 6ec59143720..3cc24089c40 100644 --- a/sql/sp.cc +++ b/sql/sp.cc @@ -34,6 +34,10 @@ #include +/* Used in error handling only */ +#define SP_TYPE_STRING(type) \ + (type == TYPE_ENUM_FUNCTION ? "FUNCTION" : "PROCEDURE") + static int db_load_routine(THD *thd, stored_procedure_type type, sp_name *name, sp_head **sphp, @@ -1007,15 +1011,16 @@ sp_drop_routine_internal(THD *thd, stored_procedure_type type, followed by an implicit grant (sp_grant_privileges()) and this subsequent call opens and closes mysql.procs_priv. - @return Error code. SP_OK is returned on success. Other - SP_ constants are used to indicate about errors. + @return Error status. + @retval FALSE on success + @retval TRUE on error */ -int +bool sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp) { LEX *lex= thd->lex; - int ret; + bool ret= TRUE; TABLE *table; char definer_buf[USER_HOST_BUFF_SIZE]; LEX_STRING definer; @@ -1040,7 +1045,22 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp) /* Grab an exclusive MDL lock. */ if (lock_object_name(thd, mdl_type, sp->m_db.str, sp->m_name.str)) - DBUG_RETURN(SP_OPEN_TABLE_FAILED); + { + my_error(ER_BAD_DB_ERROR, MYF(0), sp->m_db.str); + DBUG_RETURN(TRUE); + } + + /* + Check that a database directory with this name + exists. Design note: This won't work on virtual databases + like information_schema. + */ + if (check_db_dir_existence(sp->m_db.str)) + { + my_error(ER_BAD_DB_ERROR, MYF(0), sp->m_db.str); + DBUG_RETURN(TRUE); + } + /* Reset sql_mode during data dictionary operations. */ thd->variables.sql_mode= 0; @@ -1049,7 +1069,9 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp) thd->count_cuted_fields= CHECK_FIELD_WARN; if (!(table= open_proc_table_for_update(thd))) - ret= SP_OPEN_TABLE_FAILED; + { + my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(type),sp->m_name.str); + } else { /* Checking if the routine already exists */ @@ -1065,11 +1087,10 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp) push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, ER_SP_ALREADY_EXISTS, ER_THD(thd, ER_SP_ALREADY_EXISTS), - type == TYPE_ENUM_FUNCTION ? - "FUNCTION" : "PROCEDURE", + SP_TYPE_STRING(type), lex->spname->m_name.str); - ret= SP_OK; + ret= FALSE; // Setting retstr as it is used for logging. if (sp->m_type == TYPE_ENUM_FUNCTION) @@ -1078,7 +1099,8 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp) } else { - ret= SP_WRITE_ROW_FAILED; + my_error(ER_SP_ALREADY_EXISTS, MYF(0), + SP_TYPE_STRING(type), sp->m_name.str); goto done; } } @@ -1090,7 +1112,8 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp) if (table->s->fields < MYSQL_PROC_FIELD_COUNT) { - ret= SP_GET_FIELD_FAILED; + my_error(ER_SP_STORE_FAILED, MYF(0), + SP_TYPE_STRING(type), sp->m_name.str); goto done; } @@ -1099,12 +1122,12 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp) sp->m_name.str+sp->m_name.length) > table->field[MYSQL_PROC_FIELD_NAME]->char_length()) { - ret= SP_BAD_IDENTIFIER; + my_error(ER_TOO_LONG_IDENT, MYF(0), sp->m_name.str); goto done; } if (sp->m_body.length > table->field[MYSQL_PROC_FIELD_BODY]->field_length) { - ret= SP_BODY_TOO_LONG; + my_error(ER_TOO_LONG_BODY, MYF(0), sp->m_name.str); goto done; } @@ -1193,17 +1216,13 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp) if (access == SP_CONTAINS_SQL || access == SP_MODIFIES_SQL_DATA) { - my_message(ER_BINLOG_UNSAFE_ROUTINE, - ER_THD(thd, ER_BINLOG_UNSAFE_ROUTINE), MYF(0)); - ret= SP_INTERNAL_ERROR; + my_error(ER_BINLOG_UNSAFE_ROUTINE, MYF(0)); goto done; } } if (!(thd->security_ctx->master_access & SUPER_ACL)) { - my_message(ER_BINLOG_CREATE_ROUTINE_NEED_SUPER, - ER_THD(thd, ER_BINLOG_CREATE_ROUTINE_NEED_SUPER), MYF(0)); - ret= SP_INTERNAL_ERROR; + my_error(ER_BINLOG_CREATE_ROUTINE_NEED_SUPER,MYF(0)); goto done; } } @@ -1234,22 +1253,24 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp) if (store_failed) { - ret= SP_FLD_STORE_FAILED; + my_error(ER_CANT_CREATE_SROUTINE, MYF(0), sp->m_name.str); goto done; } - ret= SP_OK; if (table->file->ha_write_row(table->record[0])) - ret= SP_WRITE_ROW_FAILED; + { + my_error(ER_SP_ALREADY_EXISTS, MYF(0), + SP_TYPE_STRING(type), sp->m_name.str); + goto done; + } /* Make change permanent and avoid 'table is marked as crashed' errors */ table->file->extra(HA_EXTRA_FLUSH); - if (ret == SP_OK) - sp_cache_invalidate(); + sp_cache_invalidate(); } log: - if (ret == SP_OK && mysql_bin_log.is_open()) + if (mysql_bin_log.is_open()) { thd->clear_error(); @@ -1268,7 +1289,7 @@ log: &(thd->lex->definer->host), saved_mode)) { - ret= SP_INTERNAL_ERROR; + my_error(ER_OUT_OF_RESOURCES, MYF(0)); goto done; } /* restore sql_mode when binloging */ @@ -1277,9 +1298,13 @@ log: if (thd->binlog_query(THD::STMT_QUERY_TYPE, log_query.ptr(), log_query.length(), FALSE, FALSE, FALSE, 0)) - ret= SP_INTERNAL_ERROR; + { + my_error(ER_ERROR_ON_WRITE, MYF(MY_WME), "binary log", -1); + goto done; + } thd->variables.sql_mode= 0; } + ret= FALSE; done: thd->count_cuted_fields= saved_count_cuted_fields; diff --git a/sql/sp.h b/sql/sp.h index 4bfb0577fcc..df60482f8fd 100644 --- a/sql/sp.h +++ b/sql/sp.h @@ -126,7 +126,7 @@ sp_exist_routines(THD *thd, TABLE_LIST *procs, bool is_proc); bool sp_show_create_routine(THD *thd, stored_procedure_type type, sp_name *name); -int +bool sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp); int diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 248a15458d7..6fcb549f097 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -118,8 +118,6 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, */ /* Used in error handling only */ -#define SP_TYPE_STRING(LP) \ - ((LP)->sphead->m_type == TYPE_ENUM_FUNCTION ? "FUNCTION" : "PROCEDURE") #define SP_COM_STRING(LP) \ ((LP)->sql_command == SQLCOM_CREATE_SPFUNCTION || \ (LP)->sql_command == SQLCOM_ALTER_FUNCTION || \ @@ -5104,7 +5102,6 @@ end_with_restore_list: { uint namelen; char *name; - int sp_result= SP_INTERNAL_ERROR; DBUG_ASSERT(lex->sphead != 0); DBUG_ASSERT(lex->sphead->m_db.str); /* Must be initialized in the parser */ @@ -5115,23 +5112,12 @@ end_with_restore_list: if (check_db_name(&lex->sphead->m_db)) { my_error(ER_WRONG_DB_NAME, MYF(0), lex->sphead->m_db.str); - goto create_sp_error; + goto error; } if (check_access(thd, CREATE_PROC_ACL, lex->sphead->m_db.str, NULL, NULL, 0, 0)) - goto create_sp_error; - - /* - Check that a database directory with this name - exists. Design note: This won't work on virtual databases - like information_schema. - */ - if (check_db_dir_existence(lex->sphead->m_db.str)) - { - my_error(ER_BAD_DB_ERROR, MYF(0), lex->sphead->m_db.str); - goto create_sp_error; - } + goto error; /* Checking the drop permissions if CREATE OR REPLACE is used */ if (lex->create_info.or_replace()) @@ -5139,7 +5125,7 @@ end_with_restore_list: if (check_routine_access(thd, ALTER_PROC_ACL, lex->spname->m_db.str, lex->spname->m_name.str, lex->sql_command == SQLCOM_DROP_PROCEDURE, 0)) - goto create_sp_error; + goto error; } name= lex->sphead->name(&namelen); @@ -5151,18 +5137,17 @@ end_with_restore_list: if (udf) { my_error(ER_UDF_EXISTS, MYF(0), name); - goto create_sp_error; + goto error; } } #endif if (sp_process_definer(thd)) - goto create_sp_error; + goto error; WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL) - res= (sp_result= sp_create_routine(thd, lex->sphead->m_type, lex->sphead)); - switch (sp_result) { - case SP_OK: { + if (!sp_create_routine(thd, lex->sphead->m_type, lex->sphead)) + { #ifndef NO_EMBEDDED_ACCESS_CHECKS /* only add privileges if really neccessary */ @@ -5227,31 +5212,8 @@ end_with_restore_list: } #endif - break; } - case SP_WRITE_ROW_FAILED: - my_error(ER_SP_ALREADY_EXISTS, MYF(0), SP_TYPE_STRING(lex), name); - break; - case SP_BAD_IDENTIFIER: - my_error(ER_TOO_LONG_IDENT, MYF(0), name); - break; - case SP_BODY_TOO_LONG: - my_error(ER_TOO_LONG_BODY, MYF(0), name); - break; - case SP_FLD_STORE_FAILED: - my_error(ER_CANT_CREATE_SROUTINE, MYF(0), name); - break; - default: - my_error(ER_SP_STORE_FAILED, MYF(0), SP_TYPE_STRING(lex), name); - break; - } /* end switch */ - - /* - Capture all errors within this CASE and - clean up the environment. - */ -create_sp_error: - if (sp_result != SP_OK ) + else goto error; my_ok(thd); break; /* break super switch */ -- cgit v1.2.1