Commit 0bdd6cb
authored
mariadb 11.8 wrapper: fix hlindex assertion failure in wrapper mode with FULLTEXT indexes (mroonga#977)
GitHub: mroongaGH-943
## Issue
The test `mroonga/wrapper/alter_table.change_engine` was failing with an
assertion error during ALTER TABLE operations that change MyISAM tables
with FULLTEXT indexes to Mroonga wrapper mode:
```
- saving '/home/otegami/work/cpp/mariadb-11.8.3.build/mysql-test/var/3/log/mroonga/wrapper/alter_table.change_engine/' to '/home/otegami/work/cpp/mariadb-11.8.3.build/mysql-test/var/log/alter_table.change_engine/'
***Warnings generated in error logs during shutdown after running tests: mroonga/wrapper/alter_table.change_engine
mariadbd: /home/otegami/work/cpp/mariadb-11.8.3/sql/sql_base.cc:10018: int TABLE::hlindexes_on_insert(): Assertion `s->hlindexes() == (hlindex != __null)' failed.
250910 10:31:10 [ERROR] /home/otegami/work/cpp/mariadb-11.8.3.build/sql/mariadbd got signal 6 ;
Attempting backtrace. Include this in the bug report.
```
The crash occurred during `copy_data_between_tables()` when the wrapped
handler (InnoDB) attempted to insert rows, specifically when
`TABLE::hlindexes_on_insert()` was called.
## Cause
When Mroonga operates in wrapper mode, it creates a `wrap_table_share`
structure that excludes FULLTEXT and SPATIAL indexes since these are
handled by Mroonga rather than the wrapped storage engine. The bug
occurred because:
1. The `wrap_table_share` was created by copying all fields from the
original table share
2. The `keys` field was correctly updated to reflect only
wrapper-handled keys (non-FULLTEXT, non-SPATIAL)
3. However, `total_keys` was not updated and remained at the original
value
4. This caused `hlindexes()` (calculated as `total_keys - keys`) to
return a non-zero value, incorrectly indicating that the wrapper handler
should handle FULLTEXT indexes
5. Since `hlindex` was NULL but `hlindexes() > 0`, the assertion
`s->hlindexes() == (hlindex != NULL)` failed
For example, with a table having 2 FULLTEXT indexes:
- Actual: Original table share: `hlindexes()=2`
- Expected: table share: `hlindexes()=0`
## Solution
Fixed by setting `wrap_table_share->total_keys = share->wrap_keys` in
`mrn_table.cpp`. This ensures that for the wrapper table share,
`total_keys` equals `keys`, making `hlindexes()` return 0, which
correctly indicates that the wrapper handler doesn't handle FULLTEXT
indexes.
Related MariaDB commit:
MariaDB/server@d6add9a
It also uses this solution.1 parent 6c474c1 commit 0bdd6cb
1 file changed
+3
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
864 | 864 | | |
865 | 865 | | |
866 | 866 | | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
867 | 870 | | |
868 | 871 | | |
869 | 872 | | |
| |||
0 commit comments