diff options
author | Aditya A <aditya.a@oracle.com> | 2013-07-05 14:30:15 +0530 |
---|---|---|
committer | Aditya A <aditya.a@oracle.com> | 2013-07-05 14:30:15 +0530 |
commit | eee10f381a49e524236f038e8ea69eb9cb4cdb21 (patch) | |
tree | 0efdf9db38f0c7a4e2b17d96d3f24738ea44f337 /storage | |
parent | ae59c57758aaebf985dbc181a12d3619c96a6e9d (diff) | |
download | mariadb-git-eee10f381a49e524236f038e8ea69eb9cb4cdb21.tar.gz |
Bug#17033706 SINCE 5.5.32 & 5.6.12, INNODB CANT START WITH OWN
MULTI-FILE TABLESPACE
ANALYSIS
--------
When a tablespace has multiple data files, InnoDB fails to
open the tablespace. This is because for each ibd file,
the first page is checked.But the first page of all ibd file
need not be the first page of the tablespace. Only the first
page of the tablespace contains the tablespace header. When
we check the first page of an ibd file that is not the first
page of the tablespace, then the "tablespace flags" is not
really available.This was wrongly used to check if a page is
corrupt or not.
FIX
---
Use the tablespace flags only if the page number is 0
in a tablespace.
[Approved by Inaam rb#2836 ]
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/fil/fil0fil.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c index 42935447a9b..be7d43c132d 100644 --- a/storage/innobase/fil/fil0fil.c +++ b/storage/innobase/fil/fil0fil.c @@ -1860,7 +1860,7 @@ fil_write_flushed_lsn_to_data_files( } /*******************************************************************//** -Checks the consistency of the first data page of a data file +Checks the consistency of the first data page of a tablespace at database startup. @retval NULL on success, or if innodb_force_recovery is set @return pointer to an error message string */ @@ -1868,9 +1868,7 @@ static __attribute__((warn_unused_result)) const char* fil_check_first_page( /*=================*/ - const page_t* page, /*!< in: data page */ - ibool first_page) /*!< in: TRUE if this is the - first page of the tablespace */ + const page_t* page) /*!< in: data page */ { ulint space_id; ulint flags; @@ -1882,7 +1880,7 @@ fil_check_first_page( space_id = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_ID + page); flags = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page); - if (first_page && !space_id && !flags) { + if (!space_id && !flags) { ulint nonzero_bytes = UNIV_PAGE_SIZE; const byte* b = page; @@ -1900,9 +1898,8 @@ fil_check_first_page( return("checksum mismatch"); } - if (!first_page - || (page_get_space_id(page) == space_id - && page_get_page_no(page) == 0)) { + if (page_get_space_id(page) == space_id + && page_get_page_no(page) == 0) { return(NULL); } @@ -1937,7 +1934,7 @@ fil_read_first_page( byte* buf; page_t* page; ib_uint64_t flushed_lsn; - const char* check_msg; + const char* check_msg = NULL; buf = ut_malloc(2 * UNIV_PAGE_SIZE); /* Align the memory for a possible read from a raw device */ @@ -1949,7 +1946,9 @@ fil_read_first_page( flushed_lsn = mach_read_from_8(page + FIL_PAGE_FILE_FLUSH_LSN); - check_msg = fil_check_first_page(page, !one_read_already); + if (!one_read_already) { + check_msg = fil_check_first_page(page); + } ut_free(buf); @@ -3272,7 +3271,7 @@ fil_open_single_table_tablespace( success = os_file_read(file, page, 0, 0, UNIV_PAGE_SIZE); - check_msg = fil_check_first_page(page, TRUE); + check_msg = fil_check_first_page(page); /* We have to read the tablespace id and flags from the file. */ @@ -3528,7 +3527,7 @@ fil_load_single_table_tablespace( /* We have to read the tablespace id from the file */ - check_msg = fil_check_first_page(page, TRUE); + check_msg = fil_check_first_page(page); if (check_msg) { fprintf(stderr, |