diff options
Diffstat (limited to 'extra/innochecksum.cc')
-rw-r--r-- | extra/innochecksum.cc | 78 |
1 files changed, 24 insertions, 54 deletions
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index 3eea1244429..1af2d6e54a4 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2014, 2019, MariaDB Corporation. + Copyright (c) 2014, 2021, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -94,9 +94,10 @@ static my_bool do_leaf; static my_bool per_page_details; static ulint n_merge; extern ulong srv_checksum_algorithm; -static ulong physical_page_size; /* Page size in bytes on disk. */ -static ulong logical_page_size; /* Page size when uncompressed. */ +static ulint physical_page_size; /* Page size in bytes on disk. */ +static ulint logical_page_size; /* Page size when uncompressed. */ ulong srv_page_size; +ulong srv_page_size_shift; page_size_t univ_page_size(0, 0, false); /* Current page number (0 based). */ unsigned long long cur_page_num; @@ -137,13 +138,10 @@ static ulong write_check; struct innodb_page_type { int n_undo_state_active; int n_undo_state_cached; - int n_undo_state_to_free; int n_undo_state_to_purge; int n_undo_state_prepared; int n_undo_state_other; - int n_undo_insert; - int n_undo_update; - int n_undo_other; + int n_undo; int n_fil_page_index; int n_fil_page_undo_log; int n_fil_page_inode; @@ -309,16 +307,16 @@ const page_size_t get_page_size( byte* buf) { - const ulint flags = mach_read_from_4(buf + FIL_PAGE_DATA + const unsigned flags = mach_read_from_4(buf + FIL_PAGE_DATA + FSP_SPACE_FLAGS); - const ulint ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags); + const ulong ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags); - if (ssize == 0) { - srv_page_size = UNIV_PAGE_SIZE_ORIG; - } else { - srv_page_size = ((UNIV_ZIP_SIZE_MIN >> 1) << ssize); - } + srv_page_size_shift = ssize + ? UNIV_ZIP_SIZE_SHIFT_MIN - 1 + ssize + : UNIV_PAGE_SIZE_SHIFT_ORIG; + + srv_page_size = 1U << srv_page_size_shift; univ_page_size.copy_from( page_size_t(srv_page_size, srv_page_size, false)); @@ -348,7 +346,7 @@ error_message( /***********************************************//* @param>>_______[in] name>_____name of file. - @retval file pointer; file pointer is NULL when error occured. + @retval file pointer; file pointer is NULL when error occurred. */ FILE* @@ -432,13 +430,13 @@ open_file( tablespace. @retval no. of bytes read. */ -ulong read_file( +ulint read_file( byte* buf, bool partial_page_read, - ulong physical_page_size, + ulint physical_page_size, FILE* fil_in) { - ulong bytes = 0; + ulint bytes = 0; DBUG_ASSERT(physical_page_size >= UNIV_ZIP_SIZE_MIN); @@ -448,7 +446,7 @@ ulong read_file( bytes = UNIV_ZIP_SIZE_MIN; } - bytes += ulong(fread(buf, 1, physical_page_size, fil_in)); + bytes += ulint(fread(buf, 1, physical_page_size, fil_in)); return bytes; } @@ -819,7 +817,7 @@ write_file( // 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) + ulonglong page_no) { const byte *des= xdes + XDES_ARR_OFFSET + @@ -852,7 +850,7 @@ parse_page( ulint right_page_no; ulint data_bytes; bool is_leaf; - int size_range_id; + ulint size_range_id; /* Check whether page is doublewrite buffer. */ if(skip_page) { @@ -955,21 +953,7 @@ parse_page( fprintf(file, "#::%llu\t\t|\t\tUndo log page\t\t\t|", cur_page_num); } - if (undo_page_type == TRX_UNDO_INSERT) { - page_type.n_undo_insert++; - if (page_type_dump) { - fprintf(file, "\t%s", - "Insert Undo log page"); - } - - } else if (undo_page_type == TRX_UNDO_UPDATE) { - page_type.n_undo_update++; - if (page_type_dump) { - fprintf(file, "\t%s", - "Update undo log page"); - } - } - + page_type.n_undo++; undo_page_type = mach_read_from_2(page + TRX_UNDO_SEG_HDR + TRX_UNDO_STATE); switch (undo_page_type) { @@ -989,14 +973,6 @@ parse_page( } break; - case TRX_UNDO_TO_FREE: - page_type.n_undo_state_to_free++; - if (page_type_dump) { - fprintf(file, ", %s", "Insert undo " - "segment that can be freed"); - } - break; - case TRX_UNDO_TO_PURGE: page_type.n_undo_state_to_purge++; if (page_type_dump) { @@ -1134,7 +1110,7 @@ parse_page( /** @param [in/out] file_name name of the filename -@retval FILE pointer if successfully created else NULL when error occured. +@retval FILE pointer if successfully created else NULL when error occurred. */ FILE* create_file( @@ -1218,15 +1194,11 @@ print_summary( fprintf(fil_out, "\n===============================================\n"); fprintf(fil_out, "Additional information:\n"); - fprintf(fil_out, "Undo page type: %d insert, %d update, %d other\n", - page_type.n_undo_insert, - page_type.n_undo_update, - page_type.n_undo_other); - fprintf(fil_out, "Undo page state: %d active, %d cached, %d to_free, %d" + fprintf(fil_out, "Undo page type: %d\n", page_type.n_undo); + fprintf(fil_out, "Undo page state: %d active, %d cached, %d" " to_purge, %d prepared, %d other\n", page_type.n_undo_state_active, page_type.n_undo_state_cached, - page_type.n_undo_state_to_free, page_type.n_undo_state_to_purge, page_type.n_undo_state_prepared, page_type.n_undo_state_other); @@ -1747,15 +1719,13 @@ int main( ulint zip_size = page_size.is_compressed() ? page_size.logical() : 0; logical_page_size = page_size.is_compressed() ? zip_size : 0; physical_page_size = page_size.physical(); - srv_page_size = page_size.logical(); bool is_compressed = FSP_FLAGS_HAS_PAGE_COMPRESSION(flags); if (physical_page_size == UNIV_ZIP_SIZE_MIN) { partial_page_read = false; } else { /* Read rest of the page 0 to determine crypt_data */ - bytes = ulong(read_file(buf, partial_page_read, page_size.physical(), fil_in)); - + bytes = read_file(buf, partial_page_read, page_size.physical(), fil_in); if (bytes != page_size.physical()) { fprintf(stderr, "Error: Was not able to read the " "rest of the page "); |