diff options
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/btr/btr0btr.cc | 37 | ||||
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 90 | ||||
-rw-r--r-- | storage/innobase/buf/buf0dblwr.cc | 61 | ||||
-rw-r--r-- | storage/innobase/dict/dict0crea.cc | 7 | ||||
-rw-r--r-- | storage/innobase/fil/fil0crypt.cc | 44 | ||||
-rw-r--r-- | storage/innobase/fil/fil0fil.cc | 25 | ||||
-rw-r--r-- | storage/innobase/fsp/fsp0fsp.cc | 24 | ||||
-rw-r--r-- | storage/innobase/fsp/fsp0sysspace.cc | 11 | ||||
-rw-r--r-- | storage/innobase/include/buf0dblwr.h | 9 | ||||
-rw-r--r-- | storage/innobase/include/fsp0fsp.h | 14 | ||||
-rw-r--r-- | storage/innobase/include/trx0rseg.h | 7 | ||||
-rw-r--r-- | storage/innobase/include/trx0trx.h | 2 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.cc | 2 | ||||
-rw-r--r-- | storage/innobase/srv/srv0start.cc | 19 | ||||
-rw-r--r-- | storage/innobase/trx/trx0rseg.cc | 4 |
15 files changed, 170 insertions, 186 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 3d778c49012..d0fcd68c677 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -1133,9 +1133,7 @@ btr_create( const btr_create_t* btr_redo_create_info, mtr_t* mtr) { - ulint page_no; buf_block_t* block; - buf_frame_t* frame; page_t* page; page_zip_des_t* page_zip; @@ -1170,33 +1168,28 @@ btr_create( + IBUF_HEADER + IBUF_TREE_SEG_HEADER, IBUF_TREE_ROOT_PAGE_NO, FSP_UP, mtr); - ut_ad(block->page.id.page_no() == IBUF_TREE_ROOT_PAGE_NO); - } else { - block = fseg_create(space, 0, - PAGE_HEADER + PAGE_BTR_SEG_TOP, mtr); - } - if (block == NULL) { - - return(FIL_NULL); - } + if (block == NULL) { + return(FIL_NULL); + } - page_no = block->page.id.page_no(); - frame = buf_block_get_frame(block); + ut_ad(block->page.id.page_no() == IBUF_TREE_ROOT_PAGE_NO); - if (type & DICT_IBUF) { - /* It is an insert buffer tree: initialize the free list */ buf_block_dbg_add_level(block, SYNC_IBUF_TREE_NODE_NEW); - ut_ad(page_no == IBUF_TREE_ROOT_PAGE_NO); - - flst_init(frame + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, mtr); + flst_init(block->frame + PAGE_HEADER + PAGE_BTR_IBUF_FREE_LIST, + mtr); } else { - /* It is a non-ibuf tree: create a file segment for leaf - pages */ + block = fseg_create(space, 0, + PAGE_HEADER + PAGE_BTR_SEG_TOP, mtr); + + if (block == NULL) { + return(FIL_NULL); + } + buf_block_dbg_add_level(block, SYNC_TREE_NODE_NEW); - if (!fseg_create(space, page_no, + if (!fseg_create(space, block->page.id.page_no(), PAGE_HEADER + PAGE_BTR_SEG_LEAF, mtr)) { /* Not enough space for new segment, free root segment before return. */ @@ -1287,7 +1280,7 @@ btr_create( ut_ad(page_get_max_insert_size(page, 2) > 2 * BTR_PAGE_MAX_REC_SIZE); - return(page_no); + return(block->page.id.page_no()); } /** Free a B-tree except the root page. The root page MUST be freed after diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 168225c5484..8d6d95a020e 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -3872,14 +3872,25 @@ buf_zip_decompress( { const byte* frame = block->page.zip.data; ulint size = page_zip_get_size(&block->page.zip); + /* The tablespace will not be found if this function is called + during IMPORT. */ + fil_space_t* space = fil_space_acquire_for_io(block->page.id.space()); + const unsigned key_version = mach_read_from_4( + frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); + fil_space_crypt_t* crypt_data = space ? space->crypt_data : NULL; + const bool encrypted = crypt_data + && crypt_data->type != CRYPT_SCHEME_UNENCRYPTED + && (!crypt_data->is_default_encryption() + || srv_encrypt_tables); ut_ad(block->page.size.is_compressed()); ut_a(block->page.id.space() != 0); if (UNIV_UNLIKELY(check && !page_zip_verify_checksum(frame, size))) { - ib::error() << "Compressed page checksum mismatch " - << block->page.id << "): stored: " + ib::error() << "Compressed page checksum mismatch for " + << (space ? space->chain.start->name : "") + << block->page.id << ": stored: " << mach_read_from_4(frame + FIL_PAGE_SPACE_OR_CHKSUM) << ", crc32: " << page_zip_calc_checksum( @@ -3895,7 +3906,7 @@ buf_zip_decompress( << page_zip_calc_checksum( frame, size, SRV_CHECKSUM_ALGORITHM_NONE); - return(FALSE); + goto err_exit; } switch (fil_page_get_type(frame)) { @@ -3903,15 +3914,16 @@ buf_zip_decompress( case FIL_PAGE_RTREE: if (page_zip_decompress(&block->page.zip, block->frame, TRUE)) { + if (space) { + fil_space_release_for_io(space); + } return(TRUE); } - ib::error() << "Unable to decompress space " - << block->page.id.space() - << " page " << block->page.id.page_no(); - - return(FALSE); - + ib::error() << "Unable to decompress " + << (space ? space->chain.start->name : "") + << block->page.id; + goto err_exit; case FIL_PAGE_TYPE_ALLOCATED: case FIL_PAGE_INODE: case FIL_PAGE_IBUF_BITMAP: @@ -3921,11 +3933,31 @@ buf_zip_decompress( case FIL_PAGE_TYPE_ZBLOB2: /* Copy to uncompressed storage. */ memcpy(block->frame, frame, block->page.size.physical()); + if (space) { + fil_space_release_for_io(space); + } + return(TRUE); } ib::error() << "Unknown compressed page type " - << fil_page_get_type(frame); + << fil_page_get_type(frame) + << " in " << (space ? space->chain.start->name : "") + << block->page.id; + +err_exit: + if (encrypted) { + ib::info() << "Row compressed page could be encrypted" + " with key_version " << key_version; + block->page.encrypted = true; + dict_set_encrypted_by_space(block->page.id.space()); + } else { + dict_set_corrupted_by_space(block->page.id.space()); + } + + if (space) { + fil_space_release_for_io(space); + } return(FALSE); } @@ -4526,12 +4558,21 @@ got_block: /* Decompress the page while not holding buf_pool->mutex or block->mutex. */ - /* Page checksum verification is already done when - the page is read from disk. Hence page checksum - verification is not necessary when decompressing the page. */ { - bool success = buf_zip_decompress(block, FALSE); - ut_a(success); + bool success = buf_zip_decompress(block, TRUE); + + if (!success) { + buf_pool_mutex_enter(buf_pool); + buf_page_mutex_enter(fix_block); + buf_block_set_io_fix(fix_block, BUF_IO_NONE); + buf_page_mutex_exit(fix_block); + + --buf_pool->n_pend_unzip; + buf_block_unfix(fix_block); + buf_pool_mutex_exit(buf_pool); + rw_lock_x_unlock(&fix_block->lock); + return NULL; + } } if (!recv_no_ibuf_operations) { @@ -4634,19 +4675,12 @@ got_block: goto loop; } - ib::info() << "innodb_change_buffering_debug evict " - << page_id; - return(NULL); } buf_page_mutex_enter(fix_block); if (buf_flush_page_try(buf_pool, fix_block)) { - - ib::info() << "innodb_change_buffering_debug flush " - << page_id; - guess = fix_block; goto loop; @@ -5563,15 +5597,11 @@ buf_page_create( memset(frame + FIL_PAGE_NEXT, 0xff, 4); mach_write_to_2(frame + FIL_PAGE_TYPE, FIL_PAGE_TYPE_ALLOCATED); - /* These 8 bytes are also repurposed for PageIO compression and must - be reset when the frame is assigned to a new page id. See fil0fil.h. - - - FIL_PAGE_FILE_FLUSH_LSN is used on the following pages: + /* FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION is only used on the + following pages: (1) The first page of the InnoDB system tablespace (page 0:0) - (2) FIL_RTREE_SPLIT_SEQ_NUM on R-tree pages . - - Therefore we don't transparently compress such pages. */ + (2) FIL_RTREE_SPLIT_SEQ_NUM on R-tree pages + (3) key_version on encrypted pages (not page 0:0) */ memset(frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 0, 8); diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 3113424a894..b770e8483d9 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -162,11 +162,11 @@ buf_dblwr_init( ut_zalloc_nokey(buf_size * sizeof(void*))); } -/****************************************************************//** -Creates the doublewrite buffer to a new InnoDB installation. The header of the -doublewrite buffer is placed on the trx system header page. -@return true if successful, false if not. */ -MY_ATTRIBUTE((warn_unused_result)) +/** Create the doublewrite buffer if the doublewrite buffer header +is not present in the TRX_SYS page. +@return whether the operation succeeded +@retval true if the doublewrite buffer exists or was created +@retval false if the creation failed (too small first data file) */ bool buf_dblwr_create() { @@ -181,12 +181,11 @@ buf_dblwr_create() if (buf_dblwr) { /* Already inited */ - return(true); } start_again: - mtr_start(&mtr); + mtr.start(); buf_dblwr_being_created = TRUE; doublewrite = buf_dblwr_get(&mtr); @@ -198,33 +197,49 @@ start_again: buf_dblwr_init(doublewrite); - mtr_commit(&mtr); + mtr.commit(); buf_dblwr_being_created = FALSE; return(true); - } + } else { + fil_space_t* space = fil_space_acquire(TRX_SYS_SPACE); + const bool fail = UT_LIST_GET_FIRST(space->chain)->size + < 3 * FSP_EXTENT_SIZE; + fil_space_release(space); - ib::info() << "Doublewrite buffer not found: creating new"; + if (fail) { + goto too_small; + } + } block2 = fseg_create(TRX_SYS_SPACE, TRX_SYS_PAGE_NO, TRX_SYS_DOUBLEWRITE + TRX_SYS_DOUBLEWRITE_FSEG, &mtr); - /* fseg_create acquires a second latch on the page, - therefore we must declare it: */ - - buf_block_dbg_add_level(block2, SYNC_NO_ORDER_CHECK); - if (block2 == NULL) { - ib::error() << "Cannot create doublewrite buffer: you must" - " increase your tablespace size." - " Cannot continue operation."; - - /* The mini-transaction did not write anything yet; - we merely failed to allocate a page. */ +too_small: + ib::error() + << "Cannot create doublewrite buffer: " + "the first file in innodb_data_file_path" + " must be at least " + << (3 * (FSP_EXTENT_SIZE * UNIV_PAGE_SIZE) >> 20) + << "M."; mtr.commit(); return(false); } + ib::info() << "Doublewrite buffer not found: creating new"; + + /* FIXME: After this point, the doublewrite buffer creation + is not atomic. The doublewrite buffer should not exist in + the InnoDB system tablespace file in the first place. + It could be located in separate optional file(s) in a + user-specified location. */ + + /* fseg_create acquires a second latch on the page, + therefore we must declare it: */ + + buf_block_dbg_add_level(block2, SYNC_NO_ORDER_CHECK); + fseg_header = doublewrite + TRX_SYS_DOUBLEWRITE_FSEG; prev_page_no = 0; @@ -516,6 +531,10 @@ buf_dblwr_process() byte* unaligned_read_buf; recv_dblwr_t& recv_dblwr = recv_sys->dblwr; + if (!buf_dblwr) { + return; + } + unaligned_read_buf = static_cast<byte*>( ut_malloc_nokey(2 * UNIV_PAGE_SIZE)); diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index 1b5b6ff3850..128f661b618 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -460,14 +460,9 @@ dict_build_tablespace_for_table( mtr_start(&mtr); mtr.set_named_space(table->space); - bool ret = fsp_header_init(table->space, - FIL_IBD_FILE_INITIAL_SIZE, - &mtr); + fsp_header_init(table->space, FIL_IBD_FILE_INITIAL_SIZE, &mtr); mtr_commit(&mtr); - if (!ret) { - return(DB_ERROR); - } } else { ut_ad(dict_tf_get_rec_format(table->flags) != REC_FORMAT_COMPRESSED); diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 0026e6e2735..5cfacc5bcd8 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -831,7 +831,7 @@ fil_space_decrypt( Calculate post encryption checksum @param[in] page_size page size @param[in] dst_frame Block where checksum is calculated -@return page checksum or BUF_NO_CHECKSUM_MAGIC +@return page checksum not needed. */ UNIV_INTERN uint32_t @@ -839,34 +839,11 @@ fil_crypt_calculate_checksum( const page_size_t& page_size, const byte* dst_frame) { - uint32_t checksum = 0; - srv_checksum_algorithm_t algorithm = - static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm); - - if (!page_size.is_compressed()) { - switch (algorithm) { - case SRV_CHECKSUM_ALGORITHM_CRC32: - case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32: - checksum = buf_calc_page_crc32(dst_frame); - break; - case SRV_CHECKSUM_ALGORITHM_INNODB: - case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB: - checksum = (ib_uint32_t) buf_calc_page_new_checksum( - dst_frame); - break; - case SRV_CHECKSUM_ALGORITHM_NONE: - case SRV_CHECKSUM_ALGORITHM_STRICT_NONE: - checksum = BUF_NO_CHECKSUM_MAGIC; - break; - /* no default so the compiler will emit a warning - * if new enum is added and not handled here */ - } - } else { - checksum = page_zip_calc_checksum(dst_frame, page_size.physical(), - algorithm); - } - - return checksum; + /* For encrypted tables we use only crc32 and strict_crc32 */ + return page_size.is_compressed() + ? page_zip_calc_checksum(dst_frame, page_size.physical(), + SRV_CHECKSUM_ALGORITHM_CRC32) + : buf_calc_page_crc32(dst_frame); } /***********************************************************************/ @@ -2492,15 +2469,8 @@ fil_space_verify_crypt_checksum( return false; } - srv_checksum_algorithm_t algorithm = - static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm); - /* If no checksum is used, can't continue checking. */ - if (algorithm == SRV_CHECKSUM_ALGORITHM_NONE) { - return(true); - } - /* Read stored post encryption checksum. */ - ib_uint32_t checksum = mach_read_from_4( + uint32_t checksum = mach_read_from_4( page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4); /* Declare empty pages non-corrupted */ diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 966c160f4bd..72358e7628b 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -4282,12 +4282,14 @@ fil_ibd_open( df_default.close(); tablespaces_found--; } + if (df_dict.is_open() && !df_dict.is_valid()) { df_dict.close(); /* Leave dict.filepath so that SYS_DATAFILES can be corrected below. */ tablespaces_found--; } + if (df_remote.is_open() && !df_remote.is_valid()) { df_remote.close(); tablespaces_found--; @@ -5151,23 +5153,16 @@ fil_report_invalid_page_access( ulint len, /*!< in: I/O length */ bool is_read) /*!< in: I/O type */ { - ib::error() - << "Trying to access page number " << block_offset << " in" + ib::fatal() + << "Trying to " << (is_read ? "read" : "write") + << " page number " << block_offset << " in" " space " << space_id << ", space name " << space_name << "," " which is outside the tablespace bounds. Byte offset " - << byte_offset << ", len " << len << ", i/o type " << - (is_read ? "read" : "write") - << ". If you get this error at mysqld startup, please check" - " that your my.cnf matches the ibdata files that you have in" - " the MySQL server."; - - ib::error() << "Server exits" -#ifdef UNIV_DEBUG - << " at " << __FILE__ << "[" << __LINE__ << "]" -#endif - << "."; - - _exit(1); + << byte_offset << ", len " << len << + (space_id == 0 && !srv_was_started + ? "Please check that the configuration matches" + " the InnoDB system tablespace location (ibdata files)" + : ""); } /** Reads or writes data. This operation could be asynchronous (aio). diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index 57b6c8de825..467fbbd557d 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -690,17 +690,12 @@ fsp_header_init_fields( flags); } -/** Initializes the space header of a new created space and creates also the -insert buffer tree root if space == 0. +/** Initialize a tablespace header. @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. */ -bool -fsp_header_init( - ulint space_id, - ulint size, - mtr_t* mtr) +@param[in,out] mtr mini-transaction */ +void +fsp_header_init(ulint space_id, ulint size, mtr_t* mtr) { fsp_header_t* header; buf_block_t* block; @@ -752,19 +747,9 @@ fsp_header_init( fsp_fill_free_list(!is_system_tablespace(space_id), space, header, mtr); - if (space_id == srv_sys_space.space_id()) { - if (btr_create(DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF, - 0, univ_page_size, DICT_IBUF_ID_MIN + space_id, - dict_ind_redundant, NULL, mtr) == FIL_NULL) { - return(false); - } - } - if (space->crypt_data) { space->crypt_data->write_page0(space, page, mtr); } - - return(true); } /**********************************************************************//** @@ -2096,7 +2081,6 @@ fseg_create_general( inode = fsp_alloc_seg_inode(space, space_header, mtr); if (inode == NULL) { - goto funct_exit; } diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc index 974140fe565..fa0203586fb 100644 --- a/storage/innobase/fsp/fsp0sysspace.cc +++ b/storage/innobase/fsp/fsp0sysspace.cc @@ -834,17 +834,6 @@ SysTablespace::check_file_spec( } } - /* We assume doublewirte blocks in the first data file. */ - if (err == DB_SUCCESS && *create_new_db - && begin->m_size < TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 3) { - ib::error() << "The " << name() << " data file " - << "'" << begin->name() << "' must be at least " - << TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * 3 * UNIV_PAGE_SIZE - / (1024 * 1024) << " MB"; - - err = DB_ERROR; - } - return(err); } diff --git a/storage/innobase/include/buf0dblwr.h b/storage/innobase/include/buf0dblwr.h index ef522be4d9a..598609e2be4 100644 --- a/storage/innobase/include/buf0dblwr.h +++ b/storage/innobase/include/buf0dblwr.h @@ -38,10 +38,11 @@ extern buf_dblwr_t* buf_dblwr; /** Set to TRUE when the doublewrite buffer is being created */ extern ibool buf_dblwr_being_created; -/****************************************************************//** -Creates the doublewrite buffer to a new InnoDB installation. The header of the -doublewrite buffer is placed on the trx system header page. -@return true if successful, false if not. */ +/** Create the doublewrite buffer if the doublewrite buffer header +is not present in the TRX_SYS page. +@return whether the operation succeeded +@retval true if the doublewrite buffer exists or was created +@retval false if the creation failed (too small first data file) */ MY_ATTRIBUTE((warn_unused_result)) bool buf_dblwr_create(); diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index f6fee72300c..63fc211c88d 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -397,18 +397,12 @@ fsp_header_init_fields( ulint space_id, /*!< in: space id */ ulint flags); /*!< in: tablespace flags (FSP_SPACE_FLAGS): 0, or table->flags if newer than COMPACT */ - -/** Initializes the space header of a new created space and creates also the -insert buffer tree root if space == 0. +/** Initialize a tablespace header. @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. */ -bool -fsp_header_init( - ulint space_id, - ulint size, - mtr_t* mtr); +@param[in,out] mtr mini-transaction */ +void +fsp_header_init(ulint space_id, ulint size, mtr_t* mtr); /**********************************************************************//** Increases the space size field of a space. */ diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h index 4c162526384..3078aa8faf1 100644 --- a/storage/innobase/include/trx0rseg.h +++ b/storage/innobase/include/trx0rseg.h @@ -110,9 +110,12 @@ void trx_rseg_mem_free(trx_rseg_t* rseg); /** Create a persistent rollback segment. -@param[in] space_id system or undo tablespace id */ +@param[in] space_id system or undo tablespace id +@return pointer to new rollback segment +@retval NULL on failure */ trx_rseg_t* -trx_rseg_create(ulint space_id); +trx_rseg_create(ulint space_id) + MY_ATTRIBUTE((warn_unused_result)); /** Create the temporary rollback segments. */ void diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 75753b53467..6274dec9f9d 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, 2017, MariaDB Corporation. +Copyright (c) 2015, 2017, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 06ed058f18e..56aa5626450 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -2537,7 +2537,7 @@ suspend_thread: case SRV_SHUTDOWN_CLEANUP: if (srv_shutdown_state == SRV_SHUTDOWN_CLEANUP && srv_fast_shutdown < 2) { - srv_shutdown(srv_fast_shutdown == 1); + srv_shutdown(srv_fast_shutdown == 0); } srv_suspend_thread(slot); my_thread_end(); diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index c89a11d821b..99843719008 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1334,7 +1334,7 @@ srv_init_abort_low( dberr_t err) { if (create_new_db) { - ib::error() << "InnoDB Database creation was aborted" + ib::error() << "Database creation was aborted" #ifdef UNIV_DEBUG " at " << innobase_basename(file) << "[" << line << "]" #endif /* UNIV_DEBUG */ @@ -2131,14 +2131,24 @@ files_checked: mtr_start(&mtr); - bool ret = fsp_header_init(0, sum_of_new_sizes, &mtr); + fsp_header_init(0, sum_of_new_sizes, &mtr); + + compile_time_assert(TRX_SYS_SPACE == 0); + compile_time_assert(IBUF_SPACE_ID == 0); + + ulint ibuf_root = btr_create( + DICT_CLUSTERED | DICT_UNIVERSAL | DICT_IBUF, + 0, univ_page_size, DICT_IBUF_ID_MIN, + dict_ind_redundant, NULL, &mtr); mtr_commit(&mtr); - if (!ret) { + if (ibuf_root == FIL_NULL) { return(srv_init_abort(DB_ERROR)); } + ut_ad(ibuf_root == IBUF_TREE_ROOT_PAGE_NO); + /* To maintain backward compatibility we create only the first rollback segment before the double write buffer. All the remaining rollback segments will be created later, @@ -2286,7 +2296,7 @@ files_checked: const ulint sum_of_data_file_sizes = srv_sys_space.get_sum_of_sizes(); /* Compare the system tablespace file size to what is - stored in FSP_SIZE. In open_or_create_data_files() + stored in FSP_SIZE. In srv_sys_space.open_or_create() we already checked that the file sizes match the innodb_data_file_path specification. */ if (srv_read_only_mode @@ -2393,7 +2403,6 @@ files_checked: } } - /* Validate a few system page types that were left uninitialized by older versions of MySQL. */ if (!high_level_read_only) { diff --git a/storage/innobase/trx/trx0rseg.cc b/storage/innobase/trx/trx0rseg.cc index 663566cf26f..b48f3e18f1b 100644 --- a/storage/innobase/trx/trx0rseg.cc +++ b/storage/innobase/trx/trx0rseg.cc @@ -263,7 +263,9 @@ trx_rseg_array_init() } /** Create a persistent rollback segment. -@param[in] space_id system or undo tablespace id */ +@param[in] space_id system or undo tablespace id +@return pointer to new rollback segment +@retval NULL on failure */ trx_rseg_t* trx_rseg_create(ulint space_id) { |