diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-12-01 15:35:16 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-12-01 15:35:16 +0200 |
commit | 24c9785a67dda85f8df8a3fde4c4903e09f846e9 (patch) | |
tree | ec2bc07657c2d8a6b058168e2292e6de26697cfe /storage | |
parent | 5b697c5a23ed7322b5b746b61e3ec66b510ca134 (diff) | |
parent | 40bf5c951b6f1241bcb59e3be5303057282079e8 (diff) | |
download | mariadb-git-24c9785a67dda85f8df8a3fde4c4903e09f846e9.tar.gz |
Merge 10.2 into bb-10.2-ext
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/include/log0recv.h | 9 | ||||
-rw-r--r-- | storage/innobase/log/log0log.cc | 1 | ||||
-rw-r--r-- | storage/innobase/log/log0recv.cc | 56 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.cc | 9 |
4 files changed, 47 insertions, 28 deletions
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index 24ad9ae2a30..29784a59d95 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -99,14 +99,15 @@ recv_sys_debug_free(void); /** Read a log segment to a buffer. @param[out] buf buffer @param[in] group redo log files -@param[in] start_lsn read area start +@param[in, out] start_lsn in : read area start, out: the last read valid lsn @param[in] end_lsn read area end -@return valid end_lsn */ -lsn_t +@param[out] invalid_block - invalid, (maybe incompletely written) block encountered +@return false, if invalid block encountered (e.g checksum mismatch), true otherwise */ +bool log_group_read_log_seg( byte* buf, const log_group_t* group, - lsn_t start_lsn, + lsn_t* start_lsn, lsn_t end_lsn); /********************************************************//** diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index f7974d243d8..01f3ff1034c 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -1979,6 +1979,7 @@ wait_suspend_loop: goto wait_suspend_loop; case SRV_PURGE: case SRV_WORKER: + ut_ad(!"purge was not shut down"); srv_purge_wakeup(); thread_name = "purge thread"; goto wait_suspend_loop; diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 2d707820f4a..2e967a99121 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -608,28 +608,29 @@ recv_sys_debug_free(void) /** Read a log segment to a buffer. @param[out] buf buffer @param[in] group redo log files -@param[in] start_lsn read area start +@param[in, out] start_lsn in : read area start, out: the last read valid lsn @param[in] end_lsn read area end -@return valid end_lsn */ -lsn_t +@param[out] invalid_block - invalid, (maybe incompletely written) block encountered +@return false, if invalid block encountered (e.g checksum mismatch), true otherwise */ +bool log_group_read_log_seg( byte* buf, const log_group_t* group, - lsn_t start_lsn, + lsn_t *start_lsn, lsn_t end_lsn) { ulint len; lsn_t source_offset; - + bool success = true; ut_ad(log_mutex_own()); - ut_ad(!(start_lsn % OS_FILE_LOG_BLOCK_SIZE)); + ut_ad(!(*start_lsn % OS_FILE_LOG_BLOCK_SIZE)); ut_ad(!(end_lsn % OS_FILE_LOG_BLOCK_SIZE)); loop: - source_offset = log_group_calc_lsn_offset(start_lsn, group); + source_offset = log_group_calc_lsn_offset(*start_lsn, group); - ut_a(end_lsn - start_lsn <= ULINT_MAX); - len = (ulint) (end_lsn - start_lsn); + ut_a(end_lsn - *start_lsn <= ULINT_MAX); + len = (ulint) (end_lsn - *start_lsn); ut_ad(len != 0); @@ -659,16 +660,16 @@ loop: for (ulint l = 0; l < len; l += OS_FILE_LOG_BLOCK_SIZE, buf += OS_FILE_LOG_BLOCK_SIZE, - start_lsn += OS_FILE_LOG_BLOCK_SIZE) { + (*start_lsn) += OS_FILE_LOG_BLOCK_SIZE) { const ulint block_number = log_block_get_hdr_no(buf); - if (block_number != log_block_convert_lsn_to_no(start_lsn)) { + if (block_number != log_block_convert_lsn_to_no(*start_lsn)) { /* Garbage or an incompletely written log block. We will not report any error, because this can happen when InnoDB was killed while it was writing redo log. We simply treat this as an abrupt end of the redo log. */ - end_lsn = start_lsn; + end_lsn = *start_lsn; break; } @@ -676,6 +677,13 @@ loop: ulint crc = log_block_calc_checksum_crc32(buf); ulint cksum = log_block_get_checksum(buf); + DBUG_EXECUTE_IF("log_intermittent_checksum_mismatch", { + static int block_counter; + if (block_counter++ == 0) { + cksum = crc + 1; + } + }); + if (crc != cksum) { ib::error() << "Invalid log block checksum." << " block: " << block_number @@ -683,30 +691,33 @@ loop: << log_block_get_checkpoint_no(buf) << " expected: " << crc << " found: " << cksum; - end_lsn = start_lsn; + end_lsn = *start_lsn; + success = false; break; } if (group->is_encrypted()) { - log_crypt(buf, start_lsn, + log_crypt(buf, *start_lsn, OS_FILE_LOG_BLOCK_SIZE, true); } } } if (recv_sys->report(ut_time())) { - ib::info() << "Read redo log up to LSN=" << start_lsn; + ib::info() << "Read redo log up to LSN=" << *start_lsn; sd_notifyf(0, "STATUS=Read redo log up to LSN=" LSN_PF, - start_lsn); + *start_lsn); } - if (start_lsn != end_lsn) { + if (*start_lsn != end_lsn) { goto loop; } - return(start_lsn); + return(success); } + + /********************************************************//** Copies a log segment from the most up-to-date log group to the other log groups, so that they all contain the latest log data. Also writes the info @@ -721,10 +732,10 @@ recv_synchronize_groups() /* Read the last recovered log block to the recovery system buffer: the block is always incomplete */ - const lsn_t start_lsn = ut_uint64_align_down(recovered_lsn, + lsn_t start_lsn = ut_uint64_align_down(recovered_lsn, OS_FILE_LOG_BLOCK_SIZE); log_group_read_log_seg(log_sys->buf, &log_sys->log, - start_lsn, start_lsn + OS_FILE_LOG_BLOCK_SIZE); + &start_lsn, start_lsn + OS_FILE_LOG_BLOCK_SIZE); /* Update the fields in the group struct to correspond to recovered_lsn */ @@ -2903,8 +2914,9 @@ recv_group_scan_log_recs( start_lsn = ut_uint64_align_down(end_lsn, OS_FILE_LOG_BLOCK_SIZE); - end_lsn = log_group_read_log_seg( - log_sys->buf, group, start_lsn, + end_lsn = start_lsn; + log_group_read_log_seg( + log_sys->buf, group, &end_lsn, start_lsn + RECV_SCAN_SIZE); } while (end_lsn != start_lsn && !recv_scan_log_recs( diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 25ec0670c7d..9ac4daf5901 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -2980,8 +2980,11 @@ srv_purge_wakeup() { ut_ad(!srv_read_only_mode); - if (srv_force_recovery < SRV_FORCE_NO_BACKGROUND) { + if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) { + return; + } + do { srv_release_threads(SRV_PURGE, 1); if (srv_n_purge_threads > 1) { @@ -2989,7 +2992,9 @@ srv_purge_wakeup() srv_release_threads(SRV_WORKER, n_workers); } - } + } while (!srv_running + && (srv_sys.n_threads_active[SRV_WORKER] + || srv_sys.n_threads_active[SRV_PURGE])); } /** Check if tablespace is being truncated. |