Repository navigation
MDEV-41758 ALTER TABLE ignores a changed fulltext parser of an index #5978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
futureweb
wants to merge
1
commit into
MariaDB:11.8
Choose a base branch
from
futureweb:MDEV-41758-alter-parser
base: 11.8
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # | ||
| # MDEV-41758 ALTER TABLE ignores a changed fulltext parser of an index | ||
| # | ||
| INSTALL PLUGIN simple_parser SONAME 'mypluglib'; | ||
| # Adding a parser. The index is built with it: simple_parser keeps | ||
| # 'abc-def' as one word, so 'abc' does not match. | ||
| CREATE TABLE t (id INT PRIMARY KEY, c TEXT, FULLTEXT ft(c)) ENGINE=InnoDB; | ||
| INSERT INTO t VALUES (1, 'abc-def'); | ||
| ALTER TABLE t DROP INDEX ft, ADD FULLTEXT ft(c) WITH PARSER simple_parser; | ||
| SHOW CREATE TABLE t; | ||
| Table Create Table | ||
| t CREATE TABLE `t` ( | ||
| `id` int(11) NOT NULL, | ||
| `c` text DEFAULT NULL, | ||
| PRIMARY KEY (`id`), | ||
| FULLTEXT KEY `ft` (`c`) WITH PARSER `simple_parser` | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci | ||
| SELECT id FROM t WHERE MATCH(c) AGAINST('abc'); | ||
| id | ||
| DROP TABLE t; | ||
| # Removing it, which cannot be done instantly | ||
| CREATE TABLE t (id INT PRIMARY KEY, c TEXT, | ||
| FULLTEXT ft(c) WITH PARSER simple_parser) ENGINE=InnoDB; | ||
| ALTER TABLE t DROP INDEX ft, ADD FULLTEXT ft(c), ALGORITHM=INSTANT; | ||
| ERROR 0A000: ALGORITHM=INSTANT is not supported. Reason: ADD INDEX. Try ALGORITHM=NOCOPY | ||
| ALTER TABLE t DROP INDEX ft, ADD FULLTEXT ft(c); | ||
| SHOW CREATE TABLE t; | ||
| Table Create Table | ||
| t CREATE TABLE `t` ( | ||
| `id` int(11) NOT NULL, | ||
| `c` text DEFAULT NULL, | ||
| PRIMARY KEY (`id`), | ||
| FULLTEXT KEY `ft` (`c`) | ||
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci | ||
| DROP TABLE t; | ||
| # Adding it under another name: the index is rebuilt, not just renamed, | ||
| # so 'abc' does not match. | ||
| CREATE TABLE t (id INT PRIMARY KEY, c TEXT, FULLTEXT ft(c)) ENGINE=InnoDB; | ||
| INSERT INTO t VALUES (1, 'abc-def'); | ||
| ALTER TABLE t DROP INDEX ft, ADD FULLTEXT ft2(c) WITH PARSER simple_parser; | ||
| SELECT id FROM t WHERE MATCH(c) AGAINST('abc'); | ||
| id | ||
| DROP TABLE t; | ||
| # The same parser, in any letter case, is no change | ||
| CREATE TABLE t (id INT PRIMARY KEY, c TEXT, | ||
| FULLTEXT ft(c) WITH PARSER simple_parser) ENGINE=InnoDB; | ||
| ALTER TABLE t DROP INDEX ft, | ||
| ADD FULLTEXT ft(c) WITH PARSER SIMPLE_PARSER, ALGORITHM=INSTANT; | ||
| DROP TABLE t; | ||
| UNINSTALL PLUGIN simple_parser; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| --source include/have_innodb.inc | ||
| --source include/have_simple_parser.inc | ||
|
|
||
| --echo # | ||
| --echo # MDEV-41758 ALTER TABLE ignores a changed fulltext parser of an index | ||
| --echo # | ||
|
|
||
| INSTALL PLUGIN simple_parser SONAME 'mypluglib'; | ||
|
|
||
| --echo # Adding a parser. The index is built with it: simple_parser keeps | ||
| --echo # 'abc-def' as one word, so 'abc' does not match. | ||
| CREATE TABLE t (id INT PRIMARY KEY, c TEXT, FULLTEXT ft(c)) ENGINE=InnoDB; | ||
| INSERT INTO t VALUES (1, 'abc-def'); | ||
| ALTER TABLE t DROP INDEX ft, ADD FULLTEXT ft(c) WITH PARSER simple_parser; | ||
| SHOW CREATE TABLE t; | ||
| SELECT id FROM t WHERE MATCH(c) AGAINST('abc'); | ||
| DROP TABLE t; | ||
|
|
||
| --echo # Removing it, which cannot be done instantly | ||
| CREATE TABLE t (id INT PRIMARY KEY, c TEXT, | ||
| FULLTEXT ft(c) WITH PARSER simple_parser) ENGINE=InnoDB; | ||
| --error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON | ||
| ALTER TABLE t DROP INDEX ft, ADD FULLTEXT ft(c), ALGORITHM=INSTANT; | ||
| ALTER TABLE t DROP INDEX ft, ADD FULLTEXT ft(c); | ||
| SHOW CREATE TABLE t; | ||
| DROP TABLE t; | ||
|
|
||
| --echo # Adding it under another name: the index is rebuilt, not just renamed, | ||
| --echo # so 'abc' does not match. | ||
| CREATE TABLE t (id INT PRIMARY KEY, c TEXT, FULLTEXT ft(c)) ENGINE=InnoDB; | ||
| INSERT INTO t VALUES (1, 'abc-def'); | ||
| ALTER TABLE t DROP INDEX ft, ADD FULLTEXT ft2(c) WITH PARSER simple_parser; | ||
| SELECT id FROM t WHERE MATCH(c) AGAINST('abc'); | ||
| DROP TABLE t; | ||
|
|
||
| --echo # The same parser, in any letter case, is no change | ||
| CREATE TABLE t (id INT PRIMARY KEY, c TEXT, | ||
| FULLTEXT ft(c) WITH PARSER simple_parser) ENGINE=InnoDB; | ||
| ALTER TABLE t DROP INDEX ft, | ||
| ADD FULLTEXT ft(c) WITH PARSER SIMPLE_PARSER, ALGORITHM=INSTANT; | ||
| DROP TABLE t; | ||
|
|
||
| UNINSTALL PLUGIN simple_parser; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional, stylistic, nit: FWIW, these complex tests where one test depends on the result of the other are very hard to maintain and develop further.
I'd keep the individual tests completely separate. E.g. I'd drop the table after the above test and re-recreate it for this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done – each case has its own table now.