• Marko Mäkelä's avatar
    MDEV-29694 Remove the InnoDB change buffer · f27e9c89
    Marko Mäkelä authored
    The purpose of the change buffer was to reduce random disk access,
    which could be useful on rotational storage, but maybe less so on
    solid-state storage.
    When we wished to
    (1) insert a record into a non-unique secondary index,
    (2) delete-mark a secondary index record,
    (3) delete a secondary index record as part of purge (but not ROLLBACK),
    and the B-tree leaf page where the record belongs to is not in the buffer
    pool, we inserted a record into the change buffer B-tree, indexed by
    the page identifier. When the page was eventually read into the buffer
    pool, we looked up the change buffer B-tree for any modifications to the
    page, applied these upon the completion of the read operation. This
    was called the insert buffer merge.
    
    We remove the change buffer, because it has been the source of
    various hard-to-reproduce corruption bugs, including those fixed in
    commit 5b9ee8d8 and
    commit 165564d3 but not limited to them.
    
    A downgrade will fail with a clear message starting with
    commit db14eb16 (MDEV-30106).
    
    buf_page_t::state: Merge IBUF_EXIST to UNFIXED and
    WRITE_FIX_IBUF to WRITE_FIX.
    
    buf_pool_t::watch[]: Remove.
    
    trx_t: Move isolation_level, check_foreigns, check_unique_secondary,
    bulk_insert into the same bit-field. The only purpose of
    trx_t::check_unique_secondary is to enable bulk insert into an
    empty table. It no longer enables insert buffering for UNIQUE INDEX.
    
    btr_cur_t::thr: Remove. This field was originally needed for change
    buffering. Later, its use was extended to cover SPATIAL INDEX.
    Much of the time, rtr_info::thr holds this field. When it does not,
    we will add parameters to SPATIAL INDEX specific functions.
    
    ibuf_upgrade_needed(): Check if the change buffer needs to be updated.
    
    ibuf_upgrade(): Merge and upgrade the change buffer after all redo log
    has been applied. Free any pages consumed by the change buffer, and
    zero out the change buffer root page to mark the upgrade completed,
    and to prevent a downgrade to an earlier version.
    
    dict_load_tablespaces(): Renamed from
    dict_check_tablespaces_and_store_max_id(). This needs to be invoked
    before ibuf_upgrade().
    
    btr_cur_open_at_rnd_pos(): Specialize for use in persistent statistics.
    The change buffer merge does not need this function anymore.
    
    btr_page_alloc(): Renamed from btr_page_alloc_low(). We no longer
    allocate any change buffer pages.
    
    btr_cur_open_at_rnd_pos(): Specialize for use in persistent statistics.
    The change buffer merge does not need this function anymore.
    
    row_search_index_entry(), btr_lift_page_up(): Add a parameter thr
    for the SPATIAL INDEX case.
    
    rtr_page_split_and_insert(): Specialized from btr_page_split_and_insert().
    
    rtr_root_raise_and_insert(): Specialized from btr_root_raise_and_insert().
    
    Note: The support for upgrading from the MySQL 3.23 or MySQL 4.0
    change buffer format that predates the MySQL 4.1 introduction of
    the option innodb_file_per_table was removed in MySQL 5.6.5
    as part of mysql/mysql-server@69b6241a79876ae98bb0c9dce7c8d8799d6ad273
    and MariaDB 10.0.11 as part of 1d0f70c2.
    
    In the tests innodb.log_upgrade and innodb.log_corruption, we create
    valid (upgraded) change buffer pages.
    
    Tested by: Matthias Leich
    f27e9c89
fsp0fsp.cc 94.4 KB