• Marko Mäkelä's avatar
    MDEV-12266: Change dict_table_t::space to fil_space_t* · 4cad4239
    Marko Mäkelä authored
    InnoDB always keeps all tablespaces in the fil_system cache.
    The fil_system.LRU is only for closing file handles; the
    fil_space_t and fil_node_t for all data files will remain
    in main memory. Between startup to shutdown, they can only be
    created and removed by DDL statements. Therefore, we can
    let dict_table_t::space point directly to the fil_space_t.
    
    dict_table_t::space_id: A numeric tablespace ID for the corner cases
    where we do not have a tablespace. The most prominent examples are
    ALTER TABLE...DISCARD TABLESPACE or a missing or corrupted file.
    
    There are a few functional differences; most notably:
    (1) DROP TABLE will delete matching .ibd and .cfg files,
    even if they were not attached to the data dictionary.
    (2) Some error messages will report file names instead of numeric IDs.
    
    There still are many functions that use numeric tablespace IDs instead
    of fil_space_t*, and many functions could be converted to fil_space_t
    member functions. Also, Tablespace and Datafile should be merged with
    fil_space_t and fil_node_t. page_id_t and buf_page_get_gen() could use
    fil_space_t& instead of a numeric ID, and after moving to a single
    buffer pool (MDEV-15058), buf_pool_t::page_hash could be moved to
    fil_space_t::page_hash.
    
    FilSpace: Remove. Only few calls to fil_space_acquire() will remain,
    and gradually they should be removed.
    
    mtr_t::set_named_space_id(ulint): Renamed from set_named_space(),
    to prevent accidental calls to this slower function. Very few
    callers remain.
    
    fseg_create(), fsp_reserve_free_extents(): Take fil_space_t*
    as a parameter instead of a space_id.
    
    fil_space_t::rename(): Wrapper for fil_rename_tablespace_check(),
    fil_name_write_rename(), fil_rename_tablespace(). Mariabackup
    passes the parameter log=false; InnoDB passes log=true.
    
    dict_mem_table_create(): Take fil_space_t* instead of space_id
    as parameter.
    
    dict_process_sys_tables_rec_and_mtr_commit(): Replace the parameter
    'status' with 'bool cached'.
    
    dict_get_and_save_data_dir_path(): Avoid copying the fil_node_t::name.
    
    fil_ibd_open(): Return the tablespace.
    
    fil_space_t::set_imported(): Replaces fil_space_set_imported().
    
    truncate_t: Change many member function parameters to fil_space_t*,
    and remove page_size parameters.
    
    row_truncate_prepare(): Merge to its only caller.
    
    row_drop_table_from_cache(): Assert that the table is persistent.
    
    dict_create_sys_indexes_tuple(): Write SYS_INDEXES.SPACE=FIL_NULL
    if the tablespace has been discarded.
    
    row_import_update_discarded_flag(): Remove a constant parameter.
    4cad4239
fil0fil.cc 151 KB