[MDEV-19120] legacy_db_type needs rethinking Created: 2019-04-01  Updated: 2021-01-26

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Major
Reporter: Andrew Hutchings (Inactive) Assignee: Nikita Malyavin
Resolution: Unresolved Votes: 1
Labels: spider

Issue Links:
Relates
relates to MCOL-3673 Proper fix for db_type issues Closed
relates to MDEV-18772 fix DB_TYPE_FIRST_DYNAMIC Open
relates to MCOL-2061 MariaDB shows warnings and could cras... Closed

 Description   

With every major release DB_TYPE_FIRST_DYNAMIC changes so dynamic engine plugins shift IDs with it. FRM files are not automatically updated which can cause issues in code that uses these IDs.

For example in 10.2 an engine will have ID 44, in 10.3 ID 44 is reserved for DB_TYPE_SEQUENCE. When a TRUNCATE is called after an upgrade MariaDB calls certain functions in the SEQUENCE engine instead of the intended engine plugin which can cause a crash.

The only workaround appears to be "ALTER TABLE comment=''"

There are several ways this could be solved. mysql_upgrade should probably be aware of this. Maybe the start ID for legacy_db_type should be something high like 100?



 Comments   
Comment by Sergei Golubchik [ 2019-04-01 ]

all new frms store the engine name, the server doesn't have to trust frm's legacy_db_type. On the opposite, it can assume that it's wrong and infer it from the engine name when the frm is opened.

Comment by Richard Stracke [ 2019-11-25 ]

The same issue exists with spider engine.

"ALTER TABLE comment=''" is not an option, because important information will be stored in the comment field for spider.

A modified version of columnstore_upgrade for spider could be based on alter table engine = spider like

DELIMITER //
 
create procedure spider_upgrade()
`spider_upgrade`: BEGIN
 DECLARE done INTEGER DEFAULT 0;
    DECLARE schema_table VARCHAR(100) CHARACTER SET utf8 DEFAULT "";
    DECLARE table_list CURSOR FOR select concat('`', table_schema,'`.`',table_name,'`') from information_schema.tables where engine='spider';
    DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
    OPEN table_list;
    tlist: LOOP
        FETCH table_list INTO schema_table;
        IF done = 1 THEN LEAVE tlist;
        END IF;
        SET @sql_query = concat('ALTER TABLE ', schema_table, ' engine=spider');
        PREPARE stmt FROM @sql_query;
        EXECUTE stmt;
        DEALLOCATE PREPARE stmt;
    END LOOP;
END //
 
DELIMITER ;

Comment by Nikita Malyavin [ 2020-10-22 ]

So what am I supposed to do in this "bug"?

Comment by Sergei Golubchik [ 2020-10-23 ]

it was incorrectly reported as a bug, looks more like a refactoring task to me. changed.

Generated at Thu Feb 08 08:49:12 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.