Commit 1918bdf3 authored by Eugene Kosov's avatar Eugene Kosov

MDEV-25361 innochecksum must not report errors for freed pages

Store and maintain xdes pages always. And doesn't verify checksums for
freed pages.

innochecksum can work only with the first space file of multiple ones.
Tell about it and abort in case of not the first file.
parent 5f8651ac
...@@ -817,6 +817,16 @@ write_file( ...@@ -817,6 +817,16 @@ write_file(
return(true); return(true);
} }
// checks using current xdes page whether the page is free
static bool page_is_free(const byte *xdes, page_size_t page_size,
size_t page_no)
{
const byte *des=
xdes + XDES_ARR_OFFSET +
XDES_SIZE * ((page_no & (page_size.physical() - 1)) / FSP_EXTENT_SIZE);
return xdes_get_bit(des, XDES_FREE_BIT, page_no % FSP_EXTENT_SIZE);
}
/* /*
Parse the page and collect/dump the information about page type Parse the page and collect/dump the information about page type
@param [in] page buffer page @param [in] page buffer page
...@@ -908,11 +918,7 @@ parse_page( ...@@ -908,11 +918,7 @@ parse_page(
std::map<unsigned long long, per_index_stats>::iterator it; std::map<unsigned long long, per_index_stats>::iterator it;
it = index_ids.find(id); it = index_ids.find(id);
per_index_stats &index = (it->second); per_index_stats &index = (it->second);
const byte* des = xdes + XDES_ARR_OFFSET if (page_is_free(xdes, page_size, page_no)) {
+ XDES_SIZE * ((page_no & (page_size.physical() - 1))
/ FSP_EXTENT_SIZE);
if (xdes_get_bit(des, XDES_FREE_BIT,
page_no % FSP_EXTENT_SIZE)) {
index.free_pages++; index.free_pages++;
return; return;
} }
...@@ -1072,7 +1078,6 @@ parse_page( ...@@ -1072,7 +1078,6 @@ parse_page(
case FIL_PAGE_TYPE_FSP_HDR: case FIL_PAGE_TYPE_FSP_HDR:
page_type.n_fil_page_type_fsp_hdr++; page_type.n_fil_page_type_fsp_hdr++;
memcpy(xdes, page, page_size.physical());
if (page_type_dump) { if (page_type_dump) {
fprintf(file, "#::%llu\t\t|\t\tFile Space " fprintf(file, "#::%llu\t\t|\t\tFile Space "
"Header\t\t|\t%s\n", cur_page_num, str); "Header\t\t|\t%s\n", cur_page_num, str);
...@@ -1081,7 +1086,6 @@ parse_page( ...@@ -1081,7 +1086,6 @@ parse_page(
case FIL_PAGE_TYPE_XDES: case FIL_PAGE_TYPE_XDES:
page_type.n_fil_page_type_xdes++; page_type.n_fil_page_type_xdes++;
memcpy(xdes, page, page_size.physical());
if (page_type_dump) { if (page_type_dump) {
fprintf(file, "#::%llu\t\t|\t\tExtent descriptor " fprintf(file, "#::%llu\t\t|\t\tExtent descriptor "
"page\t\t|\t%s\n", cur_page_num, str); "page\t\t|\t%s\n", cur_page_num, str);
...@@ -1814,6 +1818,8 @@ int main( ...@@ -1814,6 +1818,8 @@ int main(
printf("page %llu ", cur_page_num); printf("page %llu ", cur_page_num);
} }
memcpy(xdes, buf, physical_page_size);
if (page_type_summary || page_type_dump) { if (page_type_summary || page_type_dump) {
parse_page(buf, xdes, fil_page_type, page_size, is_encrypted); parse_page(buf, xdes, fil_page_type, page_size, is_encrypted);
} }
...@@ -1992,6 +1998,7 @@ int main( ...@@ -1992,6 +1998,7 @@ int main(
/* If no-check is enabled, skip the /* If no-check is enabled, skip the
checksum verification.*/ checksum verification.*/
if (!no_check if (!no_check
&& !page_is_free(xdes, page_size, cur_page_num)
&& !skip_page && !skip_page
&& (exit_status = verify_checksum( && (exit_status = verify_checksum(
buf, page_size, buf, page_size,
...@@ -2014,6 +2021,10 @@ int main( ...@@ -2014,6 +2021,10 @@ int main(
printf("page %llu ", cur_page_num); printf("page %llu ", cur_page_num);
} }
if (page_get_page_no(buf) % physical_page_size == 0) {
memcpy(xdes, buf, physical_page_size);
}
if (page_type_summary || page_type_dump) { if (page_type_summary || page_type_dump) {
parse_page(buf, xdes, fil_page_type, page_size, is_encrypted); parse_page(buf, xdes, fil_page_type, page_size, is_encrypted);
} }
......
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