Commit c3a881a6 authored by heikki@donna.mysql.fi's avatar heikki@donna.mysql.fi

log0recv.c:

  Add warnings to recovery in some cases where log file might be corrupt and consequently recovery can be trusted less than normally
parent 7b672bc9
...@@ -564,8 +564,15 @@ recv_parse_or_apply_log_rec_body( ...@@ -564,8 +564,15 @@ recv_parse_or_apply_log_rec_body(
} else if (type <= MLOG_WRITE_STRING) { } else if (type <= MLOG_WRITE_STRING) {
new_ptr = mlog_parse_string(ptr, end_ptr, page); new_ptr = mlog_parse_string(ptr, end_ptr, page);
} else { } else {
new_ptr = NULL; /* Eliminate compiler warning */ new_ptr = NULL;
ut_error;
fprintf(stderr,
"InnoDB: WARNING: the log file may have been corrupt and it\n"
"InnoDB: is possible that the log scan did not proceed\n"
"InnoDB: far enough in recovery. Please run CHECK TABLE\n"
"InnoDB: on your InnoDB tables to check that they are ok!\n"
"InnoDB: Corrupt log record type %lu\n",
(ulint)type);
} }
ut_ad(!page || new_ptr); ut_ad(!page || new_ptr);
...@@ -1316,9 +1323,29 @@ recv_parse_log_rec( ...@@ -1316,9 +1323,29 @@ recv_parse_log_rec(
new_ptr = mlog_parse_initial_log_record(ptr, end_ptr, type, space, new_ptr = mlog_parse_initial_log_record(ptr, end_ptr, type, space,
page_no); page_no);
/* If the operating system writes to the log complete 512-byte
blocks, we should not get the warnings below in recovery.
A warning means that the header and the trailer appeared ok
in a 512-byte block, but in the middle there was something wrong.
TODO: (1) add similar warnings in the case there is an incompletely
written log record which does not extend to the boundary of a
512-byte block. (2) Add a checksum to a log block. */
if (!new_ptr) {
return(0);
}
/* Check that space id and page_no are sensible */ /* Check that space id and page_no are sensible */
if (!new_ptr || *space != 0 || *page_no > 0x8FFFFFFF) { if (*space != 0 || *page_no > 0x8FFFFFFF) {
fprintf(stderr,
"InnoDB: WARNING: the log file may have been corrupt and it\n"
"InnoDB: is possible that the log scan did not proceed\n"
"InnoDB: far enough in recovery. Please run CHECK TABLE\n"
"InnoDB: on your InnoDB tables to check that they are ok!\n"
"InnoDB: Corrupt log record type %lu, space id %lu, page no %lu\n",
(ulint)(*type), *space, *page_no);
return(0); return(0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment