Repository navigation
MDEV-41752 Aria: RENAME TABLE, ALTER TABLE, REPAIR TABLE and crash recovery fail for a table with a fulltext parser plugin - #5977
Open
futureweb wants to merge 2 commits into
Conversation
…st" for a table with a fulltext parser plugin maria_delete_table() opens the table to find out whether it is transactional. A table whose fulltext index uses a parser plugin has HA_OPTION_RELIES_ON_SQL_LAYER, so maria_open() refused it with HA_ERR_UNSUPPORTED. DROP TABLE then warned "Table uses an extension that doesn't exist in this MariaDB version" and skipped the REDO_DROP_TABLE log record of a transactional table. Opening for drop only reads the share, so allow it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…covery fail for a table with a fulltext parser plugin A table whose fulltext index uses a parser plugin has HA_OPTION_RELIES_ON_SQL_LAYER, and maria_open() refuses it unless HA_OPEN_FROM_SQL_LAYER is set, which only ha_maria::open() did. So maria_rename() (RENAME TABLE, and the renames of ALTER TABLE ... ALGORITHM=COPY), the second data handle of a ROW_FORMAT=PAGE repair (create_new_data_handle()) and crash recovery (new_table()) failed for such tables, and recovery skipped their REDO records. Inside the server, open such tables with HA_OPEN_FROM_SQL_LAYER in these places. Recovery can pass the flag for every table, because for the others its only effect, the state LSN update, already follows from maria_in_recovery. aria_chk and aria_read_log still refuse such tables. Repair builds the fulltext keys through the handle that the SQL layer opened, which has the parser of the table, and recovery applies logged rows and key values without a parser. Recovery cannot replay REDO_REPAIR_TABLE for such a table, because the parser plugin is not loaded then. It skips the record and keeps the files of the repair. To make that safe, write_log_record_for_repair() now syncs the files of such a table before it logs the repair: flushing the pages does not make them durable. Marking the table as crashed instead would make recovery skip all later REDO records of the table, which can be committed changes. The debug points maria_crash_after_repair_log and maria_before_repair_log are for maria.fulltext_parser_debug. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
futureweb
marked this pull request as ready for review
October 24, 2026 18:48
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This branch contains the commit of MDEV-41747 (#5963). Please merge it after #5963.
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() set it, so these opens failed:
Before:
In the recovery example of the Jira issue, SELECT COUNT(*) returns 3 after the kill and restart (5 without WITH PARSER), and the error log shows
***WARNING: ./test/t1 could not be opened: Error: 138. After: the statements work, and recovery applies the REDO records of such tables.Fix:
aria_chk and aria_read_log still refuse such tables. The debug points maria_crash_after_repair_log and maria_before_repair_log are for the test. With the ngram parser proposed in MDEV-10267, Aria tables WITH PARSER ngram hit this as well.
Release Notes
Aria tables with a fulltext index that uses a parser plugin can be renamed, changed with ALTER TABLE ... ALGORITHM=COPY and repaired. Crash recovery no longer skips such tables, which lost committed changes.
How can this PR be tested?
New tests
maria.fulltext_parserand, for debug builds,maria.fulltext_parser_debug. Both use thesimple_parserplugin from mypluglib and are skipped if it is not built.fulltext_parser: RENAME TABLE, ALTER TABLE ... ALGORITHM=COPY, ADD FULLTEXT ... WITH PARSER, REPAIR TABLE (default, QUICK, EXTENDED) and OPTIMIZE TABLE for ROW_FORMAT=PAGE and DYNAMIC; recovery of committed rows after a kill; rollback of an uncommitted transaction during recovery; recovery after a bulk insert repair.fulltext_parser_debug: a crash right after REDO_REPAIR_TABLE is logged, and changes committed after a repair record. Without the fix, RENAME TABLE fails with errno 138 and the recovered table misses the committed rows.The
mariaandpluginssuites and themainfulltext, plugin and alter tests pass on 11.4 (debug build). On main with all our fixes and the ngram parser of MDEV-10267, theinnodb_fts,mariaandpluginssuites and themainfulltext, plugin and alter tests pass.Basing the PR against the correct MariaDB version
PR quality check
🤖 Generated with Claude Code