[Commits] 670bc0b: Improve validation. If page type is not valid, try to print more

Jan Lindström jan.lindstrom at mariadb.com
Thu Dec 17 09:25:30 EET 2015


revision-id: 670bc0b352187e1b62752b317971c037d783e8db (mariadb-10.1.9-20-g670bc0b)
parent(s): 953d5680a3c050273a8f29253f7386984679f92b
committer: Jan Lindström
timestamp: 2015-12-17 09:24:54 +0200
message:

Improve validation. If page type is not valid, try to print more
information from the page (note that page could be corrupt).

---
 storage/innobase/include/fil0fil.ic | 37 +++++++++++++++++------------------
 storage/xtradb/include/fil0fil.ic   | 39 ++++++++++++++++++-------------------
 2 files changed, 37 insertions(+), 39 deletions(-)

diff --git a/storage/innobase/include/fil0fil.ic b/storage/innobase/include/fil0fil.ic
index 3380065..f929123 100644
--- a/storage/innobase/include/fil0fil.ic
+++ b/storage/innobase/include/fil0fil.ic
@@ -115,25 +115,6 @@ fil_page_type_validate(
 {
 #ifdef UNIV_DEBUG
 	ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE);
-#ifdef UNIV_ENCRYPTION_EXTRA_DEBUG
-	uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
-	bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED);
-	bool page_compressed_encrypted = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
-	ulint space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
-	ulint offset = mach_read_from_4(page + FIL_PAGE_OFFSET);
-	ib_uint64_t lsn = mach_read_from_8(page + FIL_PAGE_LSN);
-	ulint compressed_len = mach_read_from_2(page + FIL_PAGE_DATA);
-	fil_system_enter();
-	fil_space_t* rspace = fil_space_get_by_id(space);
-	fil_system_exit();
-
-	/* Dump out the page info */
-	fprintf(stderr, "InnoDB: Space %lu offset %lu name %s page_type %lu page_type_name %s\n"
-		"InnoDB: key_version %u page_compressed %d lsn %lu compressed_len %lu\n",
-		space, offset, rspace->name, page_type, fil_get_page_type_name(page_type),
-		key_version, page_compressed, lsn, compressed_len);
-	fflush(stderr);
-#endif
 
 	/* Validate page type */
 	if (!((page_type == FIL_PAGE_PAGE_COMPRESSED ||
@@ -152,6 +133,24 @@ fil_page_type_validate(
 		page_type == FIL_PAGE_TYPE_ZBLOB ||
 		page_type == FIL_PAGE_TYPE_COMPRESSED))) {
 
+		uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
+		bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED);
+		bool page_compressed_encrypted = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
+		ulint space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+		ulint offset = mach_read_from_4(page + FIL_PAGE_OFFSET);
+		ib_uint64_t lsn = mach_read_from_8(page + FIL_PAGE_LSN);
+		ulint compressed_len = mach_read_from_2(page + FIL_PAGE_DATA);
+		fil_system_enter();
+		fil_space_t* rspace = fil_space_get_by_id(space);
+		fil_system_exit();
+
+		/* Dump out the page info */
+		fprintf(stderr, "InnoDB: Space %lu offset %lu name %s page_type %lu page_type_name %s\n"
+			"InnoDB: key_version %u page_compressed %d lsn %lu compressed_len %lu\n",
+			space, offset, rspace->name, page_type, fil_get_page_type_name(page_type),
+			key_version, page_compressed, lsn, compressed_len);
+		fflush(stderr);
+
 		ut_ad(page_type == FIL_PAGE_PAGE_COMPRESSED ||
 			page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED ||
 			page_type == FIL_PAGE_INDEX ||
diff --git a/storage/xtradb/include/fil0fil.ic b/storage/xtradb/include/fil0fil.ic
index dca483e..38ed11e 100644
--- a/storage/xtradb/include/fil0fil.ic
+++ b/storage/xtradb/include/fil0fil.ic
@@ -115,26 +115,6 @@ fil_page_type_validate(
 {
 #ifdef UNIV_DEBUG
 	ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE);
-#ifdef UNIV_ENCRYPTION_EXTRA_DEBUG
-	uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
-	bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED);
-	bool page_compressed_encrypted = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
-	ulint space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
-	ulint offset = mach_read_from_4(page + FIL_PAGE_OFFSET);
-	ib_uint64_t lsn = mach_read_from_8(page + FIL_PAGE_LSN);
-	ulint compressed_len = mach_read_from_2(page + FIL_PAGE_DATA);
-	fil_system_enter();
-	fil_space_t* rspace = fil_space_get_by_id(space);
-	fil_system_exit();
-
-
-	/* Dump out the page info */
-	fprintf(stderr, "InnoDB: Space %lu offset %lu name %s page_type %lu page_type_name %s\n"
-		"InnoDB: key_version %u page_compressed %d lsn %lu compressed_len %lu\n",
-		space, offset, rspace->name, page_type, fil_get_page_type_name(page_type),
-		key_version, page_compressed, lsn, compressed_len);
-	fflush(stderr);
-#endif
 
 	/* Validate page type */
 	if (!((page_type == FIL_PAGE_PAGE_COMPRESSED ||
@@ -153,6 +133,25 @@ fil_page_type_validate(
 		page_type == FIL_PAGE_TYPE_ZBLOB ||
 		page_type == FIL_PAGE_TYPE_COMPRESSED))) {
 
+		uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
+		bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED);
+		bool page_compressed_encrypted = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
+		ulint space = mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+		ulint offset = mach_read_from_4(page + FIL_PAGE_OFFSET);
+		ib_uint64_t lsn = mach_read_from_8(page + FIL_PAGE_LSN);
+		ulint compressed_len = mach_read_from_2(page + FIL_PAGE_DATA);
+		fil_system_enter();
+		fil_space_t* rspace = fil_space_get_by_id(space);
+		fil_system_exit();
+
+
+		/* Dump out the page info */
+		fprintf(stderr, "InnoDB: Space %lu offset %lu name %s page_type %lu page_type_name %s\n"
+			"InnoDB: key_version %u page_compressed %d lsn %lu compressed_len %lu\n",
+			space, offset, rspace->name, page_type, fil_get_page_type_name(page_type),
+			key_version, page_compressed, lsn, compressed_len);
+		fflush(stderr);
+
 		ut_ad(page_type == FIL_PAGE_PAGE_COMPRESSED ||
 			page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED ||
 			page_type == FIL_PAGE_INDEX ||


More information about the commits mailing list