diff options
Diffstat (limited to 'innobase/log/log0recv.c')
-rw-r--r-- | innobase/log/log0recv.c | 60 |
1 files changed, 48 insertions, 12 deletions
diff --git a/innobase/log/log0recv.c b/innobase/log/log0recv.c index 01679a374b0..432a6ed1e85 100644 --- a/innobase/log/log0recv.c +++ b/innobase/log/log0recv.c @@ -165,14 +165,16 @@ void recv_sys_empty_hash(void) /*=====================*/ { +#ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(recv_sys->mutex))); +#endif /* UNIV_SYNC_DEBUG */ if (recv_sys->n_addrs != 0) { fprintf(stderr, "InnoDB: Error: %lu pages with log records were left unprocessed!\n" "InnoDB: Maximum page number with log records on it %lu\n", (ulong) recv_sys->n_addrs, (ulong) recv_max_parsed_page_no); - ut_a(0); + ut_error; } hash_table_free(recv_sys->addr_hash); @@ -181,9 +183,10 @@ recv_sys_empty_hash(void) recv_sys->addr_hash = hash_create(buf_pool_get_curr_size() / 256); } +#ifndef UNIV_LOG_DEBUG /************************************************************ Frees the recovery system. */ - +static void recv_sys_free(void) /*===============*/ @@ -200,6 +203,7 @@ recv_sys_free(void) mutex_exit(&(recv_sys->mutex)); } +#endif /* !UNIV_LOG_DEBUG */ /************************************************************ Truncates possible corrupted or extra records from a log group. */ @@ -358,7 +362,7 @@ 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 about the latest checkpoint to the groups, and inits the fields in the group memory structs to up-to-date values. */ - +static void recv_synchronize_groups( /*====================*/ @@ -483,6 +487,7 @@ recv_find_max_checkpoint( log_group_read_checkpoint_info(group, field); if (!recv_check_cp_is_consistent(buf)) { +#ifdef UNIV_LOG_DEBUG if (log_debug_writes) { fprintf(stderr, "InnoDB: Checkpoint in group %lu at %lu invalid, %lu\n", @@ -492,6 +497,7 @@ recv_find_max_checkpoint( + LOG_CHECKPOINT_CHECKSUM_1)); } +#endif /* UNIV_LOG_DEBUG */ goto not_consistent; } @@ -505,12 +511,14 @@ recv_find_max_checkpoint( checkpoint_no = mach_read_from_8(buf + LOG_CHECKPOINT_NO); +#ifdef UNIV_LOG_DEBUG if (log_debug_writes) { fprintf(stderr, "InnoDB: Checkpoint number %lu found in group %lu\n", (ulong) ut_dulint_get_low(checkpoint_no), (ulong) group->id); } +#endif /* UNIV_LOG_DEBUG */ if (ut_dulint_cmp(checkpoint_no, max_no) >= 0) { *max_group = group; @@ -1076,7 +1084,9 @@ recv_recover_page( &mtr); ut_a(success); +#ifdef UNIV_SYNC_DEBUG buf_page_dbg_add_level(page, SYNC_NO_ORDER_CHECK); +#endif /* UNIV_SYNC_DEBUG */ } /* Read the newest modification lsn from the page */ @@ -1141,6 +1151,7 @@ recv_recover_page( start_lsn = recv->start_lsn; } +#ifdef UNIV_LOG_DEBUG if (log_debug_writes) { fprintf(stderr, "InnoDB: Applying log rec type %lu len %lu to space %lu page no %lu\n", @@ -1148,7 +1159,8 @@ recv_recover_page( (ulong) recv_addr->space, (ulong) recv_addr->page_no); } - +#endif /* UNIV_LOG_DEBUG */ + recv_parse_or_apply_log_rec_body(recv->type, buf, buf + recv->len, page, &mtr); mach_write_to_8(page + UNIV_PAGE_SIZE @@ -1278,14 +1290,13 @@ loop: goto loop; } +#ifdef UNIV_SYNC_DEBUG + ut_ad(!allow_ibuf == mutex_own(&log_sys->mutex)); +#endif /* UNIV_SYNC_DEBUG */ if (!allow_ibuf) { - ut_ad(mutex_own(&(log_sys->mutex))); - recv_no_ibuf_operations = TRUE; - } else { - ut_ad(!mutex_own(&(log_sys->mutex))); } - + recv_sys->apply_log_recs = TRUE; recv_sys->apply_batch_on = TRUE; @@ -1315,8 +1326,10 @@ loop: page = buf_page_get(space, page_no, RW_X_LATCH, &mtr); +#ifdef UNIV_SYNC_DEBUG buf_page_dbg_add_level(page, SYNC_NO_ORDER_CHECK); +#endif /* UNIV_SYNC_DEBUG */ recv_recover_page(FALSE, FALSE, page, space, page_no); mtr_commit(&mtr); @@ -1539,7 +1552,9 @@ recv_update_replicate( replica = buf_page_get(space + RECV_REPLICA_SPACE_ADD, page_no, RW_X_LATCH, &mtr); +#ifdef UNIV_SYNC_DEBUG buf_page_dbg_add_level(replica, SYNC_NO_ORDER_CHECK); +#endif /* UNIV_SYNC_DEBUG */ ptr = recv_parse_or_apply_log_rec_body(type, body, end_ptr, replica, &mtr); @@ -1608,7 +1623,9 @@ recv_compare_replicate( replica = buf_page_get(space + RECV_REPLICA_SPACE_ADD, page_no, RW_X_LATCH, &mtr); +#ifdef UNIV_SYNC_DEBUG buf_page_dbg_add_level(replica, SYNC_NO_ORDER_CHECK); +#endif /* UNIV_SYNC_DEBUG */ recv_check_identical(page + FIL_PAGE_DATA, replica + FIL_PAGE_DATA, @@ -1649,7 +1666,9 @@ recv_compare_spaces( IB__FILE__, __LINE__, &mtr); if (frame) { +#ifdef UNIV_SYNC_DEBUG buf_page_dbg_add_level(frame, SYNC_NO_ORDER_CHECK); +#endif /* UNIV_SYNC_DEBUG */ ut_memcpy(page, frame, UNIV_PAGE_SIZE); } else { /* Read it from file */ @@ -1662,7 +1681,9 @@ recv_compare_spaces( IB__FILE__, __LINE__, &mtr); if (frame) { +#ifdef UNIV_SYNC_DEBUG buf_page_dbg_add_level(frame, SYNC_NO_ORDER_CHECK); +#endif /* UNIV_SYNC_DEBUG */ ut_memcpy(replica, frame, UNIV_PAGE_SIZE); } else { /* Read it from file */ @@ -1803,10 +1824,11 @@ recv_calc_lsn_on_data_add( return(ut_dulint_add(lsn, lsn_len)); } +#ifdef UNIV_LOG_DEBUG /*********************************************************** Checks that the parser recognizes incomplete initial segments of a log record as incomplete. */ - +static void recv_check_incomplete_log_recs( /*===========================*/ @@ -1824,6 +1846,7 @@ recv_check_incomplete_log_recs( &page_no, &body)); } } +#endif /* UNIV_LOG_DEBUG */ /*********************************************************** Prints diagnostic info of corrupt log. */ @@ -1912,7 +1935,9 @@ recv_parse_log_recs( byte* body; ulint n_recs; +#ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(log_sys->mutex))); +#endif /* UNIV_SYNC_DEBUG */ ut_ad(!ut_dulint_is_zero(recv_sys->parse_start_lsn)); loop: ptr = recv_sys->buf + recv_sys->recovered_offset; @@ -1965,12 +1990,14 @@ loop: recv_sys->recovered_offset += len; recv_sys->recovered_lsn = new_recovered_lsn; +#ifdef UNIV_LOG_DEBUG if (log_debug_writes) { fprintf(stderr, "InnoDB: Parsed a single log rec type %lu len %lu space %lu page no %lu\n", (ulong) type, (ulong) len, (ulong) space, (ulong) page_no); } +#endif /* UNIV_LOG_DEBUG */ if (type == MLOG_DUMMY_RECORD) { /* Do nothing */ @@ -2052,13 +2079,15 @@ loop: */ } +#ifdef UNIV_LOG_DEBUG if (log_debug_writes) { fprintf(stderr, "InnoDB: Parsed a multi log rec type %lu len %lu space %lu page no %lu\n", (ulong) type, (ulong) len, (ulong) space, (ulong) page_no); } - +#endif /* UNIV_LOG_DEBUG */ + total_len += len; n_recs++; @@ -2463,6 +2492,7 @@ recv_group_scan_log_recs( start_lsn = end_lsn; } +#ifdef UNIV_LOG_DEBUG if (log_debug_writes) { fprintf(stderr, "InnoDB: Scanned group %lu up to log sequence number %lu %lu\n", @@ -2470,6 +2500,7 @@ recv_group_scan_log_recs( (ulong) ut_dulint_get_high(*group_scanned_lsn), (ulong) ut_dulint_get_low(*group_scanned_lsn)); } +#endif /* UNIV_LOG_DEBUG */ } /************************************************************ @@ -2850,10 +2881,12 @@ recv_recovery_from_checkpoint_finish(void) recv_apply_hashed_log_recs(TRUE); } +#ifdef UNIV_LOG_DEBUG if (log_debug_writes) { fprintf(stderr, "InnoDB: Log records applied to the database\n"); } +#endif /* UNIV_LOG_DEBUG */ if (recv_needed_recovery) { trx_sys_print_mysql_master_log_pos(); @@ -2895,8 +2928,9 @@ recv_reset_logs( { log_group_t* group; +#ifdef UNIV_SYNC_DEBUG ut_ad(mutex_own(&(log_sys->mutex))); - +#endif /* UNIV_SYNC_DEBUG */ log_sys->lsn = ut_dulint_align_up(lsn, OS_FILE_LOG_BLOCK_SIZE); group = UT_LIST_GET_FIRST(log_sys->log_groups); @@ -3164,6 +3198,7 @@ ask_again: break; } +#ifdef UNIV_LOG_DEBUG if (log_debug_writes) { fprintf(stderr, "InnoDB: Archive read starting at lsn %lu %lu, len %lu from file %s\n", @@ -3171,6 +3206,7 @@ ask_again: (ulong) ut_dulint_get_low(start_lsn), (ulong) len, name); } +#endif /* UNIV_LOG_DEBUG */ fil_io(OS_FILE_READ | OS_FILE_LOG, TRUE, group->archive_space_id, read_offset / UNIV_PAGE_SIZE, |