Details
-
Bug
-
Status: In Review (View Workflow)
-
Critical
-
Resolution: Unresolved
-
10.11.19, 11.4.13, 11.8.9, 12.3.3
-
None
-
Can result in data loss
-
RENAME TABLE, ALTER TABLE ... ALGORITHM=COPY, REPAIR TABLE and crash recovery no longer fail for Aria tables whose fulltext index uses a parser plugin.
Description
INSTALL PLUGIN simple_parser SONAME 'mypluglib'; |
CREATE TABLE t1 (a TEXT, FULLTEXT(a) WITH PARSER simple_parser) ENGINE=Aria; |
INSERT INTO t1 VALUES ('hello world'), ('other text'), ('more'); |
RENAME TABLE t1 TO t2; |
# Error on rename of './test/t1' to './test/t2' (errno: 138 "Unsupported extension used for table"), t1 stays |
ALTER TABLE t1 ADD COLUMN b INT, ALGORITHM=COPY; |
# Error on rename of './test/t1' to './test/#sql-backup-...' (errno: 138 ...) |
REPAIR TABLE t1; |
# "Got error 138 when trying to repair table" (11.4: "138 when fixing table"), "Operation failed" |
SELECT a FROM t1 WHERE MATCH(a) AGAINST('hello'); |
# Got error '144 "Table is crashed and last repair failed"' for './test/t1' |
The table stays marked as crashed, also after a restart, until CHECK TABLE or REPAIR TABLE ... QUICK clears the mark. ALTER TABLE ... ADD FULLTEXT ... WITH PARSER on an existing Aria table fails the same way, when the new table is renamed.
Crash recovery skips such a table:
CREATE TABLE t1 (a TEXT, FULLTEXT(a) WITH PARSER simple_parser) ENGINE=Aria; |
INSERT INTO t1 VALUES ('hello world'), ('other text'), ('more'); |
# restart
|
INSERT INTO t1 VALUES ('after restart 1'), ('after restart 2'); |
# kill the server and start it again |
SELECT COUNT(*) FROM t1; # 3 (5 without WITH PARSER) |
The error log shows ***WARNING: ./test/t1 could not be opened: Error: 138 during recovery.
A table whose fulltext index uses a parser plugin has HA_OPTION_RELIES_ON_SQL_LAYER, and maria_open() refuses it with HA_ERR_UNSUPPORTED unless HA_OPEN_FROM_SQL_LAYER is set; in the server only ha_maria::open() sets it. Besides maria_delete_table() (MDEV-41747), these opens from inside the server do not: maria_rename() (RENAME TABLE, and ALTER TABLE ... ALGORITHM=COPY, which renames the original and the new table), create_new_data_handle() in ma_check.c (REPAIR TABLE without QUICK of a ROW_FORMAT=PAGE table), and new_table() in ma_recovery.c (crash recovery, which then skips the REDO records of the table).
The check comes from MyISAM (WL#2575), where these statements work; it is meant for aria_chk and other programs that cannot load the parser plugin. Possible fix: pass HA_OPEN_FROM_SQL_LAYER for these opens when they run inside the server. With the ngram parser built in (MDEV-10267), Aria tables with WITH PARSER ngram hit this as well.
Attachments
Issue Links
- blocks
-
MDEV-10267 Add "ngram" support to MariaDB
-
- In Review
-
- links to