InnoDB cleanup: remove a bunch of #ifdef UNIV_INNOCHECKSUM
innochecksum uses global variables. great, let's use them all the way down, instead of passing them as arguments to innodb internals, conditionally modifying function prototypes with #ifdefs
This commit is contained in:
parent
7a29ca2776
commit
0072d2e9a1
@ -571,7 +571,6 @@ is_page_corrupted(
|
||||
if (mach_read_from_4(buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) != 0) {
|
||||
is_corrupted = fil_space_verify_crypt_checksum(
|
||||
const_cast<byte*>(buf), page_size,
|
||||
strict_verify, is_log_enabled ? log_file : NULL,
|
||||
mach_read_from_4(buf
|
||||
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID),
|
||||
cur_page_num);
|
||||
@ -581,9 +580,7 @@ is_page_corrupted(
|
||||
|
||||
if (is_corrupted) {
|
||||
is_corrupted = buf_page_is_corrupted(
|
||||
true, buf, page_size, NULL,
|
||||
cur_page_num, strict_verify,
|
||||
is_log_enabled, log_file);
|
||||
true, buf, page_size, NULL);
|
||||
}
|
||||
|
||||
return(is_corrupted);
|
||||
|
@ -612,10 +612,6 @@ buf_page_is_zeroes(
|
||||
@param[in] read_buf database page
|
||||
@param[in] checksum_field1 new checksum field
|
||||
@param[in] checksum_field2 old checksum field
|
||||
@param[in] page_no page number of given read_buf
|
||||
@param[in] is_log_enabled true if log option is enabled
|
||||
@param[in] log_file file pointer to log_file
|
||||
@param[in] curr_algo current checksum algorithm
|
||||
@param[in] use_legacy_big_endian use legacy big endian algorithm
|
||||
@return true if the page is in crc32 checksum format. */
|
||||
bool
|
||||
@ -623,24 +619,18 @@ buf_page_is_checksum_valid_crc32(
|
||||
const byte* read_buf,
|
||||
ulint checksum_field1,
|
||||
ulint checksum_field2,
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
uintmax_t page_no,
|
||||
bool is_log_enabled,
|
||||
FILE* log_file,
|
||||
const srv_checksum_algorithm_t curr_algo,
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
bool use_legacy_big_endian)
|
||||
{
|
||||
const uint32_t crc32 = buf_calc_page_crc32(read_buf,
|
||||
use_legacy_big_endian);
|
||||
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
if (is_log_enabled
|
||||
&& curr_algo == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
|
||||
if (log_file
|
||||
&& srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
|
||||
fprintf(log_file, "page::%lu;"
|
||||
" crc32 calculated = %u;"
|
||||
" recorded checksum field1 = %lu recorded"
|
||||
" checksum field2 =%lu\n", page_no,
|
||||
" checksum field2 =%lu\n", cur_page_num,
|
||||
crc32, checksum_field1, checksum_field2);
|
||||
}
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
@ -671,23 +661,12 @@ invalid:
|
||||
@param[in] read_buf database page
|
||||
@param[in] checksum_field1 new checksum field
|
||||
@param[in] checksum_field2 old checksum field
|
||||
@param[in] page_no page number of given read_buf
|
||||
@param[in] is_log_enabled true if log option is enabled
|
||||
@param[in] log_file file pointer to log_file
|
||||
@param[in] curr_algo current checksum algorithm
|
||||
@return true if the page is in innodb checksum format. */
|
||||
bool
|
||||
buf_page_is_checksum_valid_innodb(
|
||||
const byte* read_buf,
|
||||
ulint checksum_field1,
|
||||
ulint checksum_field2
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
,uintmax_t page_no,
|
||||
bool is_log_enabled,
|
||||
FILE* log_file,
|
||||
const srv_checksum_algorithm_t curr_algo
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
)
|
||||
ulint checksum_field2)
|
||||
{
|
||||
/* There are 2 valid formulas for
|
||||
checksum_field2 (old checksum field) which algo=innodb could have
|
||||
@ -703,31 +682,31 @@ buf_page_is_checksum_valid_innodb(
|
||||
ulint new_checksum = buf_calc_page_new_checksum(read_buf);
|
||||
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
if (is_log_enabled
|
||||
&& curr_algo == SRV_CHECKSUM_ALGORITHM_INNODB) {
|
||||
if (log_file
|
||||
&& srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_INNODB) {
|
||||
fprintf(log_file, "page::%lu;"
|
||||
" old style: calculated ="
|
||||
" %lu; recorded = %lu\n",
|
||||
page_no, old_checksum,
|
||||
cur_page_num, old_checksum,
|
||||
checksum_field2);
|
||||
fprintf(log_file, "page::%lu;"
|
||||
" new style: calculated ="
|
||||
" %lu; crc32 = %u; recorded = %lu\n",
|
||||
page_no, new_checksum,
|
||||
cur_page_num, new_checksum,
|
||||
buf_calc_page_crc32(read_buf), checksum_field1);
|
||||
}
|
||||
|
||||
if (is_log_enabled
|
||||
&& curr_algo == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
|
||||
if (log_file
|
||||
&& srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
|
||||
fprintf(log_file, "page::%lu;"
|
||||
" old style: calculated ="
|
||||
" %lu; recorded checksum = %lu\n",
|
||||
page_no, old_checksum,
|
||||
cur_page_num, old_checksum,
|
||||
checksum_field2);
|
||||
fprintf(log_file, "page::%lu;"
|
||||
" new style: calculated ="
|
||||
" %lu; recorded checksum = %lu\n",
|
||||
page_no, new_checksum,
|
||||
cur_page_num, new_checksum,
|
||||
checksum_field1);
|
||||
}
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
@ -767,23 +746,12 @@ buf_page_is_checksum_valid_innodb(
|
||||
@param[in] read_buf database page
|
||||
@param[in] checksum_field1 new checksum field
|
||||
@param[in] checksum_field2 old checksum field
|
||||
@param[in] page_no page number of given read_buf
|
||||
@param[in] is_log_enabled true if log option is enabled
|
||||
@param[in] log_file file pointer to log_file
|
||||
@param[in] curr_algo current checksum algorithm
|
||||
@return true if the page is in none checksum format. */
|
||||
bool
|
||||
buf_page_is_checksum_valid_none(
|
||||
const byte* read_buf,
|
||||
ulint checksum_field1,
|
||||
ulint checksum_field2
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
,uintmax_t page_no,
|
||||
bool is_log_enabled,
|
||||
FILE* log_file,
|
||||
const srv_checksum_algorithm_t curr_algo
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
)
|
||||
ulint checksum_field2)
|
||||
{
|
||||
#ifndef DBUG_OFF
|
||||
if (checksum_field1 != checksum_field2
|
||||
@ -799,13 +767,13 @@ buf_page_is_checksum_valid_none(
|
||||
#endif /* DBUG_OFF */
|
||||
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
if (is_log_enabled
|
||||
&& curr_algo == SRV_CHECKSUM_ALGORITHM_STRICT_NONE) {
|
||||
if (log_file
|
||||
&& srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_NONE) {
|
||||
fprintf(log_file,
|
||||
"page::%lu; none checksum: calculated"
|
||||
" = %lu; recorded checksum_field1 = %lu"
|
||||
" recorded checksum_field2 = %lu\n",
|
||||
page_no, BUF_NO_CHECKSUM_MAGIC,
|
||||
cur_page_num, BUF_NO_CHECKSUM_MAGIC,
|
||||
checksum_field1, checksum_field2);
|
||||
}
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
@ -820,10 +788,6 @@ the LSN
|
||||
@param[in] read_buf database page
|
||||
@param[in] page_size page size
|
||||
@param[in] space tablespace
|
||||
@param[in] page_no page number of given read_buf
|
||||
@param[in] strict_check true if strict-check option is enabled
|
||||
@param[in] is_log_enabled true if log option is enabled
|
||||
@param[in] log_file file pointer to log_file
|
||||
@return TRUE if corrupted */
|
||||
bool
|
||||
buf_page_is_corrupted(
|
||||
@ -831,12 +795,6 @@ buf_page_is_corrupted(
|
||||
const byte* read_buf,
|
||||
const page_size_t& page_size,
|
||||
const fil_space_t* space
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
,uintmax_t page_no,
|
||||
bool strict_check,
|
||||
bool is_log_enabled,
|
||||
FILE* log_file
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
)
|
||||
{
|
||||
ulint checksum_field1;
|
||||
@ -926,15 +884,8 @@ buf_page_is_corrupted(
|
||||
}
|
||||
|
||||
if (page_size.is_compressed()) {
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
return(!page_zip_verify_checksum(read_buf,
|
||||
page_size.physical(),
|
||||
page_no, strict_check,
|
||||
is_log_enabled, log_file));
|
||||
#else
|
||||
return(!page_zip_verify_checksum(read_buf,
|
||||
page_size.physical()));
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
}
|
||||
|
||||
checksum_field1 = mach_read_from_4(
|
||||
@ -976,10 +927,10 @@ buf_page_is_corrupted(
|
||||
}
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
if (i >= page_size.logical()) {
|
||||
if (is_log_enabled) {
|
||||
if (log_file) {
|
||||
fprintf(log_file, "Page::%lu"
|
||||
" is empty and uncorrupted\n",
|
||||
page_no);
|
||||
cur_page_num);
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
@ -1005,20 +956,13 @@ buf_page_is_corrupted(
|
||||
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
|
||||
|
||||
if (buf_page_is_checksum_valid_crc32(read_buf,
|
||||
checksum_field1, checksum_field2,
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
page_no, is_log_enabled, log_file, curr_algo,
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
false)) {
|
||||
checksum_field1, checksum_field2, false)) {
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (buf_page_is_checksum_valid_none(read_buf,
|
||||
checksum_field1, checksum_field2
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
, page_no, is_log_enabled, log_file, curr_algo)) {
|
||||
#else /* UNIV_INNOCHECKSUM */
|
||||
)) {
|
||||
checksum_field1, checksum_field2)) {
|
||||
#ifndef UNIV_INNOCHECKSUM
|
||||
if (curr_algo
|
||||
== SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
|
||||
page_warn_strict_checksum(
|
||||
@ -1026,20 +970,20 @@ buf_page_is_corrupted(
|
||||
SRV_CHECKSUM_ALGORITHM_NONE,
|
||||
page_id);
|
||||
}
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
#endif /* !UNIV_INNOCHECKSUM */
|
||||
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
if (is_log_enabled) {
|
||||
if (log_file) {
|
||||
|
||||
fprintf(log_file, "page::%lu;"
|
||||
" old style: calculated = " ULINTPF ";"
|
||||
" recorded = " ULINTPF "\n", page_no,
|
||||
" recorded = " ULINTPF "\n", cur_page_num,
|
||||
buf_calc_page_old_checksum(read_buf),
|
||||
checksum_field2);
|
||||
fprintf(log_file, "page::%lu;"
|
||||
" new style: calculated = " ULINTPF ";"
|
||||
" crc32 = %u; recorded = " ULINTPF "\n",
|
||||
page_no,
|
||||
cur_page_num,
|
||||
buf_calc_page_new_checksum(read_buf),
|
||||
buf_calc_page_crc32(read_buf),
|
||||
checksum_field1);
|
||||
@ -1055,11 +999,7 @@ buf_page_is_corrupted(
|
||||
Otherwise we check innodb checksum first. */
|
||||
if (legacy_big_endian_checksum) {
|
||||
if (buf_page_is_checksum_valid_crc32(read_buf,
|
||||
checksum_field1, checksum_field2,
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
page_no, is_log_enabled, log_file, curr_algo,
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
true)) {
|
||||
checksum_field1, checksum_field2, true)) {
|
||||
|
||||
return(false);
|
||||
}
|
||||
@ -1067,11 +1007,8 @@ buf_page_is_corrupted(
|
||||
}
|
||||
|
||||
if (buf_page_is_checksum_valid_innodb(read_buf,
|
||||
checksum_field1, checksum_field2
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
, page_no, is_log_enabled, log_file, curr_algo)) {
|
||||
#else /* UNIV_INNOCHECKSUM */
|
||||
)) {
|
||||
checksum_field1, checksum_field2)) {
|
||||
#ifndef UNIV_INNOCHECKSUM
|
||||
if (curr_algo
|
||||
== SRV_CHECKSUM_ALGORITHM_STRICT_CRC32) {
|
||||
page_warn_strict_checksum(
|
||||
@ -1079,27 +1016,23 @@ buf_page_is_corrupted(
|
||||
SRV_CHECKSUM_ALGORITHM_INNODB,
|
||||
page_id);
|
||||
}
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
#endif /* !UNIV_INNOCHECKSUM */
|
||||
return(false);
|
||||
}
|
||||
|
||||
/* If legacy checksum is not checked, do it now. */
|
||||
if (!legacy_checksum_checked && buf_page_is_checksum_valid_crc32(
|
||||
read_buf, checksum_field1, checksum_field2,
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
page_no, is_log_enabled, log_file, curr_algo,
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
true)) {
|
||||
read_buf, checksum_field1, checksum_field2, true)) {
|
||||
|
||||
legacy_big_endian_checksum = true;
|
||||
return(false);
|
||||
}
|
||||
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
if (is_log_enabled) {
|
||||
if (log_file) {
|
||||
fprintf(log_file, "Fail; page %lu"
|
||||
" invalid (fails crc32 checksum)\n",
|
||||
page_no);
|
||||
cur_page_num);
|
||||
}
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
return(true);
|
||||
@ -1108,20 +1041,13 @@ buf_page_is_corrupted(
|
||||
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
|
||||
|
||||
if (buf_page_is_checksum_valid_innodb(read_buf,
|
||||
checksum_field1, checksum_field2
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
, page_no, is_log_enabled, log_file, curr_algo
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
)) {
|
||||
checksum_field1, checksum_field2)) {
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (buf_page_is_checksum_valid_none(read_buf,
|
||||
checksum_field1, checksum_field2
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
, page_no, is_log_enabled, log_file, curr_algo)) {
|
||||
#else /* UNIV_INNOCHECKSUM */
|
||||
)) {
|
||||
checksum_field1, checksum_field2)) {
|
||||
#ifndef UNIV_INNOCHECKSUM
|
||||
if (curr_algo
|
||||
== SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
|
||||
page_warn_strict_checksum(
|
||||
@ -1129,19 +1055,19 @@ buf_page_is_corrupted(
|
||||
SRV_CHECKSUM_ALGORITHM_NONE,
|
||||
page_id);
|
||||
}
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
#endif /* !UNIV_INNOCHECKSUM */
|
||||
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
if (is_log_enabled) {
|
||||
if (log_file) {
|
||||
fprintf(log_file, "page::%lu;"
|
||||
" old style: calculated = %lu;"
|
||||
" recorded = %lu\n", page_no,
|
||||
" recorded = %lu\n", cur_page_num,
|
||||
buf_calc_page_old_checksum(read_buf),
|
||||
checksum_field2);
|
||||
fprintf(log_file, "page::%lu;"
|
||||
" new style: calculated = %lu;"
|
||||
" crc32 = %u; recorded = %lu\n",
|
||||
page_no,
|
||||
cur_page_num,
|
||||
buf_calc_page_new_checksum(read_buf),
|
||||
buf_calc_page_crc32(read_buf),
|
||||
checksum_field1);
|
||||
@ -1150,19 +1076,11 @@ buf_page_is_corrupted(
|
||||
return(false);
|
||||
}
|
||||
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
if (buf_page_is_checksum_valid_crc32(read_buf,
|
||||
checksum_field1, checksum_field2,
|
||||
page_no, is_log_enabled, log_file, curr_algo, false)
|
||||
|| buf_page_is_checksum_valid_crc32(read_buf,
|
||||
checksum_field1, checksum_field2,
|
||||
page_no, is_log_enabled, log_file, curr_algo, true)) {
|
||||
#else /* UNIV_INNOCHECKSUM */
|
||||
if (buf_page_is_checksum_valid_crc32(read_buf,
|
||||
checksum_field1, checksum_field2, false)
|
||||
|| buf_page_is_checksum_valid_crc32(read_buf,
|
||||
checksum_field1, checksum_field2, true)) {
|
||||
|
||||
#ifndef UNIV_INNOCHECKSUM
|
||||
if (curr_algo
|
||||
== SRV_CHECKSUM_ALGORITHM_STRICT_INNODB) {
|
||||
page_warn_strict_checksum(
|
||||
@ -1170,16 +1088,16 @@ buf_page_is_corrupted(
|
||||
SRV_CHECKSUM_ALGORITHM_CRC32,
|
||||
page_id);
|
||||
}
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
#endif /* !UNIV_INNOCHECKSUM */
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
if (is_log_enabled) {
|
||||
if (log_file) {
|
||||
fprintf(log_file, "Fail; page %lu"
|
||||
" invalid (fails innodb checksum)\n",
|
||||
page_no);
|
||||
cur_page_num);
|
||||
}
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
return(true);
|
||||
@ -1187,54 +1105,39 @@ buf_page_is_corrupted(
|
||||
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
|
||||
|
||||
if (buf_page_is_checksum_valid_none(read_buf,
|
||||
checksum_field1, checksum_field2
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
, page_no, is_log_enabled, log_file, curr_algo
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
)) {
|
||||
checksum_field1, checksum_field2)) {
|
||||
return(false);
|
||||
}
|
||||
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
if (buf_page_is_checksum_valid_crc32(read_buf,
|
||||
checksum_field1, checksum_field2,
|
||||
page_no, is_log_enabled, log_file, curr_algo, false)
|
||||
|| buf_page_is_checksum_valid_crc32(read_buf,
|
||||
checksum_field1, checksum_field2,
|
||||
page_no, is_log_enabled, log_file, curr_algo, true)) {
|
||||
#else /* UNIV_INNOCHECKSUM */
|
||||
if (buf_page_is_checksum_valid_crc32(read_buf,
|
||||
checksum_field1, checksum_field2, false)
|
||||
|| buf_page_is_checksum_valid_crc32(read_buf,
|
||||
checksum_field1, checksum_field2, true)) {
|
||||
|
||||
#ifndef UNIV_INNOCHECKSUM
|
||||
page_warn_strict_checksum(
|
||||
curr_algo,
|
||||
SRV_CHECKSUM_ALGORITHM_CRC32,
|
||||
page_id);
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
#endif /* !UNIV_INNOCHECKSUM */
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (buf_page_is_checksum_valid_innodb(read_buf,
|
||||
checksum_field1, checksum_field2
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
, page_no, is_log_enabled, log_file, curr_algo)) {
|
||||
#else /* UNIV_INNOCHECKSUM */
|
||||
)) {
|
||||
checksum_field1, checksum_field2)) {
|
||||
#ifndef UNIV_INNOCHECKSUM
|
||||
page_warn_strict_checksum(
|
||||
curr_algo,
|
||||
SRV_CHECKSUM_ALGORITHM_INNODB,
|
||||
page_id);
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
#endif /* !UNIV_INNOCHECKSUM */
|
||||
return(false);
|
||||
}
|
||||
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
if (is_log_enabled) {
|
||||
if (log_file) {
|
||||
fprintf(log_file, "Fail; page %lu"
|
||||
" invalid (fails none checksum)\n",
|
||||
page_no);
|
||||
cur_page_num);
|
||||
}
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
return(true);
|
||||
|
@ -2492,10 +2492,6 @@ bool
|
||||
fil_space_verify_crypt_checksum(
|
||||
byte* page,
|
||||
const page_size_t& page_size,
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
bool strict_check, /*!< --strict-check */
|
||||
FILE* log_file, /*!< --log */
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
ulint space,
|
||||
ulint offset)
|
||||
{
|
||||
@ -2541,14 +2537,7 @@ fil_space_verify_crypt_checksum(
|
||||
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, checksum);
|
||||
|
||||
bool valid = page_zip_verify_checksum(page,
|
||||
page_size.physical()
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
, offset,
|
||||
strict_check,
|
||||
log_file != NULL,
|
||||
log_file
|
||||
#endif
|
||||
);
|
||||
page_size.physical());
|
||||
|
||||
mach_write_to_4(page + FIL_PAGE_SPACE_OR_CHKSUM, old);
|
||||
|
||||
@ -2594,19 +2583,11 @@ fil_space_verify_crypt_checksum(
|
||||
ulint checksum2 = mach_read_from_4(
|
||||
page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM);
|
||||
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
# define CKARGS page, checksum1, checksum2, \
|
||||
offset, log_file != NULL, log_file, algorithm
|
||||
#else
|
||||
# define CKARGS page, checksum1, checksum2
|
||||
#endif
|
||||
|
||||
bool valid = buf_page_is_checksum_valid_crc32(
|
||||
CKARGS, false
|
||||
page, checksum1, checksum2, false
|
||||
/* FIXME: also try the original crc32 that was
|
||||
buggy on big-endian architectures? */)
|
||||
|| buf_page_is_checksum_valid_innodb(CKARGS);
|
||||
#undef CKARGS
|
||||
|| buf_page_is_checksum_valid_innodb(page, checksum1, checksum2);
|
||||
|
||||
if (encrypted && valid) {
|
||||
/* If page is encrypted and traditional checksums match,
|
||||
|
@ -769,10 +769,6 @@ buf_block_unfix(
|
||||
@param[in] read_buf database page
|
||||
@param[in] checksum_field1 new checksum field
|
||||
@param[in] checksum_field2 old checksum field
|
||||
@param[in] page_no page number of given read_buf
|
||||
@param[in] is_log_enabled true if log option is enabled
|
||||
@param[in] log_file file pointer to log_file
|
||||
@param[in] curr_algo current checksum algorithm
|
||||
@param[in] use_legacy_big_endian use legacy big endian algorithm
|
||||
@return true if the page is in crc32 checksum format. */
|
||||
bool
|
||||
@ -780,12 +776,6 @@ buf_page_is_checksum_valid_crc32(
|
||||
const byte* read_buf,
|
||||
ulint checksum_field1,
|
||||
ulint checksum_field2,
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
uintmax_t page_no,
|
||||
bool is_log_enabled,
|
||||
FILE* log_file,
|
||||
const srv_checksum_algorithm_t curr_algo,
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
bool use_legacy_big_endian)
|
||||
MY_ATTRIBUTE((nonnull(1), warn_unused_result));
|
||||
|
||||
@ -793,46 +783,24 @@ buf_page_is_checksum_valid_crc32(
|
||||
@param[in] read_buf database page
|
||||
@param[in] checksum_field1 new checksum field
|
||||
@param[in] checksum_field2 old checksum field
|
||||
@param[in] page_no page number of given read_buf
|
||||
@param[in] is_log_enabled true if log option is enabled
|
||||
@param[in] log_file file pointer to log_file
|
||||
@param[in] curr_algo current checksum algorithm
|
||||
@return true if the page is in innodb checksum format. */
|
||||
bool
|
||||
buf_page_is_checksum_valid_innodb(
|
||||
const byte* read_buf,
|
||||
ulint checksum_field1,
|
||||
ulint checksum_field2
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
,uintmax_t page_no,
|
||||
bool is_log_enabled,
|
||||
FILE* log_file,
|
||||
const srv_checksum_algorithm_t curr_algo
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
)
|
||||
ulint checksum_field2)
|
||||
MY_ATTRIBUTE((nonnull(1), warn_unused_result));
|
||||
|
||||
/** Checks if the page is in none checksum format.
|
||||
@param[in] read_buf database page
|
||||
@param[in] checksum_field1 new checksum field
|
||||
@param[in] checksum_field2 old checksum field
|
||||
@param[in] page_no page number of given read_buf
|
||||
@param[in] is_log_enabled true if log option is enabled
|
||||
@param[in] log_file file pointer to log_file
|
||||
@param[in] curr_algo current checksum algorithm
|
||||
@return true if the page is in none checksum format. */
|
||||
bool
|
||||
buf_page_is_checksum_valid_none(
|
||||
const byte* read_buf,
|
||||
ulint checksum_field1,
|
||||
ulint checksum_field2
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
,uintmax_t page_no,
|
||||
bool is_log_enabled,
|
||||
FILE* log_file,
|
||||
const srv_checksum_algorithm_t curr_algo
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
)
|
||||
ulint checksum_field2)
|
||||
MY_ATTRIBUTE((nonnull(1), warn_unused_result));
|
||||
|
||||
/** Checks if a page contains only zeroes.
|
||||
@ -850,10 +818,6 @@ the LSN
|
||||
@param[in] read_buf database page
|
||||
@param[in] page_size page size
|
||||
@param[in] space tablespace
|
||||
@param[in] page_no page number of given read_buf
|
||||
@param[in] strict_check true if strict-check option is enabled
|
||||
@param[in] is_log_enabled true if log option is enabled
|
||||
@param[in] log_file file pointer to log_file
|
||||
@return whether the page is corrupted */
|
||||
bool
|
||||
buf_page_is_corrupted(
|
||||
@ -861,12 +825,6 @@ buf_page_is_corrupted(
|
||||
const byte* read_buf,
|
||||
const page_size_t& page_size,
|
||||
const fil_space_t* space = NULL
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
,uintmax_t page_no = 0,
|
||||
bool strict_check = false,
|
||||
bool is_log_enabled = false,
|
||||
FILE* log_file = NULL
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
) MY_ATTRIBUTE((warn_unused_result));
|
||||
#ifndef UNIV_INNOCHECKSUM
|
||||
/**********************************************************************//**
|
||||
|
@ -492,10 +492,6 @@ bool
|
||||
fil_space_verify_crypt_checksum(
|
||||
byte* page,
|
||||
const page_size_t& page_size,
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
bool strict_check, /*!< --strict-check */
|
||||
FILE* log_file, /*!< --log */
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
ulint space,
|
||||
ulint offset)
|
||||
MY_ATTRIBUTE((warn_unused_result));
|
||||
|
@ -512,19 +512,7 @@ ibool
|
||||
page_zip_verify_checksum(
|
||||
/*=====================*/
|
||||
const void* data, /*!< in: compressed page */
|
||||
ulint size /*!< in: size of compressed page */
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
/* these variables are used only for innochecksum tool. */
|
||||
,uintmax_t page_no, /*!< in: page number of
|
||||
given read_buf */
|
||||
bool strict_check, /*!< in: true if strict-check
|
||||
option is enable */
|
||||
bool is_log_enabled, /*!< in: true if log option is
|
||||
enable */
|
||||
FILE* log_file /*!< in: file pointer to
|
||||
log_file */
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
);
|
||||
ulint size); /*!< in: size of compressed page */
|
||||
|
||||
#ifndef UNIV_INNOCHECKSUM
|
||||
/**********************************************************************//**
|
||||
|
@ -108,6 +108,12 @@ support cross-platform development and expose comonly used SQL names. */
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
extern bool strict_verify;
|
||||
extern FILE* log_file;
|
||||
extern uintmax_t cur_page_num;
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
|
||||
#include "my_pthread.h"
|
||||
/* Following defines are to enable performance schema
|
||||
instrumentation in each of five InnoDB modules if
|
||||
|
@ -4973,19 +4973,7 @@ ibool
|
||||
page_zip_verify_checksum(
|
||||
/*=====================*/
|
||||
const void* data, /*!< in: compressed page */
|
||||
ulint size /*!< in: size of compressed page */
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
/* these variables are used only for innochecksum tool. */
|
||||
,uintmax_t page_no, /*!< in: page number of
|
||||
given read_buf */
|
||||
bool strict_check, /*!< in: true if strict-check
|
||||
option is enable */
|
||||
bool is_log_enabled, /*!< in: true if log option is
|
||||
enabled */
|
||||
FILE* log_file /*!< in: file pointer to
|
||||
log_file */
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
)
|
||||
ulint size) /*!< in: size of compressed page */
|
||||
{
|
||||
const unsigned char* p = static_cast<const unsigned char*>(data)
|
||||
+ FIL_PAGE_SPACE_OR_CHKSUM;
|
||||
@ -5023,9 +5011,9 @@ page_zip_verify_checksum(
|
||||
break;
|
||||
}
|
||||
if (i >= size) {
|
||||
if (is_log_enabled) {
|
||||
if (log_file) {
|
||||
fprintf(log_file, "Page::%lu is empty and"
|
||||
" uncorrupted\n", page_no);
|
||||
" uncorrupted\n", cur_page_num);
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
@ -5061,28 +5049,28 @@ page_zip_verify_checksum(
|
||||
const uint32_t calc = page_zip_calc_checksum(data, size, curr_algo);
|
||||
|
||||
#ifdef UNIV_INNOCHECKSUM
|
||||
if (is_log_enabled) {
|
||||
if (log_file) {
|
||||
fprintf(log_file, "page::%lu;"
|
||||
" %s checksum: calculated = %u;"
|
||||
" recorded = %u\n", page_no,
|
||||
" recorded = %u\n", cur_page_num,
|
||||
buf_checksum_algorithm_name(
|
||||
static_cast<srv_checksum_algorithm_t>(
|
||||
srv_checksum_algorithm)),
|
||||
calc, stored);
|
||||
}
|
||||
|
||||
if (!strict_check) {
|
||||
if (!strict_verify) {
|
||||
|
||||
const uint32_t crc32 = page_zip_calc_checksum(
|
||||
data, size, SRV_CHECKSUM_ALGORITHM_CRC32);
|
||||
|
||||
if (is_log_enabled) {
|
||||
if (log_file) {
|
||||
fprintf(log_file, "page::%lu: crc32 checksum:"
|
||||
" calculated = %u; recorded = %u\n",
|
||||
page_no, crc32, stored);
|
||||
cur_page_num, crc32, stored);
|
||||
fprintf(log_file, "page::%lu: none checksum:"
|
||||
" calculated = %lu; recorded = %u\n",
|
||||
page_no, BUF_NO_CHECKSUM_MAGIC, stored);
|
||||
cur_page_num, BUF_NO_CHECKSUM_MAGIC, stored);
|
||||
}
|
||||
}
|
||||
#endif /* UNIV_INNOCHECKSUM */
|
||||
|
Loading…
x
Reference in New Issue
Block a user