Bug #120949 Sql_cmd_secondary_load_unload::mysql_secondary_load_or_unload(THD*, Table_ref*): Assertion `m_alter_info->requested_algo
Submitted: 17 Jul 5:24 Modified: 20 Jul 7:57
Reporter: xingwang Verdant Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DDL Severity:S6 (Debug Builds)
Version:8.4.10 OS:Ubuntu (ubuntu22.04 docker in the fedora host)
Assigned to: CPU Architecture:x86 (x64)
Tags: assertion failure, crash, input-validation, MySQL 8.4.10, Secondary Engine, SECONDARY_LOAD/UNLOAD

[17 Jul 5:24] xingwang Verdant
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.)
[20 Jul 7:57] Shane Bester
Thanks for the report,  verified on debug build.

mysqld-debug: Version: '26.10.0-debug' 
(Built on 19 July 2026, 
commit 956282494fbd13f3253c5250f56d284bbe130395 
with gcc (GCC) 11.5.0 20240719 (Red Hat 11.5.0-11.0.2)).

mysqld-debug: ./sql/sql_table.cc:12402: 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.

Thread 51 "connection" received signal SIGABRT, Aborted.
gdb) bt
#0  in __pthread_kill_implementation () from /lib64/libc.so.6
#1  in raise () from /lib64/libc.so.6
#2  in abort () from /lib64/libc.so.6
#3  in __assert_fail_base.cold () from /lib64/libc.so.6
#4  in __assert_fail () from /lib64/libc.so.6
#5  in Sql_cmd_secondary_load_unload::mysql_secondary_load_or_unload  at ./sql/sql_table.cc:12402
#6  in Sql_cmd_secondary_load_unload::execute at 
#7  in mysql_execute_command 
#8  in dispatch_sql_command 
#9  in dispatch_command 
#10 in do_command 
#11 in handle_connection 
#12 in pfs_spawn_thread
#13 in start_thread