summaryrefslogtreecommitdiff
path: root/storage/xtradb/fsp/fsp0fsp.cc
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2017-05-30 11:55:11 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2017-06-01 14:07:48 +0300
commit112b21da37dad0fbb28bc65f9ab5a3ba6c0c2186 (patch)
tree334069e2859580b2f768087143dce654a162f1b8 /storage/xtradb/fsp/fsp0fsp.cc
parent6b6987154a23a8eba72fd58cbff915ae6d17189f (diff)
downloadmariadb-git-112b21da37dad0fbb28bc65f9ab5a3ba6c0c2186.tar.gz
MDEV-12600: crash during install_db with innodb_page_size=32K and ibdata1=3M;bb-10.1-MDEV-12113
Problem was that all doublewrite buffer pages must fit to first system datafile. Ported commit 27a34df7882b1f8ed283f22bf83e8bfc523cbfde Author: Shaohua Wang <shaohua.wang@oracle.com> Date: Wed Aug 12 15:55:19 2015 +0800 BUG#21551464 - SEGFAULT WHILE INITIALIZING DATABASE WHEN INNODB_DATA_FILE SIZE IS SMALL To 10.1 (with extended error printout). btr_create(): If ibuf header page allocation fails report error and return FIL_NULL. Similarly if root page allocation fails return a error. dict_build_table_def_step: If fsp_header_init fails return error code. fsp_header_init: returns true if header initialization succeeds and false if not. fseg_create_general: report error if segment or page allocation fails. innobase_init: If first datafile is smaller than 3M and could not contain all doublewrite buffer pages report error and fail to initialize InnoDB plugin. row_truncate_table_for_mysql: report error if fsp header init fails. srv_init_abort: New function to report database initialization errors. srv_undo_tablespaces_init, innobase_start_or_create_for_mysql: If database initialization fails report error and abort. trx_rseg_create: If segment header creation fails return.
Diffstat (limited to 'storage/xtradb/fsp/fsp0fsp.cc')
-rw-r--r--storage/xtradb/fsp/fsp0fsp.cc37
1 files changed, 27 insertions, 10 deletions
diff --git a/storage/xtradb/fsp/fsp0fsp.cc b/storage/xtradb/fsp/fsp0fsp.cc
index 934824c6462..7929372ae6c 100644
--- a/storage/xtradb/fsp/fsp0fsp.cc
+++ b/storage/xtradb/fsp/fsp0fsp.cc
@@ -673,16 +673,18 @@ fsp_header_init_fields(
}
#ifndef UNIV_HOTBACKUP
-/**********************************************************************//**
-Initializes the space header of a new created space and creates also the
-insert buffer tree root if space == 0. */
+/** Initializes the space header of a new created space and creates also the
+insert buffer tree root if space == 0.
+@param[in] space_id space id
+@param[in] size current size in blocks
+@param[in,out] mtr min-transaction
+@return true on success, otherwise false. */
UNIV_INTERN
-void
+bool
fsp_header_init(
-/*============*/
- ulint space_id, /*!< in: space id */
- ulint size, /*!< in: current size in blocks */
- mtr_t* mtr) /*!< in/out: mini-transaction */
+ ulint space_id,
+ ulint size,
+ mtr_t* mtr)
{
fsp_header_t* header;
buf_block_t* block;
@@ -725,11 +727,15 @@ fsp_header_init(
flst_init(header + FSP_SEG_INODES_FREE, mtr);
mlog_write_ull(header + FSP_SEG_ID, 1, mtr);
+
if (space_id == 0) {
fsp_fill_free_list(FALSE, space_id, header, mtr);
- btr_create(DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF,
+
+ if (btr_create(DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF,
0, 0, DICT_IBUF_ID_MIN + space_id,
- dict_ind_redundant, mtr);
+ dict_ind_redundant, mtr) == FIL_NULL) {
+ return (false);
+ }
} else {
fsp_fill_free_list(TRUE, space_id, header, mtr);
}
@@ -742,6 +748,8 @@ fsp_header_init(
}
fil_space_release(space);
+
+ return (true);
}
#endif /* !UNIV_HOTBACKUP */
@@ -2066,6 +2074,10 @@ fseg_create_general(
success = fsp_reserve_free_extents(&n_reserved, space, 2,
FSP_NORMAL, mtr);
if (!success) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Reserving %d free extents failed"
+ " could reserve only " ULINTPF " extents.",
+ 2, n_reserved);
return(NULL);
}
}
@@ -2075,6 +2087,8 @@ fseg_create_general(
inode = fsp_alloc_seg_inode(space_header, mtr);
if (inode == NULL) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Allocation of a new file segment inode page failed.");
goto funct_exit;
}
@@ -2104,6 +2118,9 @@ fseg_create_general(
inode, 0, FSP_UP, mtr, mtr);
if (block == NULL) {
+ ib_logf(IB_LOG_LEVEL_ERROR,
+ "Allocation of a free page from space " ULINTPF " failed.",
+ space);
fsp_free_seg_inode(space, zip_size, inode, mtr);