[MDEV-12022] InnoDB wrongly ignores the end of an .ibd file Created: 2017-02-08  Updated: 2017-02-08  Resolved: 2017-02-08

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.1.21
Fix Version/s: 10.1.22

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates MDEV-11792 InnoDB: Error: trying to access page ... Closed
Relates
relates to MDEV-11556 InnoDB redo log apply fails to adjust... Closed

 Description   

The test innodb.innodb-64k-crash is crashing in recovery due to a wrongly reported out-of-bounds page access:

2017-02-08 10:45:40 140342763513024 [Note] InnoDB: Waiting for purge to start
InnoDB: Error: trying to access page number 2 in space 5,
InnoDB: space name test/t2,
InnoDB: which is outside the tablespace bounds.

The tablespace file in question has FSP_SIZE=21 which corresponds to the file size 21*16384 pages. The error message above is misleading, because it is not really about accessing page 2, but accessing page space->size+2. The issue is that InnoDB wrongly truncated the space->size to 16. The fix is to remove that bogus truncation:

diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 97e70645636..949907af597 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -692,11 +692,6 @@ fil_node_open_file(
 			return(false);
 		}
 
-		if (size_bytes >= (1024*1024)) {
-			/* Truncate the size to whole extent size. */
-			size_bytes = ut_2pow_round(size_bytes, (1024*1024));
-		}
-
 		if (!fsp_flags_is_compressed(flags)) {
 			node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
 		} else {



 Comments   
Comment by Marko Mäkelä [ 2017-02-08 ]

Note: In MySQL 5.7 (which was the first MySQL version to support innodb_page_size=32k or innodb_page_size=64k, in WL#5757) the extent size is 2 MiB for innodb_page_size=32k and 4 MiB for innodb_page_size=64k. See for example dict_table_extent_size() and the macro definition:

#define FSP_EXTENT_SIZE         ((UNIV_PAGE_SIZE <= (16384) ?	\
				(1048576 / UNIV_PAGE_SIZE) :	\
				((UNIV_PAGE_SIZE <= (32768)) ?	\
				(2097152 / UNIV_PAGE_SIZE) :	\
				(4194304 / UNIV_PAGE_SIZE))))

That said, I do not see any point in ignoring the end of the file when opening a file. MDEV-11556 already made file size extension crash-safe.

Comment by Jan Lindström (Inactive) [ 2017-02-08 ]

ok to push.

Generated at Thu Feb 08 07:54:30 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.