You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
MCOL-2061 Add upgrade path to rebuild FRM files
A major upgrade (1.1 -> 1.2 for example) may have issues due to stale FRM table IDs. This commit adds a stored procedure that changes the table comment to empty on every ColumnStore table to repair the IDs. The user should run this as part of the upgrade procedure between major versions.
This commit is contained in:
@ -98,4 +98,23 @@ BEGIN
|
||||
SELECT CONCAT((SELECT SUM(data_size) FROM information_schema.columnstore_extents ce left join information_schema.columnstore_columns cc on ce.object_id = cc.object_id where compression_type='Snappy') / (SELECT SUM(compressed_data_size) FROM information_schema.columnstore_files WHERE compressed_data_size IS NOT NULL), ':1') COMPRESSION_RATIO;
|
||||
END //
|
||||
|
||||
create procedure columnstore_upgrade()
|
||||
`columnstore_upgrade`: BEGIN
|
||||
DECLARE done INTEGER DEFAULT 0;
|
||||
DECLARE schema_table VARCHAR(100) DEFAULT "";
|
||||
DECLARE table_list CURSOR FOR select concat('`', table_schema,'`.`',table_name,'`') from information_schema.tables where engine='columnstore';
|
||||
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, ' COMMENT=\'\'');
|
||||
PREPARE stmt FROM @sql_query;
|
||||
EXECUTE stmt;
|
||||
DEALLOCATE PREPARE stmt;
|
||||
END LOOP;
|
||||
END //
|
||||
delimiter ;
|
||||
|
||||
DELIMITER ;
|
||||
|
Reference in New Issue
Block a user