Skip to content

fix(database): Sync prefixlen of FTS index during restoration (backport #459)#463

Merged
tanmoysrt merged 1 commit intomasterfrom
mergify/bp/master/pr-459
Feb 27, 2026
Merged

fix(database): Sync prefixlen of FTS index during restoration (backport #459)#463
tanmoysrt merged 1 commit intomasterfrom
mergify/bp/master/pr-459

Conversation

@mergify
Copy link
Contributor

@mergify mergify bot commented Feb 27, 2026

We have started getting this error message while restoring tables with FTS Index :

(1808, "Schema mismatch (Index ft_description field description prefix len 0 doesn't match metadata file value 1))

Root Cause :

MariaDB has some special validation in place for FTS index. It really matters, how the FTS index was added in the database at first place. If we don't follow the same flow to re-create FTS, it will panic.

For example, If we add FTS Index via ALTER and take physical backup of the database

CREATE TABLE articles (
    id INT AUTO_INCREMENT PRIMARY KEY,
    title VARCHAR(200),
    content TEXT
) ENGINE=InnoDB;
ALTER TABLE articles ADD FULLTEXT INDEX ft_content (content);

We can't restore the tablespace ever, if we have created the target table with FTS index with the following syntax

CREATE TABLE articles (
    id INT AUTO_INCREMENT PRIMARY KEY,
    title VARCHAR(200),
    content TEXT,
    FULLTEXT INDEX ft_content (content)
) ENGINE=InnoDB;

SHOW CREATE TABLE ..... will always include FTS Index Creation regardless how it was added.

Solution :

The prefixlen metadata is available inside the .cfg file only (which generates during tablespace export). So, we have to parse the cfg file.

Source : https://github.com/MariaDB/server/blob/d755574c47f101917aee29ea847e214c24c92c0b/storage/innobase/row/row0import.cc#L2816

So, if the FTS indexes prefixlen is 1 according to .cfg file, we have to drop the FTS index and re-create using alter.


This is an automatic backport of pull request #459 done by Mergify.

The fix has been made to fix the following issue:

(1808, "Schema mismatch (Index ft_description field description prefix len 0 doesn't match metadata file value 1))

Check PR description or code inline comments for more info

(cherry picked from commit f4d89f1)
@tanmoysrt tanmoysrt merged commit a52b3d5 into master Feb 27, 2026
3 checks passed
@tanmoysrt tanmoysrt deleted the mergify/bp/master/pr-459 branch February 27, 2026 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant