diff --git a/.gitignore b/.gitignore index 22de4d2b2ee..d89100c57f5 100644 --- a/.gitignore +++ b/.gitignore @@ -289,8 +289,6 @@ storage/mroonga/vendor/groonga/src/grnslap storage/mroonga/vendor/groonga/src/groonga storage/mroonga/vendor/groonga/src/groonga-benchmark storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset -storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result -storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result zlib/zconf.h xxx/* yyy/* diff --git a/CMakeLists.txt b/CMakeLists.txt index ff5f2cd5dda..912addc9fdd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,6 +247,19 @@ ENDIF() OPTION(WITH_MSAN "Enable memory sanitizer" OFF) IF (WITH_MSAN) MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO) + IF(NOT (have_C__fsanitize_memory__fsanitize_memory_track_origins__U_FORTIFY_SOURCE + AND have_CXX__fsanitize_memory__fsanitize_memory_track_origins__U_FORTIFY_SOURCE)) + MESSAGE(FATAL_ERROR "Compiler doesn't support -fsanitize=memory flags") + ENDIF() + MY_CHECK_CXX_COMPILER_FLAG("-stdlib=libc++") + IF(NOT have_CXX__stdlib_libc__) + MESSAGE(FATAL_ERROR "C++ Compiler requires support for -stdlib=libc++") + ENDIF() + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + MY_CHECK_AND_SET_LINKER_FLAG("-fsanitize=memory" DEBUG RELWITHDEBINFO) + IF(NOT HAVE_LINK_FLAG__fsanitize_memory) + MESSAGE(FATAL_ERROR "Linker doesn't support -fsanitize=memory flags") + ENDIF() ENDIF() OPTION(WITH_GPROF "Enable profiling with gprof" OFF) @@ -260,7 +273,7 @@ MY_CHECK_AND_SET_COMPILER_FLAG("-fno-omit-frame-pointer" RELWITHDEBINFO) # enable security hardening features, like most distributions do # in our benchmarks that costs about ~1% of performance, depending on the load OPTION(SECURITY_HARDENED "Use security-enhancing compiler features (stack protector, relro, etc)" ON) -IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND NOT WITH_GPROF) +IF(SECURITY_HARDENED AND NOT WITH_ASAN AND NOT WITH_UBSAN AND NOT WITH_TSAN AND NOT WITH_GPROF AND NOT WITH_MSAN) # security-enhancing flags MY_CHECK_AND_SET_COMPILER_FLAG("-pie -fPIC") MY_CHECK_AND_SET_LINKER_FLAG("-Wl,-z,relro,-z,now") diff --git a/client/mysqltest.cc b/client/mysqltest.cc index f6a2b13a975..5b4225f63df 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -164,6 +164,7 @@ static struct property prop_list[] = { { &ps_protocol_enabled, 0, 0, 0, "$ENABLED_PS_PROTOCOL" }, { &ps2_protocol_enabled, 0, 0, 0, "$ENABLED_PS2_PROTOCOL" }, { &view_protocol_enabled, 0, 0, 0, "$ENABLED_VIEW_PROTOCOL"}, + { &cursor_protocol_enabled, 0, 0, 0, "$ENABLED_CURSOR_PROTOCOL"}, { &service_connection_enabled, 0, 1, 0, "$ENABLED_SERVICE_CONNECTION"}, { &disable_query_log, 0, 0, 1, "$ENABLED_QUERY_LOG" }, { &disable_result_log, 0, 0, 1, "$ENABLED_RESULT_LOG" }, @@ -181,6 +182,7 @@ enum enum_prop { P_PS, P_PS2, P_VIEW, + P_CURSOR, P_CONN, P_QUERY, P_RESULT, @@ -273,6 +275,7 @@ static regex_t ps_re; /* the query can be run using PS protocol */ static regex_t ps2_re; /* the query can be run using PS protocol with second execution*/ static regex_t sp_re; /* the query can be run as a SP */ static regex_t view_re; /* the query can be run as a view*/ +static regex_t cursor_re; /* the query can be run with cursor protocol*/ static void init_re(void); static int match_re(regex_t *, char *); @@ -391,6 +394,7 @@ enum enum_commands { Q_CHARACTER_SET, Q_DISABLE_PS_PROTOCOL, Q_ENABLE_PS_PROTOCOL, Q_DISABLE_PS2_PROTOCOL, Q_ENABLE_PS2_PROTOCOL, Q_DISABLE_VIEW_PROTOCOL, Q_ENABLE_VIEW_PROTOCOL, + Q_DISABLE_CURSOR_PROTOCOL, Q_ENABLE_CURSOR_PROTOCOL, Q_DISABLE_SERVICE_CONNECTION, Q_ENABLE_SERVICE_CONNECTION, Q_ENABLE_NON_BLOCKING_API, Q_DISABLE_NON_BLOCKING_API, Q_DISABLE_RECONNECT, Q_ENABLE_RECONNECT, @@ -487,6 +491,8 @@ const char *command_names[]= "enable_ps2_protocol", "disable_view_protocol", "enable_view_protocol", + "disable_cursor_protocol", + "enable_cursor_protocol", "disable_service_connection", "enable_service_connection", "enable_non_blocking_api", @@ -8664,13 +8670,22 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command, #if MYSQL_VERSION_ID >= 50000 if (cursor_protocol_enabled) { + ps2_protocol_enabled = 0; + /* - Use cursor when retrieving result + Use cursor for queries matching the filter, + else reset cursor type */ - ulong type= CURSOR_TYPE_READ_ONLY; - if (mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type)) - die("mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s", - mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); + if (match_re(&cursor_re, query)) + { + /* + Use cursor when retrieving result + */ + ulong type= CURSOR_TYPE_READ_ONLY; + if (mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type)) + die("mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s", + mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); + } } #endif @@ -8732,9 +8747,11 @@ void run_query_stmt(struct st_connection *cn, struct st_command *command, { /* When running in cursor_protocol get the warnings from execute here - and keep them in a separate string for later. + and keep them in a separate string for later. Cursor_protocol is used + only for queries matching the filter "cursor_re". */ - if (cursor_protocol_enabled && !disable_warnings) + if (cursor_protocol_enabled && match_re(&cursor_re, query) && + !disable_warnings) append_warnings(&ds_execute_warnings, mysql); if (!disable_result_log && @@ -8881,6 +8898,16 @@ end: var_set_errno(mysql_stmt_errno(stmt)); + #if MYSQL_VERSION_ID >= 50000 + if (cursor_protocol_enabled) + { + ulong type= CURSOR_TYPE_NO_CURSOR; + if (mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*) &type)) + die("mysql_stmt_attr_set(STMT_ATTR_CURSOR_TYPE) failed': %d %s", + mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); + } + #endif + revert_properties(); /* Close the statement if reconnect, need new prepare */ @@ -9747,10 +9774,19 @@ void init_re(void) "^(" "[[:space:]]*SELECT[[:space:]])"; + /* + Filter for queries that can be run with + cursor protocol + */ + const char *cursor_re_str = + "^(" + "[[:space:]]*SELECT[[:space:]])"; + init_re_comp(&ps_re, ps_re_str); init_re_comp(&ps2_re, ps2_re_str); init_re_comp(&sp_re, sp_re_str); init_re_comp(&view_re, view_re_str); + init_re_comp(&cursor_re, cursor_re_str); } @@ -9788,6 +9824,7 @@ void free_re(void) regfree(&ps2_re); regfree(&sp_re); regfree(&view_re); + regfree(&cursor_re); } /****************************************************************************/ @@ -10577,6 +10614,17 @@ int main(int argc, char **argv) case Q_ENABLE_VIEW_PROTOCOL: set_property(command, P_VIEW, view_protocol); break; + case Q_DISABLE_CURSOR_PROTOCOL: + set_property(command, P_CURSOR, 0); + if (cursor_protocol) + set_property(command, P_PS, 0); + /* Close any open statements */ + close_statements(); + break; + case Q_ENABLE_CURSOR_PROTOCOL: + set_property(command, P_CURSOR, cursor_protocol); + set_property(command, P_PS, ps_protocol); + break; case Q_DISABLE_SERVICE_CONNECTION: set_property(command, P_CONN, 0); /* Close only util connections */ diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index c47c56d80d2..2a64a27c597 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -64,6 +64,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #ifdef _WIN32 #include /* rmdir */ #endif +#include #ifdef _WIN32 #include @@ -1634,7 +1635,7 @@ is_aria_log_dir_file(const datadir_node_t &node) bool copy_back_aria_logs(const char *dstdir) { - std::unique_ptr + std::unique_ptr> ds_ctxt_aria_log_dir_path(ds_create(dstdir, DS_TYPE_LOCAL), ds_destroy); datadir_node_t node; diff --git a/include/my_bit.h b/include/my_bit.h index 8ee8b41c8d4..e86c3ec883f 100644 --- a/include/my_bit.h +++ b/include/my_bit.h @@ -175,6 +175,11 @@ static inline uchar last_byte_mask(uint bits) return (uchar) ((2U << used) - 1); } +static inline uint my_bits_in_bytes(uint n) +{ + return ((n + 7) / 8); +} + #ifdef _MSC_VER #include #endif diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h index a0d0a338a0e..cf94364c1cf 100644 --- a/include/mysql/service_wsrep.h +++ b/include/mysql/service_wsrep.h @@ -209,7 +209,7 @@ extern "C" my_bool wsrep_thd_is_local_toi(const MYSQL_THD thd); extern "C" my_bool wsrep_thd_is_in_rsu(const MYSQL_THD thd); /* Return true if thd is in BF mode, either high_priority or TOI */ extern "C" my_bool wsrep_thd_is_BF(const MYSQL_THD thd, my_bool sync); -/* Return true if thd is streaming */ +/* Return true if thd is streaming in progress */ extern "C" my_bool wsrep_thd_is_SR(const MYSQL_THD thd); extern "C" void wsrep_handle_SR_rollback(MYSQL_THD BF_thd, MYSQL_THD victim_thd); /* Return thd retry counter */ diff --git a/mysql-test/include/commit.inc b/mysql-test/include/commit.inc index 132fdcff7bd..dbbd7459b52 100644 --- a/mysql-test/include/commit.inc +++ b/mysql-test/include/commit.inc @@ -258,8 +258,10 @@ select * from t2; insert into t2 (a) values (1025); --replace_result $MYSQLTEST_VARDIR .. +--disable_cursor_protocol --error ER_DUP_ENTRY eval select f2(25) into outfile "$MYSQLTEST_VARDIR/tmp/dml.out" from t1; +--enable_cursor_protocol select * from t2; rollback; select * from t2; @@ -279,8 +281,10 @@ select * from t2; --echo ======================================================================= insert into t2 (a) values (1027); +--disable_cursor_protocol --error ER_DUP_ENTRY select f2(27) into @foo; +--enable_cursor_protocol select * from t2; rollback; select * from t2; diff --git a/mysql-test/include/ctype_like_range_f1f2.inc b/mysql-test/include/ctype_like_range_f1f2.inc index def341e8d5e..59f668bfbba 100644 --- a/mysql-test/include/ctype_like_range_f1f2.inc +++ b/mysql-test/include/ctype_like_range_f1f2.inc @@ -17,6 +17,8 @@ INSERT INTO t1 (a, b) VALUES (2, repeat(0xF1F2,10)); INSERT INTO t1 (a, b) VALUES (3, repeat(0xF1F2,11)); INSERT INTO t1 (a, b) VALUES (4, repeat(0xF1F2,12)); +#enable after fix MDEV-31512 +--disable_cursor_protocol #check after fix MDEV-29290 --disable_view_protocol # Check pattern (important for ucs2, utf16, utf32) @@ -24,5 +26,6 @@ SELECT hex(concat(repeat(0xF1F2, 10), '%')); --echo 3 rows expected SELECT a, hex(b), c FROM t1 WHERE b LIKE concat(repeat(0xF1F2,10), '%'); -DROP TABLE t1; +--enable_cursor_protocol --enable_view_protocol +DROP TABLE t1; diff --git a/mysql-test/include/ctype_numconv.inc b/mysql-test/include/ctype_numconv.inc index ced818f00b9..9e24e1850f8 100644 --- a/mysql-test/include/ctype_numconv.inc +++ b/mysql-test/include/ctype_numconv.inc @@ -1646,7 +1646,10 @@ SELECT GROUP_CONCAT(IF(a,a,'')) FROM t1; SELECT GROUP_CONCAT(CASE WHEN a THEN a ELSE '' END) FROM t1; --disable_view_protocol --enable_metadata +#Check after fix MDEV-31512 +--disable_cursor_protocol SELECT COALESCE(a,'') FROM t1 GROUP BY 1; +--enable_cursor_protocol --disable_metadata --enable_view_protocol --echo # All columns must be VARCHAR(9) with the same length: diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc index a566a4d79c2..331f5c18a02 100644 --- a/mysql-test/include/diff_tables.inc +++ b/mysql-test/include/diff_tables.inc @@ -168,7 +168,9 @@ while ($_dt_tables) --disable_ps2_protocol --let $_dt_outfile= `SELECT @@datadir` --let $_dt_outfile= $_dt_outfile/diff_table-$_dt_connection-$_dt_database-$_dt_table + --disable_cursor_protocol eval SELECT * INTO OUTFILE '$_dt_outfile' FROM $_dt_database.$_dt_table ORDER BY `$_dt_column_list`; + --enable_cursor_protocol --enable_ps2_protocol # Compare files. diff --git a/mysql-test/include/explain_utils.inc b/mysql-test/include/explain_utils.inc index c85e0d4d288..f4cc8e6ea00 100644 --- a/mysql-test/include/explain_utils.inc +++ b/mysql-test/include/explain_utils.inc @@ -28,6 +28,7 @@ --echo # --disable_ps2_protocol --disable_view_protocol +--disable_cursor_protocol if ($select) { --enable_prepare_warnings --disable_query_log @@ -164,5 +165,6 @@ SHOW STATUS WHERE (Variable_name LIKE 'Sort%' OR --enable_query_log --echo +--enable_cursor_protocol --enable_view_protocol --enable_ps2_protocol diff --git a/mysql-test/include/function_defaults.inc b/mysql-test/include/function_defaults.inc index e8e1059f4be..86ccb697d28 100644 --- a/mysql-test/include/function_defaults.inc +++ b/mysql-test/include/function_defaults.inc @@ -824,6 +824,7 @@ eval CREATE TABLE t2 ( i $datetime DEFAULT $current_timestamp ON UPDATE $current_timestamp NOT NULL ); +--disable_cursor_protocol --disable_ps2_protocol SELECT 1 INTO OUTFILE 't3.dat' FROM dual; @@ -833,6 +834,7 @@ FROM dual; SELECT 1, 2 INTO OUTFILE 't5.dat' FROM dual; --enable_ps2_protocol +--enable_cursor_protocol --echo # Mon Aug 1 15:11:19 2011 UTC SET TIMESTAMP = 1312211479.918273; @@ -931,11 +933,13 @@ remove_file $MYSQLD_DATADIR/test/t5.dat; --echo # Mon Aug 1 15:11:19 2011 UTC SET TIMESTAMP = 1312211479.089786; +--disable_cursor_protocol --disable_ps2_protocol SELECT 1 INTO OUTFILE "file1.dat" FROM dual; SELECT NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL INTO OUTFILE "file2.dat" FROM dual; --enable_ps2_protocol +--enable_cursor_protocol --echo # Too short row diff --git a/mysql-test/include/grant_cache.inc b/mysql-test/include/grant_cache.inc index 2d4e8345392..0fccee64372 100644 --- a/mysql-test/include/grant_cache.inc +++ b/mysql-test/include/grant_cache.inc @@ -55,6 +55,7 @@ set LOCAL query_cache_type=ON; set GLOBAL query_cache_size=1355776; --disable_ps2_protocol +--disable_cursor_protocol reset query cache; flush status; @@ -175,6 +176,7 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; show status like "Qcache_not_cached"; +--enable_cursor_protocol --enable_ps2_protocol # Cleanup diff --git a/mysql-test/include/have_tlsv13.inc b/mysql-test/include/have_tlsv13.inc new file mode 100644 index 00000000000..ef897d92f97 --- /dev/null +++ b/mysql-test/include/have_tlsv13.inc @@ -0,0 +1,10 @@ +--disable_query_log +connect (ssl_connection,localhost,root,,,,,SSL); + +if (`SELECT VARIABLE_VALUE NOT LIKE 'TLSv1.3' FROM information_schema.SESSION_STATUS WHERE VARIABLE_NAME = 'ssl_version'`) { + skip Needs TLSv1.3; +} + +disconnect ssl_connection; +connection default; +--enable_query_log diff --git a/mysql-test/include/ps_conv.inc b/mysql-test/include/ps_conv.inc index 2b7af82907c..9facff43ec9 100644 --- a/mysql-test/include/ps_conv.inc +++ b/mysql-test/include/ps_conv.inc @@ -206,6 +206,7 @@ execute full_info ; --error 1064 prepare stmt1 from "select ? := c1 from t9 where c1= 1" ; +--disable_cursor_protocol --disable_query_log select '------ select column, .. into @parm,.. ------' as test_sequence ; --enable_query_log @@ -243,6 +244,7 @@ into @arg01, @arg02, @arg03, @arg04, @arg05, @arg06, @arg07, @arg08, @arg17, @arg18, @arg19, @arg20, @arg21, @arg22, @arg23, @arg24, @arg25, @arg26, @arg27, @arg28, @arg29, @arg30, @arg31, @arg32 from t9 where c1= ?" ; +--enable_cursor_protocol set @my_key= 1 ; execute stmt1 using @my_key ; # get as much information about the parameters as possible diff --git a/mysql-test/include/query_cache.inc b/mysql-test/include/query_cache.inc index 0f52b70b7f2..ba9c256005a 100644 --- a/mysql-test/include/query_cache.inc +++ b/mysql-test/include/query_cache.inc @@ -28,6 +28,7 @@ drop table if exists t1,t2,t3; set @save_query_cache_size = @@global.query_cache_size; set GLOBAL query_cache_size = 1355776; +--disable_cursor_protocol # # Without auto_commit. # @@ -86,6 +87,7 @@ show status like "Qcache_hits"; commit; show status like "Qcache_queries_in_cache"; drop table t3,t2,t1; +--enable_cursor_protocol eval CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id))$partitions_id; select count(*) from t1; @@ -128,6 +130,7 @@ connection default; # This should be 'YES'. SHOW VARIABLES LIKE 'have_query_cache'; +--disable_cursor_protocol SET GLOBAL query_cache_size = 204800; flush status; SET @@autocommit=1; @@ -190,6 +193,7 @@ disconnect connection1; connection default; set @@global.query_cache_size = @save_query_cache_size; drop table t2; +--enable_cursor_protocol SET global query_cache_type=default; --enable_view_protocol diff --git a/mysql-test/include/query_cache_partitions.inc b/mysql-test/include/query_cache_partitions.inc index 6c51300a5d5..3e861b5fe29 100644 --- a/mysql-test/include/query_cache_partitions.inc +++ b/mysql-test/include/query_cache_partitions.inc @@ -45,9 +45,11 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; --disable_ps2_protocol +--disable_cursor_protocol SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; @@ -81,9 +83,11 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; --disable_ps2_protocol +--disable_cursor_protocol SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; @@ -118,6 +122,7 @@ show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; --disable_ps2_protocol +--disable_cursor_protocol BEGIN; UPDATE `t1` SET `cool` = 1 WHERE `id` = 1; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; @@ -127,6 +132,7 @@ BEGIN; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; ROLLBACK; SELECT cool FROM `t1` WHERE (`t1`.id = 1) LIMIT 1; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; show status like "Qcache_hits"; diff --git a/mysql-test/include/test_outfile.inc b/mysql-test/include/test_outfile.inc index e50847b67a3..af64cc6ba5f 100644 --- a/mysql-test/include/test_outfile.inc +++ b/mysql-test/include/test_outfile.inc @@ -1,3 +1,5 @@ +--disable_cursor_protocol --disable_ps2_protocol eval select "Outfile OK" into outfile "$MYSQLTEST_VARDIR/tmp/outfile.test"; --enable_ps2_protocol +--enable_cursor_protocol diff --git a/mysql-test/include/type_temporal_zero_default.inc b/mysql-test/include/type_temporal_zero_default.inc index 6553bfb6d86..4cc36ad572c 100644 --- a/mysql-test/include/type_temporal_zero_default.inc +++ b/mysql-test/include/type_temporal_zero_default.inc @@ -35,7 +35,9 @@ SET sql_mode=DEFAULT; --eval INSERT INTO t1 VALUES (DEFAULT,DEFAULT); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --disable_ps2_protocol +--disable_cursor_protocol --eval SELECT a INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/mdev-7824.txt' FROM t1 +--enable_cursor_protocol DELETE FROM t1; --enable_ps2_protocol SET sql_mode=TRADITIONAL; diff --git a/mysql-test/include/write_var_to_file.inc b/mysql-test/include/write_var_to_file.inc index 58bdac6f09e..1579b5b21e7 100644 --- a/mysql-test/include/write_var_to_file.inc +++ b/mysql-test/include/write_var_to_file.inc @@ -46,9 +46,11 @@ if (`SELECT LENGTH(@@secure_file_priv) > 0`) --let $_wvtf_suffix= `SELECT UUID()` --let $_wvtf_tmp_file= $MYSQLTEST_VARDIR/_wvtf_$_wvtf_suffix + --disable_cursor_protocol --disable_ps2_protocol --eval SELECT '$write_var' INTO DUMPFILE '$_wvtf_tmp_file' --enable_ps2_protocol + --enable_cursor_protocol --copy_file $_wvtf_tmp_file $write_to_file --remove_file $_wvtf_tmp_file } diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test index 5ffa300f3f8..dd496352deb 100644 --- a/mysql-test/main/alter_table.test +++ b/mysql-test/main/alter_table.test @@ -985,6 +985,7 @@ while ($count) commit; --enable_query_log +--disable_cursor_protocol select index_length into @unpaked_keys_size from information_schema.tables where table_name='t1'; alter table t1 pack_keys=1; @@ -998,6 +999,7 @@ alter table t1 max_rows=100; select max_data_length into @changed_max_data_length from information_schema.tables where table_name='t1'; select (@orig_max_data_length > @changed_max_data_length); +--enable_cursor_protocol drop table t1; diff --git a/mysql-test/main/alter_user.test b/mysql-test/main/alter_user.test index 95e6d732907..6f4f9fb1e1e 100644 --- a/mysql-test/main/alter_user.test +++ b/mysql-test/main/alter_user.test @@ -1,6 +1,8 @@ --source include/not_embedded.inc +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol select * from mysql.user where user = 'root' and host = 'localhost'; --echo # Test syntax diff --git a/mysql-test/main/analyze_stmt_slow_query_log.test b/mysql-test/main/analyze_stmt_slow_query_log.test index 268203078f8..355292e3f6a 100644 --- a/mysql-test/main/analyze_stmt_slow_query_log.test +++ b/mysql-test/main/analyze_stmt_slow_query_log.test @@ -19,9 +19,11 @@ SET @@global.slow_query_log = ON; create table t1 (a int); INSERT INTO t1 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +--disable_cursor_protocol --disable_ps2_protocol select * from t1 where a<3; --enable_ps2_protocol +--enable_cursor_protocol drop table t1; let SLOW_LOG_FILE= `select @@slow_query_log_file`; diff --git a/mysql-test/main/auto_increment_ranges_innodb.test b/mysql-test/main/auto_increment_ranges_innodb.test index 3abd8d4d482..927954216c7 100644 --- a/mysql-test/main/auto_increment_ranges_innodb.test +++ b/mysql-test/main/auto_increment_ranges_innodb.test @@ -11,9 +11,11 @@ set default_storage_engine=innodb; # create table t1 (pk int auto_increment primary key, f varchar(20)); insert t1 (f) values ('a'), ('b'), ('c'), ('d'); +--disable_cursor_protocol --disable_ps2_protocol select null, f into outfile 'load.data' from t1 limit 1; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'load.data' into table t1; insert t1 (f) values ('<==='); select * from t1; diff --git a/mysql-test/main/bootstrap.test b/mysql-test/main/bootstrap.test index 68fbc00181d..5877b049fff 100644 --- a/mysql-test/main/bootstrap.test +++ b/mysql-test/main/bootstrap.test @@ -45,9 +45,11 @@ remove_file $MYSQLTEST_VARDIR/tmp/bootstrap_error.sql; --echo # --disable_query_log create table t1 select 2 as a, concat(repeat('MySQL', @@max_allowed_packet/10), ';') as b; +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLTEST_VARDIR/tmp/long_query.sql' from t1; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log --source include/kill_mysqld.inc --error 1 diff --git a/mysql-test/main/bug12427262.test b/mysql-test/main/bug12427262.test index 3a5642516a8..cf365852992 100644 --- a/mysql-test/main/bug12427262.test +++ b/mysql-test/main/bug12427262.test @@ -20,6 +20,7 @@ create table t9 (c1 int); create table t10 (c1 int); --enable_warnings +--disable_cursor_protocol # Query PS to know initial read count for frm file. --enable_prepare_warnings select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME @@ -33,16 +34,19 @@ show tables; select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_after; +--enable_cursor_protocol select @count_read_after-@count_read_before; show full tables; +--disable_cursor_protocol # Query PS to know read count for frm file after above query. COUNT_READ # will be incremented by 1 as FRM file will be opened for above query. select Sum(ALL(COUNT_READ)) from performance_schema.file_summary_by_instance where FILE_NAME like "%show_table_lw_db%" AND FILE_NAME like "%.frm%" AND EVENT_NAME='wait/io/file/sql/FRM' into @count_read_after; +--enable_cursor_protocol select @count_read_after-@count_read_before; diff --git a/mysql-test/main/connect.result b/mysql-test/main/connect.result index 6642b8a1c6e..e84a93317ab 100644 --- a/mysql-test/main/connect.result +++ b/mysql-test/main/connect.result @@ -448,3 +448,33 @@ FOUND 2 /This connection closed normally without authentication/ in mysqld.1.err SET GLOBAL log_warnings=default; SET GLOBAL connect_timeout= @save_connect_timeout; # End of 10.4 tests +# +# MDEV-33990: SHOW STATUS counts ER_CON_COUNT_ERROR as +# Connection_errors_internal +# +flush status; +show global status like 'Connection_errors%'; +Variable_name Value +Connection_errors_accept 0 +Connection_errors_internal 0 +Connection_errors_max_connections 0 +Connection_errors_peer_address 0 +Connection_errors_select 0 +Connection_errors_tcpwrap 0 +set @max_con.save= @@max_connections; +set global max_connections= 10; +# ERROR 1040 +# ERROR 1040 +connection default; +show global status like 'Connection_errors%'; +Variable_name Value +Connection_errors_accept 0 +Connection_errors_internal 0 +Connection_errors_max_connections 2 +Connection_errors_peer_address 0 +Connection_errors_select 0 +Connection_errors_tcpwrap 0 +set global max_connections= @max_con.save; +# +# End of 10.5 tests +# diff --git a/mysql-test/main/connect.test b/mysql-test/main/connect.test index c9969633a2a..ab69d32eedf 100644 --- a/mysql-test/main/connect.test +++ b/mysql-test/main/connect.test @@ -508,3 +508,38 @@ SET GLOBAL log_warnings=default; SET GLOBAL connect_timeout= @save_connect_timeout; --echo # End of 10.4 tests + +--echo # +--echo # MDEV-33990: SHOW STATUS counts ER_CON_COUNT_ERROR as +--echo # Connection_errors_internal +--echo # + +flush status; + +show global status like 'Connection_errors%'; + +set @max_con.save= @@max_connections; +set global max_connections= 10; + +--disable_result_log +--disable_query_log +--let $n= 12 +while ($n) +{ + --error 0,ER_CON_COUNT_ERROR + --connect (con$n,localhost,root) + if ($mysql_errno) { + --echo # ERROR $mysql_errno + } + --dec $n +} + +--enable_result_log +--enable_query_log +--connection default +show global status like 'Connection_errors%'; +set global max_connections= @max_con.save; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/main/count_distinct2.test b/mysql-test/main/count_distinct2.test index f5d16527af3..0ab8169098f 100644 --- a/mysql-test/main/count_distinct2.test +++ b/mysql-test/main/count_distinct2.test @@ -62,6 +62,7 @@ while ($1) commit; --enable_query_log +--disable_cursor_protocol flush status; select count(distinct n) from t1; show status like 'Created_tmp_disk_tables'; @@ -83,6 +84,7 @@ flush status; select count(distinct s) from t1; show status like 'Created_tmp_disk_tables'; drop table t1; +--enable_cursor_protocol --enable_ps2_protocol # End of 4.1 tests diff --git a/mysql-test/main/create_user.result b/mysql-test/main/create_user.result index 8bd0ca88335..477d4d53bbe 100644 --- a/mysql-test/main/create_user.result +++ b/mysql-test/main/create_user.result @@ -70,3 +70,12 @@ select * from mysql.user where user like 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time % foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 40 mysql_native_password N N 0.000000 drop user foo; +# End of 10.2 tests +# +# MDEV-24193 UBSAN: sql/sql_acl.cc:9985:29: runtime error: member access within null pointer of type 'struct TABLE' , ASAN: use-after-poison in handle_grant_table +# +RENAME TABLE mysql.procs_priv TO mysql.temp; +CREATE USER a IDENTIFIED WITH 'a'; +ERROR HY000: Plugin 'a' is not loaded +RENAME TABLE mysql.temp TO mysql.procs_priv; +# End of 10.5 tests diff --git a/mysql-test/main/create_user.test b/mysql-test/main/create_user.test index f04cb3e302a..ef855ed5e86 100644 --- a/mysql-test/main/create_user.test +++ b/mysql-test/main/create_user.test @@ -56,3 +56,15 @@ create user foo with MAX_QUERIES_PER_HOUR 10 MAX_USER_CONNECTIONS 40; select * from mysql.user where user like 'foo'; drop user foo; + +--echo # End of 10.2 tests + +--echo # +--echo # MDEV-24193 UBSAN: sql/sql_acl.cc:9985:29: runtime error: member access within null pointer of type 'struct TABLE' , ASAN: use-after-poison in handle_grant_table +--echo # +RENAME TABLE mysql.procs_priv TO mysql.temp; +--error ER_PLUGIN_IS_NOT_LOADED +CREATE USER a IDENTIFIED WITH 'a'; +RENAME TABLE mysql.temp TO mysql.procs_priv; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/cte_nonrecursive.test b/mysql-test/main/cte_nonrecursive.test index bebf02eafd9..a56b89cf3c8 100644 --- a/mysql-test/main/cte_nonrecursive.test +++ b/mysql-test/main/cte_nonrecursive.test @@ -1048,14 +1048,14 @@ drop table t1; --echo # MDEV-16473: query with CTE when no database is set --echo # -# Enable view protocol after fix MDEV-27944 ---disable_view_protocol create database db_mdev_16473; use db_mdev_16473; drop database db_mdev_16473; +--disable_service_connection --echo # Now no default database is set select database(); +--enable_service_connection with cte as (select 1 as a) select * from cte; @@ -1073,7 +1073,6 @@ select * from cte, db_mdev_16473.t1 as t where cte.a=t.a; drop database db_mdev_16473; use test; ---enable_view_protocol --echo # --echo # MDEV-17154: using parameter markers for PS within CTEs more than once @@ -1220,8 +1219,6 @@ DROP TABLE test.t; --echo # MDEV-22781: create view with CTE without default database --echo # -# Enable view protocol after fix MDEV-27944 ---disable_view_protocol create database db; use db; drop database db; @@ -1231,7 +1228,9 @@ insert into db1.t1 values (3),(7),(1); create view db1.v1 as with t as (select * from db1.t1) select * from t; show create view db1.v1; +--disable_service_connection select * from db1.v1; +--enable_service_connection drop view db1.v1; prepare stmt from " @@ -1240,14 +1239,15 @@ create view db1.v1 as with t as (select * from db1.t1) select * from t; execute stmt; deallocate prepare stmt; show create view db1.v1; +--disable_service_connection select * from db1.v1; +--enable_service_connection drop view db1.v1; drop table db1.t1; drop database db1; use test; ---enable_view_protocol --echo # --echo # MDEV-24597: CTE with union used multiple times in query diff --git a/mysql-test/main/ctype_big5.test b/mysql-test/main/ctype_big5.test index 8a8b6f8a824..bdf884768da 100644 --- a/mysql-test/main/ctype_big5.test +++ b/mysql-test/main/ctype_big5.test @@ -78,9 +78,11 @@ select hex(convert(_big5 0xC84041 using ucs2)); set names big5; create table t1 (a blob); insert into t1 values (0xEE00); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'test/t1.txt' from t1; --enable_ps2_protocol +--enable_cursor_protocol delete from t1; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR diff --git a/mysql-test/main/ctype_binary.test b/mysql-test/main/ctype_binary.test index 26618ec235b..756c96fcf60 100644 --- a/mysql-test/main/ctype_binary.test +++ b/mysql-test/main/ctype_binary.test @@ -1,3 +1,4 @@ + set names binary; --source include/ctype_numconv.inc @@ -232,8 +233,11 @@ SELECT DATE_FORMAT('2004-02-02','%W'); SELECT HEX(DATE_FORMAT('2004-02-02','%W')); #Enable after fix MDEV-33936 --disable_view_protocol +#enable after fix MDEV-34215 +--disable_cursor_protocol SELECT DATE_FORMAT(TIME'-01:01:01','%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01','%h')); +--enable_cursor_protocol --enable_view_protocol --echo # latin1 format, binary result @@ -241,8 +245,11 @@ SELECT DATE_FORMAT('2004-02-02',_latin1'%W'); SELECT HEX(DATE_FORMAT('2004-02-02',_latin1'%W')); #Enable after fix MDEV-33936 --disable_view_protocol +#enable after fix MDEV-34215 +--disable_cursor_protocol SELECT DATE_FORMAT(TIME'-01:01:01',_latin1'%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_latin1'%h')); +--enable_cursor_protocol --enable_view_protocol --echo # Binary format, latin1 result @@ -251,8 +258,11 @@ SELECT DATE_FORMAT('2004-02-02',_binary'%W'); SELECT HEX(DATE_FORMAT('2004-02-02',_binary'%W')); #Enable after fix MDEV-33936 --disable_view_protocol +#enable after fix MDEV-34215 +--disable_cursor_protocol SELECT DATE_FORMAT(TIME'-01:01:01',_binary'%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_binary'%h')); +--enable_cursor_protocol --enable_view_protocol --echo # --echo # End of 10.4 tests diff --git a/mysql-test/main/ctype_filename.result b/mysql-test/main/ctype_filename.result index a223bf084e9..a8e5093a224 100644 --- a/mysql-test/main/ctype_filename.result +++ b/mysql-test/main/ctype_filename.result @@ -132,6 +132,33 @@ a c @002d1 @002d1 DROP TABLE t1; SET NAMES utf8; +# +# MDEV-25900 Assertion `octets < 1024' failed in Binlog_type_info_fixed_string::Binlog_type_info_fixed_string OR Assertion `field_length < 1024' failed in Field_string::save_field_metadata +# +CREATE TABLE t1 (a CHAR(204)) CHARACTER SET filename; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` char(204) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=filename COLLATE=filename +DROP TABLE t1; +CREATE TABLE t1 (a CHAR(205)) CHARACTER SET filename; +ERROR 42000: Column length too big for column 'a' (max = 204); use BLOB or TEXT instead +SET sql_mode=''; +CREATE TABLE t1 (a CHAR(205)) CHARACTER SET filename; +Warnings: +Note 1246 Converting column 'a' from CHAR to VARCHAR +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` varchar(205) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=filename COLLATE=filename +DROP TABLE t1; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a CHAR(205) CHARACTER SET latin1); +ALTER TABLE t1 CONVERT TO CHARACTER SET filename; +ERROR 42000: Column length too big for column 'a' (max = 204); use BLOB or TEXT instead +DROP TABLE t1; # End of 10.5 tests # # Start of 10.9 tests diff --git a/mysql-test/main/ctype_filename.test b/mysql-test/main/ctype_filename.test index f74ece22931..76c7cbf136c 100644 --- a/mysql-test/main/ctype_filename.test +++ b/mysql-test/main/ctype_filename.test @@ -20,10 +20,13 @@ drop table com1; create table `clock$` (a int); drop table `clock$`; +# Enable after fix MDEV-31553 +--disable_cursor_protocol # Enable after fix MDEV-29295 --disable_view_protocol select convert(convert(',' using filename) using binary); --enable_view_protocol +--enable_cursor_protocol --echo # --echo # MDEV-7677 my_charset_handler_filename has a wrong "ismbchar" member @@ -141,6 +144,28 @@ SET NAMES utf8; --enable_ps_protocol +--echo # +--echo # MDEV-25900 Assertion `octets < 1024' failed in Binlog_type_info_fixed_string::Binlog_type_info_fixed_string OR Assertion `field_length < 1024' failed in Field_string::save_field_metadata +--echo # + +CREATE TABLE t1 (a CHAR(204)) CHARACTER SET filename; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +--error ER_TOO_BIG_FIELDLENGTH +CREATE TABLE t1 (a CHAR(205)) CHARACTER SET filename; + +SET sql_mode=''; +CREATE TABLE t1 (a CHAR(205)) CHARACTER SET filename; +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +CREATE TABLE t1 (a CHAR(205) CHARACTER SET latin1); +--error ER_TOO_BIG_FIELDLENGTH +ALTER TABLE t1 CONVERT TO CHARACTER SET filename; +DROP TABLE t1; + --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/ctype_gbk.test b/mysql-test/main/ctype_gbk.test index 5ef4d349687..2c6a233a0de 100644 --- a/mysql-test/main/ctype_gbk.test +++ b/mysql-test/main/ctype_gbk.test @@ -65,10 +65,12 @@ CREATE TABLE t1(a MEDIUMTEXT CHARACTER SET gbk, INSERT INTO t1 VALUES (REPEAT(0x1125,200000), REPEAT(0x1125,200000)), ('', ''), ('', ''); +--disable_cursor_protocol --enable_prepare_warnings SELECT a FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; SELECT b FROM t1 GROUP BY 1 LIMIT 1 INTO @nullll; --disable_prepare_warnings +--enable_cursor_protocol DROP TABLES t1; diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result index 9f93f07c054..3b3c882f7ee 100644 --- a/mysql-test/main/ctype_latin1.result +++ b/mysql-test/main/ctype_latin1.result @@ -9007,6 +9007,12 @@ CAST(_latin1 0x61FF62 AS INT) Warnings: Warning 1292 Truncated incorrect INTEGER value: 'aÿb' # +# MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +# +SELECT CAST(CONVERT('-9223372036854775808' USING latin1) AS SIGNED) AS c1; +c1 +-9223372036854775808 +# # End of 10.5 tests # # diff --git a/mysql-test/main/ctype_latin1.test b/mysql-test/main/ctype_latin1.test index 290eec2edc4..c4df72d8704 100644 --- a/mysql-test/main/ctype_latin1.test +++ b/mysql-test/main/ctype_latin1.test @@ -523,6 +523,13 @@ SELECT CAST(_latin1 0x617E62 AS INT); SELECT CAST(_latin1 0x61FF62 AS INT); +--echo # +--echo # MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +--echo # + +SELECT CAST(CONVERT('-9223372036854775808' USING latin1) AS SIGNED) AS c1; + + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/ctype_recoding.test b/mysql-test/main/ctype_recoding.test index 9b5f74d0b93..5c25d854137 100644 --- a/mysql-test/main/ctype_recoding.test +++ b/mysql-test/main/ctype_recoding.test @@ -74,13 +74,12 @@ SHOW TABLES IN SET CHARACTER SET koi8r; DROP DATABASE ÔÅÓÔ; -# Enable view protocol after fix MDEV-27944 ---disable_view_protocol +--disable_service_connection SET NAMES koi8r; SELECT hex('ÔÅÓÔ'); SET character_set_connection=cp1251; SELECT hex('ÔÅÓÔ'); ---enable_view_protocol +--enable_service_connection USE test; # Bug#4417 diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result index c4b7229d1fa..b92fc0e17b8 100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@ -6540,5 +6540,20 @@ DROP VIEW v1; DROP TABLE t1; SET NAMES utf8mb3; # +# MDEV-28386 UBSAN: runtime error: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoull_8bit on SELECT ... OCT +# +CREATE TABLE t1 (c TEXT CHARACTER SET ucs2); +INSERT INTO t1 VALUES ('-9223372036854775808.5'); +SELECT OCT(c) FROM t1; +OCT(c) +1000000000000000000000 +DROP TABLE t1; +# +# MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +# +SELECT CAST(CONVERT('-9223372036854775808' USING ucs2) AS SIGNED) AS c1; +c1 +-9223372036854775808 +# # End of 10.5 tests # diff --git a/mysql-test/main/ctype_ucs.test b/mysql-test/main/ctype_ucs.test index 5d9e8924e23..4c5cd69b08d 100644 --- a/mysql-test/main/ctype_ucs.test +++ b/mysql-test/main/ctype_ucs.test @@ -75,11 +75,13 @@ DROP TABLE t1; --echo # Problem # 1 (original report): wrong parsing of ucs2 data SET character_set_connection=ucs2; +--disable_cursor_protocol --enable_prepare_warnings --disable_ps2_protocol SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp.txt'; --disable_prepare_warnings --enable_ps2_protocol +--enable_cursor_protocol CREATE TABLE t1(a INT); LOAD DATA INFILE 'tmpp.txt' INTO TABLE t1 CHARACTER SET ucs2 (@b) SET a=REVERSE(@b); @@ -92,9 +94,11 @@ remove_file $MYSQLD_DATADIR/test/tmpp.txt; --disable_ps2_protocol --echo # Problem # 2 : if you write and read ucs2 data to a file they're lost +--disable_cursor_protocol --enable_prepare_warnings SELECT '00' UNION SELECT '10' INTO OUTFILE 'tmpp2.txt' CHARACTER SET ucs2; --disable_prepare_warnings +--enable_cursor_protocol --enable_ps2_protocol CREATE TABLE t1(a INT); LOAD DATA INFILE 'tmpp2.txt' INTO TABLE t1 CHARACTER SET ucs2 @@ -1217,6 +1221,20 @@ DROP VIEW v1; DROP TABLE t1; SET NAMES utf8mb3; +--echo # +--echo # MDEV-28386 UBSAN: runtime error: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoull_8bit on SELECT ... OCT +--echo # + +CREATE TABLE t1 (c TEXT CHARACTER SET ucs2); +INSERT INTO t1 VALUES ('-9223372036854775808.5'); +SELECT OCT(c) FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +--echo # + +SELECT CAST(CONVERT('-9223372036854775808' USING ucs2) AS SIGNED) AS c1; --echo # --echo # End of 10.5 tests diff --git a/mysql-test/main/ctype_utf16.test b/mysql-test/main/ctype_utf16.test index 529b737fcfb..9f23f02b0fa 100644 --- a/mysql-test/main/ctype_utf16.test +++ b/mysql-test/main/ctype_utf16.test @@ -741,6 +741,8 @@ CREATE TABLE t1 ( s3 MEDIUMTEXT CHARACTER SET utf16, s4 LONGTEXT CHARACTER SET utf16 ); +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SET NAMES utf8, @@character_set_results=NULL; @@ -751,6 +753,7 @@ SET NAMES utf8; SELECT *, HEX(s1) FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; diff --git a/mysql-test/main/ctype_utf16le.test b/mysql-test/main/ctype_utf16le.test index 537a456f7db..d0ccb2e8509 100644 --- a/mysql-test/main/ctype_utf16le.test +++ b/mysql-test/main/ctype_utf16le.test @@ -703,6 +703,8 @@ CREATE TABLE t1 ( s3 MEDIUMTEXT CHARACTER SET utf16le, s4 LONGTEXT CHARACTER SET utf16le ); +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SET NAMES utf8, @@character_set_results=NULL; @@ -713,6 +715,7 @@ SET NAMES utf8; SELECT *, HEX(s1) FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; diff --git a/mysql-test/main/ctype_utf32.result b/mysql-test/main/ctype_utf32.result index e9972a076c4..321d6a98683 100644 --- a/mysql-test/main/ctype_utf32.result +++ b/mysql-test/main/ctype_utf32.result @@ -3109,3 +3109,12 @@ SET NAMES utf8mb4; # # End of 10.11 tests # +# +# MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +# +SELECT CAST(CONVERT('-9223372036854775808' USING utf32) AS SIGNED) AS c1; +c1 +-9223372036854775808 +# +# End of 10.5 tests +# diff --git a/mysql-test/main/ctype_utf32.test b/mysql-test/main/ctype_utf32.test index 23a4070fc69..75c9e3e84f8 100644 --- a/mysql-test/main/ctype_utf32.test +++ b/mysql-test/main/ctype_utf32.test @@ -795,6 +795,8 @@ CREATE TABLE t1 ( s3 MEDIUMTEXT CHARACTER SET utf32, s4 LONGTEXT CHARACTER SET utf32 ); +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SET NAMES utf8mb4, @@character_set_results=NULL; @@ -805,6 +807,7 @@ SET NAMES utf8mb4; SELECT *, HEX(s1) FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; @@ -1131,8 +1134,11 @@ SELECT HEX(DATE_FORMAT(TIME'-01:01:01','%h')); --echo # utf8 format, utf32 result SELECT DATE_FORMAT('2004-02-02',_utf8'%W'); SELECT HEX(DATE_FORMAT('2004-02-02',_utf8'%W')); +#enable after fix MDEV-34215 +--disable_cursor_protocol SELECT DATE_FORMAT(TIME'-01:01:01',_utf8'%h'); SELECT HEX(DATE_FORMAT(TIME'-01:01:01',_utf8'%h')); +--enable_cursor_protocol --echo # utf32 format, utf8 result SET NAMES utf8; @@ -1232,3 +1238,14 @@ SET NAMES utf8mb4; --echo # --enable_service_connection + + +--echo # +--echo # MDEV-31221 UBSAN runtime error: negation of -9223372036854775808 cannot be represented in type 'long long int' in my_strtoll10_utf32 +--echo # + +SELECT CAST(CONVERT('-9223372036854775808' USING utf32) AS SIGNED) AS c1; + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/main/ctype_utf8.test b/mysql-test/main/ctype_utf8.test index 0a41f9fb67c..fb1f271b0ee 100644 --- a/mysql-test/main/ctype_utf8.test +++ b/mysql-test/main/ctype_utf8.test @@ -1501,8 +1501,11 @@ SELECT HEX(LPAD(_utf8 0xD18F, 3, 0x20)); SELECT HEX(INSERT(_utf8 0xD18F, 2, 1, 0x20)); #Enable view-protocol after fix MDEV-33942 --disable_view_protocol +#Enable after fix MDEV-31512 +--disable_cursor_protocol SELECT HEX(INSERT(_utf8 0xD18FD18E, 2, 1, 0x20)); --enable_view_protocol +--enable_cursor_protocol --echo # --echo # Bug#11752408 - 43593: DUMP/BACKUP/RESTORE/UPGRADE TOOLS FAILS BECAUSE OF UTF8_GENERAL_CI @@ -1581,12 +1584,15 @@ CREATE TABLE t1 ( ); --disable_view_protocol --enable_metadata +#Check after fix MDEV-31512 +--disable_cursor_protocol SET NAMES utf8, @@character_set_results=NULL; SELECT *, HEX(s1) FROM t1; SET NAMES latin1; SELECT *, HEX(s1) FROM t1; SET NAMES utf8; SELECT *, HEX(s1) FROM t1; +--enable_cursor_protocol --disable_metadata --enable_view_protocol CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; diff --git a/mysql-test/main/ctype_utf8mb4.test b/mysql-test/main/ctype_utf8mb4.test index 8fddfa90a52..a691f6ab4c1 100644 --- a/mysql-test/main/ctype_utf8mb4.test +++ b/mysql-test/main/ctype_utf8mb4.test @@ -1798,12 +1798,15 @@ CREATE TABLE t1 ( s4 LONGTEXT CHARACTER SET utf8mb4 ); --enable_metadata +#Check after fix MDEV-31512 +--disable_cursor_protocol SET NAMES utf8mb4, @@character_set_results=NULL; SELECT *, HEX(s1) FROM t1; SET NAMES latin1; SELECT *, HEX(s1) FROM t1; SET NAMES utf8mb4; SELECT *, HEX(s1) FROM t1; +--enable_cursor_protocol --disable_metadata CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; @@ -1953,7 +1956,9 @@ DROP TABLE t1; SET NAMES utf8mb4; SELECT COLUMN_JSON(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1)); +--disable_cursor_protocol SELECT COLUMN_LIST(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1)); +--enable_cursor_protocol SELECT COLUMN_GET(COLUMN_CREATE(_utf8mb4 0xF09F988E, 1), _utf8mb4 0xF09F988E as int); diff --git a/mysql-test/main/derived.test b/mysql-test/main/derived.test index 51fbe5ee734..3cb665c8e6b 100644 --- a/mysql-test/main/derived.test +++ b/mysql-test/main/derived.test @@ -862,6 +862,8 @@ INSERT INTO example1463 VALUES ('David', 'Unknown', 100); INSERT INTO example1463 VALUES ('Edward', 'Success', 150); INSERT INTO example1463 VALUES ('Edward', 'Pending', 150); +#Enable after fix MDEV-31720 +--disable_cursor_protocol SELECT Customer, Success, SUM(OrderSize) FROM (SELECT Customer, CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success, @@ -869,6 +871,7 @@ SELECT Customer, Success, SUM(OrderSize) FROM example1463) as subQ GROUP BY Success, Customer WITH ROLLUP; +--enable_cursor_protocol SELECT Customer, Success, SUM(OrderSize) FROM (SELECT Customer, CASE WHEN DeliveryStatus='Success' THEN 'Yes' ELSE 'No' END AS Success, diff --git a/mysql-test/main/derived_view.test b/mysql-test/main/derived_view.test index 0f2c8d146ff..4c02d0fa906 100644 --- a/mysql-test/main/derived_view.test +++ b/mysql-test/main/derived_view.test @@ -42,6 +42,7 @@ explain extended select * from (select * from t1 where f1 in (2,3)) tt join (select * from t1 where f1 in (1,2)) aa on tt.f1=aa.f1; +--disable_cursor_protocol --disable_ps2_protocol flush status; explain extended @@ -51,6 +52,7 @@ flush status; select * from (select * from t1 where f1 in (2,3)) tt where f11=2; show status like 'Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol --echo for merged views create view v1 as select * from t1; @@ -72,12 +74,14 @@ explain extended select * from v3 join v4 on f1=f2; --disable_ps2_protocol +--disable_cursor_protocol flush status; explain extended select * from v4 where f2 in (1,3); show status like 'Handler_read%'; flush status; select * from v4 where f2 in (1,3); show status like 'Handler_read%'; +--enable_cursor_protocol --echo for materialized derived tables --echo explain for simple derived @@ -92,8 +96,10 @@ flush status; explain select * from t1 join (select * from t2 group by f2) tt on f1=f2; show status like 'Handler_read%'; flush status; +--disable_cursor_protocol select * from t1 join (select * from t2 group by f2) tt on f1=f2; show status like 'Handler_read%'; +--enable_cursor_protocol --enable_ps2_protocol --echo for materialized views @@ -110,6 +116,7 @@ explain extended select * from t1 join v2 on f1=f2; select * from t1 join v2 on f1=f2; explain extended select * from t1,v3 as v31,v3 where t1.f1=v31.f1 and t1.f1=v3.f1; +--disable_cursor_protocol --disable_ps2_protocol flush status; select * from t1,v3 as v31,v3 where t1.f1=v31.f1 and t1.f1=v3.f1; @@ -122,6 +129,7 @@ flush status; select * from t1 join v2 on f1=f2; show status like 'Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol explain extended select * from v1 join v4 on f1=f2; explain format=json select * from v1 join v4 on f1=f2; @@ -165,6 +173,7 @@ join (select * from (select * from t1 where f1 < 7 group by f1) tt where f1 > 2) z on x.f1 = z.f1; +--disable_cursor_protocol --disable_ps2_protocol flush status; select * from @@ -175,6 +184,7 @@ join show status like 'Handler_read%'; flush status; --enable_ps2_protocol +--enable_cursor_protocol --echo merged in merged derived join merged in merged derived explain extended select * from diff --git a/mysql-test/main/distinct.test b/mysql-test/main/distinct.test index 0658949597c..8935147e579 100644 --- a/mysql-test/main/distinct.test +++ b/mysql-test/main/distinct.test @@ -460,6 +460,7 @@ INSERT INTO t1 VALUES (2,2,'APPLE'); INSERT INTO t1 VALUES (3,2,'APPLE'); INSERT INTO t1 VALUES (4,3,'PEAR'); +--disable_cursor_protocol SELECT DISTINCT fruit_id, fruit_name INTO @v1, @v2 FROM t1 WHERE fruit_name = 'APPLE'; SELECT @v1, @v2; @@ -508,6 +509,7 @@ SELECT DISTINCT @v19:= fruit_id, @v20:= fruit_name INTO OUTFILE --enable_ps2_protocol LOAD DATA INFILE '../../tmp/data2.tmp' INTO TABLE t2; --remove_file $MYSQLTEST_VARDIR/tmp/data2.tmp +--enable_cursor_protocol SELECT @v19, @v20; SELECT * FROM t2; diff --git a/mysql-test/main/empty_table.test b/mysql-test/main/empty_table.test index 85638bc290b..3c6f418ccd4 100644 --- a/mysql-test/main/empty_table.test +++ b/mysql-test/main/empty_table.test @@ -6,6 +6,8 @@ drop table if exists t1; --enable_warnings +# Enable after fix MDEV-31721 +--disable_cursor_protocol create table t1 (nr int(5) not null auto_increment,b blob,str char(10), primary key (nr)); --disable_ps2_protocol select count(*) from t1; @@ -24,6 +26,7 @@ drop table t1; select * from t2; --enable_ps2_protocol show status like "Empty_queries"; +--enable_cursor_protocol --echo # End of 4.1 tests diff --git a/mysql-test/main/events_bugs.test b/mysql-test/main/events_bugs.test index fe744de86c9..3c4836af9e5 100644 --- a/mysql-test/main/events_bugs.test +++ b/mysql-test/main/events_bugs.test @@ -966,7 +966,9 @@ DROP USER evtest1@localhost; # scheduler to detect that --echo Sleep 4 seconds sleep 4; +--disable_cursor_protocol SELECT COUNT(*) INTO @row_cnt FROM events_test.event_log; +--enable_cursor_protocol # Give the event mechanism ~ 4 seconds to do something wrong # (execute the event of the dropped user -> inser rows). --echo Sleep 4 seconds @@ -1186,9 +1188,11 @@ drop procedure if exists p; set @old_mode= @@sql_mode; set @@sql_mode= cast(pow(2,32)-1 as unsigned integer); create event e1 on schedule every 1 day do select 1; +--disable_cursor_protocol select @@sql_mode into @full_mode; set @@sql_mode= @old_mode; select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode; +--enable_cursor_protocol select name from mysql.event where name = 'e1' and sql_mode = @full_mode; drop event e1; diff --git a/mysql-test/main/explain.test b/mysql-test/main/explain.test index 5269fccf78b..f41b8e247ad 100644 --- a/mysql-test/main/explain.test +++ b/mysql-test/main/explain.test @@ -48,7 +48,9 @@ set names latin1; # # Bug#15463: EXPLAIN SELECT..INTO hangs the client (QB, command line) # +--disable_cursor_protocol select 3 into @v1; +--enable_cursor_protocol explain select 3 into @v1; # @@ -154,7 +156,9 @@ DROP TABLE t1; CREATE TABLE t1 (f1 INT not null); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; # EXPLAIN EXTENDED (with subselect). used to crash. should give NOTICE. diff --git a/mysql-test/main/flush_ssl.test b/mysql-test/main/flush_ssl.test index e7bd57b156a..c8be2896815 100644 --- a/mysql-test/main/flush_ssl.test +++ b/mysql-test/main/flush_ssl.test @@ -23,7 +23,9 @@ let $restart_parameters=--ssl-key=$ssl_key --ssl-cert=$ssl_cert; --source include/start_mysqld.inc connect ssl_con,localhost,root,,,,,SSL; +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @ssl_not_after FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after'; +--enable_cursor_protocol let $ssl_not_after=`SELECT @ssl_not_after`; remove_file $ssl_cert; diff --git a/mysql-test/main/func_analyse.test b/mysql-test/main/func_analyse.test index 17b6b49decc..8afc2ab34a6 100644 --- a/mysql-test/main/func_analyse.test +++ b/mysql-test/main/func_analyse.test @@ -24,7 +24,10 @@ EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE(); create table t1 (v varchar(128)); insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd'); +#Enable after fix MDEV-31538 +--disable_cursor_protocol select * from t1 procedure analyse(); +--enable_cursor_protocol drop table t1; #decimal-related test diff --git a/mysql-test/main/func_des_encrypt.test b/mysql-test/main/func_des_encrypt.test index 884fad54635..2fe471c34ba 100644 --- a/mysql-test/main/func_des_encrypt.test +++ b/mysql-test/main/func_des_encrypt.test @@ -56,7 +56,13 @@ DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT t1 VALUES (1),(2); +# There is a problem with cursor-protocol and DES_DECRYPT(), +# but DES_DECRYPT has been deprecated from MariaDB 10.10.0, +# and will be removed in a future release. That's why this +# case is excluded without bug +--disable_cursor_protocol SELECT CHAR_LENGTH(a), DES_DECRYPT(a) FROM (SELECT _utf8 0xC2A2 AS a FROM t1) AS t2; +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/mysql-test/main/func_digest.test b/mysql-test/main/func_digest.test index afc3941e1b3..9043f6534b9 100644 --- a/mysql-test/main/func_digest.test +++ b/mysql-test/main/func_digest.test @@ -489,6 +489,8 @@ SELECT LENGTH(SHA2( 'computed', 512 )) / 2 * 8 = 512; --echo # Bug#54661 sha2() returns BINARY result --echo # +#Check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SET NAMES binary; @@ -499,6 +501,7 @@ SET NAMES latin1; SELECT sha2('1',224); --disable_metadata --disable_view_protocol +--enable_cursor_protocol --echo # --echo # Start of 10.1 tests diff --git a/mysql-test/main/func_extract.result b/mysql-test/main/func_extract.result index dc71f6ae27a..7c1fd5009ca 100644 --- a/mysql-test/main/func_extract.result +++ b/mysql-test/main/func_extract.result @@ -1470,5 +1470,13 @@ DROP FUNCTION params; DROP FUNCTION select01; DROP FUNCTION select02; # +# MDEV-32891 Assertion `value <= ((ulonglong) 0xFFFFFFFFL) * 10000ULL' failed in str_to_DDhhmmssff_internal +# +SELECT EXTRACT(HOUR_MICROSECOND FROM '42949672955000x1'); +EXTRACT(HOUR_MICROSECOND FROM '42949672955000x1') +NULL +Warnings: +Warning 1292 Incorrect interval value: '42949672955000x1' +# # End of 10.5 tests # diff --git a/mysql-test/main/func_extract.test b/mysql-test/main/func_extract.test index dd808443f58..6167780b9bf 100644 --- a/mysql-test/main/func_extract.test +++ b/mysql-test/main/func_extract.test @@ -511,6 +511,13 @@ DROP FUNCTION params; DROP FUNCTION select01; DROP FUNCTION select02; +--echo # +--echo # MDEV-32891 Assertion `value <= ((ulonglong) 0xFFFFFFFFL) * 10000ULL' failed in str_to_DDhhmmssff_internal +--echo # + +SELECT EXTRACT(HOUR_MICROSECOND FROM '42949672955000x1'); + + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/func_gconcat.test b/mysql-test/main/func_gconcat.test index 09703db334a..5694c245033 100644 --- a/mysql-test/main/func_gconcat.test +++ b/mysql-test/main/func_gconcat.test @@ -409,11 +409,14 @@ drop table t1; # create table t1 (f1 int unsigned, f2 varchar(255)); insert into t1 values (1,repeat('a',255)),(2,repeat('b',255)); +#Enable after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata --disable_view_protocol select f2,group_concat(f1) from t1 group by f2; --enable_view_protocol --disable_metadata +--enable_cursor_protocol drop table t1; # End of 4.1 tests @@ -499,11 +502,14 @@ set names latin1; # create table t1 (f1 int unsigned, f2 varchar(255)); insert into t1 values (1,repeat('a',255)),(2,repeat('b',255)); +#Enable after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata --disable_view_protocol select f2,group_concat(f1) from t1 group by f2; --enable_view_protocol --disable_metadata +--enable_cursor_protocol drop table t1; # diff --git a/mysql-test/main/func_group.test b/mysql-test/main/func_group.test index 05946908fcf..e1023405b96 100644 --- a/mysql-test/main/func_group.test +++ b/mysql-test/main/func_group.test @@ -1,9 +1,9 @@ # # simple test of all group functions # -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Test temporarily disabled for ps-protocol + --skip Test temporarily disabled for ps-protocol and cursor-protocol } set @sav_dpi= @@div_precision_increment; diff --git a/mysql-test/main/func_group_innodb.test b/mysql-test/main/func_group_innodb.test index 6db7fdc2ad7..2f6935ec4a6 100644 --- a/mysql-test/main/func_group_innodb.test +++ b/mysql-test/main/func_group_innodb.test @@ -170,8 +170,10 @@ DROP TABLE t1; --echo # MDEV-4269: crash when grouping by values() --echo # +--disable_cursor_protocol SELECT @@default_storage_engine INTO @old_engine; set default_storage_engine=innodb; +--enable_cursor_protocol create table y select 1 b; select 1 from y group by b; diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index aa24e94655e..5b3909b961e 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -1757,6 +1757,15 @@ JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3') JSON_SET(JSON_OBJECT(l1, {"k1": "v1", "k2": "v2", "k3": "v3"} {"k1": "v1", "k2": "new v2"} {"k1": "v1", "k2": "new v2"} DROP TABLE t; # +# MDEV-27412: JSON_TABLE doesn't properly unquote strings +# +SET @data = '[{"Data": ""}]'; +SELECT +data +FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t; +data + +# # End of 10.6 tests # # diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index eefbc32443d..8f7a0e1aa66 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -24,7 +24,10 @@ select json_array(1); --disable_view_protocol select json_array(1, "text", false, null); +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_array_append('["a", "b"]', '$', FALSE); +--enable_cursor_protocol --enable_view_protocol select json_array_append('{"k1":1, "k2":["a", "b"]}', '$.k2', 2); select json_array_append('["a", ["b", "c"], "d"]', '$[0]', 2); @@ -87,12 +90,18 @@ select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]') as exp; select json_extract('[10, 20, [30, 40], 1, 10]', '$[1]', '$[25]') as exp; select json_extract( '[{"a": [3, 4]}, {"b": 2}]', '$[0].a', '$[1].a') as exp; +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.k1', 'word') as exp; +--enable_cursor_protocol select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.d[3]', 3) as exp; select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.a[2]', 2) as exp; select json_insert('{"a":1, "b":{"c":1}, "d":[1, 2]}', '$.b.c', 'word') as exp; +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_set('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp; +--enable_cursor_protocol select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.c', '[true, false]') as exp; select json_replace('{ "a": 1, "b": [2, 3]}', '$.a', 10, '$.b', '[true, false]') as exp; @@ -134,11 +143,14 @@ select json_merge('a','b'); select json_merge('{"a":"b"}','{"c":"d"}'); SELECT JSON_MERGE('[1, 2]', '{"id": 47}'); +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_type('{"k1":123, "k2":345}'); select json_type('[123, "k2", 345]'); select json_type("true"); select json_type('123'); select json_type('123.12'); +--enable_cursor_protocol select json_keys('{"a":{"c":1, "d":2}, "b":2}'); select json_keys('{"a":{"c":1, "d":2}, "b":2}', "$.a"); @@ -166,21 +178,30 @@ insert into t1 values select json_search( json_col, 'all', 'foot' ) as ex from t1; drop table t1; - +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_unquote('"abc"'); select json_unquote('abc'); +--enable_cursor_protocol + # # MDEV-13703 Illegal mix of collations for operation 'json_object' on using JSON_UNQUOTE as an argument. # create table t1 (c VARCHAR(8)) DEFAULT CHARSET=latin1; insert into t1 values ('abc'),('def'); - + +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_object('foo', json_unquote(json_object('bar', c)),'qux', c) as fld from t1; +--enable_cursor_protocol drop table t1; select json_object("a", json_object("b", "abcd")); +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_object("a", '{"b": "abcd"}'); +--enable_cursor_protocol select json_object("a", json_compact('{"b": "abcd"}')); select json_compact(NULL); @@ -257,8 +278,11 @@ select json_merge('{"a":{"u":12, "x":"b"}}', '{"a":{"x":"c"}}') as ex ; select json_merge('{"a":{"u":12, "x":"b", "r":1}}', '{"a":{"x":"c", "r":2}}') as ex ; select json_compact('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex; +#enable after fix MDEV-31554 +--disable_cursor_protocol select json_loose('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex; select json_detailed('{"a":1, "b":[1,2,3], "c":{"aa":"v1", "bb": "v2"}}') as ex; +--enable_cursor_protocol # # MDEV-11856 json_search doesn't search for values with double quotes character (") @@ -453,9 +477,12 @@ drop table t1; --echo # MDEV-16750 JSON_SET mishandles unicode every second pair of arguments. --echo # +#enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6) as exp; SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6) as exp; SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6') as exp; +--enable_cursor_protocol --echo # --echo # MDEV-17121 JSON_ARRAY_APPEND @@ -1032,12 +1059,15 @@ create table t1 (a varchar(254)); insert into t1 values (concat('x64-', repeat('a', 60))); insert into t1 values (concat('x64-', repeat('b', 60))); insert into t1 values (concat('x64-', repeat('c', 60))); +#enable after fix MDEV-31554 +--disable_cursor_protocol #enable after MDEV-32454 fix --disable_view_protocol --disable_ps2_protocol select json_arrayagg(a) from t1; --enable_ps2_protocol --enable_view_protocol +--enable_cursor_protocol drop table t1; SET group_concat_max_len= default; @@ -1189,6 +1219,18 @@ SELECT JSON_ARRAY_APPEND(JSON_ARRAY(l1, l2, l3, l4), '$[0]', 'k3'), JSON_ARRAY_I SELECT JSON_INSERT(JSON_OBJECT(l1, l2, l3, l4), '$.k3', 'v3'),JSON_SET(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2'),JSON_REPLACE(JSON_OBJECT(l1, l2, l3, l4), '$.k2', 'new v2') from t; DROP TABLE t; + +--echo # +--echo # MDEV-27412: JSON_TABLE doesn't properly unquote strings +--echo # + + +SET @data = '[{"Data": ""}]'; + +SELECT + data +FROM JSON_TABLE (@data, '$[*]' COLUMNS (data text PATH '$.Data')) AS t; + --echo # --echo # End of 10.6 tests --echo # diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test index b32a1a4634b..634511f54fa 100644 --- a/mysql-test/main/func_math.test +++ b/mysql-test/main/func_math.test @@ -567,11 +567,14 @@ select (1.175494351E-37 div 1.7976931348623157E+308); select round(999999999, -9); select round(999999999.0, -9); +#enable after fix MDEV-31555 +--disable_cursor_protocol #enable after fix MDEV-29526 --disable_view_protocol select round(999999999999999999, -18); select round(999999999999999999.0, -18); --enable_view_protocol +--enable_cursor_protocol --echo # --echo # Bug#12537160 ASSERTION FAILED: diff --git a/mysql-test/main/func_misc.test b/mysql-test/main/func_misc.test index 34186db6cf9..709de4461bd 100644 --- a/mysql-test/main/func_misc.test +++ b/mysql-test/main/func_misc.test @@ -254,6 +254,7 @@ SELECT NAME_CONST('var', 'value') COLLATE latin1_general_cs; # # Bug #35848: UUID() returns UUIDs with the wrong time # +--disable_cursor_protocol select @@session.time_zone into @save_tz; # make sure all times are UTC so the DayNr won't differ @@ -265,6 +266,7 @@ select 24 * 60 * 60 * 1000 * 1000 * 10 into @my_uuid_one_day; select concat('0',mid(@my_uuid,16,3),mid(@my_uuid,10,4),left(@my_uuid,8)) into @my_uuidate; select floor(conv(@my_uuidate,16,10)/@my_uuid_one_day) into @my_uuid_date; select 141427 + datediff(curdate(),'1970-01-01') into @my_uuid_synthetic; +--enable_cursor_protocol # these should be identical; date part of UUID should be current date select @my_uuid_date - @my_uuid_synthetic; diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index ba246b8787b..9daabc48769 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -5316,6 +5316,19 @@ SELECT SUBSTR(0,@a) FROM t; SUBSTR(0,@a) DROP TABLE t; # +# MDEV-28386 UBSAN: runtime error: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoull_8bit on SELECT ... OCT +# +CREATE TABLE t1 (c BLOB); +INSERT INTO t1 VALUES ('-9223372036854775808.5'); +SELECT OCT(c) FROM t1; +OCT(c) +1000000000000000000000 +SELECT BIN(c) FROM t1; +BIN(c) +1000000000000000000000000000000000000000000000000000000000000000 +DROP TABLE t1; +DO OCT(-9223372036854775808); +# # End of 10.5 tests # # diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test index df259edf61f..7bc4bd0bb6f 100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@ -92,9 +92,12 @@ SELECT CONCAT('"',CONCAT_WS('";"',repeat('a',60),repeat('b',60),repeat('c',60),r select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es'); select replace('aaaa','a','b'),replace('aaaa','aa','b'),replace('aaaa','a','bb'),replace('aaaa','','b'),replace('bbbb','a','c'); --disable_view_protocol +#chaeck after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata select replace('aaaa','a','bbbb'); --disable_metadata +--enable_cursor_protocol --enable_view_protocol select replace(concat(lcase(concat('THIS',' ','IS',' ','A',' ')),ucase('false'),' ','test'),'FALSE','REAL') as exp; select soundex(''),soundex('he'),soundex('hello all folks'),soundex('#3556 in bugdb'); @@ -145,7 +148,10 @@ select length(unhex(md5("abrakadabra"))); # # Bug #6564: QUOTE(NULL # +#enable after fix MDEV-31587 +--disable_cursor_protocol select concat('a', quote(NULL)); +--enable_cursor_protocol # # Wrong usage of functions @@ -744,8 +750,11 @@ create table t1 (i int); insert into t1 values (1000000000),(1); --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol select lpad(i, 7, ' ') as t from t1; select rpad(i, 7, ' ') as t from t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata drop table t1; @@ -896,6 +905,8 @@ select format(NULL, NULL); select format(pi(), NULL); select format(NULL, 2); +#check after fix MDEV-31587 +--disable_cursor_protocol #enable after fix MDEV-28585 --disable_view_protocol select benchmark(NULL, NULL); @@ -903,16 +914,20 @@ select benchmark(0, NULL); select benchmark(100, NULL); select benchmark(NULL, 1+1); --enable_view_protocol +--enable_cursor_protocol # # Bug #20752: BENCHMARK with many iterations returns too quickly # # not a string, but belongs with the above Bug#22684 +#check after fix MDEV-31587 +--disable_cursor_protocol #enable after fix MDEV-28585 --disable_view_protocol select benchmark(-1, 1); --enable_view_protocol +--enable_cursor_protocol # # Please note: # 1) The collation of the password is irrelevant, the encryption uses @@ -980,26 +995,26 @@ select left('hello', -1); select left('hello', -4294967295); #enable after fix MDEV-29552 --disable_view_protocol +#enable after fix MDEV-34213 +--disable_cursor_protocol select left('hello', 4294967295); ---enable_view_protocol select left('hello', -4294967296); -#enable after fix MDEV-29552 ---disable_view_protocol select left('hello', 4294967296); ---enable_view_protocol select left('hello', -4294967297); -#enable after fix MDEV-29552 ---disable_view_protocol select left('hello', 4294967297); +--enable_cursor_protocol --enable_view_protocol #view protocol generates additional warning --disable_view_protocol select left('hello', -18446744073709551615); select left('hello', 18446744073709551615); select left('hello', -18446744073709551616); +#enable after fix MDEV-34213 +--disable_cursor_protocol select left('hello', 18446744073709551616); select left('hello', -18446744073709551617); select left('hello', 18446744073709551617); +--enable_cursor_protocol --enable_view_protocol select right('hello', 10); @@ -1008,26 +1023,26 @@ select right('hello', -1); select right('hello', -4294967295); #enable after fix MDEV-29552 --disable_view_protocol +#enable after fix MDEV-34213 +--disable_cursor_protocol select right('hello', 4294967295); ---enable_view_protocol select right('hello', -4294967296); -#enable after fix MDEV-29552 ---disable_view_protocol select right('hello', 4294967296); ---enable_view_protocol select right('hello', -4294967297); -#enable after fix MDEV-29552 ---disable_view_protocol select right('hello', 4294967297); +--enable_cursor_protocol --enable_view_protocol #view protocol generates additional warning --disable_view_protocol select right('hello', -18446744073709551615); select right('hello', 18446744073709551615); select right('hello', -18446744073709551616); +#enable after fix MDEV-34213 +--disable_cursor_protocol select right('hello', 18446744073709551616); select right('hello', -18446744073709551617); select right('hello', 18446744073709551617); +--enable_cursor_protocol --enable_view_protocol select substring('hello', 2, -1); @@ -1052,6 +1067,8 @@ select substring('hello', 18446744073709551617, 1); #enable after fix MDEV-28652 --disable_view_protocol select substring('hello', 1, -1); +#check after fix MDEV-31587 +--disable_cursor_protocol select substring('hello', 1, -4294967295); select substring('hello', 1, 4294967295); select substring('hello', 1, -4294967296); @@ -1067,6 +1084,7 @@ select substring('hello', 1, -18446744073709551616); select substring('hello', 1, 18446744073709551616); select substring('hello', 1, -18446744073709551617); select substring('hello', 1, 18446744073709551617); +--enable_cursor_protocol --enable_view_protocol select substring('hello', -1, -1); select substring('hello', -4294967295, -4294967295); @@ -1398,7 +1416,10 @@ create table t1(a float); insert into t1 values (1.33); --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol select format(a, 2) from t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata drop table t1; @@ -1513,9 +1534,11 @@ SELECT CONVERT(('' IN (REVERSE(CAST(('') AS DECIMAL)), '')), CHAR(3)); --echo # CREATE TABLE t1 ( a TEXT ); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT 'aaaaaaaaaaaaaa' INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug58165.txt'; --enable_ps2_protocol +--enable_cursor_protocol SELECT insert( substring_index( 'a', 'a', 'b' ), 1, 0, 'x' ); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug58165.txt' INTO TABLE t1; @@ -1598,11 +1621,17 @@ SELECT format(12345678901234567890.123, 3, 'ar_AE'); SELECT format(12345678901234567890.123, 3, 'ar_SA'); SELECT format(12345678901234567890.123, 3, 'be_BY'); SELECT format(12345678901234567890.123, 3, 'de_DE'); +#check after fix MDEV-31512 +--disable_cursor_protocol SELECT format(12345678901234567890.123, 3, 'en_IN'); SELECT format(12345678901234567890.123, 3, 'en_US'); +--enable_cursor_protocol SELECT format(12345678901234567890.123, 3, 'it_CH'); SELECT format(12345678901234567890.123, 3, 'ru_RU'); +#checkafter fix MDEV-31512 +--disable_cursor_protocol SELECT format(12345678901234567890.123, 3, 'ta_IN'); +--enable_cursor_protocol CREATE TABLE t1 (fmt CHAR(5) NOT NULL); INSERT INTO t1 VALUES ('ar_AE'); @@ -1614,6 +1643,8 @@ INSERT INTO t1 VALUES ('en_US'); INSERT INTO t1 VALUES ('it_CH'); INSERT INTO t1 VALUES ('ru_RU'); INSERT INTO t1 VALUES ('ta_IN'); +#check after fix MDEV-31512 +--disable_cursor_protocol SELECT fmt, format(12345678901234567890.123, 3, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(12345678901234567890.123, 0, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(12345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; @@ -1621,6 +1652,7 @@ SELECT fmt, format(-12345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(-02345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(-00345678901234567890, 3, fmt) FROM t1 ORDER BY fmt; SELECT fmt, format(-00045678901234567890, 3, fmt) FROM t1 ORDER BY fmt; +--enable_cursor_protocol DROP TABLE t1; SELECT format(123, 1, 'Non-existent-locale'); @@ -2065,7 +2097,10 @@ DROP TABLE t1; --disable_view_protocol CREATE TABLE t1 (a INT, b TIME, c TIME); INSERT INTO t1 VALUES (NULL,'22:56:45','22:56:45'),(4,'12:51:42','12:51:42'); +#check after fix MDEV-31512 +--disable_cursor_protocol SELECT REPLACE( BINARY c, a, b ) f FROM t1 GROUP BY f WITH ROLLUP; +--enable_cursor_protocol DROP TABLE t1; --enable_view_protocol @@ -2326,6 +2361,19 @@ CREATE TABLE t (c1 INT,c2 CHAR); SELECT SUBSTR(0,@a) FROM t; DROP TABLE t; +--echo # +--echo # MDEV-28386 UBSAN: runtime error: negation of -X cannot be represented in type 'long long int'; cast to an unsigned type to negate this value to itself in my_strntoull_8bit on SELECT ... OCT +--echo # + +CREATE TABLE t1 (c BLOB); +INSERT INTO t1 VALUES ('-9223372036854775808.5'); +SELECT OCT(c) FROM t1; +SELECT BIN(c) FROM t1; +DROP TABLE t1; + +DO OCT(-9223372036854775808); + + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result index bf7d974873b..5b6977d48af 100644 --- a/mysql-test/main/func_time.result +++ b/mysql-test/main/func_time.result @@ -6425,5 +6425,16 @@ Warning 1292 Truncated incorrect time value: '8390000' Warning 1292 Truncated incorrect time value: '8390000' SET @@timestamp= DEFAULT; # +# MDEV-31302 Assertion `mon > 0 && mon < 13' failed in my_time_t sec_since_epoch(int, int, int, int, int, int) +# +CREATE TABLE t1 (a DATE); +SET @@time_zone='+1:00'; +INSERT INTO t1 VALUES ('2024-00-01'); +SELECT UNIX_TIMESTAMP(MAX(a)) AS a FROM t1; +a +NULL +SET @@time_zone=DEFAULT; +DROP TABLE t1; +# # End of 10.5 tests # diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test index caf6ec1c6cf..cad21b03788 100644 --- a/mysql-test/main/func_time.test +++ b/mysql-test/main/func_time.test @@ -1296,7 +1296,10 @@ SET TIME_ZONE='+02:00'; --echo # CREATE TABLE t1 (a DATE); INSERT INTO t1 VALUES ('2005-05-04'),('2000-02-23'); +#check after fix MDEV-31495 +--disable_cursor_protocol SELECT a, FROM_UNIXTIME(CONCAT(a,'10')) AS f1, FROM_UNIXTIME(CONCAT(a,'10'))+0 AS f2 FROM t1; +--enable_cursor_protocol SELECT * FROM t1 GROUP BY FROM_UNIXTIME(CONCAT(a,'10'))+0; DROP TABLE t1; @@ -1610,7 +1613,10 @@ SELECT DATE_ADD('2001-01-01 10:20:30',INTERVAL 250000000000.0 SECOND) AS c1, DAT --echo # --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol SELECT DATE_ADD('2011-01-02 12:13:14', INTERVAL 1 MINUTE); +--enable_cursor_protocol --enable_view_protocol --disable_metadata @@ -2243,12 +2249,14 @@ SET @sav_slow_query_log= @@session.slow_query_log; --disable_ps2_protocol # @@slow_query_log ON check SET @@session.slow_query_log= ON; +--disable_cursor_protocol SELECT current_timestamp(6),fn_sleep_before_now() INTO @ts_cur, @ts_func; --enable_ps2_protocol --enable_prepare_warnings SELECT a FROM t_ts LIMIT 1 into @ts_func; SELECT a FROM t_trig LIMIT 1 into @ts_trig; +--enable_cursor_protocol if (!`SELECT @ts_cur = @ts_func and @ts_func = @ts_trig`) { SELECT @ts_cur, @ts_func, @ts_trig; @@ -2260,12 +2268,13 @@ DELETE FROM t_trig; --disable_ps2_protocol # @@slow_query_log OFF check SET @@session.slow_query_log= OFF; +--disable_cursor_protocol SELECT current_timestamp(6),fn_sleep_before_now() INTO @ts_cur, @func_ts; --enable_ps2_protocol SELECT a FROM t_ts LIMIT 1 into @ts_func; SELECT a FROM t_trig LIMIT 1 into @ts_trig; --disable_prepare_warnings - +--enable_cursor_protocol if (!`SELECT @ts_cur = @ts_func and @ts_func = @ts_trig`) { SELECT @ts_cur, @ts_func, @ts_trig; @@ -3201,7 +3210,10 @@ SELECT TIME('- 01:00:00'), TIME('- 1 01:00:00'); #enable after fix MDEV-29534 --disable_view_protocol SET time_zone='+00:00'; +#check after fix MDEV-31495 +--disable_cursor_protocol SELECT NULLIF(FROM_UNIXTIME('foo'), '2012-12-12 21:10:14'); +--enable_cursor_protocol SET time_zone=DEFAULT; --enable_view_protocol @@ -3254,6 +3266,17 @@ SELECT SET @@timestamp= DEFAULT; +--echo # +--echo # MDEV-31302 Assertion `mon > 0 && mon < 13' failed in my_time_t sec_since_epoch(int, int, int, int, int, int) +--echo # + +CREATE TABLE t1 (a DATE); +SET @@time_zone='+1:00'; +INSERT INTO t1 VALUES ('2024-00-01'); +SELECT UNIX_TIMESTAMP(MAX(a)) AS a FROM t1; +SET @@time_zone=DEFAULT; +DROP TABLE t1; + --echo # --echo # End of 10.5 tests --echo # diff --git a/mysql-test/main/func_time_round.test b/mysql-test/main/func_time_round.test index 79f9ec289a0..fa13e7cb461 100644 --- a/mysql-test/main/func_time_round.test +++ b/mysql-test/main/func_time_round.test @@ -181,7 +181,10 @@ SELECT YEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; SELECT DAYNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; SELECT MONTHNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +#check after fix MDEV-31555 +--disable_cursor_protocol SELECT LAST_DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +--enable_cursor_protocol SELECT TO_DAYS(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; SELECT DAYOFYEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; @@ -219,7 +222,10 @@ SELECT DAYNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; SELECT MONTHNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; SELECT YEARWEEK(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +#check after fix MDEV-31555 +--disable_cursor_protocol SELECT LAST_DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +--enable_cursor_protocol SELECT TO_DAYS(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; SELECT DAYOFYEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; SELECT DAYOFMONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; diff --git a/mysql-test/main/get_diagnostics.test b/mysql-test/main/get_diagnostics.test index 27c98069384..349b9e4c835 100644 --- a/mysql-test/main/get_diagnostics.test +++ b/mysql-test/main/get_diagnostics.test @@ -284,6 +284,7 @@ GET DIAGNOSTICS CONDITION ABS(2) @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION 1.1 @var = CLASS_ORIGIN; GET DIAGNOSTICS CONDITION "1" @var = CLASS_ORIGIN; +--disable_cursor_protocol # Reset warnings SELECT COUNT(max_questions) INTO @var FROM mysql.user; @@ -303,6 +304,7 @@ GET DIAGNOSTICS CONDITION @cond @var1 = CLASS_ORIGIN; # Reset warnings SELECT COUNT(max_questions) INTO @var FROM mysql.user; +--enable_cursor_protocol DELIMITER |; CREATE PROCEDURE p1() @@ -367,7 +369,9 @@ GET DIAGNOSTICS @var = NUMBER; SELECT @var; --enable_view_protocol +--disable_cursor_protocol SELECT COUNT(max_questions) INTO @var FROM mysql.user; +--enable_cursor_protocol GET DIAGNOSTICS @var = NUMBER; SELECT @var; diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test index 659636b14d3..db03da3dbed 100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@ -403,9 +403,12 @@ select (asWKT(geomfromwkb((0x010100000000000000000024400000000000002440)))) as e --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol create table t1 (g GEOMETRY); select * from t1; select asbinary(g) from t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata drop table t1; @@ -3245,6 +3248,8 @@ CREATE TABLE t1 ( g GEOMETRY ) CHARACTER SET utf8; +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SELECT * FROM t1; @@ -3350,6 +3355,7 @@ FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test index 52f2f78bfe1..3779047124a 100644 --- a/mysql-test/main/grant.test +++ b/mysql-test/main/grant.test @@ -10,7 +10,9 @@ set GLOBAL sql_mode=""; set LOCAL sql_mode=""; SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol connect (master,localhost,root,,); connection master; diff --git a/mysql-test/main/grant2.test b/mysql-test/main/grant2.test index 8f1402c283c..287aaebbbe6 100644 --- a/mysql-test/main/grant2.test +++ b/mysql-test/main/grant2.test @@ -4,7 +4,10 @@ # Save the initial number of concurrent sessions --source include/count_sessions.inc +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol + set GLOBAL sql_mode=""; set LOCAL sql_mode=""; SET NAMES binary; @@ -657,8 +660,10 @@ DROP DATABASE db1; # work out who we are. USE mysql; +--disable_cursor_protocol SELECT LEFT(CURRENT_USER(),INSTR(CURRENT_USER(),'@')-1) INTO @u; SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h; +--enable_cursor_protocol # show current privs. SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; @@ -840,9 +845,11 @@ SHOW CREATE TABLE t1; --echo # INSERT INTO t1 VALUES (1), (2), (3); --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT a INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug27480.txt' FROM t1 --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/bug27480.txt' INTO TABLE t1 --remove_file $MYSQLTEST_VARDIR/tmp/bug27480.txt diff --git a/mysql-test/main/grant_4332.test b/mysql-test/main/grant_4332.test index 8ee42e0f6e0..4d79ddaf5ad 100644 --- a/mysql-test/main/grant_4332.test +++ b/mysql-test/main/grant_4332.test @@ -21,7 +21,10 @@ flush privileges; --enable_metadata --disable_view_protocol +# Check after fix MDEV-31540 +--disable_cursor_protocol select user(); +--enable_cursor_protocol --enable_view_protocol --disable_metadata @@ -43,7 +46,10 @@ flush privileges; --enable_metadata --disable_view_protocol +# Check after fix MDEV-31540 +--disable_cursor_protocol select user(); +--enable_cursor_protocol --enable_view_protocol --disable_metadata diff --git a/mysql-test/main/greedy_optimizer.test b/mysql-test/main/greedy_optimizer.test index 2a830c70677..5a04c0b6537 100644 --- a/mysql-test/main/greedy_optimizer.test +++ b/mysql-test/main/greedy_optimizer.test @@ -424,6 +424,7 @@ EXPLAIN SELECT * FROM t100,t10000,t10; EXPLAIN SELECT * FROM t10000,t10,t100; EXPLAIN SELECT * FROM t10000,t100,t10; +--disable_cursor_protocol ###### ## Ordering between T100,T10000 EQ-joined T10 will ## normally be with smallest EQ-table joined first @@ -492,7 +493,6 @@ WHERE t100.K=t10.I AND t10000.K=t10.K; --source include/check_qep.inc - ##### ## EQ_REF Should be executed before table scan(ALL) ## - Independent of #records in table being EQ_REF-joined @@ -715,6 +715,7 @@ SELECT COUNT(*) FROM t10,t10000 y,t10000 x WHERE x.k=t10.i AND y.i=x.k; --source include/check_qep.inc +--enable_cursor_protocol ######## diff --git a/mysql-test/main/group_by.test b/mysql-test/main/group_by.test index 340a6473eb7..6c2b99c90be 100644 --- a/mysql-test/main/group_by.test +++ b/mysql-test/main/group_by.test @@ -284,6 +284,7 @@ drop table t1; CREATE TABLE t1 (a char(1)); INSERT INTO t1 VALUES ('A'),('B'),('A'),('B'),('A'),('B'),(NULL),('a'),('b'),(NULL),('A'),('B'),(NULL); flush status; +--disable_cursor_protocol --disable_ps2_protocol SELECT a FROM t1 GROUP BY a; SELECT a,count(*) FROM t1 GROUP BY a; @@ -292,11 +293,13 @@ SELECT a,count(*) FROM t1 GROUP BY binary a; SELECT binary a FROM t1 GROUP BY 1; SELECT binary a,count(*) FROM t1 GROUP BY 1; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol show status like 'Created%tables'; --enable_ps_protocol # Do the same tests with on-disk temporary tables set tmp_memory_table_size=0; +--disable_cursor_protocol --disable_ps2_protocol SELECT a FROM t1 GROUP BY a; SELECT a,count(*) FROM t1 GROUP BY a; @@ -305,6 +308,7 @@ SELECT a,count(*) FROM t1 GROUP BY binary a; SELECT binary a FROM t1 GROUP BY 1; SELECT binary a,count(*) FROM t1 GROUP BY 1; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol show status like 'Created%tables'; --enable_ps_protocol @@ -1666,7 +1670,7 @@ DROP TABLE t1, t2; # an additional util connection and other statistics data --disable_ps2_protocol --disable_view_protocol - +--disable_cursor_protocol FLUSH STATUS; # this test case *must* use Aria temp tables CREATE TABLE t1 (f1 INT, f2 decimal(20,1), f3 blob); @@ -1676,6 +1680,7 @@ DROP TABLE t1; --echo the value below *must* be 1 show status like 'Created_tmp_disk_tables'; +--enable_cursor_protocol --enable_view_protocol --enable_ps2_protocol diff --git a/mysql-test/main/group_min_max.test b/mysql-test/main/group_min_max.test index 68ec14975ac..7f974aa61e6 100644 --- a/mysql-test/main/group_min_max.test +++ b/mysql-test/main/group_min_max.test @@ -1727,6 +1727,8 @@ explain select and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +#Enable after fix MDEV-31552 +--disable_cursor_protocol select t1.PARENT_ID, min(CHILD_FIELD) @@ -1734,6 +1736,7 @@ select where t1.PARENT_ID = 1 and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +--enable_cursor_protocol select 1, @@ -1765,6 +1768,8 @@ explain select and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +#Enable after fix MDEV-31552 +--disable_cursor_protocol select t1.PARENT_ID, min(CHILD_FIELD) @@ -1772,6 +1777,7 @@ select where t1.PARENT_ID = 1 and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +--enable_cursor_protocol drop table t1,t2; @@ -1898,6 +1904,8 @@ explain select and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +#Enable after fix MDEV-31552 +--disable_cursor_protocol select t1.PARENT_ID, min(CHILD_FIELD) @@ -1905,6 +1913,7 @@ select where t1.PARENT_ID = 1 and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +--enable_cursor_protocol select 1, @@ -1936,6 +1945,8 @@ explain select and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +#Enable after fix MDEV-31552 +--disable_cursor_protocol select t1.PARENT_ID, min(CHILD_FIELD) @@ -1943,6 +1954,7 @@ select where t1.PARENT_ID = 1 and t1.PARENT_ID = t2.PARENT_ID and t2.CHILD_FIELD = "ZZZZ"; +--enable_cursor_protocol drop table t1,t2; diff --git a/mysql-test/main/handler_read_last.test b/mysql-test/main/handler_read_last.test index 390d5f092fc..56e0b091e67 100644 --- a/mysql-test/main/handler_read_last.test +++ b/mysql-test/main/handler_read_last.test @@ -9,6 +9,7 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a INT, INDEX (a)); INSERT INTO t1 VALUES (),(),(),(),(),(),(),(),(),(); +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; SELECT a FROM t1 ORDER BY a LIMIT 1; @@ -26,6 +27,7 @@ FLUSH STATUS; SELECT a FROM t1 ORDER BY a DESC LIMIT 3; SHOW STATUS LIKE 'HANDLER_READ%'; --enable_ps2_protocol +--enable_cursor_protocol DROP TABLE t1; diff --git a/mysql-test/main/information_schema.test b/mysql-test/main/information_schema.test index fe9853da70f..99e88c4f413 100644 --- a/mysql-test/main/information_schema.test +++ b/mysql-test/main/information_schema.test @@ -1812,14 +1812,18 @@ drop database mysqltest; --disable_result_log SELECT * FROM INFORMATION_SCHEMA.TABLES; --enable_result_log +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @val1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'Opened_tables'; +--enable_cursor_protocol --disable_result_log SELECT ENGINE FROM INFORMATION_SCHEMA.TABLES; --enable_result_log --echo # The below SELECT query should give same output as above SELECT query. +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @val2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'Opened_tables'; +--enable_cursor_protocol --echo # The below select should return '1' SELECT @val1 = @val2; diff --git a/mysql-test/main/information_schema_parameters.test b/mysql-test/main/information_schema_parameters.test index 72b7f2da803..2073730f556 100644 --- a/mysql-test/main/information_schema_parameters.test +++ b/mysql-test/main/information_schema_parameters.test @@ -297,10 +297,12 @@ CREATE FUNCTION test_func5 (s CHAR(20)) RETURNS VARCHAR(30) --echo # We cannot use the index due to missing condition on SPECIFIC_SCHEMA, --echo # but we will use SPECIFIC_NAME for filtering records from mysql.proc FLUSH STATUS; +--disable_cursor_protocol --disable_ps2_protocol query_vertical SELECT * FROM INFORMATION_SCHEMA.PARAMETERS WHERE SPECIFIC_NAME = 'test_func5'; --enable_ps2_protocol +--enable_cursor_protocol --replace_result $count_routines count_routines SHOW STATUS LIKE 'handler_read%next'; @@ -308,6 +310,7 @@ SHOW STATUS LIKE 'handler_read%next'; --echo # We cannot use the index due to CONCAT(), and filtering by SPECIFIC_NAME --echo # does not work either since SPECIFIC_NAME = 'not_existing_proc'. See --echo # the difference in counters in comparison to the previous test +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; query_vertical SELECT * FROM INFORMATION_SCHEMA.PARAMETERS @@ -342,6 +345,7 @@ query_vertical SELECT * FROM INFORMATION_SCHEMA.PARAMETERS AND SPECIFIC_NAME = 'процедурка'; SHOW STATUS LIKE 'handler_read%next'; --enable_ps2_protocol +--enable_cursor_protocol --replace_column 1 # SELECT COUNT(*) FROM information_schema.PARAMETERS diff --git a/mysql-test/main/information_schema_routines.test b/mysql-test/main/information_schema_routines.test index 2509f644b76..4a67499561b 100644 --- a/mysql-test/main/information_schema_routines.test +++ b/mysql-test/main/information_schema_routines.test @@ -270,11 +270,13 @@ CREATE FUNCTION test_func5 (s CHAR(20)) RETURNS VARCHAR(30) --echo # We cannot use the index due to missing condition on SPECIFIC_SCHEMA, --echo # but we will use ROUTINE_NAME for filtering records from mysql.proc FLUSH STATUS; +--disable_cursor_protocol --disable_ps2_protocol --replace_column 24 25 query_vertical SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME = 'test_func5'; --enable_ps2_protocol +--enable_cursor_protocol --replace_result $count_routines count_routines SHOW STATUS LIKE 'handler_read%next'; @@ -282,6 +284,7 @@ SHOW STATUS LIKE 'handler_read%next'; --echo # We cannot use the index due to CONCAT(), and filtering by ROUTINE_NAME --echo # does not work either since ROUTINE_NAME = 'not_existing_proc'. See --echo # the difference in counters in comparison to the previous test +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; query_vertical SELECT * FROM INFORMATION_SCHEMA.ROUTINES @@ -320,6 +323,7 @@ query_vertical SELECT * FROM INFORMATION_SCHEMA.ROUTINES AND ROUTINE_NAME = 'процедурка'; SHOW STATUS LIKE 'handler_read%next'; --enable_ps2_protocol +--enable_cursor_protocol --echo # --echo # Test SHOW PROCEDURE STATUS. It's impossible to use the index here diff --git a/mysql-test/main/init_file.test b/mysql-test/main/init_file.test index 65e54db43ea..57acf7ce6e2 100644 --- a/mysql-test/main/init_file.test +++ b/mysql-test/main/init_file.test @@ -10,8 +10,10 @@ # Bug#23240 --init-file statements with NOW() reports '1970-01-01 11:00:00'as the date time # INSERT INTO init_file.startup VALUES ( NOW() ); +--disable_cursor_protocol SELECT * INTO @X FROM init_file.startup limit 0,1; SELECT * INTO @Y FROM init_file.startup limit 1,1; +--enable_cursor_protocol SELECT YEAR(@X)-YEAR(@Y); --echo ok diff --git a/mysql-test/main/innodb_ext_key.test b/mysql-test/main/innodb_ext_key.test index 3d3a14c801f..8ad328c3de3 100644 --- a/mysql-test/main/innodb_ext_key.test +++ b/mysql-test/main/innodb_ext_key.test @@ -29,6 +29,7 @@ ANALYZE TABLE lineitem PERSISTENT FOR COLUMNS() INDEXES(); --enable_result_log --enable_query_log +--disable_cursor_protocol --disable_ps2_protocol explain select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01'; @@ -153,6 +154,7 @@ select o_orderkey, p_partkey and o_orderkey=l_orderkey and p_partkey=l_partkey; show /*d*/ status like 'handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol --echo # --echo # Bug mdev-3851: ref access used instead of expected eq_ref access @@ -326,7 +328,9 @@ from t1 A, t1 B; explain select * from t1, t2 where t2.a=t1.a and t2.b < 2; flush status; +--disable_cursor_protocol select * from t1, t2 where t2.a=t1.a and t2.b < 2; +--enable_cursor_protocol show /*e*/ status like 'handler_read%'; --enable_ps2_protocol diff --git a/mysql-test/main/insert.test b/mysql-test/main/insert.test index 0a1e63765a4..4b5a5181f09 100644 --- a/mysql-test/main/insert.test +++ b/mysql-test/main/insert.test @@ -596,9 +596,11 @@ CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = cast('' as REPLACE INTO v1 SET f2 = 1; SELECT * from t1; drop view v1; +--disable_cursor_protocol --disable_ps2_protocol SELECT 0,0 INTO OUTFILE 't1.txt'; --enable_ps2_protocol +--enable_cursor_protocol CREATE ALGORITHM = MERGE VIEW v1 AS SELECT f1, f2 FROM t1 WHERE f1 = 'x' WITH CHECK OPTION; --error ER_TRUNCATED_WRONG_VALUE LOAD DATA INFILE 't1.txt' INTO TABLE v1; diff --git a/mysql-test/main/invisible_field.test b/mysql-test/main/invisible_field.test index 8e11981cc02..ef3114b37f0 100644 --- a/mysql-test/main/invisible_field.test +++ b/mysql-test/main/invisible_field.test @@ -251,10 +251,12 @@ DROP TABLE t1; create or replace table t1 (a int, b int invisible); insert into t1 values (1),(2); +--disable_cursor_protocol --enable_prepare_warnings --disable_ps2_protocol select * from t1 into outfile 'f'; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'f' into table t1; select a,b from t1; load data infile 'f' into table t1 (a,@v) SET b=@v; @@ -264,9 +266,11 @@ select a,b from t1; truncate table t1; insert into t1(a,b) values (1,1),(2,2); +--disable_cursor_protocol --disable_ps2_protocol select a,b from t1 into outfile 'a'; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'a' into table t1(a,b); select a,b from t1; load data infile 'a' into table t1 (a,@v) SET b=@v; diff --git a/mysql-test/main/join.test b/mysql-test/main/join.test index f5fb28985b9..1920d954356 100644 --- a/mysql-test/main/join.test +++ b/mysql-test/main/join.test @@ -658,6 +658,7 @@ insert into t2 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); create table t3 (a int not null, primary key(a)); insert into t3 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +--disable_cursor_protocol flush status; --disable_ps2_protocol select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; @@ -665,6 +666,7 @@ select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; explain select * from t1, t2, t3 where t3.a=t1.a and t2.a=t1.b; --echo We expect rnd_next=5, and read_key must be 0 because of short-cutting: show status like 'Handler_read%'; +--enable_cursor_protocol drop table t1, t2, t3; # @@ -959,11 +961,13 @@ INSERT INTO t1 VALUES (3,'b'),(4,NULL),(5,'c'),(6,'cc'),(7,'d'), (8,'dd'),(9,'e'),(10,'ee'); INSERT INTO t2 VALUES (2,NULL); ANALYZE TABLE t1,t2; +--disable_cursor_protocol FLUSH STATUS; --disable_ps2_protocol SELECT * FROM t1 JOIN t2 ON t1.v = t2.v WHERE t2.v IS NULL ORDER BY 1; --enable_ps2_protocol SHOW STATUS LIKE 'Handler_read_%'; +--enable_cursor_protocol DROP TABLE t1, t2; --echo End of 5.1 tests diff --git a/mysql-test/main/join_outer.test b/mysql-test/main/join_outer.test index 83bb7fdeef3..d370a11967e 100644 --- a/mysql-test/main/join_outer.test +++ b/mysql-test/main/join_outer.test @@ -885,9 +885,11 @@ INSERT INTO t2 VALUES EXPLAIN SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL; +--disable_cursor_protocol flush status; SELECT t1.id, a FROM t1 LEFT JOIN t2 ON t1.id=t2.id WHERE t2.b IS NULL; show status like 'Handler_read%'; +--enable_cursor_protocol DROP TABLE t1,t2; --enable_ps2_protocol @@ -1371,7 +1373,6 @@ drop table t1,t2,t3,t4; --echo # table is used in the on condition of an outer join --echo # --disable_ps2_protocol ---disable_view_protocol create table t1 (a int); insert into t1 values (NULL), (NULL), (NULL), (NULL); insert into t1 select * from t1; @@ -1403,16 +1404,18 @@ insert into t3 values (11, 100), (33, 301), (44, 402), (11, 102), (11, 101); insert into t3 values (22, 100), (53, 301), (64, 402), (22, 102), (22, 101); analyze table t1,t2,t3; - +--disable_view_protocol +--disable_cursor_protocol flush status; select sum(t3.b) from t1 left join t3 on t3.a=t1.a and t1.a is not null; show status like "handler_read%"; flush status; select sum(t3.b) from t2 left join t3 on t3.a=t2.a and t2.a <> 10; show status like "handler_read%"; +--enable_cursor_protocol +--enable_view_protocol drop table t1,t2,t3; ---enable_view_protocol --enable_ps2_protocol --echo # diff --git a/mysql-test/main/key_cache.test b/mysql-test/main/key_cache.test index 0829719a442..b25ff58bd1e 100644 --- a/mysql-test/main/key_cache.test +++ b/mysql-test/main/key_cache.test @@ -303,7 +303,9 @@ update t1 set p=3 where p=1; update t2 set i=2 where i=1; select * from information_schema.session_status where variable_name like 'key_%' and variable_name != 'Key_blocks_unused'; +--disable_cursor_protocol select variable_value into @key_blocks_unused from information_schema.session_status where variable_name = 'Key_blocks_unused'; +--enable_cursor_protocol --replace_column 7 # select * from information_schema.key_caches where segment_number is null; diff --git a/mysql-test/main/kill_debug.test b/mysql-test/main/kill_debug.test index 6bade1d8d90..d861b8b4680 100644 --- a/mysql-test/main/kill_debug.test +++ b/mysql-test/main/kill_debug.test @@ -313,7 +313,9 @@ connection default; set debug_sync='now WAIT_FOR go0'; set debug_sync='found_killee SIGNAL go1 WAIT_FOR go2'; evalp kill $id; +--disable_cursor_protocol select variable_value into @threads_cached from information_schema.global_status where variable_name='threads_cached'; +--enable_cursor_protocol set debug_sync='now SIGNAL go3'; if (`select @@thread_handling != 'pool-of-threads'`) { # cannot check that a thread was added to thread pool on windows, but the test works there w/o the wait diff --git a/mysql-test/main/last_value.test b/mysql-test/main/last_value.test index 41cfdb5482d..9e90a8a25bb 100644 --- a/mysql-test/main/last_value.test +++ b/mysql-test/main/last_value.test @@ -33,6 +33,8 @@ DROP TABLE t1; SELECT LAST_VALUE(@last_a:=1,@last_b:=1); select @last_b; --enable_ps_protocol +#Check after fix MDEV-31540 +--disable_cursor_protocol SELECT LAST_VALUE(@last_a:=1,@last_b:=1.0); select @last_b; SELECT LAST_VALUE(@last_a:=1,@last_b:="hello"); @@ -41,6 +43,7 @@ SELECT date(LAST_VALUE(@last_a:=1,@last_b:="2001-02-03")); select @last_b; SELECT LAST_VALUE(@last_a:=1,@last_b:="2001-02-03",NULL); select @last_b; +--enable_cursor_protocol --disable_metadata --error ER_PARSE_ERROR SELECT LAST_VALUE(); diff --git a/mysql-test/main/limit_rows_examined.test b/mysql-test/main/limit_rows_examined.test index 16831a0cf5c..94bbf8e819a 100644 --- a/mysql-test/main/limit_rows_examined.test +++ b/mysql-test/main/limit_rows_examined.test @@ -23,6 +23,8 @@ insert into t2i values ('bb'), ('cc'), ('dd'), ('ff'); --echo Simple joins --echo ========================================================================= +#Check after fix MDEV-31522 +--disable_cursor_protocol --echo Simple nested loops join without blocking set @@join_cache_level=0; explain @@ -457,6 +459,7 @@ SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 14; SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 15; SELECT DISTINCT a FROM t1, t2 HAVING a > ' ' LIMIT ROWS EXAMINED 16; +--enable_cursor_protocol drop table t1,t2,t3; @@ -489,6 +492,7 @@ WHERE alias3.c IN ( SELECT 1 UNION SELECT 6 ) GROUP BY field1, field2, field3, field4, field5 LIMIT ROWS EXAMINED 120; +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; SELECT a AS field1, alias2.d AS field2, alias2.f AS field3, alias2.e AS field4, b AS field5 @@ -508,6 +512,7 @@ LIMIT ROWS EXAMINED 124; SHOW STATUS LIKE 'Handler_read%'; SHOW STATUS LIKE 'Handler_tmp%'; --enable_ps2_protocol +--enable_cursor_protocol drop table t1, t2; diff --git a/mysql-test/main/loaddata.test b/mysql-test/main/loaddata.test index 9c1a583831b..ef1496787d4 100644 --- a/mysql-test/main/loaddata.test +++ b/mysql-test/main/loaddata.test @@ -41,7 +41,9 @@ SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO; create table t1(id integer not null auto_increment primary key); insert into t1 values(0); disable_query_log; +--disable_cursor_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' from t1; +--enable_cursor_protocol delete from t1; eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t1; enable_query_log; @@ -49,9 +51,11 @@ select * from t1; remove_file $MYSQLTEST_VARDIR/tmp/t1; disable_query_log; +--disable_cursor_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n' FROM t1; +--enable_cursor_protocol delete from t1; eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t1 FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'; @@ -94,9 +98,11 @@ INSERT INTO t1 (c1) VALUES SELECT * FROM t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY 'r' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol cat_file $MYSQLTEST_VARDIR/tmp/t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -184,9 +190,11 @@ create table t1(f1 int); insert into t1 values(1),(null); create table t2(f2 int auto_increment primary key); disable_query_log; +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t1' from t1; --enable_ps2_protocol +--enable_cursor_protocol SET @OLD_SQL_MODE=@@SQL_MODE, @@SQL_MODE=NO_AUTO_VALUE_ON_ZERO; eval load data infile '$MYSQLTEST_VARDIR/tmp/t1' into table t2; enable_query_log; @@ -203,20 +211,24 @@ create table t1(f1 int, f2 timestamp not null default current_timestamp); create table t2(f1 int); insert into t2 values(1),(2); disable_query_log; +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLTEST_VARDIR/tmp/t2' from t2; --enable_ps2_protocol +--enable_cursor_protocol eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' ignore into table t1; enable_query_log; select f1 from t1 where f2 <> '0000-00-00 00:00:00' order by f1; remove_file $MYSQLTEST_VARDIR/tmp/t2; delete from t1; disable_query_log; +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t2' FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n' FROM t2; --enable_ps2_protocol +--enable_cursor_protocol eval load data infile '$MYSQLTEST_VARDIR/tmp/t2' ignore into table t1 FIELDS TERMINATED BY '' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\r\n'; enable_query_log; @@ -235,9 +247,11 @@ INSERT INTO t1 (c1, c2, c3, c4) VALUES (10, '1970-02-01 01:02:03', 1.1E-100, 1.1 SELECT * FROM t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1' FIELDS ENCLOSED BY '-' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol cat_file $MYSQLTEST_VARDIR/tmp/t1; echo EOF; @@ -376,8 +390,10 @@ SET sql_mode = ''; --disable_ps2_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT '1 \\\\aa\n' INTO DUMPFILE '$file' --enable_ps2_protocol +--enable_cursor_protocol CREATE TABLE t1 (id INT, val1 CHAR(3)) ENGINE=MyISAM; @@ -389,17 +405,21 @@ SELECT * FROM t1; # show we can write this with OUTFILE, forcing the parameters for now --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file2' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1 --enable_ps2_protocol +--enable_cursor_protocol --diff_files $file $file2 --remove_file $file2 # now show the OUTFILE defaults are correct with NO_BACKSLASH_ESCAPES --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file2' FIELDS TERMINATED BY ' ' FROM t1 --enable_ps2_protocol +--enable_cursor_protocol --diff_files $file $file2 --remove_file $file2 @@ -432,9 +452,11 @@ INSERT INTO t1 (id, val1) VALUES (3, '\tx'); --echo 1.1 NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS TERMINATED BY ' ' @@ -451,9 +473,11 @@ eval SELECT LOAD_FILE("$file") as exp; --echo 1.2 NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS ESCAPED BY '\' TERMINATED BY ' ' FROM t1 ORDER BY id --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS ESCAPED BY '\' TERMINATED BY ' ' @@ -475,9 +499,11 @@ SET sql_mode = ''; --echo 2.1 !NO_BACKSLASH_ESCAPES, use defaults for ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS TERMINATED BY ' ' FROM t1 ORDER BY id --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS TERMINATED BY ' ' @@ -500,9 +526,11 @@ SET sql_mode = ''; --echo 2.2 !NO_BACKSLASH_ESCAPES, override defaults for ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS ESCAPED BY '' TERMINATED BY ' ' FROM t1 ORDER BY id --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval LOAD DATA INFILE '$file' INTO TABLE t2 FIELDS ESCAPED BY '' TERMINATED BY ' ' @@ -544,9 +572,11 @@ INSERT INTO t1 VALUES (1); SET NAMES latin1; SET character_set_filesystem=filename; select @@character_set_filesystem; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 't-1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol DELETE FROM t1; LOAD DATA INFILE 't-1' INTO TABLE t1; SELECT * FROM t1; @@ -568,9 +598,11 @@ select @@character_set_filesystem; --echo # CREATE TABLE t1(col0 LONGBLOB); +--disable_cursor_protocol --disable_ps2_protocol SELECT 'test' INTO OUTFILE 't1.txt'; --enable_ps2_protocol +--enable_cursor_protocol LOAD DATA INFILE 't1.txt' IGNORE INTO TABLE t1 SET col0=col0; SELECT * FROM t1; @@ -639,9 +671,11 @@ disconnect con1; --echo # CREATE TABLE t1(f1 INT); +--disable_cursor_protocol --disable_ps2_protocol EVAL SELECT 0xE1BB30 INTO OUTFILE 't1.dat'; --enable_ps2_protocol +--enable_cursor_protocol --disable_warnings LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8; --enable_warnings @@ -658,7 +692,9 @@ remove_file $MYSQLD_DATADIR/test/t1.dat; --disable_ps2_protocol --let $file=$MYSQLTEST_VARDIR/tmp/bug11735141.txt --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT '1\n' INTO DUMPFILE '$file' +--enable_cursor_protocol --enable_ps2_protocol create table t1(a point); @@ -745,9 +781,11 @@ CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a), UNIQUE(b)); INSERT INTO t1 VALUES (1,1); CREATE TABLE t2 (c INT); CREATE VIEW v AS SELECT t1.* FROM t1 JOIN t2; +--disable_cursor_protocol --disable_ps2_protocol SELECT a, b INTO OUTFILE '15645.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_WRONG_USAGE LOAD DATA INFILE '15645.data' IGNORE INTO TABLE v (a,b); --error ER_WRONG_USAGE diff --git a/mysql-test/main/locking_clause.test b/mysql-test/main/locking_clause.test index ccf51103e49..d198bcf74c4 100644 --- a/mysql-test/main/locking_clause.test +++ b/mysql-test/main/locking_clause.test @@ -152,6 +152,7 @@ DROP USER test2@localhost; --echo # MYSQL 8 --echo # +--disable_cursor_protocol --enable_prepare_warnings SELECT 1 FROM DUAL LIMIT 1 INTO @var FOR UPDATE; SELECT 1 FROM DUAL LIMIT 1 FOR UPDATE INTO @var; @@ -163,3 +164,4 @@ SELECT 1 FROM DUAL LIMIT 1 INTO @var FOR UPDATE INTO @var; SELECT 1 UNION SELECT 1 FOR UPDATE INTO @var; SELECT 1 UNION SELECT 1 INTO @var FOR UPDATE; --disable_prepare_warnings +--enable_cursor_protocol diff --git a/mysql-test/main/log_crash.result b/mysql-test/main/log_crash.result new file mode 100644 index 00000000000..5a820a1fd01 --- /dev/null +++ b/mysql-test/main/log_crash.result @@ -0,0 +1,17 @@ +# +# MDEV-33373: Unexpected ER_FILE_NOT_FOUND upon reading from logging +# table after crash recovery +# +call mtr.add_suppression("Table 'general_log' is marked as crashed and should be repaired"); +SET GLOBAL log_output="TABLE"; +CREATE TABLE t (a INT); +# restart +DROP TABLE t; +SELECT count(*) FROM mysql.general_log; +count(*) +5 +Warnings: +Error 1194 Table 'general_log' is marked as crashed and should be repaired +# +# End of 10.5 tests +# diff --git a/mysql-test/main/log_crash.test b/mysql-test/main/log_crash.test new file mode 100644 index 00000000000..3a6a2ff4454 --- /dev/null +++ b/mysql-test/main/log_crash.test @@ -0,0 +1,25 @@ + +--source include/not_embedded.inc +--source include/have_csv.inc + +--echo # +--echo # MDEV-33373: Unexpected ER_FILE_NOT_FOUND upon reading from logging +--echo # table after crash recovery +--echo # + +call mtr.add_suppression("Table 'general_log' is marked as crashed and should be repaired"); + +--disable_ps_protocol +SET GLOBAL log_output="TABLE"; +CREATE TABLE t (a INT); +--disable_ps_protocol +--let $shutdown_timeout= 0 +--source include/restart_mysqld.inc +DROP TABLE t; +--disable_ps_protocol +SELECT count(*) FROM mysql.general_log; +--enable_ps_protocol + +--echo # +--echo # End of 10.5 tests +--echo # diff --git a/mysql-test/main/log_slow.test b/mysql-test/main/log_slow.test index b11bc00ace9..0b713061a40 100644 --- a/mysql-test/main/log_slow.test +++ b/mysql-test/main/log_slow.test @@ -45,6 +45,7 @@ show fields from mysql.slow_log; # # Check flush command # +--disable_cursor_protocol --disable_ps2_protocol flush slow logs; @@ -75,10 +76,12 @@ SET long_query_time=0.1; --echo # Although this query is disallowed by slow_query_log, it should still increment Slow_queries +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @global_slow_queries FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='SLOW_QUERIES'; SELECT sleep(0.2) INTO @tmp FROM DUAL; +--enable_cursor_protocol SELECT CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment FROM @@ -89,11 +92,13 @@ SELECT --echo # Although this query is disallowed by log_slow_filter, it should still increment Slow_queries SET log_slow_filter=filesort; +--disable_cursor_protocol SELECT sleep(0.2) INTO @tmp FROM DUAL; SELECT VARIABLE_VALUE INTO @global_slow_queries FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='SLOW_QUERIES'; SELECT sleep(0.2) INTO @tmp FROM DUAL; +--enable_cursor_protocol SELECT CAST(VARIABLE_VALUE AS UNSIGNED)-@global_slow_queries AS Slow_queries_increment FROM @@ -118,6 +123,7 @@ show session status like 'Slow_queries'; drop table t; --enable_ps2_protocol +--enable_cursor_protocol --echo # --echo # End of 10.3 tests @@ -141,6 +147,7 @@ CREATE TABLE `tab_MDEV_30820` ( PRIMARY KEY (`id`) ); +--disable_cursor_protocol --disable_ps2_protocol --disable_view_protocol @@ -185,7 +192,7 @@ drop function get_zero; --enable_view_protocol --enable_ps2_protocol ---enable_view_protocol +--enable_cursor_protocol --echo # End of 10.4 tests diff --git a/mysql-test/main/log_slow_innodb.test b/mysql-test/main/log_slow_innodb.test index 9cdb1e0cc0f..09a49f0fe1d 100644 --- a/mysql-test/main/log_slow_innodb.test +++ b/mysql-test/main/log_slow_innodb.test @@ -30,9 +30,11 @@ SET SESSION log_slow_verbosity='innodb,query_plan'; --let log_file=$log_slow_prefix-verbosity_1 --source include/log_slow_start.inc +--disable_cursor_protocol --disable_ps2_protocol SELECT sum(a+b) FROM t1; --enable_ps2_protocol +--enable_cursor_protocol UPDATE t1 set b=b+1 where a=1 or a=999; --source include/log_slow_stop.inc @@ -51,9 +53,11 @@ SET SESSION log_slow_verbosity='innodb,query_plan'; --let log_file=$log_slow_prefix-verbosity_2 --source include/log_slow_start.inc +--disable_cursor_protocol --disable_ps2_protocol SELECT 1; --enable_ps2_protocol +--enable_cursor_protocol --source include/log_slow_stop.inc --let log_slow_verbosity_expected_matches= 2 diff --git a/mysql-test/main/log_tables-big.test b/mysql-test/main/log_tables-big.test index 0861c79126e..c94e0179c91 100644 --- a/mysql-test/main/log_tables-big.test +++ b/mysql-test/main/log_tables-big.test @@ -16,6 +16,7 @@ connect (con2,localhost,root,,); # # Bug #27638: slow logging to CSV table inserts bad query_time and lock_time values # +--disable_cursor_protocol --disable_ps2_protocol connection con1; set session long_query_time=10; @@ -38,5 +39,5 @@ connection default; disconnect con1; disconnect con2; --enable_ps2_protocol - +--enable_cursor_protocol set @@global.log_output = @log_output.saved; diff --git a/mysql-test/main/log_tables.test b/mysql-test/main/log_tables.test index 37df8d46859..46d7de2dd26 100644 --- a/mysql-test/main/log_tables.test +++ b/mysql-test/main/log_tables.test @@ -836,7 +836,9 @@ SET GLOBAL slow_query_log = @old_slow_query_log; --echo # Bug#21557 entries in the general query log truncated at 1000 characters. --echo # +--disable_cursor_protocol select CONNECTION_ID() into @thread_id; +--enable_cursor_protocol --disable_ps_protocol truncate table mysql.general_log; --enable_ps_protocol @@ -1007,9 +1009,12 @@ INSERT INTO t1 VALUES (3,3,3); INSERT INTO t1 VALUES (4,4,4); --disable_ps2_protocol +#Enable after fix MDEV-31522 +--disable_cursor_protocol SELECT SQL_NO_CACHE 'Bug#31700 - SCAN',f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f3=4; SELECT SQL_NO_CACHE 'Bug#31700 - KEY', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f2=3; SELECT SQL_NO_CACHE 'Bug#31700 - PK', f1,f2,f3,SLEEP(1.1) FROM t1 WHERE f1=2; +--enable_cursor_protocol --replace_column 1 TIMESTAMP SELECT start_time, rows_examined, rows_sent, sql_text FROM mysql.slow_log WHERE sql_text LIKE '%Bug#31700%' ORDER BY start_time; @@ -1037,6 +1042,7 @@ unlock tables; --echo # --echo # MDEV-33267 User with minimal permissions can intentionally corrupt mysql.slow_log table --echo # +--disable_cursor_protocol truncate mysql.slow_log; set global log_output= 'TABLE'; create user u@localhost; @@ -1052,6 +1058,7 @@ select 'after evil-doing', sleep(0.2); select distinct sql_text from mysql.slow_log where sql_text like '%evil%'; set global log_output=default; drop user u@localhost; +--enable_cursor_protocol SET @@global.log_output= @old_log_output; SET @@global.slow_query_log= @old_slow_query_log; diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test index 8acb5e9e080..973b8ff72a9 100644 --- a/mysql-test/main/long_unique_bugs.test +++ b/mysql-test/main/long_unique_bugs.test @@ -12,9 +12,11 @@ insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(), (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(), (),(),(),(); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'load.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol create temporary table tmp (a varchar(1024), b int, c int, d int, e linestring, unique (e)); load data infile 'load.data' into table tmp; delete from tmp; @@ -226,9 +228,11 @@ drop table t1; --echo # CREATE TABLE t1 (data VARCHAR(4), unique(data) using hash) with system versioning; INSERT INTO t1 VALUES ('A'); +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 'load.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DUP_ENTRY LOAD DATA INFILE 'load.data' INTO TABLE t1; select * from t1; @@ -242,9 +246,11 @@ DROP TABLE t1; CREATE TABLE t1 (data VARCHAR(7961)) ENGINE=InnoDB; INSERT INTO t1 VALUES ('f'), ('o'), ('o'); +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 'load.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol ALTER IGNORE TABLE t1 ADD UNIQUE INDEX (data); SELECT * FROM t1; @@ -509,9 +515,11 @@ drop table t2; --echo # create table t1 (pk int primary key, f blob, unique(f)) engine=innodb; insert t1 values (1, null); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 't1.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol load data infile 't1.data' replace into table t1; select * from t1; drop table t1; diff --git a/mysql-test/main/lowercase_table.test b/mysql-test/main/lowercase_table.test index 8d493fff5cd..6af80f1c339 100644 --- a/mysql-test/main/lowercase_table.test +++ b/mysql-test/main/lowercase_table.test @@ -2,9 +2,6 @@ # Test of --lower-case-table-names # -#remove this include after fix MDEV-27944 ---source include/no_view_protocol.inc - create table T1 (id int primary key, Word varchar(40) not null, Index(Word)); create table t4 (id int primary key, Word varchar(40) not null); INSERT INTO T1 VALUES (1, 'a'), (2, 'b'), (3, 'c'); @@ -36,8 +33,10 @@ drop table t1; create database mysqltest; use MYSQLTEST; create table t1 (a int); +--disable_service_connection select T1.a from MYSQLTEST.T1; select t1.a from MYSQLTEST.T1; +--enable_service_connection select mysqltest.t1.* from MYSQLTEST.t1; select MYSQLTEST.t1.* from MYSQLTEST.t1; select MYSQLTEST.T1.* from MYSQLTEST.T1; diff --git a/mysql-test/main/lowercase_table_qcache.test b/mysql-test/main/lowercase_table_qcache.test index b6047a98c74..ceff2719353 100644 --- a/mysql-test/main/lowercase_table_qcache.test +++ b/mysql-test/main/lowercase_table_qcache.test @@ -13,6 +13,7 @@ set LOCAL query_cache_type=ON; drop database if exists MySQLtesT; --enable_warnings +--disable_cursor_protocol create database MySQLtesT; create table MySQLtesT.t1 (a int); select * from MySQLtesT.t1; @@ -30,6 +31,7 @@ disable_result_log; select * from MySQL.db; enable_result_log; show status like "Qcache_queries_in_cache"; +--enable_cursor_protocol set GLOBAL query_cache_size=@save_query_cache_size; set GLOBAL query_cache_type=default; diff --git a/mysql-test/main/mdev-21101.test b/mysql-test/main/mdev-21101.test index 543b587c5e6..99a8c3006e5 100644 --- a/mysql-test/main/mdev-21101.test +++ b/mysql-test/main/mdev-21101.test @@ -10,12 +10,14 @@ # different connections simultaneously, to force queueing occurs. # Verify connections are intact, even if queueing time exceeds wait_timeout +--disable_cursor_protocol SELECT @@global.wait_timeout, @@global.thread_pool_max_threads, @@global.thread_pool_size, @@global.thread_pool_oversubscribe, @@global.thread_pool_stall_limit INTO @_wait_timeout,@_thread_pool_max_threads,@_thread_pool_size, @_thread_pool_oversubscribe,@_thread_pool_stall_limit; +--enable_cursor_protocol SET @@global.wait_timeout=1, @@global.thread_pool_max_threads=2, diff --git a/mysql-test/main/mdev-31636.result b/mysql-test/main/mdev-31636.result new file mode 100644 index 00000000000..82dcd03027c --- /dev/null +++ b/mysql-test/main/mdev-31636.result @@ -0,0 +1,8 @@ +RESET MASTER; +SET +@@global.gtid_binlog_state='1-1-101,2-1-2002', +@@global.slave_parallel_mode=x; +ERROR 42000: Variable 'slave_parallel_mode' can't be set to the value of 'x' +SELECT @@global.gtid_binlog_state; +@@global.gtid_binlog_state + diff --git a/mysql-test/main/mdev-31636.test b/mysql-test/main/mdev-31636.test new file mode 100644 index 00000000000..b5affaef60c --- /dev/null +++ b/mysql-test/main/mdev-31636.test @@ -0,0 +1,7 @@ +--source include/have_log_bin.inc +RESET MASTER; +--error ER_WRONG_VALUE_FOR_VAR +SET + @@global.gtid_binlog_state='1-1-101,2-1-2002', + @@global.slave_parallel_mode=x; +SELECT @@global.gtid_binlog_state; diff --git a/mysql-test/main/myisam_debug.test b/mysql-test/main/myisam_debug.test index 2659a3f9347..f24639a7fd6 100644 --- a/mysql-test/main/myisam_debug.test +++ b/mysql-test/main/myisam_debug.test @@ -48,12 +48,14 @@ let $wait_condition= INFO = "INSERT INTO t1(id) SELECT id FROM t2"; --source include/wait_condition.inc +--disable_cursor_protocol --enable_prepare_warnings SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'wait_in_enable_indexes' AND INFO = "INSERT INTO t1(id) SELECT id FROM t2" INTO @thread_id; --disable_prepare_warnings +--enable_cursor_protocol KILL QUERY @thread_id; CHECK TABLE t1; diff --git a/mysql-test/main/mysqladmin.test b/mysql-test/main/mysqladmin.test index 07e23cfe25c..554e49e57f4 100644 --- a/mysql-test/main/mysqladmin.test +++ b/mysql-test/main/mysqladmin.test @@ -75,7 +75,9 @@ let $restart_parameters=--ssl-key=$ssl_key --ssl-cert=$ssl_cert; --source include/restart_mysqld.inc connect ssl_con,localhost,root,,,,,SSL; +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @ssl_not_after FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after'; +--enable_cursor_protocol let $ssl_not_after=`SELECT @ssl_not_after`; remove_file $ssl_cert; diff --git a/mysql-test/main/mysqld--help,win.rdiff b/mysql-test/main/mysqld--help,win.rdiff index a42c0c6f81f..88bb67fa740 100644 --- a/mysql-test/main/mysqld--help,win.rdiff +++ b/mysql-test/main/mysqld--help,win.rdiff @@ -1,5 +1,5 @@ ---- main/mysqld--help.result 2023-11-30 02:21:51.951132200 +0100 -+++ main/mysqld--help,win.reject 2023-11-30 02:35:44.404612300 +0100 +--- main/mysqld--help.result ++++ main/mysqld--help,win.reject @@ -191,6 +191,7 @@ --console Write error output on screen; don't remove the console window on windows. @@ -8,7 +8,7 @@ -h, --datadir=name Path to the database root directory --date-format=name The DATE format (ignored) --datetime-format=name -@@ -696,6 +697,7 @@ +@@ -695,6 +696,7 @@ Use MySQL-5.6 (instead of MariaDB-5.3) format for TIME, DATETIME, TIMESTAMP columns. (Defaults to on; use --skip-mysql56-temporal-format to disable.) @@ -16,7 +16,7 @@ --net-buffer-length=# Buffer length for TCP/IP and socket communication --net-read-timeout=# -@@ -1351,6 +1353,10 @@ +@@ -1375,6 +1377,10 @@ Alias for log_slow_query_file. Log slow queries to given log file. Defaults logging to 'hostname'-slow.log. Must be enabled to activate other slow log options @@ -27,7 +27,7 @@ --socket=name Socket file to use for connection --sort-buffer-size=# Each thread that needs to do a sort allocates a buffer of -@@ -1376,6 +1382,7 @@ +@@ -1400,6 +1406,7 @@ deleting or updating every row in a table. --stack-trace Print a symbolic stack trace on failure (Defaults to on; use --skip-stack-trace to disable.) @@ -35,19 +35,20 @@ --standard-compliant-cte Allow only CTEs compliant to SQL standard (Defaults to on; use --skip-standard-compliant-cte to disable.) -@@ -1454,6 +1461,11 @@ +@@ -1478,6 +1485,12 @@ --thread-pool-max-threads=# Maximum allowed number of worker threads in the thread pool + --thread-pool-min-threads=# + Minimum number of threads in the thread pool. + --thread-pool-mode=name -+ Chose implementation of the threadpool. One of: windows, -+ generic ++ Chose implementation of the threadpool. Use 'windows' ++ unless you have a workload with a lot of concurrent ++ connections and minimal contention --thread-pool-oversubscribe=# How many additional active worker threads in a group are allowed. -@@ -1493,8 +1505,8 @@ +@@ -1517,8 +1530,8 @@ automatically convert it to an on-disk MyISAM or Aria table. -t, --tmpdir=name Path for temporary files. Several paths may be specified, @@ -58,7 +59,7 @@ --transaction-alloc-block-size=# Allocation block size for transactions to be stored in binary log -@@ -1716,6 +1728,7 @@ +@@ -1740,6 +1753,7 @@ myisam-stats-method NULLS_UNEQUAL myisam-use-mmap FALSE mysql56-temporal-format TRUE @@ -66,7 +67,7 @@ net-buffer-length 16384 net-read-timeout 30 net-retry-count 10 -@@ -1874,6 +1887,7 @@ +@@ -1900,6 +1914,7 @@ slave-type-conversions slow-launch-time 2 slow-query-log FALSE @@ -74,7 +75,7 @@ sort-buffer-size 2097152 sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION sql-safe-updates FALSE -@@ -1901,6 +1915,8 @@ +@@ -1927,6 +1942,8 @@ thread-pool-exact-stats FALSE thread-pool-idle-timeout 60 thread-pool-max-threads 65536 diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index cc16fdaf981..b3a60a1a00b 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -747,8 +747,10 @@ The following specify which files/extra groups are read (specified before remain Disable doubling of the Cardinality for InnoDB secondary keys. fix_reuse_range_for_ref = Do a better job at reusing range access estimates when estimating ref - access. This variable will be deleted in MariaDB 11.0 as - it is not needed with the new 11.0 optimizer. + access. fix_card_multiplier = Fix the computation in + selectivity_for_indexes. selectivity_multiplier. This + variable will be deleted in MariaDB 11.0 as it is not + needed with the new 11.0 optimizer. Use 'ALL' to set all combinations. --optimizer-extra-pruning-depth=# If the optimizer needs to enumerate join prefix of this diff --git a/mysql-test/main/mysqldump-max.test b/mysql-test/main/mysqldump-max.test index e85490b7352..6e92bb90ea2 100644 --- a/mysql-test/main/mysqldump-max.test +++ b/mysql-test/main/mysqldump-max.test @@ -81,8 +81,10 @@ drop table t6; # type to avoid Inno's column-number limits (~1000 columns) etc. # Here because it needs Inno-engine. +--disable_cursor_protocol SELECT @@global.default_storage_engine INTO @old_engine; SET GLOBAL default_storage_engine=InnoDB; +--enable_cursor_protocol --disable_query_log CREATE TABLE `t1` ( diff --git a/mysql-test/main/null.test b/mysql-test/main/null.test index 7256ce1cc5b..b7180d9d0a5 100644 --- a/mysql-test/main/null.test +++ b/mysql-test/main/null.test @@ -322,7 +322,10 @@ CREATE TABLE t1 (a YEAR(2)); --disable_prepare_warnings INSERT INTO t1 VALUES (0); SELECT a,NULLIF(a,2000),NULLIF(2000,a) FROM t1; +# Enable after fix MDEV-31722 +--disable_cursor_protocol SELECT a,NULLIF(a,2001),NULLIF(2001,a) FROM t1; +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/mysql-test/main/null_key.test b/mysql-test/main/null_key.test index e0c318f7d59..e78384162c9 100644 --- a/mysql-test/main/null_key.test +++ b/mysql-test/main/null_key.test @@ -237,11 +237,13 @@ EXPLAIN SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b; FLUSH STATUS ; --disable_ps2_protocol +--disable_cursor_protocol SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a LEFT JOIN t3 ON t2.b=t3.b; --disable_view_protocol SELECT FOUND_ROWS(); +--enable_cursor_protocol SHOW STATUS LIKE "handler_read%"; --enable_view_protocol --enable_ps2_protocol diff --git a/mysql-test/main/order_by.test b/mysql-test/main/order_by.test index 2f85bd59cf9..1869b367b69 100644 --- a/mysql-test/main/order_by.test +++ b/mysql-test/main/order_by.test @@ -825,7 +825,10 @@ eval set @tmp_tables_before = CAST(REPLACE('$q', 'Created_tmp_tables', '') AS UNSIGNED); --enable_query_log +#Enable after fix MDEV-31548 +--disable_cursor_protocol SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (a, ab) GROUP BY a; +--enable_cursor_protocol # this query creates one temporary table in itself, which we are not # interested in. @@ -847,7 +850,10 @@ eval set @tmp_tables_before = CAST(REPLACE('$q', 'Created_tmp_tables', '') AS UNSIGNED); --enable_query_log +#Enable after fix MDEV-31548 +--disable_cursor_protocol SELECT a FROM t1 IGNORE INDEX FOR ORDER BY (a, ab) ORDER BY a; +--enable_cursor_protocol --disable_query_log --let $q = `show status like 'Created_tmp_tables';` @@ -1877,6 +1883,7 @@ insert into t1 analyze table t1; --enable_result_log +--disable_cursor_protocol --disable_view_protocol --disable_ps2_protocol explain @@ -1900,6 +1907,7 @@ select b, count(*) num_cnt from t1 show status like '%Handler_read%'; --enable_ps2_protocol --enable_view_protocol +--enable_cursor_protocol drop table t0, t1; diff --git a/mysql-test/main/order_by_pack_big.test b/mysql-test/main/order_by_pack_big.test index b83a5416e91..717027e3e5a 100644 --- a/mysql-test/main/order_by_pack_big.test +++ b/mysql-test/main/order_by_pack_big.test @@ -145,16 +145,20 @@ set sort_buffer_size= 2097152; --source include/analyze-format.inc eval ANALYZE FORMAT=JSON SELECT id, names, address FROM t3 ORDER BY names, address; flush status; +--disable_cursor_protocol --disable_ps2_protocol evalp SELECT id, names, address INTO OUTFILE '$file1' FROM t3 ORDER BY names, address; --enable_ps2_protocol +--enable_cursor_protocol --echo # Sort_merge_passes should be 0 show status like '%sort%'; +--disable_cursor_protocol --disable_ps2_protocol evalp SELECT id, names, address INTO OUTFILE '$file2' FROM t3 FORCE INDEX(idx) ORDER BY names, address; --enable_ps2_protocol +--enable_cursor_protocol diff_files $file1 $file2; @@ -171,9 +175,11 @@ set sort_buffer_size= 1097152; --source include/analyze-format.inc eval ANALYZE FORMAT=JSON SELECT id, names, address FROM t3 ORDER BY names, address; flush status; +--disable_cursor_protocol --disable_ps2_protocol evalp SELECT id, names, address INTO OUTFILE '$file1' FROM t3 ORDER BY names, address; --enable_ps2_protocol +--enable_cursor_protocol --echo # Sort_merge_passes should be 0 show status like '%sort%'; diff --git a/mysql-test/main/outfile.test b/mysql-test/main/outfile.test index 7f8f31bc748..f9bd76dcd95 100644 --- a/mysql-test/main/outfile.test +++ b/mysql-test/main/outfile.test @@ -21,29 +21,41 @@ drop table if exists t1; create table t1 (`a` blob); insert into t1 values("hello world"),("Hello mars"),(NULL); disable_query_log; +--disable_cursor_protocol eval select * into outfile "../../tmp/outfile-test.1" from t1; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.1")); disable_query_log; +--disable_cursor_protocol eval select * into dumpfile "../../tmp/outfile-test.2" from t1 limit 1; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.2")); disable_query_log; +--disable_cursor_protocol eval select * into dumpfile "../../tmp/outfile-test.3" from t1 where a is null; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.3")); # the following should give errors disable_query_log; +--disable_cursor_protocol --error ER_FILE_EXISTS_ERROR eval select * into outfile "../../tmp/outfile-test.1" from t1; +--enable_cursor_protocol +--disable_cursor_protocol --error ER_FILE_EXISTS_ERROR eval select * into dumpfile "../../tmp/outfile-test.2" from t1; +--enable_cursor_protocol +--disable_cursor_protocol --error ER_FILE_EXISTS_ERROR eval select * into dumpfile "../../tmp/outfile-test.3" from t1; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.not-exist")); --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.1 @@ -53,7 +65,9 @@ drop table t1; # Bug#8191 SELECT INTO OUTFILE insists on FROM clause disable_query_log; +--disable_cursor_protocol eval select 1 into outfile "../../tmp/outfile-test.4"; +--enable_cursor_protocol enable_query_log; select load_file(concat(@tmpdir,"/outfile-test.4")); --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4 @@ -76,17 +90,21 @@ DROP TABLE t1; # Bug#13202 SELECT * INTO OUTFILE ... FROM information_schema.schemata now fails # disable_query_log; +--disable_cursor_protocol eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FROM information_schema.schemata LIMIT 0, 5; +--enable_cursor_protocol # enable_query_log; --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4 use information_schema; # disable_query_log; +--disable_cursor_protocol eval SELECT * INTO OUTFILE "../../tmp/outfile-test.4" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' FROM schemata LIMIT 0, 5; +--enable_cursor_protocol enable_query_log; --remove_file $MYSQLTEST_VARDIR/tmp/outfile-test.4 use test; @@ -97,8 +115,10 @@ use test; # It should not be possible to write to a file outside of vardir create table t1(a int); --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +--disable_cursor_protocol --error ER_OPTION_PREVENTS_STATEMENT eval select * into outfile "$MYSQL_TEST_DIR/outfile-test1" from t1; +--enable_cursor_protocol drop table t1; # @@ -110,6 +130,7 @@ create user user_1@localhost; grant all on mysqltest.* to user_1@localhost; connect (con28181_1,localhost,user_1,,mysqltest); +--disable_cursor_protocol --error ER_ACCESS_DENIED_ERROR eval select schema_name into outfile "../../tmp/outfile-test.4" @@ -117,18 +138,21 @@ fields terminated by ',' optionally enclosed by '"' lines terminated by '\n' from information_schema.schemata where schema_name like 'mysqltest'; +--enable_cursor_protocol connection default; disconnect con28181_1; grant file on *.* to user_1@localhost; connect (con28181_2,localhost,user_1,,mysqltest); +--disable_cursor_protocol eval select schema_name into outfile "../../tmp/outfile-test.4" fields terminated by ',' optionally enclosed by '"' lines terminated by '\n' from information_schema.schemata where schema_name like 'mysqltest'; +--enable_cursor_protocol connection default; disconnect con28181_2; diff --git a/mysql-test/main/outfile_loaddata.test b/mysql-test/main/outfile_loaddata.test index bb0ced72717..f812f46c692 100644 --- a/mysql-test/main/outfile_loaddata.test +++ b/mysql-test/main/outfile_loaddata.test @@ -15,7 +15,9 @@ INSERT INTO t1 VALUES (101, 202, '-r-', '=raker='); --echo # $clauses, warning: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -30,7 +32,9 @@ DROP TABLE t2; --echo # Only numeric fields, $clauses, no warnings: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -45,7 +49,9 @@ DROP TABLE t2; --echo # $clauses, warning: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -60,7 +66,9 @@ DROP TABLE t2; --echo # $clauses, warning: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -75,7 +83,9 @@ DROP TABLE t2; --echo # Only string fields, $clauses, no warnings: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT $fields INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/bug31663.txt' $clauses FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --eval SELECT LOAD_FILE('$MYSQLTEST_VARDIR/tmp/bug31663.txt') as exp --eval CREATE TABLE t2 SELECT $fields FROM t1 @@ -98,7 +108,9 @@ SELECT HEX(c1) FROM t1; --let $file=$MYSQLTEST_VARDIR/tmp/bug32533.txt --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS ENCLOSED BY 0xC3 FROM t1 +--enable_cursor_protocol TRUNCATE t1; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR @@ -133,13 +145,17 @@ INSERT INTO t1 VALUES (1, 'ABC-ÐБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL); --echo # Error on multi-character ENCLOSED/ESCAPED BY --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --error 1083 --eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ENCLOSED BY '12345' +--enable_cursor_protocol --remove_file $file --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --error 1083 --eval SELECT * FROM t1 INTO OUTFILE '$file' FIELDS ESCAPED BY '12345' +--enable_cursor_protocol --remove_file $file @@ -147,21 +163,27 @@ INSERT INTO t1 VALUES (1, 'ABC-ÐБВ', 'DEF-ÂÃÄ'), (2, NULL, NULL); --echo # LOAD DATA rises error or has unpredictable result -- to be fixed later --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS ENCLOSED BY 'ÑŠ' FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --error 1083 # backward compatibility --eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS ENCLOSED BY 'ÑŠ' --remove_file $file --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS ESCAPED BY 'ÑŠ' FROM t1 +--enable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --error 1083 # backward compatibility --eval LOAD DATA INFILE '$file' INTO TABLE t2 CHARACTER SET binary FIELDS ESCAPED BY 'ÑŠ' --remove_file $file --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' FIELDS TERMINATED BY 'ÑŠ' FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -174,7 +196,9 @@ SELECT * FROM t1; SELECT * FROM t2; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' LINES STARTING BY 'ÑŠ' FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -185,7 +209,9 @@ TRUNCATE t2; SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' LINES TERMINATED BY 'ÑŠ' FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -200,7 +226,9 @@ SELECT * FROM t2; --echo # Default (binary) charset: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -214,7 +242,9 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; --echo # latin1 charset (INTO OUTFILE warning is expected): --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' CHARACTER SET latin1 FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -228,7 +258,9 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; --echo # KOI8-R charset (INTO OUTFILE warning is expected): --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' CHARACTER SET koi8r FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -242,7 +274,9 @@ SELECT * FROM t1 UNION SELECT * FROM t2 ORDER BY a, b, c; --echo # UTF-8 charset: --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE '$file' CHARACTER SET utf8 FROM t1 +--enable_cursor_protocol --echo ################################################## --cat_file $file --echo ################################################## @@ -274,7 +308,9 @@ let $length= 800; --eval INSERT INTO t1 VALUES (REPEAT('.', $length)) --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --eval SELECT * INTO OUTFILE $file CHARACTER SET latin1 FROM t1 +--enable_cursor_protocol --echo # should be greater than $length --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR diff --git a/mysql-test/main/parser.test b/mysql-test/main/parser.test index 09ca6e292a1..5ddbaf29314 100644 --- a/mysql-test/main/parser.test +++ b/mysql-test/main/parser.test @@ -896,6 +896,7 @@ SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 FOR UPDATE; --echo # "INTO" clause tests +--disable_cursor_protocol --enable_prepare_warnings SELECT 1 FROM t1 INTO @var17727401; SELECT 1 FROM DUAL INTO @var17727401; @@ -942,6 +943,7 @@ SELECT 1 INTO @var17727401 FROM t1 PROCEDURE ANALYSE(); --error ER_PARSE_ERROR SELECT 1 FROM t1 PROCEDURE ANALYSE() INTO @var17727401; +--enable_cursor_protocol --echo # ORDER and LIMIT clause combinations diff --git a/mysql-test/main/parser_stack.test b/mysql-test/main/parser_stack.test index 5d53ff98902..a39f715addc 100644 --- a/mysql-test/main/parser_stack.test +++ b/mysql-test/main/parser_stack.test @@ -1,6 +1,6 @@ -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Test temporarily disabled for ps-protocol + --skip Test temporarily disabled for ps-protocol and cursor-protocol } # # These tests are designed to cause an internal parser stack overflow, diff --git a/mysql-test/main/partition.test b/mysql-test/main/partition.test index dd778ebdab9..ed7437e4a15 100644 --- a/mysql-test/main/partition.test +++ b/mysql-test/main/partition.test @@ -476,6 +476,7 @@ INSERT INTO `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13), EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20); +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20); @@ -488,6 +489,7 @@ SELECT c1 FROM t2 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20); SHOW STATUS LIKE 'Handler_read_%'; DROP TABLE t1,t2; --enable_ps2_protocol +--enable_cursor_protocol # Bug#37329 Range scan on partitioned tables shows higher Handler_read_next # (marked as duplicate of Bug#35931) @@ -509,6 +511,7 @@ INSERT INTO `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13), EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5); +--disable_cursor_protocol --disable_ps2_protocol FLUSH STATUS; SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5); @@ -533,6 +536,7 @@ SELECT c1 FROM t2 WHERE (c1 > 12 AND c1 < 15); SHOW STATUS LIKE 'Handler_read_%'; DROP TABLE t1,t2; --enable_ps2_protocol +--enable_cursor_protocol --error ER_PARTITION_FUNCTION_IS_NOT_ALLOWED create table t1 (a int) partition by list ((a/3)*10 div 1) diff --git a/mysql-test/main/partition_csv.test b/mysql-test/main/partition_csv.test index 44013dd4b0a..2057d8cac3b 100644 --- a/mysql-test/main/partition_csv.test +++ b/mysql-test/main/partition_csv.test @@ -57,7 +57,9 @@ ALTER TABLE gl_partitioned PARTITION BY HASH (thread_id) PARTITIONS 10; ALTER TABLE general_log RENAME TO gl_nonpartitioned; ALTER TABLE gl_partitioned RENAME TO general_log; +--disable_cursor_protocol SELECT @@global.log_output INTO @old_glo; +--enable_cursor_protocol SET GLOBAL log_output='table'; SET GLOBAL general_log =1; diff --git a/mysql-test/main/partition_explicit_prune.test b/mysql-test/main/partition_explicit_prune.test index d1fbd187c25..859dcba6ddc 100644 --- a/mysql-test/main/partition_explicit_prune.test +++ b/mysql-test/main/partition_explicit_prune.test @@ -9,6 +9,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; --echo # --echo # Bug#13559657: PARTITION SELECTION DOES NOT WORK WITH VIEWS --echo # +--disable_cursor_protocol --disable_view_protocol --disable_ps2_protocol CREATE TABLE t1 (a int) @@ -625,6 +626,7 @@ SELECT * FROM t3 PARTITION (pNeg); DROP TABLE t1, t2, t3; --enable_ps2_protocol --enable_view_protocol +--enable_cursor_protocol --echo # Test from superseeded WL# 2682 # Partition select tests. # diff --git a/mysql-test/main/plugin.test b/mysql-test/main/plugin.test index 9151a6e905c..6d03f0fd8f8 100644 --- a/mysql-test/main/plugin.test +++ b/mysql-test/main/plugin.test @@ -87,7 +87,9 @@ UNINSTALL PLUGIN example; # INSTALL PLUGIN example SONAME 'ha_example'; +--disable_cursor_protocol select @@session.sql_mode into @old_sql_mode; +--enable_cursor_protocol # first, try normal sql_mode (no error, send OK) set session sql_mode=''; diff --git a/mysql-test/main/processlist.test b/mysql-test/main/processlist.test index 7e60f196f65..1d3827fd7a2 100644 --- a/mysql-test/main/processlist.test +++ b/mysql-test/main/processlist.test @@ -66,7 +66,10 @@ set debug_sync='reset'; SET NAMES utf8; --vertical_results +#Check after fix MDEV-31514 +--disable_cursor_protocol SELECT INFO, INFO_BINARY, 'xxx😎yyy' AS utf8mb4_string FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO LIKE '%xxx%yyy%'; +--enable_cursor_protocol --horizontal_results --echo # diff --git a/mysql-test/main/ps.test b/mysql-test/main/ps.test index c7568f73beb..ff1e9e9f13e 100644 --- a/mysql-test/main/ps.test +++ b/mysql-test/main/ps.test @@ -2000,7 +2000,10 @@ prepare stmt from "create view v1 as select * from `t1` `b`"; prepare stmt from "select ?"; set @arg= 123456789.987654321; +#Enable after fix MDEV-31495 +--disable_cursor_protocol select @arg; +--enable_cursor_protocol execute stmt using @arg; set @arg= "string"; select @arg; @@ -2009,7 +2012,10 @@ set @arg= 123456; select @arg; execute stmt using @arg; set @arg= cast(-12345.54321 as decimal(20, 10)); +#Enable after fix MDEV-31495 +--disable_cursor_protocol select @arg; +--enable_cursor_protocol execute stmt using @arg; deallocate prepare stmt; @@ -3331,6 +3337,8 @@ SELECT @x_str_1, @x_int_1, @x_int_2, @x_int_3; --echo --echo -- Testing decs... +#Enable after fix MDEV-31495 +--disable_cursor_protocol --echo EXECUTE stmt_dec USING @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; @@ -3338,6 +3346,7 @@ SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; --echo EXECUTE stmt_dec USING @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; SELECT @x_int_1, @x_dec_1, @x_dec_2, @x_dec_3; +--enable_cursor_protocol --echo DEALLOCATE PREPARE stmt_str; @@ -3570,7 +3579,9 @@ execute st; show status like '%Handler_read%'; flush status; --disable_ps2_protocol +--disable_cursor_protocol select * from t1 use index() where a=3; +--enable_cursor_protocol show status like '%Handler_read%'; --enable_ps2_protocol flush status; diff --git a/mysql-test/main/ps_missed_cmds.test b/mysql-test/main/ps_missed_cmds.test index e8b4e263008..0bf12a2e477 100644 --- a/mysql-test/main/ps_missed_cmds.test +++ b/mysql-test/main/ps_missed_cmds.test @@ -1,8 +1,8 @@ --source include/have_innodb.inc -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Need regular protocol but ps-protocol was specified + --skip Need regular protocol but ps-protocol and cursor-protocol were specified } SET @save_storage_engine= @@default_storage_engine; diff --git a/mysql-test/main/ps_missed_cmds_not_embedded.test b/mysql-test/main/ps_missed_cmds_not_embedded.test index 2e7eebedf91..018334b912c 100644 --- a/mysql-test/main/ps_missed_cmds_not_embedded.test +++ b/mysql-test/main/ps_missed_cmds_not_embedded.test @@ -1,9 +1,9 @@ --source include/not_embedded.inc --source include/have_innodb.inc -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Need regular protocol but ps-protocol was specified + --skip Test temporarily disabled for ps-protocol and cursor-protocol } SET @save_storage_engine= @@default_storage_engine; diff --git a/mysql-test/main/query_cache.test b/mysql-test/main/query_cache.test index feb9ecf526c..8c6af0a65c4 100644 --- a/mysql-test/main/query_cache.test +++ b/mysql-test/main/query_cache.test @@ -21,6 +21,7 @@ SET LOCAL query_cache_type= ON; # Reset query cache variables. +--disable_cursor_protocol flush query cache; # This crashed in some versions flush query cache; # This crashed in some versions reset query cache; @@ -1806,6 +1807,7 @@ SELECT foo( LAST_INSERT_ID() ) from t1; show status like "Qcache_queries_in_cache"; DROP FUNCTION foo; drop table t1; +--enable_cursor_protocol --echo # --echo # MDEV-33861: main.query_cache fails with embedded after @@ -1861,7 +1863,9 @@ create table t1 (a text); insert into t1 values ('{"a":"foo"}'); flush status; SHOW STATUS LIKE 'Qcache_inserts'; +--disable_cursor_protocol select * from t1, json_table(t1.a, '$' columns (f varchar(20) path '$.a')) as jt; +--enable_cursor_protocol SHOW STATUS LIKE 'Qcache_inserts'; drop table t1; diff --git a/mysql-test/main/query_cache_debug.test b/mysql-test/main/query_cache_debug.test index 5942e6f42aa..d9c6cb1c94f 100644 --- a/mysql-test/main/query_cache_debug.test +++ b/mysql-test/main/query_cache_debug.test @@ -94,7 +94,9 @@ connection con1; --reap SHOW STATUS LIKE "Qcache_queries_in_cache"; --echo # Test that it's cacheable +--disable_cursor_protocol SELECT * FROM t1; +--enable_cursor_protocol SHOW STATUS LIKE "Qcache_queries_in_cache"; disconnect con1; diff --git a/mysql-test/main/query_cache_innodb.test b/mysql-test/main/query_cache_innodb.test index 7ac96220c11..143cc5ee6d6 100644 --- a/mysql-test/main/query_cache_innodb.test +++ b/mysql-test/main/query_cache_innodb.test @@ -20,7 +20,9 @@ create table t2 ( t2id int unsigned, id int unsigned, primary key(t2id, id), for --disable_view_protocol insert into t1 values (1); insert into t2 values (1,1); +--disable_cursor_protocol select * from t2; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; delete from t1; @@ -41,7 +43,9 @@ create table `t2$Ñ—` ( t2id int unsigned, id int unsigned, primary key(t2id, id) insert into `t1$Ñ—` values (1); insert into `t2$Ñ—`values (1,1); +--disable_cursor_protocol select * from `t2$Ñ—`; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; delete from `t1$Ñ—`; @@ -63,7 +67,9 @@ create table `#mysql50#t-2` ( t2id int unsigned, id int unsigned, primary key(t2 insert into `#mysql50#t-1` values (1); insert into `#mysql50#t-2`values (1,1); +--disable_cursor_protocol select * from `#mysql50#t-2`; +--enable_cursor_protocol show status like "Qcache_queries_in_cache"; delete from `#mysql50#t-1`; diff --git a/mysql-test/main/query_cache_merge.test b/mysql-test/main/query_cache_merge.test index c3267d628b9..bca3fb352d1 100644 --- a/mysql-test/main/query_cache_merge.test +++ b/mysql-test/main/query_cache_merge.test @@ -40,6 +40,7 @@ while ($1) # --disable_ps2_protocol --disable_view_protocol +--disable_cursor_protocol set @save_table_definition_cache= @@global.table_definition_cache; set @@global.table_definition_cache=512; create table t00 (a int) engine=MERGE UNION=(t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253,t254,t255,t256,t257) INSERT_METHOD=FIRST; @@ -54,6 +55,7 @@ drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t2 SET @@global.query_cache_size=0; set @@global.table_definition_cache=@save_table_definition_cache; +--enable_cursor_protocol --enable_view_protocol --enable_ps2_protocol @@ -88,8 +90,10 @@ eval CREATE TABLE t0 (a INT) ENGINE=MERGE UNION($str); SET GLOBAL query_cache_size = 1048576; FLUSH STATUS; --disable_view_protocol +--disable_cursor_protocol SELECT a FROM t0 WHERE a = 1; SHOW STATUS LIKE "Qcache_queries_in_cache"; +--enable_cursor_protocol --enable_view_protocol let $c= 255; diff --git a/mysql-test/main/query_cache_notembedded.test b/mysql-test/main/query_cache_notembedded.test index 5f97dc5c00d..73fc4340bf1 100644 --- a/mysql-test/main/query_cache_notembedded.test +++ b/mysql-test/main/query_cache_notembedded.test @@ -26,6 +26,7 @@ drop table if exists t1, t2, t3, t11, t21; # # FLUSH QUERY CACHE # +--disable_cursor_protocol create table t1 (a int not null); insert into t1 values (1),(2),(3); create table t2 (a int not null); @@ -85,6 +86,7 @@ flush query cache; show status like "Qcache_total_blocks"; show status like "Qcache_free_blocks"; drop table t1, t2, t3, t11, t21; +--enable_cursor_protocol # # do not use QC if tables locked (Bug#12385) @@ -114,6 +116,7 @@ disconnect root2; # improved to also test Bug#3583 and Bug#12990 # --disable_ps2_protocol +--disable_cursor_protocol flush query cache; reset query cache; flush status; @@ -186,6 +189,7 @@ call f1(); call f3(); call f3(); call f1(); +--enable_cursor_protocol drop procedure f1; drop procedure f2; @@ -248,6 +252,7 @@ SET @@global.log_bin_trust_function_creators = @old_log_bin_trust_function_creat # # Bug #30269 Query cache eats memory # +--disable_cursor_protocol --disable_warnings DROP DATABASE IF EXISTS bug30269; --enable_warnings @@ -269,6 +274,7 @@ SELECT id FROM test1 WHERE id>2; show status like 'Qcache_queries_in_cache'; SELECT id FROM view1 WHERE id>2; show status like 'Qcache_queries_in_cache'; +--enable_cursor_protocol connection default; USE test; diff --git a/mysql-test/main/query_cache_with_views.test b/mysql-test/main/query_cache_with_views.test index 6740c70883e..c1e3ed96cd3 100644 --- a/mysql-test/main/query_cache_with_views.test +++ b/mysql-test/main/query_cache_with_views.test @@ -18,6 +18,7 @@ set GLOBAL query_cache_size=1355776; flush status; create table t1 (a int, b int); +--disable_cursor_protocol # queries with following views should not be in query cache create view v1 (c,d) as select sql_no_cache a,b from t1; create view v2 (c,d) as select a+rand(),b from t1; @@ -66,6 +67,7 @@ show status like "Qcache_hits"; drop view v1; set query_cache_type=default; --enable_ps2_protocol +--enable_cursor_protocol drop table t1; @@ -110,6 +112,7 @@ drop table t1; # # BUG#15119: returning temptable view from the query cache. # +--disable_cursor_protocol --disable_ps2_protocol flush status; create table t1 (a int, b int); @@ -137,6 +140,7 @@ show status like "Qcache_inserts"; show status like "Qcache_hits"; drop table t1; --enable_ps2_protocol +--enable_cursor_protocol --echo # --echo # Bug46615 Assertion in Query_cache::invalidate in INSERT in a VIEW of a MERGE table diff --git a/mysql-test/main/range_vs_index_merge.test b/mysql-test/main/range_vs_index_merge.test index c4b90bc646b..5e8647ccd58 100644 --- a/mysql-test/main/range_vs_index_merge.test +++ b/mysql-test/main/range_vs_index_merge.test @@ -693,6 +693,7 @@ DROP INDEX CityName on City; CREATE INDEX Name ON City(Name); CREATE INDEX Population ON City(Population); +--disable_cursor_protocol --disable_ps2_protocol --disable_view_protocol --replace_column 9 # @@ -756,6 +757,7 @@ ORDER BY Population LIMIT 5; SHOW STATUS LIKE 'Handler_read_%'; --enable_view_protocol --enable_ps2_protocol +--enable_cursor_protocol set optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/main/select.test b/mysql-test/main/select.test index 8ea52b4e39d..ac9753a86bd 100644 --- a/mysql-test/main/select.test +++ b/mysql-test/main/select.test @@ -1846,10 +1846,15 @@ select wss_type from t1 where wss_type ='102935229216544104'; select wss_type from t1 where wss_type ='102935229216544093'; select wss_type from t1 where wss_type =102935229216544093; drop table t1; +--disable_cursor_protocol select 1+2,"aaaa",3.13*2.0 into @a,@b,@c; +--enable_cursor_protocol select @a; select @b; +#Enable after fix MDEV-31495 +--disable_cursor_protocol select @c; +--enable_cursor_protocol # # Test of removing redundant braces in the FROM part @@ -2199,7 +2204,10 @@ INSERT INTO t1 (SELECT * FROM t1 WHERE a = 50 AND b = 3); select found_rows(); SELECT * FROM t1; +# Check after fix MDEV-31522 +--disable_cursor_protocol select count(*) from t1; +--enable_cursor_protocol select found_rows(); select count(*) from t1 limit 2,3; select found_rows(); @@ -3733,6 +3741,7 @@ DROP TABLE t1; # # Bug #32942 now() - interval '7200' second is NOT pre-calculated, causing "full table scan" # +--disable_cursor_protocol --disable_ps2_protocol --disable_view_protocol CREATE TABLE t1 (a INT, b INT); @@ -3750,6 +3759,7 @@ SHOW STATUS LIKE 'Handler_read%'; DROP TABLE t1, t2; --enable_view_protocol --enable_ps2_protocol +--enable_cursor_protocol # # Bug#40953 SELECT query throws "ERROR 1062 (23000): Duplicate entry..." error @@ -3826,10 +3836,12 @@ CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (2),(3); --echo # Should not crash +--disable_cursor_protocol --error ER_SUBQUERY_NO_1_ROW SELECT 1 FROM t1 WHERE a <> 1 AND NOT ROW(1,a) <=> ROW(1,(SELECT 1 FROM t1)) INTO @var0; +--enable_cursor_protocol DROP TABLE t1; diff --git a/mysql-test/main/select_found.test b/mysql-test/main/select_found.test index dac16fdb727..abbfd6cc3ef 100644 --- a/mysql-test/main/select_found.test +++ b/mysql-test/main/select_found.test @@ -178,14 +178,19 @@ DROP TABLE t1; # # Bug #6089: queries which don't use any tables # - +# Check after fix MDEV-31522 +--disable_cursor_protocol SELECT 'foo'; +--enable_cursor_protocol SELECT FOUND_ROWS(); SELECT SQL_CALC_FOUND_ROWS 'foo'; SELECT FOUND_ROWS(); SELECT SQL_CALC_FOUND_ROWS 'foo' limit 0; +# Check after fix MDEV-31522 +--disable_cursor_protocol SELECT FOUND_ROWS(); SELECT FOUND_ROWS(); +--enable_cursor_protocol SELECT SQL_CALC_FOUND_ROWS 'foo' UNION SELECT 'bar' LIMIT 0; SELECT FOUND_ROWS(); diff --git a/mysql-test/main/selectivity_innodb_notembedded.result b/mysql-test/main/selectivity_innodb_notembedded.result index a387d241ff3..61e6330492a 100644 --- a/mysql-test/main/selectivity_innodb_notembedded.result +++ b/mysql-test/main/selectivity_innodb_notembedded.result @@ -220,6 +220,134 @@ JS set optimizer_trace=@trace_tmp; drop table t1; # +# MDEV-34993: Incorrect cardinality estimation causes poor query plan +# +create table t1 ( +pk int, +key1 int, +filler char(100), +index (key1, pk), +primary key (pk) +); +insert into t1 +select +seq, FLOOR(seq/100), 'filler' +from +seq_1_to_1000; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +set optimizer_trace=1; +explain select * from t1 +where +pk in (1,2,3,4,5) and +key1 <= 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,key1 PRIMARY 4 NULL 5 Using where +# Must have a note that "multiplier is too high": +select +json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from +information_schema.optimizer_trace; +JS +[ + [ + { + "index_name": "PRIMARY", + "selectivity_from_index": 0.005 + }, + { + "index_name": "key1", + "selectivity_from_index": 0.399, + "selectivity_multiplier": 90.9091 + } + ] +] +# Must not include 1.79...e308 as cost: +select +json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from +information_schema.optimizer_trace; +JS +[ + { + "table": "t1", + "considered_access_paths": + [ + { + "access_type": "range", + "resulting_rows": 181.3636545, + "cost": 1.79769e308, + "chosen": true + } + ], + "chosen_access_method": + { + "type": "range", + "records": 181.3636545, + "cost": 1.79769e308, + "uses_join_buffering": false + } + } +] +# Disable the fix and try the same: +set @@optimizer_adjust_secondary_key_costs=''; +explain select * from t1 +where +pk in (1,2,3,4,5) and +key1 <= 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,key1 PRIMARY 4 NULL 5 Using where +drop table t1; +# Shows a high multiplier, without a "note": +select +json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from +information_schema.optimizer_trace; +JS +[ + [ + { + "index_name": "PRIMARY", + "selectivity_from_index": 0.005 + }, + { + "index_name": "key1", + "selectivity_from_index": 0.399, + "selectivity_multiplier": 90.9091 + } + ] +] +# Includes 1.79...e308 as cost: +select +json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from +information_schema.optimizer_trace; +JS +[ + { + "table": "t1", + "considered_access_paths": + [ + { + "access_type": "range", + "resulting_rows": 181.3636545, + "cost": 1.79769e308, + "chosen": true + } + ], + "chosen_access_method": + { + "type": "range", + "records": 181.3636545, + "cost": 1.79769e308, + "uses_join_buffering": false + } + } +] +set optimizer_adjust_secondary_key_costs=default; +# # Clean up # set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; diff --git a/mysql-test/main/selectivity_innodb_notembedded.test b/mysql-test/main/selectivity_innodb_notembedded.test index 387f7dcb7de..bc07bcad464 100644 --- a/mysql-test/main/selectivity_innodb_notembedded.test +++ b/mysql-test/main/selectivity_innodb_notembedded.test @@ -3,6 +3,7 @@ --source include/big_test.inc --source include/default_optimizer_switch.inc --source include/not_embedded.inc +--source ./include/innodb_stable_estimates.inc SET SESSION STORAGE_ENGINE='InnoDB'; diff --git a/mysql-test/main/selectivity_notembedded.result b/mysql-test/main/selectivity_notembedded.result index ac8922a2579..262da1d33df 100644 --- a/mysql-test/main/selectivity_notembedded.result +++ b/mysql-test/main/selectivity_notembedded.result @@ -215,6 +215,134 @@ JS set optimizer_trace=@trace_tmp; drop table t1; # +# MDEV-34993: Incorrect cardinality estimation causes poor query plan +# +create table t1 ( +pk int, +key1 int, +filler char(100), +index (key1, pk), +primary key (pk) +); +insert into t1 +select +seq, FLOOR(seq/100), 'filler' +from +seq_1_to_1000; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status Table is already up to date +set optimizer_trace=1; +explain select * from t1 +where +pk in (1,2,3,4,5) and +key1 <= 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,key1 PRIMARY 4 NULL 5 Using index condition; Using where +# Must have a note that "multiplier is too high": +select +json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from +information_schema.optimizer_trace; +JS +[ + [ + { + "index_name": "PRIMARY", + "selectivity_from_index": 0.005 + }, + { + "index_name": "key1", + "selectivity_from_index": 0.391, + "selectivity_multiplier": 90.9091 + } + ] +] +# Must not include 1.79...e308 as cost: +select +json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from +information_schema.optimizer_trace; +JS +[ + { + "table": "t1", + "considered_access_paths": + [ + { + "access_type": "range", + "resulting_rows": 177.7272905, + "cost": 1.79769e308, + "chosen": true + } + ], + "chosen_access_method": + { + "type": "range", + "records": 177.7272905, + "cost": 1.79769e308, + "uses_join_buffering": false + } + } +] +# Disable the fix and try the same: +set @@optimizer_adjust_secondary_key_costs=''; +explain select * from t1 +where +pk in (1,2,3,4,5) and +key1 <= 4; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range PRIMARY,key1 PRIMARY 4 NULL 5 Using index condition; Using where +drop table t1; +# Shows a high multiplier, without a "note": +select +json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from +information_schema.optimizer_trace; +JS +[ + [ + { + "index_name": "PRIMARY", + "selectivity_from_index": 0.005 + }, + { + "index_name": "key1", + "selectivity_from_index": 0.391, + "selectivity_multiplier": 90.9091 + } + ] +] +# Includes 1.79...e308 as cost: +select +json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from +information_schema.optimizer_trace; +JS +[ + { + "table": "t1", + "considered_access_paths": + [ + { + "access_type": "range", + "resulting_rows": 177.7272905, + "cost": 1.79769e308, + "chosen": true + } + ], + "chosen_access_method": + { + "type": "range", + "records": 177.7272905, + "cost": 1.79769e308, + "uses_join_buffering": false + } + } +] +set optimizer_adjust_secondary_key_costs=default; +# # Clean up # set optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; diff --git a/mysql-test/main/selectivity_notembedded.test b/mysql-test/main/selectivity_notembedded.test index 323e4ca6bd6..2c4431adb23 100644 --- a/mysql-test/main/selectivity_notembedded.test +++ b/mysql-test/main/selectivity_notembedded.test @@ -220,6 +220,63 @@ from set optimizer_trace=@trace_tmp; drop table t1; +--echo # +--echo # MDEV-34993: Incorrect cardinality estimation causes poor query plan +--echo # + +create table t1 ( + pk int, + key1 int, + filler char(100), + index (key1, pk), + primary key (pk) +); + +insert into t1 +select + seq, FLOOR(seq/100), 'filler' +from + seq_1_to_1000; +analyze table t1; + +set optimizer_trace=1; +explain select * from t1 +where + pk in (1,2,3,4,5) and + key1 <= 4; + +--echo # Must have a note that "multiplier is too high": +select + json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from + information_schema.optimizer_trace; + +--echo # Must not include 1.79...e308 as cost: +select + json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from + information_schema.optimizer_trace; + +--echo # Disable the fix and try the same: +set @@optimizer_adjust_secondary_key_costs=''; +explain select * from t1 +where + pk in (1,2,3,4,5) and + key1 <= 4; +drop table t1; +--echo # Shows a high multiplier, without a "note": +select + json_detailed(json_extract(trace,'$**.selectivity_for_indexes')) as JS +from + information_schema.optimizer_trace; + +--echo # Includes 1.79...e308 as cost: +select + json_detailed(json_extract(trace,'$**.best_access_path')) as JS +from + information_schema.optimizer_trace; +set optimizer_adjust_secondary_key_costs=default; + --echo # --echo # Clean up --echo # diff --git a/mysql-test/main/set_statement.test b/mysql-test/main/set_statement.test index afe39c0054e..7a0624ad16b 100644 --- a/mysql-test/main/set_statement.test +++ b/mysql-test/main/set_statement.test @@ -976,6 +976,7 @@ SET STATEMENT keycache1.key_buffer_size=1024 FOR SELECT 1; # # MDEV-6940: SET STATEMENT executed after SET GLOBAL does not work # +--disable_cursor_protocol --disable_ps2_protocol --disable_view_protocol set @save_general_log=@@global.general_log; @@ -1048,6 +1049,7 @@ select sql_text from mysql.slow_log where sql_text not like 'set @@long_query_ti --echo #--- --enable_view_protocol --enable_ps2_protocol +--enable_cursor_protocol # # log_slow_verbosity is impossible to check because results are not written # in TABLE mode diff --git a/mysql-test/main/shutdown_debug.test b/mysql-test/main/shutdown_debug.test index 587b88dc55e..664b4aea25e 100644 --- a/mysql-test/main/shutdown_debug.test +++ b/mysql-test/main/shutdown_debug.test @@ -8,7 +8,9 @@ source include/have_debug.inc; call mtr.add_suppression('Thread .* did not exit'); set @old_dbug=@@global.debug_dbug; set global debug_dbug='+d,CONNECT_wait'; +--disable_cursor_protocol select variable_value into @cons from information_schema.global_status where variable_name='connections'; +--enable_cursor_protocol exec $MYSQL -e "select sleep(3600)" >/dev/null 2>&1 &; let $wait_condition= select variable_value>@cons from information_schema.global_status where variable_name='connections'; source include/wait_condition.inc; diff --git a/mysql-test/main/single_delete_update.test b/mysql-test/main/single_delete_update.test index 0f2dc189e94..49a1b6b758d 100644 --- a/mysql-test/main/single_delete_update.test +++ b/mysql-test/main/single_delete_update.test @@ -12,6 +12,7 @@ --echo # limit efficiently --echo # +--disable_cursor_protocol CREATE TABLE t1 (i INT); INSERT INTO t1 VALUES (10),(11),(12),(13),(14),(15),(16),(17),(18),(19), (20),(21),(22),(23),(24),(25); @@ -457,3 +458,4 @@ SELECT * FROM t2 WHERE c = 10 ORDER BY a DESC, b DESC; DROP TABLE t1, t2; --enable_ps2_protocol +--enable_cursor_protocol diff --git a/mysql-test/main/sp-error.test b/mysql-test/main/sp-error.test index c112dd0f531..bb9868be1a1 100644 --- a/mysql-test/main/sp-error.test +++ b/mysql-test/main/sp-error.test @@ -12,8 +12,10 @@ drop table if exists t1, t2; # Backup the mysql.proc table --enable_prepare_warnings --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol eval SELECT * FROM mysql.proc INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/proc.txt'; --disable_prepare_warnings +--enable_cursor_protocol --enable_ps2_protocol # Make sure we don't have any procedures left. delete from mysql.proc; diff --git a/mysql-test/main/sp-no-valgrind.test b/mysql-test/main/sp-no-valgrind.test index 6bacc7b150c..10a238f9871 100644 --- a/mysql-test/main/sp-no-valgrind.test +++ b/mysql-test/main/sp-no-valgrind.test @@ -5,18 +5,24 @@ --echo # Warmup round, this might allocate some memory for session variable --echo # and the output +--disable_cursor_protocol SELECT VARIABLE_VALUE into @global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; SELECT VARIABLE_VALUE into @local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; +--enable_cursor_protocol CREATE PROCEDURE sp0() SELECT 1; SHOW CREATE PROCEDURE sp0; DROP PROCEDURE sp0; #Check that CREATE/SHOW does not use memory in caches. +--disable_cursor_protocol SELECT VARIABLE_VALUE into @global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; SELECT VARIABLE_VALUE into @local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; +--enable_cursor_protocol CREATE PROCEDURE sp1() SELECT 1; SHOW CREATE PROCEDURE sp1; +--disable_cursor_protocol SELECT VARIABLE_VALUE-@local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; +--enable_cursor_protocol # FIXME: MDEV-26754 main.sp test fails for embedded server #SELECT VARIABLE_VALUE-@global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED'; DROP PROCEDURE sp1; diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index 2bc71bd1db6..41f41cda9fc 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -19,9 +19,9 @@ # Tests that require multibyte character sets, which are not always available, # go into separate files (e.g. sp-ucs2.test) -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Need regular protocol but ps-protocol was specified + --skip Need regular protocol but ps-protocol and cursor-protocol were specified } --source include/default_charset.inc @@ -3024,8 +3024,10 @@ create procedure bug5251() begin end| +--disable_cursor_protocol select created into @c1 from mysql.proc where db='test' and name='bug5251'| +--enable_cursor_protocol --sleep 2 alter procedure bug5251 comment 'foobar'| select count(*) from mysql.proc @@ -8255,12 +8257,16 @@ drop procedure if exists p; --enable_warnings set @old_mode= @@sql_mode; set @@sql_mode= cast(pow(2,32)-1 as unsigned integer); +--disable_cursor_protocol select @@sql_mode into @full_mode; +--enable_cursor_protocol create procedure p() as begin end; call p(); set @@sql_mode= @old_mode; # Rename SQL modes that differ in name between the server and the table definition. +--disable_cursor_protocol select replace(@full_mode, 'ALLOW_INVALID_DATES', 'INVALID_DATES') into @full_mode; +--enable_cursor_protocol select name from mysql.proc where name = 'p' and sql_mode = @full_mode; drop procedure p; diff --git a/mysql-test/main/sp_trans.test b/mysql-test/main/sp_trans.test index e7adcccb9e1..653e418752e 100644 --- a/mysql-test/main/sp_trans.test +++ b/mysql-test/main/sp_trans.test @@ -612,9 +612,11 @@ drop table t3| # BUG#11758414: Default default_storage_engine not honored when set # from within a stored procedure # +--disable_cursor_protocol SELECT @@GLOBAL.default_storage_engine INTO @old_engine| SET @@GLOBAL.default_storage_engine=InnoDB| SET @@SESSION.default_storage_engine=InnoDB| +--enable_cursor_protocol # show defaults at define-time SHOW GLOBAL VARIABLES LIKE 'default_storage_engine'| SHOW SESSION VARIABLES LIKE 'default_storage_engine'| diff --git a/mysql-test/main/statistics.test b/mysql-test/main/statistics.test index c964bc2ec23..2a0e374f1ae 100644 --- a/mysql-test/main/statistics.test +++ b/mysql-test/main/statistics.test @@ -332,6 +332,7 @@ SELECT * FROM mysql.column_stats; --sorted_result SELECT * FROM mysql.index_stats; +--disable_cursor_protocol --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR --disable_ps2_protocol eval @@ -344,6 +345,7 @@ SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/save_index_stats' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM mysql.index_stats WHERE index_name IN ('idx1', 'idx4'); --enable_ps2_protocol +--enable_cursor_protocol ALTER TABLE t1 CHANGE COLUMN b x varchar(30); SHOW CREATE TABLE t1; diff --git a/mysql-test/main/status2.test b/mysql-test/main/status2.test index 339e853f2fc..bf35890722e 100644 --- a/mysql-test/main/status2.test +++ b/mysql-test/main/status2.test @@ -27,6 +27,7 @@ CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND CREATE TABLE t1 (c1 INT); CREATE TABLE t2 (c1 INT); +--disable_cursor_protocol --echo Assert Questions == 7 SHOW STATUS LIKE 'Questions'; SELECT testQuestion(); @@ -38,6 +39,7 @@ SHOW STATUS LIKE 'Questions'; SELECT 1; --echo Assert Questions == 13 SHOW STATUS LIKE 'Questions'; +--enable_cursor_protocol connect (con1,localhost,root,,); connection con1; SELECT 1; diff --git a/mysql-test/main/strict.test b/mysql-test/main/strict.test index 1819f399041..ce02003e088 100644 --- a/mysql-test/main/strict.test +++ b/mysql-test/main/strict.test @@ -60,7 +60,10 @@ INSERT INTO t1 VALUES ('2004-2-30'); set @@sql_mode='ansi,traditional'; INSERT IGNORE INTO t1 VALUES('2004-02-29'),('2004-13-15'),('0000-00-00'); +#Enable after fix MDEV-31516 +--disable_cursor_protocol select * from t1; +--enable_cursor_protocol drop table t1; # Test difference in behaviour with InnoDB and MyISAM tables diff --git a/mysql-test/main/subselect.test b/mysql-test/main/subselect.test index 4c33b9b06ef..3906ec12c98 100644 --- a/mysql-test/main/subselect.test +++ b/mysql-test/main/subselect.test @@ -75,10 +75,13 @@ SELECT ROW(1,2,3) = (SELECT 1,2,3); SELECT ROW(1,2,3) = (SELECT 1,2,1); SELECT ROW(1,2,3) < (SELECT 1,2,1); SELECT ROW(1,2,3) > (SELECT 1,2,1); +#enable after fix MDEV-31728 +--disable_cursor_protocol #enable after fix MDEV-28585 --disable_view_protocol SELECT ROW(1,2,3) = (SELECT 1,2,NULL); --enable_view_protocol +--enable_cursor_protocol SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'a') AS m; SELECT (SELECT 1.5,2,'a') = ROW(1.5,2,'b') AS m; SELECT (SELECT 1.5,2,'a') = ROW('1.5b',2,'b') AS m; @@ -515,8 +518,11 @@ select 1 IN (SELECT * from t1); select 3 IN (SELECT * from t1); select 10 IN (SELECT * from t1); select 1 > ALL (SELECT * from t1); +#enable after fix MDEV-31728 +--disable_cursor_protocol select 10 > ALL (SELECT * from t1); select 1 > ANY (SELECT * from t1); +--enable_cursor_protocol select 10 > ANY (SELECT * from t1); drop table t1; create table t1 (a varchar(20)); @@ -529,8 +535,11 @@ select 'A' IN (SELECT * from t1); select 'DEF' IN (SELECT * from t1); select 'XYZS' IN (SELECT * from t1); select 'A' > ALL (SELECT * from t1); +#enable after fix MDEV-31728 +--disable_cursor_protocol select 'XYZS' > ALL (SELECT * from t1); select 'A' > ANY (SELECT * from t1); +--enable_cursor_protocol select 'XYZS' > ANY (SELECT * from t1); drop table t1; create table t1 (a float); @@ -543,15 +552,21 @@ select 1.5 IN (SELECT * from t1); select 3.5 IN (SELECT * from t1); select 10.5 IN (SELECT * from t1); select 1.5 > ALL (SELECT * from t1); +#enable after fix MDEV-31728 +--disable_cursor_protocol select 10.5 > ALL (SELECT * from t1); select 1.5 > ANY (SELECT * from t1); +--enable_cursor_protocol update t1 set a=NULL where a=2.5; select 1.5 IN (SELECT * from t1); select 3.5 IN (SELECT * from t1); select 10.5 IN (SELECT * from t1); select 1.5 > ALL (SELECT * from t1); +#enable after fix MDEV-31728 +--disable_cursor_protocol select 10.5 > ALL (SELECT * from t1); select 1.5 > ANY (SELECT * from t1); +--enable_cursor_protocol select 10.5 > ANY (SELECT * from t1); --enable_prepare_warnings --enable_view_protocol @@ -1187,7 +1202,9 @@ let $outfile_rel= ../../tmp/subselect.out.file.1; --error 0,1 --remove_file $outfile_abs --enable_warnings +--disable_cursor_protocol eval select a, (select max(b) from t1) into outfile "$outfile_rel" from t1; +--enable_cursor_protocol delete from t1; eval load data infile "$outfile_rel" into table t1; --remove_file $outfile_abs @@ -3593,7 +3610,9 @@ DROP TABLE t1,t2; CREATE TABLE t1(a1 int); INSERT INTO t1 VALUES (1),(2); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; ## First a simpler query, illustrating the transformation @@ -3631,7 +3650,9 @@ INSERT INTO t1 VALUES (1),(2); CREATE TABLE t2(a1 int); INSERT INTO t2 VALUES (3); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; ## All these are subject to the transformation @@ -3652,7 +3673,9 @@ DROP TABLE t1, t2; create table t2(i int); insert into t2 values(0); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; CREATE VIEW v1 AS @@ -5028,7 +5051,9 @@ INSERT INTO t1 VALUES (1),(2); CREATE TABLE t2(a1 int); INSERT INTO t2 VALUES (3); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; ## All these are subject to the transformation @@ -5045,7 +5070,9 @@ DROP TABLE t1, t2; create table t2(i int); insert into t2 values(0); +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; CREATE VIEW v1 AS @@ -5437,8 +5464,10 @@ DROP TABLE t1,t2,t3; CREATE TABLE t1(a1 int); INSERT INTO t1 VALUES (1),(2); - + +--disable_cursor_protocol SELECT @@session.sql_mode INTO @old_sql_mode; +--enable_cursor_protocol SET SESSION sql_mode='ONLY_FULL_GROUP_BY'; ## First a simpler query, illustrating the transformation @@ -5868,10 +5897,12 @@ FROM t2 alias1, t1 alias2, t1 alias3; --disable_ps2_protocol flush status; +--disable_cursor_protocol SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; +--enable_cursor_protocol show status like "subquery_cache%"; show status like '%Handler_read%'; @@ -5886,10 +5917,12 @@ FROM t2 alias1, t1 alias2, t1 alias3; flush status; +--disable_cursor_protocol SELECT (SELECT MIN(b) FROM t1, t2 WHERE b = a AND (b = alias1.b OR EXISTS (SELECT * FROM t3))) AS m FROM t2 alias1, t1 alias2, t1 alias3; +--enable_cursor_protocol show status like "subquery_cache%"; show status like '%Handler_read%'; diff --git a/mysql-test/main/subselect3.inc b/mysql-test/main/subselect3.inc index 2258456f355..6516c6a6ef0 100644 --- a/mysql-test/main/subselect3.inc +++ b/mysql-test/main/subselect3.inc @@ -57,9 +57,11 @@ select a, oref, a in ( create table t3 (a int); insert into t3 values (NULL), (NULL); flush status; +--disable_cursor_protocol --disable_ps2_protocol select a in (select max(ie) from t1 where oref=4 group by grp) from t3; --enable_ps2_protocol +--enable_cursor_protocol show status like 'Handler_read_rnd_next'; select ' ^ This must show 11' Z; @@ -96,7 +98,9 @@ select oref, a, a in (select a from t1 where oref=t2.oref) Z from t2; --disable_ps2_protocol flush status; +--disable_cursor_protocol select oref, a from t2 where a in (select a from t1 where oref=t2.oref); +--enable_cursor_protocol # This will only show access to t2: show status like '%Handler_read_rnd_next'; @@ -106,7 +110,9 @@ insert into t2 values (NULL, 0),(NULL, 0), (NULL, 0), (NULL, 0); set optimizer_switch='subquery_cache=off'; flush status; +--disable_cursor_protocol select oref, a, a in (select a from t1 where oref=t2.oref) Z from t2; +--enable_cursor_protocol show status like '%Handler_read%'; select 'No key lookups, seq reads: 29= 5 reads from t2 + 4 * 6 reads from t1.' Z; set @@optimizer_switch=@save_optimizer_switch; @@ -641,9 +647,11 @@ DROP TABLE t1, t2; create table t1 (a int, b decimal(13, 3)); insert into t1 values (1, 0.123); +--disable_cursor_protocol --disable_ps2_protocol select a, (select max(b) from t1) into outfile "../../tmp/subselect.out.file.1" from t1; --enable_ps2_protocol +--enable_cursor_protocol delete from t1; load data infile "../../tmp/subselect.out.file.1" into table t1; select * from t1; @@ -695,6 +703,8 @@ SELECT a AS x, ROW(11, 12) = (SELECT MAX(x), 12), ROW(11, 12) IN (SELECT MAX(x), DROP TABLE t1; +#enable after fix MDEV-31728 +--disable_cursor_protocol #enable after fix MDEV-28585 --disable_view_protocol --echo # both columns should be same @@ -705,6 +715,7 @@ SELECT ROW(1,2) = (SELECT NULL, 1), ROW(1,2) IN (SELECT NULL, 1); SELECT ROW(1,2) = (SELECT 1, 1), ROW(1,2) IN (SELECT 1, 1); SELECT ROW(1,2) = (SELECT 1, 2), ROW(1,2) IN (SELECT 1, 2); --enable_view_protocol +--enable_cursor_protocol # # Bug #37362 Crash in do_field_eq @@ -812,11 +823,13 @@ set @save_optimizer_switch2=@@optimizer_switch; set optimizer_switch='subquery_cache=off'; --disable_ps2_protocol +--disable_cursor_protocol --echo SELECT i1, i2 FROM t1 WHERE (i1, i2) NOT IN (SELECT i1, i2 FROM t2); +--enable_cursor_protocol --echo --echo # Check that the subquery only has to be evaluated once @@ -828,11 +841,13 @@ SHOW STATUS LIKE '%Handler_read_rnd_next'; INSERT INTO t1 VALUES (NULL, NULL); FLUSH STATUS; +--disable_cursor_protocol --echo SELECT i1, i2 FROM t1 WHERE (i1, i2) NOT IN (SELECT i1, i2 FROM t2); +--enable_cursor_protocol --echo --echo # Handler_read_rnd_next should be one more than baseline @@ -978,9 +993,11 @@ set @@max_heap_table_size= 16384; explain select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a); flush status; --disable_ps2_protocol +--disable_cursor_protocol select count(*) from t0 A, t0 B, t0 C, t0 D where D.a in (select a from t1 E where a+1 < 10000 + A.a + B.a +C.a+D.a); --enable_ps2_protocol show status like 'Created_tmp_disk_tables'; +--enable_cursor_protocol set @save_max_heap_table_size=@@max_heap_table_size; set @@optimizer_switch=@save_optimizer_switch; drop table t0, t1; diff --git a/mysql-test/main/subselect_cache.test b/mysql-test/main/subselect_cache.test index 1af2825791e..6e63273cdcb 100644 --- a/mysql-test/main/subselect_cache.test +++ b/mysql-test/main/subselect_cache.test @@ -24,7 +24,9 @@ insert into t2 values (2,3),(3,4),(5,6),(4,1); --echo #single value subquery test (SELECT list) --disable_ps2_protocol flush status; +--disable_cursor_protocol select a, (select d from t2 where b=c) from t1; +--enable_cursor_protocol show status like "subquery_cache%"; show status like '%Handler_read%'; @@ -42,6 +44,7 @@ select a, (select d from t2 where b=c), (select d from t2 where b=c union select set optimizer_switch='subquery_cache=off'; flush status; +--disable_cursor_protocol select a, (select d from t2 where b=c) from t1; show status like "subquery_cache%"; @@ -172,6 +175,7 @@ select ta.a, tb.a from t1 ta left join t1 tb on (select d from t2 where tb.b=c); show status like "subquery_cache%"; show status like '%Handler_read%'; set optimizer_switch='subquery_cache=on'; +--enable_cursor_protocol --echo #single value subquery test (PS) prepare stmt1 from 'select a, (select d from t2 where b=c) + 1 from t1'; @@ -192,6 +196,7 @@ drop procedure p1; --echo #IN subquery test flush status; +--disable_cursor_protocol show status like "subquery_cache%"; select a, b , b in (select d from t2) as SUBS from t1; show status like "subquery_cache%"; @@ -342,6 +347,7 @@ flush status; select a, b, (select exists (select * from t2 where b=d) from t2 where b=c) as SUNS1 from t1; show status like "subquery_cache%"; show status like '%Handler_read%'; +--enable_cursor_protocol --enable_ps2_protocol --echo #clean up @@ -426,12 +432,14 @@ DROP TABLE t1; flush status; CREATE TABLE t1 (a int); INSERT INTO t1 VALUES (2), (4), (1), (3); +--disable_cursor_protocol select a, a in (select a from t1) from t1 as ext; show status like "subquery_cache%"; select a, a in (select a from t1 where -1 < rand()) from t1 as ext; show status like "subquery_cache%"; select a, a in (select a from t1 where -1 < benchmark(a,100)) from t1 as ext; show status like "subquery_cache%"; +--enable_cursor_protocol drop table t1; --enable_ps2_protocol @@ -459,6 +467,7 @@ insert into t1 values (2,1), (3,1), (2,4), (3,4), (10,2), (20,2), (2,5), (3,5), (100,3), (200,3), (10,6), (20,6), (20,7), (100,8), (200,8); insert into t2 values (1,1),(3,3),(20,20); +--disable_cursor_protocol --disable_ps2_protocol --echo aggregate function as parameter of subquery set optimizer_switch='subquery_cache=off'; @@ -485,6 +494,7 @@ select max(a), (select a from t2 where a=c) from t1 group by b; show status like "subquery_cache%"; show status like '%Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol drop table t1,t2; @@ -499,6 +509,7 @@ insert into t1 values create table t2 (pk int, a int, primary key(pk)); insert into t2 select a,a from t0; +--disable_cursor_protocol --disable_ps2_protocol set optimizer_switch='default,semijoin=on,materialization=on,subquery_cache=on'; flush status; @@ -532,6 +543,7 @@ select * from t1 where a in (select pk from t2); show status like "subquery_cache%"; show status like '%Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol drop table t0,t1,t2; diff --git a/mysql-test/main/subselect_exists2in_costmat.test b/mysql-test/main/subselect_exists2in_costmat.test index 371f0936d1a..a637ebdb0f8 100644 --- a/mysql-test/main/subselect_exists2in_costmat.test +++ b/mysql-test/main/subselect_exists2in_costmat.test @@ -47,9 +47,11 @@ create index Language on CountryLanguage(Language); create index CityName on City(Name); alter table City change population population int(11) null default 0; +--disable_cursor_protocol --enable_prepare_warnings select max(id) from City into @max_city_id; --disable_prepare_warnings +--enable_cursor_protocol insert into City values (@max_city_id + 1,'Kilifarevo','BGR',NULL); diff --git a/mysql-test/main/subselect_mat_cost.test b/mysql-test/main/subselect_mat_cost.test index 8fe38849735..5ef66784bc4 100644 --- a/mysql-test/main/subselect_mat_cost.test +++ b/mysql-test/main/subselect_mat_cost.test @@ -53,9 +53,11 @@ create index Language on CountryLanguage(Language); create index CityName on City(Name); alter table City change population population int(11) null default 0; +--disable_cursor_protocol --enable_prepare_warnings select max(id) from City into @max_city_id; --disable_prepare_warnings +--enable_cursor_protocol insert into City values (@max_city_id + 1,'Kilifarevo','BGR',NULL); diff --git a/mysql-test/main/subselect_sj.test b/mysql-test/main/subselect_sj.test index e4d02ed666c..e2edc31fa9c 100644 --- a/mysql-test/main/subselect_sj.test +++ b/mysql-test/main/subselect_sj.test @@ -2679,8 +2679,10 @@ CREATE TABLE t3 (i3 INT, KEY(i3)) engine=myisam; INSERT INTO t3 VALUES (0),(8),(1),(8),(9),(24),(6),(1),(6),(2),(4),(2),(1); +--disable_cursor_protocol select @@max_heap_table_size into @tmp_max_heap_table_size; select @@join_buffer_size into @tmp_join_buffer_size; +--enable_cursor_protocol set max_heap_table_size=16*1024; --disable_query_log diff --git a/mysql-test/main/tlsv13.result b/mysql-test/main/tlsv13.result new file mode 100644 index 00000000000..772cfd85eae --- /dev/null +++ b/mysql-test/main/tlsv13.result @@ -0,0 +1,18 @@ +# restart: --ssl-cipher=TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES256-GCM-SHA384 +Variable_name Value +Ssl_cipher TLS_AES_128_GCM_SHA256 +Ssl_cipher_list TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES256-GCM-SHA384 +Variable_name Value +Ssl_cipher ECDHE-RSA-AES256-GCM-SHA384 +Ssl_cipher_list TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES256-GCM-SHA384 +ERROR 2026 (HY000): TLS/SSL error: ssl/tls alert handshake failure +ERROR 2026 (HY000): TLS/SSL error: ssl/tls alert handshake failure +# restart: --ssl-cipher=ECDHE-RSA-AES256-GCM-SHA384 +Variable_name Value +Ssl_cipher TLS_AES_128_GCM_SHA256 +Variable_name Value +Ssl_cipher ECDHE-RSA-AES256-GCM-SHA384 +# restart: --ssl-cipher=TLS_AES_128_GCM_SHA256 +Variable_name Value +Ssl_cipher TLS_AES_128_GCM_SHA256 +Ssl_cipher_list TLS_AES_128_GCM_SHA256 diff --git a/mysql-test/main/tlsv13.test b/mysql-test/main/tlsv13.test new file mode 100644 index 00000000000..f90b6849a86 --- /dev/null +++ b/mysql-test/main/tlsv13.test @@ -0,0 +1,43 @@ +--source include/have_ssl_communication.inc +--source include/require_openssl_client.inc +--source include/have_tlsv13.inc + +# +# BUG - SSL_CIPHER SYSTEM VARIABLE CANNOT CONFIGURE TLSV1.3 AND TLSV1.2 CIPHERS AT THE SAME TIME +# +# If users specify TLSv1.3 and TLSv1.2 ciphers, it will only configure the +# TLSv1.3 ciphers correctly but then it will keep all TLSv1.2 ciphers enabled. +# +# This is a potential security vulnerability because users trying to restrict +# secure TLSv1.3 and TLSv1.2 ciphers will unintentionally have insecure TLSv1.2 +# ciphers enabled on the database. +# +let $restart_parameters=--ssl-cipher=TLS_AES_128_GCM_SHA256:ECDHE-RSA-AES256-GCM-SHA384; +source include/restart_mysqld.inc; + +--exec $MYSQL --host=localhost --ssl-cipher=TLS_AES_128_GCM_SHA256 --tls-version=TLSv1.3 -e "SHOW STATUS LIKE 'Ssl_cipher%';" +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES256-GCM-SHA384 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher%';" + +# Check that other ciphers are correctly not supported by the server +--replace_regex /sslv3 alert handshake failure/ssl\/tls alert handshake failure/ +--error 1 +--exec $MYSQL --host=localhost --ssl-cipher=TLS_AES_256_GCM_SHA384 --tls-version=TLSv1.3 -e "SHOW STATUS LIKE 'Ssl_cipher';" 2>&1 + +--replace_regex /sslv3 alert handshake failure/ssl\/tls alert handshake failure/ +--error 1 +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES128-GCM-SHA256 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher';" 2>&1 + +# TLSv1.3 ciphers are still supported if only TLSv1.2 ciphers are passed to --ssl-cipher +let $restart_parameters=--ssl-cipher=ECDHE-RSA-AES256-GCM-SHA384; +source include/restart_mysqld.inc; +--exec $MYSQL --host=localhost --ssl-cipher=TLS_AES_128_GCM_SHA256 --tls-version=TLSv1.3 -e "SHOW STATUS LIKE 'Ssl_cipher';" +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES256-GCM-SHA384 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher';" +--error 1 +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES128-GCM-SHA256 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher';" + +# TLSv1.2 ciphers are not supported if only TLSv1.3 ciphers are passed to --ssl-cipher +let $restart_parameters=--ssl-cipher=TLS_AES_128_GCM_SHA256; +source include/restart_mysqld.inc; +--exec $MYSQL --host=localhost --ssl-cipher=TLS_AES_128_GCM_SHA256 --tls-version=TLSv1.3 -e "SHOW STATUS LIKE 'Ssl_cipher%';" +--error 1 +--exec $MYSQL --host=localhost --ssl-cipher=ECDHE-RSA-AES128-GCM-SHA256 --tls-version=TLSv1.2 -e "SHOW STATUS LIKE 'Ssl_cipher';" diff --git a/mysql-test/main/tmp_table_count-7586.test b/mysql-test/main/tmp_table_count-7586.test index 0629e27f164..71eb5c37d0d 100644 --- a/mysql-test/main/tmp_table_count-7586.test +++ b/mysql-test/main/tmp_table_count-7586.test @@ -11,6 +11,7 @@ create table t2 (a int); insert into t2 values (1),(2),(3); create view v2 as select a from t2; +--disable_cursor_protocol flush status; select * from v2; --disable_ps_protocol @@ -23,6 +24,7 @@ select * from (select * from t2) T1; --disable_ps_protocol show status like '%Created_tmp%'; --enable_ps_protocol +--enable_cursor_protocol explain select * from (select * from t2) T1; diff --git a/mysql-test/main/trigger-compat.test b/mysql-test/main/trigger-compat.test index 9c102993a6f..a8ad20073d6 100644 --- a/mysql-test/main/trigger-compat.test +++ b/mysql-test/main/trigger-compat.test @@ -68,11 +68,13 @@ let $MYSQLD_DATADIR = `select @@datadir`; eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/mysqltest_db1/t1.TRG' INTO TABLE patch; # remove original t1.TRG file so SELECT INTO OUTFILE won't fail --remove_file $MYSQLD_DATADIR/mysqltest_db1/t1.TRG +--disable_cursor_protocol --disable_ps2_protocol eval SELECT SUBSTRING_INDEX(a,'definers=',1) INTO OUTFILE '$MYSQLD_DATADIR/mysqltest_db1/t1.TRG' FROM patch; --enable_ps2_protocol +--enable_cursor_protocol DROP TABLE patch; --connection wl2818_definer_con --enable_query_log diff --git a/mysql-test/main/trigger.test b/mysql-test/main/trigger.test index f54a09bf7a4..7b5735b417a 100644 --- a/mysql-test/main/trigger.test +++ b/mysql-test/main/trigger.test @@ -634,7 +634,10 @@ set sql_mode=""; create trigger t1_bi before insert on t1 for each row set new.a = '2004-01-00'; set sql_mode="traditional"; insert into t1 values ('2004-01-01'); +#Check after fix MDEV-31516 +--disable_cursor_protocol select * from t1; +--enable_cursor_protocol set sql_mode=default; show create table t1; --replace_column 6 # diff --git a/mysql-test/main/type_binary.test b/mysql-test/main/type_binary.test index bfc9222762a..495c776cc75 100644 --- a/mysql-test/main/type_binary.test +++ b/mysql-test/main/type_binary.test @@ -135,6 +135,8 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a VARCHAR(39)); +#check after fix MDEV-31540 +--disable_cursor_protocol --disable_view_protocol --enable_metadata SELECT @@ -155,6 +157,7 @@ SELECT FROM t1; --disable_metadata --enable_view_protocol +--enable_cursor_protocol DROP TABLE t1; diff --git a/mysql-test/main/type_bit.test b/mysql-test/main/type_bit.test index 9b96b15a42f..5f8b0d0af2f 100644 --- a/mysql-test/main/type_bit.test +++ b/mysql-test/main/type_bit.test @@ -461,7 +461,10 @@ SHOW CREATE TABLE t2; DROP TABLE t2; --enable_metadata --disable_view_protocol +#Check after fix MDEV-31540 +--disable_cursor_protocol SELECT COALESCE(val, 1) FROM t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata DROP TABLE t1; diff --git a/mysql-test/main/type_date.test b/mysql-test/main/type_date.test index ade138ca851..52eee2bfa28 100644 --- a/mysql-test/main/type_date.test +++ b/mysql-test/main/type_date.test @@ -211,12 +211,15 @@ CREATE TABLE t2 (a DATE); CREATE INDEX i ON t1 (a); INSERT INTO t1 VALUES ('1000-00-00'),('1000-00-00'); INSERT INTO t2 VALUES ('1000-00-00'),('1000-00-00'); +#Check after fix MDEV-31516 +--disable_cursor_protocol SELECT * FROM t1 WHERE a = '1000-00-00'; SELECT * FROM t2 WHERE a = '1000-00-00'; SET SQL_MODE=TRADITIONAL; EXPLAIN SELECT * FROM t1 WHERE a = '1000-00-00'; SELECT * FROM t1 WHERE a = '1000-00-00'; SELECT * FROM t2 WHERE a = '1000-00-00'; +--enable_cursor_protocol --error ER_TRUNCATED_WRONG_VALUE INSERT INTO t1 VALUES ('1000-00-00'); SET SQL_MODE=DEFAULT; diff --git a/mysql-test/main/type_enum.test b/mysql-test/main/type_enum.test index 8cc5d1d603b..a79547b2d10 100644 --- a/mysql-test/main/type_enum.test +++ b/mysql-test/main/type_enum.test @@ -237,7 +237,10 @@ CREATE TABLE t1 ( INSERT INTO t1 VALUES (1),(2); --enable_metadata --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol SELECT AVG(f1) FROM t1; +--enable_cursor_protocol --enable_view_protocol --disable_metadata drop table t1; diff --git a/mysql-test/main/type_float.test b/mysql-test/main/type_float.test index 5fc20fb1557..436b3e13ef5 100644 --- a/mysql-test/main/type_float.test +++ b/mysql-test/main/type_float.test @@ -320,8 +320,10 @@ let $nine_65= select format(-1.7976931348623157E+307,256) as foo; select least(-1.1111111111111111111111111, - group_concat(1.7976931348623157E+308)) as foo; +--disable_cursor_protocol eval select concat((truncate((-1.7976931348623157E+307),(0x1e))), ($nine_65)) into @a; +--enable_cursor_protocol --enable_result_log --echo End of 5.0 tests @@ -337,6 +339,8 @@ select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo; --echo # MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result --echo # +#enable after fix MDEV-34213 +--disable_cursor_protocol #enable after fix MDEV-29552 --disable_view_protocol SELECT LEFT('a',EXP(50)); @@ -347,6 +351,7 @@ CREATE TABLE t1 (a FLOAT); INSERT INTO t1 VALUES (1e30); SELECT LEFT('a',a), LEFT('a',1e30) FROM t1; DROP TABLE t1; +--enable_cursor_protocol PREPARE stmt FROM 'SELECT LEFT(111,?)'; SET @a=1e30; diff --git a/mysql-test/main/type_newdecimal.test b/mysql-test/main/type_newdecimal.test index af9da5395c0..8de814c64b9 100644 --- a/mysql-test/main/type_newdecimal.test +++ b/mysql-test/main/type_newdecimal.test @@ -609,12 +609,15 @@ select round(99999999999999999.999,3); select round(-99999999999999999.999,3); #-- should return -100000000000000000.000 # +#enable after fix MDEV-31729 +--disable_cursor_protocol #enable after fix MDEV-28660 --disable_view_protocol select truncate(99999999999999999999999999999999999999,49); #-- should return 99999999999999999999999999999999999999.000 # --enable_view_protocol +--enable_cursor_protocol select truncate(99.999999999999999999999999999999999999,49); #-- should return 99.9999999999999999999999999999999 # @@ -1266,11 +1269,12 @@ DROP TABLE t1; let $nine_81= 999999999999999999999999999999999999999999999999999999999999999999999999999999999; - #view protocol generates additional warning --disable_view_protocol eval SELECT substring(('M') FROM ($nine_81)) AS foo; --enable_view_protocol +#check after fix MDEV-31729 +--disable_cursor_protocol #enable after fix MDEV-28661 --disable_view_protocol eval SELECT min($nine_81) AS foo; @@ -1284,6 +1288,7 @@ eval SELECT date_sub(($nine_81), day_minute) AS foo; eval SELECT truncate($nine_81, 28) AS foo; +--enable_cursor_protocol --enable_view_protocol --echo End of 5.0 tests diff --git a/mysql-test/main/type_timestamp.test b/mysql-test/main/type_timestamp.test index b85682911b6..e4de6f7845f 100644 --- a/mysql-test/main/type_timestamp.test +++ b/mysql-test/main/type_timestamp.test @@ -742,9 +742,11 @@ FLUSH TABLES; # 0xFF - record flags # 0x77777777 - TIMESTAMP integer part # 0xFFFFFF - TIMESTAMP bad fractional part +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT CONCAT(0xFF,0x77777777,0xFFFFFF) INTO OUTFILE '$MYSQLD_DATADIR/test/t1.MYD' FIELDS TERMINATED BY '' ESCAPED BY '' LINES TERMINATED BY '' --enable_ps2_protocol +--enable_cursor_protocol --eval SELECT HEX(LOAD_FILE('$MYSQLD_DATADIR/test/t1.MYD')) AS MYD --enable_query_log SELECT a, CAST(a AS DATETIME) AS dt0, CAST(a AS DATETIME(6)) AS dt6 FROM t1; @@ -859,7 +861,10 @@ DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP(4), b TIMESTAMP DEFAULT 0) ENGINE=MyISAM; INSERT IGNORE INTO t1 (a) VALUES ('2001-01-01'),('2003-01-01'); SELECT * FROM t1 WHERE (SELECT MIN(b) FROM t1) - a; +#Enable after fix MDEV-31730 +--disable_cursor_protocol SELECT (SELECT MIN(b) FROM t1) - a FROM t1; +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/mysql-test/main/type_year.test b/mysql-test/main/type_year.test index 98f266587b1..29fc0de6223 100644 --- a/mysql-test/main/type_year.test +++ b/mysql-test/main/type_year.test @@ -160,7 +160,10 @@ DROP TABLE t1; CREATE TABLE t1(c1 YEAR(4)); INSERT INTO t1 VALUES (1901),(2155),(0000); SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol SELECT COUNT(*) AS total_rows, MIN(c1) AS min_value, MAX(c1) FROM t1; +--enable_cursor_protocol SELECT COUNT(*) AS total_rows, MIN(c1+0) AS min_value, MAX(c1+0) FROM t1; DROP TABLE t1; --enable_view_protocol diff --git a/mysql-test/main/udf.test b/mysql-test/main/udf.test index d87d446f733..11717eb43b1 100644 --- a/mysql-test/main/udf.test +++ b/mysql-test/main/udf.test @@ -250,6 +250,8 @@ DROP FUNCTION avgcost; #enable view prtotocol after fix MDEV-28677 --disable_view_protocol +#check after fix MDEV-31587 +--disable_cursor_protocol select * from mysql.func; --replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB eval CREATE FUNCTION is_const RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; @@ -262,6 +264,7 @@ select * from mysql.func; --error 1305 select is_const(3); +--enable_cursor_protocol --enable_view_protocol # @@ -270,6 +273,8 @@ select is_const(3); --replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB eval CREATE FUNCTION is_const RETURNS STRING SONAME "$UDF_EXAMPLE_SO"; +#check after fix MDEV-31587 +--disable_cursor_protocol select is_const(3) as const, is_const(3.14) as const, @@ -297,6 +302,7 @@ select from bug18761; drop table bug18761; +--enable_cursor_protocol --error 1241 select is_const((1,2,3)); diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test index 994f187b946..872d3603439 100644 --- a/mysql-test/main/union.test +++ b/mysql-test/main/union.test @@ -1117,6 +1117,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1); +--disable_cursor_protocol -- echo # Tests fix in parser rule select_derived_union. SELECT a INTO @v FROM ( SELECT a FROM t1 @@ -1158,6 +1159,7 @@ SELECT a INTO DUMPFILE 'union.out.file8' FROM t1 UNION SELECT a FROM t1; SELECT ( SELECT a UNION SELECT a ) INTO @v FROM t1; SELECT ( SELECT a UNION SELECT a ) INTO OUTFILE 'union.out.file3' FROM t1; SELECT ( SELECT a UNION SELECT a ) INTO DUMPFILE 'union.out.file4' FROM t1; +--enable_cursor_protocol DROP TABLE t1; remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.1/data/test union.out.fil*; diff --git a/mysql-test/main/update.test b/mysql-test/main/update.test index 0dbc3c333ee..144f89b0053 100644 --- a/mysql-test/main/update.test +++ b/mysql-test/main/update.test @@ -236,9 +236,11 @@ insert into t1 (a) values (0),(0),(0),(0),(0),(0),(0),(0); # the view protocol creates an additional statistics data --disable_ps2_protocol --disable_view_protocol +--disable_cursor_protocol flush status; select a from t1 order by a limit 1; show status like 'handler_read%'; +--enable_cursor_protocol --enable_view_protocol --enable_ps2_protocol @@ -346,6 +348,7 @@ INSERT INTO t1(user_id) SELECT user_id FROM t1; INSERT INTO t1(user_id) SELECT user_id FROM t1; INSERT INTO t1(user_id) SELECT user_id FROM t1; +--disable_cursor_protocol --disable_ps2_protocol flush status; SELECT user_id FROM t1 WHERE request_id=9999999999999; @@ -357,6 +360,7 @@ show status like '%Handler_read%'; UPDATE t1 SET user_id=null WHERE request_id=999999999999999999999999999999; show status like '%Handler_read%'; --enable_ps2_protocol +--enable_cursor_protocol DROP TABLE t1; diff --git a/mysql-test/main/user_var.test b/mysql-test/main/user_var.test index 15bc527601c..5a88c888d1d 100644 --- a/mysql-test/main/user_var.test +++ b/mysql-test/main/user_var.test @@ -293,7 +293,9 @@ drop table t1; # CREATE TABLE t1(a INT, b INT); INSERT INTO t1 VALUES (0, 0), (2, 1), (2, 3), (1, 1), (30, 20); +--disable_cursor_protocol SELECT a, b INTO @a, @b FROM t1 WHERE a=2 AND b=3 GROUP BY a, b; +--enable_cursor_protocol SELECT @a, @b; SELECT a, b FROM t1 WHERE a=2 AND b=3 GROUP BY a, b; DROP TABLE t1; @@ -387,7 +389,9 @@ DROP TABLE t1; # SAME USER VARIABLE = CRASH # SET @bug12408412=1; +--disable_cursor_protocol SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412; +--enable_cursor_protocol --echo End of 5.1 tests @@ -462,7 +466,9 @@ DROP TABLE t1; --echo # SET @bug12408412=1; +--disable_cursor_protocol SELECT GROUP_CONCAT(@bug12408412 ORDER BY 1) INTO @bug12408412; +--enable_cursor_protocol # # MDEV-616 LP BUG#1002126 diff --git a/mysql-test/main/userstat-badlogin-4824.test b/mysql-test/main/userstat-badlogin-4824.test index e14eded3020..96b4368a707 100644 --- a/mysql-test/main/userstat-badlogin-4824.test +++ b/mysql-test/main/userstat-badlogin-4824.test @@ -14,7 +14,9 @@ set global userstat=1; --disable_ps2_protocol connect(foo, localhost, foo, foo, "*NO-ONE*"); +--disable_cursor_protocol select 1; +--enable_cursor_protocol disconnect foo; connection default; diff --git a/mysql-test/main/userstat.test b/mysql-test/main/userstat.test index a452bd9e679..0c49acaa19e 100644 --- a/mysql-test/main/userstat.test +++ b/mysql-test/main/userstat.test @@ -9,8 +9,10 @@ --enable_prepare_warnings --disable_ps2_protocol +--disable_cursor_protocol select variable_value from information_schema.global_status where variable_name="handler_read_key" into @global_read_key; --disable_prepare_warnings +--enable_cursor_protocol show columns from information_schema.client_statistics; show columns from information_schema.user_statistics; show columns from information_schema.index_statistics; @@ -28,6 +30,7 @@ update t1 set b=1; update t1 set b=5 where a=2; delete from t1 where a=3; +--disable_cursor_protocol /* Empty query */ select * from t1 where a=999; @@ -37,11 +40,11 @@ drop table t1; --connect (ssl_con,localhost,root,,,,,SSL) SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; --connection default +--enable_cursor_protocol # # Test the commit and rollback are counted # - create table t1 (a int, primary key (a), b int default 0) engine=innodb; begin; insert into t1 values(1,1); @@ -54,11 +57,13 @@ insert into t1 values(3,3); rollback; drop table t1; +--disable_cursor_protocol select sleep(1); show status like "rows%"; show status like "ha%"; select variable_value - @global_read_key as "handler_read_key" from information_schema.global_status where variable_name="handler_read_key"; +--enable_cursor_protocol --disconnect ssl_con diff --git a/mysql-test/main/variables.test b/mysql-test/main/variables.test index f589d139192..1cc40549d6b 100644 --- a/mysql-test/main/variables.test +++ b/mysql-test/main/variables.test @@ -65,7 +65,10 @@ set @test_int=null,@test_double=null,@test_string=null,@test_string2=null; select @test_int,@test_double,@test_string,@test_string2; select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3; explain extended select @t1:=(@t2:=1)+@t3:=4,@t1,@t2,@t3; +#Enable after fix MDEV-31495 +--disable_cursor_protocol select @t5; +--enable_cursor_protocol # # Test problem with WHERE and variables @@ -372,7 +375,9 @@ select @@key_buffer_size; select * from t1 where a=2; select * from t2 where a=3; check table t1,t2; +--disable_cursor_protocol select max(a) +1, max(a) +2 into @xx,@yy from t1; +--enable_cursor_protocol drop table t1,t2; # @@ -595,7 +600,9 @@ set global sql_mode=repeat('a',80); # create table t1 (a int); +--disable_cursor_protocol select a into @x from t1; +--enable_cursor_protocol show warnings; drop table t1; @@ -1130,7 +1137,9 @@ SET @@global.thread_stack= 7; # Bug #40657 - assertion with out of range variables and traditional sql_mode # +--disable_cursor_protocol SELECT @@global.expire_logs_days INTO @old_eld; +--enable_cursor_protocol SET GLOBAL expire_logs_days = -1; --echo needs to've been adjusted (0) @@ -1166,10 +1175,12 @@ SET GLOBAL auto_increment_offset=0; # # Bug#41030 Wrong meta data (incorrect fieldlen) # - +#Check after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata select @@default_storage_engine; --disable_metadata +--enable_cursor_protocol # # Bug#36540: CREATE EVENT and ALTER EVENT statements fail with large server_id diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index 9cab1b5f7f8..d4d405d5fef 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -6975,6 +6975,37 @@ DROP VIEW v2; DROP TABLE t; # End of 10.4 tests # +# MDEV-29537: Creation of view with UNION and SELECT ... FOR UPDATE +# in definition is failed with error +# +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT 1 FROM t1 +UNION +SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +FOR UPDATE; +SELECT * FROM v1; +1 +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 1 AS `1` from `t1` union select 1 AS `1` from DUAL where 1 group by 1 having 1 order by 1 for update latin1 latin1_swedish_ci +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT 1 FROM t1 +UNION +(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 +FOR UPDATE); +SELECT * FROM v1; +1 +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 1 AS `1` from `t1` union (select 1 AS `1` from DUAL where 1 group by 1 having 1 for update) latin1 latin1_swedish_ci +DROP VIEW v1; +DROP TABLE t1; +# End of 10.5 tests +# # MDEV-13115: SELECT .. SKIP LOCKED - ensure SHOW CREATE VIEW is correct # CREATE TABLE t1 (id int, foo int); diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test index 4c2d71d4906..c9e8f4e97c0 100644 --- a/mysql-test/main/view.test +++ b/mysql-test/main/view.test @@ -2044,7 +2044,9 @@ drop view abc; flush status; create table t1(f1 char(1)); create view v1 as select * from t1; +--disable_cursor_protocol select * from (select f1 as f2, f1 as f3 from v1) v where v.f2='a'; +--enable_cursor_protocol --disable_ps_protocol show status like "Created_tmp%"; --enable_ps_protocol @@ -2055,9 +2057,11 @@ set @tmp=@@optimizer_switch; set @@optimizer_switch='derived_merge=OFF'; create table t1(f1 char(1)); create view v1 as select * from t1; +--disable_cursor_protocol --disable_ps2_protocol select * from (select f1 as f2, f1 as f3 from v1) v where v.f2='a'; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol show status like "Created_tmp%"; --enable_ps_protocol @@ -3114,6 +3118,7 @@ DROP VIEW IF EXISTS v1; let $query = SELECT * FROM (SELECT 1) AS t into @w; +--disable_cursor_protocol --enable_prepare_warnings eval $query; --error ER_PARSE_ERROR @@ -3121,6 +3126,7 @@ eval CREATE VIEW v1 AS $query; --echo # Previously the following would fail. eval $query; --disable_prepare_warnings +--enable_cursor_protocol # # Bug#24532 The return data type of IS TRUE is different from similar operations @@ -4160,6 +4166,7 @@ INSERT INTO t2 VALUES (9,90), (16, 160), (11,110), (1,10), (18,180), (2,20), (14,140), (15, 150), (12,120), (3,30), (17,170), (19,190); +--disable_cursor_protocol EXPLAIN EXTENDED SELECT t1.a,t2.c FROM t1,t2 WHERE t2.pk = t1.a AND t2.pk > 8; FLUSH STATUS; @@ -4173,6 +4180,7 @@ FLUSH STATUS; SELECT t1.a,v.c FROM t1,v WHERE v.pk = t1.a AND v.pk > 8; SHOW STATUS LIKE 'Handler_read_%'; DROP VIEW v; +--enable_cursor_protocol DROP TABLE t1, t2; --enable_ps2_protocol @@ -6732,6 +6740,38 @@ DROP TABLE t; --echo # End of 10.4 tests +--echo # +--echo # MDEV-29537: Creation of view with UNION and SELECT ... FOR UPDATE +--echo # in definition is failed with error +--echo # + +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT 1 FROM t1 +UNION +SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 + FOR UPDATE; + +SELECT * FROM v1; +SHOW CREATE VIEW v1; + +DROP VIEW v1; +DROP TABLE t1; + + +CREATE TABLE t1 (i INT); +CREATE VIEW v1 AS SELECT 1 FROM t1 + UNION + (SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 + FOR UPDATE); +SELECT * FROM v1; + +SHOW CREATE VIEW v1; + +DROP VIEW v1; +DROP TABLE t1; + +--echo # End of 10.5 tests + --echo # --echo # MDEV-13115: SELECT .. SKIP LOCKED - ensure SHOW CREATE VIEW is correct --echo # diff --git a/mysql-test/main/view_grant.test b/mysql-test/main/view_grant.test index ab2a2423318..48dc9dcc239 100644 --- a/mysql-test/main/view_grant.test +++ b/mysql-test/main/view_grant.test @@ -691,15 +691,19 @@ use test; create view v1 as select 42; show create view v1; +--disable_cursor_protocol select definer into @v1def1 from information_schema.views where table_schema = 'test' and table_name='v1'; +--enable_cursor_protocol drop view v1; create definer=`test14256`@`%` view v1 as select 42; show create view v1; +--disable_cursor_protocol select definer into @v1def2 from information_schema.views where table_schema = 'test' and table_name='v1'; +--enable_cursor_protocol drop view v1; select @v1def1, @v1def2, @v1def1=@v1def2; diff --git a/mysql-test/main/wl4435_generated.inc b/mysql-test/main/wl4435_generated.inc index 5ea05a89402..df039c6347e 100644 --- a/mysql-test/main/wl4435_generated.inc +++ b/mysql-test/main/wl4435_generated.inc @@ -288,7 +288,10 @@ CREATE TEMPORARY TABLE tmp1 AS SELECT @a AS c1; SHOW CREATE TABLE tmp1; +#Enable after fix MDEV-31495 +--disable_cursor_protocol SELECT @a, @a = 123.456789; +--enable_cursor_protocol DROP TEMPORARY TABLE tmp1; DROP PROCEDURE p1; diff --git a/mysql-test/mariadb-test-run.pl b/mysql-test/mariadb-test-run.pl index 594e052a16e..121deee1ed3 100755 --- a/mysql-test/mariadb-test-run.pl +++ b/mysql-test/mariadb-test-run.pl @@ -248,7 +248,7 @@ my @opt_skip_test_list; our $opt_ssl_supported; our $opt_ps_protocol; my $opt_sp_protocol; -my $opt_cursor_protocol; +our $opt_cursor_protocol; my $opt_view_protocol; my $opt_non_blocking_api; @@ -5580,11 +5580,12 @@ sub start_check_testcase ($$$) { } my $errfile= "$opt_vardir/tmp/$name.err"; - My::Debugger::setup_client_args(\$args, \$exe_mysqltest); + my $exe= $exe_mysqltest; + My::Debugger::setup_client_args(\$args, \$exe); my $proc= My::SafeProcess->new ( name => $name, - path => $exe_mysqltest, + path => $exe, error => $errfile, output => $errfile, args => \$args, diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index c9eea9b6fd9..7531c5ca8b7 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -18,7 +18,7 @@ sub skip_combinations { $skip{'include/platform.combinations'} = [ 'aix', 'win' ]; } - if ( $::opt_ps_protocol ) { + if ( $::opt_ps_protocol || $::opt_cursor_protocol) { $skip{'include/protocol.combinations'} = [ 'nm' ]; } else { $skip{'include/protocol.combinations'} = [ 'ps' ]; @@ -77,6 +77,9 @@ sub skip_combinations { $skip{'main/ssl_7937.combinations'} = [ 'x509v3' ] unless $ssl_lib =~ /WolfSSL/ or $openssl_ver ge "1.0.2"; + $skip{'main/tlsv13.test'} = 'does not work with OpenSSL <= 1.1.1' + unless $ssl_lib =~ /WolfSSL/ or $openssl_ver ge "3.0.0"; + $skip{'main/ssl_verify_ip.test'} = 'x509v3 support required' unless $openssl_ver ge "1.0.2"; diff --git a/mysql-test/suite/archive/rnd_pos.test b/mysql-test/suite/archive/rnd_pos.test index f0a8c9ad2f3..4ceb8a93656 100644 --- a/mysql-test/suite/archive/rnd_pos.test +++ b/mysql-test/suite/archive/rnd_pos.test @@ -11,9 +11,11 @@ explain partitions select c1,c3 from t1 order by c2; set max_length_for_sort_data = 4; explain partitions select c1,c3 from t1 order by c2; flush status; +--disable_cursor_protocol --disable_ps2_protocol select c1,c3 from t1 order by c2; --enable_ps2_protocol +--enable_cursor_protocol set max_length_for_sort_data = default; --disable_ps_protocol show status where variable_name like '%tmp%' and value != 0; @@ -24,9 +26,11 @@ explain partitions select c1,c3 from t1 order by c2; set max_length_for_sort_data = 4; explain partitions select c1,c3 from t1 order by c2; flush status; +--disable_cursor_protocol --disable_ps2_protocol select c1,c3 from t1 order by c2; --enable_ps2_protocol +--enable_cursor_protocol set max_length_for_sort_data = default; --disable_ps_protocol show status where variable_name like '%tmp%' and value != 0; diff --git a/mysql-test/suite/binlog/include/database.test b/mysql-test/suite/binlog/include/database.test index e61198b2da2..a55cd7c5002 100644 --- a/mysql-test/suite/binlog/include/database.test +++ b/mysql-test/suite/binlog/include/database.test @@ -44,9 +44,11 @@ CREATE TABLE t2(c1 INT); let $prefix= `SELECT UUID()`; --echo # Create a file in the database directory --replace_result $prefix FAKE_FILE +--disable_cursor_protocol --disable_ps2_protocol eval SELECT 'hello' INTO OUTFILE 'fake_file.$prefix'; --enable_ps2_protocol +--enable_cursor_protocol --echo --echo # 'DROP DATABASE' will fail if there is any other file in the the diff --git a/mysql-test/suite/binlog/t/binlog_commit_wait.test b/mysql-test/suite/binlog/t/binlog_commit_wait.test index 7d7af2a90e2..dbd0e41407f 100644 --- a/mysql-test/suite/binlog/t/binlog_commit_wait.test +++ b/mysql-test/suite/binlog/t/binlog_commit_wait.test @@ -15,6 +15,7 @@ connect(con3,localhost,root,,test); # Get Initial status measurements --connection default +--disable_cursor_protocol SELECT variable_value INTO @group_commits FROM information_schema.global_status WHERE variable_name = 'binlog_group_commits'; SELECT variable_value INTO @group_commit_trigger_count FROM information_schema.global_status @@ -23,6 +24,7 @@ SELECT variable_value INTO @group_commit_trigger_timeout FROM information_schema WHERE variable_name = 'binlog_group_commit_trigger_timeout'; SELECT variable_value INTO @group_commit_trigger_lock_wait FROM information_schema.global_status WHERE variable_name = 'binlog_group_commit_trigger_lock_wait'; +--enable_cursor_protocol # Note: binlog_group_commits is counted at the start of the group and group_commit_trigger_* is # counted near when the groups its finalised. diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test index 3e18ef1e351..420a00462ee 100644 --- a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test +++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test @@ -7,7 +7,9 @@ CREATE TABLE t (a TEXT); # events of interest are guaranteed to stay in 000001 log RESET MASTER; --eval INSERT INTO t SET a=repeat('a', 1024) +--disable_cursor_protocol SELECT a into @a from t; +--enable_cursor_protocol FLUSH LOGS; DELETE FROM t; diff --git a/mysql-test/suite/compat/oracle/t/update_innodb.test b/mysql-test/suite/compat/oracle/t/update_innodb.test index 79660920901..38030e04c23 100644 --- a/mysql-test/suite/compat/oracle/t/update_innodb.test +++ b/mysql-test/suite/compat/oracle/t/update_innodb.test @@ -8,8 +8,10 @@ SET sql_mode='ORACLE'; CREATE TABLE t1 (a INT NOT NULL PRIMARY KEY) engine=innodb; INSERT INTO t1 VALUES (1); START TRANSACTION; +--disable_cursor_protocol --enable_prepare_warnings SELECT a AS a_con1 FROM t1 INTO @a FOR UPDATE; +--enable_cursor_protocol --connect(con2,localhost,root,,) SET sql_mode='ORACLE'; diff --git a/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test b/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test index 83abb783c9e..c48e5cf5c73 100644 --- a/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test +++ b/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.test @@ -2,6 +2,7 @@ --source include/have_innodb.inc --source include/have_file_key_management_plugin.inc +--disable_cursor_protocol SELECT CAST(variable_value AS INT) INTO @old_encrypted FROM information_schema.global_status WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted'; @@ -9,6 +10,7 @@ WHERE variable_name = 'innodb_encryption_n_temp_blocks_encrypted'; SELECT CAST(variable_value AS INT) INTO @old_decrypted FROM information_schema.global_status WHERE variable_name = 'innodb_encryption_n_temp_blocks_decrypted'; +--enable_cursor_protocol CREATE TEMPORARY TABLE t1(f1 CHAR(200), f2 CHAR(200)) ENGINE=InnoDB; INSERT INTO t1 (f1,f2) SELECT '', '' FROM seq_1_to_8192; diff --git a/mysql-test/suite/engines/funcs/t/ld_null.test b/mysql-test/suite/engines/funcs/t/ld_null.test index 50cbce78044..e01c473baf3 100644 --- a/mysql-test/suite/engines/funcs/t/ld_null.test +++ b/mysql-test/suite/engines/funcs/t/ld_null.test @@ -3,7 +3,9 @@ DROP TABLE IF EXISTS t1; --enable_warnings CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 DATETIME); LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_null.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n'; +--disable_cursor_protocol eval SELECT * INTO OUTFILE '../../tmp/t1.dat' FROM t1; +--enable_cursor_protocol SELECT * FROM t1 ORDER BY c1; TRUNCATE TABLE t1; --disable_query_log @@ -15,7 +17,9 @@ DROP TABLE t1; CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10), c3 DATETIME); LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_null2.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' ESCAPED BY '\'' LINES TERMINATED BY '\n'; --disable_query_log +--disable_cursor_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1-2.dat' FIELDS ESCAPED BY '\'' FROM t1; +--enable_cursor_protocol --enable_query_log SELECT * FROM t1 ORDER BY c1; TRUNCATE TABLE t1; diff --git a/mysql-test/suite/engines/funcs/t/ld_quote.test b/mysql-test/suite/engines/funcs/t/ld_quote.test index 89636fff2bb..b66a5e24ed8 100644 --- a/mysql-test/suite/engines/funcs/t/ld_quote.test +++ b/mysql-test/suite/engines/funcs/t/ld_quote.test @@ -4,7 +4,9 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c1 INTEGER NOT NULL PRIMARY KEY, c2 VARCHAR(10)); LOAD DATA LOCAL INFILE 'suite/engines/funcs/t/load_quote.inc' INTO TABLE t1 FIELDS TERMINATED BY ',' ENCLOSED BY '\'' LINES TERMINATED BY '\n'; --disable_query_log +--disable_cursor_protocol eval SELECT * INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/t1.dat' FIELDS ENCLOSED BY '\'' FROM t1; +--enable_cursor_protocol --enable_query_log SELECT * FROM t1 ORDER BY c1; TRUNCATE TABLE t1; diff --git a/mysql-test/suite/engines/iuds/t/insert_calendar.test b/mysql-test/suite/engines/iuds/t/insert_calendar.test index 5d8380a1496..f957891bb1e 100644 --- a/mysql-test/suite/engines/iuds/t/insert_calendar.test +++ b/mysql-test/suite/engines/iuds/t/insert_calendar.test @@ -78,8 +78,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -152,8 +155,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -868,8 +874,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24 09:15:28'; @@ -942,8 +951,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26 00:00:00'; @@ -1016,8 +1028,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '1998-12-28 00:00:00'; @@ -2070,8 +2085,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -2144,8 +2162,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -2864,8 +2885,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -2938,8 +2962,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -3012,8 +3039,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '1998-12-28'; @@ -4067,8 +4097,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -4141,8 +4174,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -4854,8 +4890,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-24'; @@ -4928,8 +4967,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2007-05-26'; @@ -5002,8 +5044,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '1998-12-28'; diff --git a/mysql-test/suite/engines/iuds/t/insert_decimal.test b/mysql-test/suite/engines/iuds/t/insert_decimal.test index c75fa19506e..d6e1b43d0bf 100644 --- a/mysql-test/suite/engines/iuds/t/insert_decimal.test +++ b/mysql-test/suite/engines/iuds/t/insert_decimal.test @@ -60,8 +60,11 @@ SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '0.0'; @@ -134,8 +137,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '-0.0'; @@ -388,8 +394,11 @@ SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '0.0'; @@ -462,8 +471,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '-0.0'; @@ -711,8 +723,11 @@ SELECT count(*) as total_rows, min(c3) as min_value, max(c3) as max_value, sum(c ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '0.0'; @@ -785,8 +800,11 @@ SELECT * FROM t1 WHERE c1 IS NOT NULL ORDER BY c1,c2 DESC LIMIT 2; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '-0.0'; diff --git a/mysql-test/suite/engines/iuds/t/insert_time.test b/mysql-test/suite/engines/iuds/t/insert_time.test index 0e5e21507a9..8a7a822b934 100644 --- a/mysql-test/suite/engines/iuds/t/insert_time.test +++ b/mysql-test/suite/engines/iuds/t/insert_time.test @@ -77,8 +77,11 @@ SELECT * FROM t4; ## Full table scan ## --sorted_result SELECT * FROM t1; +#Check after fix MDEV-31730 +--disable_cursor_protocol --sorted_result SELECT count(*) as total_rows, min(c1) as min_value, max(c1) FROM t1; +--enable_cursor_protocol --sorted_result SELECT * FROM t1 WHERE c3 = '2009-01-17'; diff --git a/mysql-test/suite/federated/federatedx_create_handlers.test b/mysql-test/suite/federated/federatedx_create_handlers.test index c5ac36de644..c09ba28a7ea 100644 --- a/mysql-test/suite/federated/federatedx_create_handlers.test +++ b/mysql-test/suite/federated/federatedx_create_handlers.test @@ -7,6 +7,9 @@ connection default; set global federated_pushdown=1; +#Enable after fix MDEV-31846 or in v. 10.5 and later +--disable_cursor_protocol + connection slave; DROP TABLE IF EXISTS federated.t1; @@ -436,5 +439,7 @@ DEALLOCATE PREPARE stmt; set global federated_pushdown=0; +--enable_cursor_protocol + source include/federated_cleanup.inc; diff --git a/mysql-test/suite/funcs_1/datadict/datadict.pre b/mysql-test/suite/funcs_1/datadict/datadict.pre index cedc24aad13..4082ab7be31 100644 --- a/mysql-test/suite/funcs_1/datadict/datadict.pre +++ b/mysql-test/suite/funcs_1/datadict/datadict.pre @@ -21,11 +21,13 @@ # be able to use the correct --replace_result statement. Using this only the # one pair of 'wrong' values is replaced and not all occurrencies of all # possible pairs of values. See bug #12777 for details. +--disable_cursor_protocol SELECT character_maximum_length INTO @CML FROM information_schema.columns WHERE table_schema = 'information_schema' AND table_name = 'columns' AND column_name = 'table_catalog'; +--enable_cursor_protocol let $bug_12777_0512= `SELECT @CML = 512`; let $bug_12777_1023= `SELECT @CML = 1023`; diff --git a/mysql-test/suite/funcs_1/datadict/datadict_load.inc b/mysql-test/suite/funcs_1/datadict/datadict_load.inc index 9e3b87660f8..e3358588654 100644 --- a/mysql-test/suite/funcs_1/datadict/datadict_load.inc +++ b/mysql-test/suite/funcs_1/datadict/datadict_load.inc @@ -16,11 +16,13 @@ # be able to use the correct --replace_result statement. Using this only the # one pair of 'wrong' values is replaced and not all occurrencies of all # possible pairs of values. See bug #12777 for details. +--disable_cursor_protocol SELECT character_maximum_length INTO @CML FROM information_schema.columns WHERE table_schema = 'information_schema' AND table_name = 'columns' AND column_name = 'table_catalog'; +--enable_cursor_protocol let $bug_12777_0512= `SELECT @CML = 512`; let $bug_12777_1023= `SELECT @CML = 1023`; diff --git a/mysql-test/suite/funcs_1/datadict/is_tables.inc b/mysql-test/suite/funcs_1/datadict/is_tables.inc index b3d0ef4cca5..12257cad1ce 100644 --- a/mysql-test/suite/funcs_1/datadict/is_tables.inc +++ b/mysql-test/suite/funcs_1/datadict/is_tables.inc @@ -337,9 +337,11 @@ WHERE table_name = 't1_my_tablex'; ALTER TABLE db_datadict.t1_my_tablex CHECKSUM = 1; SELECT table_name, checksum IS NOT NULL FROM information_schema.tables WHERE table_name = 't1_my_tablex'; +--disable_cursor_protocol SELECT UPDATE_TIME, checksum INTO @UPDATE_TIME, @checksum FROM information_schema.tables WHERE table_name = 't1_my_tablex'; +--enable_cursor_protocol # Enforce a time difference bigger than the smallest unit (1 second). --real_sleep 1.1 INSERT INTO db_datadict.t1_my_tablex SET f1 = 3; @@ -354,8 +356,10 @@ FROM information_schema.tables WHERE table_name = 't1_my_tablex'; # # Information is used later +--disable_cursor_protocol SELECT CREATE_TIME INTO @CREATE_TIME FROM information_schema.tables WHERE table_name = 't1_my_tablex'; +--enable_cursor_protocol # # Check impact of DROP TABLE SELECT table_name FROM information_schema.tables diff --git a/mysql-test/suite/funcs_1/storedproc/param_check.inc b/mysql-test/suite/funcs_1/storedproc/param_check.inc index 203187f92b1..72c5ce15bc1 100644 --- a/mysql-test/suite/funcs_1/storedproc/param_check.inc +++ b/mysql-test/suite/funcs_1/storedproc/param_check.inc @@ -32,12 +32,16 @@ eval UPDATE t1_aux SET f1 = NULL; # Enforce that all user variables have the same data type and initial value. +--disable_cursor_protocol SELECT f1,f1,f1,f1 INTO @v1_tab,@v1_proc,@v2_proc,@v1_func FROM t1_aux; +--enable_cursor_protocol --disable_warnings eval UPDATE t1_aux SET f1 = $test_value; --enable_warnings +--disable_cursor_protocol SELECT f1 INTO @v1_tab FROM t1_aux; +--enable_cursor_protocol --disable_warnings eval CALL sproc_1($test_value, @v1_proc); eval SET @v1_func = func_1($test_value); diff --git a/mysql-test/suite/funcs_1/t/is_basics_mixed.test b/mysql-test/suite/funcs_1/t/is_basics_mixed.test index 7d5a1ee3872..9f52d7644f4 100644 --- a/mysql-test/suite/funcs_1/t/is_basics_mixed.test +++ b/mysql-test/suite/funcs_1/t/is_basics_mixed.test @@ -176,9 +176,11 @@ SELECT 1 AS my_col FROM information_schema.tables WHERE table_name = 't1_third'; # # SELECT INTO USER VARIABLE +--disable_cursor_protocol SELECT table_name,table_schema INTO @table_name,@table_schema FROM information_schema.tables WHERE table_schema = 'db_datadict' ORDER BY table_name LIMIT 1; +--enable_cursor_protocol SELECT @table_name,@table_schema; # # SELECT INTO OUTFILE @@ -186,6 +188,7 @@ let $OUTFILE = $MYSQLTEST_VARDIR/tmp/datadict.out; --error 0,1 remove_file $OUTFILE; --replace_result $OUTFILE +--disable_cursor_protocol --disable_ps2_protocol eval SELECT table_name,table_schema INTO OUTFILE '$OUTFILE' @@ -194,6 +197,7 @@ LINES TERMINATED BY '\n' FROM information_schema.tables WHERE table_schema = 'db_datadict' ORDER BY table_name; --enable_ps2_protocol +--enable_cursor_protocol cat_file $OUTFILE; remove_file $OUTFILE; # diff --git a/mysql-test/suite/funcs_1/t/row_count_func.test b/mysql-test/suite/funcs_1/t/row_count_func.test index fb207681bc6..4c3466f7a13 100644 --- a/mysql-test/suite/funcs_1/t/row_count_func.test +++ b/mysql-test/suite/funcs_1/t/row_count_func.test @@ -18,9 +18,11 @@ INSERT INTO t1 VALUES (1), (2), (3); --enable_info --echo SELECT * FROM t1 INTO OUTFILE "MYSQL_TMP_DIR/bug21818.txt"; --disable_query_log # to avoid $MYSQL_TMP_DIR in query log +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT * FROM t1 INTO OUTFILE "$MYSQL_TMP_DIR/bug21818.txt" --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log --disable_info @@ -32,9 +34,11 @@ SELECT ROW_COUNT(); --echo --echo # -- Check 2. +--disable_cursor_protocol --enable_info SELECT a FROM t1 LIMIT 1 INTO @a; --disable_info +--enable_cursor_protocol --echo --disable_ps2_protocol diff --git a/mysql-test/suite/funcs_1/t/storedproc.test b/mysql-test/suite/funcs_1/t/storedproc.test index e9c00742f01..621a4cc7f75 100644 --- a/mysql-test/suite/funcs_1/t/storedproc.test +++ b/mysql-test/suite/funcs_1/t/storedproc.test @@ -10,7 +10,10 @@ # ############################################################################ ---disable_ps_protocol +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) +{ + --skip Test temporarily disabled for ps-protocol and cursor-protocol +} --source include/default_charset.inc set sql_mode=""; @@ -29733,4 +29736,3 @@ DROP TABLE IF EXISTS res_t1; let $message= . +++ END OF SCRIPT +++; --source include/show_msg80.inc # ============================================================================== ---enable_ps_protocol diff --git a/mysql-test/suite/funcs_1/triggers/triggers_08.inc b/mysql-test/suite/funcs_1/triggers/triggers_08.inc index 7169f160fb8..f982f93239e 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_08.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_08.inc @@ -124,8 +124,10 @@ let $message= 3.5.8.4 - multiple SQL; select * from db_test.t1_u; --sorted_result select * from db_test.t1_d; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @test_var; - +--enable_cursor_protocol let $message= 3.5.8.4 - single SQL - insert; --source include/show_msg.inc @@ -202,7 +204,10 @@ let $message= 3.5.8.3/4 - single SQL - select; f122='Test 3.5.8.4-Single Select' where f122='Test 3.5.8.4-Single Delete'; Select f120, f122, f136, f144, f163 from tb3 where f122 like 'Test 3.5.8.4%'; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @test_var; +--enable_cursor_protocol #Cleanup connection default; diff --git a/mysql-test/suite/funcs_1/triggers/triggers_09.inc b/mysql-test/suite/funcs_1/triggers/triggers_09.inc index 93762b363df..92ea70240fc 100644 --- a/mysql-test/suite/funcs_1/triggers/triggers_09.inc +++ b/mysql-test/suite/funcs_1/triggers/triggers_09.inc @@ -93,10 +93,13 @@ let $message= Testcase 3.5.9.3:; Update tb3 Set f136=8 where f122='Test 3.5.9.3'; select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; +--enable_cursor_protocol --disable_query_log set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, @@ -112,10 +115,14 @@ let $message= Testcase 3.5.9.3:; delete from tb3 where f122='Test 3.5.9.3'; select f118, f121, f122, f136, f163 from tb3 where f122='Test 3.5.9.3' order by f136; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_163; select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_163; +--enable_cursor_protocol + #Cleanup --disable_warnings drop trigger trg2_a; @@ -167,10 +174,13 @@ let $message= Testcase 3.5.9.4:; select f118, f121, f122, f136, f151, f163 from tb3 where f122 like 'Test 3.5.9.4%' order by f163; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; +--enable_cursor_protocol --disable_query_log set @tr_var_b4_118=0, @tr_var_b4_121=0, @tr_var_b4_122=0, @@ -188,10 +198,14 @@ let $message= Testcase 3.5.9.4:; select f118, f121, f122, f136, f151, f163 from tb3 where f122 like 'Test 3.5.9.4-trig' order by f163; +#Check after fix MDEV-31495 +--disable_cursor_protocol select @tr_var_b4_118, @tr_var_b4_121, @tr_var_b4_122, @tr_var_b4_136, @tr_var_b4_151, @tr_var_b4_163; select @tr_var_af_118, @tr_var_af_121, @tr_var_af_122, @tr_var_af_136, @tr_var_af_151, @tr_var_af_163; +--enable_cursor_protocol + #Cleanup --disable_warnings drop trigger trg3_a; diff --git a/mysql-test/suite/galera/r/MDEV-16509.result b/mysql-test/suite/galera/r/MDEV-16509.result index b56622da2c0..fecb397994c 100644 --- a/mysql-test/suite/galera/r/MDEV-16509.result +++ b/mysql-test/suite/galera/r/MDEV-16509.result @@ -28,6 +28,11 @@ wsrep_last_seen_gtid_do_not_match 1 SET DEBUG_SYNC = "now SIGNAL after_group_continue"; connection node_1; +SELECT * from t1; +f1 +1 +connection ctrl; +SET DEBUG_SYNC = "RESET"; SET SESSION wsrep_sync_wait = 0; connection ctrl; connection node_1; @@ -69,6 +74,11 @@ SET DEBUG_SYNC = "now SIGNAL agac_continue_2"; connection node_1a; connection ctrl; SET DEBUG_SYNC = "RESET"; +SELECT * from t1; +f1 +1 +2 +3 DROP TABLE t1; disconnect ctrl; disconnect node_1a; diff --git a/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff b/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff new file mode 100644 index 00000000000..e02acc3de08 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff @@ -0,0 +1,37 @@ +--- a/home/panda/mariadb-10.5/mysql-test/suite/galera/r/galera_bf_kill.result ++++ b/home/panda/mariadb-10.5/mysql-test/suite/galera/r/galera_bf_kill.reject +@@ -77,4 +77,34 @@ a b + 5 2 + disconnect node_2a; + connection node_1; ++connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; ++connection node_2a; ++truncate t1; ++insert into t1 values (7,0); ++connection node_2; ++set wsrep_sync_wait=0; ++begin; ++update t1 set b=2 where a=7; ++connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2; ++set wsrep_sync_wait=0; ++SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; ++connection node_1; ++update t1 set b=1 where a=7; ++connection node_2b; ++SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; ++connection node_2; ++connection node_2b; ++SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; ++connection node_2; ++ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ++commit; ++select * from t1; ++a b ++7 1 ++connection node_2a; ++SET DEBUG_SYNC= 'RESET'; ++SET GLOBAL debug_dbug = ""; ++disconnect node_2a; ++disconnect node_2b; ++connection node_1; + drop table t1; diff --git a/mysql-test/suite/galera/r/galera_fk_multicolumn.result b/mysql-test/suite/galera/r/galera_fk_multicolumn.result index b626d963af8..c10c0a5c702 100644 --- a/mysql-test/suite/galera/r/galera_fk_multicolumn.result +++ b/mysql-test/suite/galera/r/galera_fk_multicolumn.result @@ -2,7 +2,7 @@ connection node_2; connection node_1; CREATE TABLE t0 ( f1 INT PRIMARY KEY, -f2 INT UNIQUE +f2 INT UNIQUE NOT NULL ); CREATE TABLE t1 ( f1 INT PRIMARY KEY, diff --git a/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result b/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result index 250974daf47..f6b68ea20b9 100644 --- a/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result +++ b/mysql-test/suite/galera/r/galera_var_ignore_apply_errors.result @@ -209,7 +209,9 @@ DROP TABLE t1; connection node_2; SELECT * FROM t1; ERROR 42S02: Table 'test.t1' doesn't exist -SET GLOBAL wsrep_ignore_apply_errors = 7; +SET GLOBAL wsrep_ignore_apply_errors = 10; +Warnings: +Warning 1292 Truncated incorrect wsrep_ignore_apply_errors value: '10' CALL mtr.add_suppression("Can't find record in "); CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event"); CALL mtr.add_suppression("Slave SQL: Error 'Unknown table 'test\\.t1'' on query\\. Default database: 'test'\\. Query: 'DROP TABLE t1', Error_code: 1051"); @@ -218,3 +220,4 @@ CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP INDEX idx1', Error_code: 1091"); CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'f2'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP COLUMN f2', Error_code: 1091"); CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query\\."); +CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus on "); diff --git a/mysql-test/suite/galera/t/MDEV-16509.test b/mysql-test/suite/galera/t/MDEV-16509.test index 078f1e95a99..3f3e2d88f1b 100644 --- a/mysql-test/suite/galera/t/MDEV-16509.test +++ b/mysql-test/suite/galera/t/MDEV-16509.test @@ -58,6 +58,12 @@ SET DEBUG_SYNC = "now SIGNAL after_group_continue"; --connection node_1 --reap +--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1; +--source include/wait_condition.inc +SELECT * from t1; + +--connection ctrl +SET DEBUG_SYNC = "RESET"; # # Scenario 2: Verify that two INSERTs from two different connections @@ -137,6 +143,10 @@ SET DEBUG_SYNC = "now SIGNAL agac_continue_2"; --connection ctrl SET DEBUG_SYNC = "RESET"; +--let $wait_condition = SELECT COUNT(*) = 3 FROM test.t1; +--source include/wait_condition.inc +SELECT * from t1; + DROP TABLE t1; --disconnect ctrl diff --git a/mysql-test/suite/galera/t/galera_bf_kill.test b/mysql-test/suite/galera/t/galera_bf_kill.test index 1b35b609a96..1cb2e866cb4 100644 --- a/mysql-test/suite/galera/t/galera_bf_kill.test +++ b/mysql-test/suite/galera/t/galera_bf_kill.test @@ -154,4 +154,77 @@ select * from t1; --disconnect node_2a --connection node_1 + +source include/maybe_debug.inc; +if ($have_debug) { +# +# Test case 7: Start a transaction on node_2 and use KILL to abort +# a query in connection node_2a +# During the KILL execution replicate conflicting transaction from node_1 +# to BF abort the transaction executing the KILL +# + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +truncate t1; +insert into t1 values (7,0); + +--connection node_2 +set wsrep_sync_wait=0; + +# get the ID of connection to be later killed +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1 +--source include/wait_condition.inc +--let $k_thread = `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND COMMAND = 'Sleep' LIMIT 1` + +# start a transaction +begin; +update t1 set b=2 where a=7; + +# set sync point for incoming applying +--connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2 +set wsrep_sync_wait=0; + +SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb"; + +# replicate conflicting transaction, should stopp in the sync point +--connection node_1 +update t1 set b=1 where a=7; + +# wait for the applier to reach the sync point +--connection node_2b +SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached"; + +# issue KILL inside the transacion, implicit commit is expected +--connection node_2 +--disable_query_log +--send_eval KILL QUERY $k_thread +--enable_query_log + +# wait for the KILL processing to be seen in processlist +--connection node_2b +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'root' AND INFO LIKE 'KILL QUERY%' +--source include/wait_condition.inc + +# resume applying, BF abort should follow +SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb"; + +--connection node_2 +--error ER_LOCK_DEADLOCK +--reap + +commit; + +select * from t1; + +--connection node_2a +SET DEBUG_SYNC= 'RESET'; +SET GLOBAL debug_dbug = ""; + +--disconnect node_2a +--disconnect node_2b + +--connection node_1 +} + drop table t1; diff --git a/mysql-test/suite/galera/t/galera_fk_multicolumn.test b/mysql-test/suite/galera/t/galera_fk_multicolumn.test index ad42f65924d..eeed46bca6c 100644 --- a/mysql-test/suite/galera/t/galera_fk_multicolumn.test +++ b/mysql-test/suite/galera/t/galera_fk_multicolumn.test @@ -7,7 +7,7 @@ CREATE TABLE t0 ( f1 INT PRIMARY KEY, - f2 INT UNIQUE + f2 INT UNIQUE NOT NULL ); CREATE TABLE t1 ( diff --git a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.cnf b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.cnf index 1d02401decc..fdb73f1f052 100644 --- a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.cnf +++ b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.cnf @@ -2,5 +2,5 @@ [mysqld] wsrep_debug=1 -wsrep_sync_wait=15 +wsrep_sync_wait=0 loose-galera-var-ignore-apply-errors=1 diff --git a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test index de17c95b33e..02dd9fa8416 100644 --- a/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test +++ b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test @@ -18,6 +18,7 @@ SET GLOBAL wsrep_ignore_apply_errors = 1; SET GLOBAL wsrep_on = OFF; CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc DROP TABLE t1; --connection node_2 @@ -28,6 +29,7 @@ SHOW TABLES; SET GLOBAL wsrep_on = OFF; CREATE SCHEMA s1; SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc DROP SCHEMA s1; --connection node_2 @@ -39,6 +41,7 @@ CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; CREATE INDEX idx1 ON t1 (f1); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc DROP INDEX idx1 ON t1; --connection node_2 @@ -51,6 +54,7 @@ CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; CREATE INDEX idx1 ON t1 (f1); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc ALTER TABLE t1 DROP INDEX idx1; --connection node_2 @@ -63,6 +67,7 @@ CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; ALTER TABLE t1 ADD COLUMN f2 INTEGER; SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc ALTER TABLE t1 DROP COLUMN f2; --connection node_2 @@ -83,6 +88,7 @@ CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = OFF; INSERT INTO t1 VALUES (1); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc DELETE FROM t1 WHERE f1 = 1; SELECT COUNT(*) AS expect_0 FROM t1; @@ -97,6 +103,7 @@ INSERT INTO t1 VALUES (2); SET GLOBAL wsrep_on = OFF; INSERT INTO t1 VALUES (1); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc START TRANSACTION; INSERT INTO t1 VALUES (3); DELETE FROM t1 WHERE f1 = 1; @@ -122,6 +129,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5); SET SESSION wsrep_on = OFF; DELETE FROM t1 WHERE f1 = 3; SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 DELETE FROM t1; @@ -148,6 +156,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5); SET SESSION wsrep_on = OFF; DELETE FROM t1 WHERE f1 = 3; SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 SET AUTOCOMMIT=OFF; @@ -186,6 +195,7 @@ SET SESSION wsrep_on = OFF; DELETE FROM t2 WHERE f1 = 2; DELETE FROM t1 WHERE f1 = 3; SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1; @@ -215,6 +225,7 @@ INSERT INTO child VALUES (1,1),(2,2),(3,3); SET SESSION wsrep_on = OFF; DELETE FROM child WHERE parent_id = 2; SET SESSION wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 DELETE FROM parent; @@ -241,6 +252,7 @@ SET GLOBAL wsrep_ignore_apply_errors = 4; SET GLOBAL wsrep_on = OFF; CREATE TABLE t1 (f1 INTEGER); SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_1 CREATE TABLE t1 (f1 INTEGER, f2 INTEGER); @@ -249,7 +261,7 @@ DROP TABLE t1; --connection node_2 --error ER_NO_SUCH_TABLE SELECT * FROM t1; -SET GLOBAL wsrep_ignore_apply_errors = 7; +SET GLOBAL wsrep_ignore_apply_errors = 10; CALL mtr.add_suppression("Can't find record in "); CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event"); @@ -259,3 +271,4 @@ CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'idx1'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP INDEX idx1', Error_code: 1091"); CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'f2'; check that column/key exists' on query\\. Default database: 'test'\\. Query: 'ALTER TABLE t1 DROP COLUMN f2', Error_code: 1091"); CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query\\."); +CALL mtr.add_suppression("Inconsistency detected: Inconsistent by consensus on "); diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf index abd778c482c..f23e1c65008 100644 --- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -48,6 +48,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' [sst] sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log +transferfmt=@ENV.MTR_GALERA_TFMT [ENV] NODE_MYPORT_1= @mysqld.1.port diff --git a/mysql-test/suite/galera_sr/r/MDEV-34836.result b/mysql-test/suite/galera_sr/r/MDEV-34836.result new file mode 100644 index 00000000000..10d302c415f --- /dev/null +++ b/mysql-test/suite/galera_sr/r/MDEV-34836.result @@ -0,0 +1,23 @@ +connection node_2; +connection node_1; +connection node_1; +CREATE TABLE parent (id INT AUTO_INCREMENT PRIMARY KEY, v INT) ENGINE=InnoDB; +INSERT INTO parent VALUES (1, 1),(2, 2),(3, 3); +CREATE TABLE child (id INT AUTO_INCREMENT PRIMARY KEY, parent_id INT, CONSTRAINT parent_fk +FOREIGN KEY (parent_id) REFERENCES parent (id)) ENGINE=InnoDB; +connection node_2; +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO child (parent_id) VALUES (1),(2),(3); +connection node_1; +SET SESSION wsrep_sync_wait = 15; +SELECT COUNT(*) FROM child; +COUNT(*) +0 +ALTER TABLE parent AUTO_INCREMENT = 100; +connection node_2; +COMMIT; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP TABLE child, parent; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera_sr/t/MDEV-34836.test b/mysql-test/suite/galera_sr/t/MDEV-34836.test new file mode 100644 index 00000000000..840ebaede4c --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MDEV-34836.test @@ -0,0 +1,56 @@ +# +# MDEV-34836: TOI transaction on FK-referenced parent table must BF abort +# SR transaction in progress on a child table. +# +# Applied SR transaction on the child table was not BF aborted by TOI running +# on the parent table for several reasons: +# Although SR correctly collected FK-referenced keys to parent, TOI in Galera +# disregards common certification index and simply sets itself to depend on the +# latest certified write set seqno. +# Since this write set was the fragment of SR transaction, TOI was allowed to run in +# parallel with SR presuming it would BF abort the latter. +# +# At the same time, DML transactions in the server don't grab MDL locks on FK-referenced +# tables, thus parent table wasn't protected by an MDL lock from SR and it couldn't +# provoke MDL lock conflict for TOI to BF abort SR transaction. +# In InnoDB, DDL transactions grab shared MDL locks on child tables, which is not enough +# to trigger MDL conflict in Galera. +# InnoDB-level Wsrep patch didn't contain correct conflict resolution logic due to the +# fact that it was believed MDL locking should always produce conflicts correctly. +# +# The fix brings conflict resolution rules similar to MDL-level checks to InnoDB, thus +# accounting for the problematic case. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE parent (id INT AUTO_INCREMENT PRIMARY KEY, v INT) ENGINE=InnoDB; +INSERT INTO parent VALUES (1, 1),(2, 2),(3, 3); + +CREATE TABLE child (id INT AUTO_INCREMENT PRIMARY KEY, parent_id INT, CONSTRAINT parent_fk + FOREIGN KEY (parent_id) REFERENCES parent (id)) ENGINE=InnoDB; + +--connection node_2 +# Start SR transaction and make it lock both parent and child tales. +SET SESSION wsrep_trx_fragment_size = 1; +START TRANSACTION; +INSERT INTO child (parent_id) VALUES (1),(2),(3); + +--connection node_1 +# Sync wait for SR transaction to replicate and apply fragments, thus +# locking parent table as well. +SET SESSION wsrep_sync_wait = 15; +SELECT COUNT(*) FROM child; +# Now run TOI on the parent, which BF-aborts the SR-transaction in progress. +ALTER TABLE parent AUTO_INCREMENT = 100; + +--connection node_2 +# Check that SR is BF-aborted. +--error ER_LOCK_DEADLOCK +COMMIT; + +# Cleanup +DROP TABLE child, parent; +--source include/galera_end.inc diff --git a/mysql-test/suite/gcol/inc/gcol_ins_upd.inc b/mysql-test/suite/gcol/inc/gcol_ins_upd.inc index f025752b5b1..7b6538a3085 100644 --- a/mysql-test/suite/gcol/inc/gcol_ins_upd.inc +++ b/mysql-test/suite/gcol/inc/gcol_ins_upd.inc @@ -626,9 +626,11 @@ CREATE TABLE t1 ( ); INSERT IGNORE INTO t1 (b) VALUES (b'101110001110100'),(b'011101'); +--disable_cursor_protocol --disable_ps2_protocol SELECT pk, b INTO OUTFILE 'load.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DATA_TOO_LONG LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b); diff --git a/mysql-test/suite/gcol/inc/gcol_keys.inc b/mysql-test/suite/gcol/inc/gcol_keys.inc index 4ae47afca9f..9349824aed7 100644 --- a/mysql-test/suite/gcol/inc/gcol_keys.inc +++ b/mysql-test/suite/gcol/inc/gcol_keys.inc @@ -776,9 +776,11 @@ CREATE TABLE t1 ( ); INSERT IGNORE INTO t1 (b) VALUES (b'101110001110100'),(b'011101'); +--disable_cursor_protocol --disable_ps2_protocol SELECT pk, b INTO OUTFILE 'load.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DATA_TOO_LONG LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1 (pk, b); diff --git a/mysql-test/suite/gcol/t/gcol_bugfixes.test b/mysql-test/suite/gcol/t/gcol_bugfixes.test index 1edc9779d41..7ec4b3d4e35 100644 --- a/mysql-test/suite/gcol/t/gcol_bugfixes.test +++ b/mysql-test/suite/gcol/t/gcol_bugfixes.test @@ -674,9 +674,11 @@ DROP TABLE t1; CREATE TABLE t1 (id INT PRIMARY KEY, a VARCHAR(2333), va VARCHAR(171) AS (a)) ENGINE=InnoDB; INSERT INTO t1 (id,a) VALUES (1,REPEAT('x',200)); +--disable_cursor_protocol --disable_ps2_protocol SELECT id, va INTO OUTFILE 'load_t1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DATA_TOO_LONG LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id,va); SELECT * FROM t1; @@ -689,9 +691,11 @@ DROP TABLE t1; CREATE TABLE t1 (id BIGINT PRIMARY KEY, a VARCHAR(2333), va VARCHAR(171) AS (a)) ENGINE=InnoDB; INSERT INTO t1 (id,a) VALUES (1,REPEAT('x',200)); +--disable_cursor_protocol --disable_ps2_protocol SELECT id, va INTO OUTFILE 'load_t1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DATA_TOO_LONG LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id,va); SELECT * FROM t1; @@ -711,9 +715,11 @@ CREATE TABLE t1 (id INT PRIMARY KEY, ts TIMESTAMP DEFAULT '1971-01-01 00:00:00', c VARBINARY(8) DEFAULT '', vc VARCHAR(3) AS (c) STORED); INSERT IGNORE INTO t1 (id,c) VALUES (1,'foobar'); +--disable_cursor_protocol --disable_ps2_protocol SELECT id, ts, vc INTO OUTFILE 'load_t1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --error 0,ER_DATA_TOO_LONG LOAD DATA INFILE 'load_t1' REPLACE INTO TABLE t1 (id, ts, vc); INSERT IGNORE INTO t1 (id) VALUES (2); diff --git a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test index 7966953535c..d41cc0c02b1 100644 --- a/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test +++ b/mysql-test/suite/gcol/t/innodb_virtual_debug_purge.test @@ -258,10 +258,14 @@ disconnect truncate; connection default; DROP TABLE t1, t2; +--disable_cursor_protocol --disable_ps2_protocol --enable_ps2_protocol +--enable_cursor_protocol +--disable_cursor_protocol --disable_ps2_protocol --enable_ps2_protocol +--enable_cursor_protocol --source include/wait_until_count_sessions.inc set debug_sync=reset; diff --git a/mysql-test/suite/handler/ps.test b/mysql-test/suite/handler/ps.test index 783d862435e..87f4cddf525 100644 --- a/mysql-test/suite/handler/ps.test +++ b/mysql-test/suite/handler/ps.test @@ -7,6 +7,10 @@ flush status; handler handler_a read first; # handler...read must be prepared in --ps-protocol mode --replace_result $PS_PROTOCOL OK +if($CURSOR_PROTOCOL) +{ + --replace_result $CURSOR_PROTOCOL OK +} --disable_ps_protocol show status like 'Com_stmt_prepare%'; --enable_ps_protocol diff --git a/mysql-test/suite/innodb/r/foreign_null,COPY.rdiff b/mysql-test/suite/innodb/r/foreign_null,COPY.rdiff new file mode 100644 index 00000000000..e39d5c0e9db --- /dev/null +++ b/mysql-test/suite/innodb/r/foreign_null,COPY.rdiff @@ -0,0 +1,18 @@ +--- foreign_null.result ++++ foreign_null,COPY.result +@@ -139,6 +139,7 @@ + ALTER TABLE `t#2` DROP INDEX f1; + SET FOREIGN_KEY_CHECKS=1; + ALTER TABLE `t#1` MODIFY COLUMN f2 INT; ++ERROR HY000: Error on rename of './test/#sql-alter' to './test/t@00231' (errno: 150 "Foreign key constraint is incorrectly formed") + DROP TABLE `t#2`, `t#1`; + # Drop referenced index and modify column + CREATE TABLE `t#1`(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +@@ -147,6 +148,7 @@ + ALTER TABLE `t#1` DROP INDEX f2; + SET FOREIGN_KEY_CHECKS=1; + ALTER TABLE `t#2` MODIFY COLUMN f1 INT NOT NULL; ++ERROR HY000: Error on rename of './test/#sql-alter' to './test/t@00232' (errno: 150 "Foreign key constraint is incorrectly formed") + DROP TABLE `t#2`, `t#1`; + # Self referential modifying column + CREATE TABLE t1(f1 INT, f2 INT, index(f2), foreign key(f1) references t1(f2) ON UPDATE CASCADE)engine=innodb; diff --git a/mysql-test/suite/innodb/r/foreign_null.result b/mysql-test/suite/innodb/r/foreign_null.result new file mode 100644 index 00000000000..a5d1afc7e0c --- /dev/null +++ b/mysql-test/suite/innodb/r/foreign_null.result @@ -0,0 +1,156 @@ +call mtr.add_suppression("InnoDB: In ALTER TABLE .* has or is referenced in foreign key constraints which are not compatible with the new table definition."); +# modify child column NOT NULL on UPDATE CASCADE..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +ERROR HY000: Column 'f1' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL +DROP TABLE t2, t1; +# modify child column NOT NULL ON DELETE CASCADE..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +DROP TABLE t2, t1; +# modify child column NOT NULL ON UPDATE SET NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY(f1) REFERENCES t1(f1) ON UPDATE SET NULL)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +ERROR HY000: Column 'f1' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL +DROP TABLE t2, t1; +# modify child column NOT NULL ON DELETE SET NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +ERROR HY000: Column 'f2' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL +DROP TABLE t2, t1; +# modify child column NOT NULL ON UPDATE RESTRICT..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +DROP TABLE t2, t1; +# modify child column NOT NULL ON DELETE RESTRICT..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE RESTRICT)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +DROP TABLE t2, t1; +# modify child column NOT NULL ON UPDATE NO ACTION..PARENT COLUMN NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +DROP TABLE t2, t1; +# modify child column NOT NULL ON DELETE NO ACTION..PARENT COLUMN NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +DROP TABLE t2, t1; +# modify parent column NULL ON UPDATE CASCADE child column NOT NULL +CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT NOT NULL, +FOREIGN KEY(f1) REFERENCES `t#1`(f2) +ON UPDATE CASCADE)ENGINE=InnoDB; +ALTER TABLE `t#1` MODIFY COLUMN f2 INT; +ERROR HY000: Cannot change column 'f2': used in a foreign key constraint 't#2_ibfk_1' of table 'test.t#2' +DROP TABLE `t#2`, `t#1`; +# modify parent column NULL ON DELETE CASCADE child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# modify parent column NULL ON UPDATE SET NULL child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE SET NULL)ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +DROP TABLE t1; +# modify parent column NULL ON DELETE SET NULL child NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +DROP TABLE t1; +# modify parent column NULL ON UPDATE RESTRICT child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# modify parent column NULL ON DELETE RESTRICT child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# modify parent column NULL ON UPDATE NO ACTION child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# modify parent column NULL ON DELETE NO ACTION child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f2 INT; +DROP TABLE t2, t1; +# foreign key constraint for multiple columns +# modify parent column NULL ON UPDATE CASCADE child column NOT NULL +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, +INDEX(f1, f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, +INDEX(f1, f2), +FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON +UPDATE CASCADE)ENGINE=InnoDB; +ALTER TABLE t1 MODIFY COLUMN f1 INT; +ERROR HY000: Cannot change column 'f1': used in a foreign key constraint 't2_ibfk_1' of table 'test.t2' +DROP TABLE t2, t1; +# modify child column NOT NULL ON UPDATE CASCADE parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, INDEX(f1, f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, INDEX(f1, f2), +FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON +UPDATE CASCADE)ENGINE=InnoDB; +ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL; +ERROR HY000: Column 'f2' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL +DROP TABLE t2, t1; +# allow foreign key constraints when parent table created later +SET FOREIGN_KEY_CHECKS=0; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1); +INSERT INTO t2 VALUES(1); +UPDATE t1 SET f2= NULL; +ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f1`) REFERENCES `t1` (`f2`) ON UPDATE CASCADE) +SELECT * FROM t2; +f1 +1 +SET FOREIGN_KEY_CHECKS=0; +UPDATE t1 SET f2= NULL; +SELECT * FROM t2; +f1 +1 +DROP TABLE t2, t1; +# Modify column + Drop column & Drop foreign key constraint +CREATE TABLE t1(f1 INT, f2 INT, KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, f3 INT, +FOREIGN KEY fdx(f2) REFERENCES t1(f1), +FOREIGN KEY fdx2(f3) REFERENCES t1(f2))ENGINE=InnoDB; +ALTER TABLE t2 MODIFY f2 INT NOT NULL, DROP FOREIGN KEY fdx; +ALTER TABLE t2 ADD FOREIGN KEY fdx (f2) REFERENCES t1(f1); +ALTER TABLE t2 DROP COLUMN f2, DROP FOREIGN KEY fdx; +DROP TABLE t2, t1; +# Drop foreign index & modify column +CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE `t#2` DROP INDEX f1; +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE `t#1` MODIFY COLUMN f2 INT; +DROP TABLE `t#2`, `t#1`; +# Drop referenced index and modify column +CREATE TABLE `t#1`(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=0; +ALTER TABLE `t#1` DROP INDEX f2; +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE `t#2` MODIFY COLUMN f1 INT NOT NULL; +DROP TABLE `t#2`, `t#1`; +# Self referential modifying column +CREATE TABLE t1(f1 INT, f2 INT, index(f2), foreign key(f1) references t1(f2) ON UPDATE CASCADE)engine=innodb; +ALTER TABLE t1 MODIFY COLUMN f2 INT NOT NULL; +ALTER TABLE t1 MODIFY COLUMN f1 INT NOT NULL; +ALTER TABLE t1 MODIFY COLUMN f1 INT; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/import_hidden_fts.result b/mysql-test/suite/innodb/r/import_hidden_fts.result index 69120898d4d..e08558cdc89 100644 --- a/mysql-test/suite/innodb/r/import_hidden_fts.result +++ b/mysql-test/suite/innodb/r/import_hidden_fts.result @@ -1,3 +1,5 @@ +SET @save_adaptive=@@GLOBAL.innodb_adaptive_hash_index; +SET GLOBAL innodb_adaptive_hash_index=ON; call mtr.add_suppression("InnoDB: Added system generated FTS_DOC_ID and FTS_DOC_ID_INDEX while importing the tablespace"); CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 CHAR(2) not null, fulltext f_idx(f2), @@ -9,7 +11,7 @@ INSERT INTO t1(f1, f2) SELECT seq, "si" FROM seq_2_to_256; ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; ALTER TABLE t1 DROP COLUMN f6; ALTER TABLE t1 DROP INDEX f_idx; -connect con1,localhost,root,,; +connect block_purge,localhost,root,,; START TRANSACTION WITH CONSISTENT SNAPSHOT; connection default; DELETE FROM t1 WHERE f1 > 1; @@ -22,6 +24,7 @@ UNLOCK TABLES; Warnings: Warning 1235 This version of MariaDB doesn't yet support 'FLUSH TABLES on a table that had an FTS index, created on a hidden column, the auxiliary tables haven't been dropped as yet. FTS auxiliary tables will not be flushed.' DROP TABLE t1; +disconnect block_purge; CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 CHAR(2) not null, f3 INT as (f1) VIRTUAL, INDEX(f3), @@ -43,3 +46,4 @@ t1 CREATE TABLE `t1` ( KEY `f4` (`f4`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; +SET GLOBAL innodb_adaptive_hash_index=@save_adaptive; diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result index a76837b91a2..d7d6f40af72 100644 --- a/mysql-test/suite/innodb/r/innodb-index.result +++ b/mysql-test/suite/innodb/r/innodb-index.result @@ -455,11 +455,11 @@ ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint alter table t2 drop index b, drop index c, drop index d; ERROR HY000: Cannot drop index 'b': needed in a foreign key constraint alter table t2 MODIFY b INT NOT NULL, ALGORITHM=COPY; -ERROR HY000: Cannot change column 'b': used in a foreign key constraint 't2_ibfk_1' +ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL set @old_sql_mode = @@sql_mode; set @@sql_mode = 'STRICT_TRANS_TABLES'; alter table t2 MODIFY b INT NOT NULL, ALGORITHM=INPLACE; -ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL +ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL set @@sql_mode = @old_sql_mode; SET FOREIGN_KEY_CHECKS=0; alter table t2 DROP COLUMN b, ALGORITHM=COPY; @@ -480,10 +480,10 @@ info: Records: 0 Duplicates: 0 Warnings: 0 set @@sql_mode = 'STRICT_TRANS_TABLES'; alter table t2 add primary key (alpha), change a alpha int, change b beta int not null, change c charlie int not null; -ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL +ERROR HY000: Column 'b' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL alter table t2 add primary key (alpha), change a alpha int, change c charlie int not null, change d delta int not null; -ERROR HY000: Column 'd' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_3' SET NULL +ERROR HY000: Column 'd' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_3' SET NULL alter table t2 add primary key (alpha), change a alpha int, change b beta int, modify c int not null; affected rows: 0 diff --git a/mysql-test/suite/innodb/r/innodb.result b/mysql-test/suite/innodb/r/innodb.result index e9f70621673..7c0e6066e7a 100644 --- a/mysql-test/suite/innodb/r/innodb.result +++ b/mysql-test/suite/innodb/r/innodb.result @@ -3058,7 +3058,7 @@ ALTER TABLE t2 ADD FOREIGN KEY (a) REFERENCES t1 (a) ON DELETE SET NULL; set @old_sql_mode = @@sql_mode; set @@sql_mode = 'STRICT_TRANS_TABLES'; ALTER TABLE t2 MODIFY a INT NOT NULL; -ERROR HY000: Column 'a' cannot be NOT NULL: needed in a foreign key constraint 'test/t2_ibfk_1' SET NULL +ERROR HY000: Column 'a' cannot be NOT NULL: needed in a foreign key constraint 't2_ibfk_1' SET NULL set @@sql_mode = @old_sql_mode; DELETE FROM t1; DROP TABLE t2,t1; diff --git a/mysql-test/suite/innodb/r/purge.result b/mysql-test/suite/innodb/r/purge.result index 9284fa18a7d..9b155f1c320 100644 --- a/mysql-test/suite/innodb/r/purge.result +++ b/mysql-test/suite/innodb/r/purge.result @@ -116,6 +116,29 @@ t12963823 CREATE TABLE `t12963823` ( KEY `ndx_o` (`o`(500)), KEY `ndx_p` (`p`(500)) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci ROW_FORMAT=DYNAMIC +BEGIN NOT ATOMIC +DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c', +GROUP_CONCAT(seq SEPARATOR +' INT DEFAULT 0, c'), +' INT DEFAULT 0, PRIMARY KEY(c', +GROUP_CONCAT(seq SEPARATOR ', c'), +')) ENGINE=InnoDB;') FROM seq_1_to_33); +EXECUTE IMMEDIATE c; +END; +$$ +ERROR 42000: Too many key parts specified; max 32 parts allowed +BEGIN NOT ATOMIC +DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c', +GROUP_CONCAT(seq SEPARATOR +' INT DEFAULT 0, c'), +' INT DEFAULT 0, PRIMARY KEY(c', +GROUP_CONCAT(seq SEPARATOR ', c'), +')) ENGINE=InnoDB;') FROM seq_1_to_32); +EXECUTE IMMEDIATE c; +END; +$$ +INSERT INTO t1() VALUES(); InnoDB 0 transactions not purged SET GLOBAL innodb_stats_persistent = @save_stats_persistent; +DROP TABLE t1; DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge, t12637786, t12963823; diff --git a/mysql-test/suite/innodb/r/stat_tables.result b/mysql-test/suite/innodb/r/stat_tables.result index 99c862fea77..a50e6fb1886 100644 --- a/mysql-test/suite/innodb/r/stat_tables.result +++ b/mysql-test/suite/innodb/r/stat_tables.result @@ -82,4 +82,22 @@ WHERE database_name='test' AND table_name='t1' AND stat_name='size'; TIMESTAMPDIFF(DAY,last_update,now())<=1 1 DROP TABLE t1; +# +# MDEV-34207: ALTER TABLE...STATS_PERSISTENT=0 fails to drop statistics +# +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +ALTER TABLE t1 STATS_PERSISTENT 0; +DROP TABLE t1; +SET @save_persistent=@@GLOBAL.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent=1; +CREATE TABLE t2 (c1 INT) ENGINE=InnoDB; +RENAME TABLE t2 TO t1; +DROP TABLE t1; +SET GLOBAL innodb_stats_persistent=0; +CREATE TABLE t2 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +RENAME TABLE t2 TO t1; +SET GLOBAL innodb_stats_persistent=@save_persistent; +DROP TABLE t1; +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +DROP TABLE t1; # End of 10.6 tests diff --git a/mysql-test/suite/innodb/t/alter_inplace_perfschema.test b/mysql-test/suite/innodb/t/alter_inplace_perfschema.test index e0451e121a6..9abc198843b 100644 --- a/mysql-test/suite/innodb/t/alter_inplace_perfschema.test +++ b/mysql-test/suite/innodb/t/alter_inplace_perfschema.test @@ -4,7 +4,9 @@ --source include/have_debug_sync.inc --source include/not_embedded.inc +--disable_cursor_protocol select count_star into @init_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%'; +--enable_cursor_protocol connect (ddl, localhost, root,,); update performance_schema.setup_instruments set enabled='yes'; update performance_schema.setup_consumers set enabled='yes'; @@ -26,7 +28,9 @@ send ALTER TABLE t1 ADD INDEX(b), ALGORITHM=INPLACE; connection default; SET DEBUG_SYNC = 'now WAIT_FOR go'; +--disable_cursor_protocol select count_star into @final_count from performance_schema.events_waits_summary_global_by_event_name WHERE event_name LIKE '%wait%io%file%innodb%innodb_temp_file%'; +--enable_cursor_protocol SELECT @final_count - @init_count; diff --git a/mysql-test/suite/innodb/t/foreign_null.combinations b/mysql-test/suite/innodb/t/foreign_null.combinations new file mode 100644 index 00000000000..e84e17b06ac --- /dev/null +++ b/mysql-test/suite/innodb/t/foreign_null.combinations @@ -0,0 +1,2 @@ +[COPY] +[INPLACE] diff --git a/mysql-test/suite/innodb/t/foreign_null.test b/mysql-test/suite/innodb/t/foreign_null.test new file mode 100644 index 00000000000..6869154fc9f --- /dev/null +++ b/mysql-test/suite/innodb/t/foreign_null.test @@ -0,0 +1,225 @@ +--source include/have_innodb.inc +call mtr.add_suppression("InnoDB: In ALTER TABLE .* has or is referenced in foreign key constraints which are not compatible with the new table definition."); + +let $MYSQLD_DATADIR= `select @@datadir`; +let $algorithm=`select regexp_replace('$MTR_COMBINATIONS', 'innodb,\|,innodb', '')`; + +--echo # modify child column NOT NULL on UPDATE CASCADE..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_NOT_NULL +eval ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON DELETE CASCADE..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON UPDATE SET NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY(f1) REFERENCES t1(f1) ON UPDATE SET NULL)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_NOT_NULL +eval ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON DELETE SET NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_NOT_NULL +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON UPDATE RESTRICT..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON DELETE RESTRICT..parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE RESTRICT)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON UPDATE NO ACTION..PARENT COLUMN NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON DELETE NO ACTION..PARENT COLUMN NULL +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, FOREIGN KEY (f2) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON UPDATE CASCADE child column NOT NULL +CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT NOT NULL, + FOREIGN KEY(f1) REFERENCES `t#1`(f2) + ON UPDATE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_CANNOT_CHANGE_CHILD +eval ALTER TABLE `t#1` MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE `t#2`, `t#1`; + +--echo # modify parent column NULL ON DELETE CASCADE child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON UPDATE SET NULL child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE SET NULL)ENGINE=InnoDB; +DROP TABLE t1; + +--echo # modify parent column NULL ON DELETE SET NULL child NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +--error ER_CANT_CREATE_TABLE +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE SET NULL)ENGINE=InnoDB; +DROP TABLE t1; + +--echo # modify parent column NULL ON UPDATE RESTRICT child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON DELETE RESTRICT child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE RESTRICT)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON UPDATE NO ACTION child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE NO ACTION)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify parent column NULL ON DELETE NO ACTION child column NOT NULL +CREATE TABLE t1(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES t1(f2) ON DELETE NO ACTION)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # foreign key constraint for multiple columns +--echo # modify parent column NULL ON UPDATE CASCADE child column NOT NULL +CREATE TABLE t1(f1 INT NOT NULL, f2 INT NOT NULL, + INDEX(f1, f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT NOT NULL, f2 INT NOT NULL, + INDEX(f1, f2), + FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON + UPDATE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_CANNOT_CHANGE_CHILD +eval ALTER TABLE t1 MODIFY COLUMN f1 INT,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # modify child column NOT NULL ON UPDATE CASCADE parent column NULL +CREATE TABLE t1(f1 INT, f2 INT, INDEX(f1, f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, INDEX(f1, f2), + FOREIGN KEY(f1, f2) REFERENCES t1(f1, f2) ON + UPDATE CASCADE)ENGINE=InnoDB; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +--error ER_FK_COLUMN_NOT_NULL +eval ALTER TABLE t2 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # allow foreign key constraints when parent table created later +SET FOREIGN_KEY_CHECKS=0; +CREATE TABLE t2(f1 INT, FOREIGN KEY(f1) REFERENCES t1(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=1; +ALTER TABLE t2 MODIFY COLUMN f1 INT NOT NULL; +CREATE TABLE t1(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +INSERT INTO t1 VALUES(1, 1); +INSERT INTO t2 VALUES(1); +--error ER_ROW_IS_REFERENCED_2 +UPDATE t1 SET f2= NULL; +SELECT * FROM t2; +SET FOREIGN_KEY_CHECKS=0; +UPDATE t1 SET f2= NULL; +SELECT * FROM t2; +DROP TABLE t2, t1; + +--echo # Modify column + Drop column & Drop foreign key constraint +CREATE TABLE t1(f1 INT, f2 INT, KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE t2(f1 INT, f2 INT, f3 INT, + FOREIGN KEY fdx(f2) REFERENCES t1(f1), + FOREIGN KEY fdx2(f3) REFERENCES t1(f2))ENGINE=InnoDB; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 MODIFY f2 INT NOT NULL, DROP FOREIGN KEY fdx,ALGORITHM=$algorithm; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 ADD FOREIGN KEY fdx (f2) REFERENCES t1(f1),ALGORITHM=$algorithm; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t2 DROP COLUMN f2, DROP FOREIGN KEY fdx,ALGORITHM=$algorithm; +DROP TABLE t2, t1; + +--echo # Drop foreign index & modify column +CREATE TABLE `t#1`(f1 INT, f2 INT NOT NULL, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT NOT NULL, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB; + +SET FOREIGN_KEY_CHECKS=0; +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE `t#2` DROP INDEX f1,ALGORITHM=$algorithm; +SET FOREIGN_KEY_CHECKS=1; + +let $error_code=0; +if ($algorithm == "COPY") +{ + let $error_code= ER_ERROR_ON_RENAME; +} + +--replace_regex /#sql-alter-[0-9a-f_\-]*/#sql-alter/ +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '' $MYSQLD_DATADIR ./; +--error $error_code +eval ALTER TABLE `t#1` MODIFY COLUMN f2 INT,ALGORITHM=$algorithm; +DROP TABLE `t#2`, `t#1`; + +--echo # Drop referenced index and modify column +CREATE TABLE `t#1`(f1 INT, f2 INT, PRIMARY KEY(f1), KEY(f2))ENGINE=InnoDB; +CREATE TABLE `t#2`(f1 INT, FOREIGN KEY(f1) REFERENCES `t#1`(f2) ON UPDATE CASCADE)ENGINE=InnoDB; +SET FOREIGN_KEY_CHECKS=0; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE `t#1` DROP INDEX f2,ALGORITHM=$algorithm; +SET FOREIGN_KEY_CHECKS=1; + +--replace_regex /#sql-alter-[0-9a-f_\-]*/#sql-alter/ +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE '' $MYSQLD_DATADIR ./; +--error $error_code +eval ALTER TABLE `t#2` MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; +DROP TABLE `t#2`, `t#1`; + +--echo # Self referential modifying column +CREATE TABLE t1(f1 INT, f2 INT, index(f2), foreign key(f1) references t1(f2) ON UPDATE CASCADE)engine=innodb; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f2 INT NOT NULL,ALGORITHM=$algorithm; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f1 INT NOT NULL,ALGORITHM=$algorithm; + +replace_result ,ALGORITHM=COPY '' ,ALGORITHM=INPLACE ''; +eval ALTER TABLE t1 MODIFY COLUMN f1 INT,ALGORITHM=$algorithm; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/group_commit.test b/mysql-test/suite/innodb/t/group_commit.test index 3a2018bec5d..1f7ebe55d3d 100644 --- a/mysql-test/suite/innodb/t/group_commit.test +++ b/mysql-test/suite/innodb/t/group_commit.test @@ -14,10 +14,12 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=innodb; # So concurrent insert won't happen on the table INSERT INTO t1 VALUES(100); +--disable_cursor_protocol SELECT variable_value INTO @commits FROM information_schema.global_status WHERE variable_name = 'binlog_commits'; SELECT variable_value INTO @group_commits FROM information_schema.global_status WHERE variable_name = 'binlog_group_commits'; +--enable_cursor_protocol connect(con1,localhost,root,,); connect(con2,localhost,root,,); diff --git a/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test b/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test index 107fc6f4056..0167a95fe4d 100644 --- a/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test +++ b/mysql-test/suite/innodb/t/group_commit_no_optimize_thread.test @@ -14,10 +14,12 @@ CREATE TABLE t1 (a VARCHAR(10) PRIMARY KEY) ENGINE=innodb; # So concurrent insert won't happen on the table INSERT INTO t1 VALUES("default"); +--disable_cursor_protocol SELECT variable_value INTO @commits FROM information_schema.global_status WHERE variable_name = 'binlog_commits'; SELECT variable_value INTO @group_commits FROM information_schema.global_status WHERE variable_name = 'binlog_group_commits'; +--enable_cursor_protocol connect(con1,localhost,root,,); connect(con2,localhost,root,,); diff --git a/mysql-test/suite/innodb/t/import_hidden_fts.test b/mysql-test/suite/innodb/t/import_hidden_fts.test index 4129e258fe1..406f11f7642 100644 --- a/mysql-test/suite/innodb/t/import_hidden_fts.test +++ b/mysql-test/suite/innodb/t/import_hidden_fts.test @@ -1,5 +1,11 @@ --source include/have_innodb.inc --source include/have_sequence.inc + +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET @save_adaptive=@@GLOBAL.innodb_adaptive_hash_index; +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET GLOBAL innodb_adaptive_hash_index=ON; + # Table with virtual, fulltext, instant add, instant drop column # and purgeable rows call mtr.add_suppression("InnoDB: Added system generated FTS_DOC_ID and FTS_DOC_ID_INDEX while importing the tablespace"); @@ -13,7 +19,7 @@ INSERT INTO t1(f1, f2) SELECT seq, "si" FROM seq_2_to_256; ALTER TABLE t1 ADD COLUMN f6 INT NOT NULL; ALTER TABLE t1 DROP COLUMN f6; ALTER TABLE t1 DROP INDEX f_idx; -connect(con1,localhost,root,,); +connect(block_purge,localhost,root,,); START TRANSACTION WITH CONSISTENT SNAPSHOT; connection default; @@ -26,6 +32,7 @@ ib_backup_tablespaces("test", "t1"); EOF UNLOCK TABLES; DROP TABLE t1; +disconnect block_purge; CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 CHAR(2) not null, @@ -44,3 +51,5 @@ ALTER TABLE t1 IMPORT TABLESPACE; --enable_warnings SHOW CREATE TABLE t1; DROP TABLE t1; +--error 0,ER_UNKNOWN_SYSTEM_VARIABLE +SET GLOBAL innodb_adaptive_hash_index=@save_adaptive; diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test index c80e3e6c066..8d6ca38568e 100644 --- a/mysql-test/suite/innodb/t/innodb-index.test +++ b/mysql-test/suite/innodb/t/innodb-index.test @@ -167,7 +167,7 @@ alter table t4 drop index d; alter table t2 drop index b; --error ER_DROP_INDEX_FK alter table t2 drop index b, drop index c, drop index d; ---error ER_FK_COLUMN_CANNOT_CHANGE +--error ER_FK_COLUMN_NOT_NULL alter table t2 MODIFY b INT NOT NULL, ALGORITHM=COPY; # NULL -> NOT NULL only allowed INPLACE if strict sql_mode is on. set @old_sql_mode = @@sql_mode; @@ -1187,8 +1187,10 @@ DROP TABLE t; --echo # CREATE TABLE t1 (a VARCHAR(8), PRIMARY KEY(a DESC)) ENGINE=InnoDB; ALTER TABLE t1 RENAME COLUMN a TO b, ALGORITHM=INPLACE; +--disable_cursor_protocol SELECT TABLE_ID INTO @table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME="test/t1"; SELECT INDEX_ID INTO @index_id FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE TABLE_ID = @table_id; +--enable_cursor_protocol SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS WHERE INDEX_ID=@index_id; DROP TABLE t1; @@ -1217,8 +1219,10 @@ DROP TABLE t1; CREATE TABLE t1 (id INT PRIMARY KEY, a CHAR(8), b INT, KEY(a DESC,b)) ENGINE=InnoDB; INSERT INTO t1 VALUES (1,'foo',10); ALTER TABLE t1 RENAME COLUMN b TO c, ALGORITHM=INPLACE; +--disable_cursor_protocol SELECT TABLE_ID INTO @table_id FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME="test/t1"; SELECT INDEX_ID INTO @index_id FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES WHERE TABLE_ID = @table_id ORDER BY INDEX_ID DESC LIMIT 1; +--enable_cursor_protocol SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS WHERE INDEX_ID=@index_id; DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_none.test b/mysql-test/suite/innodb/t/innodb-page_compression_none.test index e4eaae8bcb2..3ca0e1afe32 100644 --- a/mysql-test/suite/innodb/t/innodb-page_compression_none.test +++ b/mysql-test/suite/innodb/t/innodb-page_compression_none.test @@ -6,8 +6,9 @@ SET @save_compression_algorithm=@@GLOBAL.innodb_compression_algorithm; SET GLOBAL innodb_compression_algorithm=0; +--disable_cursor_protocol SELECT VARIABLE_VALUE INTO @compress_errors FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Innodb_num_pages_page_compression_error'; - +--enable_cursor_protocol CREATE TABLE t (c INT) page_compressed=1 page_compression_level=4 ENGINE=InnoDB; INSERT INTO t VALUES (1); diff --git a/mysql-test/suite/innodb/t/innodb-system-table-view.test b/mysql-test/suite/innodb/t/innodb-system-table-view.test index 663b76a1f18..14a85afe49f 100644 --- a/mysql-test/suite/innodb/t/innodb-system-table-view.test +++ b/mysql-test/suite/innodb/t/innodb-system-table-view.test @@ -13,10 +13,12 @@ LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`; # The IDs of mysql.innodb_table_stats and mysql.innodb_index_stats may # vary depending on whether the tables have been rebuilt # by previously run tests. +--disable_cursor_protocol SELECT table_id INTO @table_stats_id FROM information_schema.innodb_sys_tables WHERE name = 'mysql/innodb_table_stats'; SELECT table_id INTO @index_stats_id FROM information_schema.innodb_sys_tables WHERE name = 'mysql/innodb_index_stats'; +--enable_cursor_protocol SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE table_id NOT IN (@table_stats_id, @index_stats_id) ORDER BY table_id; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test index baced6e9e11..1697c69d6e4 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_load_now.test @@ -30,8 +30,10 @@ ENGINE=INNODB; SELECT PAGE_NUMBER FROM information_schema.innodb_buffer_page_lru WHERE table_name = '`test`.`ib_bp_test`'; +--disable_cursor_protocol SELECT SPACE INTO @space FROM information_schema.innodb_buffer_page_lru WHERE table_name = '`test`.`ib_bp_test`' AND PAGE_NUMBER=3; +--enable_cursor_protocol let SPACE=`SELECT @space`; diff --git a/mysql-test/suite/innodb/t/innodb_bug51920.test b/mysql-test/suite/innodb/t/innodb_bug51920.test index 84977925548..45acb64ee88 100644 --- a/mysql-test/suite/innodb/t/innodb_bug51920.test +++ b/mysql-test/suite/innodb/t/innodb_bug51920.test @@ -22,11 +22,13 @@ let $wait_condition = WHERE INFO="UPDATE bug51920 SET i=2"; -- source include/wait_condition.inc +--disable_cursor_protocol --enable_prepare_warnings SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO="UPDATE bug51920 SET i=2" INTO @thread_id; --disable_prepare_warnings +--enable_cursor_protocol KILL @thread_id; let $wait_condition = diff --git a/mysql-test/suite/innodb/t/innodb_force_recovery.test b/mysql-test/suite/innodb/t/innodb_force_recovery.test index 30364c06bb3..2dfe671e4e1 100644 --- a/mysql-test/suite/innodb/t/innodb_force_recovery.test +++ b/mysql-test/suite/innodb/t/innodb_force_recovery.test @@ -21,15 +21,19 @@ SET GLOBAL innodb_fast_shutdown = 0; --source include/restart_mysqld.inc let $status=`SHOW ENGINE INNODB STATUS`; +--disable_cursor_protocol SELECT CAST(variable_value AS INTEGER) INTO @read1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='innodb_buffer_pool_read_requests'; +--enable_cursor_protocol select * from t1; +--disable_cursor_protocol SELECT CAST(variable_value AS INTEGER) INTO @read2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='innodb_buffer_pool_read_requests'; +--enable_cursor_protocol SELECT @read1>0, @read2>@read1; diff --git a/mysql-test/suite/innodb/t/innodb_mysql.test b/mysql-test/suite/innodb/t/innodb_mysql.test index d495186db25..50ab6e8c1a8 100644 --- a/mysql-test/suite/innodb/t/innodb_mysql.test +++ b/mysql-test/suite/innodb/t/innodb_mysql.test @@ -625,7 +625,9 @@ CREATE TABLE t2 (a INT, b INT, --echo # set up our data elements INSERT INTO t1 (d) VALUES (1); INSERT INTO t2 (a,b) VALUES (1,1); +--disable_cursor_protocol SELECT SECOND(c) INTO @bug47453 FROM t2; +--enable_cursor_protocol SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a; UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1; diff --git a/mysql-test/suite/innodb/t/innodb_stats_persistent.test b/mysql-test/suite/innodb/t/innodb_stats_persistent.test index 294f283b259..85dc789d7b5 100644 --- a/mysql-test/suite/innodb/t/innodb_stats_persistent.test +++ b/mysql-test/suite/innodb/t/innodb_stats_persistent.test @@ -99,8 +99,10 @@ ANALYZE TABLE bug12429573; # innodb_index_stats have been updated to the same value. If the bug is # present this check will fail. +--disable_cursor_protocol SELECT last_update INTO @last FROM mysql.innodb_table_stats WHERE table_name = 'bug12429573'; +--enable_cursor_protocol SELECT * FROM mysql.innodb_index_stats WHERE table_name = 'bug12429573' AND last_update!=@last; diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test index 46952fda786..a4e6592477f 100644 --- a/mysql-test/suite/innodb/t/insert_into_empty.test +++ b/mysql-test/suite/innodb/t/insert_into_empty.test @@ -560,9 +560,11 @@ DROP TABLE t; --echo # CREATE TABLE t (id INT) ENGINE=InnoDB; --replace_result $MYSQLTEST_VARDIR VARDIR +--disable_cursor_protocol --disable_ps2_protocol eval select 1 into outfile "$MYSQLTEST_VARDIR/tmp/t.outfile"; --enable_ps2_protocol +--enable_cursor_protocol BEGIN; --replace_result $MYSQLTEST_VARDIR VARDIR eval LOAD DATA INFILE '$MYSQLTEST_VARDIR/tmp/t.outfile' INTO TABLE t; diff --git a/mysql-test/suite/innodb/t/instant_alter.test b/mysql-test/suite/innodb/t/instant_alter.test index d6d7a988d96..b2023e581ad 100644 --- a/mysql-test/suite/innodb/t/instant_alter.test +++ b/mysql-test/suite/innodb/t/instant_alter.test @@ -808,18 +808,24 @@ SELECT * FROM t1; DROP TABLE t1; eval CREATE TABLE t1 (t TINYINT PRIMARY KEY, m MEDIUMINT UNIQUE) $engine; +--disable_cursor_protocol SELECT table_id INTO @table_id1 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t1'; +--enable_cursor_protocol INSERT INTO t1 VALUES (-42, -123456); --enable_info ALTER TABLE t1 CHANGE t s SMALLINT; +--disable_cursor_protocol SELECT table_id INTO @table_id2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t1'; +--enable_cursor_protocol --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON ALTER TABLE t1 CHANGE m i INT, ALGORITHM=INSTANT; ALTER TABLE t1 CHANGE m i INT; +--disable_cursor_protocol SELECT table_id INTO @table_id3 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS WHERE name = 'test/t1'; +--enable_cursor_protocol --disable_info SELECT @table_id1 = @table_id2, @table_id2 = @table_id3; INSERT IGNORE INTO t1 VALUES (0, -123456); diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test index 84227098952..f7841c1e4ef 100644 --- a/mysql-test/suite/innodb/t/instant_alter_bugs.test +++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test @@ -129,9 +129,11 @@ INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES INSERT INTO t1 (f1,f2,f3,f4,f5,f6,f7,f8) VALUES ('impact', 'b', 'h', 185, 'fj', 7, 7, 3); ALTER TABLE t1 ADD COLUMN filler VARCHAR(255) DEFAULT ''; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 'load.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol UPDATE IGNORE t1 SET pk = 0; LOAD DATA INFILE 'load.data' REPLACE INTO TABLE t1; HANDLER t1 OPEN AS h; diff --git a/mysql-test/suite/innodb/t/mem_pressure.test b/mysql-test/suite/innodb/t/mem_pressure.test index 91f75e65795..adb221cfe4e 100644 --- a/mysql-test/suite/innodb/t/mem_pressure.test +++ b/mysql-test/suite/innodb/t/mem_pressure.test @@ -24,9 +24,11 @@ SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit; DROP TABLE t1; +--disable_cursor_protocol SELECT CAST(VARIABLE_VALUE AS INTEGER) INTO @dirty_prev FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty'; +--enable_cursor_protocol set debug_dbug="d,trigger_garbage_collection"; SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size; diff --git a/mysql-test/suite/innodb/t/purge.test b/mysql-test/suite/innodb/t/purge.test index 1dc2b1175dc..3bbee574373 100644 --- a/mysql-test/suite/innodb/t/purge.test +++ b/mysql-test/suite/innodb/t/purge.test @@ -1,5 +1,6 @@ --source include/have_innodb.inc --source include/have_innodb_16k.inc +--source include/have_sequence.inc SET @save_stats_persistent = @@GLOBAL.innodb_stats_persistent; SET GLOBAL innodb_stats_persistent = 0; @@ -110,9 +111,35 @@ CREATE INDEX ndx_n ON t12963823 (n(500)); CREATE INDEX ndx_o ON t12963823 (o(500)); CREATE INDEX ndx_p ON t12963823 (p(500)); SHOW CREATE TABLE t12963823; -# We need to activate the purge thread before DROP TABLE. +DELIMITER $$; +--error ER_TOO_MANY_KEY_PARTS +BEGIN NOT ATOMIC + DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c', + GROUP_CONCAT(seq SEPARATOR + ' INT DEFAULT 0, c'), + ' INT DEFAULT 0, PRIMARY KEY(c', + GROUP_CONCAT(seq SEPARATOR ', c'), + ')) ENGINE=InnoDB;') FROM seq_1_to_33); + EXECUTE IMMEDIATE c; +END; +$$ +BEGIN NOT ATOMIC + DECLARE c TEXT DEFAULT(SELECT CONCAT('CREATE TABLE t1(c', + GROUP_CONCAT(seq SEPARATOR + ' INT DEFAULT 0, c'), + ' INT DEFAULT 0, PRIMARY KEY(c', + GROUP_CONCAT(seq SEPARATOR ', c'), + ')) ENGINE=InnoDB;') FROM seq_1_to_32); + EXECUTE IMMEDIATE c; +END; +$$ +DELIMITER ;$$ +INSERT INTO t1() VALUES(); + +# We need to activate the purge thread before DROP TABLE. -- source include/wait_all_purged.inc SET GLOBAL innodb_stats_persistent = @save_stats_persistent; +DROP TABLE t1; DROP TABLE t1_purge, t2_purge, t3_purge, t4_purge, t12637786, t12963823; diff --git a/mysql-test/suite/innodb/t/restart.test b/mysql-test/suite/innodb/t/restart.test index 8507f182be6..727353b2492 100644 --- a/mysql-test/suite/innodb/t/restart.test +++ b/mysql-test/suite/innodb/t/restart.test @@ -102,8 +102,10 @@ let $wait_condition = FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; +--disable_cursor_protocol SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; +--enable_cursor_protocol --error ER_WRONG_VALUE_FOR_VAR EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); diff --git a/mysql-test/suite/innodb/t/stat_tables.test b/mysql-test/suite/innodb/t/stat_tables.test index ad421587283..79bc107d0ea 100644 --- a/mysql-test/suite/innodb/t/stat_tables.test +++ b/mysql-test/suite/innodb/t/stat_tables.test @@ -80,5 +80,29 @@ SELECT TIMESTAMPDIFF(DAY,last_update,now())<=1 FROM mysql.innodb_index_stats WHERE database_name='test' AND table_name='t1' AND stat_name='size'; DROP TABLE t1; +--echo # +--echo # MDEV-34207: ALTER TABLE...STATS_PERSISTENT=0 fails to drop statistics +--echo # +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +ALTER TABLE t1 STATS_PERSISTENT 0; +DROP TABLE t1; + +SET @save_persistent=@@GLOBAL.innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent=1; + +CREATE TABLE t2 (c1 INT) ENGINE=InnoDB; +RENAME TABLE t2 TO t1; + +DROP TABLE t1; +SET GLOBAL innodb_stats_persistent=0; + +CREATE TABLE t2 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +RENAME TABLE t2 TO t1; + +SET GLOBAL innodb_stats_persistent=@save_persistent; +DROP TABLE t1; + +CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; +DROP TABLE t1; --echo # End of 10.6 tests diff --git a/mysql-test/suite/innodb/t/temp_table_savepoint.test b/mysql-test/suite/innodb/t/temp_table_savepoint.test index fd1d06b48f7..185fb252e93 100644 --- a/mysql-test/suite/innodb/t/temp_table_savepoint.test +++ b/mysql-test/suite/innodb/t/temp_table_savepoint.test @@ -141,9 +141,11 @@ update ignore t5 set c1 = 20 where c1 = 140 ; select count(*) from t5 where c1 = 140; --replace_result $MYSQLTEST_VARDIR VARDIR +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile "$MYSQLTEST_VARDIR/tmp/t5.outfile" from t5; --enable_ps2_protocol +--enable_cursor_protocol create temporary table temp_1 engine = innodb as select * from t5 where 1=2; diff --git a/mysql-test/suite/innodb_fts/t/opt.test b/mysql-test/suite/innodb_fts/t/opt.test index 19dfdcad8fd..efcc47af4a7 100644 --- a/mysql-test/suite/innodb_fts/t/opt.test +++ b/mysql-test/suite/innodb_fts/t/opt.test @@ -30,6 +30,7 @@ ANALYZE TABLE t1; SET STATEMENT use_stat_tables=never FOR ANALYZE TABLE wp; +--disable_cursor_protocol --disable_ps2_protocol # @@ -549,6 +550,7 @@ SHOW STATUS LIKE 'Handler_read%'; DROP TABLE wp, t1; --enable_ps2_protocol +--enable_cursor_protocol # Tests for FT hints. diff --git a/mysql-test/suite/innodb_gis/t/1.test b/mysql-test/suite/innodb_gis/t/1.test index a0abbb82479..c3a270c9ec2 100644 --- a/mysql-test/suite/innodb_gis/t/1.test +++ b/mysql-test/suite/innodb_gis/t/1.test @@ -408,7 +408,10 @@ select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440))) --enable_metadata create table t1 (g GEOMETRY); select * from t1; +#Check after fix MDEV-31540 +--disable_cursor_protocol select ST_asbinary(g) from t1; +--enable_cursor_protocol --disable_metadata --enable_view_protocol drop table t1; diff --git a/mysql-test/suite/innodb_gis/t/gis.test b/mysql-test/suite/innodb_gis/t/gis.test index 87438f50582..731dfe86c65 100644 --- a/mysql-test/suite/innodb_gis/t/gis.test +++ b/mysql-test/suite/innodb_gis/t/gis.test @@ -398,11 +398,14 @@ select (ST_asWKT(ST_geomfromwkb((0x000000000140240000000000004024000000000000))) select (ST_asWKT(ST_geomfromwkb((0x010100000000000000000024400000000000002440)))) AS val; --disable_view_protocol +#check after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata create table t1 (g GEOMETRY); select * from t1; select ST_asbinary(g) from t1; --disable_metadata +--enable_cursor_protocol --enable_view_protocol drop table t1; @@ -1440,7 +1443,9 @@ SELECT ST_Union('', ''), md5(1); --echo # fields after MDEV-25459 --echo # CREATE TABLE t1(l LINESTRING NOT NULL, SPATIAL INDEX(l))ENGINE=InnoDB; +--disable_cursor_protocol SELECT GROUP_CONCAT(CONCAT(seq, ' ', seq) SEPARATOR ',') INTO @g FROM seq_0_to_504; +--enable_cursor_protocol INSERT INTO t1 SET l=ST_GeomFromText(CONCAT('LINESTRING(',@g,',0 0)')); SELECT COUNT(*) FROM t1 WHERE MBRIntersects(GeomFromText('Polygon((0 0,0 10,10 10,10 0,0 0))'), l); DROP TABLE t1; diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result index 8fb737cc558..0cfddc60877 100644 --- a/mysql-test/suite/json/r/json_table.result +++ b/mysql-test/suite/json/r/json_table.result @@ -1040,6 +1040,51 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY jt ALL NULL NULL NULL NULL 40 Table function: json_table drop table t1; # +# MDEV-25822: JSON_TABLE: default values should allow non-string literals +# +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 0.5 on empty)) as T; +col1 +0.5 +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 5 on empty)) as T; +col1 +5 +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 'asdf' on empty)) as T; +col1 +asdf +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default -0.5 on empty)) as T; +col1 +-0.5 +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 18446744073709551615 on empty)) as T; +col1 +18446744073709551615 +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default DATE '2021-01-01' on empty)) as T; +col1 +2021-01-01 +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 5 on empty)) as T; +select * from v; +col1 +5 +show create view v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `T`.`col1` AS `col1` from JSON_TABLE('{"a": "b"}', '$' COLUMNS (`col1` varchar(32) PATH '$.fooo' DEFAULT 5 ON EMPTY)) `T` latin1 latin1_swedish_ci +drop view v; +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 18446744073709551615 on empty)) as T; +select * from v; +col1 +18446744073709551615 +show create view v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `T`.`col1` AS `col1` from JSON_TABLE('{"a": "b"}', '$' COLUMNS (`col1` varchar(32) PATH '$.fooo' DEFAULT 18446744073709551615 ON EMPTY)) `T` latin1 latin1_swedish_ci +drop view v; +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 'asdf' on empty)) as T; +select * from v; +col1 +asdf +show create view v; +View Create View character_set_client collation_connection +v CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v` AS select `T`.`col1` AS `col1` from JSON_TABLE('{"a": "b"}', '$' COLUMNS (`col1` varchar(32) PATH '$.fooo' DEFAULT 'asdf' ON EMPTY)) `T` latin1 latin1_swedish_ci +drop view v; +# # End of 10.6 tests # # diff --git a/mysql-test/suite/json/r/json_table_mysql.result b/mysql-test/suite/json/r/json_table_mysql.result index 2357d9d3cf0..ef84e4fb417 100644 --- a/mysql-test/suite/json/r/json_table_mysql.result +++ b/mysql-test/suite/json/r/json_table_mysql.result @@ -549,10 +549,12 @@ Warning 1366 Incorrect double value: 'asdf' for column ``.`(temporary)`.`f` at r Warning 1366 Incorrect decimal value: 'asdf' for column ``.`(temporary)`.`d` at row 1 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON EMPTY)) jt; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL ON EMPTY)) jt' at line 2 +x +NULL SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON ERROR)) jt; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'NULL ON ERROR)) jt' at line 2 +x +NULL SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON EMPTY)) jt; x @@ -565,12 +567,14 @@ SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE PATH '$.x' DEFAULT DATE'2020-01-01' ON EMPTY)) jt; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATE'2020-01-01' ON EMPTY)) jt' at line 4 +x +2020-01-01 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE PATH '$.x' DEFAULT DATE'2020-01-01' ON ERROR)) jt; -ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'DATE'2020-01-01' ON ERROR)) jt' at line 4 +x +NULL # # Bug#25413069: SIG11 IN CHECK_COLUMN_GRANT_IN_TABLE_REF # diff --git a/mysql-test/suite/json/t/json_no_table.test b/mysql-test/suite/json/t/json_no_table.test index d7b302c98a6..82191377129 100644 --- a/mysql-test/suite/json/t/json_no_table.test +++ b/mysql-test/suite/json/t/json_no_table.test @@ -330,8 +330,11 @@ SELECT JSON_DEPTH( json_compact( '"abc"') ); --echo error ER_INVALID_TYPE_FOR_JSON SELECT JSON_DEPTH( 1 ); +#Check after fix MDEV-31728 +--disable_cursor_protocol --echo error ER_INVALID_JSON_TEXT_IN_PARAM SELECT JSON_DEPTH( 'abc' ); +--enable_cursor_protocol # returns 1 SELECT JSON_DEPTH( json_compact( 1) ); @@ -372,11 +375,14 @@ SELECT JSON_DEPTH '[ "a", true, "b" , { "e" : false }, "c" , null ]' ); +#Check after fix MDEV-31728 +--disable_cursor_protocol --echo error ER_INVALID_JSON_TEXT_IN_PARAM SELECT JSON_DEPTH ( '[ "a", true, "b" , { "e" : false }, "c" , null' ); +--enable_cursor_protocol --echo # ---------------------------------------------------------------------- --echo # Test of JSON_REMOVE function. @@ -585,6 +591,8 @@ SELECT JSON_MERGE --echo error ER_INVALID_JSON_TEXT_IN_PARAM select json_type('abc'); +# Enable after fix MDEV-31554 +--disable_cursor_protocol #select i, json_type(j) from t1; select json_type('{"a": 2}'); select json_type('[1,2]'); @@ -651,6 +659,7 @@ select json_type(json_compact(ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0) select json_type(json_compact(null)); select json_type(json_compact(null)) is null; # check that it is an SQL NULL select json_type(null) is null; # is an SQL NULL +--enable_cursor_protocol # # same, but now show the printable value: @@ -882,7 +891,10 @@ select json_extract( '[1]', '$**[0]' ); # should have same result select json_extract( '{ "a": 1 }', '$.a[0]' ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_extract( '{ "a": 1 }', '$**[0]' ); +--enable_cursor_protocol # should have same result select json_extract( '{ "a": 1 }', '$[0].a' ); @@ -890,7 +902,10 @@ select json_extract( '{ "a": 1 }', '$**.a' ); # should have same result select json_extract( '{ "a": 1 }', '$[0].a[0]' ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_extract( '{ "a": 1 }', '$**[0]' ); +--enable_cursor_protocol # should have the same result select json_extract( '{ "a": 1 }', '$[0].a' ); @@ -998,7 +1013,10 @@ select json_extract( '[ { "a": [3,4] }, { "b": 2 } ]', '$[0].a', '$[1].a' ) jdoc # NULLs select json_array_append(NULL, '$.b', json_compact(1)); select json_array_append('[1,2,3]', NULL, json_compact(1)); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_array_append('[1,2,3]', '$', NULL); +--enable_cursor_protocol # wrong # args --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT @@ -1019,9 +1037,12 @@ select json_array_append(json_compact('{"a": {"b": [3]}}'), '$**[0]', 6); --echo # Auto-wrapping, since because the paths identify scalars. --echo # should return {"a": "foo", "b": ["bar", 4], "c": ["wibble", "grape"]} +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_ARRAY_APPEND('{"a": "foo", "b": "bar", "c": "wibble"}', '$.b', json_compact(4), '$.c', json_compact('"grape"')); +--enable_cursor_protocol --echo # should return {"a": "foo", "b": [1, 2, 3, 4], --echo # "c": ["apple", "pear", "grape"]} @@ -1061,7 +1082,10 @@ SELECT JSON_ARRAY_APPEND --echo # Bug#21373874 ASSERTION `PARENT' FAILED --echo # ---------------------------------------------------------------------- +#Enable after fix MDEV-31554 +--disable_cursor_protocol select json_array_append('{"a":1}', '$[0]', 100); +--enable_cursor_protocol select json_array_append('3', '$[0]', 100); select json_array_append('3', '$[0][0][0][0]', 100); @@ -1072,7 +1096,10 @@ select json_array_append('3', '$[0][0][0][0]', 100); # NULLs select json_insert(NULL, '$.b', json_compact(1)); select json_insert('[1,2,3]', NULL, json_compact(1)); +#Enable after fix MDEV-31554 +--disable_cursor_protocol select json_insert('[1,2,3]', '$[3]', NULL); +--enable_cursor_protocol # wrong # args --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT @@ -1089,7 +1116,10 @@ select json_insert('[1,2,3]', '$[3]', 4); select json_insert('[1,2,3]', '$[10]', 4); select json_insert('{"c":4}', '$.c', 4); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_insert('{"c":4}', '$.a', 4); +--enable_cursor_protocol select json_insert('1', '$', 4); select json_insert('1', '$[0]', 4); @@ -1200,7 +1230,10 @@ SELECT JSON_INSERT # NULLs select json_array_insert(NULL, '$.b[1]', 1); select json_array_insert('[1,2,3]', NULL, 1); +#Enable after fix MDEV-31554 +--disable_cursor_protocol select json_array_insert('[1,2,3]', '$[3]', NULL); +--enable_cursor_protocol # wrong # args --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT @@ -1218,6 +1251,8 @@ select json_array_insert('true', '$.a', 1); --echo error ER_INVALID_JSON_PATH_ARRAY_CELL select json_array_insert('true', '$.a[1].b', 1); +#Enable after fix MDEV-31554 +--disable_cursor_protocol # nop if there is no array at the path's parent select json_array_insert( 'true', '$[0]', false ); select json_array_insert( 'true', '$[1]', false ); @@ -1243,6 +1278,7 @@ select json_array_insert( '[1, 2, 3, 4]', '$[2]', false ); select json_array_insert( '[1, 2, 3, 4]', '$[3]', false ); select json_array_insert( '[1, 2, 3, 4]', '$[4]', false ); select json_array_insert( '[1, 2, 3, 4]', '$[5]', false ); +--enable_cursor_protocol select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[0]', false ); select json_array_insert( '{ "a": [1, 2, 3, 4] }', '$.a[1]', false ); @@ -1268,7 +1304,10 @@ select json_insert('[]', '$**[1]', 6); select json_insert('[]', '$[*][1]', 6); # multiple paths, +#Enable after fix MDEV-31554 +--disable_cursor_protocol select json_array_insert( '[ 1, 2, 3 ]', '$[1]', true, '$[1]', false ); +--enable_cursor_protocol select json_array_insert( '[ 1, 2, 3 ]', '$[1]', json_compact( '[ "a", "b", "c", "d" ]'), '$[1][2]', false ); @@ -1297,9 +1336,12 @@ select json_set(NULL, NULL); --error ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT select json_set(NULL, NULL, NULL, NULL); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # Detect errors in nested function calls. --echo error ER_INVALID_JSON_TEXT_IN_PARAM SELECT JSON_SET('{}', '$.name', JSON_EXTRACT('', '$')); +--enable_cursor_protocol # positive test cases @@ -1308,7 +1350,10 @@ select json_set('[1,2,3]', '$[3]', 4); select json_set('[1,2,3]', '$[10]', 4); select json_set('{"c":4}', '$.c', 5); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_set('{"c":4}', '$.a', 5); +--enable_cursor_protocol select json_set('1', '$', 4); select json_set('1', '$[0]', 4); @@ -1355,10 +1400,13 @@ select json_set('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.a', json_compact('{}')); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # returns { "a" : "foo", "b" : [ 1, 2, 3 ], "c" : [ true, false ] } select json_set('{ "a" : "foo", "b" : [ 1, 2, 3 ] }', '$.c', json_compact('[true, false]')); +--enable_cursor_protocol # returns [ 1, null, null, 2 ] select json_set('1', '$[3]', 2); @@ -1376,6 +1424,8 @@ SELECT JSON_SET JSON_OBJECT() ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # returns {"a": "foo", "b": [1, 2, 3], "c": [true, false]} SELECT JSON_SET ( @@ -1391,6 +1441,7 @@ SELECT JSON_SET '$.c', JSON_ARRAY( json_compact( 'true'), json_compact( 'false') ) ); +--enable_cursor_protocol # returns [1, 2] SELECT JSON_SET @@ -1473,6 +1524,8 @@ select json_array('[1,2,3]', NULL, json_compact(1)); select json_array('[1,2,3]', '$[3]', NULL); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # positive test cases select json_array(); select json_array(3.14); @@ -1483,6 +1536,7 @@ select json_array(b'0', b'1', b'10'); # returns the empty array: [] SELECT JSON_ARRAY(); +--enable_cursor_protocol --echo # ---------------------------------------------------------------------- --echo # Test of JSON_OBJECT function. @@ -1498,9 +1552,12 @@ select json_object( 'a', 1, 'b' ); --echo error ER_JSON_DOCUMENT_NULL_KEY select json_object( null, 1 ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # positive tests select json_object(); select json_object( 'a', null ); +--enable_cursor_protocol select json_object( 'a', 1 ); select json_object( 'a', 1, 'b', 'foo' ); select json_object( 'a', 1, 'b', 'foo', 'c', json_compact( '{ "d": "wibble" }') ); @@ -1517,8 +1574,11 @@ select json_object( cast(json_array() as char), json_array()); select json_object( 1, json_array()); select json_object( cast(1 as char), json_array()); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # returns the empty object: {} SELECT JSON_OBJECT(); +--enable_cursor_protocol --echo # ---------------------------------------------------------------------- --echo # Test of JSON_SEARCH function. @@ -1710,17 +1770,23 @@ select json_type(case (null is null) when 1 then json_compact('null') else json_compact('[1,2,3]') end); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_type(case (null is not null) when 1 then json_compact('null') else json_compact('[1,2,3]') end); +--enable_cursor_protocol select json_type( if(null is null, json_compact('null'), json_compact('[1,2,3]')) ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_type( if(null is not null, json_compact('null'), json_compact('[1,2,3]'))); +--enable_cursor_protocol select cast(json_extract(json_compact(concat('[', json_compact('["A",2]'), ']')), '$[0][1]') as char) = 2; @@ -1765,8 +1831,11 @@ select json_quote(convert('abc' using utf8mb4)); select json_unquote('abc'); # should do nothing select json_unquote('"abc"'); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_unquote(convert('"abc"' using ascii)); select json_unquote(convert('"abc"' using latin1)); +--enable_cursor_protocol select json_unquote(convert('"abc"' using utf8)); select json_unquote(convert('"abc"' using utf8mb4)); @@ -1775,8 +1844,11 @@ select json_unquote('"'); # should do nothing --echo error ER_INCORRECT_TYPE select json_quote(123); # integer not allowed +# Enable after fix MDEV-31554 +--disable_cursor_protocol --echo error ER_INCORRECT_TYPE select json_unquote(123); # integer not allowed +--enable_cursor_protocol select json_unquote('""'); # empty string select char_length(json_unquote('""')); # verify empty string @@ -1810,21 +1882,30 @@ select json_unquote(json_unquote(json_unquote( # long round trip of it # DATE/TIME will lose their quotes, too: select json_compact(cast('2015-01-15 23:24:25' as datetime)); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_unquote(json_compact(cast('2015-01-15 23:24:25' as datetime))); +--enable_cursor_protocol # as well as opaque values: select json_compact(st_geomfromtext('point(1 1)')); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_unquote(json_compact(st_geomfromtext('point(1 1)'))); +--enable_cursor_protocol # examples from the wl7909 spec # returns the SQL string literal abc SELECT JSON_UNQUOTE( '"abc"' ); +# Enable after fix MDEV-31554 +--disable_cursor_protocol # returns the SQL string literal "abc SELECT JSON_UNQUOTE( '"abc' ); --echo error ER_INCORRECT_TYPE SELECT JSON_UNQUOTE( 123 ); +--enable_cursor_protocol # returns the SQL string literal abc SELECT JSON_UNQUOTE @@ -1966,7 +2047,10 @@ SELECT JSON_CONTAINS('[1]', '[1]', '$', '$[0]'); select json_object("a", ifnull(json_quote('test'), json_compact('null'))); select json_compact(concat('[', json_quote('ab'), ']')); select json_compact(concat('[', json_unquote('"12"'), ']')); +# Enable after fix MDEV-31554 +--disable_cursor_protocol select json_compact(concat('["', json_type( json_compact(1)), '"]')); +--enable_cursor_protocol --echo # --echo # Bug#20912438: ITEM_TYPE_HOLDER::DISPLAY_LENGTH(ITEM*): ASSERTION `0' FAILED @@ -2125,7 +2209,10 @@ select json_quote( json_type( json_compact('{}') ) ); --echo # WHEN EXECUTED IN A VIEW OR JOIN --echo # +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_TYPE(JSON_OBJECT()); +--enable_cursor_protocol CREATE VIEW v1 AS SELECT JSON_TYPE(JSON_OBJECT()); SELECT * FROM v1; drop view v1; @@ -2158,8 +2245,11 @@ SELECT * FROM (SELECT JSON_UNQUOTE(JSON_QUOTE('This is a string that should not --echo # FOR BOOL WHEN USED VIA VIEW --echo # +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_OBJECT('key1', false, 'key2', true); SELECT JSON_ARRAY('key1', false, 'key2', true); +--enable_cursor_protocol CREATE VIEW v1 AS SELECT JSON_OBJECT('key1', false, 'key2', true); SELECT * FROM v1; CREATE VIEW v2 AS SELECT JSON_ARRAY('key1', false, 'key2', true); @@ -2282,7 +2372,9 @@ SELECT JSON_REPLACE('[[[1]]]', '$[0][0][0]', 100); # LEAST and GREATEST treat JSON arguments as strings for now. They used to hit # an assertion if used in a JSON context and all arguments were JSON values, or # a mix of NULLs and JSON values. +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT JSON_ARRAY(LEAST(NULL, NULL), GREATEST(NULL, NULL), LEAST(j1, NULL), GREATEST(NULL, j2), LEAST(j1, j2), GREATEST(j1, j2)) AS j FROM (SELECT json_compact('1') AS j1, json_compact('2') AS j2) t; - +--enable_cursor_protocol diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test index 96eb992e6d3..6b2a45099b7 100644 --- a/mysql-test/suite/json/t/json_table.test +++ b/mysql-test/suite/json/t/json_table.test @@ -893,6 +893,30 @@ explain select c, drop table t1; +--echo # +--echo # MDEV-25822: JSON_TABLE: default values should allow non-string literals +--echo # +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 0.5 on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 5 on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 'asdf' on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default -0.5 on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 18446744073709551615 on empty)) as T; +select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default DATE '2021-01-01' on empty)) as T; + +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 5 on empty)) as T; +select * from v; +show create view v; +drop view v; +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 18446744073709551615 on empty)) as T; +select * from v; +show create view v; +drop view v; +create view v as select * from json_table('{"a": "b"}', '$' columns(col1 varchar(32) path '$.fooo' default 'asdf' on empty)) as T; +select * from v; +show create view v; +drop view v; + + --echo # --echo # End of 10.6 tests --echo # diff --git a/mysql-test/suite/json/t/json_table_mysql.test b/mysql-test/suite/json/t/json_table_mysql.test index 9f77ad964f3..8595c0e15e8 100644 --- a/mysql-test/suite/json/t/json_table_mysql.test +++ b/mysql-test/suite/json/t/json_table_mysql.test @@ -445,11 +445,8 @@ SELECT * FROM JSON_TABLE('"asdf"', '$' COLUMNS( f FLOAT PATH '$', d DECIMAL PATH '$')) AS jt; -# DEFAULT NULL is not accepted syntax. ---error ER_PARSE_ERROR SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON EMPTY)) jt; ---error ER_PARSE_ERROR SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON ERROR)) jt; @@ -457,13 +454,10 @@ SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON EMPTY)) jt; SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON ERROR)) jt; -# We don't accept dates in DEFAULT ---error 1064 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE PATH '$.x' DEFAULT DATE'2020-01-01' ON EMPTY)) jt; ---error 1064 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE PATH '$.x' diff --git a/mysql-test/suite/parts/inc/partition.pre b/mysql-test/suite/parts/inc/partition.pre index 3c9bbe9a6a6..9a18c53d61d 100644 --- a/mysql-test/suite/parts/inc/partition.pre +++ b/mysql-test/suite/parts/inc/partition.pre @@ -57,7 +57,9 @@ let $ER_NO_PARTITION_FOR_GIVEN_VALUE= 1526; # Set the variable $engine_other to a storage engine <> $engine --disable_query_log +--disable_cursor_protocol eval SELECT UPPER($engine) = 'MEMORY' INTO @aux; +--enable_cursor_protocol let $aux= `SELECT @aux`; if ($aux) { @@ -69,6 +71,7 @@ if (!$aux) } --enable_query_log +--disable_cursor_protocol # Numbers used for # - partitioning Example: ... PARTITION part1 VALUES LESS THAN ($max_row_div2) # - INSERT/SELECT/UPDATE/DELETE Example: ... WHERE f_int1 > @max_row_div3 @@ -102,6 +105,7 @@ WHERE f_int1 BETWEEN 2 * @max_row_div3 AND @max_row; # let $insert_all= INSERT INTO t1(f_int1,f_int2,f_char1,f_char2,f_charbig) SELECT f_int1,f_int2,f_char1,f_char2,f_charbig FROM t0_template; +--enable_cursor_protocol # Column list with definition for all tables to be checked let $column_list= f_int1 INTEGER DEFAULT 0, diff --git a/mysql-test/suite/parts/inc/partition_alter3.inc b/mysql-test/suite/parts/inc/partition_alter3.inc index 395f93f44f6..feebcf4ffaa 100644 --- a/mysql-test/suite/parts/inc/partition_alter3.inc +++ b/mysql-test/suite/parts/inc/partition_alter3.inc @@ -28,8 +28,10 @@ SELECT CONCAT(CAST((f_int1 + 999) AS CHAR),'-02-10'), CAST(f_char1 AS CHAR) FROM t0_template WHERE f_int1 + 999 BETWEEN 1000 AND 9999; # 3. Calculate the number of inserted records. +--disable_cursor_protocol SELECT IF(9999 - 1000 + 1 > @max_row, @max_row , 9999 - 1000 + 1) INTO @exp_row_count; +--enable_cursor_protocol # DEBUG SELECT @exp_row_count; # 4. Print the layout, check Readability --source suite/parts/inc/partition_layout.inc diff --git a/mysql-test/suite/parts/inc/partition_check.inc b/mysql-test/suite/parts/inc/partition_check.inc index ed323dfa245..4dad6bff16f 100644 --- a/mysql-test/suite/parts/inc/partition_check.inc +++ b/mysql-test/suite/parts/inc/partition_check.inc @@ -64,6 +64,7 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol let $my_stmt= SELECT COUNT(*) <> 0 INTO @aux FROM t1 WHERE f_int1 <> f_int2 OR f_char1 <> CAST(f_int1 AS CHAR) OR f_char1 <> f_char2 OR f_charbig <> CONCAT('===',f_char1,'===') @@ -148,6 +149,7 @@ if ($run) --echo # Sorry, have to abort. exit; } +--enable_cursor_protocol # Give a success message like in the other following tests --echo # check MIN/MAX(f_int2) success: 1 @@ -368,17 +370,21 @@ AND (MIN(f_int1) = 1) AND (MAX(f_int1) = @max_row) AS "" FROM t1; if ($any_unique) { # Calculate the number of records, where we will try INSERT ..... or REPLACE + --disable_cursor_protocol SELECT COUNT(*) INTO @try_count FROM t0_template WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + --enable_cursor_protocol # # Calculate the number of records, where we will get DUPLICATE KEY # f_int1 is sufficient for calculating this, because 1.1 # checks, that f_int1 = f_int2 is valid for all rows. + --disable_cursor_protocol SELECT COUNT(*) INTO @clash_count FROM t1 INNER JOIN t0_template USING(f_int1) WHERE MOD(f_int1,3) = 0 AND f_int1 BETWEEN @max_row_div2 AND @max_row; + --enable_cursor_protocol if ($debug) { SELECT @try_count, @clash_count; @@ -390,7 +396,9 @@ if ($any_unique) # 4 Some operations with single records # 4.1 Insert one record with a value for f_int1 which is lower than in all # existing records. +--disable_cursor_protocol SELECT MIN(f_int1) - 1 INTO @cur_value FROM t1; +--enable_cursor_protocol INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), @@ -408,7 +416,9 @@ WHERE f_int1 = @cur_value AND f_int2 = @cur_value # # 4.2 Insert one record with a value for f_int1 which is higher than in all # existing records. +--disable_cursor_protocol SELECT MAX(f_int1) + 1 INTO @cur_value FROM t1; +--enable_cursor_protocol INSERT INTO t1 SET f_int1 = @cur_value , f_int2 = @cur_value, f_char1 = CAST(@cur_value AS CHAR), f_char2 = CAST(@cur_value AS CHAR), @@ -428,8 +438,10 @@ WHERE f_int1 = @cur_value AND f_int2 = @cur_value # the highest value of all existing records. # If f_int1 is used for the partitioning expression a movement of the # record to another partition/subpartition might appear. +--disable_cursor_protocol SELECT MIN(f_int1) INTO @cur_value1 FROM t1; SELECT MAX(f_int1) + 1 INTO @cur_value2 FROM t1; +--enable_cursor_protocol UPDATE t1 SET f_int1 = @cur_value2 WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; # Check of preceding statement via Select @@ -447,7 +459,9 @@ WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; # record to another partition/subpartition might appear. # f_int1 gets the delicate value '-1'. SET @cur_value1= -1; +--disable_cursor_protocol SELECT MAX(f_int1) INTO @cur_value2 FROM t1; +--enable_cursor_protocol # Bug#15968: Partitions: crash when INSERT with f_int1 = -1 into PARTITION BY HASH(f_int1) UPDATE t1 SET f_int1 = @cur_value1 WHERE f_int1 = @cur_value2 AND f_charbig = '#SINGLE#'; @@ -461,7 +475,9 @@ WHERE f_int1 = @cur_value1 AND f_charbig = '#SINGLE#'; --enable_query_log # # 4.5 Delete the record with the highest value of f_int1. +--disable_cursor_protocol SELECT MAX(f_int1) INTO @cur_value FROM t1; +--enable_cursor_protocol DELETE FROM t1 WHERE f_int1 = @cur_value AND f_charbig = '#SINGLE#'; # Check of preceding statements via Select if ($no_debug) @@ -751,8 +767,10 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(f_int1) INTO @start_count FROM t1 WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @start_count <> 0`; if ($run) @@ -770,7 +788,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +--enable_cursor_protocol --enable_query_log # 7.1 Successful INSERT + COMMIT INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) @@ -839,8 +859,10 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(*) INTO @my_count FROM t1 WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +--enable_cursor_protocol SELECT '# check transactions-6 success: ' AS "", @my_count IN (0,@exp_inserted_rows) AS ""; let $run= `SELECT @my_count = 0`; @@ -872,7 +894,9 @@ COMMIT WORK; # 7.3 Failing INSERT (in mid of statement processing) + COMMIT SET @@session.sql_mode = 'traditional'; # Number of records where a INSERT has to be tried +--disable_cursor_protocol SELECT @max_row_div2 + @max_row_div4 - @max_row_div4 + 1 INTO @exp_inserted_rows; +--enable_cursor_protocol # --disable_abort_on_error INSERT INTO t1 (f_int1, f_int2, f_char1, f_char2, f_charbig) @@ -890,8 +914,10 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(*) INTO @my_count FROM t1 WHERE f_int1 BETWEEN @max_row_div4 AND @max_row_div2 + @max_row_div4; +--enable_cursor_protocol SELECT '# check transactions-8 success: ' AS "", @my_count IN (@max_row_div2 - 1 - @max_row_div4 + 1,0) AS ""; let $run= `SELECT @my_count = @max_row_div2 - 1 - @max_row_div4 + 1`; diff --git a/mysql-test/suite/parts/inc/partition_check_read.inc b/mysql-test/suite/parts/inc/partition_check_read.inc index e42bb9c90ab..280580d67a6 100644 --- a/mysql-test/suite/parts/inc/partition_check_read.inc +++ b/mysql-test/suite/parts/inc/partition_check_read.inc @@ -27,7 +27,9 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE $col_to_check = $num; + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -46,7 +48,9 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) = 1 INTO @aux FROM t1 WHERE $col_to_check = @max_row + $num; + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -64,7 +68,9 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) = 1 INTO @aux FROM t1 WHERE $col_to_check = 1 - $num; + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) diff --git a/mysql-test/suite/parts/inc/partition_check_read1.inc b/mysql-test/suite/parts/inc/partition_check_read1.inc index 0b8b800a371..cb6b839130a 100644 --- a/mysql-test/suite/parts/inc/partition_check_read1.inc +++ b/mysql-test/suite/parts/inc/partition_check_read1.inc @@ -26,7 +26,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE f_date = '1000-02-10'; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -43,7 +45,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol eval SELECT COUNT(*) <> @exp_row_count INTO @aux FROM t1; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -63,8 +67,10 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE f_date = CONCAT(CAST(999 + $num AS CHAR),'-02-10'); + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) diff --git a/mysql-test/suite/parts/inc/partition_check_read2.inc b/mysql-test/suite/parts/inc/partition_check_read2.inc index 60964355d14..36421dec115 100644 --- a/mysql-test/suite/parts/inc/partition_check_read2.inc +++ b/mysql-test/suite/parts/inc/partition_check_read2.inc @@ -22,7 +22,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE f_int1 = 3; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -39,7 +41,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol eval SELECT COUNT(*) <> @max_row INTO @aux FROM t1; +--enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) @@ -59,8 +63,10 @@ while ($num) { --disable_query_log } + --disable_cursor_protocol eval SELECT COUNT(*) <> 1 INTO @aux FROM t1 WHERE f_int1 = 3; + --enable_cursor_protocol --enable_query_log let $run= `SELECT @aux`; if ($run) diff --git a/mysql-test/suite/parts/inc/partition_layout_check2.inc b/mysql-test/suite/parts/inc/partition_layout_check2.inc index 23e4a9e1e95..6e98eb16223 100644 --- a/mysql-test/suite/parts/inc/partition_layout_check2.inc +++ b/mysql-test/suite/parts/inc/partition_layout_check2.inc @@ -58,11 +58,13 @@ eval INSERT INTO t0_definition SET state = 'new', file_list = @aux; # Print the old and new table layout, if they differ +--disable_cursor_protocol SELECT COUNT(*) <> 1 INTO @aux FROM t0_definition tab1, t0_definition tab2 WHERE tab1.state = 'old' AND tab2.state = 'new' AND tab1.create_command = tab2.create_command AND tab1.file_list = tab2.file_list; +--enable_cursor_protocol let $run= `SELECT @aux`; if ($run) { diff --git a/mysql-test/suite/parts/inc/partition_trigg1.inc b/mysql-test/suite/parts/inc/partition_trigg1.inc index 7bb5aa162a9..c0d6ba4e867 100644 --- a/mysql-test/suite/parts/inc/partition_trigg1.inc +++ b/mysql-test/suite/parts/inc/partition_trigg1.inc @@ -24,7 +24,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol eval SELECT INSTR('$statement','DELETE') = 0 INTO @aux; +--enable_cursor_protocol let $run1= `SELECT @aux`; --enable_query_log if ($run1) @@ -72,7 +74,9 @@ if ($no_debug) { --disable_query_log } +--disable_cursor_protocol eval SELECT INSTR('$statement','INSERT') = 0 INTO @aux; +--enable_cursor_protocol let $run1= `SELECT @aux`; --enable_query_log if ($run1) diff --git a/mysql-test/suite/parts/inc/partition_trigg3.inc b/mysql-test/suite/parts/inc/partition_trigg3.inc index 34dbf4e2cd1..4d461a8a755 100644 --- a/mysql-test/suite/parts/inc/partition_trigg3.inc +++ b/mysql-test/suite/parts/inc/partition_trigg3.inc @@ -46,7 +46,9 @@ delimiter ;| # Additional statements because of Bug(limitation)#17704 SET @counter = 1; # Bug#18730 Partitions: crash on SELECT MIN() +--disable_cursor_protocol SELECT MAX(f_int1), MIN(f_int2) INTO @my_max1,@my_min2 FROM t1; +--enable_cursor_protocol # Additional statements end eval $statement; DROP TRIGGER trg_3; diff --git a/mysql-test/suite/parts/r/partition_debug.result b/mysql-test/suite/parts/r/partition_debug.result index 5aae648dd1c..449e7b44f07 100644 --- a/mysql-test/suite/parts/r/partition_debug.result +++ b/mysql-test/suite/parts/r/partition_debug.result @@ -3280,7 +3280,7 @@ x 42 52 alter table t1 convert partition p2 to table tp2; -ERROR HY000: Error on rename of './test/t1#P#p2' to './test/tp2' (errno: 137 "No more records (read after end of file)") +ERROR HY000: Error on rename of './test/t1#P#p2' to './test/tp2' (errno: 0 "Internal error/check (Not system error)") # d,error_convert_partition_00: AFTER failure db.opt t1#P#p1.MYD @@ -3367,7 +3367,7 @@ x 52 LOCK TABLE t1 WRITE; alter table t1 convert partition p2 to table tp2; -ERROR HY000: Error on rename of './test/t1#P#p2' to './test/tp2' (errno: 137 "No more records (read after end of file)") +ERROR HY000: Error on rename of './test/t1#P#p2' to './test/tp2' (errno: 0 "Internal error/check (Not system error)") # d,error_convert_partition_00: AFTER failure (under LOCK TABLE) db.opt t1#P#p1.MYD diff --git a/mysql-test/suite/perfschema/t/alter_table_progress.test b/mysql-test/suite/perfschema/t/alter_table_progress.test index d4933ac9006..7577672f12e 100644 --- a/mysql-test/suite/perfschema/t/alter_table_progress.test +++ b/mysql-test/suite/perfschema/t/alter_table_progress.test @@ -34,9 +34,11 @@ update performance_schema.threads truncate table performance_schema.events_statements_history_long; truncate table performance_schema.events_stages_history_long; +--disable_cursor_protocol --disable_query_log eval select $con1_THREAD_ID into @con1_thread_id; --enable_query_log +--enable_cursor_protocol --connection con1 @@ -52,10 +54,12 @@ SET DEBUG_SYNC='copy_data_between_tables_before SIGNAL found_row WAIT_FOR wait_r SET DEBUG_SYNC='now WAIT_FOR found_row'; # Find the statement id of the ALTER TABLE +--disable_cursor_protocol --enable_prepare_warnings select event_id from performance_schema.events_statements_current where thread_id = @con1_thread_id into @con1_stmt_id; --disable_prepare_warnings +--enable_cursor_protocol # completed 0 select EVENT_NAME, WORK_COMPLETED, WORK_ESTIMATED diff --git a/mysql-test/suite/perfschema/t/dml_handler.test b/mysql-test/suite/perfschema/t/dml_handler.test index d289d89ce50..a1d5bc01f3f 100644 --- a/mysql-test/suite/perfschema/t/dml_handler.test +++ b/mysql-test/suite/perfschema/t/dml_handler.test @@ -21,9 +21,11 @@ CREATE TEMPORARY TABLE table_list (id INT AUTO_INCREMENT, PRIMARY KEY (id)) AS WHERE TABLE_SCHEMA='performance_schema' ORDER BY TABLE_NAME; +--disable_cursor_protocol --enable_prepare_warnings SELECT COUNT(*) FROM table_list INTO @table_count; +--enable_cursor_protocol let $count=`SELECT @table_count`; @@ -34,7 +36,9 @@ let $count=`SELECT @table_count`; while ($count > 0) { + --disable_cursor_protocol eval SELECT TABLE_NAME INTO @table_name FROM table_list WHERE id=$count; + --enable_cursor_protocol let $table_name = `SELECT @table_name`; --error ER_ILLEGAL_HA eval HANDLER performance_schema.$table_name OPEN; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test index d304cc5a1b8..58077973248 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_blocked.test @@ -17,7 +17,9 @@ --source ../include/wait_for_pfs_thread_count.inc --source ../include/hostcache_set_state.inc +--disable_cursor_protocol select @@global.max_connect_errors into @saved_max_connect_errors; +--enable_cursor_protocol set global max_connect_errors = 3; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test index 6420b8b5300..ab3fd73ab45 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv4_max_con.test @@ -17,8 +17,10 @@ --source ../include/wait_for_pfs_thread_count.inc --source ../include/hostcache_set_state.inc +--disable_cursor_protocol select @@global.max_connections into @saved_max_connections; select @@global.max_user_connections into @saved_max_user_connections; +--enable_cursor_protocol create user 'quota'@'santa.claus.ipv4.example.com'; grant select on test.* to 'quota'@'santa.claus.ipv4.example.com'; diff --git a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test index 6da99e02444..9d845b5e296 100644 --- a/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test +++ b/mysql-test/suite/perfschema/t/hostcache_ipv6_blocked.test @@ -17,7 +17,9 @@ --source ../include/wait_for_pfs_thread_count.inc --source ../include/hostcache_set_state.inc +--disable_cursor_protocol select @@global.max_connect_errors into @saved_max_connect_errors; +--enable_cursor_protocol set global max_connect_errors = 3; diff --git a/mysql-test/suite/perfschema/t/query_cache.test b/mysql-test/suite/perfschema/t/query_cache.test index 045c4628e9e..43c408a075f 100644 --- a/mysql-test/suite/perfschema/t/query_cache.test +++ b/mysql-test/suite/perfschema/t/query_cache.test @@ -23,13 +23,17 @@ reset query cache; flush status; --disable_ps2_protocol +--disable_cursor_protocol select * from t1; +--enable_cursor_protocol show global status like "Qcache_queries_in_cache"; show global status like "Qcache_inserts"; show global status like "Qcache_hits"; +--disable_cursor_protocol select * from t1; +--enable_cursor_protocol show global status like "Qcache_queries_in_cache"; show global status like "Qcache_inserts"; diff --git a/mysql-test/suite/perfschema/t/rpl_threads.test b/mysql-test/suite/perfschema/t/rpl_threads.test index fcecf775722..a7aa1fcff3b 100644 --- a/mysql-test/suite/perfschema/t/rpl_threads.test +++ b/mysql-test/suite/perfschema/t/rpl_threads.test @@ -29,11 +29,13 @@ connection master; # Read the ID of the binlog dump connection, # as exposed in PROCESSLIST. +--disable_cursor_protocol --enable_prepare_warnings select ID from INFORMATION_SCHEMA.PROCESSLIST where COMMAND = "Binlog Dump" into @master_dump_pid; --disable_prepare_warnings +--enable_cursor_protocol select COMMAND, STATE from INFORMATION_SCHEMA.PROCESSLIST @@ -49,11 +51,13 @@ sync_slave_with_master; # Read the ID of the SLAVE IO thread, # as exposed in PROCESSLIST. +--disable_cursor_protocol --enable_prepare_warnings select ID from INFORMATION_SCHEMA.PROCESSLIST where STATE like "Waiting for master to send event%" into @slave_io_pid; --disable_prepare_warnings +--enable_cursor_protocol select COMMAND, STATE from INFORMATION_SCHEMA.PROCESSLIST @@ -66,11 +70,13 @@ select NAME, TYPE, PROCESSLIST_COMMAND, PROCESSLIST_STATE # Read the ID of the SLAVE SQL thread, # as exposed in PROCESSLIST. +--disable_cursor_protocol --enable_prepare_warnings select ID from INFORMATION_SCHEMA.PROCESSLIST where STATE like "Slave has read all relay log%" into @slave_sql_pid; --disable_prepare_warnings +--enable_cursor_protocol select COMMAND, STATE from INFORMATION_SCHEMA.PROCESSLIST diff --git a/mysql-test/suite/perfschema/t/socket_connect.test b/mysql-test/suite/perfschema/t/socket_connect.test index 8290e289df1..3eae8fe2680 100644 --- a/mysql-test/suite/perfschema/t/socket_connect.test +++ b/mysql-test/suite/perfschema/t/socket_connect.test @@ -16,6 +16,7 @@ let $my_socket_debug_dbug=0; --echo #============================================================================== --source ../include/socket_ipv6.inc +--disable_cursor_protocol --echo #============================================================================== --echo # Get hostname, port number --echo #============================================================================== @@ -291,3 +292,4 @@ WHERE EVENT_NAME LIKE '%client_connection%' AND OBJECT_INSTANCE_BEGIN <> @default_object_instance_begin; --source include/wait_condition.inc exit; +--enable_cursor_protocol diff --git a/mysql-test/suite/perfschema/t/socket_instances_func.test b/mysql-test/suite/perfschema/t/socket_instances_func.test index 7e8dfe51d2f..266080fc696 100644 --- a/mysql-test/suite/perfschema/t/socket_instances_func.test +++ b/mysql-test/suite/perfschema/t/socket_instances_func.test @@ -51,9 +51,11 @@ CREATE TEMPORARY TABLE my_socket_instances AS SELECT * FROM performance_schema.socket_instances; --echo # Get thread id of the default connection +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol let $con0_thread_id= `SELECT @thread_id`; @@ -71,14 +73,18 @@ if($my_socket_debug) } --echo # Store the thread id of connection 1 (tcp/ip) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 1 (tcp/ip) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con1_thread_id= `SELECT @thread_id`; let $con1_port= `SELECT @port`; @@ -99,14 +105,18 @@ if($my_socket_debug) } --echo # Store the thread_id of connection 2 (tcp/ip) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 2 (tcp/ip) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con2_thread_id= `SELECT @thread_id`; let $con2_port= `SELECT @port`; @@ -127,14 +137,18 @@ if($my_socket_debug) } --echo # Store the thread id of connection 3 (unix domain) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 3 (unix domain) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con3_port= `SELECT @port`; let $con3_thread_id= `SELECT @thread_id`; @@ -237,9 +251,11 @@ WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket'; # Store the thread id of server_tcpip_socket --echo # Get the 'server_tcpip_socket' thread id +--disable_cursor_protocol SELECT DISTINCT THREAD_ID INTO @thread_id FROM performance_schema.socket_instances WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket'; +--enable_cursor_protocol let $server_tcpip_thread_id= `SELECT @thread_id`; @@ -270,9 +286,11 @@ WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket'; # Store the thread id of 'server_unix_socket' --echo # Get the 'server_unix_socket' thread id +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.socket_instances WHERE EVENT_NAME = 'wait/io/socket/sql/server_unix_socket'; +--enable_cursor_protocol let $server_unix_thread_id= `SELECT @thread_id`; @@ -306,7 +324,9 @@ WHERE THREAD_ID = @thread_id; --echo #Compare server listener socket thread ids --disable_query_log ONCE +--disable_cursor_protocol eval SELECT ($server_tcpip_thread_id = $server_unix_thread_id) into @match_thread_id; +--disable_cursor_protocol select @match_thread_id; diff --git a/mysql-test/suite/perfschema/t/socket_instances_func_win.test b/mysql-test/suite/perfschema/t/socket_instances_func_win.test index 5faf0d24ec4..24774a51fa2 100644 --- a/mysql-test/suite/perfschema/t/socket_instances_func_win.test +++ b/mysql-test/suite/perfschema/t/socket_instances_func_win.test @@ -47,9 +47,11 @@ CREATE TEMPORARY TABLE my_socket_instances AS SELECT * FROM performance_schema.socket_instances; --echo # Get thread id of the default connection +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol let $con0_thread_id= `SELECT @thread_id`; @@ -70,14 +72,18 @@ if($my_socket_debug) } --echo # Store the thread id of connection 1 (tcp/ip) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 1 (tcp/ip) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con1_thread_id= `SELECT @thread_id`; let $con1_port= `SELECT @port`; @@ -102,14 +108,18 @@ if($my_socket_debug) } --echo # Store the thread_id of connection 2 (tcp/ip) +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.threads WHERE PROCESSLIST_ID = CONNECTION_ID(); +--enable_cursor_protocol --echo # Store the port of connection 2 (tcp/ip) +--disable_cursor_protocol eval SELECT PORT INTO @port FROM performance_schema.socket_instances WHERE THREAD_ID = @thread_id; +--enable_cursor_protocol let $con2_thread_id= `SELECT @thread_id`; let $con2_port = `SELECT @port`; @@ -216,9 +226,11 @@ WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket'; # Store the thread id of server_tcpip_socket --echo # Get the 'server_tcpip_socket' thread id +--disable_cursor_protocol SELECT THREAD_ID INTO @thread_id FROM performance_schema.socket_instances WHERE EVENT_NAME = 'wait/io/socket/sql/server_tcpip_socket'; +--enable_cursor_protocol let $server_tcpip_thread_id= `SELECT @thread_id`; diff --git a/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test b/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test index 4a6ee2b6277..aebe64e3f59 100644 --- a/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test +++ b/mysql-test/suite/perfschema/t/socket_summary_by_event_name_func.test @@ -41,8 +41,10 @@ let $my_socket_debug_dbug= 0; --echo #============================================================================== --echo # Get hostname, port number --echo #============================================================================== +--disable_cursor_protocol SELECT @@hostname INTO @MY_HOSTNAME; SELECT @@port INTO @MY_MASTER_PORT; +--enable_cursor_protocol if ($my_socket_debug) { @@ -145,7 +147,7 @@ WHERE t_inst.event_name LIKE '%client%' --connection default UPDATE performance_schema.threads SET INSTRUMENTED='NO' WHERE PROCESSLIST_ID = CONNECTION_ID(); - +--disable_cursor_protocol --echo # --echo # 1.2 Get the default THREAD_ID; --echo # @@ -161,6 +163,7 @@ let $default_object_instance_begin= `SELECT @my_object_instance_begin`; --disable_query_log SELECT @my_object_instance_begin INTO @default_object_instance_begin; --enable_query_log +--enable_cursor_protocol if ($my_socket_debug) { diff --git a/mysql-test/suite/perfschema/t/table_schema.test b/mysql-test/suite/perfschema/t/table_schema.test index 935bd667f2d..6abbd403837 100644 --- a/mysql-test/suite/perfschema/t/table_schema.test +++ b/mysql-test/suite/perfschema/t/table_schema.test @@ -16,9 +16,11 @@ select * from information_schema.columns where table_schema="performance_schema" # Count the number of NUMBER_OF_BYTES columns. +--disable_cursor_protocol select count(*) into @count_byte_columns from information_schema.columns where table_schema="performance_schema" and data_type = "bigint" and column_name like "%number_of_bytes"; +--enable_cursor_protocol # Confirm that at least one column was found. @@ -26,10 +28,12 @@ select @count_byte_columns > 0; # Confirm that all NUMBER_OF_BYTES columns are BIGINT signed. +--disable_cursor_protocol select count(*) into @count_byte_signed from information_schema.columns where table_schema="performance_schema" and data_type="bigint" and column_name like "%number_of_bytes" and column_type not like "%unsigned"; +--enable_cursor_protocol select (@count_byte_columns - @count_byte_signed) = 0; @@ -38,9 +42,11 @@ select (@count_byte_columns - @count_byte_signed) = 0; # # Count the number of OBJECT_INSTANCE_BEGIN columns. +--disable_cursor_protocol select count(*) into @count_object_columns from information_schema.columns where table_schema="performance_schema" and data_type = "bigint" and column_name like "%object_instance_begin"; +--enable_cursor_protocol # Confirm that at least one column was found. @@ -48,10 +54,12 @@ select @count_object_columns > 0; # Confirm that all OBJECT_INSTANCE_BEGIN columns are BIGINT unsigned. +--disable_cursor_protocol select count(*) into @count_object_unsigned from information_schema.columns where table_schema="performance_schema" and data_type="bigint" and column_name like "%object_instance_begin" and column_type like "%unsigned"; +--enable_cursor_protocol select (@count_object_columns - @count_object_unsigned) = 0; diff --git a/mysql-test/suite/perfschema/t/thread_cache.test b/mysql-test/suite/perfschema/t/thread_cache.test index 92309bb9ca1..1bd52afbd01 100644 --- a/mysql-test/suite/perfschema/t/thread_cache.test +++ b/mysql-test/suite/perfschema/t/thread_cache.test @@ -36,8 +36,10 @@ let $con2_THREAD_ID=`select thread_id from performance_schema.threads --connection default --disable_query_log +--disable_cursor_protocol eval select ($con2_ID - $con1_ID) into @id_increment; eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment; +--enable_cursor_protocol --enable_query_log # Expect 1, connection_id() is incremented for each new connection @@ -82,8 +84,10 @@ let $wait_condition= --source include/wait_condition.inc --disable_query_log +--disable_cursor_protocol eval select ($con3_ID - $con2_ID) into @id_increment; eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment; +--enable_cursor_protocol --enable_query_log select @id_increment; @@ -110,8 +114,10 @@ let $con2_THREAD_ID=`select thread_id from performance_schema.threads --connection default --disable_query_log +--disable_cursor_protocol eval select ($con2_ID - $con1_ID) into @id_increment; eval select ($con2_THREAD_ID - $con1_THREAD_ID) into @thread_id_increment; +--enable_cursor_protocol --enable_query_log select @id_increment; @@ -154,8 +160,10 @@ let $wait_condition= --source include/wait_condition.inc --disable_query_log +--disable_cursor_protocol eval select ($con3_ID - $con2_ID) into @id_increment; eval select ($con3_THREAD_ID - $con2_THREAD_ID) into @thread_id_increment; +--enable_cursor_protocol --enable_query_log # When caching threads, the pthread that executed con2 was parked in the diff --git a/mysql-test/suite/perfschema/t/threads_mysql.test b/mysql-test/suite/perfschema/t/threads_mysql.test index e19b3664f21..cf0a1386b5f 100644 --- a/mysql-test/suite/perfschema/t/threads_mysql.test +++ b/mysql-test/suite/perfschema/t/threads_mysql.test @@ -64,7 +64,9 @@ TRUNCATE t1; INSERT INTO t1 SELECT thread_id FROM performance_schema.threads WHERE name LIKE 'thread/sql%'; +--disable_cursor_protocol SELECT COUNT(*) INTO @aux FROM t1; +--enable_cursor_protocol # Attention: # Just waiting for some new thread showing up is not sufficient because diff --git a/mysql-test/suite/period/t/overlaps.test b/mysql-test/suite/period/t/overlaps.test index b762743be24..aca1a9150de 100644 --- a/mysql-test/suite/period/t/overlaps.test +++ b/mysql-test/suite/period/t/overlaps.test @@ -253,18 +253,22 @@ insert into t values (1, '2020-03-03', '2020-03-10') on duplicate key update x = 2; select * from t; +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'tmp_t.txt' from t; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'tmp_t.txt' into table t; --error ER_NOT_SUPPORTED_YET load data infile 'tmp_t.txt' replace into table t; remove_file $MYSQLD_DATADIR/test/tmp_t.txt; insert into t values (1, '2020-03-01', '2020-03-05'); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'tmp_t.txt' from t; --enable_ps2_protocol +--enable_cursor_protocol --error ER_DUP_ENTRY load data infile 'tmp_t.txt' into table t; diff --git a/mysql-test/suite/period/t/versioning.test b/mysql-test/suite/period/t/versioning.test index 5d38d81349e..45ca12469df 100644 --- a/mysql-test/suite/period/t/versioning.test +++ b/mysql-test/suite/period/t/versioning.test @@ -12,7 +12,9 @@ eval create table t ( insert into t values('1999-01-01', '2018-12-12'), ('1999-01-01', '1999-12-12'); +--disable_cursor_protocol select row_start into @ins_time from t limit 1; +--enable_cursor_protocol select * from t order by s, e; delete from t for portion of apptime from '2000-01-01' to '2018-01-01'; @@ -28,7 +30,9 @@ insert into t values('1999-01-01', '2018-12-12'), --let $trig_table=t --source suite/period/create_triggers.inc +--disable_cursor_protocol select row_start into @ins_time from t limit 1; +--enable_cursor_protocol select * from t order by s, e; delete from t for portion of apptime from '2000-01-01' to '2018-01-01'; @@ -47,7 +51,9 @@ eval create or replace table t (x int, s date, e date, insert into t values(1, '1999-01-01', '2018-12-12'), (2, '1999-01-01', '1999-12-12'); +--disable_cursor_protocol select row_start into @ins_time from t limit 1; +--enable_cursor_protocol --sorted_result select * from t; diff --git a/mysql-test/suite/plugins/r/fulltext_plugin.result b/mysql-test/suite/plugins/r/fulltext_plugin.result index 2c104c98676..6fcba7735c9 100644 --- a/mysql-test/suite/plugins/r/fulltext_plugin.result +++ b/mysql-test/suite/plugins/r/fulltext_plugin.result @@ -1,3 +1,6 @@ +# +# BUG#39746 - Debug flag breaks struct definition (server crash) +# INSTALL PLUGIN simple_parser SONAME 'mypluglib.so'; CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser); ALTER TABLE t1 ADD FULLTEXT(b) WITH PARSER simple_parser; @@ -5,3 +8,11 @@ DROP TABLE t1; UNINSTALL PLUGIN simple_parser; show status like 'a%status'; Variable_name Value +# +# MDEV-35050 Found wrong usage of mutex upon setting plugin session variables +# +install soname 'mypluglib'; +set session_track_system_variables="*"; +set session simple_parser_simple_thdvar_one = 10; +uninstall soname 'mypluglib'; +# End of 10.5 tests diff --git a/mysql-test/suite/plugins/t/feedback_plugin_load.test b/mysql-test/suite/plugins/t/feedback_plugin_load.test index f67397afdfe..cb154cae7ad 100644 --- a/mysql-test/suite/plugins/t/feedback_plugin_load.test +++ b/mysql-test/suite/plugins/t/feedback_plugin_load.test @@ -18,7 +18,9 @@ select plugin_status from information_schema.plugins where plugin_name='feedback # so lets get back to it if it ever happens. # Lets say the plugin was used X times before this SELECT +--disable_cursor_protocol SELECT variable_value INTO @feedback_used FROM information_schema.feedback where variable_name = 'FEEDBACK used'; +--enable_cursor_protocol # Now $feedback_used == X+1, and 'FEEDBACK used' is also X+1. And variable_value is increased again when we run the next SELECT SELECT variable_value = @feedback_used + 1 as 'MUST BE 1' FROM information_schema.feedback where variable_name = 'FEEDBACK used'; diff --git a/mysql-test/suite/plugins/t/fulltext_plugin.test b/mysql-test/suite/plugins/t/fulltext_plugin.test index e9b4343e0dc..f6f6e169945 100644 --- a/mysql-test/suite/plugins/t/fulltext_plugin.test +++ b/mysql-test/suite/plugins/t/fulltext_plugin.test @@ -1,8 +1,9 @@ +--source include/not_embedded.inc --source include/have_simple_parser.inc -# -# BUG#39746 - Debug flag breaks struct definition (server crash) -# +--echo # +--echo # BUG#39746 - Debug flag breaks struct definition (server crash) +--echo # --replace_result .dll .so eval INSTALL PLUGIN simple_parser SONAME '$MYPLUGLIB_SO'; CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser); @@ -15,3 +16,12 @@ UNINSTALL PLUGIN simple_parser; # show status like 'a%status'; +--echo # +--echo # MDEV-35050 Found wrong usage of mutex upon setting plugin session variables +--echo # +install soname 'mypluglib'; +set session_track_system_variables="*"; +set session simple_parser_simple_thdvar_one = 10; +uninstall soname 'mypluglib'; + +--echo # End of 10.5 tests diff --git a/mysql-test/suite/plugins/t/qc_info.test b/mysql-test/suite/plugins/t/qc_info.test index de3e9d59b01..5345bac12ff 100644 --- a/mysql-test/suite/plugins/t/qc_info.test +++ b/mysql-test/suite/plugins/t/qc_info.test @@ -4,10 +4,12 @@ set @save_query_cache_size=@@global.query_cache_size; # test that hits are correctly incremented reset query cache; +--disable_cursor_protocol --disable_ps2_protocol select * from t1; select * from t1; --enable_ps2_protocol +--enable_cursor_protocol select hits, statement_text from information_schema.query_cache_info; drop table t1; diff --git a/mysql-test/suite/plugins/t/qc_info_init.inc b/mysql-test/suite/plugins/t/qc_info_init.inc index c69ffa07ca8..8c2d4b6e227 100644 --- a/mysql-test/suite/plugins/t/qc_info_init.inc +++ b/mysql-test/suite/plugins/t/qc_info_init.inc @@ -9,11 +9,14 @@ set global query_cache_size=1355776; create table t1 (a int not null); insert into t1 values (1),(2),(3); +--disable_cursor_protocol --disable_ps2_protocol select * from t1; --enable_ps2_protocol +--enable_cursor_protocol select statement_schema, statement_text, result_blocks_count, result_blocks_size from information_schema.query_cache_info; +--disable_cursor_protocol select @@time_zone into @time_zone; select @@default_week_format into @default_week_format; select @@character_set_client into @character_set_client; @@ -32,6 +35,7 @@ select * from t1; --enable_ps2_protocol --enable_result_log set time_zone= @time_zone, default_week_format= @default_week_format, character_set_client= @character_set_client,character_set_results= @character_set_results, sql_mode= @sql_mode, div_precision_increment= @div_precision_increment, lc_time_names= @lc_time_names, autocommit= @autocommit, group_concat_max_len= @group_concat_max_len, max_sort_length= @max_sort_length; +--enable_cursor_protocol --sorted_result --replace_column 5 # 20 # 24 # diff --git a/mysql-test/suite/roles/grant_revoke_current.test b/mysql-test/suite/roles/grant_revoke_current.test index fda55358b20..1c7bb0402df 100644 --- a/mysql-test/suite/roles/grant_revoke_current.test +++ b/mysql-test/suite/roles/grant_revoke_current.test @@ -1,5 +1,8 @@ --source include/not_embedded.inc + +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol --error ER_MALFORMED_DEFINER grant select on *.* to current_role; diff --git a/mysql-test/suite/roles/set_default_role_ps-6960.test b/mysql-test/suite/roles/set_default_role_ps-6960.test index fd965c2aa75..ce7bb96b5bb 100644 --- a/mysql-test/suite/roles/set_default_role_ps-6960.test +++ b/mysql-test/suite/roles/set_default_role_ps-6960.test @@ -4,7 +4,9 @@ --source include/not_embedded.inc +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; +--enable_cursor_protocol create role r1; prepare stmt from "set password = '11111111111111111111111111111111111111111'"; diff --git a/mysql-test/suite/rpl/include/check_type.inc b/mysql-test/suite/rpl/include/check_type.inc index c72754cad4f..26276391a63 100644 --- a/mysql-test/suite/rpl/include/check_type.inc +++ b/mysql-test/suite/rpl/include/check_type.inc @@ -43,7 +43,9 @@ connection master; eval INSERT INTO t1 VALUES(1, $source_value); if ($can_convert) { sync_slave_with_master; + --disable_cursor_protocol eval SELECT a = $target_value into @compare FROM t1; + --enable_cursor_protocol eval INSERT INTO type_conversions SET Source = "$source_type", Target = "$target_type", diff --git a/mysql-test/suite/rpl/include/rpl_stop_middle_group.test b/mysql-test/suite/rpl/include/rpl_stop_middle_group.test index 6bc872cabe5..0a436b28b20 100644 --- a/mysql-test/suite/rpl/include/rpl_stop_middle_group.test +++ b/mysql-test/suite/rpl/include/rpl_stop_middle_group.test @@ -37,9 +37,11 @@ source include/wait_for_slave_sql_to_stop.inc; let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1); let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1); +--disable_cursor_protocol --disable_query_log eval SELECT $read = $exec into @check; --enable_query_log +--enable_cursor_protocol eval SELECT "NO$error" AS Last_SQL_Error, @check as `true`; select count(*) as one from tm; select count(*) as one from ti; @@ -91,9 +93,11 @@ source include/wait_for_slave_sql_error.inc; let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1); let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1); +--disable_cursor_protocol --disable_query_log eval SELECT $read - $exec > 0 into @check; --enable_query_log +--enable_cursor_protocol eval SELECT "$error" AS Last_SQL_Error, @check as `true`; select count(*) as one from tm; select count(*) as zero from ti; @@ -130,9 +134,11 @@ source include/wait_for_slave_sql_error.inc; let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); let $read = query_get_value("SHOW SLAVE STATUS", Read_Master_Log_Pos, 1); let $exec = query_get_value("SHOW SLAVE STATUS", Exec_Master_Log_Pos, 1); +--disable_cursor_protocol --disable_query_log eval SELECT $read - $exec > 0 into @check; --enable_query_log +--enable_cursor_protocol eval SELECT "$error" AS Last_SQL_Error, @check as `true`; select max(a) as two from tm; select max(a) as one from ti; diff --git a/mysql-test/suite/rpl/include/sync_with_master_sql_delay_debug_sync.inc b/mysql-test/suite/rpl/include/sync_with_master_sql_delay_debug_sync.inc new file mode 100644 index 00000000000..7f3602d6979 --- /dev/null +++ b/mysql-test/suite/rpl/include/sync_with_master_sql_delay_debug_sync.inc @@ -0,0 +1,82 @@ +# ==== Purpose ==== +# +# If using DEBUG_SYNC to coordinate a slave's SQL DELAY via the DEBUG_DBUG +# identifier "sql_delay_by_debug_sync", this helper file will help synchronize +# a slave with the master for statements which don't need to be delayed. This +# can be helpful, for example, for setup/cleanup statements, if they must be +# run in the same lifetime as the statements used for the test. +# +# The actual synchronization will take place based on the input parameter +# slave_sync_method, which can be "gtid", "file_coord", or "none"; and will use +# the helper files sync_with_master_gtid.inc or sync_with_master.inc (or none +# at all), respectively. +# +# +# ==== Requirements ==== +# +# --source include/have_debug.inc +# --source include/have_debug_sync.inc +# set @@GLOBAL.debug_dbug= "+d,sql_delay_by_debug_sync"; +# +# +# ==== Usage ==== +# +# --let $slave_sync_method= gtid|file_coord|none +# [--let $num_event_groups= NUMBER] +# --source include/sync_with_master_sql_delay_debug_sync.inc +# +# +# Parameters: +# $slave_sync_method +# Value can be gtid, file_coord, or none; and will synchronize the slave +# with the master via this method (i.e. using sync_with_master_gtid.inc +# or sync_with_master.inc, respectively), after synchronizing the SQL +# delay +# +# $num_event_groups +# Number of event groups to synchronize the SQL delay for. If unset, will +# be default to 1. +# + +--let $include_filename= sync_with_master_sql_delay_debug_sync.inc +--source include/begin_include_file.inc + +if (!$slave_sync_method) +{ + --die Parameter slave_sync_method must be set +} + +if (`select "$slave_sync_method" not like "gtid" and "$slave_sync_method" not like "file_coord" and "$slave_sync_method" not like "none"`) +{ + --die Parameter slave_sync_method must have value "gtid", "file_coord" or "none" +} + +if (`select "$slave_sync_method" not like "none" and strcmp("$master_pos", "") = 0`) +{ + --die sync_with_master.inc or sync_with_master_gtid.inc was not called to populate variable master_pos +} + +if (!$num_event_groups) +{ + --let $num_event_groups= 1 +} + +while ($num_event_groups) +{ + set debug_sync= "now WAIT_FOR at_sql_delay"; + set debug_sync= "now SIGNAL continue_sql_thread"; + --dec $num_event_groups +} + +if (`select "$slave_sync_method" LIKE "gtid"`) +{ + --source include/sync_with_master_gtid.inc +} + +if (`select "$slave_sync_method" LIKE "file_coord"`) +{ + --source include/sync_with_master.inc +} + +--let $include_filename= sync_with_master_sql_delay_debug_sync.inc +--source include/end_include_file.inc diff --git a/mysql-test/suite/rpl/r/rpl_parallel_sbm.result b/mysql-test/suite/rpl/r/rpl_parallel_sbm.result index 75012c93f3b..59a6955aa1b 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel_sbm.result +++ b/mysql-test/suite/rpl/r/rpl_parallel_sbm.result @@ -5,14 +5,20 @@ include/master-slave.inc # connection slave; include/stop_slave.inc -set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master"; set @@GLOBAL.slave_parallel_mode= CONSERVATIVE; -change master to master_delay=3, master_use_gtid=Slave_Pos; +set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master,sql_delay_by_debug_sync"; +change master to master_delay=1, master_use_gtid=Slave_Pos; include/start_slave.inc connection master; create table t1 (a int); create table t2 (a int); -include/sync_slave_sql_with_master.inc +include/save_master_gtid.inc +connection slave; +include/sync_with_master_sql_delay_debug_sync.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; # # Pt 1) Ensure SBM is updated immediately upon arrival of the next event connection master; @@ -21,12 +27,23 @@ insert into t1 values (0); include/save_master_gtid.inc connection slave; # Waiting for transaction to arrive on slave and begin SQL Delay.. +set debug_sync= "now WAIT_FOR at_sql_delay"; # Validating SBM is updated on event arrival.. # ..done # MDEV-32265. At time of STOP SLAVE, if the SQL Thread is currently # delaying a transaction; then when the reciprocal START SLAVE occurs, # if the event is still to be delayed, SBM should resume accordingly -include/stop_slave.inc +connection server_2; +# Ensure the kill from STOP SLAVE will be received before continuing the +# SQL thread +set debug_sync="after_thd_awake_kill SIGNAL slave_notified_of_kill"; +STOP SLAVE; +connection slave; +set debug_sync= "now WAIT_FOR slave_notified_of_kill"; +set debug_sync= "now SIGNAL continue_sql_thread"; +connection server_2; +include/wait_for_slave_to_stop.inc +set debug_sync="RESET"; # Lock t1 on slave to ensure the event can't finish (and thereby update # Seconds_Behind_Master) so slow running servers don't accidentally # catch up to the master before checking SBM. @@ -34,6 +51,10 @@ connection server_2; LOCK TABLES t1 WRITE; include/start_slave.inc connection slave; +# SQL delay has no impact for the rest of the test case, so ignore it +include/sync_with_master_sql_delay_debug_sync.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; # Waiting for replica to get blocked by the table lock # Sleeping 1s to increment SBM # Ensuring Seconds_Behind_Master increases after sleeping.. @@ -54,6 +75,13 @@ insert into t1 values (2); include/save_master_pos.inc connection slave; # Wait for first transaction to complete SQL delay and begin execution.. +include/sync_with_master_sql_delay_debug_sync.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; +# Wait for second transaction to complete SQL delay.. +include/sync_with_master_sql_delay_debug_sync.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; +set debug_sync= "now SIGNAL continue_sql_thread"; # Validate SBM calculation doesn't use the second transaction because worker threads shouldn't have gone idle.. # ..and that SBM wasn't calculated using prior committed transactions # ..done @@ -63,6 +91,8 @@ include/wait_for_slave_param.inc [Relay_Master_Log_File] include/wait_for_slave_param.inc [Exec_Master_Log_Pos] # Cleanup include/stop_slave.inc +set debug_sync= "RESET"; +set @@GLOBAL.debug_dbug= "-d,sql_delay_by_debug_sync"; CHANGE MASTER TO master_delay=0; include/start_slave.inc # diff --git a/mysql-test/suite/rpl/t/rpl_binlog_errors.test b/mysql-test/suite/rpl/t/rpl_binlog_errors.test index 4dbd8eca558..25f426d4911 100644 --- a/mysql-test/suite/rpl/t/rpl_binlog_errors.test +++ b/mysql-test/suite/rpl/t/rpl_binlog_errors.test @@ -58,9 +58,11 @@ SET @old_debug= @@global.debug_dbug; -- let $load_file= $MYSQLTEST_VARDIR/tmp/bug_46166.data -- let $MYSQLD_DATADIR= `select @@datadir` -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol -- eval SELECT repeat('x',8192) INTO OUTFILE '$load_file' --enable_ps2_protocol +--enable_cursor_protocol ### ACTION: create a small file (< 4096 bytes) that will be later used ### in LOAD DATA INFILE to check for absence of binlog errors @@ -69,9 +71,11 @@ SET @old_debug= @@global.debug_dbug; -- let $load_file2= $MYSQLTEST_VARDIR/tmp/bug_46166-2.data -- let $MYSQLD_DATADIR= `select @@datadir` -- replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol -- eval SELECT repeat('x',10) INTO OUTFILE '$load_file2' --enable_ps2_protocol +--enable_cursor_protocol RESET MASTER; diff --git a/mysql-test/suite/rpl/t/rpl_bug31076.test b/mysql-test/suite/rpl/t/rpl_bug31076.test index 7e5232974f9..bdedcaa3308 100644 --- a/mysql-test/suite/rpl/t/rpl_bug31076.test +++ b/mysql-test/suite/rpl/t/rpl_bug31076.test @@ -1,6 +1,6 @@ -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Need regular protocol but ps-protocol was specified + --skip Need regular protocol but ps-protocol and cursor-protocol were specified } source include/have_binlog_format_mixed_or_row.inc; diff --git a/mysql-test/suite/rpl/t/rpl_checksum_cache.test b/mysql-test/suite/rpl/t/rpl_checksum_cache.test index e04f618b81e..63c40ac05da 100644 --- a/mysql-test/suite/rpl/t/rpl_checksum_cache.test +++ b/mysql-test/suite/rpl/t/rpl_checksum_cache.test @@ -119,7 +119,9 @@ let $1=100; begin; while ($1) { + --disable_cursor_protocol eval select round($t2_aver_size + RAND() * $t2_max_rand) into @act_size; + --enable_cursor_protocol set @data = repeat('a', @act_size); insert into t2 set data = @data; dec $1; @@ -162,7 +164,9 @@ let $1= 300; begin; while ($1) { + --disable_cursor_protocol eval select round($t3_aver_size + RAND() * $t3_max_rand) into @act_size; + --enable_cursor_protocol insert into t3 set data= repeat('a', @act_size); dec $1; } diff --git a/mysql-test/suite/rpl/t/rpl_do_grant.test b/mysql-test/suite/rpl/t/rpl_do_grant.test index 1350585ff93..2b757f57692 100644 --- a/mysql-test/suite/rpl/t/rpl_do_grant.test +++ b/mysql-test/suite/rpl/t/rpl_do_grant.test @@ -343,7 +343,9 @@ SELECT Grantor FROM mysql.tables_priv WHERE User='user_bug27606'; --connection master DROP USER user_bug27606@localhost; +--disable_cursor_protocol select priv into @root_priv from mysql.global_priv where user='root' and host='127.0.0.1'; +--enable_cursor_protocol update mysql.global_priv set priv=@root_priv where user='root' and host='localhost'; diff --git a/mysql-test/suite/rpl/t/rpl_drop_db.test b/mysql-test/suite/rpl/t/rpl_drop_db.test index 245ab8b609c..ef918842d4e 100644 --- a/mysql-test/suite/rpl/t/rpl_drop_db.test +++ b/mysql-test/suite/rpl/t/rpl_drop_db.test @@ -10,11 +10,13 @@ drop database if exists mysqltest1; create database mysqltest1; create table mysqltest1.t1 (n int); insert into mysqltest1.t1 values (1); +--disable_cursor_protocol --enable_prepare_warnings --disable_ps2_protocol select * from mysqltest1.t1 into outfile 'mysqltest1/f1.txt'; --disable_prepare_warnings --enable_ps2_protocol +--enable_cursor_protocol create table mysqltest1.t2 (n int); create table mysqltest1.t3 (n int); --replace_result \\ / 66 39 93 39 17 39 247 39 41 39 "File exists" "Directory not empty" diff --git a/mysql-test/suite/rpl/t/rpl_events.test b/mysql-test/suite/rpl/t/rpl_events.test index 1d66c327633..f33ecfd7088 100644 --- a/mysql-test/suite/rpl/t/rpl_events.test +++ b/mysql-test/suite/rpl/t/rpl_events.test @@ -4,9 +4,9 @@ # Purpose: To test that event effects are replicated. # ################################################################## -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Need regular protocol but ps-protocol was specified + --skip Need regular protocol but ps-protocol and cursor-protocol were specified } --source include/master-slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test index ee6daac71ea..1b93ddc3f0a 100644 --- a/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test +++ b/mysql-test/suite/rpl/t/rpl_filter_tables_not_exist.test @@ -229,15 +229,19 @@ SET INSERT_ID=2; SET @c=2; SET @@rand_seed1=10000000, @@rand_seed2=1000000; INSERT INTO t5 VALUES (NULL, RAND(), @c); # to be ignored +--disable_cursor_protocol SELECT b into @b FROM test.t5; +--enable_cursor_protocol --let $b_master=`select @b` UPDATE test.t1 SET a=2; # to run trigger on slave --sync_slave_with_master # The proof: +--disable_cursor_protocol SELECT a AS 'ONE' into @a FROM test.t_slave; SELECT c AS 'NULL' into @c FROM test.t_slave; +--enable_cursor_protocol let $count= 1; let $table= test.t_slave; @@ -249,7 +253,9 @@ if (`SELECT @a != 2 and @c != NULL`) --die Intvar or user var from replication events unexpetedly escaped out to screw a following query applying context. } +--disable_cursor_protocol SELECT b into @b FROM test.t_slave; +--enable_cursor_protocol --let $b_slave=`select @b` --let $assert_text= Random values from master and slave must be different diff --git a/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test b/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test index 5c17653da8a..cc32220f5d7 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_mdev4484.test @@ -67,8 +67,10 @@ EOF # Since we injected error in the cleanup code, the rows should remain in # mysql.gtid_slave_pos. Check that we have at least 20 (more robust against # non-deterministic cleanup and future changes than checking for exact number). +--disable_cursor_protocol SELECT COUNT(*), MAX(seq_no) INTO @pre_count, @pre_max_seq_no FROM mysql.gtid_slave_pos; +--disable_cursor_protocol SELECT IF(@pre_count >= 20, "OK", CONCAT("Error: too few rows seen while errors injected: ", @pre_count)); SET GLOBAL debug_dbug= @old_dbug; diff --git a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test index acce6651b8d..0612aa6a565 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_stop_start.test @@ -1,6 +1,6 @@ -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Test temporarily disabled for ps-protocol + --skip Test temporarily disabled for ps-protocol and cursor-protocol } --source include/no_valgrind_without_big.inc --let $rpl_topology=1->2 diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_local.test b/mysql-test/suite/rpl/t/rpl_loaddata_local.test index 01f5607ba0b..975bd110739 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_local.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_local.test @@ -27,9 +27,11 @@ set SQL_LOG_BIN=1; enable_query_log; let $MYSQLD_DATADIR= `select @@datadir`; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; --enable_ps2_protocol +--enable_cursor_protocol #This will generate a 20KB file, now test LOAD DATA LOCAL truncate table t1; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR @@ -52,9 +54,11 @@ connection master; create table t1(a int); insert into t1 values (1), (2), (2), (3); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; --enable_ps2_protocol +--enable_cursor_protocol drop table t1; create table t1(a int primary key); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR @@ -83,9 +87,11 @@ SET sql_mode='ignore_space'; CREATE TABLE t1(a int); insert into t1 values (1), (2), (3), (4); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' from t1; --enable_ps2_protocol +--enable_cursor_protocol truncate table t1; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR eval load data local infile '$MYSQLD_DATADIR/rpl_loaddatalocal.select_outfile' into table t1; @@ -109,7 +115,9 @@ sync_slave_with_master; connection master; let $MYSQLD_DATADIR= `select @@datadir`; +--disable_cursor_protocol SELECT @@SESSION.sql_mode INTO @old_mode; +--enable_cursor_protocol SET sql_mode='ignore_space'; @@ -117,9 +125,11 @@ CREATE TABLE t1(a int); INSERT INTO t1 VALUES (1), (2), (3), (4); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug43746.sql' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol TRUNCATE TABLE t1; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR @@ -167,9 +177,11 @@ sync_slave_with_master; connection master; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT * INTO OUTFILE '$MYSQLD_DATADIR/bug59267.sql' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol TRUNCATE TABLE t1; --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR @@ -214,9 +226,11 @@ CREATE VIEW v1 AS SELECT * FROM t2 WHERE f1 IN (SELECT f1 FROM t3 WHERE (t3.f2 IS NULL)); --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR +--disable_cursor_protocol --disable_ps2_protocol eval SELECT 1 INTO OUTFILE '$MYSQLD_DATADIR/bug60580.csv' FROM DUAL; --enable_ps2_protocol +--enable_cursor_protocol --replace_result $MYSQLD_DATADIR MYSQLD_DATADIR eval LOAD DATA LOCAL INFILE '$MYSQLD_DATADIR/bug60580.csv' INTO TABLE t1 (@f1) SET f2 = (SELECT f1 FROM v1 WHERE f1=@f1); diff --git a/mysql-test/suite/rpl/t/rpl_loaddata_map.test b/mysql-test/suite/rpl/t/rpl_loaddata_map.test index 0df424aa1ac..24477fa0230 100644 --- a/mysql-test/suite/rpl/t/rpl_loaddata_map.test +++ b/mysql-test/suite/rpl/t/rpl_loaddata_map.test @@ -37,9 +37,11 @@ while($rows) eval insert into t1 values (null); dec $rows; } +--disable_cursor_protocol --disable_ps2_protocol eval select * into outfile '$MYSQLTEST_VARDIR/tmp/bug30435_5k.txt' from t1; --enable_ps2_protocol +--enable_cursor_protocol DROP TABLE t1; SET @@sql_log_bin= 1; diff --git a/mysql-test/suite/rpl/t/rpl_loadfile.test b/mysql-test/suite/rpl/t/rpl_loadfile.test index a49b3c30b87..edb72dc9925 100644 --- a/mysql-test/suite/rpl/t/rpl_loadfile.test +++ b/mysql-test/suite/rpl/t/rpl_loadfile.test @@ -69,9 +69,11 @@ connection master; let $file= $MYSQLTEST_VARDIR/tmp/bug_39701.data; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR +--disable_cursor_protocol --disable_ps2_protocol --eval SELECT repeat('x',20) INTO OUTFILE '$file' --enable_ps2_protocol +--enable_cursor_protocol disable_warnings; DROP TABLE IF EXISTS t1; diff --git a/mysql-test/suite/rpl/t/rpl_mdev12179.test b/mysql-test/suite/rpl/t/rpl_mdev12179.test index 597295d1136..792696ec7c7 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev12179.test +++ b/mysql-test/suite/rpl/t/rpl_mdev12179.test @@ -278,8 +278,10 @@ EOF --enable_reconnect --enable_prepare_warnings --source include/wait_until_connected_again.inc +--disable_cursor_protocol SELECT max(seq_no) FROM mysql.gtid_slave_pos_InnoDB into @seq_no; --disable_prepare_warnings +--enable_cursor_protocol --connection server_1 INSERT INTO t2(a) SELECT 1+MAX(a) FROM t2; diff --git a/mysql-test/suite/rpl/t/rpl_misc_functions.test b/mysql-test/suite/rpl/t/rpl_misc_functions.test index b9d65844b12..be55a208c3e 100644 --- a/mysql-test/suite/rpl/t/rpl_misc_functions.test +++ b/mysql-test/suite/rpl/t/rpl_misc_functions.test @@ -26,9 +26,11 @@ insert into t1 values(3, 0, 0, 0, password('does_this_work?')); --disable_warnings insert into t1 values(4, connection_id(), rand()*1000, rand()*1000, password('does_this_still_work?')); --enable_warnings +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'rpl_misc_functions.outfile' from t1; --enable_ps2_protocol +--enable_cursor_protocol let $MYSQLD_DATADIR= `select @@datadir`; sync_slave_with_master; create temporary table t2 like t1; @@ -93,10 +95,12 @@ INSERT INTO t1 (col_a) VALUES (test_replication_sf()); --enable_prepare_warnings # Dump table on slave +--disable_cursor_protocol --disable_ps2_protocol select * from t1 into outfile "../../tmp/t1_slave.txt"; --disable_prepare_warnings --enable_ps2_protocol +--enable_cursor_protocol # Load data from slave into temp table on master connection master; @@ -108,8 +112,10 @@ load data infile '../../tmp/t1_slave.txt' into table t1_slave; # Compare master and slave temp table, use subtraction # for floating point comparison of "double" +--disable_cursor_protocol select count(*) into @aux from t1 join t1_slave using (id) where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ; +--enable_cursor_protocol SELECT @aux; if (`SELECT @aux <> 12 OR @aux IS NULL`) { diff --git a/mysql-test/suite/rpl/t/rpl_parallel_sbm.test b/mysql-test/suite/rpl/t/rpl_parallel_sbm.test index 90753caf143..6941a88f4d0 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_sbm.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_sbm.test @@ -3,6 +3,7 @@ # --source include/have_log_bin.inc --source include/have_debug.inc +--source include/have_debug_sync.inc --source include/master-slave.inc --echo # @@ -16,14 +17,23 @@ # Seconds_Behind_Master is based on the timestamp of the new transaction, # rather than the last committed transaction. # +# Note that the test doesn't actually use the value of MASTER_DELAY, but +# rather uses debug_sync to coordinate the end of the delay. This is to ensure +# that on slow machines, a delay doesn't pass before the test gets a chance to +# validate results. Additionally, it lets us continue testing after validation +# so we don't have to wait out a full delay unnecessarily. The debug_sync point +# is enabled via sql_delay_by_debug_sync, which will delay transactions based +# only on GTID events, so only one synchronization is needed per transaction. +# --connection slave --source include/stop_slave.inc --let $save_dbug= `SELECT @@GLOBAL.debug_dbug` --let $save_parallel_mode= `SELECT @@GLOBAL.slave_parallel_mode` -set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master"; set @@GLOBAL.slave_parallel_mode= CONSERVATIVE; ---let $master_delay= 3 +set @@GLOBAL.debug_dbug= "d,negate_clock_diff_with_master,sql_delay_by_debug_sync"; + +--let $master_delay= 1 --eval change master to master_delay=$master_delay, master_use_gtid=Slave_Pos --source include/start_slave.inc @@ -31,7 +41,11 @@ set @@GLOBAL.slave_parallel_mode= CONSERVATIVE; --let insert_ctr= 0 create table t1 (a int); create table t2 (a int); ---source include/sync_slave_sql_with_master.inc +--source include/save_master_gtid.inc +--connection slave +--let $slave_sync_method= gtid +--let $num_event_groups= 2 +--source include/sync_with_master_sql_delay_debug_sync.inc --echo # --echo # Pt 1) Ensure SBM is updated immediately upon arrival of the next event @@ -48,8 +62,7 @@ sleep 2; --connection slave --echo # Waiting for transaction to arrive on slave and begin SQL Delay.. ---let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting until MASTER_DELAY seconds after master executed event'; ---source include/wait_condition.inc +set debug_sync= "now WAIT_FOR at_sql_delay"; --echo # Validating SBM is updated on event arrival.. --let $sbm_trx1_arrive= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1) @@ -66,7 +79,20 @@ if (`SELECT $sbm_trx1_arrive > ($seconds_since_idling + 1)`) --echo # delaying a transaction; then when the reciprocal START SLAVE occurs, --echo # if the event is still to be delayed, SBM should resume accordingly ---source include/stop_slave.inc +--connection server_2 +--echo # Ensure the kill from STOP SLAVE will be received before continuing the +--echo # SQL thread +set debug_sync="after_thd_awake_kill SIGNAL slave_notified_of_kill"; +--send STOP SLAVE + +--connection slave +set debug_sync= "now WAIT_FOR slave_notified_of_kill"; +set debug_sync= "now SIGNAL continue_sql_thread"; + +--connection server_2 +--reap +--source include/wait_for_slave_to_stop.inc +set debug_sync="RESET"; --echo # Lock t1 on slave to ensure the event can't finish (and thereby update --echo # Seconds_Behind_Master) so slow running servers don't accidentally @@ -77,6 +103,11 @@ LOCK TABLES t1 WRITE; --source include/start_slave.inc --connection slave + +--echo # SQL delay has no impact for the rest of the test case, so ignore it +--let $slave_sync_method= none +--source include/sync_with_master_sql_delay_debug_sync.inc + --echo # Waiting for replica to get blocked by the table lock --let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting for table metadata lock'; --source include/wait_condition.inc @@ -120,9 +151,14 @@ sleep 3; --connection slave --echo # Wait for first transaction to complete SQL delay and begin execution.. +--let $slave_sync_method= none +--source include/sync_with_master_sql_delay_debug_sync.inc --let $wait_condition= SELECT count(*) FROM information_schema.processlist WHERE state LIKE 'Waiting for table metadata lock%' AND command LIKE 'Slave_Worker'; --source include/wait_condition.inc +--echo # Wait for second transaction to complete SQL delay.. +--source include/sync_with_master_sql_delay_debug_sync.inc + --echo # Validate SBM calculation doesn't use the second transaction because worker threads shouldn't have gone idle.. --let $sbm_after_trx_no_idle= query_get_value(SHOW SLAVE STATUS, Seconds_Behind_Master, 1) --let $timestamp_trxpt2_arrive= `SELECT UNIX_TIMESTAMP()` @@ -147,6 +183,8 @@ UNLOCK TABLES; --echo # Cleanup --source include/stop_slave.inc +set debug_sync= "RESET"; +set @@GLOBAL.debug_dbug= "-d,sql_delay_by_debug_sync"; --eval CHANGE MASTER TO master_delay=0 --source include/start_slave.inc diff --git a/mysql-test/suite/rpl/t/rpl_parallel_seq.test b/mysql-test/suite/rpl/t/rpl_parallel_seq.test index cc361a7b35b..9522a976b89 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_seq.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_seq.test @@ -147,7 +147,9 @@ if (`select $iter = 1`) --connection master CREATE OR REPLACE SEQUENCE s3 ENGINE=innodb; # select may return non-deterministically, don't print its result +--disable_cursor_protocol SELECT NEXT VALUE FOR s3 into @tmpvar; +--enable_cursor_protocol --source include/save_master_gtid.inc --connection slave 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 2d5d08a4600..e74c1368bad 100644 --- a/mysql-test/suite/rpl/t/rpl_slow_query_log.test +++ b/mysql-test/suite/rpl/t/rpl_slow_query_log.test @@ -25,6 +25,11 @@ # Note that due to the sleep() command the insert is written to the binary # log in row format. +if (`SELECT $CURSOR_PROTOCOL != 0`) +{ + --skip Test requires: cursor-protocol disabled +} + source include/have_binlog_format_statement.inc; source include/master-slave.inc; diff --git a/mysql-test/suite/rpl/t/rpl_stm_found_rows.test b/mysql-test/suite/rpl/t/rpl_stm_found_rows.test index c1b7e02319b..5ca2f4edb8f 100644 --- a/mysql-test/suite/rpl/t/rpl_stm_found_rows.test +++ b/mysql-test/suite/rpl/t/rpl_stm_found_rows.test @@ -35,18 +35,22 @@ SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1; # Instead of # INSERT INTO logtbl VALUES(1, 1, FOUND_ROWS()); # we write +--disable_cursor_protocol --disable_ps2_protocol SELECT FOUND_ROWS() INTO @a; --enable_ps2_protocol +--enable_cursor_protocol INSERT INTO logtbl VALUES(1,1,@a); SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a < 5 ORDER BY a LIMIT 1; # Instead of # INSERT INTO logtbl VALUES(1, 2, FOUND_ROWS()); # we write +--disable_cursor_protocol --disable_ps2_protocol SELECT FOUND_ROWS() INTO @a; --enable_ps2_protocol +--enable_cursor_protocol INSERT INTO logtbl VALUES(1,2,@a); SELECT * FROM logtbl WHERE sect = 1 ORDER BY sect,test; @@ -82,9 +86,11 @@ END $$ --delimiter ; SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1; +--disable_cursor_protocol --disable_ps2_protocol SELECT FOUND_ROWS() INTO @found_rows; --enable_ps2_protocol +--enable_cursor_protocol CALL just_log(2,3,@found_rows); SELECT * FROM logtbl WHERE sect = 2 ORDER BY sect,test; @@ -105,7 +111,9 @@ END $$ SELECT SQL_CALC_FOUND_ROWS * FROM t1 WHERE a > 5 ORDER BY a LIMIT 1; --disable_ps2_protocol +--disable_cursor_protocol SELECT FOUND_ROWS() INTO @found_rows; +--enable_cursor_protocol SELECT log_rows(3,1,@found_rows), log_rows(3,2,@found_rows); --enable_ps2_protocol diff --git a/mysql-test/suite/rpl/t/rpl_temporary.test b/mysql-test/suite/rpl/t/rpl_temporary.test index 0ec57715f79..90dec10e55a 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary.test +++ b/mysql-test/suite/rpl/t/rpl_temporary.test @@ -346,7 +346,9 @@ GRANT PROCESS ON *.* TO user43748@127.0.0.1; connect (cont43748,127.0.0.1,user43748,meow,"*NO-ONE*",$SLAVE_MYPORT,); connection cont43748; +--disable_cursor_protocol SELECT id INTO @id FROM information_schema.processlist WHERE user='system user' LIMIT 1; +--enable_cursor_protocol --error ER_KILL_DENIED_ERROR,ER_NO_SUCH_THREAD KILL @id; diff --git a/mysql-test/suite/rpl/t/rpl_xa.inc b/mysql-test/suite/rpl/t/rpl_xa.inc index d22d2d2ef3d..5925de24f44 100644 --- a/mysql-test/suite/rpl/t/rpl_xa.inc +++ b/mysql-test/suite/rpl/t/rpl_xa.inc @@ -94,7 +94,9 @@ while ($p_trx) --connection master --let $xid=ro_$p_trx --let $query=`SELECT @query$p_trx` + --disable_cursor_protocol --source rpl_create_xa_prepared.inc + --enable_cursor_protocol --let $complete=`select if(floor(rand()*10)%2,'COMMIT','ROLLBACK')` --error 0 --disable_query_log @@ -117,8 +119,9 @@ while ($p_trx) --connection master --let $xid=ro_$p_trx --let $query=`SELECT @query$p_trx` + --disable_cursor_protocol --source rpl_create_xa_prepared.inc - + --enable_cursor_protocol --disconnect master_$xid --source include/wait_until_disconnected.inc 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 4d665991085..5dce9e018b4 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -2325,11 +2325,11 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_ADJUST_SECONDARY_KEY_COSTS VARIABLE_SCOPE SESSION VARIABLE_TYPE SET -VARIABLE_COMMENT A bit field with the following values: adjust_secondary_key_cost = Update secondary key costs for ranges to be at least 5x of clustered primary key costs. disable_max_seek = Disable 'max_seek optimization' for secondary keys and slight adjustment of filter cost. disable_forced_index_in_group_by = Disable automatic forced index in GROUP BY. fix_innodb_cardinality = Disable doubling of the Cardinality for InnoDB secondary keys. fix_reuse_range_for_ref = Do a better job at reusing range access estimates when estimating ref access. This variable will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer. +VARIABLE_COMMENT A bit field with the following values: adjust_secondary_key_cost = Update secondary key costs for ranges to be at least 5x of clustered primary key costs. disable_max_seek = Disable 'max_seek optimization' for secondary keys and slight adjustment of filter cost. disable_forced_index_in_group_by = Disable automatic forced index in GROUP BY. fix_innodb_cardinality = Disable doubling of the Cardinality for InnoDB secondary keys. fix_reuse_range_for_ref = Do a better job at reusing range access estimates when estimating ref access. fix_card_multiplier = Fix the computation in selectivity_for_indexes. selectivity_multiplier. This variable will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST adjust_secondary_key_cost,disable_max_seek,disable_forced_index_in_group_by,fix_innodb_cardinality,fix_reuse_range_for_ref +ENUM_VALUE_LIST adjust_secondary_key_cost,disable_max_seek,disable_forced_index_in_group_by,fix_innodb_cardinality,fix_reuse_range_for_ref,fix_card_multiplier READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_EXTRA_PRUNING_DEPTH 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 ab89741b082..c5f8f11f87e 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -2495,11 +2495,11 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_ADJUST_SECONDARY_KEY_COSTS VARIABLE_SCOPE SESSION VARIABLE_TYPE SET -VARIABLE_COMMENT A bit field with the following values: adjust_secondary_key_cost = Update secondary key costs for ranges to be at least 5x of clustered primary key costs. disable_max_seek = Disable 'max_seek optimization' for secondary keys and slight adjustment of filter cost. disable_forced_index_in_group_by = Disable automatic forced index in GROUP BY. fix_innodb_cardinality = Disable doubling of the Cardinality for InnoDB secondary keys. fix_reuse_range_for_ref = Do a better job at reusing range access estimates when estimating ref access. This variable will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer. +VARIABLE_COMMENT A bit field with the following values: adjust_secondary_key_cost = Update secondary key costs for ranges to be at least 5x of clustered primary key costs. disable_max_seek = Disable 'max_seek optimization' for secondary keys and slight adjustment of filter cost. disable_forced_index_in_group_by = Disable automatic forced index in GROUP BY. fix_innodb_cardinality = Disable doubling of the Cardinality for InnoDB secondary keys. fix_reuse_range_for_ref = Do a better job at reusing range access estimates when estimating ref access. fix_card_multiplier = Fix the computation in selectivity_for_indexes. selectivity_multiplier. This variable will be deleted in MariaDB 11.0 as it is not needed with the new 11.0 optimizer. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST adjust_secondary_key_cost,disable_max_seek,disable_forced_index_in_group_by,fix_innodb_cardinality,fix_reuse_range_for_ref +ENUM_VALUE_LIST adjust_secondary_key_cost,disable_max_seek,disable_forced_index_in_group_by,fix_innodb_cardinality,fix_reuse_range_for_ref,fix_card_multiplier READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_EXTRA_PRUNING_DEPTH diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test index 8c5f8fa7bf0..c33eb057cc6 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test @@ -11,8 +11,10 @@ SELECT @@global.innodb_buffer_pool_dump_now; -- error 0,1 -- remove_file $file +--disable_cursor_protocol SELECT variable_value INTO @old_dump_status FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status'; +--enable_cursor_protocol # A previous test could have run buffer pool dump already; # in this case we want to make sure that the current time is different diff --git a/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test index 8bc7bd2dc4b..e29639a1779 100644 --- a/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_fil_make_page_dirty_debug_basic.test @@ -23,10 +23,12 @@ set innodb_fil_make_page_dirty_debug = ON; --echo # An example usage. create table t1 (f1 int primary key) engine = innodb; +--disable_cursor_protocol --enable_prepare_warnings select space from information_schema.innodb_sys_tables where name = 'test/t1' into @space_id; --disable_prepare_warnings +--enable_cursor_protocol set global innodb_saved_page_number_debug = 0; set global innodb_fil_make_page_dirty_debug = @space_id; drop table t1; diff --git a/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test index 148871478a7..0fd7a5eafcb 100644 --- a/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_read_io_threads_basic.test @@ -21,7 +21,9 @@ select * from information_schema.session_variables where variable_name='innodb_r # # show that it's not read-only # +--disable_cursor_protocol select @@innodb_read_io_threads into @n; +--enable_cursor_protocol --disable_warnings set global innodb_read_io_threads = 1; --enable_warnings diff --git a/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test b/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test index 29b8451867a..63bea91b879 100644 --- a/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_saved_page_number_debug_basic.test @@ -23,10 +23,12 @@ set innodb_saved_page_number_debug = ON; --echo # An example usage. create table t1 (f1 int primary key) engine = innodb; +--disable_cursor_protocol --enable_prepare_warnings select space from information_schema.innodb_sys_tables where name = 'test/t1' into @space_id; --disable_prepare_warnings +--enable_cursor_protocol set global innodb_saved_page_number_debug = 0; set global innodb_fil_make_page_dirty_debug = @space_id; drop table t1; diff --git a/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test b/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test index 9ee9f5ba619..b7123f74dcb 100644 --- a/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_write_io_threads_basic.test @@ -21,7 +21,9 @@ select * from information_schema.session_variables where variable_name='innodb_w # # show that it's not read-only # +--disable_cursor_protocol select @@innodb_write_io_threads into @n; +--enable_cursor_protocol --disable_warnings set global innodb_write_io_threads=1; --enable_warnings diff --git a/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test b/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test index db9bc8fb48f..1be82f5380e 100644 --- a/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test +++ b/mysql-test/suite/sys_vars/t/log_slow_disabled_statements_func.test @@ -43,7 +43,9 @@ SELECT @@log_slow_disabled_statements; TRUNCATE TABLE mysql.slow_log; ALTER TABLE t1 add column extra int; CALL slow2(); +--disable_cursor_protocol SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part2'; +--enable_cursor_protocol --echo --> SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare"; @@ -53,7 +55,9 @@ SET SESSION log_slow_disabled_statements="call,admin"; TRUNCATE TABLE mysql.slow_log; ALTER TABLE t1 add column extra2 int; CALL slow2(); +--disable_cursor_protocol SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part3'; +--enable_cursor_protocol --echo --> SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare"; @@ -63,7 +67,9 @@ SET SESSION log_slow_disabled_statements=""; TRUNCATE TABLE mysql.slow_log; ALTER TABLE t1 add column extra3 int; CALL slow2(); +--disable_cursor_protocol SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part4'; +--enable_cursor_protocol --echo --> SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare"; @@ -73,7 +79,9 @@ SET SESSION log_slow_disabled_statements="call,admin,slave,sp"; TRUNCATE TABLE mysql.slow_log; ALTER TABLE t1 add column extra4 int; CALL slow2(); +--disable_cursor_protocol SELECT count(if(sleep(1) >= 0,0,NULL)) from t1 where j>'b and part5'; +--enable_cursor_protocol --echo --> SELECT sql_text FROM mysql.slow_log where sql_text <> "Close stmt" and sql_text <> "Prepare"; diff --git a/mysql-test/suite/sys_vars/t/query_cache_limit_func.test b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test index e0105c89866..27b19934162 100644 --- a/mysql-test/suite/sys_vars/t/query_cache_limit_func.test +++ b/mysql-test/suite/sys_vars/t/query_cache_limit_func.test @@ -76,6 +76,8 @@ SET GLOBAL query_cache_size = 0; SET GLOBAL query_cache_size = 131072; SET GLOBAL query_cache_type = ON; +--disable_cursor_protocol + --echo '#---------------------FN_DYNVARS_132_01----------------------#' # #Check if results are cacheing on default value # @@ -168,6 +170,8 @@ SHOW STATUS LIKE 'Qcache_not_cached'; SHOW STATUS LIKE 'Qcache_queries_in_cache'; --echo 1 Expected +--enable_cursor_protocol + # # Cleanup # diff --git a/mysql-test/suite/sys_vars/t/query_cache_type_func.test b/mysql-test/suite/sys_vars/t/query_cache_type_func.test index e1b5f4d1a12..e31c949fef0 100644 --- a/mysql-test/suite/sys_vars/t/query_cache_type_func.test +++ b/mysql-test/suite/sys_vars/t/query_cache_type_func.test @@ -62,6 +62,8 @@ SET @@GLOBAL.query_cache_size = 65536; --echo ** TESTING SESSION SCOPE ** +--disable_cursor_protocol + --echo '#--------------------FN_DYNVARS_135_01-------------------------#' # # Testing default value it should be ON by default @@ -284,6 +286,8 @@ connection con3; SELECT @@query_cache_type; --echo ON Expected +--enable_cursor_protocol + --echo --echo ** Cleanup ** --echo 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 d9dff17b5a0..395bdaed343 100644 --- a/mysql-test/suite/sys_vars/t/secure_file_priv.test +++ b/mysql-test/suite/sys_vars/t/secure_file_priv.test @@ -17,6 +17,7 @@ SHOW VARIABLES LIKE 'secure_file_priv'; # 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). +--disable_cursor_protocol --perl use File::Basename; @@ -41,6 +42,8 @@ EOF --remove_file $MYSQL_TMP_DIR/bug50373.inc --enable_query_log +--enable_cursor_protocol + DROP TABLE t1; --perl diff --git a/mysql-test/suite/sys_vars/t/slow_query_log_func.test b/mysql-test/suite/sys_vars/t/slow_query_log_func.test index 8dcc0279e72..c8c8c664ea7 100644 --- a/mysql-test/suite/sys_vars/t/slow_query_log_func.test +++ b/mysql-test/suite/sys_vars/t/slow_query_log_func.test @@ -5,6 +5,11 @@ SET @global_log_output = @@global.log_output; # Begin the functionality testing for slow_query_log # ############################################################################### +if (`SELECT $CURSOR_PROTOCOL != 0`) +{ + --skip Test temporarily disabled for cursor-protocol +} + SET @@session.long_query_time=1; SET @@global.log_output = 'TABLE'; diff --git a/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test b/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test index 77f947c9913..d398f711ad5 100644 --- a/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test +++ b/mysql-test/suite/sys_vars/t/sql_buffer_result_func.test @@ -51,18 +51,22 @@ SHOW STATUS LIKE 'Created_tmp_tables'; --enable_ps_protocol --echo Expected value : 0. +--disable_cursor_protocol --disable_ps2_protocol SELECT * FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol SHOW STATUS LIKE 'Created_tmp_tables'; --enable_ps_protocol --echo Expected value : 1. +--disable_cursor_protocol --disable_ps2_protocol SELECT * FROM t1; --enable_ps2_protocol +--enable_cursor_protocol --disable_ps_protocol SHOW STATUS LIKE 'Created_tmp_tables'; @@ -81,7 +85,9 @@ SHOW STATUS LIKE 'Created_tmp_tables'; --enable_ps_protocol --echo Expected value : 2. +--disable_cursor_protocol SELECT * FROM t1; +--enable_cursor_protocol --disable_ps_protocol SHOW STATUS LIKE 'Created_tmp_tables'; diff --git a/mysql-test/suite/vcol/t/load_data.test b/mysql-test/suite/vcol/t/load_data.test index 1b662818cd2..be247d106b9 100644 --- a/mysql-test/suite/vcol/t/load_data.test +++ b/mysql-test/suite/vcol/t/load_data.test @@ -5,9 +5,11 @@ create table t1 ( c1 varchar(10), c2 varchar(10), c3 int ); insert into t1 values ("a" , "b", 1), ("a" , "b", 2); create table t2 like t1 ; alter table t2 add column c4 bigint unsigned as (CONV(LEFT(MD5(concat(c1,c2,c3)), 16), 16, 10)) persistent unique key; +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 't1.csv' from t1; --enable_ps2_protocol +--enable_cursor_protocol load data infile 't1.csv' ignore into table t2 ; select * from t2; insert into t2 (c1,c2,c3) values ("a" , "b", 4); diff --git a/mysql-test/suite/vcol/t/vcol_keys_myisam.test b/mysql-test/suite/vcol/t/vcol_keys_myisam.test index bc8fcbd29c0..e9207d3bcdd 100644 --- a/mysql-test/suite/vcol/t/vcol_keys_myisam.test +++ b/mysql-test/suite/vcol/t/vcol_keys_myisam.test @@ -281,9 +281,11 @@ drop table t1; CREATE TABLE t1 (i INT, d1 DATE, d2 DATE NOT NULL, t TIMESTAMP, KEY(t)) ENGINE=MyISAM; INSERT INTO t1 VALUES (1,'2023-03-16','2023-03-15','2012-12-12 12:12:12'); ALTER TABLE t1 MODIFY t FLOAT AS (i) PERSISTENT; +--disable_cursor_protocol --disable_ps2_protocol SELECT i, d1, d2 INTO OUTFILE 'load_t1' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol DELETE FROM t1; LOAD DATA INFILE 'load_t1' INTO TABLE t1 (i,d1,d2); SELECT * FROM t1 WHERE d2 < d1; diff --git a/mysql-test/suite/versioning/common.inc b/mysql-test/suite/versioning/common.inc index 9b901846e9f..73dacedb9de 100644 --- a/mysql-test/suite/versioning/common.inc +++ b/mysql-test/suite/versioning/common.inc @@ -7,7 +7,9 @@ source include/have_innodb.inc; set @@session.time_zone='+00:00'; set @@global.time_zone='+00:00'; +--disable_cursor_protocol select ifnull(max(transaction_id), 0) into @start_trx_id from mysql.transaction_registry; +--enable_cursor_protocol set @test_start=now(6); delimiter ~~; diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test index 85448d21346..85d40b1e8e9 100644 --- a/mysql-test/suite/versioning/t/alter.test +++ b/mysql-test/suite/versioning/t/alter.test @@ -139,9 +139,11 @@ select * from t; update t set a=3 where a=1; select * from t; select * from t for system_time all; +--disable_cursor_protocol --enable_prepare_warnings select row_start from t where a=3 into @tm; --disable_prepare_warnings +--enable_cursor_protocol alter table t add column b int; select @tm=row_start from t where a=3; show create table t; diff --git a/mysql-test/suite/versioning/t/commit_id.test b/mysql-test/suite/versioning/t/commit_id.test index 96461f5c299..a64067563ef 100644 --- a/mysql-test/suite/versioning/t/commit_id.test +++ b/mysql-test/suite/versioning/t/commit_id.test @@ -18,21 +18,27 @@ insert into t1 values (); set @ts0= now(6); insert into t1 values (); +--disable_cursor_protocol --enable_prepare_warnings select sys_trx_start from t1 where id = last_insert_id() into @tx0; +--enable_cursor_protocol select transaction_id = @tx0 from mysql.transaction_registry order by transaction_id desc limit 1; set @ts1= now(6); insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx1; +--enable_cursor_protocol select transaction_id = @tx1 from mysql.transaction_registry order by transaction_id desc limit 1; set @ts2= now(6); insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx2; +--enable_cursor_protocol select transaction_id = @tx2 from mysql.transaction_registry order by transaction_id desc limit 1; @@ -72,22 +78,30 @@ select trt_trx_sees(0, @tx2); set transaction isolation level read uncommitted; insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx3; +--enable_cursor_protocol select isolation_level = 'READ-UNCOMMITTED' from mysql.transaction_registry where transaction_id = @tx3; set transaction isolation level read committed; insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx4; +--enable_cursor_protocol select isolation_level = 'READ-COMMITTED' from mysql.transaction_registry where transaction_id = @tx4; set transaction isolation level serializable; insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx5; +--enable_cursor_protocol select isolation_level = 'SERIALIZABLE' from mysql.transaction_registry where transaction_id = @tx5; set transaction isolation level repeatable read; insert into t1 values (); +--disable_cursor_protocol select sys_trx_start from t1 where id = last_insert_id() into @tx6; +--enable_cursor_protocol select isolation_level = 'REPEATABLE-READ' from mysql.transaction_registry where transaction_id = @tx6; --disable_prepare_warnings diff --git a/mysql-test/suite/versioning/t/create.test b/mysql-test/suite/versioning/t/create.test index 46ed8fad4cb..f9be091114f 100644 --- a/mysql-test/suite/versioning/t/create.test +++ b/mysql-test/suite/versioning/t/create.test @@ -210,9 +210,11 @@ show create table t3; --echo ## For versioned table insert into t1 values (1); +--disable_cursor_protocol select row_start from t1 into @row_start; insert into t0 (y) values (2); select st from t0 into @st; +--enable_cursor_protocol create or replace table t2 with system versioning as select * from t1; --replace_result $default_engine DEFAULT_ENGINE @@ -251,10 +253,12 @@ create or replace table t3 with system versioning select x23, row_start from t1; create or replace table t3 with system versioning select x23, row_end from t1; --echo # Prepare checking for historical row +--disable_cursor_protocol delete from t1; select row_end from t1 for system_time all into @row_end; delete from t0; select en from t0 for system_time all into @en; +--enable_cursor_protocol --echo ## Combinations of versioned + non-versioned create or replace table t2 (y int); @@ -270,9 +274,13 @@ insert into t2 (y) values (1), (2); delete from t2 where y = 2; create or replace table t3 select * from t2 for system_time all; +--disable_cursor_protocol select st, en from t3 where y = 1 into @st, @en; +--enable_cursor_protocol select y from t2 for system_time all where st = @st and en = @en; +--disable_cursor_protocol select st, en from t3 where y = 2 into @st, @en; +--enable_cursor_protocol select y from t2 for system_time all where st = @st and en = @en; --echo ## Default engine detection diff --git a/mysql-test/suite/versioning/t/cte.test b/mysql-test/suite/versioning/t/cte.test index 025e1b2319d..c60d347ec82 100644 --- a/mysql-test/suite/versioning/t/cte.test +++ b/mysql-test/suite/versioning/t/cte.test @@ -1,6 +1,6 @@ -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Test temporarily disabled for ps-protocol + --skip Test temporarily disabled for ps-protocol and cursor-protocol } --source include/have_innodb.inc --source include/default_optimizer_switch.inc @@ -38,7 +38,9 @@ insert into emp (emp_id, name, salary, dept_id, mgr) values (20, "john", 500, 10, 1), (30, "jane", 750, 10,1 ); +--disable_cursor_protocol select row_start into @ts_1 from emp where name="jane"; +--enable_cursor_protocol update emp set mgr=30 where name ="john"; @@ -49,7 +51,9 @@ with ancestors as ( select e.emp_id, e.name, e.mgr, e.salary from emp as e ) select * from ancestors for system_time as of @ts_1; +--disable_cursor_protocol select row_start into @ts_2 from emp where name="john"; +--enable_cursor_protocol let $q= /* All report to 'Bill' */ diff --git a/mysql-test/suite/versioning/t/data.test b/mysql-test/suite/versioning/t/data.test index fb996258124..36eb21f4e3a 100644 --- a/mysql-test/suite/versioning/t/data.test +++ b/mysql-test/suite/versioning/t/data.test @@ -38,8 +38,10 @@ insert into t1 values (1), (2); set timestamp=unix_timestamp('2011-11-11 11:11:11.111111'); delete from t1 where x = 1; set timestamp=default; +--disable_cursor_protocol select row_start, row_end into @s1, @e1 from t1 for system_time all where x = 1; select row_start, row_end into @s2, @e2 from t1 for system_time all where x = 2; +--enable_cursor_protocol create or replace table t2 ( x int, diff --git a/mysql-test/suite/versioning/t/delete.test b/mysql-test/suite/versioning/t/delete.test index 9debdcfec8c..ded6f46762b 100644 --- a/mysql-test/suite/versioning/t/delete.test +++ b/mysql-test/suite/versioning/t/delete.test @@ -42,7 +42,9 @@ eval create or replace table t1( with system versioning; insert into t1(x) values (1); +--disable_cursor_protocol select sys_start into @sys_start from t1; +--disable_cursor_protocol delete from t1; select * from t1; select x = 1 as A, sys_start = @sys_start as B, sys_end > sys_start as C from t1 for system_time all; diff --git a/mysql-test/suite/versioning/t/foreign.test b/mysql-test/suite/versioning/t/foreign.test index 5f228747108..58db815d8f1 100644 --- a/mysql-test/suite/versioning/t/foreign.test +++ b/mysql-test/suite/versioning/t/foreign.test @@ -314,9 +314,11 @@ create or replace table subchild ( ) engine=innodb; insert into parent (value) values (23); +--disable_cursor_protocol --enable_prepare_warnings select id, value from parent into @id, @value; --disable_prepare_warnings +--enable_cursor_protocol insert into child values (default, @id, @value); insert into subchild values (default, @id, @value); @@ -398,21 +400,27 @@ INSERT INTO t2 VALUES (1,'against'),(2,'q'); SET SQL_MODE= ''; SET timestamp = 2; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 't1.data' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol SET timestamp = 3; UPDATE t1 SET f13 = 'q'; SET timestamp = 4; LOAD DATA INFILE 't1.data' REPLACE INTO TABLE t1; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 't1.data.2' FROM t1; --enable_ps2_protocol +--enable_cursor_protocol SET timestamp = 5; LOAD DATA INFILE 't1.data.2' REPLACE INTO TABLE t1; +--disable_cursor_protocol --disable_ps2_protocol SELECT * INTO OUTFILE 't2.data' FROM t2; --enable_ps2_protocol +--enable_cursor_protocol SET timestamp = 6; LOAD DATA INFILE 't2.data' REPLACE INTO TABLE t2; SET FOREIGN_KEY_CHECKS = OFF; @@ -555,9 +563,11 @@ delete from t0; --error ER_ROW_IS_REFERENCED_2 replace t0 values (1); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'load_t0' from t0 ; --enable_ps2_protocol +--enable_cursor_protocol --error ER_ROW_IS_REFERENCED_2 load data infile 'load_t0' replace into table t0; diff --git a/mysql-test/suite/versioning/t/insert.test b/mysql-test/suite/versioning/t/insert.test index f4c54eb6cc4..7c1b4fed361 100644 --- a/mysql-test/suite/versioning/t/insert.test +++ b/mysql-test/suite/versioning/t/insert.test @@ -52,9 +52,11 @@ drop view vt1_1; replace_result $sys_datatype_expl SYS_DATATYPE; eval create or replace table t1( id bigint primary key, a int, b int) with system versioning; insert into t1 values(1, 1, 1); +--disable_cursor_protocol --enable_prepare_warnings select row_start, row_end from t1 into @sys_start, @sys_end; --disable_prepare_warnings +--enable_cursor_protocol select id, a, b from t1; insert into t1 values(2, 2, 2); select id, a, b, row_start > @sys_start as C, row_end = @sys_end as D from t1 where id = 2; @@ -190,9 +192,11 @@ replace into t3 values (0, '1980-01-01 00:00:00', '1981-01-01 00:00:00'); --echo # LOAD DATA --let DATAFILE= $MYSQLTEST_VARDIR/tmp/test_versioning_t3.data --replace_result $DATAFILE DATAFILE +--disable_cursor_protocol --disable_ps2_protocol eval select x, row_start, row_end into outfile '$DATAFILE' from t1 for system_time all; --enable_ps2_protocol +--enable_cursor_protocol create or replace table t2 like t1; --replace_result $default_engine DEFAULT_ENGINE show create table t2; @@ -249,9 +253,11 @@ set sql_mode='STRICT_ALL_TABLES'; create or replace table t1 (a int) with system versioning; set system_versioning_insert_history= on; insert into t1 (a,row_start,row_end) values (1,'2022-01-01','2023-01-01'),(1,'2022-01-01','2023-01-01'); +--disable_cursor_protocol --disable_ps2_protocol select a,row_start,row_end into outfile 'mdev29813.txt' from t1 for system_time all; --enable_ps2_protocol +--enable_cursor_protocol create or replace table t1 (a int primary key) with system versioning; load data infile 'mdev29813.txt' ignore into table t1 (a,row_start,row_end); diff --git a/mysql-test/suite/versioning/t/insert2.test b/mysql-test/suite/versioning/t/insert2.test index 1e7d2166064..527a66e5f21 100644 --- a/mysql-test/suite/versioning/t/insert2.test +++ b/mysql-test/suite/versioning/t/insert2.test @@ -48,7 +48,9 @@ insert into t1 (row_start) select row_end from t1; set sql_mode=''; insert into t1 (row_start, row_end) values (DEFAULT, 1); set sql_mode=default; +--disable_cursor_protocol select @@sql_mode into @saved_mode; +--enable_cursor_protocol set sql_mode= ''; insert into t1 (x, row_start, row_end) values (3, 4, 5); set sql_mode= @saved_mode; diff --git a/mysql-test/suite/versioning/t/load_data.test b/mysql-test/suite/versioning/t/load_data.test index 4b77d9f80bb..7234de7945c 100644 --- a/mysql-test/suite/versioning/t/load_data.test +++ b/mysql-test/suite/versioning/t/load_data.test @@ -5,11 +5,13 @@ CREATE TABLE t1 (a INT, b INT, c INT, vc INT AS (c), UNIQUE(a), UNIQUE(b)) WITH SYSTEM VERSIONING; INSERT IGNORE INTO t1 (a,b,c) VALUES (1,2,3); +--disable_cursor_protocol --enable_prepare_warnings --disable_ps2_protocol SELECT a, b, c FROM t1 INTO OUTFILE '15330.data'; --disable_prepare_warnings --enable_ps2_protocol +--enable_cursor_protocol LOAD DATA INFILE '15330.data' IGNORE INTO TABLE t1 (a,b,c); LOAD DATA INFILE '15330.data' REPLACE INTO TABLE t1 (a,b,c); diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index 5707746f96c..41aa509d5a5 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -1019,6 +1019,7 @@ create or replace table t1 ( insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); +--disable_cursor_protocol --disable_ps2_protocol select * into outfile 'MDEV-17891.data' from t1; --enable_ps2_protocol @@ -1027,6 +1028,7 @@ load data infile 'MDEV-17891.data' replace into table t1; load data infile 'MDEV-17891.data' replace into table t1; --error ER_RECORD_FILE_FULL load data infile 'MDEV-17891.data' replace into table t1; +--enable_cursor_protocol # Cleanup --remove_file $datadir/test/MDEV-17891.data @@ -1367,9 +1369,11 @@ partition by system_time limit 100 ( partition pn current); insert into t1 select seq from seq_0_to_49; +--disable_cursor_protocol --disable_ps2_protocol select x into outfile 'MDEV-20077.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol load data infile 'MDEV-20077.data' replace into table t1 (x); load data infile 'MDEV-20077.data' replace into table t1 (x); @@ -2208,9 +2212,11 @@ create or replace table t1 (x int primary key) with system versioning partition by system_time interval 1 hour auto; insert t1 values (1), (2), (3); +--disable_cursor_protocol --disable_ps2_protocol select x into outfile 'MDEV-17554.data' from t1; --enable_ps2_protocol +--enable_cursor_protocol set timestamp= unix_timestamp('2000-01-01 01:00:00'); load data infile 'MDEV-17554.data' replace into table t1 (x); diff --git a/mysql-test/suite/versioning/t/rpl.test b/mysql-test/suite/versioning/t/rpl.test index c723751a060..76e537085e4 100644 --- a/mysql-test/suite/versioning/t/rpl.test +++ b/mysql-test/suite/versioning/t/rpl.test @@ -414,9 +414,11 @@ select row_start = '1980-01-01 00:00:00', row_end = '1980-01-01 00:00:01' from t connection master; --let DATAFILE= $MYSQLTEST_VARDIR/tmp/test_versioning_t3.data --replace_result $DATAFILE DATAFILE +--disable_cursor_protocol --disable_ps2_protocol eval select x, row_start, row_end into outfile '$DATAFILE' from t1 for system_time all; --enable_ps2_protocol +--enable_cursor_protocol create or replace table t3 like t1; set @@system_versioning_insert_history= 1; --replace_result $DATAFILE DATAFILE diff --git a/mysql-test/suite/versioning/t/select.test b/mysql-test/suite/versioning/t/select.test index 5603d1a3a12..7bde6c71135 100644 --- a/mysql-test/suite/versioning/t/select.test +++ b/mysql-test/suite/versioning/t/select.test @@ -1,6 +1,6 @@ -if (`SELECT $PS_PROTOCOL != 0`) +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) { - --skip Need regular protocol but ps-protocol was specified + --skip Need regular protocol but ps-protocol and cursor-protocol were specified } --source suite/versioning/engines.inc --source suite/versioning/common.inc @@ -37,7 +37,9 @@ set @t0= now(6); if ($MTR_COMBINATION_TRX_ID) { --disable_query_log +--disable_cursor_protocol select sys_trx_start from t1 limit 1 into @x0; +--enable_cursor_protocol --enable_query_log } @@ -45,12 +47,16 @@ delete from t1 where x = 3; delete from t1 where x > 7; insert into t1(x, y) values(3, 33); +--disable_cursor_protocol select sys_trx_start from t1 where x = 3 and y = 33 into @t1; +--enable_cursor_protocol if ($MTR_COMBINATION_TRX_ID) { --disable_query_log set @x1= @t1; +--disable_cursor_protocol select trt_commit_ts(@x1) into @t1; +--enable_cursor_protocol --enable_query_log } @@ -126,12 +132,14 @@ delete from t1; insert into t1 values (3); delete from t1; +--disable_cursor_protocol select row_start into @start1 from t1 for system_time all where x = 1; select row_end into @end1 from t1 for system_time all where x = 1; select row_start into @start2 from t1 for system_time all where x = 2; select row_end into @end2 from t1 for system_time all where x = 2; select row_start into @start3 from t1 for system_time all where x = 3; select row_end into @end3 from t1 for system_time all where x = 3; +--enable_cursor_protocol select x as ASOF_x from t1 for system_time as of @start2; select x as ASOF_x from t1 for system_time as of @end2; @@ -262,7 +270,9 @@ create or replace table t1 ( insert into t1 values (1); set @ts= now(6); delete from t1; +--disable_cursor_protocol select sys_trx_start from t1 for system_time all into @trx_start; +--enable_cursor_protocol --echo ## ensure @trx_start is much lower than unix timestamp select @trx_start < unix_timestamp(@ts) - 100 as trx_start_good; @@ -390,8 +400,10 @@ eval create or replace table t1 ( ) with system versioning; insert into t1 values (1); delete from t1; +--disable_cursor_protocol select row_start from t1 for system_time all into @t1; select row_end from t1 for system_time all into @t2; +--enable_cursor_protocol --disable_query_log if($MTR_COMBINATION_TRX_ID) { set @t1= trt_begin_ts(@t1); diff --git a/mysql-test/suite/versioning/t/select2.test b/mysql-test/suite/versioning/t/select2.test index 53840b390b6..6e41e4341d2 100644 --- a/mysql-test/suite/versioning/t/select2.test +++ b/mysql-test/suite/versioning/t/select2.test @@ -22,13 +22,17 @@ insert into t1 (x, y) values (8, 108), (9, 109); set @t0= now(6); +--disable_cursor_protocol --enable_prepare_warnings select sys_start from t1 limit 1 into @x0; --disable_prepare_warnings +--enable_cursor_protocol + delete from t1 where x = 3; delete from t1 where x > 7; insert into t1(x, y) values(3, 33); +--disable_cursor_protocol --enable_prepare_warnings select sys_start from t1 where x = 3 and y = 33 into @t1; --disable_prepare_warnings @@ -36,6 +40,7 @@ if($MTR_COMBINATION_TRX_ID) { set @x1= @t1; select trt_commit_ts(@x1) into @t1; } +--enable_cursor_protocol select x, y from t1; select x as ASOF_x, y from t1 for system_time as of timestamp @t0; diff --git a/mysql-test/suite/versioning/t/simple.test b/mysql-test/suite/versioning/t/simple.test index b550b3967d9..6f0e52f4f5d 100644 --- a/mysql-test/suite/versioning/t/simple.test +++ b/mysql-test/suite/versioning/t/simple.test @@ -18,6 +18,7 @@ create or replace table emp ( ) with system versioning; +--disable_cursor_protocol select now() into @ts_0; insert into dept (dept_id, name) values (10, "accounting"); @@ -29,13 +30,16 @@ insert into emp (emp_id, name, salary, dept_id) values (1, "bill", 1000, 10); commit; select row_start into @ts_2 from emp where name="bill"; +--enable_cursor_protocol select * from emp; update emp set salary=2000 where name="bill"; commit; +--disable_cursor_protocol select row_start into @ts_3 from emp where name="bill"; +--enable_cursor_protocol select * from emp; select * from emp for system_time as of timestamp @ts_2; diff --git a/mysql-test/suite/versioning/t/trx_id.test b/mysql-test/suite/versioning/t/trx_id.test index 60836279f52..8f96500f340 100644 --- a/mysql-test/suite/versioning/t/trx_id.test +++ b/mysql-test/suite/versioning/t/trx_id.test @@ -40,11 +40,15 @@ alter table t1 add period for system_time(s, e), add system versioning, algorithm=inplace; +--disable_cursor_protocol select s from t1 into @trx_start; +--enable_cursor_protocol select count(*) = 1 from mysql.transaction_registry where transaction_id = @trx_start; create or replace table t1 (x int); +--disable_cursor_protocol select count(*) from mysql.transaction_registry into @tmp; +--enable_cursor_protocol alter table t1 add column s bigint unsigned as row start, add column e bigint unsigned as row end, @@ -61,11 +65,15 @@ alter table t1 add period for system_time(s, e), add system versioning, algorithm=copy; +--disable_cursor_protocol select s from t1 into @trx_start; +--enable_cursor_protocol select count(*) = 1 from mysql.transaction_registry where transaction_id = @trx_start; create or replace table t1 (x int); +--disable_cursor_protocol select count(*) from mysql.transaction_registry into @tmp; +--enable_cursor_protocol alter table t1 add column s bigint unsigned as row start, add column e bigint unsigned as row end, @@ -124,9 +132,11 @@ commit; --sleep 0.01 set @ts3= sysdate(6); +--disable_cursor_protocol select sys_start from t1 where x = 1 into @trx_id1; select sys_start from t1 where x = 2 into @trx_id2; select sys_start from t1 where x = 3 into @trx_id3; +--enable_cursor_protocol select @trx_id1 < @trx_id2, @trx_id2 < @trx_id3; select @ts1 < @ts2, @ts2 < @ts3; @@ -267,7 +277,9 @@ set @ts1= now(6); insert into t1 values (1); commit; +--disable_cursor_protocol select row_start from t1 into @trx_id; +--enable_cursor_protocol select trt_begin_ts(@trx_id) <= @ts1 as BEGIN_TS_GOOD; drop table t1; diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test index 6930fecce40..e7a57b393ad 100644 --- a/mysql-test/suite/versioning/t/update.test +++ b/mysql-test/suite/versioning/t/update.test @@ -28,11 +28,15 @@ eval create table t1 ( with system versioning; set timestamp= unix_timestamp('2000-01-01 00:00:00'); insert into t1 values(1, 1, 1); +--disable_cursor_protocol select sys_trx_start into @tmp1 from t1; +--enable_cursor_protocol set timestamp= unix_timestamp('2000-01-01 01:00:00'); update t1 set x= 11, y= 11 where id = 1; select @tmp1 < sys_trx_start as A1, x, y from t1; +--disable_cursor_protocol select sys_trx_start into @tmp1 from t1; +--enable_cursor_protocol set timestamp= unix_timestamp('2000-01-01 02:00:00'); update t1 set y= 1 where id = 1; select @tmp1 = sys_trx_start as A2, x from t1; @@ -135,14 +139,18 @@ create table t2 like t1; insert into t1 values (1, "Jeremy", 3000); insert into t2 values (1, "Jeremy", 4000); +--disable_cursor_protocol select sys_trx_start into @tmp1 from t1; select sys_trx_start into @tmp2 from t2; +--enable_cursor_protocol update t1, t2 set t1.name= "Jerry", t2.name= "Jerry" where t1.id = t2.id and t1.name = "Jeremy"; select @tmp1 < sys_trx_start as A1, name from t1; select @tmp2 < sys_trx_start as A2, name from t2; +--disable_cursor_protocol select sys_trx_start into @tmp1 from t1; select sys_trx_start into @tmp2 from t2; +--enable_cursor_protocol update t1, t2 set t1.salary= 2500, t2.salary= 2500 where t1.id = t2.id and t1.name = "Jerry"; select @tmp1 = sys_trx_start as B1, salary from t1; select @tmp2 = sys_trx_start as B2, salary from t2; @@ -335,7 +343,9 @@ drop tables t1, t2, t3; create or replace table t1 (x int) with system versioning; insert t1 values (1); update t1 set x= 1; +--disable_cursor_protocol select row_start into @r from t1; +--enable_cursor_protocol select check_row_ts(row_start, row_end) from t1 for system_time all where row_start = @r; drop table t1; diff --git a/mysql-test/suite/versioning/t/view.test b/mysql-test/suite/versioning/t/view.test index 9bb915f7b77..e4c688fa859 100644 --- a/mysql-test/suite/versioning/t/view.test +++ b/mysql-test/suite/versioning/t/view.test @@ -5,10 +5,14 @@ create or replace table t1 (x int) with system versioning; insert into t1 values (1); +--disable_cursor_protocol select now(6) into @t1; +--enable_cursor_protocol update t1 set x= 2; +--disable_cursor_protocol select now(6) into @t2; +--enable_cursor_protocol delete from t1; set @vt1= concat("create or replace view vt1 as select * from t1 for system_time as of timestamp '", @t1, "'"); diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet4.test b/plugin/type_inet/mysql-test/type_inet/type_inet4.test index b6b6300da47..8bb2a8259f8 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet4.test +++ b/plugin/type_inet/mysql-test/type_inet/type_inet4.test @@ -24,10 +24,12 @@ DROP TABLE t1; CREATE TABLE t1 (a INET4); INSERT INTO t1 VALUES ('0.0.0.1'); +--disable_cursor_protocol --enable_metadata SELECT * FROM t1; SELECT CAST('0.0.0.1' AS INET4) AS a; --disable_metadata +--enable_cursor_protocol DROP TABLE t1; @@ -1290,6 +1292,7 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a INET4); +--disable_cursor_protocol --enable_metadata SELECT CAST(a AS BINARY(0)), @@ -1308,6 +1311,7 @@ SELECT CAST(a AS BINARY(16777216)) FROM t1; --disable_metadata +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.test b/plugin/type_inet/mysql-test/type_inet/type_inet6.test index cb3d226f9b6..c3128140b71 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test @@ -18,7 +18,10 @@ CREATE TABLE t1 (a INET6); INSERT INTO t1 VALUES ('::1'); --enable_metadata SELECT * FROM t1; +#check after fix MDEV-31540 +--disable_cursor_protocol SELECT CAST('::' AS INET6) AS a; +--enable_cursor_protocol --disable_metadata DROP TABLE t1; @@ -1430,6 +1433,8 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a INET6); +#check after fix MDEV-31540 +--disable_cursor_protocol --enable_metadata SELECT CAST(a AS BINARY(0)), @@ -1448,6 +1453,7 @@ SELECT CAST(a AS BINARY(16777216)) FROM t1; --disable_metadata +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test index 0979582a69a..63b9228c343 100644 --- a/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test +++ b/plugin/type_uuid/mysql-test/type_uuid/type_uuid.test @@ -20,10 +20,12 @@ DROP TABLE t1; CREATE TABLE t1 (a UUID); INSERT INTO t1 VALUES ('00000000-0000-0000-0000-000000000001'); +--disable_cursor_protocol --enable_metadata SELECT * FROM t1; SELECT CAST('00000000-0000-0000-0000-000000000001' AS UUID) AS a; --disable_metadata +--enable_cursor_protocol DROP TABLE t1; @@ -1587,6 +1589,7 @@ DROP TABLE t1; --echo # CREATE TABLE t1 (a UUID); +--disable_cursor_protocol --enable_metadata SELECT CAST(a AS BINARY(0)), @@ -1605,6 +1608,7 @@ SELECT CAST(a AS BINARY(16777216)) FROM t1; --disable_metadata +--enable_cursor_protocol DROP TABLE t1; --echo # diff --git a/sql-common/my_time.c b/sql-common/my_time.c index eff39cd5eae..2f74235614c 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -961,7 +961,7 @@ str_to_DDhhmmssff_internal(my_bool neg, const char *str, size_t length, { /* String given as one number; assume HHMMSS format */ date[0]= 0; - DBUG_ASSERT(value <= ((ulonglong) UINT_MAX32) * 10000ULL); + DBUG_ASSERT(value / 10000 <= ((ulonglong) UINT_MAX32)); date[1]= (ulong) (value/10000); date[2]= (ulong) (value/100 % 100); date[3]= (ulong) (value % 100); diff --git a/sql/ha_partition.h b/sql/ha_partition.h index a252b0e928d..bc69aaf4771 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -1471,7 +1471,7 @@ public: virtual int get_foreign_key_list(THD *thd, List *f_key_list) - virtual uint referenced_by_foreign_key() + bool referenced_by_foreign_key() const noexcept override */ bool can_switch_engines() override; /* diff --git a/sql/handler.h b/sql/handler.h index bd4dfd17178..52b3beaa578 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -4155,7 +4155,7 @@ public: virtual int get_parent_foreign_key_list(THD *thd, List *f_key_list) { return 0; } - virtual uint referenced_by_foreign_key() { return 0;} + virtual bool referenced_by_foreign_key() const noexcept { return false;} virtual void init_table_handle_for_HANDLER() { return; } /* prepare InnoDB for HANDLER */ virtual void free_foreign_key_create_info(char* str) {} diff --git a/sql/item_func.h b/sql/item_func.h index 51e60d38673..483d96e3e8e 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -35,6 +35,8 @@ extern "C" /* Bug in BSDI include file */ #include +extern int st_append_json(String *s, + CHARSET_INFO *json_cs, const uchar *js, uint js_len); class Item_func :public Item_func_or_sum { void sync_with_sum_func_and_with_field(List &list); diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 217a95f90aa..2dde672c0d8 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -4009,7 +4009,6 @@ static Native_func_registry func_array_geom[] = { { STRING_WITH_LEN("ST_ENDPOINT") }, GEOM_BUILDER(Create_func_endpoint)}, { { STRING_WITH_LEN("ST_ENVELOPE") }, GEOM_BUILDER(Create_func_envelope)}, { { STRING_WITH_LEN("ST_EQUALS") }, GEOM_BUILDER(Create_func_equals)}, - { { STRING_WITH_LEN("ST_EQUALS") }, GEOM_BUILDER(Create_func_equals)}, { { STRING_WITH_LEN("ST_EXTERIORRING") }, GEOM_BUILDER(Create_func_exteriorring)}, { { STRING_WITH_LEN("ST_GEOMCOLLFROMTEXT") }, GEOM_BUILDER(Create_func_geometry_from_text)}, { { STRING_WITH_LEN("ST_GEOMCOLLFROMWKB") }, GEOM_BUILDER(Create_func_geometry_from_wkb)}, diff --git a/sql/item_jsonfunc.cc b/sql/item_jsonfunc.cc index 182838a14f5..37fe49ebf29 100644 --- a/sql/item_jsonfunc.cc +++ b/sql/item_jsonfunc.cc @@ -96,7 +96,7 @@ static inline bool append_simple(String *s, const uchar *a, size_t a_len) Appends JSON string to the String object taking charsets in consideration. */ -static int st_append_json(String *s, +int st_append_json(String *s, CHARSET_INFO *json_cs, const uchar *js, uint js_len) { int str_len= js_len * s->charset()->mbmaxlen; diff --git a/sql/json_table.cc b/sql/json_table.cc index f9019ef8169..4281a2add04 100644 --- a/sql/json_table.cc +++ b/sql/json_table.cc @@ -381,6 +381,8 @@ int ha_json_table::rnd_init(bool scan) static void store_json_in_field(Field *f, const json_engine_t *je) { + String res_tmp("", 0, je->s.cs); + switch (je->value_type) { case JSON_VALUE_NULL: @@ -401,7 +403,8 @@ static void store_json_in_field(Field *f, const json_engine_t *je) default: break; }; - f->store((const char *) je->value, (uint32) je->value_len, je->s.cs); + st_append_json(&res_tmp, je->s.cs, je->value, je->value_len); + f->store((const char *) res_tmp.ptr(), (uint32) res_tmp.length(), je->s.cs); } @@ -1046,8 +1049,7 @@ int Json_table_column::On_response::respond(Json_table_column *jc, Field *f, return 1; case Json_table_column::RESPONSE_DEFAULT: f->set_notnull(); - f->store(m_default.str, - m_default.length, jc->m_defaults_cs); + m_default->save_in_field(f, TRUE); break; } return 0; @@ -1057,7 +1059,11 @@ int Json_table_column::On_response::respond(Json_table_column *jc, Field *f, int Json_table_column::On_response::print(const char *name, String *str) const { LEX_CSTRING resp; - const LEX_CSTRING *ds= NULL; + + char valbuf[512]; + String val(valbuf, sizeof(valbuf), str->charset()); + String *ds= NULL; + if (m_response == Json_table_column::RESPONSE_NOT_SPECIFIED) return 0; @@ -1072,7 +1078,7 @@ int Json_table_column::On_response::print(const char *name, String *str) const case Json_table_column::RESPONSE_DEFAULT: { lex_string_set3(&resp, STRING_WITH_LEN("DEFAULT")); - ds= &m_default; + ds= m_default->val_str(&val); break; } default: @@ -1081,9 +1087,14 @@ int Json_table_column::On_response::print(const char *name, String *str) const } return (str->append(' ') || str->append(resp) || - (ds && (str->append(STRING_WITH_LEN(" '")) || - str->append_for_single_quote(ds->str, ds->length) || - str->append('\''))) || + (ds && + (str->append(' ') || + (m_default->result_type()==STRING_RESULT && str->append('\''))|| + + str->append_for_single_quote(ds) || + + (m_default->result_type()==STRING_RESULT && str->append('\''))))|| + str->append(STRING_WITH_LEN(" ON ")) || str->append(name, strlen(name))); } diff --git a/sql/json_table.h b/sql/json_table.h index 74c2bfc217d..84f0a099d6e 100644 --- a/sql/json_table.h +++ b/sql/json_table.h @@ -140,7 +140,7 @@ public: { public: Json_table_column::enum_on_response m_response; - LEX_CSTRING m_default; + Item *m_default; int respond(Json_table_column *jc, Field *f, uint error_num); int print(const char *name, String *str) const; bool specified() const { return m_response != RESPONSE_NOT_SPECIFIED; } @@ -154,7 +154,6 @@ public: Create_field *m_field; Json_table_nested_path *m_nest; CHARSET_INFO *m_explicit_cs; - CHARSET_INFO *m_defaults_cs; void set(enum_type ctype) { @@ -263,9 +262,6 @@ public: /* SQL Parser: current column in JSON_TABLE (...) syntax */ Json_table_column *m_cur_json_table_column; - /* SQL Parser: charset of the current text literal */ - CHARSET_INFO *m_text_literal_cs; - private: /* Context to be used for resolving the first argument. */ Name_resolution_context *m_context; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 902e4df0f8d..3beadda3a52 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6419,7 +6419,9 @@ void handle_connections_sockets() &length); if (mysql_socket_getfd(new_sock) != INVALID_SOCKET) handle_accepted_socket(new_sock, sock); - else if (socket_errno != SOCKET_EINTR && socket_errno != SOCKET_EAGAIN) + else if (socket_errno == SOCKET_EAGAIN || socket_errno == SOCKET_EWOULDBLOCK) + break; + else if (socket_errno != SOCKET_EINTR) { /* accept(2) failed on the listening port. diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 736d15278f9..f149e82f203 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -3537,9 +3537,35 @@ bool calculate_cond_selectivity_for_table(THD *thd, TABLE *table, Item **cond) */ selectivity_mult= ((double)(i+1)) / i; } - table->cond_selectivity*= selectivity_mult; selectivity_for_index.add("selectivity_multiplier", selectivity_mult); + + /* + Ok, now we assume that selectivity that range condition on + this index adds over selectivities on indexes that we've already + examined is + + $SEL= (quick_cond_selectivity * selectivity_mult) + + The heuristic that we used to obtain selectivity_mult may not be + correct (actually is known to be incorrect in simple cases), so + we make sure here that $SEL <= 1.0. + + We adjust selectivity_mult (table->cond_selectivity was already + multiplied by quick_cond_selectivity above, so we will only + multiply it with selectivity_mult). + */ + if ((thd->variables.optimizer_adjust_secondary_key_costs & + OPTIMIZER_ADJ_FIX_CARD_MULT) && + selectivity_mult > 1.0 / quick_cond_selectivity) + { + selectivity_for_index.add("note", "multiplier too high, clipping"); + selectivity_mult= 1.0/quick_cond_selectivity; + selectivity_for_index.add("clipped_multiplier", selectivity_mult); + DBUG_ASSERT(quick_cond_selectivity * selectivity_mult <= 1.0); + } + + table->cond_selectivity*= selectivity_mult; } /* We need to set selectivity for fields supported by indexes. diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc index 22ae84aa353..0a26951b47e 100644 --- a/sql/service_wsrep.cc +++ b/sql/service_wsrep.cc @@ -183,7 +183,8 @@ extern "C" my_bool wsrep_thd_is_BF(const THD *thd, my_bool sync) extern "C" my_bool wsrep_thd_is_SR(const THD *thd) { - return thd && thd->wsrep_cs().transaction().is_streaming(); + return thd && thd->wsrep_cs().transaction().is_streaming() && + thd->wsrep_cs().transaction().state() == wsrep::transaction::s_executing; } extern "C" void wsrep_handle_SR_rollback(THD *bf_thd, diff --git a/sql/session_tracker.cc b/sql/session_tracker.cc index 14cb78e8fa6..0ccef54e900 100644 --- a/sql/session_tracker.cc +++ b/sql/session_tracker.cc @@ -428,6 +428,7 @@ bool Session_sysvars_tracker::vars_list::store(THD *thd, String *buf) SHOW_VAR show; CHARSET_INFO *charset; size_t val_length, length; + mysql_mutex_lock(&LOCK_global_system_variables); mysql_mutex_lock(&LOCK_plugin); if (!*node->test_load) { @@ -444,13 +445,12 @@ bool Session_sysvars_tracker::vars_list::store(THD *thd, String *buf) show.name= svar->name.str; show.value= (char *) svar; - mysql_mutex_lock(&LOCK_global_system_variables); const char *value= get_one_variable(thd, &show, OPT_SESSION, SHOW_SYS, NULL, &charset, val_buf, &val_length); - mysql_mutex_unlock(&LOCK_global_system_variables); if (is_plugin) mysql_mutex_unlock(&LOCK_plugin); + mysql_mutex_unlock(&LOCK_global_system_variables); length= net_length_size(svar->name.length) + svar->name.length + diff --git a/sql/slave.cc b/sql/slave.cc index 108d73a1afd..d4f28df7f2e 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -1090,6 +1090,8 @@ terminate_slave_thread(THD *thd, mysql_mutex_unlock(&thd->LOCK_thd_kill); mysql_mutex_unlock(&thd->LOCK_thd_data); + DEBUG_SYNC(current_thd, "after_thd_awake_kill"); + /* There is a small chance that slave thread might miss the first alarm. To protect againts it, resend the signal until it reacts @@ -3855,13 +3857,26 @@ sql_delay_event(Log_event *ev, THD *thd, rpl_group_info *rgi) sql_delay, (long)ev->when, rli->mi->clock_diff_with_master, (long)now, (ulonglong)sql_delay_end, (long)nap_time)); - - if (sql_delay_end > now) + /* if using debug_sync for sql_delay, only delay once per event group */ + if (DBUG_IF("sql_delay_by_debug_sync") + ? type == GTID_EVENT : sql_delay_end > now) { DBUG_PRINT("info", ("delaying replication event %lu secs", nap_time)); rli->start_sql_delay(sql_delay_end); mysql_mutex_unlock(&rli->data_lock); + +#ifdef ENABLED_DEBUG_SYNC + DBUG_EXECUTE_IF("sql_delay_by_debug_sync", { + DBUG_ASSERT(!debug_sync_set_action( + thd, STRING_WITH_LEN( + "now SIGNAL at_sql_delay WAIT_FOR continue_sql_thread"))); + + // Skip the actual sleep if using DEBUG_SYNC to coordinate SQL_DELAY + DBUG_RETURN(0); + };); +#endif + DBUG_RETURN(slave_sleep(thd, nap_time, sql_slave_killed, rgi)); } } diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index f12a0950c78..f4be1798f7d 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -10354,6 +10354,10 @@ static int handle_grant_table(THD *thd, const Grant_table_base& grant_table, int result= 0; int error; TABLE *table= grant_table.table(); + DBUG_ENTER("handle_grant_table"); + if (!table) + DBUG_RETURN(0); + Field *host_field= table->field[0]; Field *user_field= table->field[which_table == USER_TABLE || which_table == PROXIES_PRIV_TABLE ? 1 : 2]; @@ -10363,7 +10367,6 @@ static int handle_grant_table(THD *thd, const Grant_table_base& grant_table, const char *user; uchar user_key[MAX_KEY_LENGTH]; uint key_prefix_length; - DBUG_ENTER("handle_grant_table"); if (which_table == ROLES_MAPPING_TABLE) { diff --git a/sql/sql_class.h b/sql/sql_class.h index 906f897415a..c74caa50378 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -4485,6 +4485,7 @@ public: is_slave_error= 0; if (killed == KILL_BAD_DATA) reset_killed(); + my_errno= 0; DBUG_VOID_RETURN; } diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index c25b43f4eb5..4c1085c8825 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -1362,7 +1362,7 @@ void do_handle_one_connection(CONNECT *connect, bool put_in_cache) THD *thd; if (!(thd= connect->create_thd(NULL))) { - connect->close_and_delete(); + connect->close_and_delete(0); return; } @@ -1437,7 +1437,7 @@ end_thread: if (!(connect->create_thd(thd))) { /* Out of resources. Free thread to get more resources */ - connect->close_and_delete(); + connect->close_and_delete(0); break; } delete connect; @@ -1466,9 +1466,11 @@ end_thread: Close connection without error and delete the connect object This and close_with_error are only called if we didn't manage to create a new thd object. + + Note: err can be 0 if unknown/not inportant */ -void CONNECT::close_and_delete() +void CONNECT::close_and_delete(uint err) { DBUG_ENTER("close_and_delete"); @@ -1482,7 +1484,11 @@ void CONNECT::close_and_delete() vio_type= VIO_CLOSED; --*scheduler->connection_count; - statistic_increment(connection_errors_internal, &LOCK_status); + + if (err == ER_CON_COUNT_ERROR) + statistic_increment(connection_errors_max_connection, &LOCK_status); + else + statistic_increment(connection_errors_internal, &LOCK_status); statistic_increment(aborted_connects,&LOCK_status); delete this; @@ -1506,7 +1512,7 @@ void CONNECT::close_with_error(uint sql_errno, delete thd; set_current_thd(0); } - close_and_delete(); + close_and_delete(close_error); } diff --git a/sql/sql_connect.h b/sql/sql_connect.h index 8be6c1aecc0..ed8c0fb8753 100644 --- a/sql/sql_connect.h +++ b/sql/sql_connect.h @@ -61,7 +61,7 @@ public: count--; DBUG_ASSERT(vio_type == VIO_CLOSED); } - void close_and_delete(); + void close_and_delete(uint err); void close_with_error(uint sql_errno, const char *message, uint close_error); THD *create_thd(THD *thd); diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 6509d6a88b5..4346d9dbae5 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -3792,6 +3792,8 @@ void st_select_lex_unit::print(String *str, enum_query_type query_type) } else if (saved_fake_select_lex) saved_fake_select_lex->print_limit(thd, str, query_type); + + print_lock_from_the_last_select(str); } @@ -10728,6 +10730,22 @@ bool SELECT_LEX_UNIT::set_lock_to_the_last_select(Lex_select_lock l) return FALSE; } + +void SELECT_LEX_UNIT::print_lock_from_the_last_select(String *str) +{ + SELECT_LEX *sel= first_select(); + while (sel->next_select()) + sel= sel->next_select(); + if(sel->braces) + return; // braces processed in st_select_lex::print + + // lock type + sel->print_lock_type(str); + + return; +} + + /** Generate unique name for generated derived table for this SELECT */ diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 8099a8c40c9..9c17ffbefd1 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1048,6 +1048,7 @@ public: bool check_parameters(SELECT_LEX *main_select); bool set_lock_to_the_last_select(Lex_select_lock l); + void print_lock_from_the_last_select(String *str); bool can_be_merged(); @@ -1506,6 +1507,7 @@ public: bool setup_ref_array(THD *thd, uint order_group_num); uint get_cardinality_of_ref_ptrs_slice(uint order_group_num_arg); void print(THD *thd, String *str, enum_query_type query_type); + void print_lock_type(String *str); void print_item_list(THD *thd, String *str, enum_query_type query_type); void print_set_clause(THD *thd, String *str, enum_query_type query_type); void print_on_duplicate_key_clause(THD *thd, String *str, diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index fc06ae0f5d3..fc18f9d6975 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -9485,8 +9485,27 @@ static void sql_kill(THD *thd, my_thread_id id, killed_state state, killed_type type) { #ifdef WITH_WSREP + if (WSREP(thd)) + { + if (!(thd->variables.option_bits & OPTION_GTID_BEGIN)) + { + WSREP_DEBUG("implicit commit before KILL"); + /* Commit the normal transaction if one is active. */ + bool commit_failed= trans_commit_implicit(thd); + /* Release metadata locks acquired in this transaction. */ + thd->release_transactional_locks(); + if (commit_failed || wsrep_after_statement(thd)) + { + WSREP_DEBUG("implicit commit failed, MDL released: %lld", + (longlong) thd->thread_id); + return; + } + thd->transaction->stmt.mark_trans_did_ddl(); + } + } + bool wsrep_high_priority= false; -#endif +#endif /* WITH_WSREP */ uint error= kill_one_thread(thd, id, state, type #ifdef WITH_WSREP , wsrep_high_priority @@ -9518,6 +9537,26 @@ sql_kill_user(THD *thd, LEX_USER *user, killed_state state) { uint error; ha_rows rows; +#ifdef WITH_WSREP + if (WSREP(thd)) + { + if (!(thd->variables.option_bits & OPTION_GTID_BEGIN)) + { + WSREP_DEBUG("implicit commit before KILL"); + /* Commit the normal transaction if one is active. */ + bool commit_failed= trans_commit_implicit(thd); + /* Release metadata locks acquired in this transaction. */ + thd->release_transactional_locks(); + if (commit_failed || wsrep_after_statement(thd)) + { + WSREP_DEBUG("implicit commit failed, MDL released: %lld", + (longlong) thd->thread_id); + return; + } + thd->transaction->stmt.mark_trans_did_ddl(); + } + } +#endif /* WITH_WSREP */ switch (error= kill_threads_for_user(thd, user, state, &rows)) { case 0: diff --git a/sql/sql_priv.h b/sql/sql_priv.h index 9e47af841f9..5eaa3c92efb 100644 --- a/sql/sql_priv.h +++ b/sql/sql_priv.h @@ -280,6 +280,7 @@ #define OPTIMIZER_ADJ_DISABLE_FORCE_INDEX_GROUP_BY (4) #define OPTIMIZER_FIX_INNODB_CARDINALITY (8) #define OPTIMIZER_ADJ_FIX_REUSE_RANGE_FOR_REF (16) +#define OPTIMIZER_ADJ_FIX_CARD_MULT (32) /* Replication uses 8 bytes to store SQL_MODE in the binary log. The day you diff --git a/sql/sql_select.cc b/sql/sql_select.cc index f7bfe6d9892..8ac966e1056 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8121,6 +8121,30 @@ double hash_join_fanout(JOIN *join, JOIN_TAB *s, table_map remaining_tables, } +#ifndef DBUG_OFF + +static char dbug_join_prefix_buf[256]; + +const char* dbug_print_join_prefix(const POSITION *join_positions, + uint idx, + JOIN_TAB *s) +{ + char *buf= dbug_join_prefix_buf; + String str(buf, sizeof(dbug_join_prefix_buf), &my_charset_bin); + str.length(0); + for (uint i=0; i!=idx; i++) + { + str.append(join_positions[i].table->table->alias); + str.append(','); + } + str.append(s->table->alias); + if (str.c_ptr_safe() == buf) + return buf; + else + return "Couldn't fit into buffer"; +} +#endif + /** Find the best access path for an extension of a partial execution plan and add this path to the plan. @@ -8144,6 +8168,14 @@ double hash_join_fanout(JOIN *join, JOIN_TAB *s, table_map remaining_tables, @param pos OUT Table access plan @param loose_scan_pos OUT Table plan that uses loosescan, or set cost to DBL_MAX if not possible. + @detail + Use this to print the current join prefix: + + dbug_print_join_prefix(join_positions, idx, s) + + Use this as breakpoint condition to stop at join prefix "t1,t2,t3": + + $_streq(dbug_print_join_prefix(join_positions, idx, s), "t1,t2,t3") @return None @@ -15309,13 +15341,6 @@ void JOIN_TAB::cleanup() delete filesort->select; delete filesort; filesort= NULL; - /* Skip non-existing derived tables/views result tables */ - if (table && - (table->s->tmp_table != INTERNAL_TMP_TABLE || table->is_created())) - { - table->file->ha_end_keyread(); - table->file->ha_index_or_rnd_end(); - } if (table) { table->file->ha_end_keyread(); @@ -15324,8 +15349,7 @@ void JOIN_TAB::cleanup() else table->file->ha_index_or_rnd_end(); preread_init_done= FALSE; - if (table->pos_in_table_list && - table->pos_in_table_list->jtbm_subselect) + if (table->pos_in_table_list && table->pos_in_table_list->jtbm_subselect) { if (table->pos_in_table_list->jtbm_subselect->is_jtbm_const_tab) { @@ -30460,6 +30484,18 @@ void st_select_lex::print_on_duplicate_key_clause(THD *thd, String *str, } } + +void st_select_lex::print_lock_type(String *str) +{ + if (select_lock == select_lock_type::IN_SHARE_MODE) + str->append(STRING_WITH_LEN(" lock in share mode")); + else if (select_lock == select_lock_type::FOR_UPDATE) + str->append(STRING_WITH_LEN(" for update")); + if (unlikely(skip_locked)) + str->append(STRING_WITH_LEN(" skip locked")); +} + + void st_select_lex::print(THD *thd, String *str, enum_query_type query_type) { DBUG_ASSERT(thd); @@ -30731,12 +30767,9 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type) print_limit(thd, str, query_type); // lock type - if (select_lock == select_lock_type::IN_SHARE_MODE) - str->append(STRING_WITH_LEN(" lock in share mode")); - else if (select_lock == select_lock_type::FOR_UPDATE) - str->append(STRING_WITH_LEN(" for update")); - if (unlikely(skip_locked)) - str->append(STRING_WITH_LEN(" skip locked")); + if (braces) /* no braces processed in + SELECT_LEX_UNIT::print_lock_from_the_last_select */ + print_lock_type(str); if ((sel_type == INSERT_CMD || sel_type == REPLACE_CMD) && thd->lex->update_list.elements) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 3b69a0190b6..55f708c6692 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -3943,6 +3943,33 @@ bool Column_definition::prepare_blob_field(THD *thd) { DBUG_ENTER("Column_definition::prepare_blob_field"); + if (real_field_type() == FIELD_TYPE_STRING && length > 1024) + { + DBUG_ASSERT(charset->mbmaxlen > 4); + /* + Convert long CHAR columns to VARCHAR. + CHAR has an octet length limit of 1024 bytes. + The code in Binlog_type_info_fixed_string::Binlog_type_info_fixed_string + relies on this limit. If octet length of a CHAR column is greater + than 1024, then it cannot write its metadata to binlog properly. + In case of the filename character set with mbmaxlen=5, + the maximum possible character length is 1024/5=204 characters. + Upgrade to VARCHAR if octet length is greater than 1024. + */ + char warn_buff[MYSQL_ERRMSG_SIZE]; + if (thd->is_strict_mode()) + { + my_error(ER_TOO_BIG_FIELDLENGTH, MYF(0), field_name.str, + static_cast(1024 / charset->mbmaxlen)); + DBUG_RETURN(1); + } + set_handler(&type_handler_varchar); + my_snprintf(warn_buff, sizeof(warn_buff), ER_THD(thd, ER_AUTO_CONVERT), + field_name.str, "CHAR", "VARCHAR"); + push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_AUTO_CONVERT, + warn_buff); + } + if (length > MAX_FIELD_VARCHARLENGTH && !(flags & BLOB_FLAG)) { /* Convert long VARCHAR columns to TEXT or BLOB */ @@ -9292,18 +9319,20 @@ static Create_field *get_field_by_old_name(Alter_info *alter_info, enum fk_column_change_type { FK_COLUMN_NO_CHANGE, FK_COLUMN_DATA_CHANGE, - FK_COLUMN_RENAMED, FK_COLUMN_DROPPED + FK_COLUMN_RENAMED, FK_COLUMN_DROPPED, FK_COLUMN_NOT_NULL }; /** Check that ALTER TABLE's changes on columns of a foreign key are allowed. @param[in] thd Thread context. + @param[in] table table to be altered @param[in] alter_info Alter_info describing changes to be done by ALTER TABLE. - @param[in] fk_columns List of columns of the foreign key to check. + @param[in] fk Foreign key information. @param[out] bad_column_name Name of field on which ALTER TABLE tries to do prohibited operation. + @param[in] referenced Check the referenced fields @note This function takes into account value of @@foreign_key_checks setting. @@ -9314,17 +9343,27 @@ enum fk_column_change_type change in foreign key column. @retval FK_COLUMN_RENAMED Foreign key column is renamed. @retval FK_COLUMN_DROPPED Foreign key column is dropped. + @retval FK_COLUMN_NOT_NULL Foreign key column cannot be null + if ON...SET NULL or ON UPDATE + CASCADE conflicts with NOT NULL */ static enum fk_column_change_type -fk_check_column_changes(THD *thd, Alter_info *alter_info, - List &fk_columns, - const char **bad_column_name) +fk_check_column_changes(THD *thd, const TABLE *table, + Alter_info *alter_info, + FOREIGN_KEY_INFO *fk, + const char **bad_column_name, + bool referenced=false) { + List &fk_columns= referenced + ? fk->referenced_fields + : fk->foreign_fields; List_iterator_fast column_it(fk_columns); LEX_CSTRING *column; + int n_col= 0; *bad_column_name= NULL; + enum fk_column_change_type result= FK_COLUMN_NO_CHANGE; while ((column= column_it++)) { @@ -9343,8 +9382,8 @@ fk_check_column_changes(THD *thd, Alter_info *alter_info, SE that foreign keys should be updated to use new name of column like it happens in case of in-place algorithm. */ - *bad_column_name= column->str; - return FK_COLUMN_RENAMED; + result= FK_COLUMN_RENAMED; + goto func_exit; } /* @@ -9357,17 +9396,55 @@ fk_check_column_changes(THD *thd, Alter_info *alter_info, new_field->flags&= ~AUTO_INCREMENT_FLAG; const bool equal_result= old_field->is_equal(*new_field); new_field->flags= flags; + const bool old_field_not_null= old_field->flags & NOT_NULL_FLAG; + const bool new_field_not_null= new_field->flags & NOT_NULL_FLAG; - if ((equal_result == IS_EQUAL_NO) || - ((new_field->flags & NOT_NULL_FLAG) && - !(old_field->flags & NOT_NULL_FLAG))) + if ((equal_result == IS_EQUAL_NO)) { /* Column in a FK has changed significantly and it may break referential intergrity. */ - *bad_column_name= column->str; - return FK_COLUMN_DATA_CHANGE; + result= FK_COLUMN_DATA_CHANGE; + goto func_exit; + } + + if (old_field_not_null != new_field_not_null) + { + if (referenced && !new_field_not_null) + { + /* + Don't allow referenced column to change from + NOT NULL to NULL when foreign key relation is + ON UPDATE CASCADE and the referencing column + is declared as NOT NULL + */ + if (fk->update_method == FK_OPTION_CASCADE && + !fk->is_nullable(false, n_col)) + { + result= FK_COLUMN_DATA_CHANGE; + goto func_exit; + } + } + else if (!referenced && new_field_not_null) + { + /* + Don't allow the foreign column to change + from NULL to NOT NULL when foreign key type is + 1) UPDATE SET NULL + 2) DELETE SET NULL + 3) UPDATE CASCADE and referenced column is declared as NULL + */ + if (fk->update_method == FK_OPTION_SET_NULL || + fk->delete_method == FK_OPTION_SET_NULL || + (fk->update_method == FK_OPTION_CASCADE && + fk->referenced_key_name && + fk->is_nullable(true, n_col))) + { + result= FK_COLUMN_NOT_NULL; + goto func_exit; + } + } } } else @@ -9381,12 +9458,15 @@ fk_check_column_changes(THD *thd, Alter_info *alter_info, field being dropped since it is easy to break referential integrity in this case. */ - *bad_column_name= column->str; - return FK_COLUMN_DROPPED; + result= FK_COLUMN_DROPPED; + goto func_exit; } + n_col++; } - return FK_COLUMN_NO_CHANGE; +func_exit: + *bad_column_name= column->str; + return result; } @@ -9478,9 +9558,8 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table, enum fk_column_change_type changes; const char *bad_column_name; - changes= fk_check_column_changes(thd, alter_info, - f_key->referenced_fields, - &bad_column_name); + changes= fk_check_column_changes(thd, table, alter_info, f_key, + &bad_column_name, true); switch(changes) { @@ -9514,6 +9593,9 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table, f_key->foreign_id->str, buff.c_ptr()); DBUG_RETURN(true); } + /* FK_COLUMN_NOT_NULL error happens only when changing + the foreign key column from NULL to NOT NULL */ + case FK_COLUMN_NOT_NULL: default: DBUG_ASSERT(0); } @@ -9552,8 +9634,7 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table, enum fk_column_change_type changes; const char *bad_column_name; - changes= fk_check_column_changes(thd, alter_info, - f_key->foreign_fields, + changes= fk_check_column_changes(thd, table, alter_info, f_key, &bad_column_name); switch(changes) @@ -9575,6 +9656,10 @@ static bool fk_prepare_copy_alter_table(THD *thd, TABLE *table, my_error(ER_FK_COLUMN_CANNOT_DROP, MYF(0), bad_column_name, f_key->foreign_id->str); DBUG_RETURN(true); + case FK_COLUMN_NOT_NULL: + my_error(ER_FK_COLUMN_NOT_NULL, MYF(0), bad_column_name, + f_key->foreign_id->str); + DBUG_RETURN(true); default: DBUG_ASSERT(0); } diff --git a/sql/sql_type.cc b/sql/sql_type.cc index 8909b1bb44b..58ed64c3f9f 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -9264,6 +9264,7 @@ Type_handler_timestamp_common::Item_val_native_with_conversion(THD *thd, Datetime dt(thd, item, Datetime::Options(TIME_NO_ZERO_IN_DATE, thd)); return !dt.is_valid_datetime() || + dt.check_date(TIME_NO_ZERO_IN_DATE | TIME_NO_ZERO_DATE) || TIME_to_native(thd, dt.get_mysql_time(), to, item->datetime_precision(thd)); } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 1a5d2308213..93ff0ca1ca6 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1327,7 +1327,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); TEXT_STRING NCHAR_STRING json_text_literal - json_text_literal_or_num %type opt_table_alias_clause @@ -1524,6 +1523,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); simple_target_specification condition_number opt_versioning_interval_start + json_default_literal %type opt_vers_auto_part @@ -11304,40 +11304,13 @@ table_ref: json_text_literal: TEXT_STRING - { - Lex->json_table->m_text_literal_cs= NULL; - } | NCHAR_STRING - { - Lex->json_table->m_text_literal_cs= national_charset_info; - } | UNDERSCORE_CHARSET TEXT_STRING { - Lex->json_table->m_text_literal_cs= $1; $$= $2; } ; -json_text_literal_or_num: - json_text_literal - | NUM - { - Lex->json_table->m_text_literal_cs= NULL; - } - | LONG_NUM - { - Lex->json_table->m_text_literal_cs= NULL; - } - | DECIMAL_NUM - { - Lex->json_table->m_text_literal_cs= NULL; - } - | FLOAT_NUM - { - Lex->json_table->m_text_literal_cs= NULL; - } - ; - join_table_list: derived_table_list { MYSQL_YYABORT_UNLESS($$=$1); } ; @@ -11446,6 +11419,12 @@ json_opt_on_empty_or_error: | json_on_empty_response json_on_error_response ; +json_default_literal: + literal + | signed_literal + ; + + json_on_response: ERROR_SYM { @@ -11455,12 +11434,10 @@ json_on_response: { $$.m_response= Json_table_column::RESPONSE_NULL; } - | DEFAULT json_text_literal_or_num + | DEFAULT json_default_literal { $$.m_response= Json_table_column::RESPONSE_DEFAULT; $$.m_default= $2; - Lex->json_table->m_cur_json_table_column->m_defaults_cs= - thd->variables.collation_connection; } ; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 25ee0016991..b66afb3f54a 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2097,15 +2097,6 @@ struct gtid_binlog_state_data { rpl_gtid *list; uint32 list_len; }; bool Sys_var_gtid_binlog_state::do_check(THD *thd, set_var *var) { - String str, *res; - struct gtid_binlog_state_data *data; - rpl_gtid *list; - uint32 list_len; - - DBUG_ASSERT(var->type == OPT_GLOBAL); - - if (!(res= var->value->val_str(&str))) - return true; if (thd->in_active_multi_stmt_transaction()) { my_error(ER_CANT_DO_THIS_DURING_AN_TRANSACTION, MYF(0)); @@ -2121,6 +2112,31 @@ Sys_var_gtid_binlog_state::do_check(THD *thd, set_var *var) my_error(ER_BINLOG_MUST_BE_EMPTY, MYF(0)); return true; } + return false; +} + + +bool +Sys_var_gtid_binlog_state::global_update(THD *thd, set_var *var) +{ + DBUG_ASSERT(var->type == OPT_GLOBAL); + + if (!var->value) + { + my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str); + return true; + } + + bool result; + String str, *res; + struct gtid_binlog_state_data *data; + rpl_gtid *list; + uint32 list_len; + + DBUG_ASSERT(var->type == OPT_GLOBAL); + + if (!(res= var->value->val_str(&str))) + return true; if (res->length() == 0) { list= NULL; @@ -2142,31 +2158,13 @@ Sys_var_gtid_binlog_state::do_check(THD *thd, set_var *var) data->list= list; data->list_len= list_len; var->save_result.ptr= data; - return false; -} - - -bool -Sys_var_gtid_binlog_state::global_update(THD *thd, set_var *var) -{ - bool res; - - DBUG_ASSERT(var->type == OPT_GLOBAL); - - if (!var->value) - { - my_error(ER_NO_DEFAULT, MYF(0), var->var->name.str); - return true; - } - - struct gtid_binlog_state_data *data= - (struct gtid_binlog_state_data *)var->save_result.ptr; + mysql_mutex_unlock(&LOCK_global_system_variables); - res= (reset_master(thd, data->list, data->list_len, 0) != 0); + result= (reset_master(thd, data->list, data->list_len, 0) != 0); mysql_mutex_lock(&LOCK_global_system_variables); my_free(data->list); my_free(data); - return res; + return result; } @@ -2959,7 +2957,8 @@ static Sys_var_ulong Sys_optimizer_trace_max_mem_size( static const char *adjust_secondary_key_cost[]= { "adjust_secondary_key_cost", "disable_max_seek", "disable_forced_index_in_group_by", - "fix_innodb_cardinality", "fix_reuse_range_for_ref", 0 + "fix_innodb_cardinality", "fix_reuse_range_for_ref", + "fix_card_multiplier", 0 }; @@ -2976,6 +2975,9 @@ static Sys_var_set Sys_optimizer_adjust_secondary_key_costs( "secondary keys. " "fix_reuse_range_for_ref = Do a better job at reusing range access estimates " "when estimating ref access. " + "fix_card_multiplier = Fix the computation in selectivity_for_indexes." + " selectivity_multiplier. " + "This variable will be deleted in MariaDB 11.0 as it is not needed with the " "new 11.0 optimizer.", SESSION_VAR(optimizer_adjust_secondary_key_costs), CMD_LINE(REQUIRED_ARG), @@ -4140,7 +4142,8 @@ static Sys_var_on_access_global Sys_threadpool_mode( "thread_pool_mode", - "Chose implementation of the threadpool", + "Chose implementation of the threadpool. Use 'windows' unless you have a " + "workload with a lot of concurrent connections and minimal contention", READ_ONLY GLOBAL_VAR(threadpool_mode), CMD_LINE(REQUIRED_ARG), threadpool_mode_names, DEFAULT(TP_MODE_WINDOWS) ); diff --git a/sql/table.h b/sql/table.h index 5f4f59c3426..4f54b59c68c 100644 --- a/sql/table.h +++ b/sql/table.h @@ -36,6 +36,7 @@ #include "sql_i_s.h" #include "sql_type.h" /* vers_kind_t */ #include "privilege.h" /* privilege_t */ +#include "my_bit.h" /* Buffer for unix timestamp in microseconds: @@ -1912,6 +1913,70 @@ typedef struct st_foreign_key_info LEX_CSTRING *referenced_key_name; List foreign_fields; List referenced_fields; +private: + unsigned char *fields_nullable= nullptr; + + /** + Get the number of fields exist in foreign key relationship + */ + unsigned get_n_fields() const noexcept + { + unsigned n_fields= foreign_fields.elements; + if (n_fields == 0) + n_fields= referenced_fields.elements; + return n_fields; + } + + /** + Assign nullable field for referenced and foreign fields + based on number of fields. This nullable fields + should be allocated by engine for passing the + foreign key information + @param thd thread to allocate the memory + @param num_fields number of fields + */ + void assign_nullable(THD *thd, unsigned num_fields) noexcept + { + fields_nullable= + (unsigned char *)thd_calloc(thd, + my_bits_in_bytes(2 * num_fields)); + } + +public: + /** + Set nullable bit for the field in the given field + @param referenced set null bit for referenced column + @param field field number + @param n_fields number of fields + */ + void set_nullable(THD *thd, bool referenced, + unsigned field, unsigned n_fields) noexcept + { + if (!fields_nullable) + assign_nullable(thd, n_fields); + DBUG_ASSERT(fields_nullable); + DBUG_ASSERT(field < n_fields); + size_t bit= size_t{field} + referenced * n_fields; + fields_nullable[bit / 8]|= (unsigned char)(1 << (bit % 8)); + } + + /** + Check whether the given field_no in foreign key field or + referenced key field + @param referenced check referenced field nullable value + @param field field number + @return true if the field is nullable or false if it is not + */ + bool is_nullable(bool referenced, unsigned field) const noexcept + { + if (!fields_nullable) + return false; + unsigned n_field= get_n_fields(); + DBUG_ASSERT(field < n_field); + size_t bit= size_t{field} + referenced * n_field; + return fields_nullable[bit / 8] & (1 << (bit % 8)); + } + } FOREIGN_KEY_INFO; LEX_CSTRING *fk_option_name(enum_fk_option opt); diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index 22730550d1b..0e45c6757f1 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -304,7 +304,7 @@ static THD *threadpool_add_connection(CONNECT *connect, TP_connection *c) if (!mysys_var ||!(thd= connect->create_thd(NULL))) { /* Out of memory? */ - connect->close_and_delete(); + connect->close_and_delete(0); if (mysys_var) my_thread_end(); return NULL; @@ -497,7 +497,7 @@ static void tp_add_connection(CONNECT *connect) if (c) pool->add(c); else - connect->close_and_delete(); + connect->close_and_delete(0); } int tp_get_idle_thread_count() diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 1c77f1d626c..a1172919842 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -271,8 +271,8 @@ static char provider_vendor[256]= { 0, }; * Wsrep status variables. LOCK_status must be locked When modifying * these variables, */ +std::atomic wsrep_ready(false); my_bool wsrep_connected = FALSE; -my_bool wsrep_ready = FALSE; const char* wsrep_cluster_state_uuid= cluster_uuid_str; long long wsrep_cluster_conf_id = WSREP_SEQNO_UNDEFINED; const char* wsrep_cluster_status = "Disconnected"; @@ -578,10 +578,7 @@ void wsrep_verify_SE_checkpoint(const wsrep_uuid_t& uuid, */ my_bool wsrep_ready_get (void) { - if (mysql_mutex_lock (&LOCK_wsrep_ready)) abort(); - my_bool ret= wsrep_ready; - mysql_mutex_unlock (&LOCK_wsrep_ready); - return ret; + return wsrep_ready; } int wsrep_show_ready(THD *thd, SHOW_VAR *var, void *buff, @@ -3906,6 +3903,10 @@ bool wsrep_consistency_check(THD *thd) // Wait until wsrep has reached ready state void wsrep_wait_ready(THD *thd) { + // First check not locking the mutex. + if (wsrep_ready) + return; + mysql_mutex_lock(&LOCK_wsrep_ready); while(!wsrep_ready) { diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 14ea07f4ea6..183dc65b007 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -147,7 +147,6 @@ extern const char *wsrep_SR_store_types[]; // MySQL status variables extern my_bool wsrep_connected; -extern my_bool wsrep_ready; extern const char* wsrep_cluster_state_uuid; extern long long wsrep_cluster_conf_id; extern const char* wsrep_cluster_status; diff --git a/sql/wsrep_server_state.cc b/sql/wsrep_server_state.cc index 1edcaeb8c70..f6a4ec4ccbf 100644 --- a/sql/wsrep_server_state.cc +++ b/sql/wsrep_server_state.cc @@ -101,7 +101,7 @@ void Wsrep_server_state::deinit_provider_services() void Wsrep_server_state::handle_fatal_signal() { - if (m_instance) + if (m_instance && m_instance->is_provider_loaded()) { /* Galera background threads are still running and the logging may be relatively verbose in case of networking error. Silence all wsrep diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 4cba1e2e013..23bda4d54d4 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -648,8 +648,8 @@ static void* sst_joiner_thread (void* a) if (!tmp || strlen(tmp) < (magic_len + 2) || strncasecmp (tmp, magic, magic_len)) { - WSREP_ERROR("Failed to read '%s ' from: %s\n\tRead: '%s'", - magic, arg->cmd, tmp); + WSREP_ERROR("Failed to read '%s ' (got '%s') from: %s", + magic, tmp, arg->cmd); proc.wait(); if (proc.error()) err= proc.error(); } @@ -661,8 +661,8 @@ static void* sst_joiner_thread (void* a) else { err= proc.error(); - WSREP_ERROR("Failed to execute: %s : %d (%s)", - arg->cmd, err, strerror(err)); + WSREP_ERROR("Failed to execute (%M): %s", + err, arg->cmd); } /* diff --git a/storage/connect/mysql-test/connect/t/bson_udf.test b/storage/connect/mysql-test/connect/t/bson_udf.test index 0da2de38864..584f8f25554 100644 --- a/storage/connect/mysql-test/connect/t/bson_udf.test +++ b/storage/connect/mysql-test/connect/t/bson_udf.test @@ -19,7 +19,10 @@ SELECT BsonValue(9223372036854775807); SELECT BsonValue(NULL); SELECT BsonValue(TRUE); SELECT BsonValue(FALSE); +#Check after fix MDEV-31587 +--disable_cursor_protocol SELECT BsonValue(); +--enable_cursor_protocol SELECT BsonValue('[11, 22, 33]' json_) FROM t1; # SELECT Bson_Make_Array(); diff --git a/storage/connect/mysql-test/connect/t/json_udf.test b/storage/connect/mysql-test/connect/t/json_udf.test index 96fe836e60b..82afd030f75 100644 --- a/storage/connect/mysql-test/connect/t/json_udf.test +++ b/storage/connect/mysql-test/connect/t/json_udf.test @@ -19,7 +19,10 @@ SELECT JsonValue(9223372036854775807); SELECT JsonValue(NULL); SELECT JsonValue(TRUE); SELECT JsonValue(FALSE); +#Check after fix MDEV-31587 +--disable_cursor_protocol SELECT JsonValue(); +--enable_cursor_protocol SELECT JsonValue('[11, 22, 33]' json_) FROM t1; # SELECT Json_Make_Array(); @@ -60,7 +63,10 @@ SELECT Json_Make_Object(56, 3.1416, 'foo', NULL); SELECT Json_Make_Object(56 qty, 3.1416 price, 'foo' truc, NULL garanty); SELECT Json_Make_Object(); SELECT Json_Make_Object(Json_Make_Array(56, 3.1416, 'foo'), NULL); +# Enable after fix MDEV-31554 +--disable_cursor_protocol SELECT Json_Make_Array(Json_Make_Object(56 "qty", 3.1416 "price", 'foo') ,NULL); +--enable_cursor_protocol SELECT Json_Object_Key('qty', 56, 'price', 3.1416, 'truc', 'machin', 'garanty', NULL); --error ER_CANT_INITIALIZE_UDF SELECT Json_Object_Key('qty', 56, 'price', 3.1416, 'truc', 'machin', 'garanty'); diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp index 037a465af13..05799cb3d87 100644 --- a/storage/connect/tabfmt.cpp +++ b/storage/connect/tabfmt.cpp @@ -93,7 +93,7 @@ PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info) char sep, q; int rc, mxr; bool hdr; - char *p, *colname[MAXCOL], dechar, buf[8]; + char *p, *colname[MAXCOL], dechar, buf[16]; int i, imax, hmax, n, nerr, phase, blank, digit, dec, type; int ncol = sizeof(buftyp) / sizeof(int); int num_read = 0, num_max = 10000000; // Statistics diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc index e9b7d84a703..4111fad3844 100644 --- a/storage/csv/ha_tina.cc +++ b/storage/csv/ha_tina.cc @@ -333,7 +333,7 @@ static int read_meta_file(File meta_file, ha_rows *rows) /* check crashed bit and magic number */ if ((meta_buffer[0] != (uchar)TINA_CHECK_HEADER) || ((bool)(*ptr)== TRUE)) - DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE); + DBUG_RETURN(my_errno= HA_ERR_CRASHED_ON_USAGE); mysql_file_sync(meta_file, MYF(MY_WME)); @@ -974,7 +974,7 @@ int ha_tina::open(const char *name, int mode, uint open_options) if (share->crashed && !(open_options & HA_OPEN_FOR_REPAIR)) { free_share(share); - DBUG_RETURN(my_errno ? my_errno : HA_ERR_CRASHED_ON_USAGE); + DBUG_RETURN(my_errno); } local_data_file_version= share->data_file_version; diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index 1d47c46d583..e01e600ed41 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -1709,8 +1709,8 @@ dict_foreigns_has_s_base_col( foreign = *it; ulint type = foreign->type; - type &= ~(DICT_FOREIGN_ON_DELETE_NO_ACTION - | DICT_FOREIGN_ON_UPDATE_NO_ACTION); + type &= ~(foreign->DELETE_NO_ACTION + | foreign->UPDATE_NO_ACTION); if (type == 0) { continue; @@ -1756,8 +1756,10 @@ dict_create_add_foreigns_to_dictionary( } for (auto fk : local_fk_set) - if (dberr_t error= - dict_create_add_foreign_to_dictionary(table->name.m_name, fk, trx)) + if (!fk->check_fk_constraint_valid()) + return DB_CANNOT_ADD_CONSTRAINT; + else if (dberr_t error= dict_create_add_foreign_to_dictionary + (table->name.m_name, fk, trx)) return error; return DB_SUCCESS; diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 6de10bb3d1b..48a90f24754 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -955,7 +955,7 @@ void dict_sys_t::create() } -void dict_sys_t::lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) +void dict_sys_t::lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept { ulonglong now= my_hrtime_coarse().val, old= 0; if (latch_ex_wait_start.compare_exchange_strong @@ -981,17 +981,17 @@ void dict_sys_t::lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) } #ifdef UNIV_PFS_RWLOCK -ATTRIBUTE_NOINLINE void dict_sys_t::unlock() +ATTRIBUTE_NOINLINE void dict_sys_t::unlock() noexcept { latch.wr_unlock(); } -ATTRIBUTE_NOINLINE void dict_sys_t::freeze(const char *file, unsigned line) +ATTRIBUTE_NOINLINE void dict_sys_t::freeze(const char *file, unsigned line) noexcept { latch.rd_lock(file, line); } -ATTRIBUTE_NOINLINE void dict_sys_t::unfreeze() +ATTRIBUTE_NOINLINE void dict_sys_t::unfreeze() noexcept { latch.rd_unlock(); } @@ -2967,8 +2967,8 @@ dict_foreign_add_to_cache( for_in_cache->n_fields, for_in_cache->referenced_index, check_charsets, for_in_cache->type - & (DICT_FOREIGN_ON_DELETE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_SET_NULL)); + & (foreign->DELETE_SET_NULL + | foreign->UPDATE_SET_NULL)); if (index == NULL && !(ignore_err & DICT_ERR_IGNORE_FK_NOKEY)) { @@ -3933,27 +3933,27 @@ dict_print_info_on_foreign_key_in_create_format(const trx_t *trx, str.append(")"); - if (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE) { + if (foreign->type & foreign->DELETE_CASCADE) { str.append(" ON DELETE CASCADE"); } - if (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) { + if (foreign->type & foreign->DELETE_SET_NULL) { str.append(" ON DELETE SET NULL"); } - if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + if (foreign->type & foreign->DELETE_NO_ACTION) { str.append(" ON DELETE NO ACTION"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) { + if (foreign->type & foreign->UPDATE_CASCADE) { str.append(" ON UPDATE CASCADE"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) { + if (foreign->type & foreign->UPDATE_SET_NULL) { str.append(" ON UPDATE SET NULL"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + if (foreign->type & foreign->UPDATE_NO_ACTION) { str.append(" ON UPDATE NO ACTION"); } @@ -4016,27 +4016,27 @@ dict_print_info_on_foreign_keys( str.append(")"); - if (foreign->type == DICT_FOREIGN_ON_DELETE_CASCADE) { + if (foreign->type == foreign->DELETE_CASCADE) { str.append(" ON DELETE CASCADE"); } - if (foreign->type == DICT_FOREIGN_ON_DELETE_SET_NULL) { + if (foreign->type == foreign->DELETE_SET_NULL) { str.append(" ON DELETE SET NULL"); } - if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + if (foreign->type & foreign->DELETE_NO_ACTION) { str.append(" ON DELETE NO ACTION"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) { + if (foreign->type & foreign->UPDATE_CASCADE) { str.append(" ON UPDATE CASCADE"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) { + if (foreign->type & foreign->UPDATE_SET_NULL) { str.append(" ON UPDATE SET NULL"); } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + if (foreign->type & foreign->UPDATE_NO_ACTION) { str.append(" ON UPDATE NO ACTION"); } } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 9acbd538d78..461c9fba404 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -10141,8 +10141,8 @@ wsrep_append_key( static bool referenced_by_foreign_key2( /*=======================*/ - dict_table_t* table, - dict_index_t* index) + const dict_table_t* table, + const dict_index_t* index) noexcept { ut_ad(table != NULL); ut_ad(index != NULL); @@ -12615,13 +12615,13 @@ create_table_info_t::create_foreign_keys() case FK_OPTION_RESTRICT: break; case FK_OPTION_CASCADE: - foreign->type |= DICT_FOREIGN_ON_DELETE_CASCADE; + foreign->type |= foreign->DELETE_CASCADE; break; case FK_OPTION_SET_NULL: - foreign->type |= DICT_FOREIGN_ON_DELETE_SET_NULL; + foreign->type |= foreign->DELETE_SET_NULL; break; case FK_OPTION_NO_ACTION: - foreign->type |= DICT_FOREIGN_ON_DELETE_NO_ACTION; + foreign->type |= foreign->DELETE_NO_ACTION; break; case FK_OPTION_SET_DEFAULT: // TODO: MDEV-10393 Foreign keys SET DEFAULT action @@ -12636,13 +12636,13 @@ create_table_info_t::create_foreign_keys() case FK_OPTION_RESTRICT: break; case FK_OPTION_CASCADE: - foreign->type |= DICT_FOREIGN_ON_UPDATE_CASCADE; + foreign->type |= foreign->UPDATE_CASCADE; break; case FK_OPTION_SET_NULL: - foreign->type |= DICT_FOREIGN_ON_UPDATE_SET_NULL; + foreign->type |= foreign->UPDATE_SET_NULL; break; case FK_OPTION_NO_ACTION: - foreign->type |= DICT_FOREIGN_ON_UPDATE_NO_ACTION; + foreign->type |= foreign->UPDATE_NO_ACTION; break; case FK_OPTION_SET_DEFAULT: // TODO: MDEV-10393 Foreign keys SET DEFAULT action @@ -15527,28 +15527,43 @@ get_foreign_key_info( name = thd_make_lex_string(thd, name, ptr, strlen(ptr), 1); f_key_info.foreign_fields.push_back(name); + + if (dict_index_t* fidx = foreign->foreign_index) { + if (fidx->fields[i].col->is_nullable()) { + f_key_info.set_nullable(thd, false, i, + foreign->n_fields); + } + } ptr = foreign->referenced_col_names[i]; name = thd_make_lex_string(thd, name, ptr, strlen(ptr), 1); f_key_info.referenced_fields.push_back(name); + + if (dict_index_t* ref_idx = foreign->referenced_index) { + if (ref_idx->fields[i].col->is_nullable()) { + f_key_info.set_nullable(thd, true, i, + foreign->n_fields); + } + } + } while (++i < foreign->n_fields); - if (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE) { + if (foreign->type & foreign->DELETE_CASCADE) { f_key_info.delete_method = FK_OPTION_CASCADE; - } else if (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) { + } else if (foreign->type & foreign->DELETE_SET_NULL) { f_key_info.delete_method = FK_OPTION_SET_NULL; - } else if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION) { + } else if (foreign->type & foreign->DELETE_NO_ACTION) { f_key_info.delete_method = FK_OPTION_NO_ACTION; } else { f_key_info.delete_method = FK_OPTION_RESTRICT; } - if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE) { + if (foreign->type & foreign->UPDATE_CASCADE) { f_key_info.update_method = FK_OPTION_CASCADE; - } else if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL) { + } else if (foreign->type & foreign->UPDATE_SET_NULL) { f_key_info.update_method = FK_OPTION_SET_NULL; - } else if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION) { + } else if (foreign->type & foreign->UPDATE_NO_ACTION) { f_key_info.update_method = FK_OPTION_NO_ACTION; } else { f_key_info.update_method = FK_OPTION_RESTRICT; @@ -15689,14 +15704,12 @@ bool ha_innobase::can_switch_engines() m_prebuilt->table->referenced_set.empty()); } -/*******************************************************************//** -Checks if a table is referenced by a foreign key. The MySQL manual states that -a REPLACE is either equivalent to an INSERT, or DELETE(s) + INSERT. Only a +/** Checks if a table is referenced by a foreign key. The MySQL manual states +that a REPLACE is either equivalent to an INSERT, or DELETE(s) + INSERT. Only a delete is then allowed internally to resolve a duplicate key conflict in REPLACE, not an update. -@return > 0 if referenced by a FOREIGN KEY */ - -uint ha_innobase::referenced_by_foreign_key() +@return whether the table is referenced by a FOREIGN KEY */ +bool ha_innobase::referenced_by_foreign_key() const noexcept { dict_sys.freeze(SRW_LOCK_CALL); const bool empty= m_prebuilt->table->referenced_set.empty(); @@ -16212,10 +16225,10 @@ ha_innobase::external_lock( } DBUG_RETURN(0); - } else { - DEBUG_SYNC_C("ha_innobase_end_statement"); } + DEBUG_SYNC_C("ha_innobase_end_statement"); + /* MySQL is releasing a table lock */ trx->n_mysql_tables_in_use--; @@ -16242,14 +16255,6 @@ ha_innobase::external_lock( } } - if (!trx_is_started(trx) - && lock_type != F_UNLCK - && (m_prebuilt->select_lock_type != LOCK_NONE - || m_prebuilt->stored_select_lock_type != LOCK_NONE)) { - - trx->will_lock = true; - } - DBUG_RETURN(0); } diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 40396564589..a6d42bb9a43 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -224,7 +224,7 @@ public: bool can_switch_engines() override; - uint referenced_by_foreign_key() override; + bool referenced_by_foreign_key() const noexcept override; void free_foreign_key_create_info(char* str) override { my_free(str); } diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 7cfce490cef..9ed2d5c8e95 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -2961,8 +2961,8 @@ innobase_check_fk_option( return(true); } - if (foreign->type & (DICT_FOREIGN_ON_UPDATE_SET_NULL - | DICT_FOREIGN_ON_DELETE_SET_NULL)) { + if (foreign->type & (foreign->UPDATE_SET_NULL + | foreign->DELETE_SET_NULL)) { for (ulint j = 0; j < foreign->n_fields; j++) { if ((dict_index_get_nth_col( @@ -2997,13 +2997,13 @@ innobase_set_foreign_key_option( case FK_OPTION_NO_ACTION: case FK_OPTION_RESTRICT: case FK_OPTION_SET_DEFAULT: - foreign->type = DICT_FOREIGN_ON_DELETE_NO_ACTION; + foreign->type = foreign->DELETE_NO_ACTION; break; case FK_OPTION_CASCADE: - foreign->type = DICT_FOREIGN_ON_DELETE_CASCADE; + foreign->type = foreign->DELETE_CASCADE; break; case FK_OPTION_SET_NULL: - foreign->type = DICT_FOREIGN_ON_DELETE_SET_NULL; + foreign->type = foreign->DELETE_SET_NULL; break; case FK_OPTION_UNDEF: break; @@ -3013,13 +3013,13 @@ innobase_set_foreign_key_option( case FK_OPTION_NO_ACTION: case FK_OPTION_RESTRICT: case FK_OPTION_SET_DEFAULT: - foreign->type |= DICT_FOREIGN_ON_UPDATE_NO_ACTION; + foreign->type |= foreign->UPDATE_NO_ACTION; break; case FK_OPTION_CASCADE: - foreign->type |= DICT_FOREIGN_ON_UPDATE_CASCADE; + foreign->type |= foreign->UPDATE_CASCADE; break; case FK_OPTION_SET_NULL: - foreign->type |= DICT_FOREIGN_ON_UPDATE_SET_NULL; + foreign->type |= foreign->UPDATE_SET_NULL; break; case FK_OPTION_UNDEF: break; @@ -3170,8 +3170,8 @@ innobase_check_fk_stored( { ulint type = foreign->type; - type &= ~(DICT_FOREIGN_ON_DELETE_NO_ACTION - | DICT_FOREIGN_ON_UPDATE_NO_ACTION); + type &= ~(foreign->DELETE_NO_ACTION + | foreign->UPDATE_NO_ACTION); if (type == 0 || s_cols == NULL) { return(false); @@ -4423,103 +4423,157 @@ innobase_dropping_foreign( return(false); } -/** Determines if an InnoDB FOREIGN KEY constraint depends on a -column that is being dropped or modified to NOT NULL. +/** Determines if an InnoDB FOREIGN KEY constraint depends on +the nullability changes of a column. +Enforce the following rules: + +i) Don't allow the referencing column from NULL TO NOT NULL when + 1) Foreign key constraint type is ON UPDATE SET NULL + 2) Foreign key constraint type is ON DELETE SET NULL + 3) Foreign key constraint type is UPDATE CASCADE and referenced + column declared as NULL + +ii) Don't allow the referenced column from NOT NULL to NULL when +foreign key constraint type is UPDATE CASCADE and referencing column +declared as NOT NULL + @param user_table InnoDB table as it is before the ALTER operation -@param col_name Name of the column being altered @param drop_fk constraints being dropped @param n_drop_fk number of constraints that are being dropped -@param drop true=drop column, false=set NOT NULL +@param col_name modified column name +@param new_field_flags Modified field flags @retval true Not allowed (will call my_error()) @retval false Allowed */ -MY_ATTRIBUTE((pure, nonnull(1,4), warn_unused_result)) static -bool -innobase_check_foreigns_low( - const dict_table_t* user_table, - dict_foreign_t** drop_fk, - ulint n_drop_fk, - const char* col_name, - bool drop) +bool check_foreigns_nullability(const dict_table_t *user_table, + dict_foreign_t **drop_fk, ulint n_drop_fk, + const char *col_name, uint32_t new_field_flags) { - dict_foreign_t* foreign; - ut_ad(dict_sys.locked()); + ut_ad(dict_sys.locked()); - /* Check if any FOREIGN KEY constraints are defined on this - column. */ + /* Changing from NULL to NOT NULL. So check referenced set */ + if (new_field_flags & NOT_NULL_FLAG) + { + for (dict_foreign_t *foreign : user_table->foreign_set) + { + if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) + continue; - for (dict_foreign_set::const_iterator it = user_table->foreign_set.begin(); - it != user_table->foreign_set.end(); - ++it) { + if (foreign->on_update_cascade_null(col_name)) + goto non_null_error; - foreign = *it; + if (foreign->type & (foreign->DELETE_SET_NULL | + foreign->UPDATE_SET_NULL)) + { + if (foreign->foreign_index + && foreign->col_fk_exists(col_name) != UINT_MAX) + { +non_null_error: + const char* fid = strchr(foreign->id, '/'); + fid= fid ? fid + 1 : foreign->id; + my_error(ER_FK_COLUMN_NOT_NULL, MYF(0), col_name, fid); + return true; + } + } + } + } + else + { + for (dict_foreign_t *foreign : user_table->referenced_set) + { + if (foreign->on_update_cascade_not_null(col_name)) + { + char display_name[FN_REFLEN]; + const int dblen= int(table_name_t(const_cast(foreign-> + foreign_table_name)).dblen()); + char tbl_name[MAX_TABLE_NAME_LEN]; + uint errors; + ulint tbl_name_len= strlen(foreign->foreign_table_name) - dblen + 1; + strncpy(tbl_name, foreign->foreign_table_name + dblen + 1, + tbl_name_len); + tbl_name[tbl_name_len - 1]= '\0'; + innobase_convert_to_system_charset(tbl_name, + strchr(foreign->foreign_table_name, + '/') + 1, + MAX_TABLE_NAME_LEN, &errors); + if (errors) + { + strncpy(tbl_name, foreign->foreign_table_name + dblen + 1, + tbl_name_len); + tbl_name[tbl_name_len - 1]= '\0'; + } - if (!drop && !(foreign->type - & (DICT_FOREIGN_ON_DELETE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_SET_NULL))) { - continue; - } + my_snprintf(display_name, FN_REFLEN - 1, "%.*s.%s", + dblen, foreign->foreign_table_name, tbl_name); - if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) { - continue; - } + display_name[FN_REFLEN - 1]= '\0'; + const char* fid = strchr(foreign->id, '/'); + fid= fid ? fid + 1 : foreign->id; + my_error(ER_FK_COLUMN_CANNOT_CHANGE_CHILD, MYF(0), col_name, + fid, display_name); + return true; + } + } + } - for (unsigned f = 0; f < foreign->n_fields; f++) { - if (!strcmp(foreign->foreign_col_names[f], - col_name)) { - my_error(drop - ? ER_FK_COLUMN_CANNOT_DROP - : ER_FK_COLUMN_NOT_NULL, MYF(0), - col_name, foreign->id); - return(true); - } - } - } + return false; +} - if (!drop) { - /* SET NULL clauses on foreign key constraints of - child tables affect the child tables, not the parent table. - The column can be NOT NULL in the parent table. */ - return(false); - } +/** Determines if an InnoDB FOREIGN KEY constraint depends on +the column when it is being dropped. +@param user_table InnoDB table as it is before the ALTER operation +@param drop_fk constraints being dropped +@param n_drop_fk number of constraints that are being dropped +@param col_name column name to be dropped +@retval true Not allowed (will call my_error()) +@retval false Allowed +*/ +static +bool check_foreign_drop_col(const dict_table_t *user_table, + dict_foreign_t **drop_fk, ulint n_drop_fk, + const char *col_name) +{ + ut_ad(dict_sys.locked()); - /* Check if any FOREIGN KEY constraints in other tables are - referring to the column that is being dropped. */ - for (dict_foreign_set::const_iterator it - = user_table->referenced_set.begin(); - it != user_table->referenced_set.end(); - ++it) { + /* Check if any FOREIGN KEY constraints are defined on this column. */ + for (dict_foreign_t *foreign : user_table->foreign_set) + { + if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) + continue; - foreign = *it; + for (unsigned f = 0; f < foreign->n_fields; f++) + if (!strcmp(foreign->foreign_col_names[f], col_name)) + { + my_error(ER_FK_COLUMN_CANNOT_DROP, MYF(0), + col_name, foreign->id); + return true; + } + } - if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) { - continue; - } + /* Check if any FOREIGN KEY constraints in other tables are + referring to the column that is being dropped. */ + for (dict_foreign_t *foreign : user_table->referenced_set) + { + if (innobase_dropping_foreign(foreign, drop_fk, n_drop_fk)) + continue; - for (unsigned f = 0; f < foreign->n_fields; f++) { - char display_name[FN_REFLEN]; - - if (strcmp(foreign->referenced_col_names[f], - col_name)) { - continue; - } - - char* buf_end = innobase_convert_name( - display_name, (sizeof display_name) - 1, - foreign->foreign_table_name, - strlen(foreign->foreign_table_name), - NULL); - *buf_end = '\0'; - my_error(ER_FK_COLUMN_CANNOT_DROP_CHILD, - MYF(0), col_name, foreign->id, - display_name); - - return(true); - } - } - - return(false); + for (unsigned f = 0; f < foreign->n_fields; f++) + { + char display_name[FN_REFLEN]; + if (strcmp(foreign->referenced_col_names[f], col_name)) + continue; + char* buf_end = innobase_convert_name( + display_name, (sizeof display_name) - 1, + foreign->foreign_table_name, + strlen(foreign->foreign_table_name), NULL); + *buf_end = '\0'; + my_error(ER_FK_COLUMN_CANNOT_DROP_CHILD, + MYF(0), col_name, foreign->id, display_name); + return true; + } + } + return false; } /** Determines if an InnoDB FOREIGN KEY constraint depends on a @@ -4554,16 +4608,25 @@ innobase_check_foreigns( return field.field == *fp; }); - if (it == end || (it->flags & NOT_NULL_FLAG)) { - if (innobase_check_foreigns_low( - user_table, drop_fk, n_drop_fk, - (*fp)->field_name.str, it == end)) { - return(true); + if (it == end) { + if (check_foreign_drop_col( + user_table, drop_fk, n_drop_fk, + (*fp)->field_name.str)) { + return true; + } + } else if ((it->flags & NOT_NULL_FLAG) + != ((*fp)->flags & NOT_NULL_FLAG)) { + + if (check_foreigns_nullability(user_table, drop_fk, + n_drop_fk, + (*fp)->field_name.str, + it->flags)) { + return true; } } } - return(false); + return false; } /** Convert a default value for ADD COLUMN. @@ -9984,8 +10047,8 @@ innobase_update_foreign_try( fk->foreign_col_names, fk->n_fields, fk->referenced_index, TRUE, fk->type - & (DICT_FOREIGN_ON_DELETE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_SET_NULL), + & (fk->DELETE_SET_NULL + | fk->UPDATE_SET_NULL), NULL, NULL, NULL); if (!fk->foreign_index) { my_error(ER_FK_INCORRECT_OPTION, @@ -10617,6 +10680,16 @@ commit_try_norebuild( dict_index_t* index; const char *op = "rename index to add"; ulint num_fts_index = 0; + const bool statistics_drop = statistics_exist + && ((HA_OPTION_NO_STATS_PERSISTENT | + HA_OPTION_STATS_PERSISTENT) + & (old_table->s->db_create_options + ^ altered_table->s->db_create_options)) + && ((altered_table->s->db_create_options + & HA_OPTION_NO_STATS_PERSISTENT) + || (!(altered_table->s->db_create_options + & HA_OPTION_STATS_PERSISTENT) + && !srv_stats_persistent)); /* We altered the table in place. Mark the indexes as committed. */ for (ulint i = 0; i < ctx->num_to_add_index; i++) { @@ -10639,7 +10712,8 @@ commit_try_norebuild( } char db[MAX_DB_UTF8_LEN], table[MAX_TABLE_UTF8_LEN]; - if (ctx->num_to_drop_index) { + + if (statistics_exist && (statistics_drop || ctx->num_to_drop_index)) { dict_fs2utf8(ctx->old_table->name.m_name, db, sizeof db, table, sizeof table); } @@ -10674,7 +10748,7 @@ commit_try_norebuild( goto handle_error; } - if (!statistics_exist) { + if (!statistics_exist || statistics_drop) { continue; } @@ -10690,6 +10764,25 @@ commit_try_norebuild( } if (!statistics_exist) { + } else if (statistics_drop) { + error = dict_stats_delete_from_table_stats(db, table, trx); + switch (error) { + case DB_SUCCESS: + case DB_STATS_DO_NOT_EXIST: + break; + default: + goto handle_error; + } + error = dict_stats_delete_from_index_stats(db, table, trx); + switch (error) { + case DB_STATS_DO_NOT_EXIST: + error = DB_SUCCESS; + /* fall through */ + case DB_SUCCESS: + break; + default: + goto handle_error; + } } else if (const size_t size = ha_alter_info->rename_keys.size()) { char tmp_name[5]; char db[MAX_DB_UTF8_LEN], table[MAX_TABLE_UTF8_LEN]; diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index d02a6fc398f..f0709e400bb 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -1490,24 +1490,24 @@ public: #ifdef UNIV_DEBUG /** @return whether the current thread is holding the latch */ - bool frozen() const { return latch.have_any(); } + bool frozen() const noexcept { return latch.have_any(); } /** @return whether the current thread is holding a shared latch */ - bool frozen_not_locked() const { return latch.have_rd(); } + bool frozen_not_locked() const noexcept { return latch.have_rd(); } /** @return whether the current thread holds the exclusive latch */ - bool locked() const { return latch.have_wr(); } + bool locked() const noexcept { return latch.have_wr(); } #endif private: /** Acquire the exclusive latch */ ATTRIBUTE_NOINLINE - void lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)); + void lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept; public: /** @return the my_hrtime_coarse().val of the oldest lock_wait() start, assuming that requests are served on a FIFO basis */ - ulonglong oldest_wait() const + ulonglong oldest_wait() const noexcept { return latch_ex_wait_start.load(std::memory_order_relaxed); } /** Exclusively lock the dictionary cache. */ - void lock(SRW_LOCK_ARGS(const char *file, unsigned line)) + void lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept { if (!latch.wr_lock_try()) lock_wait(SRW_LOCK_ARGS(file, line)); @@ -1515,18 +1515,18 @@ public: #ifdef UNIV_PFS_RWLOCK /** Unlock the data dictionary cache. */ - ATTRIBUTE_NOINLINE void unlock(); + ATTRIBUTE_NOINLINE void unlock() noexcept; /** Acquire a shared lock on the dictionary cache. */ - ATTRIBUTE_NOINLINE void freeze(const char *file, unsigned line); + ATTRIBUTE_NOINLINE void freeze(const char *file, unsigned line) noexcept; /** Release a shared lock on the dictionary cache. */ - ATTRIBUTE_NOINLINE void unfreeze(); + ATTRIBUTE_NOINLINE void unfreeze() noexcept; #else /** Unlock the data dictionary cache. */ - void unlock() { latch.wr_unlock(); } + void unlock() noexcept { latch.wr_unlock(); } /** Acquire a shared lock on the dictionary cache. */ - void freeze() { latch.rd_lock(); } + void freeze() noexcept { latch.rd_lock(); } /** Release a shared lock on the dictionary cache. */ - void unfreeze() { latch.rd_unlock(); } + void unfreeze() noexcept { latch.rd_unlock(); } #endif /** Estimate the used memory occupied by the data dictionary diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 3b8ecdd2c87..08f94a59e20 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1509,45 +1509,149 @@ typedef std::set, /** Data structure for a foreign key constraint; an example: FOREIGN KEY (A, B) REFERENCES TABLE2 (C, D). Most fields will be initialized to 0, NULL or FALSE in dict_mem_foreign_create(). */ -struct dict_foreign_t{ - mem_heap_t* heap; /*!< this object is allocated from - this memory heap */ - char* id; /*!< id of the constraint as a - null-terminated string */ - unsigned n_fields:10; /*!< number of indexes' first fields - for which the foreign key - constraint is defined: we allow the - indexes to contain more fields than - mentioned in the constraint, as long - as the first fields are as mentioned */ - unsigned type:6; /*!< 0 or DICT_FOREIGN_ON_DELETE_CASCADE - or DICT_FOREIGN_ON_DELETE_SET_NULL */ - char* foreign_table_name;/*!< foreign table name */ - char* foreign_table_name_lookup; - /*!< foreign table name used for dict lookup */ - dict_table_t* foreign_table; /*!< table where the foreign key is */ - const char** foreign_col_names;/*!< names of the columns in the - foreign key */ - char* referenced_table_name;/*!< referenced table name */ - char* referenced_table_name_lookup; - /*!< referenced table name for dict lookup*/ - dict_table_t* referenced_table;/*!< table where the referenced key - is */ - const char** referenced_col_names;/*!< names of the referenced - columns in the referenced table */ - dict_index_t* foreign_index; /*!< foreign index; we require that - both tables contain explicitly defined - indexes for the constraint: InnoDB - does not generate new indexes - implicitly */ - dict_index_t* referenced_index;/*!< referenced index */ +struct dict_foreign_t +{ + /* Object is allocated from this memory heap */ + mem_heap_t *heap; + /* id of the constraint as a null terminated string */ + char *id; + /* number of indexes first fields for which the foreign key + constraint is defined: We allow the indexes to contain more + fields than mentioned in the constraint, as long as the first + fields are as mentioned */ + unsigned n_fields:10; + /* 0 or DELETE_CASCADE OR DELETE_SET_NULL */ + unsigned type:6; + /* foreign table name */ + char *foreign_table_name; + /* Foreign table name used for dict lookup */ + char *foreign_table_name_lookup; + /* table where the foreign key is */ + dict_table_t *foreign_table; + /* names of the columns in the foreign key */ + const char **foreign_col_names; + /* referenced table name */ + char *referenced_table_name; + /* referenced table name for dict lookup */ + char *referenced_table_name_lookup; + /* Table where the referenced key is */ + dict_table_t *referenced_table; + /* Names of the referenced columns in the referenced table */ + const char **referenced_col_names; + /* foreign index; we require that both tables contain explicitly + defined indexes for the constraint: InnoDB does not generate + new indexes implicitly */ + dict_index_t *foreign_index; + /* referenced index */ + dict_index_t *referenced_index; + /* set of virtual columns affected by foreign key constraint */ + dict_vcol_set *v_cols; + /** Check whether the fulltext index gets affected by + foreign key constraint */ + bool affects_fulltext() const; + /** The flags for ON_UPDATE and ON_DELETE can be ORed; + the default is that a foreign key constraint is enforced, + therefore RESTRICT just means no flag */ + static constexpr unsigned DELETE_CASCADE= 1U; + static constexpr unsigned DELETE_SET_NULL= 2U; + static constexpr unsigned UPDATE_CASCADE= 4U; + static constexpr unsigned UPDATE_SET_NULL= 8U; + static constexpr unsigned DELETE_NO_ACTION= 16U; + static constexpr unsigned UPDATE_NO_ACTION= 32U; +private: + /** Check whether the name exists in given column names + @retval offset or UINT_MAX if name not found */ + unsigned col_exists(const char *name, const char **names) const noexcept + { + for (unsigned i= 0; i < n_fields; i++) + { + if (!strcmp(names[i], name)) + return i; + } + return UINT_MAX; + } - dict_vcol_set* v_cols; /*!< set of virtual columns affected - by foreign key constraint. */ +public: + /** Check whether the name exists in the foreign key column names + @retval offset in case of success + @retval UINT_MAX in case of failure */ + unsigned col_fk_exists(const char *name) const noexcept + { + return col_exists(name, foreign_col_names); + } - /** Check whether the fulltext index gets affected by - foreign key constraint */ - bool affects_fulltext() const; + /** Check whether the name exists in the referenced + key column names + @retval offset in case of success + @retval UINT_MAX in case of failure */ + unsigned col_ref_exists(const char *name) const noexcept + { + return col_exists(name, referenced_col_names); + } + + /** Check whether the foreign key constraint depends on + the nullability of the referenced column to be modified + @param name column to be modified + @return true in case of no conflict or false */ + bool on_update_cascade_not_null(const char *name) const noexcept + { + if (!foreign_index || type != UPDATE_CASCADE) + return false; + unsigned offset= col_ref_exists(name); + if (offset == UINT_MAX) + return false; + + ut_ad(offset < n_fields); + return foreign_index->fields[offset].col->prtype & DATA_NOT_NULL; + } + + /** Check whether the foreign key constraint depends on + the nullability of the foreign column to be modified + @param name column to be modified + @return true in case of no conflict or false */ + bool on_update_cascade_null(const char *name) const noexcept + { + if (!referenced_index || type != UPDATE_CASCADE) + return false; + unsigned offset= col_fk_exists(name); + if (offset == UINT_MAX) + return false; + + ut_ad(offset < n_fields); + return !(referenced_index->fields[offset].col->prtype & DATA_NOT_NULL); + } + + /** This is called during CREATE TABLE statement + to check the foreign key nullability constraint + @return true if foreign key constraint is valid + or else false */ + bool check_fk_constraint_valid() + { + if (!type || type & (DELETE_CASCADE | DELETE_NO_ACTION | + UPDATE_NO_ACTION)) + return true; + + if (!referenced_index) + return true; + + for (unsigned i= 0; i < n_fields; i++) + { + dict_col_t *col = foreign_index->fields[i].col; + if (col->prtype & DATA_NOT_NULL) + { + /* Foreign type is ON DELETE SET NULL + or ON UPDATE SET NULL */ + if (type & (DELETE_SET_NULL | UPDATE_SET_NULL)) + return false; + + dict_col_t *ref_col= referenced_index->fields[i].col; + /* Referenced index respective fields shouldn't be NULL */ + if (!(ref_col->prtype & DATA_NOT_NULL)) + return false; + } + } + return true; + } }; std::ostream& @@ -1707,17 +1811,6 @@ struct dict_foreign_set_free { const dict_foreign_set& m_foreign_set; }; -/** The flags for ON_UPDATE and ON_DELETE can be ORed; the default is that -a foreign key constraint is enforced, therefore RESTRICT just means no flag */ -/* @{ */ -#define DICT_FOREIGN_ON_DELETE_CASCADE 1U /*!< ON DELETE CASCADE */ -#define DICT_FOREIGN_ON_DELETE_SET_NULL 2U /*!< ON UPDATE SET NULL */ -#define DICT_FOREIGN_ON_UPDATE_CASCADE 4U /*!< ON DELETE CASCADE */ -#define DICT_FOREIGN_ON_UPDATE_SET_NULL 8U /*!< ON UPDATE SET NULL */ -#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16U /*!< ON DELETE NO ACTION */ -#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32U /*!< ON UPDATE NO ACTION */ -/* @} */ - /** Display an identifier. @param[in,out] s output stream @param[in] id_name SQL identifier (other than table name) diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 6f32e7a7689..0cc55eff03f 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -526,9 +526,6 @@ public: /** Close each file. Only invoked on fil_system.temp_space. */ void close(); - /** Note that operations on the tablespace must stop. */ - inline void set_stopping(); - /** Drop the tablespace and wait for any pending operations to cease @param id tablespace identifier @param detached_handle pointer to file to be closed later, or nullptr @@ -587,32 +584,14 @@ public: /** Clear the NEEDS_FSYNC flag */ void clear_flush() { -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - static_assert(NEEDS_FSYNC == 1U << 28, "compatibility"); - __asm__ __volatile__("lock btrl $28, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - static_assert(NEEDS_FSYNC == 1U << 28, "compatibility"); - _interlockedbittestandreset(reinterpret_cast - (&n_pending), 28); -#else n_pending.fetch_and(~NEEDS_FSYNC, std::memory_order_release); -#endif } private: /** Clear the CLOSING flag */ void clear_closing() { -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - static_assert(CLOSING == 1U << 29, "compatibility"); - __asm__ __volatile__("lock btrl $29, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - static_assert(CLOSING == 1U << 29, "compatibility"); - _interlockedbittestandreset(reinterpret_cast - (&n_pending), 29); -#else n_pending.fetch_and(~CLOSING, std::memory_order_relaxed); -#endif } /** @return pending operations (and flags) */ @@ -1535,21 +1514,6 @@ inline void fil_space_t::reacquire() #endif /* SAFE_MUTEX */ } -/** Note that operations on the tablespace must stop. */ -inline void fil_space_t::set_stopping() -{ - mysql_mutex_assert_owner(&fil_system.mutex); -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - static_assert(STOPPING_WRITES == 1U << 30, "compatibility"); - __asm__ __volatile__("lock btsl $30, %0" : "+m" (n_pending)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - static_assert(STOPPING_WRITES == 1U << 30, "compatibility"); - _interlockedbittestandset(reinterpret_cast(&n_pending), 30); -#else - n_pending.fetch_or(STOPPING_WRITES, std::memory_order_relaxed); -#endif -} - /** Flush pending writes from the file system cache to the file. */ template inline void fil_space_t::flush() { diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index 08b9f4bcb35..085e2c78fbc 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -788,28 +788,28 @@ public: ATTRIBUTE_NOINLINE void rd_unlock(); #else /** Acquire exclusive lock_sys.latch */ - void wr_lock() + void wr_lock() noexcept { mysql_mutex_assert_not_owner(&wait_mutex); latch.wr_lock(); } /** Release exclusive lock_sys.latch */ - void wr_unlock() { latch.wr_unlock(); } + void wr_unlock() noexcept { latch.wr_unlock(); } /** Acquire shared lock_sys.latch */ - void rd_lock() + void rd_lock() noexcept { mysql_mutex_assert_not_owner(&wait_mutex); latch.rd_lock(); } /** Release shared lock_sys.latch */ - void rd_unlock() { latch.rd_unlock(); } + void rd_unlock() noexcept { latch.rd_unlock(); } #endif /** Try to acquire exclusive lock_sys.latch @return whether the latch was acquired */ - bool wr_lock_try() { return latch.wr_lock_try(); } + bool wr_lock_try() noexcept { return latch.wr_lock_try(); } /** Try to acquire shared lock_sys.latch @return whether the latch was acquired */ - bool rd_lock_try() { return latch.rd_lock_try(); } + bool rd_lock_try() noexcept { return latch.rd_lock_try(); } /** Assert that wr_lock() has been invoked by this thread */ void assert_locked() const { ut_ad(latch.have_wr()); } diff --git a/storage/innobase/include/rw_lock.h b/storage/innobase/include/rw_lock.h index 4881f2f1d35..ecd994dbbcb 100644 --- a/storage/innobase/include/rw_lock.h +++ b/storage/innobase/include/rw_lock.h @@ -39,15 +39,7 @@ protected: /** Start waiting for an exclusive lock. */ void write_lock_wait_start() { -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - static_assert(WRITER_WAITING == 1U << 30, "compatibility"); - __asm__ __volatile__("lock btsl $30, %0" : "+m" (lock)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - static_assert(WRITER_WAITING == 1U << 30, "compatibility"); - _interlockedbittestandset(reinterpret_cast(&lock), 30); -#else lock.fetch_or(WRITER_WAITING, std::memory_order_relaxed); -#endif } /** Start waiting for an exclusive lock. @return current value of the lock word */ diff --git a/storage/innobase/include/srw_lock.h b/storage/innobase/include/srw_lock.h index 10edc2ad0a0..79a3e7c42a7 100644 --- a/storage/innobase/include/srw_lock.h +++ b/storage/innobase/include/srw_lock.h @@ -43,10 +43,10 @@ class pthread_mutex_wrapper final /** whether the mutex is usable; set by init(); cleared by destroy() */ bool initialized{false}; public: - ~pthread_mutex_wrapper() { ut_ad(!initialized); } + ~pthread_mutex_wrapper() noexcept { ut_ad(!initialized); } #endif public: - void init() + void init() noexcept { ut_ad(!initialized); ut_d(initialized= true); @@ -55,31 +55,31 @@ public: else pthread_mutex_init(&lock, nullptr); } - void destroy() + void destroy() noexcept { ut_ad(initialized); ut_d(initialized=false); pthread_mutex_destroy(&lock); } # ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP - void wr_lock() { ut_ad(initialized); pthread_mutex_lock(&lock); } + void wr_lock() noexcept { ut_ad(initialized); pthread_mutex_lock(&lock); } # else private: - void wr_wait(); + void wr_wait() noexcept; public: - inline void wr_lock(); + inline void wr_lock() noexcept; # endif - void wr_unlock() { ut_ad(initialized); pthread_mutex_unlock(&lock); } - bool wr_lock_try() + void wr_unlock() noexcept { ut_ad(initialized); pthread_mutex_unlock(&lock); } + bool wr_lock_try() noexcept { ut_ad(initialized); return !pthread_mutex_trylock(&lock); } }; # ifndef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP -template<> void pthread_mutex_wrapper::wr_wait(); +template<> void pthread_mutex_wrapper::wr_wait() noexcept; template<> -inline void pthread_mutex_wrapper::wr_lock() +inline void pthread_mutex_wrapper::wr_lock() noexcept { ut_ad(initialized); pthread_mutex_lock(&lock); } template<> -inline void pthread_mutex_wrapper::wr_lock() +inline void pthread_mutex_wrapper::wr_lock() noexcept { if (!wr_lock_try()) wr_wait(); } # endif @@ -90,11 +90,13 @@ template class srw_mutex_impl final { friend ssux_lock_impl; - /** The lock word, containing HOLDER + 1 if the lock is being held, - plus the number of waiters */ + /** The lock word, containing HOLDER + WAITER if the lock is being held, + plus WAITER times the number of waiters */ std::atomic lock; /** Identifies that the lock is being held */ - static constexpr uint32_t HOLDER= 1U << 31; + static constexpr uint32_t HOLDER= 1; + /** Identifies a lock waiter */ + static constexpr uint32_t WAITER= 2; #ifdef SUX_LOCK_GENERIC public: @@ -106,22 +108,22 @@ private: #endif /** Wait until the mutex has been acquired */ - void wait_and_lock(); + void wait_and_lock() noexcept; /** Wait for lock!=lk */ - inline void wait(uint32_t lk); + inline void wait(uint32_t lk) noexcept; /** Wake up one wait() thread */ - void wake(); + void wake() noexcept; /** Wake up all wait() threads */ - inline void wake_all(); + inline void wake_all() noexcept; public: /** @return whether the mutex is being held or waited for */ - bool is_locked_or_waiting() const + bool is_locked_or_waiting() const noexcept { return lock.load(std::memory_order_acquire) != 0; } /** @return whether the mutex is being held by any thread */ - bool is_locked() const + bool is_locked() const noexcept { return (lock.load(std::memory_order_acquire) & HOLDER) != 0; } - void init() + void init() noexcept { DBUG_ASSERT(!is_locked_or_waiting()); #ifdef SUX_LOCK_GENERIC @@ -129,7 +131,7 @@ public: pthread_cond_init(&cond, nullptr); #endif } - void destroy() + void destroy() noexcept { DBUG_ASSERT(!is_locked_or_waiting()); #ifdef SUX_LOCK_GENERIC @@ -139,19 +141,20 @@ public: } /** @return whether the mutex was acquired */ - bool wr_lock_try() + bool wr_lock_try() noexcept { uint32_t lk= 0; - return lock.compare_exchange_strong(lk, HOLDER + 1, + return lock.compare_exchange_strong(lk, HOLDER + WAITER, std::memory_order_acquire, std::memory_order_relaxed); } - void wr_lock() { if (!wr_lock_try()) wait_and_lock(); } - void wr_unlock() + void wr_lock() noexcept { if (!wr_lock_try()) wait_and_lock(); } + void wr_unlock() noexcept { - const uint32_t lk= lock.fetch_sub(HOLDER + 1, std::memory_order_release); - if (lk != HOLDER + 1) + const uint32_t lk= + lock.fetch_sub(HOLDER + WAITER, std::memory_order_release); + if (lk != HOLDER + WAITER) { DBUG_ASSERT(lk & HOLDER); wake(); @@ -193,16 +196,16 @@ class ssux_lock_impl static constexpr uint32_t WRITER= 1U << 31; /** Wait for readers!=lk */ - inline void wait(uint32_t lk); + inline void wait(uint32_t lk) noexcept; /** Wait for readers!=lk|WRITER */ - void wr_wait(uint32_t lk); + void wr_wait(uint32_t lk) noexcept; /** Wake up wait() on the last rd_unlock() */ - void wake(); + void wake() noexcept; /** Acquire a read lock */ - void rd_wait(); + void rd_wait() noexcept; public: - void init() + void init() noexcept { writer.init(); DBUG_ASSERT(is_vacant()); @@ -210,7 +213,7 @@ public: pthread_cond_init(&readers_cond, nullptr); #endif } - void destroy() + void destroy() noexcept { DBUG_ASSERT(is_vacant()); writer.destroy(); @@ -219,17 +222,17 @@ public: #endif } /** @return whether any writer is waiting */ - bool is_waiting() const + bool is_waiting() const noexcept { return (readers.load(std::memory_order_relaxed) & WRITER) != 0; } #ifndef DBUG_OFF /** @return whether the lock is being held or waited for */ - bool is_vacant() const { return !is_locked_or_waiting(); } + bool is_vacant() const noexcept { return !is_locked_or_waiting(); } #endif /* !DBUG_OFF */ private: /** Try to acquire a shared latch. @return the lock word value if the latch was not acquired @retval 0 if the latch was acquired */ - uint32_t rd_lock_try_low() + uint32_t rd_lock_try_low() noexcept { uint32_t lk= 0; while (!readers.compare_exchange_weak(lk, lk + 1, @@ -241,11 +244,11 @@ private: } public: - bool rd_lock_try() { return rd_lock_try_low() == 0; } + bool rd_lock_try() noexcept { return rd_lock_try_low() == 0; } - bool u_lock_try() { return writer.wr_lock_try(); } + bool u_lock_try() noexcept { return writer.wr_lock_try(); } - bool wr_lock_try() + bool wr_lock_try() noexcept { if (!writer.wr_lock_try()) return false; @@ -258,19 +261,23 @@ public: return false; } - void rd_lock() { if (!rd_lock_try()) rd_wait(); } - void u_lock() + void rd_lock() noexcept { if (!rd_lock_try()) rd_wait(); } + void u_lock() noexcept { writer.wr_lock(); } - void wr_lock() + void wr_lock() noexcept { writer.wr_lock(); #if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 - /* On IA-32 and AMD64, this type of fetch_or() can only be implemented - as a loop around LOCK CMPXCHG. In this particular case, setting the - most significant bit using fetch_add() is equivalent, and is - translated into a simple LOCK XADD. */ + /* On IA-32 and AMD64, a fetch_XXX() that needs to return the + previous value of the word state can only be implemented + efficiently for fetch_add() or fetch_sub(), both of which + translate into a 80486 LOCK XADD instruction. Anything else would + translate into a loop around LOCK CMPXCHG. In this particular + case, we know that the bit was previously clear, and therefore + setting (actually toggling) the most significant bit using + fetch_add() or fetch_sub() is equivalent. */ static_assert(WRITER == 1U << 31, "compatibility"); if (uint32_t lk= readers.fetch_add(WRITER, std::memory_order_acquire)) wr_wait(lk); @@ -280,23 +287,23 @@ public: #endif } - bool rd_u_upgrade_try() { return writer.wr_lock_try(); } + bool rd_u_upgrade_try() noexcept { return writer.wr_lock_try(); } - void u_wr_upgrade() + void u_wr_upgrade() noexcept { DBUG_ASSERT(writer.is_locked()); uint32_t lk= readers.fetch_add(WRITER, std::memory_order_acquire); if (lk) wr_wait(lk); } - void wr_u_downgrade() + void wr_u_downgrade() noexcept { DBUG_ASSERT(writer.is_locked()); DBUG_ASSERT(is_write_locked()); readers.store(0, std::memory_order_release); /* Note: Any pending rd_lock() will not be woken up until u_unlock() */ } - void u_rd_downgrade() + void u_rd_downgrade() noexcept { DBUG_ASSERT(writer.is_locked()); ut_d(uint32_t lk=) readers.fetch_add(1, std::memory_order_relaxed); @@ -304,18 +311,18 @@ public: u_unlock(); } - void rd_unlock() + void rd_unlock() noexcept { uint32_t lk= readers.fetch_sub(1, std::memory_order_release); ut_ad(~WRITER & lk); if (lk == WRITER + 1) wake(); } - void u_unlock() + void u_unlock() noexcept { writer.wr_unlock(); } - void wr_unlock() + void wr_unlock() noexcept { DBUG_ASSERT(is_write_locked()); readers.store(0, std::memory_order_release); @@ -331,10 +338,10 @@ public: bool is_locked_or_waiting() const noexcept { return is_locked() || writer.is_locked_or_waiting(); } - void lock_shared() { rd_lock(); } - void unlock_shared() { rd_unlock(); } - void lock() { wr_lock(); } - void unlock() { wr_unlock(); } + void lock_shared() noexcept { rd_lock(); } + void unlock_shared() noexcept { rd_unlock(); } + void lock() noexcept { wr_lock(); } + void unlock() noexcept { wr_unlock(); } }; #if defined _WIN32 || defined SUX_LOCK_GENERIC @@ -351,20 +358,20 @@ class srw_lock_ rw_lock_t lk; # endif - void rd_wait(); - void wr_wait(); + void rd_wait() noexcept; + void wr_wait() noexcept; public: - void init() { IF_WIN(,my_rwlock_init(&lk, nullptr)); } - void destroy() { IF_WIN(,rwlock_destroy(&lk)); } - inline void rd_lock(); - inline void wr_lock(); - bool rd_lock_try() + void init() noexcept { IF_WIN(,my_rwlock_init(&lk, nullptr)); } + void destroy() noexcept { IF_WIN(,rwlock_destroy(&lk)); } + inline void rd_lock() noexcept; + inline void wr_lock() noexcept; + bool rd_lock_try() noexcept { return IF_WIN(TryAcquireSRWLockShared(&lk), !rw_tryrdlock(&lk)); } - void rd_unlock() + void rd_unlock() noexcept { IF_WIN(ReleaseSRWLockShared(&lk), rw_unlock(&lk)); } - bool wr_lock_try() + bool wr_lock_try() noexcept { return IF_WIN(TryAcquireSRWLockExclusive(&lk), !rw_trywrlock(&lk)); } - void wr_unlock() + void wr_unlock() noexcept { IF_WIN(ReleaseSRWLockExclusive(&lk), rw_unlock(&lk)); } #ifdef _WIN32 /** @return whether any lock may be held by any thread */ @@ -378,27 +385,27 @@ public: return is_locked(); } - void lock_shared() { rd_lock(); } - void unlock_shared() { rd_unlock(); } - void lock() { wr_lock(); } - void unlock() { wr_unlock(); } + void lock_shared() noexcept { rd_lock(); } + void unlock_shared() noexcept { rd_unlock(); } + void lock() noexcept { wr_lock(); } + void unlock() noexcept { wr_unlock(); } #endif }; -template<> void srw_lock_::rd_wait(); -template<> void srw_lock_::wr_wait(); +template<> void srw_lock_::rd_wait() noexcept; +template<> void srw_lock_::wr_wait() noexcept; template<> -inline void srw_lock_::rd_lock() +inline void srw_lock_::rd_lock() noexcept { IF_WIN(AcquireSRWLockShared(&lk), rw_rdlock(&lk)); } template<> -inline void srw_lock_::wr_lock() +inline void srw_lock_::wr_lock() noexcept { IF_WIN(AcquireSRWLockExclusive(&lk), rw_wrlock(&lk)); } template<> -inline void srw_lock_::rd_lock() { if (!rd_lock_try()) rd_wait(); } +inline void srw_lock_::rd_lock() noexcept { if (!rd_lock_try()) rd_wait(); } template<> -inline void srw_lock_::wr_lock() { if (!wr_lock_try()) wr_wait(); } +inline void srw_lock_::wr_lock() noexcept { if (!wr_lock_try()) wr_wait(); } typedef srw_lock_ srw_lock_low; typedef srw_lock_ srw_spin_lock_low; @@ -424,17 +431,17 @@ class ssux_lock PSI_rwlock *pfs_psi; ssux_lock_impl lock; - ATTRIBUTE_NOINLINE void psi_rd_lock(const char *file, unsigned line); - ATTRIBUTE_NOINLINE void psi_wr_lock(const char *file, unsigned line); - ATTRIBUTE_NOINLINE void psi_u_lock(const char *file, unsigned line); - ATTRIBUTE_NOINLINE void psi_u_wr_upgrade(const char *file, unsigned line); + ATTRIBUTE_NOINLINE void psi_rd_lock(const char *file, unsigned line) noexcept; + ATTRIBUTE_NOINLINE void psi_wr_lock(const char *file, unsigned line) noexcept; + ATTRIBUTE_NOINLINE void psi_u_lock(const char *file, unsigned line) noexcept; + ATTRIBUTE_NOINLINE void psi_u_wr_upgrade(const char *file, unsigned line) noexcept; public: - void init(mysql_pfs_key_t key) + void init(mysql_pfs_key_t key) noexcept { pfs_psi= PSI_RWLOCK_CALL(init_rwlock)(key, this); lock.init(); } - void destroy() + void destroy() noexcept { if (psi_likely(pfs_psi != nullptr)) { @@ -443,56 +450,56 @@ public: } lock.destroy(); } - void rd_lock(const char *file, unsigned line) + void rd_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_rd_lock(file, line); else lock.rd_lock(); } - void rd_unlock() + void rd_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.rd_unlock(); } - void u_lock(const char *file, unsigned line) + void u_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_u_lock(file, line); else lock.u_lock(); } - void u_unlock() + void u_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.u_unlock(); } - void wr_lock(const char *file, unsigned line) + void wr_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_wr_lock(file, line); else lock.wr_lock(); } - void wr_unlock() + void wr_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.wr_unlock(); } - void u_wr_upgrade(const char *file, unsigned line) + void u_wr_upgrade(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_u_wr_upgrade(file, line); else lock.u_wr_upgrade(); } - bool rd_lock_try() { return lock.rd_lock_try(); } - bool u_lock_try() { return lock.u_lock_try(); } - bool wr_lock_try() { return lock.wr_lock_try(); } - bool is_waiting() const { return lock.is_waiting(); } + bool rd_lock_try() noexcept { return lock.rd_lock_try(); } + bool u_lock_try() noexcept { return lock.u_lock_try(); } + bool wr_lock_try() noexcept { return lock.wr_lock_try(); } + bool is_waiting() const noexcept { return lock.is_waiting(); } }; /** Slim reader-writer lock with PERFORMANCE_SCHEMA instrumentation */ @@ -506,15 +513,15 @@ class srw_lock_impl ssux_lock_impl lock; # endif - ATTRIBUTE_NOINLINE void psi_rd_lock(const char *file, unsigned line); - ATTRIBUTE_NOINLINE void psi_wr_lock(const char *file, unsigned line); + ATTRIBUTE_NOINLINE void psi_rd_lock(const char *file, unsigned line) noexcept; + ATTRIBUTE_NOINLINE void psi_wr_lock(const char *file, unsigned line) noexcept; public: - void init(mysql_pfs_key_t key) + void init(mysql_pfs_key_t key) noexcept { pfs_psi= PSI_RWLOCK_CALL(init_rwlock)(key, this); lock.init(); } - void destroy() + void destroy() noexcept { if (psi_likely(pfs_psi != nullptr)) { @@ -523,36 +530,36 @@ public: } lock.destroy(); } - void rd_lock(const char *file, unsigned line) + void rd_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_rd_lock(file, line); else lock.rd_lock(); } - void rd_unlock() + void rd_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.rd_unlock(); } - void wr_lock(const char *file, unsigned line) + void wr_lock(const char *file, unsigned line) noexcept { if (psi_likely(pfs_psi != nullptr)) psi_wr_lock(file, line); else lock.wr_lock(); } - void wr_unlock() + void wr_unlock() noexcept { if (psi_likely(pfs_psi != nullptr)) PSI_RWLOCK_CALL(unlock_rwlock)(pfs_psi); lock.wr_unlock(); } - bool rd_lock_try() { return lock.rd_lock_try(); } - bool wr_lock_try() { return lock.wr_lock_try(); } - void lock_shared() { return rd_lock(SRW_LOCK_CALL); } - void unlock_shared() { return rd_unlock(); } + bool rd_lock_try() noexcept { return lock.rd_lock_try(); } + bool wr_lock_try() noexcept { return lock.wr_lock_try(); } + void lock_shared() noexcept { return rd_lock(SRW_LOCK_CALL); } + void unlock_shared() noexcept { return rd_unlock(); } #ifndef SUX_LOCK_GENERIC /** @return whether any lock may be held by any thread */ bool is_locked_or_waiting() const noexcept @@ -582,11 +589,11 @@ class srw_lock_debug : private srw_lock std::atomic*> readers; /** Register a read lock. */ - void readers_register(); + void readers_register() noexcept; public: - void SRW_LOCK_INIT(mysql_pfs_key_t key); - void destroy(); + void SRW_LOCK_INIT(mysql_pfs_key_t key) noexcept; + void destroy() noexcept; #ifndef SUX_LOCK_GENERIC /** @return whether any lock may be held by any thread */ @@ -597,17 +604,17 @@ public: #endif /** Acquire an exclusive lock */ - void wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)); + void wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept; /** @return whether an exclusive lock was acquired */ - bool wr_lock_try(); + bool wr_lock_try() noexcept; /** Release after wr_lock() */ - void wr_unlock(); + void wr_unlock() noexcept; /** Acquire a shared lock */ - void rd_lock(SRW_LOCK_ARGS(const char *file, unsigned line)); + void rd_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept; /** @return whether a shared lock was acquired */ - bool rd_lock_try(); + bool rd_lock_try() noexcept; /** Release after rd_lock() */ - void rd_unlock(); + void rd_unlock() noexcept; /** @return whether this thread is between rd_lock() and rd_unlock() */ bool have_rd() const noexcept; /** @return whether this thread is between wr_lock() and wr_unlock() */ diff --git a/storage/innobase/include/transactional_lock_guard.h b/storage/innobase/include/transactional_lock_guard.h index 168a68977a7..40519f513b2 100644 --- a/storage/innobase/include/transactional_lock_guard.h +++ b/storage/innobase/include/transactional_lock_guard.h @@ -41,7 +41,7 @@ static inline bool xtest() { return false; } #else # if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 extern bool have_transactional_memory; -bool transactional_lock_enabled(); +bool transactional_lock_enabled() noexcept; # include # if defined __GNUC__ && !defined __INTEL_COMPILER @@ -52,7 +52,7 @@ bool transactional_lock_enabled(); # define TRANSACTIONAL_INLINE /* nothing */ # endif -TRANSACTIONAL_INLINE static inline bool xbegin() +TRANSACTIONAL_INLINE static inline bool xbegin() noexcept { return have_transactional_memory && _xbegin() == _XBEGIN_STARTED; } @@ -60,18 +60,18 @@ TRANSACTIONAL_INLINE static inline bool xbegin() # ifdef UNIV_DEBUG # ifdef __GNUC__ /** @return whether a memory transaction is active */ -bool xtest(); +bool xtest() noexcept; # else -static inline bool xtest() { return have_transactional_memory && _xtest(); } +static inline bool xtest() noexcept { return have_transactional_memory && _xtest(); } # endif # endif -TRANSACTIONAL_INLINE static inline void xabort() { _xabort(0); } +TRANSACTIONAL_INLINE static inline void xabort() noexcept { _xabort(0); } -TRANSACTIONAL_INLINE static inline void xend() { _xend(); } +TRANSACTIONAL_INLINE static inline void xend() noexcept { _xend(); } # elif defined __powerpc64__ || defined __s390__ extern bool have_transactional_memory; -bool transactional_lock_enabled(); +bool transactional_lock_enabled() noexcept; # define TRANSACTIONAL_TARGET __attribute__((hot)) # define TRANSACTIONAL_INLINE __attribute__((hot,always_inline)) @@ -89,11 +89,11 @@ bool transactional_lock_enabled(); could be implemented here, we keep the implementation the same as ppc64. */ -TRANSACTIONAL_TARGET bool xbegin(); -TRANSACTIONAL_TARGET void xabort(); -TRANSACTIONAL_TARGET void xend(); +TRANSACTIONAL_TARGET bool xbegin() noexcept; +TRANSACTIONAL_TARGET void xabort() noexcept; +TRANSACTIONAL_TARGET void xend() noexcept; # ifdef UNIV_DEBUG -bool xtest(); +bool xtest() noexcept; # endif # endif @@ -105,7 +105,7 @@ class transactional_lock_guard mutex &m; public: - TRANSACTIONAL_INLINE transactional_lock_guard(mutex &m) : m(m) + TRANSACTIONAL_INLINE transactional_lock_guard(mutex &m) noexcept : m(m) { #ifndef NO_ELISION if (xbegin()) @@ -117,8 +117,8 @@ public: #endif m.lock(); } - transactional_lock_guard(const transactional_lock_guard &)= delete; - TRANSACTIONAL_INLINE ~transactional_lock_guard() + transactional_lock_guard(const transactional_lock_guard &) noexcept= delete; + TRANSACTIONAL_INLINE ~transactional_lock_guard() noexcept { #ifndef NO_ELISION if (was_elided()) xend(); else @@ -144,7 +144,7 @@ class transactional_shared_lock_guard #endif public: - TRANSACTIONAL_INLINE transactional_shared_lock_guard(mutex &m) : m(m) + TRANSACTIONAL_INLINE transactional_shared_lock_guard(mutex &m) noexcept : m(m) { #ifndef NO_ELISION if (xbegin()) @@ -160,9 +160,9 @@ public: #endif m.lock_shared(); } - transactional_shared_lock_guard(const transactional_shared_lock_guard &)= + transactional_shared_lock_guard(const transactional_shared_lock_guard &) noexcept= delete; - TRANSACTIONAL_INLINE ~transactional_shared_lock_guard() + TRANSACTIONAL_INLINE ~transactional_shared_lock_guard() noexcept { #ifndef NO_ELISION if (was_elided()) xend(); else diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h index e0051b2a1d0..1d77291b69d 100644 --- a/storage/innobase/include/trx0rseg.h +++ b/storage/innobase/include/trx0rseg.h @@ -85,26 +85,12 @@ private: /** Set the SKIP bit */ void ref_set_skip() { - static_assert(SKIP == 1U, "compatibility"); -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - __asm__ __volatile__("lock btsl $0, %0" : "+m" (ref)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - _interlockedbittestandset(reinterpret_cast(&ref), 0); -#else ref.fetch_or(SKIP, std::memory_order_relaxed); -#endif } /** Clear a bit in ref */ void ref_reset_skip() { - static_assert(SKIP == 1U, "compatibility"); -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - __asm__ __volatile__("lock btrl $0, %0" : "+m" (ref)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - _interlockedbittestandreset(reinterpret_cast(&ref), 0); -#else ref.fetch_and(~SKIP, std::memory_order_relaxed); -#endif } public: diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 3d2017e4131..320c93c17b7 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -346,15 +346,7 @@ struct trx_lock_t /** Flag the lock owner as a victim in Galera conflict resolution. */ void set_wsrep_victim() { -# if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - /* There is no 8-bit version of the 80386 BTS instruction. - Technically, this is the wrong addressing mode (16-bit), but - there are other data members stored after the byte. */ - __asm__ __volatile__("lock btsw $1, %0" - : "+m" (was_chosen_as_deadlock_victim)); -# else was_chosen_as_deadlock_victim.fetch_or(2); -# endif } #else /* defined(UNIV_DEBUG) || !defined(DBUG_OFF) */ @@ -1084,15 +1076,7 @@ public: void reset_skip_lock_inheritance() { -#if defined __GNUC__ && (defined __i386__ || defined __x86_64__) - __asm__("lock btrl $31, %0" : : "m"(skip_lock_inheritance_and_n_ref)); -#elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) - _interlockedbittestandreset( - reinterpret_cast(&skip_lock_inheritance_and_n_ref), - 31); -#else skip_lock_inheritance_and_n_ref.fetch_and(~1U << 31); -#endif } /** @return whether the table has lock on diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index c267e45ebe6..ecca8901c40 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -496,15 +496,13 @@ void lock_sys_t::close() #ifdef WITH_WSREP # ifdef UNIV_DEBUG -/** Check if both conflicting lock transaction and other transaction -requesting record lock are brute force (BF). If they are check is -this BF-BF wait correct and if not report BF wait and assert. +/** Check if this BF-BF wait is correct and if not report and abort. @param lock other waiting lock @param trx transaction requesting conflicting lock */ -static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx, - const unsigned type_mode = LOCK_NONE) +static void wsrep_assert_valid_bf_bf_wait(const lock_t *lock, const trx_t *trx, + const unsigned type_mode) { ut_ad(!lock->is_table()); lock_sys.assert_locked(*lock); @@ -514,12 +512,8 @@ static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx, not acquire THD::LOCK_thd_data mutex below to avoid latching order violation. */ - if (!trx->is_wsrep() || !lock_trx->is_wsrep()) - return; - if (UNIV_LIKELY(!wsrep_thd_is_BF(trx->mysql_thd, FALSE)) - || UNIV_LIKELY(!wsrep_thd_is_BF(lock_trx->mysql_thd, FALSE))) - return; - + ut_ad(wsrep_thd_is_BF(trx->mysql_thd, FALSE)); + ut_ad(wsrep_thd_is_BF(lock_trx->mysql_thd, FALSE)); ut_ad(trx->state == TRX_STATE_ACTIVE); switch (lock_trx->state) { @@ -536,16 +530,6 @@ static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx, ut_ad("invalid state" == 0); } - /* If BF - BF order is honored, i.e. trx already holding - record lock should be ordered before this new lock request - we can keep trx waiting for the lock. If conflicting - transaction is already aborting or rolling back for replaying - we can also let new transaction waiting. */ - if (wsrep_thd_order_before(lock_trx->mysql_thd, trx->mysql_thd) - || wsrep_thd_is_aborting(lock_trx->mysql_thd)) { - return; - } - if (type_mode != LOCK_NONE) ib::error() << " Requested lock " << ((type_mode & LOCK_TABLE) ? "on table " : " on record ") @@ -573,8 +557,81 @@ static void wsrep_assert_no_bf_bf_wait(const lock_t *lock, const trx_t *trx, /* BF-BF wait is a bug */ ut_error; } + +void wsrep_report_error(const lock_t* victim_lock, const trx_t *bf_trx); # endif /* UNIV_DEBUG */ +/** Check if a high priority (BF) trx has to wait for the current +lock holder based on Wsrep transaction state relations. + +This code resembles the one in `wsrep_handle_mdl_conflict()`, but +it's specific to the storage engine and it doesn't perform any +BF aborts by itself. +The decision whether to BF abort a victim may depend on other conditions +like lock compatibility between InnoDB transactions. + +@param lock other waiting lock +@param trx BF transaction requesting conflicting lock +@return TRUE if BF trx has to wait for the lock to be removed +*/ +static bool wsrep_BF_has_to_wait(const lock_t *lock, const trx_t *trx, + bool report_bf_bf_wait, + const unsigned type_mode = LOCK_NONE) +{ + THD *request_thd= trx->mysql_thd; + THD *granted_thd= lock->trx->mysql_thd; + + ut_ad(wsrep_thd_is_BF(request_thd, false)); + ut_ad(lock->trx->is_wsrep()); + + /* Granted is aborting, let it complete. */ + if (wsrep_thd_is_aborting(granted_thd)) + return true; + + /* Granted is not BF, may BF abort it. */ + if (!wsrep_thd_is_BF(granted_thd, false)) + return false; + + /* Applying SR cannot BF abort other high priority (BF). */ + if (wsrep_thd_is_SR(request_thd)) + return true; + + /* Requester is truly BF and granted is applying SR in progress. */ + if (wsrep_thd_is_SR(granted_thd)) + return false; + +#ifdef UNIV_DEBUG + if (report_bf_bf_wait) + wsrep_report_error(lock, trx); + /* We very well can let BF to wait normally as other + BF will be replayed in case of conflict. For debug + builds we will do additional sanity checks to catch + unsupported BF wait if any. */ + ut_d(wsrep_assert_valid_bf_bf_wait(lock, trx, type_mode)); +#endif + return true; +} + +/** Determine whether BF abort on the lock holder is needed. + +@param lock other waiting lock +@param trx BF transaction requesting conflicting lock +@return TRUE if BF abort is needed +*/ +static bool wsrep_will_BF_abort(const lock_t *lock, const trx_t *trx) +{ + ut_ad(wsrep_thd_is_BF(trx->mysql_thd, false)); + + /* Don't BF abort system transactions. */ + if (!lock->trx->is_wsrep()) + return false; + + /* BF trx will wait for the lock, but it doesn't have to according + to Wsrep rules, meaning it must BF abort the lock holder. */ + return lock_has_to_wait(trx->lock.wait_lock, lock) && + !wsrep_BF_has_to_wait(lock, trx, true); +} + /** check if lock timeout was for priority thread, as a side effect trigger lock monitor @param trx transaction owning the lock @@ -648,19 +705,9 @@ bool lock_rec_has_to_wait_wsrep(const trx_t *trx, return false; } - if (wsrep_thd_order_before(trx->mysql_thd, trx2->mysql_thd)) - { - /* If two high priority threads have lock conflict, we look at the - order of these transactions and honor the earlier transaction. */ - - return false; - } - - /* We very well can let bf to wait normally as other - BF will be replayed in case of conflict. For debug - builds we will do additional sanity checks to catch - unsupported bf wait if any. */ - ut_d(wsrep_assert_no_bf_bf_wait(lock2, trx, type_mode)); + /* If two high priority threads have lock conflict, we check if + new lock request has to wait for the transaction holding the lock. */ + return wsrep_BF_has_to_wait(lock2, trx, false, type_mode); } return true; @@ -997,14 +1044,13 @@ void wsrep_report_error(const lock_t* victim_lock, const trx_t *bf_trx) lock_rec_print(stderr, bf_trx->lock.wait_lock, mtr); WSREP_ERROR("victim holding lock: "); lock_rec_print(stderr, victim_lock, mtr); - wsrep_assert_no_bf_bf_wait(victim_lock, bf_trx); } #endif /* WITH_DEBUG */ /** Kill the holders of conflicting locks. @param trx brute-force applier transaction running in the current thread */ ATTRIBUTE_COLD ATTRIBUTE_NOINLINE -static void lock_wait_wsrep(trx_t *trx) +static void wsrep_handle_lock_conflict(trx_t *trx) { DBUG_ASSERT(wsrep_on(trx->mysql_thd)); if (!wsrep_thd_is_BF(trx->mysql_thd, false)) @@ -1030,8 +1076,8 @@ func_exit: for (lock_t *lock= UT_LIST_GET_FIRST(table->locks); lock; lock= UT_LIST_GET_NEXT(un_member.tab_lock.locks, lock)) { - /* Victim trx needs to be different from BF trx and it has to have a - THD so that we can kill it. Victim might not have THD in two cases: + /* Victim trx has to have a THD so that we can kill it. + Victim might not have THD in two cases: (1) An incomplete transaction that was recovered from undo logs on server startup (and not yet rolled back). @@ -1039,8 +1085,8 @@ func_exit: (2) Transaction that is in XA PREPARE state and whose client connection was disconnected. - Neither of these can complete before lock_wait_wsrep() releases - lock_sys.latch. + Neither of these can complete before wsrep_handle_lock_conflict() + releases lock_sys.latch. (1) trx_t::commit_in_memory() is clearing both trx_t::state and trx_t::is_recovered before it invokes @@ -1051,24 +1097,9 @@ func_exit: (2) If is in XA PREPARE state, it would eventually be rolled back and the lock conflict would be resolved when an XA COMMIT or XA ROLLBACK statement is executed in some other connection. - - If victim has also BF status, but has earlier seqno, we have to wait. */ - if (lock->trx != trx && lock->trx->mysql_thd && - !(wsrep_thd_is_BF(lock->trx->mysql_thd, false) && - wsrep_thd_order_before(lock->trx->mysql_thd, trx->mysql_thd))) + if (lock->trx->mysql_thd && wsrep_will_BF_abort(lock, trx)) { - if (wsrep_thd_is_BF(lock->trx->mysql_thd, false)) - { - // There is no need to kill victim with compatible lock - if (!lock_has_to_wait(trx->lock.wait_lock, lock)) - continue; - -#ifdef UNIV_DEBUG - wsrep_report_error(lock, trx); -#endif - } - victims.emplace(lock->trx); } } @@ -1090,21 +1121,8 @@ func_exit: record-locks instead of table locks. See details from comment above. */ - if (lock->trx != trx && lock->trx->mysql_thd && - !(wsrep_thd_is_BF(lock->trx->mysql_thd, false) && - wsrep_thd_order_before(lock->trx->mysql_thd, trx->mysql_thd))) + if (lock->trx->mysql_thd && wsrep_will_BF_abort(lock, trx)) { - if (wsrep_thd_is_BF(lock->trx->mysql_thd, false)) - { - // There is no need to kill victim with compatible lock - if (!lock_has_to_wait(trx->lock.wait_lock, lock)) - continue; - -#ifdef UNIV_DEBUG - wsrep_report_error(lock, trx); -#endif - } - victims.emplace(lock->trx); } } while ((lock= lock_rec_get_next(heap_no, lock))); @@ -2015,7 +2033,7 @@ dberr_t lock_wait(que_thr_t *thr) ut_ad(!trx->dict_operation_lock_mode); - IF_WSREP(if (trx->is_wsrep()) lock_wait_wsrep(trx),); + IF_WSREP(if (trx->is_wsrep()) wsrep_handle_lock_conflict(trx),); const auto type_mode= wait_lock->type_mode; #ifdef HAVE_REPLICATION diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index d7cd053d4a4..72111ea3676 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -3321,7 +3321,9 @@ static dict_table_t *build_fts_hidden_table( new_index->fields[old_index->n_fields].fixed_len= sizeof(doc_id_t); } - new_index->search_info= old_index->search_info; +#ifdef BTR_CUR_HASH_ADAPT + new_index->search_info= btr_search_info_create(new_index->heap); +#endif /* BTR_CUR_HASH_ADAPT */ UT_LIST_ADD_LAST(new_index->table->indexes, new_index); old_index= UT_LIST_GET_NEXT(indexes, old_index); if (UT_LIST_GET_LEN(new_table->indexes) diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 3f25363f894..27ff8bbf865 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -910,10 +910,10 @@ row_ins_foreign_fill_virtual( return DB_OUT_OF_MEMORY; } ut_ad(!node->is_delete - || (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)); - ut_ad(foreign->type & (DICT_FOREIGN_ON_DELETE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_SET_NULL - | DICT_FOREIGN_ON_UPDATE_CASCADE)); + || (foreign->type & foreign->DELETE_SET_NULL)); + ut_ad(foreign->type & (foreign->DELETE_SET_NULL + | foreign->UPDATE_SET_NULL + | foreign->UPDATE_CASCADE)); for (uint16_t i = 0; i < n_v_fld; i++) { @@ -1029,8 +1029,8 @@ row_ins_foreign_check_on_constraint( node = static_cast(thr->run_node); if (node->is_delete && 0 == (foreign->type - & (DICT_FOREIGN_ON_DELETE_CASCADE - | DICT_FOREIGN_ON_DELETE_SET_NULL))) { + & (foreign->DELETE_CASCADE + | foreign->DELETE_SET_NULL))) { row_ins_foreign_report_err("Trying to delete", thr, foreign, @@ -1040,8 +1040,8 @@ row_ins_foreign_check_on_constraint( } if (!node->is_delete && 0 == (foreign->type - & (DICT_FOREIGN_ON_UPDATE_CASCADE - | DICT_FOREIGN_ON_UPDATE_SET_NULL))) { + & (foreign->UPDATE_CASCADE + | foreign->UPDATE_SET_NULL))) { /* This is an UPDATE */ @@ -1064,7 +1064,7 @@ row_ins_foreign_check_on_constraint( cascade->foreign = foreign; if (node->is_delete - && (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE)) { + && (foreign->type & foreign->DELETE_CASCADE)) { cascade->is_delete = PLAIN_DELETE; } else { cascade->is_delete = NO_DELETE; @@ -1212,8 +1212,8 @@ row_ins_foreign_check_on_constraint( } if (node->is_delete - ? (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) - : (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL)) { + ? (foreign->type & foreign->DELETE_SET_NULL) + : (foreign->type & foreign->UPDATE_SET_NULL)) { /* Build the appropriate update vector which sets foreign->n_fields first fields in rec to SQL NULL */ @@ -1258,12 +1258,12 @@ row_ins_foreign_check_on_constraint( } } else if (table->fts && cascade->is_delete == PLAIN_DELETE && foreign->affects_fulltext()) { - /* DICT_FOREIGN_ON_DELETE_CASCADE case */ + /* dict_foreign_t::DELETE_CASCADE case */ fts_trx_add_op(trx, table, doc_id, FTS_DELETE, NULL); } if (!node->is_delete - && (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)) { + && (foreign->type & foreign->UPDATE_CASCADE)) { /* Build the appropriate update vector which sets changing foreign->n_fields first fields in rec to new values */ diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc index 629f4177552..791d0368d0c 100644 --- a/storage/innobase/row/row0purge.cc +++ b/storage/innobase/row/row0purge.cc @@ -1062,7 +1062,7 @@ static void row_purge_reset_trx_id(purge_node_t* node, mtr_t* mtr) mem_heap_t* heap = NULL; /* Reserve enough offsets for the PRIMARY KEY and 2 columns so that we can access DB_TRX_ID, DB_ROLL_PTR. */ - rec_offs offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2]; + rec_offs offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 3]; rec_offs_init(offsets_); rec_offs* offsets = rec_get_offsets( rec, index, offsets_, index->n_core_fields, diff --git a/storage/innobase/sync/srw_lock.cc b/storage/innobase/sync/srw_lock.cc index 5db6e627590..28b586de5df 100644 --- a/storage/innobase/sync/srw_lock.cc +++ b/storage/innobase/sync/srw_lock.cc @@ -25,7 +25,7 @@ this program; if not, write to the Free Software Foundation, Inc., #elif defined _MSC_VER && (defined _M_IX86 || defined _M_X64) # include bool have_transactional_memory; -bool transactional_lock_enabled() +bool transactional_lock_enabled() noexcept { int regs[4]; __cpuid(regs, 0); @@ -39,7 +39,7 @@ bool transactional_lock_enabled() #elif defined __GNUC__ && (defined __i386__ || defined __x86_64__) # include bool have_transactional_memory; -bool transactional_lock_enabled() +bool transactional_lock_enabled() noexcept { if (__get_cpuid_max(0, nullptr) < 7) return false; @@ -52,7 +52,7 @@ bool transactional_lock_enabled() # ifdef UNIV_DEBUG TRANSACTIONAL_TARGET -bool xtest() { return have_transactional_memory && _xtest(); } +bool xtest() noexcept { return have_transactional_memory && _xtest(); } # endif #elif defined __powerpc64__ || defined __s390__ # include @@ -60,21 +60,21 @@ bool xtest() { return have_transactional_memory && _xtest(); } # include __attribute__((target("htm"),hot)) -bool xbegin() +bool xbegin() noexcept { return have_transactional_memory && __TM_simple_begin() == _HTM_TBEGIN_STARTED; } __attribute__((target("htm"),hot)) -void xabort() { __TM_abort(); } +void xabort() noexcept { __TM_abort(); } __attribute__((target("htm"),hot)) -void xend() { __TM_end(); } +void xend() noexcept { __TM_end(); } bool have_transactional_memory; static sigjmp_buf ill_jmp; -static void ill_handler(int sig) +static void ill_handler(int sig) noexcept { siglongjmp(ill_jmp, sig); } @@ -83,7 +83,7 @@ static void ill_handler(int sig) and a 1 instruction store can succeed. */ __attribute__((noinline)) -static void test_tm(bool *r) +static void test_tm(bool *r) noexcept { if (__TM_simple_begin() == _HTM_TBEGIN_STARTED) { @@ -91,7 +91,7 @@ static void test_tm(bool *r) __TM_end(); } } -bool transactional_lock_enabled() +bool transactional_lock_enabled() noexcept { bool r= false; sigset_t oset; @@ -115,7 +115,7 @@ bool transactional_lock_enabled() # ifdef UNIV_DEBUG __attribute__((target("htm"),hot)) -bool xtest() +bool xtest() noexcept { # ifdef __s390x__ return have_transactional_memory && @@ -129,13 +129,13 @@ bool xtest() #endif /** @return the parameter for srw_pause() */ -static inline unsigned srw_pause_delay() +static inline unsigned srw_pause_delay() noexcept { return my_cpu_relax_multiplier / 4 * srv_spin_wait_delay; } /** Pause the CPU for some time, with no memory accesses. */ -static inline void srw_pause(unsigned delay) +static inline void srw_pause(unsigned delay) noexcept { HMT_low(); while (delay--) @@ -144,7 +144,7 @@ static inline void srw_pause(unsigned delay) } #ifndef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP -template<> void pthread_mutex_wrapper::wr_wait() +template<> void pthread_mutex_wrapper::wr_wait() noexcept { const unsigned delay= srw_pause_delay(); @@ -160,13 +160,13 @@ template<> void pthread_mutex_wrapper::wr_wait() #endif #ifdef SUX_LOCK_GENERIC -template void ssux_lock_impl::init(); -template void ssux_lock_impl::init(); -template void ssux_lock_impl::destroy(); -template void ssux_lock_impl::destroy(); +template void ssux_lock_impl::init() noexcept; +template void ssux_lock_impl::init() noexcept; +template void ssux_lock_impl::destroy() noexcept; +template void ssux_lock_impl::destroy() noexcept; template -inline void srw_mutex_impl::wait(uint32_t lk) +inline void srw_mutex_impl::wait(uint32_t lk) noexcept { pthread_mutex_lock(&mutex); while (lock.load(std::memory_order_relaxed) == lk) @@ -175,7 +175,7 @@ inline void srw_mutex_impl::wait(uint32_t lk) } template -inline void ssux_lock_impl::wait(uint32_t lk) +inline void ssux_lock_impl::wait(uint32_t lk) noexcept { pthread_mutex_lock(&writer.mutex); while (readers.load(std::memory_order_relaxed) == lk) @@ -184,21 +184,21 @@ inline void ssux_lock_impl::wait(uint32_t lk) } template -void srw_mutex_impl::wake() +void srw_mutex_impl::wake() noexcept { pthread_mutex_lock(&mutex); pthread_cond_signal(&cond); pthread_mutex_unlock(&mutex); } template -inline void srw_mutex_impl::wake_all() +inline void srw_mutex_impl::wake_all() noexcept { pthread_mutex_lock(&mutex); pthread_cond_broadcast(&cond); pthread_mutex_unlock(&mutex); } template -void ssux_lock_impl::wake() +void ssux_lock_impl::wake() noexcept { pthread_mutex_lock(&writer.mutex); pthread_cond_signal(&readers_cond); @@ -210,18 +210,18 @@ static_assert(4 == sizeof(rw_lock), "ABI"); # include template -inline void srw_mutex_impl::wait(uint32_t lk) +inline void srw_mutex_impl::wait(uint32_t lk) noexcept { WaitOnAddress(&lock, &lk, 4, INFINITE); } template -void srw_mutex_impl::wake() { WakeByAddressSingle(&lock); } +void srw_mutex_impl::wake() noexcept { WakeByAddressSingle(&lock); } template -inline void srw_mutex_impl::wake_all() { WakeByAddressAll(&lock); } +inline void srw_mutex_impl::wake_all() noexcept { WakeByAddressAll(&lock); } template -inline void ssux_lock_impl::wait(uint32_t lk) +inline void ssux_lock_impl::wait(uint32_t lk) noexcept { WaitOnAddress(&readers, &lk, 4, INFINITE); } template -void ssux_lock_impl::wake() { WakeByAddressSingle(&readers); } +void ssux_lock_impl::wake() noexcept { WakeByAddressSingle(&readers); } # else # ifdef __linux__ # include @@ -249,64 +249,30 @@ void ssux_lock_impl::wake() { WakeByAddressSingle(&readers); } # endif template -inline void srw_mutex_impl::wait(uint32_t lk) +inline void srw_mutex_impl::wait(uint32_t lk) noexcept { SRW_FUTEX(&lock, WAIT, lk); } template -void srw_mutex_impl::wake() { SRW_FUTEX(&lock, WAKE, 1); } +void srw_mutex_impl::wake() noexcept { SRW_FUTEX(&lock, WAKE, 1); } template -void srw_mutex_impl::wake_all() { SRW_FUTEX(&lock, WAKE, INT_MAX); } +void srw_mutex_impl::wake_all() noexcept { SRW_FUTEX(&lock, WAKE, INT_MAX); } template -inline void ssux_lock_impl::wait(uint32_t lk) +inline void ssux_lock_impl::wait(uint32_t lk) noexcept { SRW_FUTEX(&readers, WAIT, lk); } template -void ssux_lock_impl::wake() { SRW_FUTEX(&readers, WAKE, 1); } +void ssux_lock_impl::wake() noexcept { SRW_FUTEX(&readers, WAKE, 1); } # endif #endif -template void srw_mutex_impl::wake(); -template void ssux_lock_impl::wake(); -template void srw_mutex_impl::wake(); -template void ssux_lock_impl::wake(); - -/* - -Unfortunately, compilers targeting IA-32 or AMD64 currently cannot -translate the following single-bit operations into Intel 80386 instructions: - - m.fetch_or(1<(&mem), bit)) \ - goto label; -# define IF_NOT_FETCH_OR_GOTO(mem, bit, label) \ - if (!_interlockedbittestandset(reinterpret_cast(&mem), bit))\ - goto label; -#endif +template void srw_mutex_impl::wake() noexcept; +template void ssux_lock_impl::wake() noexcept; +template void srw_mutex_impl::wake() noexcept; +template void ssux_lock_impl::wake() noexcept; template -void srw_mutex_impl::wait_and_lock() +void srw_mutex_impl::wait_and_lock() noexcept { - uint32_t lk= 1 + lock.fetch_add(1, std::memory_order_relaxed); + uint32_t lk= WAITER + lock.fetch_add(WAITER, std::memory_order_relaxed); if (spinloop) { @@ -318,10 +284,16 @@ void srw_mutex_impl::wait_and_lock() lk= lock.load(std::memory_order_relaxed); if (!(lk & HOLDER)) { -#ifdef IF_NOT_FETCH_OR_GOTO - static_assert(HOLDER == (1U << 31), "compatibility"); - IF_NOT_FETCH_OR_GOTO(*this, 31, acquired); - lk|= HOLDER; +#if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 + lk |= HOLDER; +# ifdef _MSC_VER + static_assert(HOLDER == (1U << 0), "compatibility"); + if (!_interlockedbittestandset + (reinterpret_cast(&lock), 0)) +# else + if (!(lock.fetch_or(HOLDER, std::memory_order_relaxed) & HOLDER)) +# endif + goto acquired; #else if (!((lk= lock.fetch_or(HOLDER, std::memory_order_relaxed)) & HOLDER)) goto acquired; @@ -339,16 +311,22 @@ void srw_mutex_impl::wait_and_lock() if (lk & HOLDER) { wait(lk); -#ifdef IF_FETCH_OR_GOTO +#if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 reload: #endif lk= lock.load(std::memory_order_relaxed); } else { -#ifdef IF_FETCH_OR_GOTO - static_assert(HOLDER == (1U << 31), "compatibility"); - IF_FETCH_OR_GOTO(*this, 31, reload); +#if defined __i386__||defined __x86_64__||defined _M_IX86||defined _M_X64 +# ifdef _MSC_VER + static_assert(HOLDER == (1U << 0), "compatibility"); + if (_interlockedbittestandset + (reinterpret_cast(&lock), 0)) +# else + if (lock.fetch_or(HOLDER, std::memory_order_relaxed) & HOLDER) +# endif + goto reload; #else if ((lk= lock.fetch_or(HOLDER, std::memory_order_relaxed)) & HOLDER) continue; @@ -361,11 +339,11 @@ acquired: } } -template void srw_mutex_impl::wait_and_lock(); -template void srw_mutex_impl::wait_and_lock(); +template void srw_mutex_impl::wait_and_lock() noexcept; +template void srw_mutex_impl::wait_and_lock() noexcept; template -void ssux_lock_impl::wr_wait(uint32_t lk) +void ssux_lock_impl::wr_wait(uint32_t lk) noexcept { DBUG_ASSERT(writer.is_locked()); DBUG_ASSERT(lk); @@ -396,11 +374,11 @@ void ssux_lock_impl::wr_wait(uint32_t lk) while (lk != WRITER); } -template void ssux_lock_impl::wr_wait(uint32_t); -template void ssux_lock_impl::wr_wait(uint32_t); +template void ssux_lock_impl::wr_wait(uint32_t) noexcept; +template void ssux_lock_impl::wr_wait(uint32_t) noexcept; template -void ssux_lock_impl::rd_wait() +void ssux_lock_impl::rd_wait() noexcept { const unsigned delay= srw_pause_delay(); @@ -416,7 +394,8 @@ void ssux_lock_impl::rd_wait() /* Subscribe to writer.wake() or write.wake_all() calls by concurrently executing rd_wait() or writer.wr_unlock(). */ - uint32_t wl= 1 + writer.lock.fetch_add(1, std::memory_order_acquire); + uint32_t wl= writer.WAITER + + writer.lock.fetch_add(writer.WAITER, std::memory_order_acquire); for (;;) { @@ -440,21 +419,21 @@ void ssux_lock_impl::rd_wait() } /* Unsubscribe writer.wake() and writer.wake_all(). */ - wl= writer.lock.fetch_sub(1, std::memory_order_release); + wl= writer.lock.fetch_sub(writer.WAITER, std::memory_order_release); ut_ad(wl); /* Wake any other threads that may be blocked in writer.wait(). All other waiters than this rd_wait() would end up acquiring writer.lock and waking up other threads on unlock(). */ - if (wl > 1) + if (wl > writer.WAITER) writer.wake_all(); } -template void ssux_lock_impl::rd_wait(); -template void ssux_lock_impl::rd_wait(); +template void ssux_lock_impl::rd_wait() noexcept; +template void ssux_lock_impl::rd_wait() noexcept; #if defined _WIN32 || defined SUX_LOCK_GENERIC -template<> void srw_lock_::rd_wait() +template<> void srw_lock_::rd_wait() noexcept { const unsigned delay= srw_pause_delay(); @@ -468,7 +447,7 @@ template<> void srw_lock_::rd_wait() IF_WIN(AcquireSRWLockShared(&lk), rw_rdlock(&lk)); } -template<> void srw_lock_::wr_wait() +template<> void srw_lock_::wr_wait() noexcept { const unsigned delay= srw_pause_delay(); @@ -484,13 +463,13 @@ template<> void srw_lock_::wr_wait() #endif #ifdef UNIV_PFS_RWLOCK -template void srw_lock_impl::psi_rd_lock(const char*, unsigned); -template void srw_lock_impl::psi_wr_lock(const char*, unsigned); -template void srw_lock_impl::psi_rd_lock(const char*, unsigned); -template void srw_lock_impl::psi_wr_lock(const char*, unsigned); +template void srw_lock_impl::psi_rd_lock(const char*, unsigned) noexcept; +template void srw_lock_impl::psi_wr_lock(const char*, unsigned) noexcept; +template void srw_lock_impl::psi_rd_lock(const char*, unsigned) noexcept; +template void srw_lock_impl::psi_wr_lock(const char*, unsigned) noexcept; template -void srw_lock_impl::psi_rd_lock(const char *file, unsigned line) +void srw_lock_impl::psi_rd_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; const bool nowait= lock.rd_lock_try(); @@ -507,7 +486,7 @@ void srw_lock_impl::psi_rd_lock(const char *file, unsigned line) } template -void srw_lock_impl::psi_wr_lock(const char *file, unsigned line) +void srw_lock_impl::psi_wr_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; # if defined _WIN32 || defined SUX_LOCK_GENERIC @@ -546,7 +525,7 @@ void srw_lock_impl::psi_wr_lock(const char *file, unsigned line) # endif } -void ssux_lock::psi_rd_lock(const char *file, unsigned line) +void ssux_lock::psi_rd_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; const bool nowait= lock.rd_lock_try(); @@ -562,7 +541,7 @@ void ssux_lock::psi_rd_lock(const char *file, unsigned line) lock.rd_lock(); } -void ssux_lock::psi_u_lock(const char *file, unsigned line) +void ssux_lock::psi_u_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; if (PSI_rwlock_locker *locker= PSI_RWLOCK_CALL(start_rwlock_wrwait) @@ -575,7 +554,7 @@ void ssux_lock::psi_u_lock(const char *file, unsigned line) lock.u_lock(); } -void ssux_lock::psi_wr_lock(const char *file, unsigned line) +void ssux_lock::psi_wr_lock(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; # if defined _WIN32 || defined SUX_LOCK_GENERIC @@ -615,7 +594,7 @@ void ssux_lock::psi_wr_lock(const char *file, unsigned line) # endif } -void ssux_lock::psi_u_wr_upgrade(const char *file, unsigned line) +void ssux_lock::psi_u_wr_upgrade(const char *file, unsigned line) noexcept { PSI_rwlock_locker_state state; DBUG_ASSERT(lock.writer.is_locked()); @@ -637,14 +616,14 @@ void ssux_lock::psi_u_wr_upgrade(const char *file, unsigned line) lock.u_wr_upgrade(); } #else /* UNIV_PFS_RWLOCK */ -template void ssux_lock_impl::rd_lock(); -template void ssux_lock_impl::rd_unlock(); -template void ssux_lock_impl::u_unlock(); -template void ssux_lock_impl::wr_unlock(); +template void ssux_lock_impl::rd_lock() noexcept; +template void ssux_lock_impl::rd_unlock() noexcept; +template void ssux_lock_impl::u_unlock() noexcept; +template void ssux_lock_impl::wr_unlock() noexcept; #endif /* UNIV_PFS_RWLOCK */ #ifdef UNIV_DEBUG -void srw_lock_debug::SRW_LOCK_INIT(mysql_pfs_key_t key) +void srw_lock_debug::SRW_LOCK_INIT(mysql_pfs_key_t key) noexcept { srw_lock::SRW_LOCK_INIT(key); readers_lock.init(); @@ -652,7 +631,7 @@ void srw_lock_debug::SRW_LOCK_INIT(mysql_pfs_key_t key) ut_ad(!have_any()); } -void srw_lock_debug::destroy() +void srw_lock_debug::destroy() noexcept { ut_ad(!writer); if (auto r= readers.load(std::memory_order_relaxed)) @@ -665,7 +644,7 @@ void srw_lock_debug::destroy() srw_lock::destroy(); } -bool srw_lock_debug::wr_lock_try() +bool srw_lock_debug::wr_lock_try() noexcept { ut_ad(!have_any()); if (!srw_lock::wr_lock_try()) @@ -675,7 +654,7 @@ bool srw_lock_debug::wr_lock_try() return true; } -void srw_lock_debug::wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) +void srw_lock_debug::wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept { ut_ad(!have_any()); srw_lock::wr_lock(SRW_LOCK_ARGS(file, line)); @@ -683,14 +662,14 @@ void srw_lock_debug::wr_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) writer.store(pthread_self(), std::memory_order_relaxed); } -void srw_lock_debug::wr_unlock() +void srw_lock_debug::wr_unlock() noexcept { ut_ad(have_wr()); writer.store(0, std::memory_order_relaxed); srw_lock::wr_unlock(); } -void srw_lock_debug::readers_register() +void srw_lock_debug::readers_register() noexcept { readers_lock.wr_lock(); auto r= readers.load(std::memory_order_relaxed); @@ -703,7 +682,7 @@ void srw_lock_debug::readers_register() readers_lock.wr_unlock(); } -bool srw_lock_debug::rd_lock_try() +bool srw_lock_debug::rd_lock_try() noexcept { ut_ad(!have_any()); if (!srw_lock::rd_lock_try()) @@ -712,14 +691,14 @@ bool srw_lock_debug::rd_lock_try() return true; } -void srw_lock_debug::rd_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) +void srw_lock_debug::rd_lock(SRW_LOCK_ARGS(const char *file, unsigned line)) noexcept { ut_ad(!have_any()); srw_lock::rd_lock(SRW_LOCK_ARGS(file, line)); readers_register(); } -void srw_lock_debug::rd_unlock() +void srw_lock_debug::rd_unlock() noexcept { const pthread_t self= pthread_self(); ut_ad(writer != self); diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 65583c284e6..a6c70acc3b5 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -494,16 +494,18 @@ loop: if (undo->hdr_page_no == hdr_addr.page) goto found_cached; ut_ad("inconsistent undo logs" == 0); - if (false) - found_cached: - UT_LIST_REMOVE(rseg.undo_cached, undo); + found_cached: static_assert(FIL_NULL == 0xffffffff, ""); if (UNIV_UNLIKELY(mach_read_from_4(TRX_RSEG + TRX_RSEG_FORMAT + rseg_hdr->page.frame))) trx_rseg_format_upgrade(rseg_hdr, &mtr); - mtr.memset(rseg_hdr, TRX_RSEG + TRX_RSEG_UNDO_SLOTS + - undo->id * TRX_RSEG_SLOT_SIZE, 4, 0xff); - ut_free(undo); + if (UNIV_LIKELY(undo != nullptr)) + { + UT_LIST_REMOVE(rseg.undo_cached, undo); + mtr.memset(rseg_hdr, TRX_RSEG + TRX_RSEG_UNDO_SLOTS + + undo->id * TRX_RSEG_SLOT_SIZE, 4, 0xff); + ut_free(undo); + } mtr.write<8,mtr_t::MAYBE_NOP>(*rseg_hdr, TRX_RSEG + TRX_RSEG_MAX_TRX_ID + rseg_hdr->page.frame, trx_sys.get_max_trx_id() - 1); @@ -779,13 +781,16 @@ buf_block_t *purge_sys_t::get_page(page_id_t id) { ut_ad(!recv_sys.recovery_on); - buf_block_t*& undo_page= pages[id]; + buf_block_t *&h= pages[id]; + buf_block_t *undo_page= h; if (!undo_page) { undo_page= buf_pool.page_fix(id); // batch_cleanup() will unfix() if (!undo_page) pages.erase(id); + else + h= undo_page; } return undo_page; diff --git a/storage/maria/libmarias3 b/storage/maria/libmarias3 index 5e6aa32f96e..0d5babbe46f 160000 --- a/storage/maria/libmarias3 +++ b/storage/maria/libmarias3 @@ -1 +1 @@ -Subproject commit 5e6aa32f96ebdbcaf32b90d6182685156f8198b5 +Subproject commit 0d5babbe46f17147ed51efd1f05a0001017a2aad diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt index 4553fd432b0..399201a2ef6 100644 --- a/storage/mroonga/CMakeLists.txt +++ b/storage/mroonga/CMakeLists.txt @@ -421,14 +421,6 @@ set(MRN_TEST_SUITE_DIR "${CMAKE_SOURCE_DIR}/mysql-test/suite/mroonga") if(NOT EXISTS "${MRN_TEST_SUITE_DIR}") set(MRN_TEST_SUITE_DIR "${PROJECT_SOURCE_DIR}/mysql-test/mroonga") endif() -configure_file( - "${MRN_TEST_SUITE_DIR}/storage/r/information_schema_plugins.result.in" - "${MRN_TEST_SUITE_DIR}/storage/r/information_schema_plugins.result" - NEWLINE_STYLE LF) -configure_file( - "${MRN_TEST_SUITE_DIR}/storage/r/variable_version.result.in" - "${MRN_TEST_SUITE_DIR}/storage/r/variable_version.result" - NEWLINE_STYLE LF) configure_file( "${PROJECT_SOURCE_DIR}/data/install.sql.in" diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp index 51c4a769018..b95b7a7f7d6 100644 --- a/storage/mroonga/ha_mroonga.cpp +++ b/storage/mroonga/ha_mroonga.cpp @@ -16805,10 +16805,10 @@ int ha_mroonga::get_parent_foreign_key_list(THD *thd, DBUG_RETURN(res); } -uint ha_mroonga::wrapper_referenced_by_foreign_key() +inline bool ha_mroonga::wrapper_referenced_by_foreign_key() const noexcept { MRN_DBUG_ENTER_METHOD(); - uint res; + bool res; MRN_SET_WRAP_SHARE_KEY(share, table->s); MRN_SET_WRAP_TABLE_KEY(this, table); res = wrap_handler->referenced_by_foreign_key(); @@ -16817,17 +16817,17 @@ uint ha_mroonga::wrapper_referenced_by_foreign_key() DBUG_RETURN(res); } -uint ha_mroonga::storage_referenced_by_foreign_key() +inline bool ha_mroonga::storage_referenced_by_foreign_key() const noexcept { MRN_DBUG_ENTER_METHOD(); - uint res = handler::referenced_by_foreign_key(); + bool res = handler::referenced_by_foreign_key(); DBUG_RETURN(res); } -uint ha_mroonga::referenced_by_foreign_key() +bool ha_mroonga::referenced_by_foreign_key() const noexcept { MRN_DBUG_ENTER_METHOD(); - uint res; + bool res; if (share->wrapper_mode) { res = wrapper_referenced_by_foreign_key(); diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp index aba123649f0..a71c0e1e4ae 100644 --- a/storage/mroonga/ha_mroonga.hpp +++ b/storage/mroonga/ha_mroonga.hpp @@ -618,7 +618,7 @@ protected: bool can_switch_engines() mrn_override; int get_foreign_key_list(THD *thd, List *f_key_list) mrn_override; int get_parent_foreign_key_list(THD *thd, List *f_key_list) mrn_override; - uint referenced_by_foreign_key() mrn_override; + bool referenced_by_foreign_key() const noexcept mrn_override; void init_table_handle_for_HANDLER() mrn_override; void free_foreign_key_create_info(char* str) mrn_override; #ifdef MRN_HAVE_HA_REBIND_PSI @@ -1268,8 +1268,8 @@ private: int storage_get_foreign_key_list(THD *thd, List *f_key_list); int wrapper_get_parent_foreign_key_list(THD *thd, List *f_key_list); int storage_get_parent_foreign_key_list(THD *thd, List *f_key_list); - uint wrapper_referenced_by_foreign_key(); - uint storage_referenced_by_foreign_key(); + bool wrapper_referenced_by_foreign_key() const noexcept; + bool storage_referenced_by_foreign_key() const noexcept; void wrapper_init_table_handle_for_HANDLER(); void storage_init_table_handle_for_HANDLER(); void wrapper_free_foreign_key_create_info(char* str); diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result new file mode 100644 index 00000000000..ef47d228da4 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result @@ -0,0 +1,4 @@ +select PLUGIN_NAME, PLUGIN_TYPE +from information_schema.plugins where plugin_name = "Mroonga"; +PLUGIN_NAME PLUGIN_TYPE +Mroonga STORAGE ENGINE diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in b/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in deleted file mode 100644 index f1020453183..00000000000 --- a/storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result.in +++ /dev/null @@ -1,4 +0,0 @@ -select PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_TYPE -from information_schema.plugins where plugin_name = "Mroonga"; -PLUGIN_NAME PLUGIN_VERSION PLUGIN_TYPE -Mroonga @MRN_PLUGIN_VERSION@ STORAGE ENGINE diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in b/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result similarity index 66% rename from storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in rename to storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result index 26ff300a759..146f70e1df0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result.in +++ b/storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result @@ -1,3 +1,3 @@ show variables like 'mroonga_version'; Variable_name Value -mroonga_version @MRN_VERSION@ +mroonga_version # diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test index ec9e3c9d4b9..1cd840a9690 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_comment.test @@ -30,7 +30,10 @@ CREATE TABLE tags ( ALTER TABLE tags ADD COLUMN name VARCHAR(64) COMMENT 'flags "COLUMN_VECTOR"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test index e3b7df72cf9..b1276755a40 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_flags_parameter.test @@ -33,7 +33,10 @@ CREATE TABLE tags ( ALTER TABLE tags ADD COLUMN name VARCHAR(64) FLAGS='COLUMN_VECTOR'; SHOW CREATE TABLE tags; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test index 964426b44bf..dbad49d67d2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_comment.test @@ -35,7 +35,10 @@ CREATE TABLE bugs ( ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'groonga_type "tags"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test index 0f92c024b7c..1f83d5d2df7 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_groonga_type_parameter.test @@ -38,7 +38,10 @@ CREATE TABLE bugs ( ALTER TABLE bugs ADD COLUMN name VARCHAR(64) GROONGA_TYPE='tags'; SHOW CREATE TABLE bugs; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test index 0516186ba17..8377e9c5690 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_cp932.test @@ -45,7 +45,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test index 0ed92333e29..ec185295891 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_multibyte_utf8.test @@ -45,7 +45,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test index 54fb986a24f..19879bc57f1 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_column_type_comment.test @@ -34,7 +34,10 @@ CREATE TABLE bugs ( ALTER TABLE bugs ADD COLUMN name VARCHAR(64) COMMENT 'type "tags"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test index 8a63885a8e7..d68fb7c7362 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_add_index_token_filters_one_token_filter.test @@ -34,7 +34,10 @@ CREATE TABLE memos ( ALTER TABLE memos ADD FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test index 8efaad2a4ce..00a09f952ec 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_change_token_filter.test @@ -37,6 +37,8 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); ALTER TABLE terms COMMENT='default_tokenizer "TokenBigram", token_filters "TokenFilterStopWord"'; @@ -47,6 +49,7 @@ ALTER TABLE memos DISABLE KEYS; ALTER TABLE memos ENABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test index 83ce2ca786e..8237f2d83fb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_disable_keys_fulltext_table.test @@ -35,9 +35,12 @@ CREATE TABLE memos ( FULLTEXT INDEX content_index (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); ALTER TABLE memos DISABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test index 424e51adaaa..27071e82c1d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/alter_table_enable_keys_fulltext_table.test @@ -35,10 +35,13 @@ CREATE TABLE memos ( FULLTEXT INDEX content_index (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol ALTER TABLE memos DISABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); ALTER TABLE memos ENABLE KEYS; SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test index c23f35eef9a..11e524482be 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_fulltext_vector_other_table.test @@ -39,7 +39,10 @@ CREATE TABLE bugs ( INSERT INTO bugs (id, tags) VALUES (1, "Linux MySQL groonga"); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol SELECT *, MATCH (tags) AGAINST ("+MySQL" IN BOOLEAN MODE) AS score FROM bugs diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test index 9e128a005bb..710b922d9da 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_groonga_index_int_other_table.test @@ -40,7 +40,10 @@ INSERT INTO bugs (id, priority) VALUES (1, 10); INSERT INTO bugs (id, priority) VALUES (2, 3); INSERT INTO bugs (id, priority) VALUES (3, -2); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol SELECT * FROM bugs diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test index be26045ab89..5c94e43e2c8 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_cp932.test @@ -43,7 +43,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test index efbaf31fae5..4734d6d71bb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_multibyte_utf8.test @@ -43,7 +43,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test index 6bafebd8b9c..c3e4280390d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_comment.test @@ -29,7 +29,10 @@ CREATE TABLE bugs ( tags TEXT COMMENT 'flags "COLUMN_VECTOR"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test index 3baa576a9ea..3dd9bd81a08 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_flags_parameter.test @@ -30,7 +30,10 @@ CREATE TABLE bugs ( tags TEXT FLAGS='COLUMN_VECTOR' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test index 28f0f214935..aa2270d4926 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_comment.test @@ -33,7 +33,10 @@ CREATE TABLE bugs ( tag VARCHAR(64) COMMENT 'groonga_type "tags"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test index a664287289b..6b1bd629337 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_groonga_type_parameter.test @@ -36,7 +36,10 @@ CREATE TABLE bugs ( ) DEFAULT CHARSET=utf8; SHOW CREATE TABLE bugs; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test index bd4b268b081..4b308c196eb 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_column_type_comment.test @@ -33,7 +33,10 @@ CREATE TABLE bugs ( tag VARCHAR(64) COMMENT 'type "tags"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test index ade4099a8d5..d1d4654460a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_default_tokenizer.test @@ -30,7 +30,10 @@ CREATE TABLE tags ( COLLATE=utf8_bin COMMENT='default_tokenizer "TokenDelimit"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE tags; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test index 4997dbf75f7..b2bc719d683 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_normalizer_index_bin.test @@ -29,7 +29,10 @@ CREATE TABLE diaries ( INDEX (content) COMMENT 'normalizer "NormalizerAuto"' ) DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test index f7add5dbd60..5b2dcf00001 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_multiple_token_filters.test @@ -33,7 +33,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test index 2fc98e6103e..4f40cca47c0 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_one_token_filter.test @@ -33,7 +33,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test index aaf60b02dc4..a4c844ba435 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_index_token_filters_parameter.test @@ -36,7 +36,10 @@ CREATE TABLE memos ( ) DEFAULT CHARSET=utf8; SHOW CREATE TABLE memos; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test index dc0996d279c..a9de0b1101d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_multiple_token_filters.test @@ -37,7 +37,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test index ee1da6d09c3..30a21540c62 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/create_table_table_token_filters_one_token_filter.test @@ -37,7 +37,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'table "terms"' ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; DROP TABLE terms; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test index 37405696697..e9ab751dc0b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_existent.test @@ -44,7 +44,10 @@ DELETE FROM comments WHERE id = 100; SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test index 9322876badb..64a75843bfc 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_delete_nonexistent.test @@ -44,7 +44,10 @@ DELETE FROM comments WHERE id = 200; SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test index 283efbd3a48..a0e27ea5618 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_existent.test @@ -42,7 +42,10 @@ INSERT INTO entries (content, comment_id) VALUES ('Hello!', 100); SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test index 4b873f50cf0..ea9820ac6a6 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_insert_nonexistent.test @@ -42,7 +42,10 @@ INSERT INTO entries (content, comment_id) VALUES ('Hello!', 1); SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test index fc3590f36ff..24cba6110fa 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_existent.test @@ -44,7 +44,10 @@ UPDATE entries SET comment_id = 200 WHERE content = 'Hello!'; SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test index bcba6e75736..756c26bbfc2 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/foreign_key_update_nonexistent.test @@ -44,7 +44,10 @@ UPDATE entries SET comment_id = 200 WHERE content = 'Hello!'; SELECT * FROM entries; SELECT * FROM comments; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE entries; DROP TABLE comments; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test index e40a703b0a5..db2ee2b2203 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_auto-escape.test @@ -31,9 +31,12 @@ CREATE TABLE diaries ( INSERT INTO diaries VALUES('It is Groonga'); INSERT INTO diaries VALUES('It is Mroonga'); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('select', 'table', 'diaries', 'filter', 'title @ "Groonga"'); +--enable_cursor_protocol DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test index 720c547c0f7..1dcb143de29 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_command_special-database-name.test @@ -30,7 +30,10 @@ CREATE TABLE diaries ( FULLTEXT KEY (title) ) DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command('dump --dump_plugins no'); +--enable_cursor_protocol DROP TABLE diaries; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test index 3958782a4bc..8f9013bc87b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_dynamic_keyword.test @@ -32,9 +32,12 @@ CREATE TABLE keywords ( INSERT INTO keywords VALUES ('Mroonga'); INSERT INTO keywords VALUES ('Groonga'); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', keyword) AS highlighted FROM keywords; +--enable_cursor_protocol --disable_query_log DROP TABLE keywords; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test index 98643876058..bac040e69b3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_multiple_keywords.test @@ -18,8 +18,11 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', 'Mroonga', 'Groonga') AS highlighted; +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test index 83e5966d39e..a774f361fe3 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_highlight_html_normalizer.test @@ -18,8 +18,11 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_highlight_html('Mroonga is the Groonga based storage engine.', 'mroonga') AS highlighted; +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test index aa2eee53b53..108f28ce952 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_default.test @@ -18,7 +18,10 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_normalize('aBcAbCã‘'); +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test index bb9199f012f..bcaec1fe4da 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_normalize_normalizer.test @@ -18,7 +18,10 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_normalize('aBcAbCã‘', "NormalizerAuto"); +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test index a92e651cfd4..69297ed3152 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_dynamic_keyword.test @@ -32,9 +32,12 @@ CREATE TABLE keywords ( INSERT INTO keywords VALUES ('Mroonga'); INSERT INTO keywords VALUES ('Groonga'); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_snippet_html('Mroonga is the Groonga based storage engine.', keyword) as snippet FROM keywords; +--enable_cursor_protocol --disable_query_log DROP TABLE keywords; diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test index 54953ebea59..a968c7b924e 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/function_snippet_html_multiple_keywords.test @@ -18,8 +18,11 @@ --source ../../include/mroonga/have_mroonga.inc --source ../../include/mroonga/load_mroonga_functions.inc +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_snippet_html('Mroonga is the Groonga based storage engine.', 'Mroonga', 'Groonga') as snippet; +--enable_cursor_protocol --source ../../include/mroonga/unload_mroonga_functions.inc --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test index 2d65b763aac..2fc986a27ee 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/information_schema_plugins.test @@ -16,7 +16,7 @@ --source ../../include/mroonga/have_mroonga.inc -select PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_TYPE +select PLUGIN_NAME, PLUGIN_TYPE from information_schema.plugins where plugin_name = "Mroonga"; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test b/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test index d9795eabdb6..848d800b5ea 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/variable_version.test @@ -17,6 +17,7 @@ --source ../../include/mroonga/have_mroonga.inc # show variables like 'groonga%'; +--replace_column 2 # show variables like 'mroonga_version'; --source ../../include/mroonga/have_mroonga_deinit.inc diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test index 21e80a74fd6..ac828ddb1ac 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_cp932.test @@ -46,7 +46,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test index f98d0e0da2c..d6d17396760 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/alter_table_add_column_multibyte_utf8.test @@ -46,7 +46,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test index 5898e3772c6..f06f6cfe94e 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_cp932.test @@ -45,7 +45,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (–¼‘O) AGAINST ('+‚½‚È‚©' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test index c646a1d2eba..a61382949fe 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/column_multibyte_utf8.test @@ -45,7 +45,10 @@ SELECT * FROM users; SELECT * FROM users WHERE MATCH (åå‰) AGAINST ('+ãŸãªã‹' IN BOOLEAN MODE); +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no --dump_records no"); +--enable_cursor_protocol DROP TABLE users; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test index e6dd9908002..c609df9d03d 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_comment_combined.test @@ -27,7 +27,10 @@ CREATE TABLE bugs ( ) DEFAULT CHARSET=utf8 COMMENT='Free style normal comment, engine "InnoDB"'; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE bugs; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test index 45c758173d4..920fa63a46c 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_multiple_token_filters.test @@ -35,7 +35,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord,TokenFilterStopWord"' ) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test index 64732efd8ec..55e31124c18 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_one_token_filter.test @@ -35,7 +35,10 @@ CREATE TABLE memos ( FULLTEXT INDEX (content) COMMENT 'token_filters "TokenFilterStopWord"' ) COMMENT='engine "InnoDB"' DEFAULT CHARSET=utf8; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test index 3fb0caeadf8..e6b56bae1e0 100644 --- a/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test +++ b/storage/mroonga/mysql-test/mroonga/wrapper/t/create_table_token_filters_index_parameter.test @@ -38,7 +38,10 @@ CREATE TABLE memos ( ) COMMENT='ENGINE "InnoDB"' DEFAULT CHARSET=utf8; SHOW CREATE TABLE memos; +#Check after fix MDEV-31554 +--disable_cursor_protocol SELECT mroonga_command("dump --dump_plugins no"); +--enable_cursor_protocol DROP TABLE memos; diff --git a/storage/mroonga/vendor/groonga/lib/proc/proc_object.c b/storage/mroonga/vendor/groonga/lib/proc/proc_object.c index 380e65531a1..40eb2b51bb5 100644 --- a/storage/mroonga/vendor/groonga/lib/proc/proc_object.c +++ b/storage/mroonga/vendor/groonga/lib/proc/proc_object.c @@ -69,13 +69,15 @@ command_object_remove(grn_ctx *ctx, grn_obj **args, grn_user_data *user_data) { - grn_obj *db; grn_obj *name; grn_bool force; grn_obj *target; grn_bool failed_to_open; - db = grn_ctx_db(ctx); + if (!grn_ctx_db(ctx)) { + GRN_PLUGIN_ERROR(ctx, GRN_INVALID_ARGUMENT, "invalid db assigned"); + return NULL; + } name = grn_plugin_proc_get_var(ctx, user_data, "name", -1); force = grn_plugin_proc_get_var_bool(ctx, user_data, "force", -1, GRN_FALSE); diff --git a/storage/mroonga/vendor/groonga/plugins/functions/index_column.c b/storage/mroonga/vendor/groonga/plugins/functions/index_column.c index 0501007471f..58764944d4f 100644 --- a/storage/mroonga/vendor/groonga/plugins/functions/index_column.c +++ b/storage/mroonga/vendor/groonga/plugins/functions/index_column.c @@ -91,8 +91,7 @@ selector_index_column_df_ratio_between(grn_ctx *ctx, df_ratio = (double)n_match_documents / (double)n_documents; { void *key; - int key_size; - key_size = grn_table_cursor_get_key(ctx, cursor, &key); + grn_table_cursor_get_key(ctx, cursor, &key); } if (min <= df_ratio && df_ratio <= max) { posting.rid = term_id; diff --git a/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c b/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c index 5d5deec69c1..09d3803eddb 100644 --- a/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c +++ b/storage/mroonga/vendor/groonga/plugins/query_expanders/tsv.c @@ -196,7 +196,6 @@ load_synonyms(grn_ctx *ctx) const char *path; grn_file_reader *file_reader; int number_of_lines; - grn_encoding encoding; grn_obj line, key, value; grn_getenv("GRN_QUERY_EXPANDER_TSV_SYNONYMS_FILE", @@ -234,7 +233,7 @@ load_synonyms(grn_ctx *ctx) } number_of_lines++; if (number_of_lines == 1) { - encoding = guess_encoding(ctx, &line_value, &line_length); + guess_encoding(ctx, &line_value, &line_length); } GRN_BULK_REWIND(&key); GRN_BULK_REWIND(&value); diff --git a/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c b/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c index 7f64f3c17d9..411000f7dbf 100644 --- a/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c +++ b/storage/mroonga/vendor/groonga/plugins/suggest/suggest.c @@ -653,7 +653,7 @@ learner_init(grn_ctx *ctx, grn_suggest_learner *learner, static void learner_init_columns(grn_ctx *ctx, grn_suggest_learner *learner) { - grn_id events_id, event_types_id; + grn_id events_id; grn_obj *seqs, *events, *post_item, *items, *pairs; learner->seqs = seqs = grn_ctx_at(ctx, GRN_OBJ_GET_DOMAIN(learner->seq)); @@ -665,7 +665,7 @@ learner_init_columns(grn_ctx *ctx, grn_suggest_learner *learner) learner->events_type = grn_obj_column(ctx, events, CONST_STR_LEN("type")); learner->events_time = grn_obj_column(ctx, events, CONST_STR_LEN("time")); - event_types_id = grn_obj_get_range(ctx, learner->events_type); + grn_obj_get_range(ctx, learner->events_type); learner->event_types = grn_obj_column(ctx, events, CONST_STR_LEN("time")); post_item = learner->post_item; diff --git a/storage/perfschema/unittest/stub_pfs_global.h b/storage/perfschema/unittest/stub_pfs_global.h index e6876dccfe6..1c5848d19d9 100644 --- a/storage/perfschema/unittest/stub_pfs_global.h +++ b/storage/perfschema/unittest/stub_pfs_global.h @@ -57,8 +57,7 @@ void *pfs_malloc(PFS_builtin_memory_class *klass, size_t size, myf) void pfs_free(PFS_builtin_memory_class *, size_t, void *ptr) { - if (ptr != NULL) - aligned_free(ptr); + aligned_free(ptr); } void *pfs_malloc_array(PFS_builtin_memory_class *klass, size_t n, size_t size, myf flags) diff --git a/storage/perfschema/unittest/stub_print_error.h b/storage/perfschema/unittest/stub_print_error.h index a02e2478d27..217a2ea7beb 100644 --- a/storage/perfschema/unittest/stub_print_error.h +++ b/storage/perfschema/unittest/stub_print_error.h @@ -23,21 +23,23 @@ #include #include #include +#include "aligned.h" +#include "assume_aligned.h" bool pfs_initialized= false; void *pfs_malloc(PFS_builtin_memory_class *klass, size_t size, myf flags) { - void *ptr= malloc(size); + size= MY_ALIGN(size, CPU_LEVEL1_DCACHE_LINESIZE); + void *ptr= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); if (ptr && (flags & MY_ZEROFILL)) - memset(ptr, 0, size); + memset_aligned(ptr, 0, size); return ptr; } void pfs_free(PFS_builtin_memory_class *, size_t, void *ptr) { - if (ptr != NULL) - free(ptr); + aligned_free(ptr); } void *pfs_malloc_array(PFS_builtin_memory_class *klass, size_t n, size_t size, myf flags) diff --git a/storage/rocksdb/mysql-test/rocksdb/include/deadlock_stats.inc b/storage/rocksdb/mysql-test/rocksdb/include/deadlock_stats.inc index 48ef6f816bd..098aa0fbf45 100644 --- a/storage/rocksdb/mysql-test/rocksdb/include/deadlock_stats.inc +++ b/storage/rocksdb/mysql-test/rocksdb/include/deadlock_stats.inc @@ -1,3 +1,8 @@ +if (`SELECT $PS_PROTOCOL + $CURSOR_PROTOCOL > 0`) +{ + --skip Test temporarily disabled for ps-protocol and cursor-protocol +} + let $prior_set_lwt = `select concat('set @prior_lock_wait_timeout = @@', '$engine', '_lock_wait_timeout;')`; let $prior_set_dld = `select concat('set @prior_deadlock_detect = @@', diff --git a/storage/rocksdb/mysql-test/rocksdb/include/group_min_max.inc b/storage/rocksdb/mysql-test/rocksdb/include/group_min_max.inc index 27d73e8d815..9adb285de3c 100644 --- a/storage/rocksdb/mysql-test/rocksdb/include/group_min_max.inc +++ b/storage/rocksdb/mysql-test/rocksdb/include/group_min_max.inc @@ -1432,10 +1432,12 @@ INSERT INTO t1(c1,c2) VALUES (4,14), (4,15), (4,16), (4,17), (4,18), (4,19), (4,20),(5,5); ANALYZE TABLE t1; +--disable_cursor_protocol EXPLAIN SELECT MAX(c2), c1 FROM t1 WHERE c1 = 4 GROUP BY c1; FLUSH STATUS; SELECT MAX(c2), c1 FROM t1 WHERE c1 = 4 GROUP BY c1; SHOW SESSION STATUS LIKE 'Handler_read%'; +--enable_cursor_protocol DROP TABLE t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test index aeadf5381b0..64d38a5e571 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/2pc_group_commit.test @@ -35,9 +35,11 @@ SET GLOBAL rocksdb_flush_log_at_trx_commit=1; --echo ## --echo ## 2PC + durability + single thread --echo ## +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits from information_schema.global_status where variable_name='Binlog_commits'; @@ -63,9 +65,11 @@ set debug_dbug='-d,rocksdb_enable_delay_commits'; --echo ## --echo ## 2PC + durability + group commit --echo ## +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" @@ -90,9 +94,11 @@ set debug_dbug='-d,rocksdb_disable_delay_commits'; SET GLOBAL rocksdb_enable_2pc=1; SET GLOBAL rocksdb_flush_log_at_trx_commit=0; +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select IF(variable_value - @b1 = 1000, 'OK', variable_value - @b1) as Binlog_commits @@ -106,9 +112,11 @@ from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --echo # 2PC enabled, MyRocks durability disabled, concurrent workload --echo ## +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" @@ -132,9 +140,11 @@ from information_schema.global_status where variable_name='Rocksdb_wal_synced'; SET GLOBAL rocksdb_enable_2pc=0; SET GLOBAL rocksdb_flush_log_at_trx_commit=1; +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=1 --number-of-queries=1000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" @@ -148,9 +158,11 @@ from information_schema.global_status where variable_name='Rocksdb_wal_synced'; --echo ## --echo # 2PC disabled, MyRocks durability enabled, concurrent workload --echo ## +--disable_cursor_protocol select variable_value into @b1 from information_schema.global_status where variable_name='Binlog_commits'; select variable_value into @b2 from information_schema.global_status where variable_name='Binlog_group_commits'; select variable_value into @b3 from information_schema.global_status where variable_name='Rocksdb_wal_synced'; +--enable_cursor_protocol --exec $MYSQL_SLAP --silent --concurrency=50 --number-of-queries=10000 --query="INSERT INTO t1 (id, value) VALUES(NULL, 1)" select variable_value - @b1 as Binlog_commits diff --git a/storage/rocksdb/mysql-test/rocksdb/t/autoinc_debug.test b/storage/rocksdb/mysql-test/rocksdb/t/autoinc_debug.test index 99e28f3b55e..280c59a6a1d 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/autoinc_debug.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/autoinc_debug.test @@ -67,7 +67,9 @@ commit; --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --disable_reconnect +--disable_cursor_protocol select max(i) into @row_max from t; +--enable_cursor_protocol select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't'; --echo # After engine prepare @@ -83,7 +85,9 @@ commit; --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --disable_reconnect +--disable_cursor_protocol select max(i) into @row_max from t; +--enable_cursor_protocol select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't'; --echo # After binlog @@ -99,7 +103,9 @@ commit; --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --disable_reconnect +--disable_cursor_protocol select max(i) into @row_max from t; +--enable_cursor_protocol select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't'; --echo # After everything @@ -115,7 +121,9 @@ commit; --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc --disable_reconnect +--disable_cursor_protocol select max(i) into @row_max from t; +--enable_cursor_protocol select table_schema, table_name, auto_increment > @row_max from information_schema.tables where table_name = 't'; drop table t; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/autoinc_vars_thread_2.test b/storage/rocksdb/mysql-test/rocksdb/t/autoinc_vars_thread_2.test index b64af16411b..83ef7c0ff29 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/autoinc_vars_thread_2.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/autoinc_vars_thread_2.test @@ -99,10 +99,12 @@ while ($i > 0) # smallest value in the sequence for thread 'thr' that is greater than # the pk in the previous row. let $file = `SELECT CONCAT(@@datadir, "test_export.txt")`; +--disable_cursor_protocol --disable_query_log --echo SELECT * FROM t1 ORDER BY pk INTO OUTFILE ; eval SELECT * FROM t1 ORDER BY pk INTO OUTFILE "$file"; --enable_query_log +--enable_cursor_protocol let ROCKSDB_OUTFILE = $file; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter3.test b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter3.test index dc2a0da506d..41909a584ff 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter3.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter3.test @@ -29,7 +29,9 @@ while ($i <= 10000) { ## HA_READ_PREFIX_LAST_OR_PREV # BF len 21 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and time >= 0 and time <= 9223372036854775807 and visibility = 1 order by time desc; select case when variable_value-@c > 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -47,7 +49,9 @@ explain select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 and time >= 0 and time <= 9223372036854775807 order by time desc; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol # MariaDB: no support for optimizer_force_index_for_range: #set @tmp_force_index_for_range=@@optimizer_force_index_for_range; #set optimizer_force_index_for_range=on; @@ -56,34 +60,46 @@ select case when variable_value-@c > 0 then 'true' else 'false' end from informa #set global optimizer_force_index_for_range=@tmp_force_index_for_range; # BF len 13 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type3`) where id1 = 100 and time >= 0 and time <= 9223372036854775807 and visibility = 1 order by time desc; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; ## HA_READ_PREFIX_LAST_OR_PREV (no end range) # BF len 20 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and visibility = 1 and time >= 0 order by time desc; select case when variable_value-@c > 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; # BF len 19 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 and time >= 0 order by time desc; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; --echo ## HA_READ_PREFIX_LAST --echo # BF len 20 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type`) where id1 = 100 and link_type = 1 and visibility = 1 order by time desc; select case when variable_value-@c > 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; --echo # BF len 19 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type2`) where id1 = 100 and link_type = 1 order by time desc; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; --echo # BF len 12 +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select id1, id2, link_type, visibility, data, time, version from linktable FORCE INDEX(`id1_type3`) where id1 = 100 and visibility = 1 order by time desc; select case when variable_value-@c = 0 then 'true' else 'false' end from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -125,7 +141,9 @@ explain select * from t1 where kp0=1 and kp1=1 and kp2=0x12FFFFFFFFFF order by kp3 desc; show status like '%rocksdb_bloom_filter_prefix%'; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol select * from t1 where kp0=1 and kp1=1 and kp2=0x12FFFFFFFFFF order by kp3 desc; show status like '%rocksdb_bloom_filter_prefix%'; --echo # The following MUST show TRUE: diff --git a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter4.test b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter4.test index 76ec6ca101f..0139b7e442e 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter4.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter4.test @@ -4,6 +4,8 @@ # This test inserts 20,000 rows into t1, then selecting one by one from stored procedure. # If the select does not return any row, it is wrong. +--disable_ps_protocol +--disable_cursor_protocol CREATE TABLE t1 ( `id1` int unsigned NOT NULL DEFAULT '0', `id2` int unsigned NOT NULL DEFAULT '0', @@ -49,4 +51,5 @@ CALL select_test(); DROP PROCEDURE select_test; drop table t1; - +--enable_cursor_protocol +--enable_ps_protocol diff --git a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter_bulk_load.test b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter_bulk_load.test index 09d9d734f9e..e159cab2f0c 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter_bulk_load.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/bloomfilter_bulk_load.test @@ -21,12 +21,16 @@ while ($t <= 2) { set session rocksdb_bulk_load=0; # bloom filter should be useful on insert (calling GetForUpdate) +--disable_cursor_protocol select variable_value into @h from information_schema.global_status where variable_name='rocksdb_block_cache_filter_hit'; +--enable_cursor_protocol insert into r1 values (100, 100); select variable_value-@h from information_schema.global_status where variable_name='rocksdb_block_cache_filter_hit'; # cf2 has no bloo filter in the bottommost level +--disable_cursor_protocol select variable_value into @h from information_schema.global_status where variable_name='rocksdb_block_cache_filter_hit'; +--enable_cursor_protocol insert into r2 values (100, 100); select variable_value-@h from information_schema.global_status where variable_name='rocksdb_block_cache_filter_hit'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/cardinality.test b/storage/rocksdb/mysql-test/rocksdb/t/cardinality.test index 1dcb176e4fa..6dcea5ccc4e 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/cardinality.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/cardinality.test @@ -21,8 +21,10 @@ column_name="a"; ANALYZE TABLE t0; --enable_result_log +--disable_cursor_protocol SELECT table_rows into @N FROM information_schema.tables WHERE table_name = "t0"; +--enable_cursor_protocol SELECT FLOOR(@N/cardinality) FROM information_schema.statistics where table_name="t0" and column_name="id"; SELECT FLOOR(@N/cardinality) FROM @@ -35,8 +37,10 @@ SET GLOBAL rocksdb_force_flush_memtable_now = 1; ANALYZE TABLE t0; --enable_result_log +--disable_cursor_protocol SELECT table_rows into @N FROM information_schema.tables WHERE table_name = "t0"; +--enable_cursor_protocol SELECT FLOOR(@N/cardinality) FROM information_schema.statistics where table_name="t0" and column_name="id"; SELECT FLOOR(@N/cardinality) FROM @@ -111,8 +115,10 @@ while ($i<100) # Cardinality of key c should be 1 for c, 10 for b, 100 for a and the other fields. SET GLOBAL rocksdb_force_flush_memtable_now = 1; ANALYZE TABLE t2; +--disable_cursor_protocol --echo cardinality of the columns after 'a' must be equal to the cardinality of column 'a' SELECT CARDINALITY INTO @c FROM information_schema.statistics WHERE TABLE_NAME='t2' AND INDEX_NAME='c' AND COLUMN_NAME='a'; +--enable_cursor_protocol SELECT COLUMN_NAME, CARDINALITY = @c FROM information_schema.statistics WHERE TABLE_NAME='t2' AND INDEX_NAME='c' AND SEQ_IN_INDEX > 3; drop table t1, t2; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/col_opt_not_null.test b/storage/rocksdb/mysql-test/rocksdb/t/col_opt_not_null.test index 1de4ccee0f7..157e1d637e7 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/col_opt_not_null.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/col_opt_not_null.test @@ -95,7 +95,11 @@ let $extra_col_opts = NOT NULL; set @col_opt_not_nullsave_time_zone=@@time_zone; set time_zone='UTC'; +--disable_cursor_protocol +--disable_ps_protocol --source type_date_time.inc +--enable_ps_protocol +--enable_cursor_protocol SET TIMESTAMP=UNIX_TIMESTAMP('2013-12-12 12:12:12'); @@ -122,9 +126,13 @@ SET TIMESTAMP=UNIX_TIMESTAMP('2013-12-12 12:12:12'); --let $col_default = '2012' --source col_not_null.inc +--disable_cursor_protocol +--disable_ps_protocol --let $col_type = YEAR(2) --let $col_default = '12' --source col_not_null.inc +--enable_ps_protocol +--enable_cursor_protocol set time_zone= @col_opt_not_nullsave_time_zone; @@ -156,8 +164,10 @@ set time_zone= @col_opt_not_nullsave_time_zone; --echo # Floating point columns (FLOAT, DOUBLE) --echo ######################## +--disable_ps_protocol --source type_float.inc - +--enable_ps_protocol + --let $col_type = FLOAT --let $col_default = 1.1 --source col_not_null.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/col_opt_null.test b/storage/rocksdb/mysql-test/rocksdb/t/col_opt_null.test index c41abb78642..21adac66fc5 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/col_opt_null.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/col_opt_null.test @@ -91,7 +91,11 @@ let $extra_col_opts = NULL; set @col_opt_nullsave_time_zone=@@time_zone; set time_zone='UTC'; +--disable_cursor_protocol +--disable_ps_protocol --source type_date_time.inc +--enable_ps_protocol +--enable_cursor_protocol --let $col_type = DATE --let $col_default = '2012-12-21' @@ -113,9 +117,13 @@ set time_zone='UTC'; --let $col_default = '2012' --source col_null.inc +--disable_cursor_protocol +--disable_ps_protocol --let $col_type = YEAR(2) --let $col_default = '12' --source col_null.inc +--enable_ps_protocol +--enable_cursor_protocol set time_zone=@col_opt_nullsave_time_zone; @@ -146,8 +154,10 @@ set time_zone=@col_opt_nullsave_time_zone; --echo # Floating point columns (FLOAT, DOUBLE) --echo ######################## +--disable_ps_protocol --source type_float.inc - +--enable_ps_protocol + --let $col_type = FLOAT --let $col_default = 1.1 --source col_null.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/deadlock_stats.test b/storage/rocksdb/mysql-test/rocksdb/t/deadlock_stats.test index a9b30a4273a..d8461a26645 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/deadlock_stats.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/deadlock_stats.test @@ -1,3 +1,7 @@ let $engine=rocksdb; +if (`SELECT $CURSOR_PROTOCOL != 0`) +{ + --skip Test temporarily disabled for cursor-protocol +} --source include/deadlock_stats.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/drop_table3.inc b/storage/rocksdb/mysql-test/rocksdb/t/drop_table3.inc index 1a044384a45..dd9a19a29cb 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/drop_table3.inc +++ b/storage/rocksdb/mysql-test/rocksdb/t/drop_table3.inc @@ -29,7 +29,9 @@ let $max = 50000; let $table = t1; --source drop_table3_repopulate_table.inc +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_compact_read_bytes'; +--enable_cursor_protocol if ($truncate_table) { truncate table t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/handler_basic.test b/storage/rocksdb/mysql-test/rocksdb/t/handler_basic.test index 22b5d69780d..21ee4b9b3ba 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/handler_basic.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/handler_basic.test @@ -8,6 +8,8 @@ DROP TABLE IF EXISTS t1; --enable_warnings +--disable_cursor_protocol + FLUSH STATUS; CREATE TABLE t1 (id INT PRIMARY KEY, a VARCHAR(100), b INT, INDEX b(b)) ENGINE=rocksdb; @@ -49,5 +51,7 @@ FLUSH STATUS; SELECT * FROM t1 WHERE id < 8 ORDER BY id; SHOW SESSION STATUS LIKE 'Handler_read%'; +--enable_cursor_protocol + # Cleanup DROP TABLE t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/hermitage.inc b/storage/rocksdb/mysql-test/rocksdb/t/hermitage.inc index 17baf5b6c57..ba88c603568 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/hermitage.inc +++ b/storage/rocksdb/mysql-test/rocksdb/t/hermitage.inc @@ -111,7 +111,9 @@ commit; connection con1; update test set value = value + 10; connection con2; +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_snapshot_conflict_errors'; +--enable_cursor_protocol select * from test; send delete from test where value = 20; connection con1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/no_merge_sort.test b/storage/rocksdb/mysql-test/rocksdb/t/no_merge_sort.test index ccef7182c11..cde1d4ef1fc 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/no_merge_sort.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/no_merge_sort.test @@ -21,8 +21,10 @@ while ($i < 30) { inc $j; } + --disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='Sort_merge_passes'; eval SELECT a, b, c FROM ti_nk ORDER BY a,b,c INTO OUTFILE '$datadir/select.out'; + --enable_cursor_protocol --remove_file $datadir/select.out select case when variable_value-@s = 0 then 'true' else 'false' end as skip_merge_sort from information_schema.global_status where variable_name='Sort_merge_passes'; inc $i; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/perf_context.test b/storage/rocksdb/mysql-test/rocksdb/t/perf_context.test index ee41324a34d..26bea857ed3 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/perf_context.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/perf_context.test @@ -72,8 +72,10 @@ AND VALUE > 0; SELECT COUNT(*) from INFORMATION_SCHEMA.ROCKSDB_PERF_CONTEXT_GLOBAL WHERE STAT_TYPE = 'IO_WRITE_NANOS' AND VALUE > 0; +--disable_cursor_protocol SELECT VALUE INTO @a from INFORMATION_SCHEMA.ROCKSDB_PERF_CONTEXT_GLOBAL WHERE STAT_TYPE = 'IO_WRITE_NANOS'; +--enable_cursor_protocol # Single statement writes do show up in per-table stats INSERT INTO t2 VALUES (5), (6), (7), (8); @@ -83,8 +85,10 @@ WHERE TABLE_NAME = 't2' AND STAT_TYPE = 'IO_WRITE_NANOS' AND VALUE > 0; +--disable_cursor_protocol SELECT VALUE INTO @b from INFORMATION_SCHEMA.ROCKSDB_PERF_CONTEXT_GLOBAL WHERE STAT_TYPE = 'IO_WRITE_NANOS'; +--enable_cursor_protocol SELECT CASE WHEN @b - @a > 0 THEN 'true' ELSE 'false' END; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/prefix_extractor_override.test b/storage/rocksdb/mysql-test/rocksdb/t/prefix_extractor_override.test index 8fa43e15827..ffad670a0bf 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/prefix_extractor_override.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/prefix_extractor_override.test @@ -22,7 +22,9 @@ set global rocksdb_force_flush_memtable_now = 1; SELECT * FROM information_schema.rocksdb_cf_options WHERE option_type like '%prefix_extractor%'; # BF used (4+8+8+8) +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -48,7 +50,9 @@ SELECT * FROM information_schema.rocksdb_cf_options WHERE option_type like '%pre # Satisfies can_use_bloom_filter (4+8+8+8), but can't use because the old SST # files have old prefix extractor +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -67,7 +71,9 @@ set global rocksdb_force_flush_memtable_now = 1; # BF used w/ new prefix extractor (4+8+8+8) (still increments once because it # needs to check the new SST file, but doesnt increment for SST file with old # extractor) +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -81,7 +87,9 @@ set global rocksdb_force_flush_memtable_now = 1; # should have 3 sst files, one with old prefix extractor and two with new SELECT COUNT(*) FROM information_schema.rocksdb_index_file_map WHERE COLUMN_FAMILY != 1; +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=1 AND id3=1; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; @@ -89,7 +97,9 @@ SET @@global.rocksdb_update_cf_options = ''; set global rocksdb_compact_cf='cf1'; # Select the updated, make sure bloom filter is checked now +--disable_cursor_protocol select variable_value into @u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; +--enable_cursor_protocol SELECT COUNT(*) FROM t1 WHERE id1=1 AND id2=30 AND id3=30; select variable_value-@u from information_schema.global_status where variable_name='rocksdb_bloom_filter_prefix_checked'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/read_only_tx.test b/storage/rocksdb/mysql-test/rocksdb/t/read_only_tx.test index 3a1025a3623..dfd119a0a8c 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/read_only_tx.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/read_only_tx.test @@ -18,8 +18,10 @@ CREATE TABLE t1 (id INT, value int, PRIMARY KEY (id), INDEX (value)) ENGINE=Rock INSERT INTO t1 VALUES (1,1); # Read-only, long-running transaction. SingleDelete/Put shouldn't increase much. +--disable_cursor_protocol select variable_value into @p from information_schema.global_status where variable_name='rocksdb_number_sst_entry_put'; select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; +--enable_cursor_protocol #-- replace_result $uuid uuid START TRANSACTION WITH CONSISTENT SNAPSHOT; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_qcache.test b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_qcache.test index 0369e758f5d..e2c13748386 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_qcache.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_qcache.test @@ -11,6 +11,7 @@ set @@global.query_cache_size=1024*1024; --enable_connect_log +--disable_cursor_protocol create table t1 (pk int primary key, c char(8)) engine=RocksDB; insert into t1 values (1,'new'),(2,'new'); @@ -35,6 +36,7 @@ show status like 'Qcache_not_cached'; show global status like 'Qcache_hits'; drop table t1; +--enable_cursor_protocol # # Cleanup diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_row_stats.test b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_row_stats.test index ebcc741fc17..ec99aa98278 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_row_stats.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_row_stats.test @@ -1,6 +1,7 @@ source include/have_rocksdb.inc; create table t1 (a int primary key) engine=rocksdb; +--disable_cursor_protocol -- echo Verify rocksdb_rows_inserted select variable_value into @old_rows_inserted from information_schema.global_status where variable_name = 'rocksdb_rows_inserted'; insert into t1 values(1); @@ -51,6 +52,7 @@ select variable_value into @old_system_rows_deleted from information_schema.glob delete from t1; select variable_value into @new_system_rows_deleted from information_schema.global_status where variable_name = 'rocksdb_system_rows_deleted'; select @new_system_rows_deleted - @old_system_rows_deleted; +--enable_cursor_protocol drop table t1; use test; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/select.test b/storage/rocksdb/mysql-test/rocksdb/t/select.test index 3d9bdc7b4b8..fc6cd7c5d10 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/select.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/select.test @@ -68,6 +68,7 @@ SELECT * FROM t2 WHERE a>0 PROCEDURE ANALYSE(); # SELECT INTO let $datadir = `SELECT @@datadir`; +--disable_cursor_protocol --replace_result $datadir eval SELECT t1.a, t2.b FROM t2, t1 WHERE t1.a = t2.a ORDER BY t2.b, t1.a @@ -94,6 +95,7 @@ SELECT t1.*, t2.* FROM t1, t2 ORDER BY t2.b, t1.a, t2.a, t1.b, t1.pk, t2.pk LIMI SELECT MIN(a), MAX(a) FROM t1 INTO @min, @max; SELECT @min, @max; +--enable_cursor_protocol # Joins diff --git a/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test b/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test index 55854710c31..5fc52a5142c 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/show_table_status.test @@ -81,9 +81,11 @@ flush tables; select create_time is not null, update_time is not null, check_time from information_schema.tables where table_schema=database() and table_name='t1'; +--disable_cursor_protocol select create_time, update_time into @create_tm, @update_tm from information_schema.tables where table_schema=database() and table_name='t1'; +--enable_cursor_protocol select sleep(3); insert into t1 values (2); @@ -109,9 +111,11 @@ where table_schema=database() and table_name='t1'; insert into t1 values (5,5); +--disable_cursor_protocol select create_time, update_time into @create_tm, @update_tm from information_schema.tables where table_schema=database() and table_name='t1'; +--enable_cursor_protocol --echo # Then, an in-place ALTER TABLE: select sleep(2); @@ -126,9 +130,11 @@ where table_schema=database() and table_name='t1'; --echo # Check TRUNCATE TABLE insert into t1 values (10,10); +--disable_cursor_protocol select create_time, update_time into @create_tm, @update_tm from information_schema.tables where table_schema=database() and table_name='t1'; +--enable_cursor_protocol select sleep(2); truncate table t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/singledelete.test b/storage/rocksdb/mysql-test/rocksdb/t/singledelete.test index 5a9d17e0255..9de2a899eda 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/singledelete.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/singledelete.test @@ -3,8 +3,10 @@ # only SingleDelete increases CREATE TABLE t1 (id INT, value int, PRIMARY KEY (id), INDEX (value)) ENGINE=RocksDB; INSERT INTO t1 VALUES (1,1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { @@ -21,8 +23,10 @@ select case when variable_value-@d < 10 then 'true' else 'false' end from inform # both SingleDelete and Delete increases CREATE TABLE t2 (id INT, value int, PRIMARY KEY (id), INDEX (value)) ENGINE=RocksDB; INSERT INTO t2 VALUES (1,1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { @@ -38,8 +42,10 @@ select case when variable_value-@d > 9000 then 'true' else 'false' end from info # only Delete increases CREATE TABLE t3 (id INT, value int, PRIMARY KEY (id)) ENGINE=RocksDB; INSERT INTO t3 VALUES (1,1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { @@ -55,8 +61,10 @@ select case when variable_value-@d > 9000 then 'true' else 'false' end from info # only SingleDelete increases CREATE TABLE t4 (id INT, PRIMARY KEY (id)) ENGINE=RocksDB; INSERT INTO t4 VALUES (1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { @@ -72,8 +80,10 @@ select case when variable_value-@d < 10 then 'true' else 'false' end from inform # only SingleDelete increases CREATE TABLE t5 (id1 INT, id2 INT, PRIMARY KEY (id1, id2), INDEX(id2)) ENGINE=RocksDB; INSERT INTO t5 VALUES (1, 1); +--disable_cursor_protocol select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete'; select variable_value into @d from information_schema.global_status where variable_name='rocksdb_number_sst_entry_delete'; +--enable_cursor_protocol --disable_query_log let $i = 1; while ($i <= 10000) { diff --git a/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary.test b/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary.test index 38bfb2eef8f..d8f17a7cbb9 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary.test @@ -516,7 +516,9 @@ set global rocksdb_enable_ttl=0; set global rocksdb_force_flush_memtable_now=1; set global rocksdb_compact_cf='default'; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_enable_ttl=1; set global rocksdb_compact_cf='default'; @@ -537,7 +539,9 @@ INSERT INTO t1 values (1); INSERT INTO t1 values (2); INSERT INTO t1 values (3); +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_force_flush_memtable_now=1; set global rocksdb_compact_cf='default'; select variable_value-@c from information_schema.global_status where variable_name='rocksdb_rows_expired'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary_read_filtering.test b/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary_read_filtering.test index 7a7609f456e..a452e932bb5 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary_read_filtering.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/ttl_primary_read_filtering.test @@ -24,7 +24,9 @@ set global rocksdb_force_flush_memtable_now=1; --sorted_result SELECT * FROM t1; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_compact_cf='default'; select variable_value-@c from information_schema.global_status where variable_name='rocksdb_rows_expired'; @@ -78,7 +80,9 @@ INSERT INTO t1 values (7); set global rocksdb_debug_ttl_rec_ts = 0; # should return nothing. +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; @@ -87,7 +91,9 @@ select variable_value-@a from information_schema.global_status where variable_na set global rocksdb_enable_ttl_read_filtering=0; # should return everything +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; @@ -96,7 +102,9 @@ select variable_value-@a from information_schema.global_status where variable_na set global rocksdb_enable_ttl_read_filtering=1; # should return nothing. +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; @@ -125,7 +133,9 @@ INSERT INTO t1 values (1,2,2); INSERT INTO t1 values (1,2,3); set global rocksdb_debug_ttl_rec_ts = 0; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_force_flush_memtable_now=1; @@ -301,27 +311,35 @@ set global rocksdb_compact_cf='default'; # this connection the records have 'expired' already so they are filtered out # even though they have not yet been removed by compaction +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; --echo # Switching to connection 1 connection con1; +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; # <= shouldn't be filtered out here select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; UPDATE t1 set a = a + 1; +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result SELECT * FROM t1; # <= shouldn't be filtered out here select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; COMMIT; +--disable_cursor_protocol select variable_value into @a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; +--enable_cursor_protocol --sorted_result # <= filtered out here because time has passed. SELECT * FROM t1; select variable_value-@a from information_schema.global_status where variable_name='rocksdb_rows_filtered'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary.test b/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary.test index fb439e109e7..49d097b1056 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary.test @@ -582,7 +582,9 @@ set global rocksdb_enable_ttl=0; set global rocksdb_force_flush_memtable_now=1; set global rocksdb_compact_cf='default'; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_enable_ttl=1; set global rocksdb_compact_cf='default'; @@ -604,7 +606,9 @@ INSERT INTO t1 values (1, 1); INSERT INTO t1 values (2, 2); INSERT INTO t1 values (3, 3); +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_force_flush_memtable_now=1; set global rocksdb_compact_cf='default'; select variable_value-@c from information_schema.global_status where variable_name='rocksdb_rows_expired'; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary_read_filtering.test b/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary_read_filtering.test index f6042cc517e..0e83a0f003e 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary_read_filtering.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/ttl_secondary_read_filtering.test @@ -29,7 +29,9 @@ SELECT * FROM t1 FORCE INDEX (PRIMARY); --sorted_result SELECT * FROM t1 FORCE INDEX (kb); +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_debug_ttl_ignore_pk = 1; set global rocksdb_compact_cf='default'; set global rocksdb_debug_ttl_ignore_pk = 0; @@ -145,7 +147,9 @@ INSERT INTO t1 values (1,2,2); INSERT INTO t1 values (1,2,3); set global rocksdb_debug_ttl_rec_ts = 0; +--disable_cursor_protocol select variable_value into @c from information_schema.global_status where variable_name='rocksdb_rows_expired'; +--enable_cursor_protocol set global rocksdb_force_flush_memtable_now=1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/type_char_indexes_collation.test b/storage/rocksdb/mysql-test/rocksdb/t/type_char_indexes_collation.test index d231236bd92..f5134b841aa 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/type_char_indexes_collation.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/type_char_indexes_collation.test @@ -45,8 +45,10 @@ explain select hex(c2) from t IGNORE INDEX (sk1) order by c2; --let $file1=$MYSQLTEST_VARDIR/tmp/filesort_order --let $file2=$MYSQLTEST_VARDIR/tmp/sk_order --disable_query_log +--disable_cursor_protocol --eval select hex(weight_string(c1)) INTO OUTFILE '$file1' from t order by c1 --eval select hex(weight_string(c1)) INTO OUTFILE '$file2' from t IGNORE INDEX (sk1) order by c1 +--enable_cursor_protocol --enable_query_log --diff_files $file1 $file2 @@ -54,8 +56,10 @@ explain select hex(c2) from t IGNORE INDEX (sk1) order by c2; --remove_file $file2 --disable_query_log +--disable_cursor_protocol --eval select hex(weight_string(c2)) INTO OUTFILE '$file1' from t order by c2 --eval select hex(weight_string(c2)) INTO OUTFILE '$file2' from t IGNORE INDEX (sk1) order by c2 +--enable_cursor_protocol --enable_query_log --diff_files $file1 $file2 diff --git a/storage/rocksdb/mysql-test/rocksdb/t/type_date_time.inc b/storage/rocksdb/mysql-test/rocksdb/t/type_date_time.inc index 18ed7436b62..12f9159e049 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/type_date_time.inc +++ b/storage/rocksdb/mysql-test/rocksdb/t/type_date_time.inc @@ -8,6 +8,7 @@ DROP TABLE IF EXISTS t1; --enable_warnings set @save_time_zone=@@time_zone; set time_zone='UTC'; +--disable_cursor_protocol eval CREATE TABLE t1 ( d DATE $extra_col_opts, dt DATETIME $extra_col_opts, @@ -18,6 +19,7 @@ eval CREATE TABLE t1 ( y2 YEAR(2) $extra_col_opts, pk DATETIME PRIMARY KEY ) ENGINE=rocksdb; +--enable_cursor_protocol SHOW COLUMNS IN t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/type_float.inc b/storage/rocksdb/mysql-test/rocksdb/t/type_float.inc index ff58b73a91b..27adda9ba35 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/type_float.inc +++ b/storage/rocksdb/mysql-test/rocksdb/t/type_float.inc @@ -56,6 +56,8 @@ INSERT INTO t1 (f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10,pk) VALUES (-9999 --sorted_result --query_vertical SELECT f,f0,r1_1,f23_0,f20_3,d,d1_0,d10_10,d53,d53_10 FROM t1 +#Enable after fix MDEV-34624 +--disable_cursor_protocol --sorted_result query_vertical SELECT @@ -116,6 +118,7 @@ eval ALTER TABLE t1 ADD COLUMN n66_6 DECIMAL(256,1) $extra_col_opts; # Error occurs on MySQL but not on MariaDB: # --error ER_TOO_BIG_SCALE eval ALTER TABLE t1 ADD COLUMN n66_66 DECIMAL(40,35) $extra_col_opts; +--enable_cursor_protocol DROP TABLE t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/unique_check.test b/storage/rocksdb/mysql-test/rocksdb/t/unique_check.test index e2520388ea7..63ccbd74d24 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/unique_check.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/unique_check.test @@ -1,6 +1,11 @@ --source include/have_rocksdb.inc --source include/have_debug_sync.inc +if (`SELECT $CURSOR_PROTOCOL != 0`) +{ + --skip Test temporarily disabled for cursor-protocol +} + # For GitHub issue#167 -- Unique key check doesn't work connect (con1, localhost, root,,); diff --git a/storage/spider/ha_spider.cc b/storage/spider/ha_spider.cc index 151cf7b4493..9a32cf0c707 100644 --- a/storage/spider/ha_spider.cc +++ b/storage/spider/ha_spider.cc @@ -1126,7 +1126,6 @@ int ha_spider::reset() int ha_spider::extra( enum ha_extra_function operation ) { - int error_num; DBUG_ENTER("ha_spider::extra"); DBUG_PRINT("info",("spider this=%p", this)); DBUG_PRINT("info",("spider operation=%d", (int) operation)); @@ -1172,16 +1171,6 @@ int ha_spider::extra( case HA_EXTRA_INSERT_WITH_UPDATE: wide_handler->insert_with_update = TRUE; break; - case HA_EXTRA_ATTACH_CHILDREN: - DBUG_PRINT("info",("spider HA_EXTRA_ATTACH_CHILDREN")); - if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) - DBUG_RETURN(error_num); - break; - case HA_EXTRA_ADD_CHILDREN_LIST: - DBUG_PRINT("info",("spider HA_EXTRA_ADD_CHILDREN_LIST")); - if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) - DBUG_RETURN(error_num); - break; case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN: DBUG_PRINT("info",("spider HA_EXTRA_STARTING_ORDERED_INDEX_SCAN")); if (table_share->primary_key != MAX_KEY) @@ -4938,13 +4927,6 @@ int ha_spider::info( DBUG_PRINT("info",("spider flag=%x", flag)); auto_inc_temporary = FALSE; wide_handler->sql_command = thd_sql_command(thd); -/* - if ( - sql_command == SQLCOM_DROP_TABLE || - sql_command == SQLCOM_ALTER_TABLE || - sql_command == SQLCOM_SHOW_CREATE - ) { -*/ if (flag & HA_STATUS_AUTO) { if (share->lgtm_tblhnd_share->auto_increment_value) @@ -7042,6 +7024,8 @@ void ha_spider::update_create_info( DBUG_PRINT("info",("spider this=%p", this)); if (wide_handler && wide_handler->sql_command == SQLCOM_ALTER_TABLE) { + if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &store_error_num))) + DBUG_VOID_RETURN; SPIDER_TRX *trx = wide_handler->trx; THD *thd = trx->thd; if (trx->query_id != thd->query_id) @@ -10255,6 +10239,8 @@ int ha_spider::append_lock_tables_list() DBUG_PRINT("info",("spider lock_table_type=%u", wide_handler->lock_table_type)); + if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num))) + DBUG_RETURN(error_num); if ((error_num = spider_check_trx_and_get_conn(wide_handler->trx->thd, this, FALSE))) { diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_34589.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_34589.result new file mode 100644 index 00000000000..557c9031330 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_34589.result @@ -0,0 +1,23 @@ +for master_1 +for child2 +for child3 +set spider_same_server_link= 1; +CREATE USER spider@localhost IDENTIFIED BY 'pwd'; +GRANT ALL ON test.* TO spider@localhost; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'spider',PASSWORD 'pwd'); +SET spider_internal_sql_log_off=0; +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", SRV "srv", TABLE "t1"' PARTITION BY HASH (c) PARTITIONS 2; +CHECK TABLE t2; +Table Op Msg_type Msg_text +test.t2 check error Partition p0 returned error +test.t2 check Error Access denied; you need (at least one of) the SUPER privilege(s) for this operation +test.t2 check Error Access denied; you need (at least one of) the SUPER privilege(s) for this operation +test.t2 check error Unknown - internal error 1227 during operation +drop table t1, t2; +drop server srv; +drop user spider@localhost; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_34636.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_34636.result new file mode 100644 index 00000000000..472a050a4f3 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_34636.result @@ -0,0 +1,20 @@ +for master_1 +for child2 +for child3 +set spider_same_server_link= 1; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +CREATE TABLE t1 (c1 TIME) ENGINE=Spider PARTITION BY HASH(EXTRACT(HOUR_SECOND FROM c1)); +CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; +CREATE TABLE t3 (c1 INT,c2 INT) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t1"'; +INSERT INTO t2 SELECT * FROM t3; +ERROR 21S01: Column count doesn't match value count at row 1 +SELECT * FROM t3; +ERROR HY000: Unable to connect to foreign data source: localhost +ALTER TABLE t1 CHANGE COLUMN c1 d1 INT; +ERROR HY000: Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed +DROP TABLE t1,t2,t3; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_34589.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_34589.test new file mode 100644 index 00000000000..dd465b52db1 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_34589.test @@ -0,0 +1,24 @@ +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +set spider_same_server_link= 1; +CREATE USER spider@localhost IDENTIFIED BY 'pwd'; +GRANT ALL ON test.* TO spider@localhost; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'spider',PASSWORD 'pwd'); +SET spider_internal_sql_log_off=0; +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +CREATE TABLE t2 (c INT) ENGINE=Spider COMMENT='WRAPPER "mysql", SRV "srv", TABLE "t1"' PARTITION BY HASH (c) PARTITIONS 2; +CHECK TABLE t2; +drop table t1, t2; +drop server srv; +drop user spider@localhost; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_34636.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_34636.test new file mode 100644 index 00000000000..08a699b9370 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_34636.test @@ -0,0 +1,29 @@ +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +set spider_same_server_link= 1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +CREATE TABLE t1 (c1 TIME) ENGINE=Spider PARTITION BY HASH(EXTRACT(HOUR_SECOND FROM c1)); +CREATE TABLE t2 (c1 INT) ENGINE=MyISAM; +CREATE TABLE t3 (c1 INT,c2 INT) ENGINE=Spider COMMENT='WRAPPER "mysql",SRV "srv",TABLE "t1"'; +--error ER_WRONG_VALUE_COUNT_ON_ROW +INSERT INTO t2 SELECT * FROM t3; +--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE +SELECT * FROM t3; +--error ER_WRONG_EXPR_IN_PARTITION_FUNC_ERROR +ALTER TABLE t1 CHANGE COLUMN c1 d1 INT; +# Cleanup +DROP TABLE t1,t2,t3; + +drop server srv; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc b/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc index 080ba735a32..325a7523974 100644 --- a/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc +++ b/storage/spider/mysql-test/spider/regression/e1121/t/load_data.inc @@ -41,9 +41,11 @@ eval CREATE TABLE tbl_a ( INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); --disable_query_log --echo SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +--disable_cursor_protocol --disable_ps2_protocol eval SELECT pkey,val INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log eval $COMMAND_BEFORE_LOAD_DATA; @@ -56,9 +58,11 @@ TRUNCATE TABLE mysql.general_log; --connection master_1 --disable_query_log --echo LOAD DATA $OPTION_LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; +--disable_cursor_protocol --disable_ps2_protocol eval LOAD DATA $OPTION_LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log --remove_file $MYSQLTEST_VARDIR/tmp/spider_outfile.tsv diff --git a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc index fd31047ab58..f52d415a032 100644 --- a/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc +++ b/storage/spider/mysql-test/spider/regression/e112122/t/load_data_part.inc @@ -54,9 +54,11 @@ eval CREATE TABLE tbl_a ( INSERT INTO tbl_a (pkey,val) VALUES (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9); --disable_query_log --echo SELECT pkey,val INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; +--disable_cursor_protocol --disable_ps_protocol eval SELECT pkey,val INTO OUTFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' FROM tbl_a ORDER BY pkey; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log eval $COMMAND_BEFORE_LOAD_DATA; @@ -72,9 +74,11 @@ TRUNCATE TABLE mysql.general_log; --connection master_1 --disable_query_log --echo LOAD DATA $OPTION_LOCAL INFILE 'MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; +--disable_cursor_protocol --disable_ps2_protocol eval LOAD DATA $OPTION_LOCAL INFILE '$MYSQLTEST_VARDIR/tmp/spider_outfile.tsv' $OPTION_WORD INTO TABLE tbl_a; --enable_ps2_protocol +--enable_cursor_protocol --enable_query_log --remove_file $MYSQLTEST_VARDIR/tmp/spider_outfile.tsv diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index be74ad69b42..699fc8f2265 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -2529,13 +2529,21 @@ int spider_db_mbase::commit( int spider_db_mbase::rollback( int *need_mon ) { - bool is_error; + bool is_error, save_in_before_query; int error_num= 0; DBUG_ENTER("spider_db_mbase::rollback"); DBUG_PRINT("info",("spider this=%p", this)); spider_lock_before_query(conn, need_mon); - if (spider_db_query(conn, SPIDER_SQL_ROLLBACK_STR, - SPIDER_SQL_ROLLBACK_LEN, -1, need_mon)) + save_in_before_query= conn->in_before_query; + /* + We do not execute the before queries to avoid unnecessary + failures in rollback + */ + conn->in_before_query= TRUE; + error_num= spider_db_query(conn, SPIDER_SQL_ROLLBACK_STR, + SPIDER_SQL_ROLLBACK_LEN, -1, need_mon); + conn->in_before_query= save_in_before_query; + if (error_num) { is_error= conn->thd->is_error(); error_num= spider_db_errorno(conn); diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index 94dc7228cf5..b4041999f16 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -757,7 +757,10 @@ ulonglong my_strntoull_8bit(CHARSET_INFO *cs, return (~(ulonglong) 0); } - return (negative ? -((longlong) i) : (longlong) i); + /* Avoid undefinite behavior - negation of LONGLONG_MIN */ + return negative && (longlong) i != LONGLONG_MIN ? + -((longlong) i) : + (longlong) i; noconv: err[0]= EDOM; diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 5d67762ac2f..845df5e2082 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -617,7 +617,10 @@ bs: return (~(ulonglong) 0); } - return (negative ? -((longlong) res) : (longlong) res); + /* Avoid undefinite behavior - negation of LONGLONG_MIN */ + return negative && (longlong) res != LONGLONG_MIN ? + -((longlong) res) : + (longlong) res; } @@ -1009,6 +1012,8 @@ end4: { if (li > MAX_NEGATIVE_NUMBER) goto overflow; + if (li == MAX_NEGATIVE_NUMBER) // Avoid undefinite behavior in negation + return LONGLONG_MIN; return -((longlong) li); } return (longlong) li; @@ -2513,6 +2518,8 @@ end4: { if (li > MAX_NEGATIVE_NUMBER) goto overflow; + if (li == MAX_NEGATIVE_NUMBER) // Avoid undefinite behavior in negation + return LONGLONG_MIN; return -((longlong) li); } return (longlong) li; diff --git a/strings/my_strtoll10.c b/strings/my_strtoll10.c index 74baef080eb..6c4ccea0b21 100644 --- a/strings/my_strtoll10.c +++ b/strings/my_strtoll10.c @@ -241,8 +241,10 @@ end4: *endptr= (char*) s; if (negative) { - if (li >= MAX_NEGATIVE_NUMBER) // Avoid undefined behavior + if (li > MAX_NEGATIVE_NUMBER) goto overflow; + if (li == MAX_NEGATIVE_NUMBER) // Avoid undefined behavior + return LONGLONG_MIN; return -((longlong) li); } return (longlong) li; diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 289c28d4cf4..89a0661d9b1 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -295,16 +295,22 @@ new_VioSSLFd(const char *key_file, const char *cert_file, /* Set the ciphers that can be used - NOTE: SSL_CTX_set_cipher_list will return 0 if + NOTE: SSL_CTX_set_ciphersuites/SSL_CTX_set_cipher_list will return 0 if none of the provided ciphers could be selected */ - if (cipher && - SSL_CTX_set_ciphersuites(ssl_fd->ssl_context, cipher) == 0 && - SSL_CTX_set_cipher_list(ssl_fd->ssl_context, cipher) == 0) + if (cipher) { - *error= SSL_INITERR_CIPHERS; - DBUG_PRINT("error", ("%s", sslGetErrString(*error))); - goto err2; + int cipher_result= 0; + + cipher_result|= SSL_CTX_set_ciphersuites(ssl_fd->ssl_context, cipher); + cipher_result|= SSL_CTX_set_cipher_list(ssl_fd->ssl_context, cipher); + + if (cipher_result == 0) + { + *error= SSL_INITERR_CIPHERS; + DBUG_PRINT("error", ("%s", sslGetErrString(*error))); + goto err2; + } } /* Load certs from the trusted ca */ diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake index 681a4250e65..f745eeb060b 100644 --- a/win/packaging/heidisql.cmake +++ b/win/packaging/heidisql.cmake @@ -1,4 +1,4 @@ -SET(HEIDISQL_BASE_NAME "HeidiSQL_12.6_32_Portable") +SET(HEIDISQL_BASE_NAME "HeidiSQL_12.8_32_Portable") SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip") SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}") SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})