• Marko Mäkelä's avatar
    MDEV-19506 Remove the global sequence DICT_HDR_ROW_ID for DB_ROW_ID · 944beb9e
    Marko Mäkelä authored
    InnoDB tables that lack a primary key (and any UNIQUE INDEX whose
    all columns are NOT NULL) will use an internally generated index,
    called GEN_CLUST_INDEX(DB_ROW_ID) in the InnoDB data dictionary,
    and hidden from the SQL layer.
    
    The 48-bit (6-byte) DB_ROW_ID is being assigned from a
    global sequence that is persisted in the DICT_HDR page.
    
    There is absolutely no reason for the DB_ROW_ID to be globally
    unique across all InnoDB tables.
    
    A downgrade to earlier versions will be prevented by the file format
    change related to removing the InnoDB change buffer (MDEV-29694).
    
    DICT_HDR_ROW_ID, dict_sys_t::row_id: Remove.
    
    dict_table_t::row_id: The per-table sequence of DB_ROW_ID.
    
    commit_try_rebuild(): Copy dict_table_t::row_id from the old table.
    
    btr_cur_instant_init(), row_import_cleanup(): If needed, perform
    the equivalent of SELECT MAX(DB_ROW_ID) to initialize
    dict_table_t::row_id.
    
    row_ins(): If needed, obtain DB_ROW_ID from dict_table_t::row_id.
    Should it exceed the maximum 48-bit value, return DB_OUT_OF_FILE_SPACE
    to prevent further inserts into the table.
    
    dict_load_table_one(): Move a condition to btr_cur_instant_init_low()
    so that dict_table_t::row_id will be restored also for
    ROW_FORMAT=COMPRESSED tables.
    
    Tested by: Matthias Leich
    944beb9e
dict0dict.inl 34.3 KB