[MDEV-24940] dict_hdr_get_new_id() changes table id in dictionary header, but does not write log record for it Created: 2021-02-22  Updated: 2021-03-28

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.2
Fix Version/s: 10.2

Type: Bug Priority: Major
Reporter: Vladislav Lesin Assignee: Vladislav Lesin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-17794 Do not assign persistent ID for tempo... Closed

 Description   

Take a look dict_hdr_get_new_id() in 10.2:

void                                                                            
dict_hdr_get_new_id(
...                                                            
)
{                                                                               
...                                                                             
        mtr_start(&mtr);                                                        
        if (table) {                                                            
                if (table->is_temporary()) {                                    
                        mtr.set_log_mode(MTR_LOG_NO_REDO);                      
                }                                                               
        }                                                                       
...                                                                             
        dict_hdr = dict_hdr_get(&mtr);                                          
        if (table_id) {                                                         
                id = mach_read_from_8(dict_hdr + DICT_HDR_TABLE_ID);            
                id++;                                                           
                mlog_write_ull(dict_hdr + DICT_HDR_TABLE_ID, id, &mtr);         
                *table_id = id;                                                 
        }                                                                       
...                                                                             
        mtr_commit(&mtr);                                                       
}                                   

If a table is temporary, log mode is set to MTR_LOG_NO_REDO. But then table id is increased and written back to space 0. But it's not logged due to log mode.

The proper fix is:
MDEV-17794 Do not assign persistent ID for temporary tables

The workaround is to remove

                if (table->is_temporary()) {                                    
                        mtr.set_log_mode(MTR_LOG_NO_REDO);                      
                }

from dict_hdr_get_new_id().


Generated at Thu Feb 08 09:33:52 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.