• Marko Mäkelä's avatar
    Introduce btr_set_instant() and a new root page format · 80aefe16
    Marko Mäkelä authored
    For instant DROP COLUMN and ROW_FORMAT=COMPACT or ROW_FORMAT=REDUNDANT,
    we must store the n_core_null_bytes in the root page, so that the
    chain of node pointer records can be followed in order to reach the
    leftmost leaf page where the metadata record is located.
    
    If the PRIMARY KEY contains any variable-length column and some
    nullable columns were instantly dropped, the dict_index_t::n_nullable
    in the data dictionary could be smaller than it actually is in the
    non-leaf pages. Because of this, the non-leaf pages could use more
    bytes for the null flags than the data dictionary expects, and we
    could be reading the lengths of the variable-length columns from the
    wrong offset, and thus reading the child page number from wrong place.
    This is the result of two design mistakes that involve unnecessary
    storage of data: First, it is nonsense to store any data fields for
    the leftmost node pointer records, because the comparisons would be
    resolved by the MIN_REC_FLAG alone. Second, there cannot be any null
    fields in the clustered index node pointer fields, but we nevertheless
    reserve space for all the null flags.
    
    btr_set_instant(): Convert a root page into "instant ALTER TABLE"
    format. This replaces page_set_instant().
    
    btr_cur_instant_init_metadata(): Do not read any lengths from the
    metadata record header before reading the BLOB. At this point, we
    would not actually know how many nullable fields the metadata record
    contains.
    
    btr_cur_instant_init_low(): Minimize differences from the 10.3 version.
    
    btr_cur_instant_root_init(): Initialize n_core_null_bytes in one
    of two possible ways.
    
    FIXME: innobase_instant_try(): When needed, convert the root page
    from the ADD COLUMN format to the generic instant ALTER TABLE format.
    80aefe16
page0page.ic 29.2 KB