summaryrefslogtreecommitdiff
path: root/extra/innochecksum.cc
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2017-03-30 12:48:42 +0200
committerSergei Golubchik <serg@mariadb.org>2017-03-30 12:48:42 +0200
commitda4d71d10d23c1ac2d10b72baee14991ccb7a146 (patch)
tree7cdf3a8c8e72ca7c1c8105427c04123f025bd870 /extra/innochecksum.cc
parent9ec85009985d644ce7ae797bc3572d0ad0f69bb0 (diff)
parenta00517ac9707ffd51c092f5af5d198c5ee789bb4 (diff)
downloadmariadb-git-da4d71d10d23c1ac2d10b72baee14991ccb7a146.tar.gz
Merge branch '10.1' into 10.2
Diffstat (limited to 'extra/innochecksum.cc')
-rw-r--r--extra/innochecksum.cc32
1 files changed, 11 insertions, 21 deletions
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc
index 819b05364f8..fa50ca72867 100644
--- a/extra/innochecksum.cc
+++ b/extra/innochecksum.cc
@@ -51,6 +51,7 @@ The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */
#include "fut0lst.h" /* FLST_NODE_SIZE */
#include "buf0checksum.h" /* buf_calc_page_*() */
#include "fil0fil.h" /* FIL_* */
+#include "fil0crypt.h"
#include "os0file.h"
#include "fsp0fsp.h" /* fsp_flags_get_page_size() &
fsp_flags_get_zip_size() */
@@ -64,24 +65,6 @@ The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */
#define PRIuMAX "llu"
#endif
-/*********************************************************************
-Verify checksum for a page (iff it's encrypted)
-NOTE: currently this function can only be run in single threaded mode
-as it modifies srv_checksum_algorithm (temporarily)
-@param[in] src_fame page to verify
-@param[in] page_size page_size
-@param[in] page_no page number of given read_buf
-@param[in] strict_check true if strict-check option is enabled
-@return true if page is encrypted AND OK, false otherwise */
-UNIV_INTERN
-bool
-fil_space_verify_crypt_checksum(
-/*============================*/
- const byte* src_frame, /*!< in: page the verify */
- const page_size_t& page_size /*!< in: page size */
- ,uintmax_t page_no,
- bool strict_check);
-
/* Global variables */
static bool verbose;
static bool just_count;
@@ -576,6 +559,9 @@ is_page_corrupted(
}
}
+ /* FIXME: Read the page number from the tablespace header,
+ and check that every page carries the same page number. */
+
/* If page is encrypted, use different checksum calculation
as innochecksum can't decrypt pages. Note that some old InnoDB
versions did not initialize FIL_PAGE_FILE_FLUSH_LSN field
@@ -583,15 +569,19 @@ is_page_corrupted(
normal method.
*/
if (mach_read_from_4(buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) != 0) {
- is_corrupted = fil_space_verify_crypt_checksum(buf, page_size,
- cur_page_num, strict_verify);
+ 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);
} else {
is_corrupted = true;
}
if (is_corrupted) {
is_corrupted = buf_page_is_corrupted(
- true, buf, page_size, false,
+ true, buf, page_size, NULL,
cur_page_num, strict_verify,
is_log_enabled, log_file);
}