From a0f2ff883239da8c1df0d95fd478094d8063ee5a Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 12 Feb 2024 12:43:08 +0100 Subject: [PATCH 1/4] Return back wolfssl v5.6.6 and new CC changed by 6b2cd7869522a140329a27583f965b8662d7f5f5 --- extra/wolfssl/wolfssl | 2 +- libmariadb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/wolfssl/wolfssl b/extra/wolfssl/wolfssl index 3b3c175af0e..66596ad9e1d 160000 --- a/extra/wolfssl/wolfssl +++ b/extra/wolfssl/wolfssl @@ -1 +1 @@ -Subproject commit 3b3c175af0e993ffaae251871421e206cc41963f +Subproject commit 66596ad9e1d7efa8479656872cf09c9c1870a02e diff --git a/libmariadb b/libmariadb index ae565eea90d..9155b19b462 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit ae565eea90dd3053a5a7857e7cdad93342dbc645 +Subproject commit 9155b19b462ac15fc69d0b58ae51370b7523ced5 From c37216de64b5b1e068c4242249741bdcf8d2d855 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 12 Feb 2024 21:08:22 +1100 Subject: [PATCH 2/4] MDEV-33441 Do not deinit plugin variables when retry requested After MDEV-31400, plugins are allowed to ask for retries when failing initialisation. However, such failures also cause plugin system variables to be deleted (plugin_variables_deinit()) before retrying and are not re-added during retry. We fix this by checking that if the plugin has requested a retry the variables are not deleted. Because plugin_deinitialize() also calls plugin_variables_deinit(), if the retry fails, the variables will still be deleted. Alternatives considered: - remove the plugin_variables_deinit() from plugin_initialize() error handling altogether. We decide to take a more conservative approach here. - re-add the system variables during retry. It is more complicated than simply iterating over plugin->system_vars and call my_hash_insert(). For example we will need to assign values to the test_load field and extract more code from test_plugin_options(), if that is possible. --- sql/sql_plugin.cc | 3 ++- .../mysql-test/spider/bugfix/r/mdev_33441.result | 7 +++++++ .../mysql-test/spider/bugfix/r/mdev_33441_fail.result | 10 ++++++++++ .../spider/mysql-test/spider/bugfix/t/mdev_33441.opt | 1 + .../spider/mysql-test/spider/bugfix/t/mdev_33441.test | 10 ++++++++++ .../mysql-test/spider/bugfix/t/mdev_33441_fail.opt | 2 ++ .../mysql-test/spider/bugfix/t/mdev_33441_fail.test | 10 ++++++++++ 7 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_33441.result create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_33441_fail.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_33441.opt create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_33441.test create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_33441_fail.opt create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_33441_fail.test diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 9f144ca5a73..5f8e61d71db 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1481,7 +1481,7 @@ static int plugin_initialize(MEM_ROOT *tmp_root, struct st_plugin_int *plugin, else ret= plugin_do_initialize(plugin, state); - if (ret) + if (ret && ret != HA_ERR_RETRY_INIT) plugin_variables_deinit(plugin); mysql_mutex_lock(&LOCK_plugin); @@ -1751,6 +1751,7 @@ int plugin_init(int *argc, char **argv, int flags) uint state= plugin_ptr->state; mysql_mutex_unlock(&LOCK_plugin); error= plugin_do_initialize(plugin_ptr, state); + DBUG_EXECUTE_IF("fail_spider_init_retry", error= 1;); mysql_mutex_lock(&LOCK_plugin); plugin_ptr->state= state; if (error == HA_ERR_RETRY_INIT) diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_33441.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_33441.result new file mode 100644 index 00000000000..b19194f13b5 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_33441.result @@ -0,0 +1,7 @@ +# +# MDEV-33441 No spider variables available is Spider is loaded upon server startup +# +set spider_same_server_link=0; +# +# end of test mdev_33441 +# diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_33441_fail.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_33441_fail.result new file mode 100644 index 00000000000..e6123ed429b --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_33441_fail.result @@ -0,0 +1,10 @@ +# +# MDEV-33441 No spider variables available is Spider is loaded upon server startup +# +select * from mysql.plugin; +name dl +show variables like 'spider%'; +Variable_name Value +# +# end of test mdev_33441_fail +# diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_33441.opt b/storage/spider/mysql-test/spider/bugfix/t/mdev_33441.opt new file mode 100644 index 00000000000..924ea4e31ef --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_33441.opt @@ -0,0 +1 @@ +--plugin-load-add=ha_spider diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_33441.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_33441.test new file mode 100644 index 00000000000..a2e0ddafe01 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_33441.test @@ -0,0 +1,10 @@ +--echo # +--echo # MDEV-33441 No spider variables available is Spider is loaded upon server startup +--echo # + +# We test that at least one spider variable exists. +set spider_same_server_link=0; + +--echo # +--echo # end of test mdev_33441 +--echo # diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_33441_fail.opt b/storage/spider/mysql-test/spider/bugfix/t/mdev_33441_fail.opt new file mode 100644 index 00000000000..28f1ce4825b --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_33441_fail.opt @@ -0,0 +1,2 @@ +--plugin-load-add=ha_spider +--debug-dbug=d,fail_spider_init_retry diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_33441_fail.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_33441_fail.test new file mode 100644 index 00000000000..6734b477583 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_33441_fail.test @@ -0,0 +1,10 @@ +--source include/have_debug.inc +--echo # +--echo # MDEV-33441 No spider variables available is Spider is loaded upon server startup +--echo # +# We test that when retry fails, spider variables are deleted. +select * from mysql.plugin; +show variables like 'spider%'; +--echo # +--echo # end of test mdev_33441_fail +--echo # From ca88eac8357073c4fb666856084a8fb2420f181e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 1 Feb 2024 14:51:26 +0200 Subject: [PATCH 3/4] MDEV-30528 CREATE FULLTEXT INDEX assertion failure WITH SYSTEM VERSIONING ha_innobase::check_if_supported_inplace_alter(): Require ALGORITHM=COPY when creating a FULLTEXT INDEX on a versioned table. row_merge_buf_add(), row_merge_read_clustered_index(): Remove the parameter or local variable history_fts that had been added in the attempt to fix MDEV-25004. Reviewed by: Thirunarayanan Balathandayuthapani Tested by: Matthias Leich --- .../innodb_fts/r/innodb-fts-ddl,vers.rdiff | 57 +++++++++++++++++++ .../r/innodb-fts-ddl,vers_trx.rdiff | 57 +++++++++++++++++++ .../innodb_fts/r/innodb-fts-fic,vers.rdiff | 10 ++++ .../r/innodb-fts-fic,vers_trx.rdiff | 10 ++++ .../suite/innodb_fts/r/misc_debug,vers.rdiff | 53 +++++++++++++++++ .../innodb_fts/r/misc_debug,vers_trx.rdiff | 53 +++++++++++++++++ .../suite/innodb_fts/r/sync_ddl,vers.rdiff | 12 ++++ .../innodb_fts/r/sync_ddl,vers_trx.rdiff | 12 ++++ mysql-test/suite/innodb_fts/r/sync_ddl.result | 5 +- .../suite/innodb_fts/t/innodb-fts-ddl.test | 33 ++++++++++- .../suite/innodb_fts/t/innodb-fts-fic.test | 5 ++ mysql-test/suite/innodb_fts/t/misc_debug.test | 14 +++++ mysql-test/suite/innodb_fts/t/sync_ddl.test | 5 +- mysql-test/suite/versioning/r/alter.result | 12 ++++ mysql-test/suite/versioning/t/alter.test | 15 +++++ storage/innobase/handler/handler0alter.cc | 13 ++++- storage/innobase/row/row0merge.cc | 24 +++----- 17 files changed, 366 insertions(+), 24 deletions(-) create mode 100644 mysql-test/suite/innodb_fts/r/innodb-fts-ddl,vers.rdiff create mode 100644 mysql-test/suite/innodb_fts/r/innodb-fts-ddl,vers_trx.rdiff create mode 100644 mysql-test/suite/innodb_fts/r/innodb-fts-fic,vers.rdiff create mode 100644 mysql-test/suite/innodb_fts/r/innodb-fts-fic,vers_trx.rdiff create mode 100644 mysql-test/suite/innodb_fts/r/misc_debug,vers.rdiff create mode 100644 mysql-test/suite/innodb_fts/r/misc_debug,vers_trx.rdiff create mode 100644 mysql-test/suite/innodb_fts/r/sync_ddl,vers.rdiff create mode 100644 mysql-test/suite/innodb_fts/r/sync_ddl,vers_trx.rdiff diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl,vers.rdiff b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl,vers.rdiff new file mode 100644 index 00000000000..d46275ff4e4 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl,vers.rdiff @@ -0,0 +1,57 @@ +--- innodb-fts-ddl.result ++++ innodb-fts-ddl.reject +@@ -11,8 +11,10 @@ + ('MySQL vs. YourSQL','In the following database comparison ...'), + ('MySQL Security','When configured properly, MySQL ...'); + ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; +-ERROR 0A000: ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE +-ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=INPLACE; ++ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY ++ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body); ++affected rows: 6 ++info: Records: 6 Duplicates: 0 Warnings: 0 + SELECT * FROM fts_test WHERE MATCH (title, body) + AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); + id title body +@@ -26,7 +28,9 @@ + ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), + ('MySQL vs. YourSQL','In the following database comparison ...'), + ('MySQL Security','When configured properly, MySQL ...'); +-ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; ++ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body); ++affected rows: 12 ++info: Records: 12 Duplicates: 0 Warnings: 0 + SELECT * FROM fts_test WHERE MATCH (title, body) + AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); + id title body +@@ -76,8 +80,10 @@ + ('MySQL vs. YourSQL','In the following database comparison ...'), + ('MySQL Security','When configured properly, MySQL ...'); + CREATE FULLTEXT INDEX idx on fts_test (title, body) LOCK=NONE; +-ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED +-ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; ++ERROR 0A000: LOCK=NONE is not supported. Reason: Not implemented for system-versioned operations. Try LOCK=SHARED ++ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body); ++affected rows: 6 ++info: Records: 6 Duplicates: 0 Warnings: 0 + ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, LOCK=NONE; + ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED + ALTER TABLE fts_test ROW_FORMAT=REDUNDANT; +@@ -162,7 +168,7 @@ + (20, 'MySQL Security','When configured properly, MySQL ...'); + ALTER TABLE articles ADD FULLTEXT INDEX idx (title), + ADD FULLTEXT INDEX idx3 (title), ALGORITHM=INPLACE; +-ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY ++ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY + ALTER TABLE articles ADD FULLTEXT INDEX idx (title), + ADD FULLTEXT INDEX idx3 (title); + affected rows: 6 +@@ -274,7 +280,7 @@ + call mtr.add_suppression("InnoDB: Failed to create"); + CREATE TABLE t1(a TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL UNIQUE) ENGINE=InnoDB; + ALTER TABLE t1 ADD FULLTEXT(a), ALGORITHM=INPLACE; +-ERROR HY000: Got error 11 "Resource temporarily unavailable" from storage engine InnoDB ++ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY + DROP TABLE t1; + CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB; + ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b); diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-ddl,vers_trx.rdiff b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl,vers_trx.rdiff new file mode 100644 index 00000000000..d46275ff4e4 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb-fts-ddl,vers_trx.rdiff @@ -0,0 +1,57 @@ +--- innodb-fts-ddl.result ++++ innodb-fts-ddl.reject +@@ -11,8 +11,10 @@ + ('MySQL vs. YourSQL','In the following database comparison ...'), + ('MySQL Security','When configured properly, MySQL ...'); + ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; +-ERROR 0A000: ALGORITHM=NOCOPY is not supported for this operation. Try ALGORITHM=INPLACE +-ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=INPLACE; ++ERROR 0A000: ALGORITHM=NOCOPY is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY ++ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body); ++affected rows: 6 ++info: Records: 6 Duplicates: 0 Warnings: 0 + SELECT * FROM fts_test WHERE MATCH (title, body) + AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); + id title body +@@ -26,7 +28,9 @@ + ('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'), + ('MySQL vs. YourSQL','In the following database comparison ...'), + ('MySQL Security','When configured properly, MySQL ...'); +-ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; ++ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body); ++affected rows: 12 ++info: Records: 12 Duplicates: 0 Warnings: 0 + SELECT * FROM fts_test WHERE MATCH (title, body) + AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE); + id title body +@@ -76,8 +80,10 @@ + ('MySQL vs. YourSQL','In the following database comparison ...'), + ('MySQL Security','When configured properly, MySQL ...'); + CREATE FULLTEXT INDEX idx on fts_test (title, body) LOCK=NONE; +-ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED +-ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; ++ERROR 0A000: LOCK=NONE is not supported. Reason: Not implemented for system-versioned operations. Try LOCK=SHARED ++ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body); ++affected rows: 6 ++info: Records: 6 Duplicates: 0 Warnings: 0 + ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, LOCK=NONE; + ERROR 0A000: LOCK=NONE is not supported. Reason: Fulltext index creation requires a lock. Try LOCK=SHARED + ALTER TABLE fts_test ROW_FORMAT=REDUNDANT; +@@ -162,7 +168,7 @@ + (20, 'MySQL Security','When configured properly, MySQL ...'); + ALTER TABLE articles ADD FULLTEXT INDEX idx (title), + ADD FULLTEXT INDEX idx3 (title), ALGORITHM=INPLACE; +-ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: InnoDB presently supports one FULLTEXT index creation at a time. Try ALGORITHM=COPY ++ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY + ALTER TABLE articles ADD FULLTEXT INDEX idx (title), + ADD FULLTEXT INDEX idx3 (title); + affected rows: 6 +@@ -274,7 +280,7 @@ + call mtr.add_suppression("InnoDB: Failed to create"); + CREATE TABLE t1(a TEXT, FTS_DOC_ID BIGINT UNSIGNED NOT NULL UNIQUE) ENGINE=InnoDB; + ALTER TABLE t1 ADD FULLTEXT(a), ALGORITHM=INPLACE; +-ERROR HY000: Got error 11 "Resource temporarily unavailable" from storage engine InnoDB ++ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY + DROP TABLE t1; + CREATE TABLE t1 (a VARCHAR(3)) ENGINE=InnoDB; + ALTER TABLE t1 ADD FULLTEXT KEY(a), ADD COLUMN b VARCHAR(3), ADD FULLTEXT KEY(b); diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-fic,vers.rdiff b/mysql-test/suite/innodb_fts/r/innodb-fts-fic,vers.rdiff new file mode 100644 index 00000000000..f9ba217769f --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb-fts-fic,vers.rdiff @@ -0,0 +1,10 @@ +--- innodb-fts-fic.result ++++ innodb-fts-fic.reject +@@ -172,7 +172,6 @@ + (1, 'MySQL Tutorial','DBMS stands for DataBase ...'), + (2, 'How To Use MySQL Well','After you went through a ...'); + CREATE FULLTEXT INDEX idx ON wp(title, text); +-ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index + DROP TABLE wp; + CREATE TABLE wp( + FTS_DOC_ID bigint unsigned PRIMARY KEY, diff --git a/mysql-test/suite/innodb_fts/r/innodb-fts-fic,vers_trx.rdiff b/mysql-test/suite/innodb_fts/r/innodb-fts-fic,vers_trx.rdiff new file mode 100644 index 00000000000..f9ba217769f --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/innodb-fts-fic,vers_trx.rdiff @@ -0,0 +1,10 @@ +--- innodb-fts-fic.result ++++ innodb-fts-fic.reject +@@ -172,7 +172,6 @@ + (1, 'MySQL Tutorial','DBMS stands for DataBase ...'), + (2, 'How To Use MySQL Well','After you went through a ...'); + CREATE FULLTEXT INDEX idx ON wp(title, text); +-ERROR HY000: Column 'FTS_DOC_ID' is of wrong type for an InnoDB FULLTEXT index + DROP TABLE wp; + CREATE TABLE wp( + FTS_DOC_ID bigint unsigned PRIMARY KEY, diff --git a/mysql-test/suite/innodb_fts/r/misc_debug,vers.rdiff b/mysql-test/suite/innodb_fts/r/misc_debug,vers.rdiff new file mode 100644 index 00000000000..a10a86ef77b --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/misc_debug,vers.rdiff @@ -0,0 +1,53 @@ +--- misc_debug.result ++++ misc_debug.reject +@@ -7,14 +7,14 @@ + SET @saved_debug_dbug = @@SESSION.debug_dbug; + SET SESSION debug_dbug="+d,ib_dict_create_index_tree_fail"; + CREATE FULLTEXT INDEX idx ON articles(body); +-ERROR HY000: Out of memory. ++ERROR HY000: Can't create table `test`.`articles` (errno: 128 "Out of memory in engine") + SET SESSION debug_dbug=@saved_debug_dbug; + ALTER TABLE articles STATS_PERSISTENT=DEFAULT; + DROP TABLE articles; + CREATE TABLE t (a INT, b TEXT) engine=innodb; + SET debug_dbug='+d,alter_table_rollback_new_index'; +-ALTER TABLE t ADD FULLTEXT INDEX (b(64)); +-ERROR HY000: Unknown error ++ALTER TABLE t ADD FULLTEXT INDEX (b(64)), ALGORITHM=INPLACE; ++ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY + SET SESSION debug_dbug=@saved_debug_dbug; + DROP TABLE t; + CREATE TABLE t1 (pk INT, a VARCHAR(8), PRIMARY KEY(pk), +@@ -27,32 +27,6 @@ + ALTER TABLE t1 FORCE; + DROP TABLE t2, t1; + # +-# MDEV-25200 Index count mismatch due to aborted FULLTEXT INDEX +-# +-CREATE TABLE t1(a INT, b TEXT, c TEXT, FULLTEXT INDEX(b)) ENGINE=InnoDB; +-INSERT INTO t1 VALUES(1, "test", "test_1"); +-connect con1,localhost,root,,test; +-SET DEBUG_DBUG="+d,innodb_OOM_inplace_alter"; +-SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL s2 WAIT_FOR g2'; +-ALTER TABLE t1 ADD FULLTEXT(c); +-connection default; +-SET DEBUG_SYNC='now WAIT_FOR s2'; +-START TRANSACTION; +-SELECT * FROM t1; +-a b c +-1 test test_1 +-SET DEBUG_SYNC='now SIGNAL g2'; +-connection con1; +-ERROR HY000: Out of memory. +-disconnect con1; +-connection default; +-SET DEBUG_SYNC=RESET; +-ALTER TABLE t1 ADD bl INT AS (LENGTH(b)) VIRTUAL; +-CHECK TABLE t1; +-Table Op Msg_type Msg_text +-test.t1 check status OK +-DROP TABLE t1; +-# + # MDEV-25663 Double free of transaction during TRUNCATE + # + call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)"); diff --git a/mysql-test/suite/innodb_fts/r/misc_debug,vers_trx.rdiff b/mysql-test/suite/innodb_fts/r/misc_debug,vers_trx.rdiff new file mode 100644 index 00000000000..a10a86ef77b --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/misc_debug,vers_trx.rdiff @@ -0,0 +1,53 @@ +--- misc_debug.result ++++ misc_debug.reject +@@ -7,14 +7,14 @@ + SET @saved_debug_dbug = @@SESSION.debug_dbug; + SET SESSION debug_dbug="+d,ib_dict_create_index_tree_fail"; + CREATE FULLTEXT INDEX idx ON articles(body); +-ERROR HY000: Out of memory. ++ERROR HY000: Can't create table `test`.`articles` (errno: 128 "Out of memory in engine") + SET SESSION debug_dbug=@saved_debug_dbug; + ALTER TABLE articles STATS_PERSISTENT=DEFAULT; + DROP TABLE articles; + CREATE TABLE t (a INT, b TEXT) engine=innodb; + SET debug_dbug='+d,alter_table_rollback_new_index'; +-ALTER TABLE t ADD FULLTEXT INDEX (b(64)); +-ERROR HY000: Unknown error ++ALTER TABLE t ADD FULLTEXT INDEX (b(64)), ALGORITHM=INPLACE; ++ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Not implemented for system-versioned operations. Try ALGORITHM=COPY + SET SESSION debug_dbug=@saved_debug_dbug; + DROP TABLE t; + CREATE TABLE t1 (pk INT, a VARCHAR(8), PRIMARY KEY(pk), +@@ -27,32 +27,6 @@ + ALTER TABLE t1 FORCE; + DROP TABLE t2, t1; + # +-# MDEV-25200 Index count mismatch due to aborted FULLTEXT INDEX +-# +-CREATE TABLE t1(a INT, b TEXT, c TEXT, FULLTEXT INDEX(b)) ENGINE=InnoDB; +-INSERT INTO t1 VALUES(1, "test", "test_1"); +-connect con1,localhost,root,,test; +-SET DEBUG_DBUG="+d,innodb_OOM_inplace_alter"; +-SET DEBUG_SYNC='innodb_commit_inplace_alter_table_enter SIGNAL s2 WAIT_FOR g2'; +-ALTER TABLE t1 ADD FULLTEXT(c); +-connection default; +-SET DEBUG_SYNC='now WAIT_FOR s2'; +-START TRANSACTION; +-SELECT * FROM t1; +-a b c +-1 test test_1 +-SET DEBUG_SYNC='now SIGNAL g2'; +-connection con1; +-ERROR HY000: Out of memory. +-disconnect con1; +-connection default; +-SET DEBUG_SYNC=RESET; +-ALTER TABLE t1 ADD bl INT AS (LENGTH(b)) VIRTUAL; +-CHECK TABLE t1; +-Table Op Msg_type Msg_text +-test.t1 check status OK +-DROP TABLE t1; +-# + # MDEV-25663 Double free of transaction during TRUNCATE + # + call mtr.add_suppression("InnoDB: \\(Too many concurrent transactions\\)"); diff --git a/mysql-test/suite/innodb_fts/r/sync_ddl,vers.rdiff b/mysql-test/suite/innodb_fts/r/sync_ddl,vers.rdiff new file mode 100644 index 00000000000..7834e04c9f3 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/sync_ddl,vers.rdiff @@ -0,0 +1,12 @@ +--- sync_ddl.result ++++ sync_ddl.reject +@@ -100,7 +100,7 @@ + ADD COLUMN id2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + DROP INDEX idx1, + ADD FULLTEXT INDEX idx2(value); +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 0 ++affected rows: 2 ++info: Records: 2 Duplicates: 0 Warnings: 0 + DROP TABLE t1; + SET GLOBAL debug_dbug = @save_debug; diff --git a/mysql-test/suite/innodb_fts/r/sync_ddl,vers_trx.rdiff b/mysql-test/suite/innodb_fts/r/sync_ddl,vers_trx.rdiff new file mode 100644 index 00000000000..7834e04c9f3 --- /dev/null +++ b/mysql-test/suite/innodb_fts/r/sync_ddl,vers_trx.rdiff @@ -0,0 +1,12 @@ +--- sync_ddl.result ++++ sync_ddl.reject +@@ -100,7 +100,7 @@ + ADD COLUMN id2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + DROP INDEX idx1, + ADD FULLTEXT INDEX idx2(value); +-affected rows: 0 +-info: Records: 0 Duplicates: 0 Warnings: 0 ++affected rows: 2 ++info: Records: 2 Duplicates: 0 Warnings: 0 + DROP TABLE t1; + SET GLOBAL debug_dbug = @save_debug; diff --git a/mysql-test/suite/innodb_fts/r/sync_ddl.result b/mysql-test/suite/innodb_fts/r/sync_ddl.result index 441954dc77b..5ebe1575d91 100644 --- a/mysql-test/suite/innodb_fts/r/sync_ddl.result +++ b/mysql-test/suite/innodb_fts/r/sync_ddl.result @@ -99,7 +99,8 @@ ALTER TABLE t1 DROP COLUMN id1, ADD COLUMN id2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, DROP INDEX idx1, -ADD FULLTEXT INDEX idx2(value), -ALGORITHM=INPLACE; +ADD FULLTEXT INDEX idx2(value); +affected rows: 0 +info: Records: 0 Duplicates: 0 Warnings: 0 DROP TABLE t1; SET GLOBAL debug_dbug = @save_debug; diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test index cef8df2d113..11d2d493bf3 100644 --- a/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test +++ b/mysql-test/suite/innodb_fts/t/innodb-fts-ddl.test @@ -20,11 +20,20 @@ INSERT INTO fts_test (title,body) VALUES ('MySQL Security','When configured properly, MySQL ...'); # Table does rebuild when fts index builds for the first time +# Create the FTS index + +if ($MTR_COMBINATION_ORIG) { --error ER_ALTER_OPERATION_NOT_SUPPORTED ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; - -# Create the FTS index ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=INPLACE; +} +if (!$MTR_COMBINATION_ORIG) { +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; +--enable_info +ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body); +--disable_info +} # Select word "tutorial" in the table SELECT * FROM fts_test WHERE MATCH (title, body) @@ -43,7 +52,14 @@ INSERT INTO fts_test (title,body) VALUES ('MySQL Security','When configured properly, MySQL ...'); # FTS_DOC_ID hidden column and FTS_DOC_ID index exist +if ($MTR_COMBINATION_ORIG) { ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; +} +if (!$MTR_COMBINATION_ORIG) { +--enable_info +ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body); +--disable_info +} # Select word "tutorial" in the table SELECT * FROM fts_test WHERE MATCH (title, body) @@ -112,7 +128,14 @@ INSERT INTO fts_test (title,body) VALUES # column already exists. This has not been implemented yet. --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON CREATE FULLTEXT INDEX idx on fts_test (title, body) LOCK=NONE; +if ($MTR_COMBINATION_ORIG) { ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body), ALGORITHM=NOCOPY; +} +if (!$MTR_COMBINATION_ORIG) { +--enable_info +ALTER TABLE fts_test ADD FULLTEXT `idx` (title, body); +--disable_info +} --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON ALTER TABLE fts_test ROW_FORMAT=REDUNDANT, LOCK=NONE; @@ -349,8 +372,14 @@ let $fts_aux_file= `select concat('FTS_',right(concat(repeat('0',16), lower(hex( write_file $MYSQLD_DATADIR/test/$fts_aux_file; EOF --replace_regex /".*" from/"Resource temporarily unavailable" from/ +if ($MTR_COMBINATION_ORIG) { --error ER_GET_ERRNO ALTER TABLE t1 ADD FULLTEXT(a), ALGORITHM=INPLACE; +} +if (!$MTR_COMBINATION_ORIG) { +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t1 ADD FULLTEXT(a), ALGORITHM=INPLACE; +} DROP TABLE t1; remove_file $MYSQLD_DATADIR/test/$fts_aux_file; diff --git a/mysql-test/suite/innodb_fts/t/innodb-fts-fic.test b/mysql-test/suite/innodb_fts/t/innodb-fts-fic.test index 2d94c21398c..05855106226 100644 --- a/mysql-test/suite/innodb_fts/t/innodb-fts-fic.test +++ b/mysql-test/suite/innodb_fts/t/innodb-fts-fic.test @@ -211,8 +211,13 @@ INSERT INTO wp (FTS_DOC_ID, title, text) VALUES (1, 'MySQL Tutorial','DBMS stands for DataBase ...'), (2, 'How To Use MySQL Well','After you went through a ...'); +if ($MTR_COMBINATION_ORIG) { --error ER_INNODB_FT_WRONG_DOCID_COLUMN CREATE FULLTEXT INDEX idx ON wp(title, text); +} +if (!$MTR_COMBINATION_ORIG) { +CREATE FULLTEXT INDEX idx ON wp(title, text); +} DROP TABLE wp; CREATE TABLE wp( diff --git a/mysql-test/suite/innodb_fts/t/misc_debug.test b/mysql-test/suite/innodb_fts/t/misc_debug.test index f4c5f49aa73..b6404b3ac17 100644 --- a/mysql-test/suite/innodb_fts/t/misc_debug.test +++ b/mysql-test/suite/innodb_fts/t/misc_debug.test @@ -23,8 +23,14 @@ CREATE TABLE articles ( # The newly create dict_index_t should be removed from fts cache SET @saved_debug_dbug = @@SESSION.debug_dbug; SET SESSION debug_dbug="+d,ib_dict_create_index_tree_fail"; +if ($MTR_COMBINATION_ORIG) { --error ER_OUT_OF_RESOURCES CREATE FULLTEXT INDEX idx ON articles(body); +} +if (!$MTR_COMBINATION_ORIG) { +--error ER_CANT_CREATE_TABLE +CREATE FULLTEXT INDEX idx ON articles(body); +} SET SESSION debug_dbug=@saved_debug_dbug; # This simply go through ha_innobase::commit_inplace_alter_table @@ -37,8 +43,14 @@ DROP TABLE articles; CREATE TABLE t (a INT, b TEXT) engine=innodb; SET debug_dbug='+d,alter_table_rollback_new_index'; +if ($MTR_COMBINATION_ORIG) { -- error ER_UNKNOWN_ERROR ALTER TABLE t ADD FULLTEXT INDEX (b(64)); +} +if (!$MTR_COMBINATION_ORIG) { +-- error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +ALTER TABLE t ADD FULLTEXT INDEX (b(64)), ALGORITHM=INPLACE; +} SET SESSION debug_dbug=@saved_debug_dbug; DROP TABLE t; @@ -56,6 +68,7 @@ ALTER TABLE t1 FORCE; # Cleanup DROP TABLE t2, t1; +if ($MTR_COMBINATION_ORIG) { --echo # --echo # MDEV-25200 Index count mismatch due to aborted FULLTEXT INDEX --echo # @@ -81,6 +94,7 @@ ALTER TABLE t1 ADD bl INT AS (LENGTH(b)) VIRTUAL; CHECK TABLE t1; DROP TABLE t1; --source include/wait_until_count_sessions.inc +} --echo # --echo # MDEV-25663 Double free of transaction during TRUNCATE diff --git a/mysql-test/suite/innodb_fts/t/sync_ddl.test b/mysql-test/suite/innodb_fts/t/sync_ddl.test index 6a16ececa60..9a0451e9d38 100644 --- a/mysql-test/suite/innodb_fts/t/sync_ddl.test +++ b/mysql-test/suite/innodb_fts/t/sync_ddl.test @@ -182,12 +182,13 @@ INSERT INTO t1 (value) VALUES ('collation of latin1_bin to make it case sensitive') ; +--enable_info ALTER TABLE t1 DROP COLUMN id1, ADD COLUMN id2 INT NOT NULL AUTO_INCREMENT PRIMARY KEY, DROP INDEX idx1, - ADD FULLTEXT INDEX idx2(value), - ALGORITHM=INPLACE; + ADD FULLTEXT INDEX idx2(value); +--disable_info DROP TABLE t1; diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result index 7891fa60024..d7e3a708354 100644 --- a/mysql-test/suite/versioning/r/alter.result +++ b/mysql-test/suite/versioning/r/alter.result @@ -845,3 +845,15 @@ Warnings: Note 1060 Duplicate column name 'v' alter table `b` add column if not exists ( p bit ); drop table `b`; +# +# MDEV-30528 Assertion !mbmaxlen || ... failed +# in dtype_get_at_most_n_mbchars() +# +CREATE TABLE t(f TEXT) WITH SYSTEM VERSIONING CHARACTER SET utf8 ENGINE=InnoDB; +INSERT INTO t VALUES ('foo'); +DELETE FROM t; +ALTER TABLE t ADD FULLTEXT (f); +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +DROP TABLE t; +# End of 10.4 tests diff --git a/mysql-test/suite/versioning/t/alter.test b/mysql-test/suite/versioning/t/alter.test index ed52d179eaa..1495de88f52 100644 --- a/mysql-test/suite/versioning/t/alter.test +++ b/mysql-test/suite/versioning/t/alter.test @@ -739,3 +739,18 @@ alter table `b` add system versioning; alter table `b` add column if not exists ( w bit, v serial ); alter table `b` add column if not exists ( p bit ); drop table `b`; + +--echo # +--echo # MDEV-30528 Assertion !mbmaxlen || ... failed +--echo # in dtype_get_at_most_n_mbchars() +--echo # + +CREATE TABLE t(f TEXT) WITH SYSTEM VERSIONING CHARACTER SET utf8 ENGINE=InnoDB; +INSERT INTO t VALUES ('foo'); +DELETE FROM t; +--enable_info +ALTER TABLE t ADD FULLTEXT (f); +--disable_info +DROP TABLE t; + +--echo # End of 10.4 tests diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index be02fc9e0a6..400828b41df 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -2596,6 +2596,9 @@ cannot_create_many_fulltext_index: online = false; } + static constexpr const char *not_implemented + = "Not implemented for system-versioned operations"; + if (ha_alter_info->handler_flags & ALTER_ADD_NON_UNIQUE_NON_PRIM_INDEX) { /* ADD FULLTEXT|SPATIAL INDEX requires a lock. @@ -2623,6 +2626,12 @@ cannot_create_many_fulltext_index: goto cannot_create_many_fulltext_index; } + if (altered_table->versioned()) { + ha_alter_info->unsupported_reason + = not_implemented; + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + } + add_fulltext = true; if (ha_alter_info->online && !ha_alter_info->unsupported_reason) { @@ -2661,10 +2670,8 @@ cannot_create_many_fulltext_index: // FIXME: implement Online DDL for system-versioned operations if (ha_alter_info->handler_flags & INNOBASE_ALTER_VERSIONED_REBUILD) { - if (ha_alter_info->online) { - ha_alter_info->unsupported_reason = - "Not implemented for system-versioned operations"; + ha_alter_info->unsupported_reason = not_implemented; } online = false; diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 8c6d4341a50..b373f19f291 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -457,8 +457,6 @@ row_merge_buf_redundant_convert( @param[in,out] row table row @param[in] ext cache of externally stored column prefixes, or NULL -@param[in] history_fts row is historical in a system-versioned table - on which a FTS_DOC_ID_INDEX(FTS_DOC_ID) exists @param[in,out] doc_id Doc ID if we are creating FTS index @param[in,out] conv_heap memory heap where to allocate data when @@ -480,7 +478,6 @@ row_merge_buf_add( fts_psort_t* psort_info, dtuple_t* row, const row_ext_t* ext, - const bool history_fts, doc_id_t* doc_id, mem_heap_t* conv_heap, dberr_t* err, @@ -543,7 +540,7 @@ error: : NULL; /* Process the Doc ID column */ - if (!v_col && (history_fts || *doc_id) + if (!v_col && *doc_id && col->ind == index->table->fts->doc_col) { fts_write_doc_id((byte*) &write_doc_id, *doc_id); @@ -595,7 +592,7 @@ error: /* Tokenize and process data for FTS */ - if (!history_fts && (index->type & DICT_FTS)) { + if (index->type & DICT_FTS) { fts_doc_item_t* doc_item; byte* value; void* ptr; @@ -1707,6 +1704,7 @@ row_merge_read_clustered_index( DBUG_ENTER("row_merge_read_clustered_index"); ut_ad((old_table == new_table) == !col_map); + ut_ad(old_table->fts || !new_table->fts || !new_table->versioned()); ut_ad(!defaults || col_map); ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE)); ut_ad(trx->id); @@ -1892,7 +1890,6 @@ row_merge_read_clustered_index( dtuple_t* row; row_ext_t* ext; page_cur_t* cur = btr_pcur_get_page_cur(&pcur); - bool history_row, history_fts = false; page_cur_move_to_next(cur); @@ -2130,11 +2127,6 @@ end_of_index: row_heap); ut_ad(row); - history_row = new_table->versioned() - && dtuple_get_nth_field(row, new_table->vers_end) - ->vers_history_row(); - history_fts = history_row && new_table->fts; - for (ulint i = 0; i < n_nonnull; i++) { dfield_t* field = &row->fields[nonnull[i]]; @@ -2164,7 +2156,7 @@ end_of_index: } /* Get the next Doc ID */ - if (add_doc_id && !history_fts) { + if (add_doc_id) { doc_id++; } else { doc_id = 0; @@ -2204,7 +2196,9 @@ end_of_index: add_autoinc); if (new_table->versioned()) { - if (history_row) { + if (dtuple_get_nth_field(row, + new_table->vers_end) + ->vers_history_row()) { if (dfield_get_type(dfield)->prtype & DATA_NOT_NULL) { err = DB_UNSUPPORTED; my_error(ER_UNSUPPORTED_EXTENSION, MYF(0), @@ -2323,7 +2317,7 @@ write_buffers: if (UNIV_LIKELY (row && (rows_added = row_merge_buf_add( buf, fts_index, old_table, new_table, - psort_info, row, ext, history_fts, + psort_info, row, ext, &doc_id, conv_heap, &err, &v_heap, eval_table, trx)))) { @@ -2657,7 +2651,7 @@ write_buffers: (!(rows_added = row_merge_buf_add( buf, fts_index, old_table, new_table, psort_info, - row, ext, history_fts, &doc_id, + row, ext, &doc_id, conv_heap, &err, &v_heap, eval_table, trx)))) { /* An empty buffer should have enough From ae709b64e29f503245fb5004574d85cb9c85a499 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Tue, 13 Feb 2024 09:24:32 +0100 Subject: [PATCH 4/4] fix view protocol in MDEV-29179 --- mysql-test/main/opt_trace.result | 4 ++-- mysql-test/main/opt_trace.test | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result index 8530c31e5c9..51edbc3fa09 100644 --- a/mysql-test/main/opt_trace.result +++ b/mysql-test/main/opt_trace.result @@ -9050,8 +9050,8 @@ SELECT b, a FROM t1 WHERE b <> 'p' OR a = 4 GROUP BY b, a HAVING a <= 7; b a h 1 n 4 -SELECT json_detailed(json_extract(trace, '$**.steps[*].join_optimization.steps[*].condition_pushdown_from_having') ), JSON_VALID(trace) FROM information_schema.optimizer_trace; -json_detailed(json_extract(trace, '$**.steps[*].join_optimization.steps[*].condition_pushdown_from_having') ) JSON_VALID(trace) +SELECT json_detailed(json_extract(trace, '$**.steps[*].join_optimization.steps[*].condition_pushdown_from_having') ) exp1, JSON_VALID(trace) exp2 FROM information_schema.optimizer_trace; +exp1 exp2 [ { "conds": "(t1.b <> 'p' or multiple equal(4, t1.a)) and t1.a <= 7", diff --git a/mysql-test/main/opt_trace.test b/mysql-test/main/opt_trace.test index 94b6d855279..289bcbb2caf 100644 --- a/mysql-test/main/opt_trace.test +++ b/mysql-test/main/opt_trace.test @@ -797,8 +797,7 @@ set optimizer_trace=DEFAULT; CREATE TABLE t1 (a INT, b VARCHAR(1), KEY (a), KEY(b,a)) ENGINE=MEMORY; INSERT INTO t1 VALUES (4,'n'),(1,'h'),(NULL,'w'); SET optimizer_trace= 'enabled=on'; -SELECT b, a FROM t1 WHERE b <> 'p' OR a = 4 GROUP BY b, a HAVING a <= 7; -SELECT json_detailed(json_extract(trace, '$**.steps[*].join_optimization.steps[*].condition_pushdown_from_having') ), JSON_VALID(trace) FROM information_schema.optimizer_trace; +SELECT b, a FROM t1 WHERE b <> 'p' OR a = 4 GROUP BY b, a HAVING a <= 7; SELECT json_detailed(json_extract(trace, '$**.steps[*].join_optimization.steps[*].condition_pushdown_from_having') ) exp1, JSON_VALID(trace) exp2 FROM information_schema.optimizer_trace; DROP TABLE t1; --echo #