From 78153cf641aea41166d3e79ae99b57b154f6a027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 24 Feb 2017 12:51:55 +0200 Subject: MDEV-11927 InnoDB change buffer is not being merged to tables in the system tablespace This is a regression caused by MDEV-11585, which accidentally changed Tablespace::is_undo_tablespace() in an incorrect way, causing the InnoDB system tablespace to be reported as a dedicated undo tablespace, for which the change buffer is not applicable. Tablespace::is_undo_tablespace(): Remove. There were only 2 calls from the function buf_page_io_complete(). Replace those calls as appropriate. Also, merge changes to tablespace import/export tests from MySQL 5.7, and clean up the tests a little further, allowing them to be run with any innodb_page_size. Remove duplicated error injection instrumentation for the import/export tests. In MySQL 5.7, the error injection label buf_page_is_corrupt_failure was renamed to buf_page_import_corrupt_failure. fil_space_extend_must_retry(): Correct a debug assertion (tablespaces can be extended during IMPORT), and remove a TODO comment about compressed temporary tables that was already addressed in MDEV-11816. dict_build_tablespace_for_table(): Correct a comment that no longer holds after MDEV-11816, and assert that ROW_FORMAT=COMPRESSED can only be used in .ibd files. --- storage/innobase/buf/buf0buf.cc | 34 +++++++++------------------------- storage/innobase/dict/dict0crea.cc | 9 ++------- storage/innobase/fil/fil0fil.cc | 3 +-- storage/innobase/handler/ha_innodb.cc | 2 +- storage/innobase/include/fsp0space.h | 7 ------- 5 files changed, 13 insertions(+), 42 deletions(-) (limited to 'storage') diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index d6a2d9ba9e0..b9968f39a81 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -872,8 +872,7 @@ buf_page_is_corrupted( } #endif - - DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", return(TRUE); ); + DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(TRUE); ); if (!no_checksum && !page_size.is_compressed() && memcmp(read_buf + FIL_PAGE_LSN + 4, @@ -1002,7 +1001,6 @@ buf_page_is_corrupted( read_buf + FIL_PAGE_OFFSET)); #endif /* UNIV_INNOCHECKSUM */ - DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", return(TRUE); ); const srv_checksum_algorithm_t curr_algo = static_cast(srv_checksum_algorithm); @@ -6033,29 +6031,17 @@ buf_page_io_complete( /* Not a real corruption if it was triggered by error injection */ - DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", - if (bpage->id.space() != TRX_SYS_SPACE - && buf_mark_space_corrupt(bpage)) { - ib::info() << - "Simulated page corruption"; - return(true); - } - goto page_not_corrupt_1; - ;); - /* Not a real corruption if it was triggered by - error injection */ DBUG_EXECUTE_IF( "buf_page_import_corrupt_failure", - if (bpage->id.space() > TRX_SYS_SPACE - && !Tablespace::is_undo_tablespace( - bpage->id.space()) + if (bpage->id.space() + > srv_undo_tablespaces_open + && bpage->id.space() != SRV_TMP_SPACE_ID && buf_mark_space_corrupt(bpage)) { ib::info() << "Simulated IMPORT " "corruption"; return(true); } - goto page_not_corrupt; - ;); + goto page_not_corrupt;); database_corrupted: bool corrupted = buf_page_check_corrupt(bpage); @@ -6123,10 +6109,7 @@ database_corrupted: } DBUG_EXECUTE_IF("buf_page_import_corrupt_failure", - page_not_corrupt: bpage = bpage; ); - - DBUG_EXECUTE_IF("buf_page_is_corrupt_failure", - page_not_corrupt_1: bpage = bpage; ); + page_not_corrupt: bpage = bpage; ); if (recv_recovery_is_on()) { /* Pages must be uncompressed for crash recovery. */ @@ -6138,8 +6121,9 @@ database_corrupted: During re-init we have already freed ibuf entries. */ if (uncompressed && !recv_no_ibuf_operations - && !Tablespace::is_undo_tablespace(bpage->id.space()) - && bpage->id.space() != SRV_TMP_SPACE_ID + && (bpage->id.space() == 0 + || (bpage->id.space() > srv_undo_tablespaces_open + && bpage->id.space() != SRV_TMP_SPACE_ID)) && !srv_is_tablespace_truncated(bpage->id.space()) && fil_page_get_type(frame) == FIL_PAGE_INDEX && page_is_leaf(frame)) { diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index 51c721bfc93..084d39fc4a1 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -474,16 +474,11 @@ dict_build_tablespace_for_table( return(DB_ERROR); } } else { + ut_ad(dict_tf_get_rec_format(table->flags) + != REC_FORMAT_COMPRESSED); if (dict_table_is_temporary(table)) { - /* Use the shared temporary tablespace. - Note: The temp tablespace supports all non-Compressed - row formats whereas the system tablespace only - supports Redundant and Compact */ - ut_ad(dict_tf_get_rec_format(table->flags) - != REC_FORMAT_COMPRESSED); table->space = SRV_TMP_SPACE_ID; } else { - /* Create in the system tablespace. */ ut_ad(table->space == srv_sys_space.space_id()); } diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 14dad77f332..1ef209ed0ed 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1186,9 +1186,8 @@ fil_space_extend_must_retry( fil_flush_low(space); return(false); default: - // TODO: reject CREATE TEMPORARY TABLE...ROW_FORMAT=COMPRESSED ut_ad(space->purpose == FIL_TYPE_TABLESPACE - || space->purpose == FIL_TYPE_TEMPORARY); + || space->purpose == FIL_TYPE_IMPORT); if (space->purpose == FIL_TYPE_TABLESPACE) { fil_flush_low(space); } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ef599bc5d04..ded2105da05 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -12174,7 +12174,7 @@ create_table_info_t::create_option_data_directory_is_valid() } /** Validate the create options. Check that the options KEY_BLOCK_SIZE, -ROW_FORMAT, DATA DIRECTORY, TEMPORARY & TABLESPACE are compatible with +ROW_FORMAT, DATA DIRECTORY, TEMPORARY are compatible with each other and other settings. These CREATE OPTIONS are not validated here unless innodb_strict_mode is on. With strict mode, this function will report each problem it finds using a custom message with error diff --git a/storage/innobase/include/fsp0space.h b/storage/innobase/include/fsp0space.h index 6ecca6211ed..0b66827ab49 100644 --- a/storage/innobase/include/fsp0space.h +++ b/storage/innobase/include/fsp0space.h @@ -200,13 +200,6 @@ public: ut_a(!m_files.empty()); return(&m_files.front()); } - - /** Check if undo tablespace. - @return true if undo tablespace */ - static bool is_undo_tablespace(ulint id) - { - return(id <= srv_undo_tablespaces_open); - } private: /** @param[in] filename Name to lookup in the data files. -- cgit v1.2.1