Description:
On a debug build of MySQL 8.4.10, executing an ALTER TABLE that combines an explicit ALGORITHM= clause with SECONDARY_UNLOAD aborts the server (SIGABRT) via a
failed assertion:
mysqld: /build/mysql-src/sql/sql_table.cc:11689:
bool Sql_cmd_secondary_load_unload::mysql_secondary_load_or_unload(THD*, Table_ref*):
Assertion `m_alter_info->requested_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT' failed.
mysqld got signal 6 ;
Query: ALTER TABLE v0 ALGORITHM = INPLACE , SECONDARY_UNLOAD
How to repeat:
create table v1099(c1100 INT);
CREATE TABLE IF NOT EXISTS v0 ( CONSTRAINT FOREIGN KEY ( c1100 ( 100 ) ) REFERENCES v1099 MATCH PARTIAL ON DELETE CASCADE ON UPDATE CASCADE , c1 LONGBLOB COLLATE BINARY AS ( TRUE ) ) STORAGE MEMORY , STORAGE MEMORY PARTITION BY RANGE ( c1100 ) AS TABLE test_sqlright1 . v1099 LIMIT 100 , c1100 ;
INSERT DELAYED INTO test_sqlright1 . v0 PARTITION ( v0 ) ( ) SELECT * ON DUPLICATE KEY UPDATE c1 = DEFAULT ;
INSERT HIGH_PRIORITY INTO v1099 PARTITION ( v0 ) SET test_sqlright1 . v1099 . c1 = DEFAULT AS v0 ( v0 ) ON DUPLICATE KEY UPDATE v0 . c1100 = DEFAULT ;
INSERT LOW_PRIORITY test_sqlright1 . v1099 ( ) VALUE ( ) ON DUPLICATE KEY UPDATE v0 . c1100 = DEFAULT ;
INSERT LOW_PRIORITY IGNORE v1099 PARTITION ( v0 ) SET c1100 = DEFAULT , c1 = DEFAULT AS v0 ON DUPLICATE KEY UPDATE v0 . c1100 = DEFAULT ;
ALTER TABLE v0 ALGORITHM = INPLACE , SECONDARY_UNLOAD ;
Suggested fix:
Reject the clause combination during ALTER TABLE preparation, before dispatching to the secondary-engine handler, returning a proper error (e.g.
ER_WRONG_USAGE, "SECONDARY_UNLOAD cannot be used with ALGORITHM") instead of relying on the downstream assertion. Concretely, in the SECONDARY_LOAD/UNLOAD
prepare path validate requested_algorithm == ALTER_TABLE_ALGORITHM_DEFAULT and raise an error if not — mirroring the assertion as a user-facing check. (The
assertion at sql_table.cc:11689 should then become unreachable from SQL.)
Description: On a debug build of MySQL 8.4.10, executing an ALTER TABLE that combines an explicit ALGORITHM= clause with SECONDARY_UNLOAD aborts the server (SIGABRT) via a failed assertion: mysqld: /build/mysql-src/sql/sql_table.cc:11689: bool Sql_cmd_secondary_load_unload::mysql_secondary_load_or_unload(THD*, Table_ref*): Assertion `m_alter_info->requested_algorithm == Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT' failed. mysqld got signal 6 ; Query: ALTER TABLE v0 ALGORITHM = INPLACE , SECONDARY_UNLOAD How to repeat: create table v1099(c1100 INT); CREATE TABLE IF NOT EXISTS v0 ( CONSTRAINT FOREIGN KEY ( c1100 ( 100 ) ) REFERENCES v1099 MATCH PARTIAL ON DELETE CASCADE ON UPDATE CASCADE , c1 LONGBLOB COLLATE BINARY AS ( TRUE ) ) STORAGE MEMORY , STORAGE MEMORY PARTITION BY RANGE ( c1100 ) AS TABLE test_sqlright1 . v1099 LIMIT 100 , c1100 ; INSERT DELAYED INTO test_sqlright1 . v0 PARTITION ( v0 ) ( ) SELECT * ON DUPLICATE KEY UPDATE c1 = DEFAULT ; INSERT HIGH_PRIORITY INTO v1099 PARTITION ( v0 ) SET test_sqlright1 . v1099 . c1 = DEFAULT AS v0 ( v0 ) ON DUPLICATE KEY UPDATE v0 . c1100 = DEFAULT ; INSERT LOW_PRIORITY test_sqlright1 . v1099 ( ) VALUE ( ) ON DUPLICATE KEY UPDATE v0 . c1100 = DEFAULT ; INSERT LOW_PRIORITY IGNORE v1099 PARTITION ( v0 ) SET c1100 = DEFAULT , c1 = DEFAULT AS v0 ON DUPLICATE KEY UPDATE v0 . c1100 = DEFAULT ; ALTER TABLE v0 ALGORITHM = INPLACE , SECONDARY_UNLOAD ; Suggested fix: Reject the clause combination during ALTER TABLE preparation, before dispatching to the secondary-engine handler, returning a proper error (e.g. ER_WRONG_USAGE, "SECONDARY_UNLOAD cannot be used with ALGORITHM") instead of relying on the downstream assertion. Concretely, in the SECONDARY_LOAD/UNLOAD prepare path validate requested_algorithm == ALTER_TABLE_ALGORITHM_DEFAULT and raise an error if not — mirroring the assertion as a user-facing check. (The assertion at sql_table.cc:11689 should then become unreachable from SQL.)