• Jan Lindström's avatar
    MDEV-12113: install_db shows corruption for rest encryption with innodb_data_file_path=ibdata1:3M; · 1af8bf39
    Jan Lindström authored
    Problem was that FIL_PAGE_FLUSH_LSN_OR_KEY_VERSION field that for
    encrypted pages even in system datafiles should contain key_version
    except very first page (0:0) is after encryption overwritten with
    flush lsn.
    
    Ported WL#7990 Repurpose FIL_PAGE_FLUSH_LSN to 10.1
    The field FIL_PAGE_FLUSH_LSN_OR_KEY_VERSION is consulted during
    InnoDB startup.
    
    At startup, InnoDB reads the FIL_PAGE_FLUSH_LSN_OR_KEY_VERSION
    from the first page of each file in the InnoDB system tablespace.
    If there are multiple files, the minimum and maximum LSN can differ.
    These numbers are passed to InnoDB startup.
    
    Having the number in other files than the first file of the InnoDB
    system tablespace is not providing much additional value. It is
    conflicting with other use of the field, such as on InnoDB R-tree
    index pages and encryption key_version.
    
    This worklog will stop writing FIL_PAGE_FLUSH_LSN_OR_KEY_VERSION to
    other files than the first file of the InnoDB system tablespace
    (page number 0:0) when system tablespace is encrypted. If tablespace
    is not encrypted we continue writing FIL_PAGE_FLUSH_LSN_OR_KEY_VERSION
    to all first pages of system tablespace to avoid unnecessary
    warnings on downgrade.
    
    open_or_create_data_files(): pass only one flushed_lsn parameter
    
    xb_load_tablespaces(): pass only one flushed_lsn parameter.
    
    buf_page_create(): Improve comment about where
    FIL_PAGE_FIL_FLUSH_LSN_OR_KEY_VERSION is set.
    
    fil_write_flushed_lsn(): A new function, merged from
    fil_write_lsn_and_arch_no_to_file() and
    fil_write_flushed_lsn_to_data_files().
    Only write to the first page of the system tablespace (page 0:0)
    if tablespace is encrypted, or write all first pages of system
    tablespace and invoke fil_flush_file_spaces(FIL_TYPE_TABLESPACE)
    afterwards.
    
    fil_read_first_page(): read flush_lsn and crypt_data only from
    first datafile.
    
    fil_open_single_table_tablespace(): Remove output of LSN, because it
    was only valid for the system tablespace and the undo tablespaces, not
    user tablespaces.
    
    fil_validate_single_table_tablespace(): Remove output of LSN.
    
    checkpoint_now_set(): Use fil_write_flushed_lsn and output
    a error if operation fails.
    
    Remove lsn variable from fsp_open_info.
    
    recv_recovery_from_checkpoint_start(): Remove unnecessary second
    flush_lsn parameter.
    
    log_empty_and_mark_files_at_shutdown(): Use fil_writte_flushed_lsn
    and output error if it fails.
    
    open_or_create_data_files(): Pass only one flushed_lsn variable.
    1af8bf39
log0recv.h 18.2 KB