summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2021-09-30 10:38:44 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2021-09-30 10:38:44 +0300
commita49e394399859b23ba609d0058b498cfa876cac4 (patch)
treed0f1a85011d7e99078624c2185a9ba69796a4262 /mysql-test
parent260649de0472e90be665ae2c442c4435e125b022 (diff)
parentbe803f037f98812410f24b67af61aa7857969dcf (diff)
downloadmariadb-git-a49e394399859b23ba609d0058b498cfa876cac4.tar.gz
Merge 10.5 into 10.6
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/lib/My/SafeProcess/CMakeLists.txt3
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_kill_win.cc109
-rw-r--r--mysql-test/main/errors.result4
-rw-r--r--mysql-test/main/errors.test2
-rw-r--r--mysql-test/main/lock_sync.result3
-rw-r--r--mysql-test/main/lock_sync.test3
-rw-r--r--mysql-test/main/sp-bugs.result4
-rw-r--r--mysql-test/main/sp-lock.result8
-rw-r--r--mysql-test/main/sp-lock.test3
-rw-r--r--mysql-test/main/sp.result19
-rw-r--r--mysql-test/main/sp.test18
-rw-r--r--mysql-test/main/view.result43
-rw-r--r--mysql-test/main/view.test49
-rw-r--r--mysql-test/suite/compat/oracle/r/sp-package.result8
-rw-r--r--mysql-test/suite/galera/disabled.def1
-rw-r--r--mysql-test/suite/galera/r/galera_fulltext.result56
-rw-r--r--mysql-test/suite/galera/r/galera_partition.result2
-rw-r--r--mysql-test/suite/galera/t/galera_fulltext.test66
-rw-r--r--mysql-test/suite/galera/t/galera_partition.cnf4
-rw-r--r--mysql-test/suite/galera/t/galera_partition.test6
-rw-r--r--mysql-test/suite/galera/t/galera_var_ignore_apply_errors.cnf7
-rw-r--r--mysql-test/suite/galera/t/galera_var_ignore_apply_errors.test19
-rw-r--r--mysql-test/suite/innodb/r/innodb_defrag_stats.result214
-rw-r--r--mysql-test/suite/innodb/t/innodb_defrag_stats.test74
-rw-r--r--mysql-test/suite/innodb/t/undo_truncate.test4
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_load.result16
-rw-r--r--mysql-test/suite/plugins/t/feedback_plugin_load.test7
27 files changed, 369 insertions, 383 deletions
diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
index eac1f1be8bd..0004a44982d 100644
--- a/mysql-test/lib/My/SafeProcess/CMakeLists.txt
+++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt
@@ -19,7 +19,8 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
IF (WIN32)
ADD_EXECUTABLE(my_safe_process safe_process_win.cc)
ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc)
- TARGET_LINK_LIBRARIES(my_safe_kill dbghelp psapi)
+ TARGET_INCLUDE_DIRECTORIES(my_safe_kill PRIVATE ${CMAKE_SOURCE_DIR}/include)
+ TARGET_LINK_LIBRARIES(my_safe_kill mysys psapi)
ELSE()
ADD_EXECUTABLE(my_safe_process safe_process.cc)
ENDIF()
diff --git a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
index 4a9d5f2b8cc..375ed80b292 100644
--- a/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_kill_win.cc
@@ -26,19 +26,7 @@
#include <signal.h>
#include <stdlib.h>
#include <psapi.h>
-
-#ifdef _MSC_VER
-/* Silence warning in OS header dbghelp.h */
-#pragma warning(push)
-#pragma warning(disable : 4091)
-#endif
-
-#include <dbghelp.h>
-
-#ifdef _MSC_VER
-/* Silence warning in OS header dbghelp.h */
-#pragma warning(pop)
-#endif
+#include <my_minidump.h>
#include <tlhelp32.h>
#include <vector>
@@ -64,106 +52,13 @@ static std::vector<DWORD> find_children(DWORD pid)
return children;
}
-void dump_single_process(DWORD pid)
-{
- HANDLE file = 0;
- HANDLE process= 0;
- DWORD size= MAX_PATH;
- char path[MAX_PATH];
- char working_dir[MAX_PATH];
- char tmpname[MAX_PATH];
- char *filename= 0;
-
- process= OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid);
- if (!process)
- {
- fprintf(stderr, "safe_kill : cannot open process pid=%lu to create dump, last error %lu\n",
- pid, GetLastError());
- goto exit;
- }
-
- if (QueryFullProcessImageName(process, 0, path, &size) == 0)
- {
- fprintf(stderr, "safe_kill : cannot read process path for pid %lu, last error %lu\n",
- pid, GetLastError());
- goto exit;
- }
-
- filename= strrchr(path, '\\');
- if (filename)
- {
- filename++;
- // We are not interested in dump of some proceses (my_safe_process.exe,cmd.exe)
- // since they are only used to start up other programs.
- // We're interested however in their children;
- const char *exclude_programs[] = {"my_safe_process.exe","cmd.exe", 0};
- for(size_t i=0; exclude_programs[i]; i++)
- if (_stricmp(filename, exclude_programs[i]) == 0)
- goto exit;
- }
- else
- filename= path;
-
- // Add .dmp extension
- char *p;
- if ((p= strrchr(filename, '.')) == 0)
- p= filename + strlen(filename);
-
- strncpy(p, ".dmp", path + MAX_PATH - p);
-
- // Íf file with this name exist, generate unique name with .dmp extension
- if (GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES)
- {
- if (!GetTempFileName(".", filename, 0, tmpname))
- {
- fprintf(stderr, "GetTempFileName failed, last error %lu", GetLastError());
- goto exit;
- }
- strncat_s(tmpname, ".dmp", sizeof(tmpname));
- filename= tmpname;
- }
-
-
- if (!GetCurrentDirectory(MAX_PATH, working_dir))
- {
- fprintf(stderr, "GetCurrentDirectory failed, last error %lu", GetLastError());
- goto exit;
- }
-
- file= CreateFile(filename, GENERIC_READ | GENERIC_WRITE,
- 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
-
- if (file == INVALID_HANDLE_VALUE)
- {
- fprintf(stderr, "safe_kill : CreateFile() failed for file %s, working dir %s, last error = %lu\n",
- filename, working_dir, GetLastError());
- goto exit;
- }
-
- if (!MiniDumpWriteDump(process, pid, file, MiniDumpNormal, 0, 0, 0))
- {
- fprintf(stderr, "Failed to write minidump to %s, working dir %s, last error %lu\n",
- filename, working_dir, GetLastError());
- goto exit;
- }
-
- fprintf(stderr, "Minidump written to %s, directory %s\n", filename, working_dir);
-
-exit:
- if (process != 0 && process != INVALID_HANDLE_VALUE)
- CloseHandle(process);
-
- if (file != 0 && file != INVALID_HANDLE_VALUE)
- CloseHandle(file);
-}
-
static int create_dump(DWORD pid, int recursion_depth= 5)
{
if (recursion_depth < 0)
return 0;
- dump_single_process(pid);
+ my_create_minidump(pid, TRUE);
std::vector<DWORD> children= find_children(pid);
for(size_t i=0; i < children.size(); i++)
create_dump(children[i], recursion_depth -1);
diff --git a/mysql-test/main/errors.result b/mysql-test/main/errors.result
index 44193865493..baa2e0ad3c0 100644
--- a/mysql-test/main/errors.result
+++ b/mysql-test/main/errors.result
@@ -224,10 +224,10 @@ SELECT 4;
END IF ;
END"where name = "P1";
show create procedure P1;
-ERROR HY000: Failed to load routine test.P1 (internal code -6). For more details, run SHOW WARNINGS
+ERROR 42000: Undeclared variable: foo
show warnings;
Level Code Message
Error 1327 Undeclared variable: foo
-Error 1457 Failed to load routine test.P1 (internal code -6). For more details, run SHOW WARNINGS
+Error 1305 PROCEDURE P1 does not exist
drop procedure P1;
# End of 10.4 tests
diff --git a/mysql-test/main/errors.test b/mysql-test/main/errors.test
index a4b95d48e5d..1948eebfcb3 100644
--- a/mysql-test/main/errors.test
+++ b/mysql-test/main/errors.test
@@ -275,7 +275,7 @@ SELECT 4;
END IF ;
END"where name = "P1";
---error ER_SP_PROC_TABLE_CORRUPT
+--error ER_SP_UNDECLARED_VAR
show create procedure P1;
show warnings;
diff --git a/mysql-test/main/lock_sync.result b/mysql-test/main/lock_sync.result
index 70960503fef..25b97460238 100644
--- a/mysql-test/main/lock_sync.result
+++ b/mysql-test/main/lock_sync.result
@@ -221,6 +221,8 @@ end|
# called below.
#
connection con1;
+set @save_dbug=@@debug_dbug;
+set debug_dbug="+d,cache_sp_in_show_create";
# Cache all functions used in the tests below so statements
# calling them won't need to open and lock mysql.proc table
# and we can assume that each statement locks its tables
@@ -245,6 +247,7 @@ show create function f14;
show create function f15;
show create function f16;
show create function f17;
+set debug_dbug=@save_dbug;
connection default;
#
# 1. Statements that read tables and do not use subqueries.
diff --git a/mysql-test/main/lock_sync.test b/mysql-test/main/lock_sync.test
index 16367d74800..b2cb0bc058c 100644
--- a/mysql-test/main/lock_sync.test
+++ b/mysql-test/main/lock_sync.test
@@ -235,6 +235,8 @@ let $con_aux2= con2;
let $table= t1;
connection con1;
+set @save_dbug=@@debug_dbug;
+set debug_dbug="+d,cache_sp_in_show_create";
--echo # Cache all functions used in the tests below so statements
--echo # calling them won't need to open and lock mysql.proc table
--echo # and we can assume that each statement locks its tables
@@ -260,6 +262,7 @@ show create function f14;
show create function f15;
show create function f16;
show create function f17;
+set debug_dbug=@save_dbug;
--enable_result_log
connection default;
diff --git a/mysql-test/main/sp-bugs.result b/mysql-test/main/sp-bugs.result
index 665e787442d..8c6788d03f4 100644
--- a/mysql-test/main/sp-bugs.result
+++ b/mysql-test/main/sp-bugs.result
@@ -168,7 +168,7 @@ RETURN 0;
END latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE FUNCTION TESTF_bug11763507;
Function sql_mode Create Function character_set_client collation_connection Database Collation
-testf_bug11763507 CREATE DEFINER=`root`@`localhost` FUNCTION `testf_bug11763507`() RETURNS int(11)
+TESTF_bug11763507 CREATE DEFINER=`root`@`localhost` FUNCTION `TESTF_bug11763507`() RETURNS int(11)
BEGIN
RETURN 0;
END latin1 latin1_swedish_ci latin1_swedish_ci
@@ -198,7 +198,7 @@ SELECT "PROCEDURE testp_bug11763507";
END latin1 latin1_swedish_ci latin1_swedish_ci
SHOW CREATE PROCEDURE TESTP_bug11763507;
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
-testp_bug11763507 CREATE DEFINER=`root`@`localhost` PROCEDURE `testp_bug11763507`()
+TESTP_bug11763507 CREATE DEFINER=`root`@`localhost` PROCEDURE `TESTP_bug11763507`()
BEGIN
SELECT "PROCEDURE testp_bug11763507";
END latin1 latin1_swedish_ci latin1_swedish_ci
diff --git a/mysql-test/main/sp-lock.result b/mysql-test/main/sp-lock.result
index acf951f6676..ec8d8970ae3 100644
--- a/mysql-test/main/sp-lock.result
+++ b/mysql-test/main/sp-lock.result
@@ -703,9 +703,6 @@ connection default;
#
# SHOW CREATE PROCEDURE p1 called from p1, after p1 was altered
#
-# We are just covering the existing behaviour with tests. The
-# results are not necessarily correct."
-#
CREATE PROCEDURE p1()
BEGIN
SELECT get_lock("test", 10);
@@ -736,10 +733,7 @@ get_lock("test", 10)
1
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
p1 STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `p1`()
-BEGIN
-SELECT get_lock("test", 10);
-SHOW CREATE PROCEDURE p1;
-END latin1 latin1_swedish_ci latin1_swedish_ci
+BEGIN END latin1 latin1_swedish_ci latin1_swedish_ci
connection con3;
disconnect con3;
connection con2;
diff --git a/mysql-test/main/sp-lock.test b/mysql-test/main/sp-lock.test
index 83ea07d4bda..703c59e8f28 100644
--- a/mysql-test/main/sp-lock.test
+++ b/mysql-test/main/sp-lock.test
@@ -807,9 +807,6 @@ connection default;
--echo #
--echo # SHOW CREATE PROCEDURE p1 called from p1, after p1 was altered
--echo #
---echo # We are just covering the existing behaviour with tests. The
---echo # results are not necessarily correct."
---echo #
delimiter |;
CREATE PROCEDURE p1()
diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result
index c460ecaa7bd..26de728391a 100644
--- a/mysql-test/main/sp.result
+++ b/mysql-test/main/sp.result
@@ -8869,6 +8869,25 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
BEGIN
RETURN '';
END' at line 2
+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';
+CREATE PROCEDURE sp0() SELECT 1;
+SHOW CREATE PROCEDURE sp0;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+sp0 STRICT_ALL_TABLES CREATE DEFINER=`root`@`localhost` PROCEDURE `sp0`()
+SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
+DROP PROCEDURE sp0;
+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';
+CREATE PROCEDURE sp1() SELECT 1;
+SHOW CREATE PROCEDURE sp1;
+Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
+sp1 STRICT_ALL_TABLES CREATE DEFINER=`root`@`localhost` PROCEDURE `sp1`()
+SELECT 1 latin1 latin1_swedish_ci latin1_swedish_ci
+SELECT VARIABLE_VALUE-@local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+VARIABLE_VALUE-@local_mem_used
+0
+DROP PROCEDURE sp1;
# End of 10.3 tests
#
# Start of 10.4 tests
diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test
index 888cc569d6c..b1c69faa83a 100644
--- a/mysql-test/main/sp.test
+++ b/mysql-test/main/sp.test
@@ -10417,6 +10417,24 @@ END;
$$
DELIMITER ;$$
+# MDEV-20699 do not cache SP in SHOW CREATE
+# Warmup round, this might allocate some memory for session variable
+# and the output
+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';
+CREATE PROCEDURE sp0() SELECT 1;
+SHOW CREATE PROCEDURE sp0;
+DROP PROCEDURE sp0;
+
+#Check that CREATE/SHOW does not use memory in caches.
+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';
+CREATE PROCEDURE sp1() SELECT 1;
+SHOW CREATE PROCEDURE sp1;
+SELECT VARIABLE_VALUE-@local_mem_used FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+# 10.5 FIXME: This occasionally shows 56 or 64 bytes of difference!
+#SELECT VARIABLE_VALUE-@global_mem_used FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='MEMORY_USED';
+DROP PROCEDURE sp1;
--echo # End of 10.3 tests
diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result
index 0bb4bda4c28..18e0e14a6ef 100644
--- a/mysql-test/main/view.result
+++ b/mysql-test/main/view.result
@@ -6792,6 +6792,49 @@ sum(z)
DROP TABLE t1;
DROP VIEW v1;
#
+# MDEV-24454: Crash at change_item_tree
+#
+CREATE TABLE t1(f0 INT);
+CREATE VIEW v1 AS
+SELECT
+f0 AS f1
+FROM t1;
+CREATE VIEW v2 AS
+SELECT
+(SELECT GROUP_CONCAT(v1.f1 SEPARATOR ', ')
+FROM v1 n) AS f2,
+GROUP_CONCAT('' SEPARATOR ', ') AS f3
+FROM v1;
+CREATE VIEW v3 AS
+SELECT 1 as f4 FROM v2;
+CREATE PROCEDURE p1()
+SELECT * FROM v3;
+CALL p1();
+f4
+1
+CALL p1();
+f4
+1
+drop procedure p1;
+drop view v1,v2,v3;
+drop table t1;
+#
+# MDEV-25631: Crash in st_select_lex::mark_as_dependent with
+# VIEW, aggregate and subquery
+#
+CREATE TABLE t1 (i1 int);
+insert into t1 values (1),(2),(3);
+CREATE VIEW v1 AS
+SELECT t1.i1 FROM (t1 a JOIN t1 ON (t1.i1 = (SELECT t1.i1 FROM t1 b)));
+SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ;
+ERROR 21000: Subquery returns more than 1 row
+delete from t1 where i1 > 1;
+SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ;
+1
+1
+drop view v1;
+drop table t1;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test
index 74f80919333..67bfb2432e8 100644
--- a/mysql-test/main/view.test
+++ b/mysql-test/main/view.test
@@ -6512,6 +6512,55 @@ DROP TABLE t1;
DROP VIEW v1;
--echo #
+--echo # MDEV-24454: Crash at change_item_tree
+--echo #
+
+CREATE TABLE t1(f0 INT);
+
+CREATE VIEW v1 AS
+SELECT
+ f0 AS f1
+FROM t1;
+
+CREATE VIEW v2 AS
+SELECT
+ (SELECT GROUP_CONCAT(v1.f1 SEPARATOR ', ')
+ FROM v1 n) AS f2,
+ GROUP_CONCAT('' SEPARATOR ', ') AS f3
+FROM v1;
+
+CREATE VIEW v3 AS
+SELECT 1 as f4 FROM v2;
+
+CREATE PROCEDURE p1()
+ SELECT * FROM v3;
+
+CALL p1();
+CALL p1();
+
+drop procedure p1;
+drop view v1,v2,v3;
+drop table t1;
+
+--echo #
+--echo # MDEV-25631: Crash in st_select_lex::mark_as_dependent with
+--echo # VIEW, aggregate and subquery
+--echo #
+
+CREATE TABLE t1 (i1 int);
+insert into t1 values (1),(2),(3); #not important
+CREATE VIEW v1 AS
+ SELECT t1.i1 FROM (t1 a JOIN t1 ON (t1.i1 = (SELECT t1.i1 FROM t1 b)));
+
+--error ER_SUBQUERY_NO_1_ROW
+SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ;
+delete from t1 where i1 > 1;
+SELECT 1 FROM (SELECT count(((SELECT i1 FROM v1))) FROM v1) dt ;
+
+drop view v1;
+drop table t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/suite/compat/oracle/r/sp-package.result b/mysql-test/suite/compat/oracle/r/sp-package.result
index cffb3ce7857..273c2f3ea7d 100644
--- a/mysql-test/suite/compat/oracle/r/sp-package.result
+++ b/mysql-test/suite/compat/oracle/r/sp-package.result
@@ -725,6 +725,10 @@ END
character_set_client latin1
collation_connection latin1_swedish_ci
Database Collation latin1_swedish_ci
+Warnings:
+Level Note
+Code 1585
+Message This function 'concat' has the same name as a native function
SHOW CREATE PACKAGE BODY test2;
Package body test2
sql_mode PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ORACLE,NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS,NO_AUTO_CREATE_USER,SIMULTANEOUS_ASSIGNMENT
@@ -745,6 +749,10 @@ END
character_set_client latin1
collation_connection latin1_swedish_ci
Database Collation latin1_swedish_ci
+Warnings:
+Level Note
+Code 1585
+Message This function 'concat' has the same name as a native function
DROP PACKAGE BODY test2;
SELECT test2.f1();
ERROR 42000: FUNCTION test.test2.f1 does not exist
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index 70220a1e01e..0c2b2facc2c 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -39,7 +39,6 @@ galera_toi_truncate : MDEV-22996 Hang on galera_toi_truncate test case
galera_trigger : MDEV-24048 galera.galera_trigger MTR fails: Result content mismatch
galera_unicode_identifiers : MDEV-26500 : galera.galera_unicode_identifiers MTR failed: InnoDB: innodb_fatal_semaphore_wait_threshold was exceeded for dict_sys.mutex
galera_var_dirty_reads : MDEV-25615 Galera test failure on galera_var_dirty_reads
-galera_var_ignore_apply_errors : MDEV-20451: Lock wait timeout exceeded in galera_var_ignore_apply_errors
galera_var_node_address : MDEV-20485 Galera test failure
galera_var_notify_cmd : MDEV-21905 Galera test galera_var_notify_cmd causes hang
galera_var_reject_queries : assertion in inline_mysql_socket_send
diff --git a/mysql-test/suite/galera/r/galera_fulltext.result b/mysql-test/suite/galera/r/galera_fulltext.result
index 94780f235ad..a22296278fa 100644
--- a/mysql-test/suite/galera/r/galera_fulltext.result
+++ b/mysql-test/suite/galera/r/galera_fulltext.result
@@ -36,59 +36,3 @@ COUNT(f1) = 1000
1
DROP TABLE t1;
DROP TABLE ten;
-connection node_1;
-SET @value=REPEAT (1,5001);
-CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb;
-INSERT IGNORE INTO t VALUES(@value);
-Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-SELECT COUNT(*) FROM t;
-COUNT(*)
-1
-connection node_2;
-SELECT COUNT(*) FROM t;
-COUNT(*)
-1
-connection node_1;
-DROP TABLE t;
-CREATE TABLE t (a VARCHAR(5000)) engine=innodb;
-INSERT IGNORE INTO t VALUES(@value);
-Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-SELECT COUNT(*) FROM t;
-COUNT(*)
-1
-connection node_2;
-SELECT COUNT(*) FROM t;
-COUNT(*)
-1
-connection node_1;
-DROP TABLE t;
-connection node_1;
-SET @value=REPEAT (1,5001);
-CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb DEFAULT CHARSET=utf8;
-INSERT IGNORE INTO t VALUES(@value);
-Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-SELECT COUNT(*) FROM t;
-COUNT(*)
-1
-connection node_2;
-SELECT COUNT(*) FROM t;
-COUNT(*)
-1
-connection node_1;
-DROP TABLE t;
-CREATE TABLE t (a VARCHAR(5000)) engine=innodb DEFAULT CHARSET=utf8;
-INSERT IGNORE INTO t VALUES(@value);
-Warnings:
-Warning 1265 Data truncated for column 'a' at row 1
-SELECT COUNT(*) FROM t;
-COUNT(*)
-1
-connection node_2;
-SELECT COUNT(*) FROM t;
-COUNT(*)
-1
-connection node_1;
-DROP TABLE t;
diff --git a/mysql-test/suite/galera/r/galera_partition.result b/mysql-test/suite/galera/r/galera_partition.result
index f09a0272eda..0e8894794d7 100644
--- a/mysql-test/suite/galera/r/galera_partition.result
+++ b/mysql-test/suite/galera/r/galera_partition.result
@@ -424,3 +424,5 @@ connection node_4;
connection node_1;
DROP TABLE t1;
DROP PROCEDURE p1;
+disconnect node_3;
+disconnect node_4;
diff --git a/mysql-test/suite/galera/t/galera_fulltext.test b/mysql-test/suite/galera/t/galera_fulltext.test
index 25f4f83b7b7..7e2fc5e581d 100644
--- a/mysql-test/suite/galera/t/galera_fulltext.test
+++ b/mysql-test/suite/galera/t/galera_fulltext.test
@@ -1,6 +1,4 @@
---source include/big_test.inc
--source include/galera_cluster.inc
---source include/have_innodb.inc
#
# InnoDB FULLTEXT indexes
@@ -60,50 +58,28 @@ SELECT COUNT(f1) = 1000 FROM t1 WHERE MATCH(f1) AGAINST ('abcdefjhk');
DROP TABLE t1;
DROP TABLE ten;
-#
-# MDEV-24978 : SIGABRT in __libc_message
-#
---connection node_1
-SET @value=REPEAT (1,5001);
-CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb;
-INSERT IGNORE INTO t VALUES(@value);
-SELECT COUNT(*) FROM t;
-
---connection node_2
-SELECT COUNT(*) FROM t;
-
---connection node_1
-DROP TABLE t;
-CREATE TABLE t (a VARCHAR(5000)) engine=innodb;
-INSERT IGNORE INTO t VALUES(@value);
-SELECT COUNT(*) FROM t;
-
---connection node_2
-SELECT COUNT(*) FROM t;
-
---connection node_1
-DROP TABLE t;
#
# Case 2: UTF-8
+# TODO: MDEV-24978
#
---connection node_1
-SET @value=REPEAT (1,5001);
-CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb DEFAULT CHARSET=utf8;
-INSERT IGNORE INTO t VALUES(@value);
-SELECT COUNT(*) FROM t;
-
---connection node_2
-SELECT COUNT(*) FROM t;
-
---connection node_1
-DROP TABLE t;
-CREATE TABLE t (a VARCHAR(5000)) engine=innodb DEFAULT CHARSET=utf8;
-INSERT IGNORE INTO t VALUES(@value);
-SELECT COUNT(*) FROM t;
-
---connection node_2
-SELECT COUNT(*) FROM t;
-
---connection node_1
-DROP TABLE t;
+#--connection node_1
+#SET @value=REPEAT (1,5001);
+#CREATE TABLE t (a VARCHAR(5000),FULLTEXT (a)) engine=innodb DEFAULT CHARSET=utf8;
+#INSERT IGNORE INTO t VALUES(@value);
+#SELECT COUNT(*) FROM t;
+#
+#--connection node_2
+#SELECT COUNT(*) FROM t;
+#
+#--connection node_1
+#DROP TABLE t;
+#CREATE TABLE t (a VARCHAR(5000)) engine=innodb DEFAULT CHARSET=utf8;
+#INSERT IGNORE INTO t VALUES(@value);
+#SELECT COUNT(*) FROM t;
+#
+#--connection node_2
+#SELECT COUNT(*) FROM t;
+#
+#--connection node_1
+#DROP TABLE t;
diff --git a/mysql-test/suite/galera/t/galera_partition.cnf b/mysql-test/suite/galera/t/galera_partition.cnf
index e6cb13ef523..525eece04ab 100644
--- a/mysql-test/suite/galera/t/galera_partition.cnf
+++ b/mysql-test/suite/galera/t/galera_partition.cnf
@@ -3,16 +3,20 @@
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;gmcast.segment=1'
wsrep_slave_threads=10
+wsrep_debug=1
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;gmcast.segment=1'
wsrep_slave_threads=10
+wsrep_debug=1
[mysqld.3]
wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M;gmcast.segment=2'
wsrep_slave_threads=10
+wsrep_debug=1
[mysqld.4]
wsrep_provider_options='base_port=@mysqld.4.#galera_port;gcache.size=10M;gmcast.segment=3'
wsrep_slave_threads=10
+wsrep_debug=1
diff --git a/mysql-test/suite/galera/t/galera_partition.test b/mysql-test/suite/galera/t/galera_partition.test
index bf3f02eaa92..3de45d54000 100644
--- a/mysql-test/suite/galera/t/galera_partition.test
+++ b/mysql-test/suite/galera/t/galera_partition.test
@@ -11,6 +11,8 @@ call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
--connection node_1
+--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
+--source include/wait_condition.inc
CREATE TABLE t1(
id bigint unsigned NOT NULL AUTO_INCREMENT,
@@ -449,3 +451,7 @@ reap;
DROP TABLE t1;
DROP PROCEDURE p1;
+--disconnect node_3
+--disconnect node_4
+
+
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
new file mode 100644
index 00000000000..545cc8147e0
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_ignore_apply_errors.cnf
@@ -0,0 +1,7 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep_debug=1
+
+[mysqld.2]
+wsrep_debug=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 0f8efad5163..5a00048a90e 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
@@ -3,7 +3,6 @@
#
--source include/galera_cluster.inc
---source include/have_innodb.inc
#
@@ -73,11 +72,15 @@ SET GLOBAL wsrep_on = ON;
DELETE FROM t1 WHERE f1 = 1;
--connection node_1
+--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
+--source include/wait_condition.inc
SELECT COUNT(*) as expect_0 FROM t1;
--connection node_2
--source include/galera_wait_ready.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
+--source include/wait_condition.inc
SELECT COUNT(*) as expect_0 FROM t1;
DROP TABLE t1;
@@ -97,11 +100,15 @@ DELETE FROM t1 WHERE f1 = 2;
COMMIT;
--connection node_1
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+--source include/wait_condition.inc
SELECT COUNT(*) as expect_1 FROM t1;
--connection node_2
--source include/galera_wait_ready.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+--source include/wait_condition.inc
SELECT COUNT(*) as expect_1 FROM t1;
DROP TABLE t1;
@@ -132,6 +139,8 @@ SELECT COUNT(*) as expect_0 FROM t1;
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
+--source include/wait_condition.inc
SELECT COUNT(*) as expect_0 FROM t1;
DROP TABLE t1;
@@ -171,6 +180,8 @@ SELECT COUNT(*) as expect_0 FROM t1;
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
+--source include/wait_condition.inc
SELECT COUNT(*) as expect_0 FROM t1;
DROP TABLE t1;
@@ -205,6 +216,8 @@ SELECT COUNT(*) as expect_0 FROM t1;
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
+--source include/wait_condition.inc
SELECT COUNT(*) as expect_0 FROM t1;
DROP TABLE t1,t2;
@@ -239,6 +252,10 @@ SELECT COUNT(*) as expect_0 FROM child;
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
+--let $wait_condition = SELECT COUNT(*) = 0 FROM parent;
+--source include/wait_condition.inc
+--let $wait_condition = SELECT COUNT(*) = 0 FROM child;
+--source include/wait_condition.inc
SELECT COUNT(*) as expect_0 FROM parent;
SELECT COUNT(*) as expect_0 FROM child;
DROP TABLE child, parent;
diff --git a/mysql-test/suite/innodb/r/innodb_defrag_stats.result b/mysql-test/suite/innodb/r/innodb_defrag_stats.result
index 2e7a2ba5197..c6fd7006f9e 100644
--- a/mysql-test/suite/innodb/r/innodb_defrag_stats.result
+++ b/mysql-test/suite/innodb/r/innodb_defrag_stats.result
@@ -3,118 +3,115 @@ DELETE FROM mysql.innodb_index_stats;
# Create table.
CREATE TABLE t1 (a INT PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256),
KEY SECOND(a, b)) ENGINE=INNODB STATS_PERSISTENT=0;
-INSERT INTO t1 SELECT seq, REPEAT('A', 256) FROM seq_1_to_1024;
+INSERT INTO t1 SELECT 100*FLOOR(seq/70)+seq%70, REPEAT('A', 256)
+FROM seq_1_to_1024;
# Not enough page splits to trigger persistent stats write yet.
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
-count(stat_value) = 0
-1
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
-count(stat_value) = 0
-1
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
-count(stat_value) = 0
-1
-INSERT INTO t1 SELECT seq, REPEAT('A', 256) FROM seq_1025_to_2048;
-# Persistent stats recorded.
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
-count(stat_value) > 0
-1
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
-count(stat_value) = 0
-1
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
-count(stat_value) > 0
-1
-# Delete some rows.
+SELECT * FROM mysql.innodb_index_stats;
+database_name table_name index_name last_update stat_name stat_value sample_size stat_description
+INSERT INTO t1 SELECT 100*FLOOR(seq/70)+seq%70, REPEAT('A', 256)
+FROM seq_1025_to_1433;
BEGIN;
-delete from t1 where a between 100 * 20 and 100 * 20 + 30;
-delete from t1 where a between 100 * 19 and 100 * 19 + 30;
-delete from t1 where a between 100 * 18 and 100 * 18 + 30;
-delete from t1 where a between 100 * 17 and 100 * 17 + 30;
-delete from t1 where a between 100 * 16 and 100 * 16 + 30;
-delete from t1 where a between 100 * 15 and 100 * 15 + 30;
-delete from t1 where a between 100 * 14 and 100 * 14 + 30;
-delete from t1 where a between 100 * 13 and 100 * 13 + 30;
-delete from t1 where a between 100 * 12 and 100 * 12 + 30;
-delete from t1 where a between 100 * 11 and 100 * 11 + 30;
-delete from t1 where a between 100 * 10 and 100 * 10 + 30;
-delete from t1 where a between 100 * 9 and 100 * 9 + 30;
-delete from t1 where a between 100 * 8 and 100 * 8 + 30;
-delete from t1 where a between 100 * 7 and 100 * 7 + 30;
-delete from t1 where a between 100 * 6 and 100 * 6 + 30;
-delete from t1 where a between 100 * 5 and 100 * 5 + 30;
-delete from t1 where a between 100 * 4 and 100 * 4 + 30;
-delete from t1 where a between 100 * 3 and 100 * 3 + 30;
-delete from t1 where a between 100 * 2 and 100 * 2 + 30;
-delete from t1 where a between 100 * 1 and 100 * 1 + 30;
-COMMIT;
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
-count(stat_value) > 0
-1
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
-count(stat_value) = 0
-1
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
-count(stat_value) > 0
-1
+INSERT INTO t1 SELECT 100*20+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*19+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*18+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*17+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*16+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*15+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*14+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*13+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*12+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*11+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*10+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*9+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*8+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*7+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*6+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*5+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*4+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*3+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*2+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+INSERT INTO t1 SELECT 100*1+seq, REPEAT('A', 256)
+FROM seq_70_to_99;
+ROLLBACK;
+SELECT @@GLOBAL.innodb_force_recovery<2 "have background defragmentation";
+have background defragmentation
+1
+SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
+table_name index_name stat_name
+t1 PRIMARY n_leaf_pages_defrag
+t1 PRIMARY n_leaf_pages_reserved
+t1 PRIMARY n_page_split
+t1 SECOND n_leaf_pages_defrag
+t1 SECOND n_leaf_pages_reserved
+t1 SECOND n_page_split
optimize table t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
-count(stat_value) > 0
-1
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
-count(stat_value) > 0
-1
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
-count(stat_value) > 0
-1
+SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
+table_name index_name stat_name
+t1 PRIMARY n_leaf_pages_defrag
+t1 PRIMARY n_leaf_pages_reserved
+t1 PRIMARY n_page_split
+t1 PRIMARY n_pages_freed
+t1 SECOND n_leaf_pages_defrag
+t1 SECOND n_leaf_pages_reserved
+t1 SECOND n_page_split
+t1 SECOND n_pages_freed
set global innodb_defragment_stats_accuracy = 40;
INSERT INTO t1 (b) SELECT b from t1;
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
-count(stat_value) > 0
-1
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
-count(stat_value) > 0
-1
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
-count(stat_value) > 0
-1
+SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
+table_name index_name stat_name
+t1 PRIMARY n_leaf_pages_defrag
+t1 PRIMARY n_leaf_pages_reserved
+t1 PRIMARY n_page_split
+t1 PRIMARY n_pages_freed
+t1 SECOND n_leaf_pages_defrag
+t1 SECOND n_leaf_pages_reserved
+t1 SECOND n_page_split
+t1 SECOND n_pages_freed
INSERT INTO t1 (b) SELECT b from t1;
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
-count(stat_value) > 0
-1
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
-count(stat_value) > 0
-1
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
-count(stat_value) > 0
-1
+SELECT stat_name FROM mysql.innodb_index_stats WHERE table_name='t1';
+stat_name
+n_leaf_pages_defrag
+n_leaf_pages_defrag
+n_leaf_pages_reserved
+n_leaf_pages_reserved
+n_page_split
+n_page_split
+n_pages_freed
+n_pages_freed
# Table rename should cause stats rename.
rename table t1 to t2;
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
-count(stat_value) = 0
-1
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
-count(stat_value) = 0
-1
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
-count(stat_value) = 0
-1
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_page_split');
-count(stat_value) > 0
-1
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed');
-count(stat_value) > 0
-1
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_leaf_pages_defrag');
-count(stat_value) > 0
-1
-# Drop index should cause stats drop, but will not.
+SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
+table_name index_name stat_name
+t2 PRIMARY n_leaf_pages_defrag
+t2 PRIMARY n_leaf_pages_reserved
+t2 PRIMARY n_page_split
+t2 PRIMARY n_pages_freed
+t2 SECOND n_leaf_pages_defrag
+t2 SECOND n_leaf_pages_reserved
+t2 SECOND n_page_split
+t2 SECOND n_pages_freed
drop index SECOND on t2;
-SELECT stat_name, stat_value>0 FROM mysql.innodb_index_stats
-WHERE table_name like '%t2%' AND index_name='SECOND';
-stat_name stat_value>0
#
# MDEV-26636: Statistics must not be written for temporary tables
#
@@ -123,15 +120,12 @@ CREATE TEMPORARY TABLE t (a INT PRIMARY KEY, c CHAR(255) NOT NULL)
ENGINE=InnoDB;
INSERT INTO t SELECT seq, '' FROM seq_1_to_100;
# restart
-SELECT * FROM mysql.innodb_index_stats where table_name like '%t1%';
-database_name table_name index_name last_update stat_name stat_value sample_size stat_description
-SELECT table_name, index_name, stat_name, stat_value>0
-FROM mysql.innodb_index_stats;
-table_name index_name stat_name stat_value>0
-t2 PRIMARY n_leaf_pages_defrag 1
-t2 PRIMARY n_leaf_pages_reserved 1
-t2 PRIMARY n_page_split 1
-t2 PRIMARY n_pages_freed 0
+SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
+table_name index_name stat_name
+t2 PRIMARY n_leaf_pages_defrag
+t2 PRIMARY n_leaf_pages_reserved
+t2 PRIMARY n_page_split
+t2 PRIMARY n_pages_freed
# Clean up
ALTER TABLE t2 STATS_PERSISTENT=1;
DROP TABLE t2;
diff --git a/mysql-test/suite/innodb/t/innodb_defrag_stats.test b/mysql-test/suite/innodb/t/innodb_defrag_stats.test
index 13e4579d3d8..ef79d8d6ade 100644
--- a/mysql-test/suite/innodb/t/innodb_defrag_stats.test
+++ b/mysql-test/suite/innodb/t/innodb_defrag_stats.test
@@ -11,75 +11,61 @@ DELETE FROM mysql.innodb_index_stats;
CREATE TABLE t1 (a INT PRIMARY KEY AUTO_INCREMENT, b VARCHAR(256),
KEY SECOND(a, b)) ENGINE=INNODB STATS_PERSISTENT=0;
-INSERT INTO t1 SELECT seq, REPEAT('A', 256) FROM seq_1_to_1024;
+INSERT INTO t1 SELECT 100*FLOOR(seq/70)+seq%70, REPEAT('A', 256)
+FROM seq_1_to_1024;
--echo # Not enough page splits to trigger persistent stats write yet.
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
-
-INSERT INTO t1 SELECT seq, REPEAT('A', 256) FROM seq_1025_to_2048;
+SELECT * FROM mysql.innodb_index_stats;
---echo # Persistent stats recorded.
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
+INSERT INTO t1 SELECT 100*FLOOR(seq/70)+seq%70, REPEAT('A', 256)
+FROM seq_1025_to_1433;
---echo # Delete some rows.
BEGIN;
let $num_delete = 20;
while ($num_delete)
{
- let $j = 100 * $num_delete;
- eval delete from t1 where a between $j and $j + 30;
+ eval INSERT INTO t1 SELECT 100*$num_delete+seq, REPEAT('A', 256)
+ FROM seq_70_to_99;
dec $num_delete;
}
-COMMIT;
+ROLLBACK;
+
+SELECT @@GLOBAL.innodb_force_recovery<2 "have background defragmentation";
+
+# Wait for defrag_pool to be processed.
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
+let $wait_timeout=30;
+let $wait_condition = SELECT COUNT(*)>0 FROM mysql.innodb_index_stats;
+--source include/wait_condition.inc
+
+--sorted_result
+SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
optimize table t1;
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
+--sorted_result
+SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
set global innodb_defragment_stats_accuracy = 40;
INSERT INTO t1 (b) SELECT b from t1;
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
-
+--sorted_result
+SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
INSERT INTO t1 (b) SELECT b from t1;
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
-
+--sorted_result
+SELECT stat_name FROM mysql.innodb_index_stats WHERE table_name='t1';
--echo # Table rename should cause stats rename.
rename table t1 to t2;
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_page_split');
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_pages_freed');
-select count(stat_value) = 0 from mysql.innodb_index_stats where table_name like '%t1%' and stat_name in ('n_leaf_pages_defrag');
-
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_page_split');
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_pages_freed');
-select count(stat_value) > 0 from mysql.innodb_index_stats where table_name like '%t2%' and stat_name in ('n_leaf_pages_defrag');
+--sorted_result
+SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
---echo # Drop index should cause stats drop, but will not.
drop index SECOND on t2;
---sorted_result
-SELECT stat_name, stat_value>0 FROM mysql.innodb_index_stats
-WHERE table_name like '%t2%' AND index_name='SECOND';
-
--echo #
--echo # MDEV-26636: Statistics must not be written for temporary tables
--echo #
@@ -90,14 +76,12 @@ INSERT INTO t SELECT seq, '' FROM seq_1_to_100;
--source include/restart_mysqld.inc
-SELECT * FROM mysql.innodb_index_stats where table_name like '%t1%';
-
--sorted_result
-SELECT table_name, index_name, stat_name, stat_value>0
-FROM mysql.innodb_index_stats;
+SELECT table_name, index_name, stat_name FROM mysql.innodb_index_stats;
--echo # Clean up
-# DROP TABLE will not touch persistent statistics if the table has none!
+# Starting with 10.6, DROP TABLE will not touch persistent statistics
+# (not defragmentation statistics either) if the table has none!
ALTER TABLE t2 STATS_PERSISTENT=1;
DROP TABLE t2;
diff --git a/mysql-test/suite/innodb/t/undo_truncate.test b/mysql-test/suite/innodb/t/undo_truncate.test
index 9601de482b3..cf8c1a8d5e3 100644
--- a/mysql-test/suite/innodb/t/undo_truncate.test
+++ b/mysql-test/suite/innodb/t/undo_truncate.test
@@ -54,7 +54,7 @@ let $trx_after= `select substr('$trx_after',9)`;
drop table t1, t2;
-if ($trx_before != $trx_after)
+if ($trx_before > $trx_after)
{
- echo Transaction sequence mismatch: $trx_before != $trx_after;
+ echo Transaction sequence mismatch: $trx_before > $trx_after;
}
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_load.result b/mysql-test/suite/plugins/r/feedback_plugin_load.result
index 5f50c9b0525..f31c7325ca1 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_load.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_load.result
@@ -24,3 +24,19 @@ VARIABLE_VALUE>0 VARIABLE_NAME
1 Collation used utf8mb3_bin
1 Collation used utf8mb3_general_ci
1 Collation used utf8mb4_bin
+prepare stmt from "SELECT VARIABLE_VALUE>0, VARIABLE_NAME FROM INFORMATION_SCHEMA.FEEDBACK WHERE VARIABLE_NAME LIKE 'Collation used %' ORDER BY VARIABLE_NAME";
+execute stmt;
+VARIABLE_VALUE>0 VARIABLE_NAME
+1 Collation used binary
+1 Collation used latin1_swedish_ci
+1 Collation used utf8mb3_bin
+1 Collation used utf8mb3_general_ci
+1 Collation used utf8mb4_bin
+execute stmt;
+VARIABLE_VALUE>0 VARIABLE_NAME
+1 Collation used binary
+1 Collation used latin1_swedish_ci
+1 Collation used utf8mb3_bin
+1 Collation used utf8mb3_general_ci
+1 Collation used utf8mb4_bin
+deallocate prepare stmt;
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_load.test b/mysql-test/suite/plugins/t/feedback_plugin_load.test
index ecf678eb420..f67397afdfe 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_load.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_load.test
@@ -42,3 +42,10 @@ if (`SELECT VERSION() LIKE '%embedded%'`)
SELECT VARIABLE_VALUE>0, VARIABLE_NAME FROM INFORMATION_SCHEMA.FEEDBACK
WHERE VARIABLE_NAME LIKE 'Collation used %'
ORDER BY VARIABLE_NAME;
+
+prepare stmt from "SELECT VARIABLE_VALUE>0, VARIABLE_NAME FROM INFORMATION_SCHEMA.FEEDBACK WHERE VARIABLE_NAME LIKE 'Collation used %' ORDER BY VARIABLE_NAME";
+
+execute stmt;
+execute stmt;
+
+deallocate prepare stmt;