diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-11-26 17:20:07 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-11-26 17:20:07 +0200 |
commit | 7dcbc33db5bd5282f35266ead5d78095848ee0f5 (patch) | |
tree | c6715d3d11c49416f7ae3a501adf0d7ab8e95750 /storage/innobase | |
parent | 8fe34dd45f39b22ae0134532b5b5247e4e8620fe (diff) | |
parent | 36359157cf2af0161f9ff856ed49c5a147c541f3 (diff) | |
download | mariadb-git-7dcbc33db5bd5282f35266ead5d78095848ee0f5.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'storage/innobase')
27 files changed, 138 insertions, 134 deletions
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 25d6e75f871..a1288642d63 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -225,7 +225,7 @@ btr_root_block_get( } buf_block_t* block = btr_block_get( - page_id_t(index->table->space->id, index->page), + page_id_t(index->table->space_id, index->page), page_size_t(index->table->space->flags), mode, index, mtr); @@ -250,9 +250,9 @@ btr_root_block_get( const page_t* root = buf_block_get_frame(block); ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF - + root, index->table->space->id)); + + root, index->table->space_id)); ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP - + root, index->table->space->id)); + + root, index->table->space_id)); } #endif /* UNIV_BTR_DEBUG */ @@ -363,7 +363,7 @@ btr_root_adjust_on_import( buf_block_t* block; page_zip_des_t* page_zip; dict_table_t* table = index->table; - const page_id_t page_id(table->space->id, index->page); + const page_id_t page_id(table->space_id, index->page); const page_size_t page_size(table->space->flags); DBUG_EXECUTE_IF("ib_import_trigger_corruption_3", @@ -405,10 +405,10 @@ btr_root_adjust_on_import( if (err == DB_SUCCESS && (!btr_root_fseg_adjust_on_import( FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF - + page, page_zip, table->space->id, &mtr) + + page, page_zip, table->space_id, &mtr) || !btr_root_fseg_adjust_on_import( FIL_PAGE_DATA + PAGE_BTR_SEG_TOP - + page, page_zip, table->space->id, &mtr))) { + + page, page_zip, table->space_id, &mtr))) { err = DB_CORRUPTION; } @@ -474,7 +474,7 @@ btr_page_alloc_for_ibuf( ut_a(node_addr.page != FIL_NULL); new_block = buf_page_get( - page_id_t(index->table->space->id, node_addr.page), + page_id_t(index->table->space_id, node_addr.page), page_size_t(index->table->space->flags), RW_X_LATCH, mtr); @@ -923,11 +923,11 @@ btr_node_ptr_get_child( mtr_t* mtr) /*!< in: mtr */ { ut_ad(rec_offs_validate(node_ptr, index, offsets)); - ut_ad(index->table->space->id + ut_ad(index->table->space_id == page_get_space_id(page_align(node_ptr))); return btr_block_get( - page_id_t(index->table->space->id, + page_id_t(index->table->space_id, btr_node_ptr_get_child_page_no(node_ptr, offsets)), page_size_t(index->table->space->flags), RW_SX_LATCH, index, mtr); @@ -1431,7 +1431,7 @@ btr_read_autoinc(dict_index_t* index) mtr.start(); ib_uint64_t autoinc; if (buf_block_t* block = buf_page_get( - page_id_t(index->table->space->id, index->page), + page_id_t(index->table->space_id, index->page), page_size_t(index->table->space->flags), RW_S_LATCH, &mtr)) { autoinc = page_get_autoinc(block->frame); @@ -1463,7 +1463,7 @@ btr_read_autoinc_with_fallback(const dict_table_t* table, unsigned col_no) mtr_t mtr; mtr.start(); buf_block_t* block = buf_page_get( - page_id_t(index->table->space->id, index->page), + page_id_t(index->table->space_id, index->page), page_size_t(index->table->space->flags), RW_S_LATCH, &mtr); @@ -2014,7 +2014,7 @@ btr_root_raise_and_insert( #endif /* UNIV_ZIP_DEBUG */ #ifdef UNIV_BTR_DEBUG if (!dict_index_is_ibuf(index)) { - ulint space = index->table->space->id; + ulint space = index->table->space_id; ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF + root, space)); @@ -3932,7 +3932,7 @@ retry: btr_search_drop_page_hash_index(block); /* Remove the page from the level list */ - btr_level_list_remove(index->table->space->id, + btr_level_list_remove(index->table->space_id, page_size, page, index, mtr); if (dict_index_is_spatial(index)) { @@ -4062,7 +4062,7 @@ retry: #endif /* UNIV_BTR_DEBUG */ /* Remove the page from the level list */ - btr_level_list_remove(index->table->space->id, + btr_level_list_remove(index->table->space_id, page_size, page, index, mtr); ut_ad(btr_node_ptr_get_child_page_no( @@ -4302,7 +4302,7 @@ btr_discard_only_page_on_level( #ifdef UNIV_BTR_DEBUG if (!dict_index_is_ibuf(index)) { const page_t* root = buf_block_get_frame(block); - const ulint space = index->table->space->id; + const ulint space = index->table->space_id; ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_LEAF + root, space)); ut_a(btr_root_fseg_validate(FIL_PAGE_DATA + PAGE_BTR_SEG_TOP @@ -4410,7 +4410,7 @@ btr_discard_page( if (left_page_no != FIL_NULL) { merge_block = btr_block_get( - page_id_t(index->table->space->id, left_page_no), + page_id_t(index->table->space_id, left_page_no), page_size, RW_X_LATCH, index, mtr); merge_page = buf_block_get_frame(merge_block); @@ -4426,7 +4426,7 @@ btr_discard_page( == btr_cur_get_rec(&parent_cursor))); } else if (right_page_no != FIL_NULL) { merge_block = btr_block_get( - page_id_t(index->table->space->id, right_page_no), + page_id_t(index->table->space_id, right_page_no), page_size, RW_X_LATCH, index, mtr); merge_page = buf_block_get_frame(merge_block); @@ -4475,7 +4475,7 @@ btr_discard_page( } /* Remove the page from the level list */ - btr_level_list_remove(index->table->space->id, page_size, + btr_level_list_remove(index->table->space_id, page_size, page, index, mtr); #ifdef UNIV_ZIP_DEBUG @@ -5065,7 +5065,7 @@ btr_validate_level( ret = false; } - ut_a(index->table->space->id == block->page.id.space()); + ut_a(index->table->space_id == block->page.id.space()); ut_a(block->page.id.space() == page_get_space_id(page)); #ifdef UNIV_ZIP_DEBUG page_zip = buf_block_get_page_zip(block); @@ -5102,7 +5102,7 @@ btr_validate_level( savepoint2 = mtr_set_savepoint(&mtr); block = btr_block_get( - page_id_t(index->table->space->id, + page_id_t(index->table->space_id, left_page_no), table_page_size, RW_SX_LATCH, index, &mtr); @@ -5131,7 +5131,7 @@ loop: ut_a(!page_zip || page_zip_validate(page_zip, page, index)); #endif /* UNIV_ZIP_DEBUG */ - ut_a(block->page.id.space() == index->table->space->id); + ut_a(block->page.id.space() == index->table->space_id); if (fseg_page_is_free(space, block->page.id.page_no())) { @@ -5174,7 +5174,7 @@ loop: savepoint = mtr_set_savepoint(&mtr); right_block = btr_block_get( - page_id_t(index->table->space->id, right_page_no), + page_id_t(index->table->space_id, right_page_no), table_page_size, RW_SX_LATCH, index, &mtr); @@ -5351,13 +5351,13 @@ loop: &mtr, savepoint, right_block); btr_block_get( - page_id_t(index->table->space->id, + page_id_t(index->table->space_id, parent_right_page_no), table_page_size, RW_SX_LATCH, index, &mtr); right_block = btr_block_get( - page_id_t(index->table->space->id, + page_id_t(index->table->space_id, right_page_no), table_page_size, RW_SX_LATCH, index, &mtr); @@ -5435,14 +5435,14 @@ node_ptr_fails: if (parent_right_page_no != FIL_NULL) { btr_block_get( page_id_t( - index->table->space->id, + index->table->space_id, parent_right_page_no), table_page_size, RW_SX_LATCH, index, &mtr); } } else if (parent_page_no != FIL_NULL) { btr_block_get( - page_id_t(index->table->space->id, + page_id_t(index->table->space_id, parent_page_no), table_page_size, RW_SX_LATCH, index, &mtr); @@ -5450,7 +5450,7 @@ node_ptr_fails: } block = btr_block_get( - page_id_t(index->table->space->id, right_page_no), + page_id_t(index->table->space_id, right_page_no), table_page_size, RW_SX_LATCH, index, &mtr); @@ -5596,7 +5596,7 @@ btr_can_merge_with_page( index = btr_cur_get_index(cursor); page = btr_cur_get_page(cursor); - const page_id_t page_id(index->table->space->id, page_no); + const page_id_t page_id(index->table->space_id, page_no); const page_size_t page_size(index->table->space->flags); mblock = btr_block_get(page_id, page_size, RW_X_LATCH, index, mtr); diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc index 73b4335d265..5cb07af3f66 100644 --- a/storage/innobase/btr/btr0bulk.cc +++ b/storage/innobase/btr/btr0bulk.cc @@ -120,7 +120,7 @@ PageBulk::init() } } else { new_block = btr_block_get( - page_id_t(m_index->table->space->id, m_page_no), + page_id_t(m_index->table->space_id, m_page_no), page_size_t(m_index->table->space->flags), RW_X_LATCH, m_index, &m_mtr); @@ -663,7 +663,7 @@ PageBulk::latch() if (!buf_page_optimistic_get(RW_X_LATCH, m_block, m_modify_clock, __FILE__, __LINE__, &m_mtr)) { m_block = buf_page_get_gen( - page_id_t(m_index->table->space->id, m_page_no), + page_id_t(m_index->table->space_id, m_page_no), page_size_t(m_index->table->space->flags), RW_X_LATCH, m_block, BUF_GET_IF_IN_POOL, __FILE__, __LINE__, &m_mtr, &m_err); @@ -1015,7 +1015,7 @@ BtrBulk::finish(dberr_t err) ut_ad(last_page_no != FIL_NULL); last_block = btr_block_get( - page_id_t(m_index->table->space->id, last_page_no), + page_id_t(m_index->table->space_id, last_page_no), page_size_t(m_index->table->space->flags), RW_X_LATCH, m_index, &mtr); first_rec = page_rec_get_next( diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 9a6b97f5baf..95ebcfe4d1e 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -754,7 +754,7 @@ btr_cur_optimistic_latch_leaves( if (left_page_no != FIL_NULL) { cursor->left_block = btr_block_get( - page_id_t(cursor->index->table->space->id, + page_id_t(cursor->index->table->space_id, left_page_no), page_size_t(cursor->index->table->space ->flags), @@ -1433,7 +1433,7 @@ btr_cur_search_to_nth_level_func( const page_size_t page_size(index->table->space->flags); /* Start with the root page. */ - page_id_t page_id(index->table->space->id, index->page); + page_id_t page_id(index->table->space_id, index->page); if (root_leaf_rw_latch == RW_X_LATCH) { node_ptr_max_size = btr_node_ptr_max_size(index); @@ -2541,7 +2541,7 @@ btr_cur_open_at_index_side_func( page_cursor = btr_cur_get_page_cur(cursor); cursor->index = index; - page_id_t page_id(index->table->space->id, index->page); + page_id_t page_id(index->table->space_id, index->page); const page_size_t page_size(index->table->space->flags); if (root_leaf_rw_latch == RW_X_LATCH) { @@ -2898,7 +2898,7 @@ btr_cur_open_at_rnd_pos_func( page_cursor = btr_cur_get_page_cur(cursor); cursor->index = index; - page_id_t page_id(index->table->space->id, index->page); + page_id_t page_id(index->table->space_id, index->page); const page_size_t page_size(index->table->space->flags); dberr_t err = DB_SUCCESS; @@ -7350,7 +7350,7 @@ struct btr_blob_log_check_t { if (m_op == BTR_STORE_INSERT_BULK) { mtr_x_lock(dict_index_get_lock(index), m_mtr); m_pcur->btr_cur.page_cur.block = btr_block_get( - page_id_t(index->table->space->id, page_no), + page_id_t(index->table->space_id, page_no), page_size_t(index->table->space->flags), RW_X_LATCH, index, m_mtr); m_pcur->btr_cur.page_cur.rec @@ -7958,6 +7958,7 @@ btr_free_externally_stored_field( & ~((BTR_EXTERN_OWNER_FLAG | BTR_EXTERN_INHERITED_FLAG) << 24))); ut_ad(space_id == index->table->space->id); + ut_ad(space_id == index->table->space_id); const page_size_t ext_page_size(dict_table_page_size(index->table)); const page_size_t& rec_page_size(rec == NULL diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc index 6f36198f129..e3c7ef8a768 100644 --- a/storage/innobase/btr/btr0defragment.cc +++ b/storage/innobase/btr/btr0defragment.cc @@ -166,7 +166,7 @@ btr_defragment_add_index( mtr_start(&mtr); // Load index rood page. buf_block_t* block = btr_block_get( - page_id_t(index->table->space->id, index->page), + page_id_t(index->table->space_id, index->page), page_size_t(index->table->space->flags), RW_NO_LATCH, index, &mtr); page_t* page = NULL; @@ -314,7 +314,7 @@ btr_defragment_save_defrag_stats_if_needed( dict_index_t* index) /*!< in: index */ { if (srv_defragment_stats_accuracy != 0 // stats tracking disabled - && index->table->space->id != 0 // do not track system tables + && index->table->space_id != 0 // do not track system tables && index->stat_defrag_modified_counter >= srv_defragment_stats_accuracy) { dict_stats_defrag_pool_add(index); @@ -489,7 +489,7 @@ btr_defragment_merge_pages( from_block); btr_search_drop_page_hash_index(from_block); btr_level_list_remove( - index->table->space->id, + index->table->space_id, page_size, from_page, index, mtr); btr_node_ptr_delete(index, from_block, mtr); /* btr_blob_dbg_remove(from_page, index, @@ -564,7 +564,7 @@ btr_defragment_n_pages( return NULL; } - if (!index->table->space || !index->table->space->id) { + if (!index->table->space || !index->table->space_id) { /* Ignore space 0. */ return NULL; } @@ -589,7 +589,7 @@ btr_defragment_n_pages( break; } - blocks[i] = btr_block_get(page_id_t(index->table->space->id, + blocks[i] = btr_block_get(page_id_t(index->table->space_id, page_no), page_size, RW_X_LATCH, index, mtr); } diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc index 22e997b60aa..7d8966d4109 100644 --- a/storage/innobase/btr/btr0scrub.cc +++ b/storage/innobase/btr/btr0scrub.cc @@ -450,14 +450,14 @@ btr_pessimistic_scrub( mtr->release_block_at_savepoint(scrub_data->savepoint, block); buf_block_t* get_block __attribute__((unused)) = btr_block_get( - page_id_t(index->table->space->id, left_page_no), + page_id_t(index->table->space_id, left_page_no), page_size, RW_X_LATCH, index, mtr); /** * Refetch block and re-initialize page */ block = btr_block_get( - page_id_t(index->table->space->id, page_no), + page_id_t(index->table->space_id, page_no), page_size, RW_X_LATCH, index, mtr); page = buf_block_get_frame(block); @@ -471,7 +471,7 @@ btr_pessimistic_scrub( if (right_page_no != FIL_NULL) { buf_block_t* get_block __attribute__((unused))= btr_block_get( - page_id_t(index->table->space->id, right_page_no), + page_id_t(index->table->space_id, right_page_no), page_size, RW_X_LATCH, index, mtr); } @@ -787,7 +787,7 @@ btr_scrub_page( /* check that table/index still match now that they are loaded */ if (!scrub_data->current_table->space - || scrub_data->current_table->space->id != scrub_data->space) { + || scrub_data->current_table->space_id != scrub_data->space) { /* this is truncate table */ mtr_commit(mtr); return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE; diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index 8bb838187bb..37a839727ec 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -660,7 +660,7 @@ btr_search_update_hash_ref( return; } - ut_ad(block->page.id.space() == index->table->space->id); + ut_ad(block->page.id.space() == index->table->space_id); ut_ad(index == cursor->index); ut_ad(!dict_index_is_ibuf(index)); @@ -1356,7 +1356,7 @@ btr_search_build_page_hash_index( rec_offs_init(offsets_); ut_ad(ahi_latch == btr_get_search_latch(index)); ut_ad(index); - ut_ad(block->page.id.space() == index->table->space->id); + ut_ad(block->page.id.space() == index->table->space_id); ut_a(!dict_index_is_ibuf(index)); ut_ad(page_is_leaf(block->frame)); @@ -1673,7 +1673,7 @@ void btr_search_update_hash_on_delete(btr_cur_t* cursor) return; } - ut_ad(block->page.id.space() == index->table->space->id); + ut_ad(block->page.id.space() == index->table->space_id); ut_a(index == cursor->index); ut_a(block->curr_n_fields > 0 || block->curr_n_bytes > 0); ut_a(!dict_index_is_ibuf(index)); @@ -1830,7 +1830,7 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor, rw_lock_t* ahi_latch) return; } - ut_ad(block->page.id.space() == index->table->space->id); + ut_ad(block->page.id.space() == index->table->space_id); btr_search_check_free_space_in_heap(index); table = btr_get_search_table(index); diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index f19a894bc64..1540f7e53bc 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -3007,7 +3007,7 @@ err_exit: } if (err == DB_SUCCESS && cached && table->is_readable()) { - if (table->space && !fil_space_get_size(table->space->id)) { + if (table->space && !fil_space_get_size(table->space_id)) { table->corrupted = true; table->file_unreadable = true; } else if (table->supports_instant()) { diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index 672be81b9dd..20ebbc136c6 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -1503,7 +1503,7 @@ dict_stats_analyze_index_below_cur( offsets_rec = rec_get_offsets(rec, index, offsets1, false, ULINT_UNDEFINED, &heap); - page_id_t page_id(index->table->space->id, + page_id_t page_id(index->table->space_id, btr_node_ptr_get_child_page_no( rec, offsets_rec)); const page_size_t page_size(index->table->space->flags); diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 3e86ae267c2..df1b5ec783c 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -4859,8 +4859,8 @@ fil_mtr_rename_log( { ut_ad(old_table->space != fil_system.temp_space); ut_ad(new_table->space != fil_system.temp_space); - ut_ad(old_table->space_id == old_table->space->id); - ut_ad(new_table->space_id == new_table->space->id); + ut_ad(old_table->space->id == old_table->space_id); + ut_ad(new_table->space->id == new_table->space_id); /* If neither table is file-per-table, there will be no renaming of files. */ diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index a1e962bdeb7..58bfeee9278 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -1741,7 +1741,7 @@ fts_create_in_mem_aux_table( { dict_table_t* new_table = dict_mem_table_create( aux_table_name, NULL, n_cols, 0, table->flags, - table->space->id == TRX_SYS_SPACE + table->space_id == TRX_SYS_SPACE ? 0 : table->space->purpose == FIL_TYPE_TEMPORARY ? DICT_TF2_TEMPORARY : DICT_TF2_USE_FILE_PER_TABLE); @@ -1770,7 +1770,7 @@ fts_create_one_common_table( const char* fts_suffix, mem_heap_t* heap) { - dict_table_t* new_table = NULL; + dict_table_t* new_table; dberr_t error; bool is_config = strcmp(fts_suffix, "CONFIG") == 0; @@ -1823,11 +1823,13 @@ fts_create_one_common_table( } if (error != DB_SUCCESS) { - trx->error_state = error; dict_mem_table_free(new_table); new_table = NULL; ib::warn() << "Failed to create FTS common table " << fts_table_name; + trx->error_state = DB_SUCCESS; + row_drop_table_for_mysql(fts_table_name, trx, SQLCOM_DROP_DB); + trx->error_state = error; } return(new_table); } @@ -1968,7 +1970,7 @@ fts_create_one_index_table( mem_heap_t* heap) { dict_field_t* field; - dict_table_t* new_table = NULL; + dict_table_t* new_table; char table_name[MAX_FULL_NAME_LEN]; dberr_t error; CHARSET_INFO* charset; @@ -2032,11 +2034,13 @@ fts_create_one_index_table( } if (error != DB_SUCCESS) { - trx->error_state = error; dict_mem_table_free(new_table); new_table = NULL; ib::warn() << "Failed to create FTS index table " << table_name; + trx->error_state = DB_SUCCESS; + row_drop_table_for_mysql(table_name, trx, SQLCOM_DROP_DB); + trx->error_state = error; } return(new_table); diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc index 4bd3e1c232a..226b5d07e5d 100644 --- a/storage/innobase/gis/gis0rtree.cc +++ b/storage/innobase/gis/gis0rtree.cc @@ -737,7 +737,7 @@ rtr_adjust_upper_level( new_prdt.op = 0; lock_prdt_update_parent(block, new_block, &prdt, &new_prdt, - index->table->space->id, + index->table->space_id, page_cursor->block->page.id.page_no()); mem_heap_free(heap); @@ -1258,7 +1258,7 @@ after_insert: /* Check any predicate locks need to be moved/copied to the new page */ lock_prdt_update_split(new_block, &prdt, &new_prdt, - cursor->index->table->space->id, page_no); + cursor->index->table->space_id, page_no); /* Adjust the upper level. */ rtr_adjust_upper_level(cursor, flags, block, new_block, @@ -1872,7 +1872,7 @@ rtr_estimate_n_rows_in_range( mtr_s_lock(&index->lock, &mtr); buf_block_t* block = btr_block_get( - page_id_t(index->table->space->id, index->page), + page_id_t(index->table->space_id, index->page), page_size_t(index->table->space->flags), RW_S_LATCH, index, &mtr); const page_t* page = buf_block_get_frame(block); diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index 6fcc56170d0..66a6d57d986 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -268,7 +268,7 @@ rtr_pcur_getnext_from_path( dberr_t err = DB_SUCCESS; block = buf_page_get_gen( - page_id_t(index->table->space->id, + page_id_t(index->table->space_id, next_rec.page_no), page_size, rw_latch, NULL, BUF_GET, __FILE__, __LINE__, mtr, &err); @@ -298,7 +298,7 @@ rtr_pcur_getnext_from_path( && mode != PAGE_CUR_RTREE_LOCATE) { ut_ad(rtr_info->thr); lock_place_prdt_page_lock( - index->table->space->id, + index->table->space_id, next_page_no, index, rtr_info->thr); } @@ -422,7 +422,7 @@ rtr_pcur_getnext_from_path( btr_cur_latch_leaves( block, - page_id_t(index->table->space->id, + page_id_t(index->table->space_id, block->page.id.page_no()), page_size, BTR_MODIFY_TREE, btr_cur, mtr); @@ -1360,7 +1360,7 @@ search_again: dberr_t err = DB_SUCCESS; block = buf_page_get_gen( - page_id_t(index->table->space->id, page_no), + page_id_t(index->table->space_id, page_no), page_size, RW_X_LATCH, NULL, BUF_GET, __FILE__, __LINE__, mtr, &err); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 1afe451d4a8..749c82da555 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -145,8 +145,8 @@ void close_thread_tables(THD* thd); #ifdef WITH_WSREP #include "dict0priv.h" -#include "ut0byte.h" #include <mysql/service_md5.h> +#include "wsrep_sst.h" extern MYSQL_PLUGIN_IMPORT MYSQL_BIN_LOG mysql_bin_log; @@ -3731,6 +3731,15 @@ static int innodb_init_params() ib::info() << "For Galera, using innodb_lock_schedule_algorithm=fcfs"; innodb_lock_schedule_algorithm = INNODB_LOCK_SCHEDULE_ALGORITHM_FCFS; } + + /* Print deprecation info if xtrabackup is used for SST method */ + if (global_system_variables.wsrep_on + && wsrep_sst_method + && (!strcmp(wsrep_sst_method, "xtrabackup") + || !strcmp(wsrep_sst_method, "xtrabackup-v2"))) { + ib::info() << "Galera SST method xtrabackup is deprecated and the " + " support for it may be removed in future releases."; + } #endif /* WITH_WSREP */ #ifndef HAVE_LZ4 @@ -12350,9 +12359,15 @@ int create_table_info_t::create_table(bool create_fk) error = convert_error_code_to_mysql(err, 0, NULL); if (error) { + /* Drop the being-created table before rollback, + so that rollback can possibly rename back a table + that could have been renamed before + the failed creation. */ + m_trx->error_state = DB_SUCCESS; row_drop_table_for_mysql(m_table_name, m_trx, - SQLCOM_DROP_DB); + SQLCOM_TRUNCATE); trx_rollback_to_savepoint(m_trx, NULL); + m_trx->error_state = DB_SUCCESS; DBUG_RETURN(error); } @@ -12577,14 +12592,18 @@ ha_innobase::create( } if ((error = info.create_table(own_trx))) { - row_drop_table_for_mysql(norm_name, trx, SQLCOM_DROP_TABLE, - true); + /* Drop the being-created table before rollback, + so that rollback can possibly rename back a table + that could have been renamed before the failed creation. */ + trx->error_state = DB_SUCCESS; + row_drop_table_for_mysql(info.table_name(), trx, + SQLCOM_TRUNCATE, true); trx_rollback_for_mysql(trx); row_mysql_unlock_data_dictionary(trx); if (own_trx) { trx_free(trx); - DBUG_RETURN(error); } + DBUG_RETURN(error); } innobase_commit_low(trx); diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 3ea6a393fa0..f005102514a 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -3369,7 +3369,7 @@ ibuf_insert_low( ut_ad(!dict_index_is_spatial(index)); ut_ad(dtuple_check_typed(entry)); ut_ad(!no_counter || op == IBUF_OP_INSERT); - ut_ad(page_id.space() == index->table->space->id); + ut_ad(page_id.space() == index->table->space_id); ut_a(op < IBUF_OP_COUNT); do_merge = FALSE; diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index 1accfd858be..8130f733806 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -372,9 +372,8 @@ row_create_table_for_mysql( MY_ATTRIBUTE((warn_unused_result)); /*********************************************************************//** -Does an index creation operation for MySQL. TODO: currently failure -to create an index results in dropping the whole table! This is no problem -currently as all indexes must be created at the same time as the table. +Create an index when creating a table. +On failure, the caller must drop the table! @return error number or DB_SUCCESS */ dberr_t row_create_index_for_mysql( diff --git a/storage/innobase/include/row0row.h b/storage/innobase/include/row0row.h index b46ca6eb3bc..8b3db8a1b64 100644 --- a/storage/innobase/include/row0row.h +++ b/storage/innobase/include/row0row.h @@ -418,7 +418,7 @@ row_mtr_start(mtr_t* mtr, dict_index_t* index, bool pessimistic) { mtr->start(); - switch (index->table->space->id) { + switch (index->table->space_id) { case IBUF_SPACE_ID: if (pessimistic && !(index->type & (DICT_UNIQUE | DICT_SPATIAL))) { diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 062892a8c88..51d6dedf512 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -4912,6 +4912,8 @@ lock_rec_queue_validate( goto func_exit; } + ut_ad(page_rec_is_leaf(rec)); + if (index == NULL) { /* Nothing we can do */ @@ -5074,11 +5076,13 @@ loop: if (!sync_check_find(SYNC_FSP)) for (i = nth_bit; i < lock_rec_get_n_bits(lock); i++) { - if (i == 1 || lock_rec_get_nth_bit(lock, i)) { + if (i == PAGE_HEAP_NO_SUPREMUM + || lock_rec_get_nth_bit(lock, i)) { rec = page_find_rec_with_heap_no(block->frame, i); ut_a(rec); - ut_ad(page_rec_is_leaf(rec)); + ut_ad(!lock_rec_get_nth_bit(lock, i) + || page_rec_is_leaf(rec)); offsets = rec_get_offsets(rec, lock->index, offsets, true, ULINT_UNDEFINED, &heap); @@ -5297,7 +5301,7 @@ lock_rec_insert_check_and_lock( { ut_ad(block->frame == page_align(rec)); ut_ad(!dict_index_is_online_ddl(index) - || dict_index_is_clust(index) + || index->is_primary() || (flags & BTR_CREATE_FLAG)); ut_ad(mtr->is_named_space(index->table->space)); ut_ad(page_rec_is_leaf(rec)); @@ -5308,6 +5312,7 @@ lock_rec_insert_check_and_lock( } ut_ad(!index->table->is_temporary()); + ut_ad(page_is_leaf(block->frame)); dberr_t err; lock_t* lock; diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index 717f4a79507..1b6567ad9a4 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -235,7 +235,7 @@ page_set_autoinc( mtr, block, MTR_MEMO_PAGE_X_FIX | MTR_MEMO_PAGE_SX_FIX)); ut_ad(index->is_primary()); ut_ad(index->page == block->page.id.page_no()); - ut_ad(index->table->space->id == block->page.id.space()); + ut_ad(index->table->space_id == block->page.id.space()); byte* field = PAGE_HEADER + PAGE_ROOT_AUTO_INC + buf_block_get_frame(block); diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc index 893eeb56c18..f46c381fbf7 100644 --- a/storage/innobase/row/row0ftsort.cc +++ b/storage/innobase/row/row0ftsort.cc @@ -900,7 +900,7 @@ loop: merge_file[t_ctx.buf_used]->offset++, block[t_ctx.buf_used], crypt_block[t_ctx.buf_used], - table->space->id)) { + table->space_id)) { error = DB_TEMP_FILE_WRITE_FAIL; goto func_exit; } @@ -994,7 +994,7 @@ exit: merge_file[i]->offset++, block[i], crypt_block[i], - table->space->id)) { + table->space_id)) { error = DB_TEMP_FILE_WRITE_FAIL; goto func_exit; } @@ -1032,7 +1032,7 @@ exit: psort_info->psort_common->dup, merge_file[i], block[i], &tmpfd[i], false, 0.0/* pct_progress */, 0.0/* pct_cost */, - crypt_block[i], table->space->id); + crypt_block[i], table->space_id); if (error != DB_SUCCESS) { os_file_close(tmpfd[i]); @@ -1702,7 +1702,7 @@ row_fts_merge_insert( #ifdef UNIV_DEBUG ins_ctx.aux_index_id = id; #endif - const ulint space = table->space->id; + const ulint space = table->space_id; for (i = 0; i < fts_sort_pll_degree; i++) { if (psort_info[i].merge_file[id]->n_rec == 0) { diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 1c8012f9b73..8fc71d698df 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -2050,7 +2050,7 @@ row_import_discard_changes( table->file_unreadable = true; if (table->space) { - fil_close_tablespace(trx, table->space->id); + fil_close_tablespace(trx, table->space_id); table->space = NULL; } } diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 3b103e48da7..1f9d4b6b8b4 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -435,7 +435,7 @@ row_log_online_op( if (!log_tmp_block_encrypt( buf, srv_sort_buf_size, log->crypt_tail, byte_offset, - index->table->space->id)) { + index->table->space_id)) { log->error = DB_DECRYPTION_FAILED; goto write_failed; } @@ -573,7 +573,7 @@ row_log_table_close_func( if (!log_tmp_block_encrypt( log->tail.block, srv_sort_buf_size, log->crypt_tail, byte_offset, - index->table->space->id)) { + index->table->space_id)) { log->error = DB_DECRYPTION_FAILED; goto err_exit; } @@ -2871,7 +2871,7 @@ all_done: if (!log_tmp_block_decrypt( buf, srv_sort_buf_size, index->online_log->crypt_head, - ofs, index->table->space->id)) { + ofs, index->table->space_id)) { error = DB_DECRYPTION_FAILED; goto func_exit; } @@ -3775,7 +3775,7 @@ all_done: if (!log_tmp_block_decrypt( buf, srv_sort_buf_size, index->online_log->crypt_head, - ofs, index->table->space->id)) { + ofs, index->table->space_id)) { error = DB_DECRYPTION_FAILED; goto func_exit; } diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index cd8d0fdd465..38af0eb1931 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -2538,7 +2538,7 @@ write_buffers: curr_progress, pct_cost, crypt_block, - new_table->space->id); + new_table->space_id); if (row == NULL) { err = clust_btr_bulk->finish( @@ -2649,7 +2649,7 @@ write_buffers: curr_progress, pct_cost, crypt_block, - new_table->space->id); + new_table->space_id); err = btr_bulk.finish(err); @@ -2683,7 +2683,7 @@ write_buffers: if (!row_merge_write( file->fd, file->offset++, block, crypt_block, - new_table->space->id)) { + new_table->space_id)) { err = DB_TEMP_FILE_WRITE_FAIL; trx->error_key_num = i; break; @@ -4303,7 +4303,7 @@ row_make_new_pathname( dict_table_t* table, /*!< in: table to be renamed */ const char* new_name) /*!< in: new name */ { - ut_ad(!is_system_tablespace(table->space->id)); + ut_ad(!is_system_tablespace(table->space_id)); return os_file_make_new_pathname(table->space->chain.start->name, new_name); } @@ -4538,7 +4538,7 @@ row_merge_write_redo( log_ptr = mlog_open(&mtr, 11 + 8); log_ptr = mlog_write_initial_log_record_low( MLOG_INDEX_LOAD, - index->table->space->id, index->page, log_ptr, &mtr); + index->table->space_id, index->page, log_ptr, &mtr); mach_write_to_8(log_ptr, index->id); mlog_close(&mtr, log_ptr + 8); mtr.commit(); @@ -4896,7 +4896,7 @@ wait_again: trx, &dup, &merge_files[i], block, &tmpfd, true, pct_progress, pct_cost, - crypt_block, new_table->space->id, + crypt_block, new_table->space_id, stage); pct_progress += pct_cost; @@ -4939,7 +4939,7 @@ wait_again: merge_files[i].fd, block, NULL, &btr_bulk, merge_files[i].n_rec, pct_progress, pct_cost, - crypt_block, new_table->space->id, + crypt_block, new_table->space_id, stage); error = btr_bulk.finish(error); diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 1fe1fad7858..4bfebab1468 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -2463,7 +2463,7 @@ err_exit: /* We already have .ibd file here. it should be deleted. */ if (dict_table_is_file_per_table(table) - && fil_delete_tablespace(table->space->id) != DB_SUCCESS) { + && fil_delete_tablespace(table->space_id) != DB_SUCCESS) { ib::error() << "Cannot delete the file of table " << table->name; } @@ -2486,9 +2486,8 @@ err_exit: } /*********************************************************************//** -Does an index creation operation for MySQL. TODO: currently failure -to create an index results in dropping the whole table! This is no problem -currently as all indexes must be created at the same time as the table. +Create an index when creating a table. +On failure, the caller must drop the table! @return error number or DB_SUCCESS */ dberr_t row_create_index_for_mysql( @@ -2511,16 +2510,9 @@ row_create_index_for_mysql( ulint len; dict_table_t* table = index->table; - trx->op_info = "creating index"; - ut_ad(rw_lock_own(dict_operation_lock, RW_LOCK_X)); ut_ad(mutex_own(&dict_sys->mutex)); - - if (!table->is_temporary()) { - trx_start_if_not_started_xa(trx, true); - } - for (i = 0; i < index->n_def; i++) { /* Check that prefix_len and actual length < DICT_MAX_INDEX_COL_LEN */ @@ -2538,19 +2530,19 @@ row_create_index_for_mysql( /* Column or prefix length exceeds maximum column length */ if (len > (ulint) DICT_MAX_FIELD_LEN_BY_FORMAT(table)) { - err = DB_TOO_BIG_INDEX_COL; - dict_mem_index_free(index); - goto error_handling; + return DB_TOO_BIG_INDEX_COL; } } - trx_set_dict_operation(trx, TRX_DICT_OP_TABLE); + trx->op_info = "creating index"; /* For temp-table we avoid insertion into SYSTEM TABLES to maintain performance and so we have separate path that directly just updates dictonary cache. */ if (!table->is_temporary()) { + trx_start_if_not_started_xa(trx, true); + trx_set_dict_operation(trx, TRX_DICT_OP_TABLE); /* Note that the space id where we store the index is inherited from the table in dict_build_index_def_step() in dict0crea.cc. */ @@ -2597,22 +2589,6 @@ row_create_index_for_mysql( } } - if (err != DB_SUCCESS) { -error_handling: - /* We have special error handling here */ - - trx->error_state = DB_SUCCESS; - - if (trx_is_started(trx)) { - row_drop_table_for_mysql(table->name.m_name, trx, - SQLCOM_DROP_TABLE, true); - trx_rollback_to_savepoint(trx, NULL); - ut_ad(!trx_is_started(trx)); - } - - trx->error_state = DB_SUCCESS; - } - trx->op_info = ""; return(err); @@ -3798,7 +3774,7 @@ do_drop: && dict_table_get_low("SYS_DATAFILES")) { info = pars_info_create(); pars_info_add_int4_literal(info, "id", - lint(table->space->id)); + lint(table->space_id)); err = que_eval_sql( info, "PROCEDURE DROP_SPACE_PROC () IS\n" diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc index d9b52484a94..d77cc1e33dc 100644 --- a/storage/innobase/row/row0quiesce.cc +++ b/storage/innobase/row/row0quiesce.cc @@ -141,7 +141,7 @@ row_quiesce_write_indexes( mach_write_to_8(ptr, index->id); ptr += sizeof(index_id_t); - mach_write_to_4(ptr, table->space->id); + mach_write_to_4(ptr, table->space_id); ptr += sizeof(ib_uint32_t); mach_write_to_4(ptr, index->page); @@ -525,7 +525,7 @@ row_quiesce_table_start( } for (ulint count = 0; - ibuf_merge_space(table->space->id) != 0 + ibuf_merge_space(table->space_id) != 0 && !trx_is_interrupted(trx); ++count) { if (!(count % 20)) { @@ -537,7 +537,7 @@ row_quiesce_table_start( if (!trx_is_interrupted(trx)) { { FlushObserver observer(table->space, trx, NULL); - buf_LRU_flush_or_remove_pages(table->space->id, + buf_LRU_flush_or_remove_pages(table->space_id, &observer); } @@ -637,7 +637,7 @@ row_quiesce_set_state( ER_CANNOT_DISCARD_TEMPORARY_TABLE); return(DB_UNSUPPORTED); - } else if (table->space->id == TRX_SYS_SPACE) { + } else if (table->space_id == TRX_SYS_SPACE) { char table_name[MAX_FULL_NAME_LEN + 1]; diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index 5cfe036d89f..5e7894d3ca7 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -1131,7 +1131,7 @@ re_scan: btr_pcur_get_page(pcur)); cur_block = buf_page_get_gen( - page_id_t(index->table->space->id, page_no), + page_id_t(index->table->space_id, page_no), page_size_t(index->table->space->flags), RW_X_LATCH, NULL, BUF_GET, __FILE__, __LINE__, mtr, &err); diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc index eedf73204a3..9a42333133d 100644 --- a/storage/innobase/row/row0uins.cc +++ b/storage/innobase/row/row0uins.cc @@ -413,7 +413,7 @@ static bool row_undo_ins_parse_undo_rec(undo_node_t* node, bool dict_locked) dict_table_t* table = node->table; ut_ad(!table->is_temporary()); ut_ad(dict_table_is_file_per_table(table) - == !is_system_tablespace(table->space->id)); + == !is_system_tablespace(table->space_id)); size_t len = mach_read_from_2(node->undo_rec) + size_t(node->undo_rec - ptr) - 2; ptr[len] = 0; diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 6eb8170e79f..b4f2b91881a 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -2303,7 +2303,7 @@ row_upd_sec_index_entry( mtr.start(); - switch (index->table->space->id) { + switch (index->table->space_id) { case SRV_TMP_SPACE_ID: mtr.set_log_mode(MTR_LOG_NO_REDO); flags = BTR_NO_LOCKING_FLAG; |