diff options
Diffstat (limited to 'storage/xtradb/log/log0recv.cc')
-rw-r--r-- | storage/xtradb/log/log0recv.cc | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/storage/xtradb/log/log0recv.cc b/storage/xtradb/log/log0recv.cc index 67f4050a1f1..759687e3fe5 100644 --- a/storage/xtradb/log/log0recv.cc +++ b/storage/xtradb/log/log0recv.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. Copyright (c) 2013, 2016, MariaDB Corporation. All Rights Reserved. @@ -333,7 +333,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(recv_writer_thread)( /*===============================*/ - void* arg __attribute__((unused))) + void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter required by os_thread_create */ { @@ -752,7 +752,7 @@ recv_check_cp_is_consistent( /********************************************************//** Looks for the maximum consistent checkpoint from the log groups. @return error code or DB_SUCCESS */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t recv_find_max_checkpoint( /*=====================*/ @@ -775,8 +775,38 @@ recv_find_max_checkpoint( buf = log_sys->checkpoint_buf; while (group) { + + ulint log_hdr_log_block_size; + group->state = LOG_GROUP_CORRUPTED; + /* Assert that we can reuse log_sys->checkpoint_buf to read the + part of the header that contains the log block size. */ + ut_ad(LOG_FILE_OS_FILE_LOG_BLOCK_SIZE + 4 + < OS_FILE_LOG_BLOCK_SIZE); + + fil_io(OS_FILE_READ | OS_FILE_LOG, true, group->space_id, 0, + 0, 0, OS_FILE_LOG_BLOCK_SIZE, + log_sys->checkpoint_buf, NULL, NULL); + log_hdr_log_block_size + = mach_read_from_4(log_sys->checkpoint_buf + + LOG_FILE_OS_FILE_LOG_BLOCK_SIZE); + if (log_hdr_log_block_size == 0) { + /* 0 means default value */ + log_hdr_log_block_size = 512; + } + if (UNIV_UNLIKELY(log_hdr_log_block_size + != srv_log_block_size)) { + fprintf(stderr, + "InnoDB: Error: The block size of ib_logfile " + "%lu is not equal to innodb_log_block_size " + "%lu.\n" + "InnoDB: Error: Suggestion - Recreate log " + "files.\n", + log_hdr_log_block_size, srv_log_block_size); + return(DB_ERROR); + } + for (field = LOG_CHECKPOINT_1; field <= LOG_CHECKPOINT_2; field += LOG_CHECKPOINT_2 - LOG_CHECKPOINT_1) { @@ -3097,7 +3127,6 @@ recv_recovery_from_checkpoint_start_func( log_group_t* group; log_group_t* max_cp_group; ulint max_cp_field; - ulint log_hdr_log_block_size; lsn_t checkpoint_lsn; ib_uint64_t checkpoint_no; lsn_t group_scanned_lsn = 0; @@ -3204,21 +3233,6 @@ recv_recovery_from_checkpoint_start_func( log_hdr_buf, max_cp_group, 0); } - log_hdr_log_block_size - = mach_read_from_4(log_hdr_buf + LOG_FILE_OS_FILE_LOG_BLOCK_SIZE); - if (log_hdr_log_block_size == 0) { - /* 0 means default value */ - log_hdr_log_block_size = 512; - } - if (UNIV_UNLIKELY(log_hdr_log_block_size != srv_log_block_size)) { - fprintf(stderr, - "InnoDB: Error: The block size of ib_logfile (" ULINTPF - ") is not equal to innodb_log_block_size.\n" - "InnoDB: Error: Suggestion - Recreate log files.\n", - log_hdr_log_block_size); - return(DB_ERROR); - } - #ifdef UNIV_LOG_ARCHIVE group = UT_LIST_GET_FIRST(log_sys->log_groups); |