Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-24940

dict_hdr_get_new_id() changes table id in dictionary header, but does not write log record for it

    XMLWordPrintable

    Details

      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().

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              vlad.lesin Vladislav Lesin
              Reporter:
              vlad.lesin Vladislav Lesin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:

                  Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.