• Jan Lindström's avatar
    MDEV-12610: MariaDB start is slow · 58c56dd7
    Jan Lindström authored
    Problem appears to be that the function fsp_flags_try_adjust()
    is being unconditionally invoked on every .ibd file on startup.
    Based on performance investigation also the top function
    fsp_header_get_crypt_offset() needs to addressed.
    
    Ported implementation of fsp_header_get_encryption_offset()
    function from 10.2 to fsp_header_get_crypt_offset().
    
    Introduced a new function fil_crypt_read_crypt_data()
    to read page 0 if it is not yet read.
    
    fil_crypt_find_space_to_rotate(): Now that page 0 for every .ibd
    file is not read on startup we need to check has page 0 read
    from space that we investigate for key rotation, if it is not read
    we read it.
    
    fil_space_crypt_get_status(): Now that page 0 for every .ibd
    file is not read on startup here also we need to read page 0
    if it is not yet read it. This is needed
    as tests use IS query to wait until background encryption
    or decryption has finished and this function is used to
    produce results.
    
    fil_crypt_thread(): Add is_stopping condition for tablespace
    so that we do not rotate pages if usage of tablespace should
    be stopped. This was needed for failure seen on regression
    testing.
    
    fil_space_create: Remove page_0_crypt_read and extra
    unnecessary info output.
    
    fil_open_single_table_tablespace(): We call fsp_flags_try_adjust
    only when when no errors has happened and server was not started
    on read only mode and tablespace validation was requested or
    flags contain other table options except low order bits to
    FSP_FLAGS_POS_PAGE_SSIZE position.
    
    fil_space_t::page_0_crypt_read removed.
    
    Added test case innodb-first-page-read to test startup when
    encryption is on and when encryption is off to check that not
    for all tables page 0 is read on startup.
    58c56dd7
innodb-first-page-read.test 5.24 KB