Loading innobase/btr/btr0cur.c +19 −17 Original line number Diff line number Diff line Loading @@ -1642,7 +1642,7 @@ btr_cur_optimistic_update( btr_search_update_hash_on_delete(cursor); page_cur_delete_rec(page_cursor, index, mtr); page_cur_delete_rec(page_cursor, index, offsets, mtr); page_cur_move_to_prev(page_cursor); Loading Loading @@ -1885,7 +1885,7 @@ btr_cur_pessimistic_update( btr_search_update_hash_on_delete(cursor); page_cur_delete_rec(page_cursor, index, mtr); page_cur_delete_rec(page_cursor, index, offsets, mtr); page_cur_move_to_prev(page_cursor); Loading Loading @@ -2401,6 +2401,7 @@ btr_cur_optimistic_delete( mem_heap_t* heap = NULL; ulint offsets_[100] = { 100, }; ulint* offsets = offsets_; ibool no_compress_needed; ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_page(cursor)), MTR_MEMO_PAGE_X_FIX)); Loading @@ -2414,9 +2415,11 @@ btr_cur_optimistic_delete( offsets = rec_get_offsets(rec, cursor->index, offsets, ULINT_UNDEFINED, &heap); if (!rec_offs_any_extern(offsets) no_compress_needed = !rec_offs_any_extern(offsets) && btr_cur_can_delete_without_compress( cursor, rec_offs_size(offsets), mtr)) { cursor, rec_offs_size(offsets), mtr); if (no_compress_needed) { lock_update_delete(rec); Loading @@ -2425,20 +2428,17 @@ btr_cur_optimistic_delete( max_ins_size = page_get_max_insert_size_after_reorganize(page, 1); page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, mtr); cursor->index, offsets, mtr); ibuf_update_free_bits_low(cursor->index, page, max_ins_size, mtr); if (heap) { mem_heap_free(heap); } return(TRUE); } if (heap) { mem_heap_free(heap); } return(FALSE); return(no_compress_needed); } /***************************************************************** Loading Loading @@ -2478,6 +2478,7 @@ btr_cur_pessimistic_delete( ibool success; ibool ret = FALSE; mem_heap_t* heap; ulint* offsets; page = btr_cur_get_page(cursor); tree = btr_cur_get_tree(cursor); Loading @@ -2503,20 +2504,20 @@ btr_cur_pessimistic_delete( } } heap = mem_heap_create(256); heap = mem_heap_create(1024); rec = btr_cur_get_rec(cursor); offsets = rec_get_offsets(rec, cursor->index, NULL, ULINT_UNDEFINED, &heap); /* Free externally stored fields if the record is neither a node pointer nor in two-byte format. This avoids unnecessary calls to rec_get_offsets(). */ This avoids an unnecessary loop. */ if (cursor->index->table->comp ? !rec_get_node_ptr_flag(rec) : !rec_get_1byte_offs_flag(rec)) { btr_rec_free_externally_stored_fields(cursor->index, rec, rec_get_offsets(rec, cursor->index, NULL, ULINT_UNDEFINED, &heap), in_rollback, mtr); mem_heap_empty(heap); rec, offsets, in_rollback, mtr); } if ((page_get_n_recs(page) < 2) Loading Loading @@ -2568,7 +2569,8 @@ btr_cur_pessimistic_delete( btr_search_update_hash_on_delete(cursor); page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, mtr); page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, offsets, mtr); ut_ad(btr_check_node_ptr(tree, page, mtr)); Loading innobase/dict/dict0crea.c +36 −7 Original line number Diff line number Diff line Loading @@ -729,14 +729,17 @@ dict_drop_index_tree( /*********************************************************************** Truncates the index tree associated with a row in SYS_INDEXES table. */ void ulint dict_truncate_index_tree( /*=====================*/ /* out: new root page number, or FIL_NULL on failure */ dict_table_t* table, /* in: the table the index belongs to */ rec_t* rec, /* in: record in the clustered index of SYS_INDEXES table */ mtr_t* mtr) /* in: mtr having the latch on the record page */ on the record page. The mtr may be committed and restarted in this call. */ { ulint root_page_no; ulint space; Loading @@ -761,7 +764,10 @@ dict_truncate_index_tree( if (root_page_no == FIL_NULL) { /* The tree has been freed. */ return; ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Trying to TRUNCATE" " a missing index of table %s!\n", table->name); return(FIL_NULL); } ptr = rec_get_nth_field_old(rec, Loading @@ -775,7 +781,10 @@ dict_truncate_index_tree( /* It is a single table tablespace and the .ibd file is missing: do nothing */ return; ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Trying to TRUNCATE" " a missing .ibd file of table %s!\n", table->name); return(FIL_NULL); } ptr = rec_get_nth_field_old(rec, Loading @@ -801,6 +810,20 @@ dict_truncate_index_tree( space, root_page_no, RW_X_LATCH, mtr)); btr_free_root(space, root_page_no, mtr); /* We will temporarily write FIL_NULL to the PAGE_NO field in SYS_INDEXES, so that the database will not get into an inconsistent state in case it crashes between the mtr_commit() below and the following mtr_commit() call. */ page_rec_write_index_page_no(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, FIL_NULL, mtr); /* We will need to commit the mini-transaction in order to avoid deadlocks in the btr_create() call, because otherwise we would be freeing and allocating pages in the same mini-transaction. */ mtr_commit(mtr); /* mtr_commit() will invalidate rec. */ rec = NULL; mtr_start(mtr); /* Find the index corresponding to this SYS_INDEXES record. */ for (index = UT_LIST_GET_FIRST(table->indexes); Loading @@ -814,11 +837,17 @@ dict_truncate_index_tree( root_page_no = btr_create(type, space, index_id, comp, mtr); if (index) { index->tree->page = root_page_no; } else { ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Index %lu %lu of table %s is missing\n" "InnoDB: from the data dictionary during TRUNCATE!\n", ut_dulint_get_high(index_id), ut_dulint_get_low(index_id), table->name); } page_rec_write_index_page_no(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, root_page_no, mtr); return(root_page_no); } /************************************************************************* Loading innobase/include/dict0crea.h +5 −2 Original line number Diff line number Diff line Loading @@ -56,14 +56,17 @@ dict_create_index_step( /*********************************************************************** Truncates the index tree associated with a row in SYS_INDEXES table. */ void ulint dict_truncate_index_tree( /*=====================*/ /* out: new root page number, or FIL_NULL on failure */ dict_table_t* table, /* in: the table the index belongs to */ rec_t* rec, /* in: record in the clustered index of SYS_INDEXES table */ mtr_t* mtr); /* in: mtr having the latch on the record page */ on the record page. The mtr may be committed and restarted in this call. */ /*********************************************************************** Drops the index tree associated with a row in SYS_INDEXES table. */ Loading innobase/include/page0cur.h +4 −3 Original line number Diff line number Diff line Loading @@ -184,6 +184,7 @@ page_cur_delete_rec( /*================*/ page_cur_t* cursor, /* in: a page cursor */ dict_index_t* index, /* in: record descriptor */ const ulint* offsets,/* in: rec_get_offsets(cursor->rec, index) */ mtr_t* mtr); /* in: mini-transaction handle */ /******************************************************************** Searches the right position for a page cursor. */ Loading innobase/include/page0page.h +1 −1 Original line number Diff line number Diff line Loading @@ -528,7 +528,7 @@ page_mem_free( /*==========*/ page_t* page, /* in: index page */ rec_t* rec, /* in: pointer to the (origin of) record */ dict_index_t* index); /* in: record descriptor */ const ulint* offsets);/* in: array returned by rec_get_offsets() */ /************************************************************** The index page creation function. */ Loading Loading
innobase/btr/btr0cur.c +19 −17 Original line number Diff line number Diff line Loading @@ -1642,7 +1642,7 @@ btr_cur_optimistic_update( btr_search_update_hash_on_delete(cursor); page_cur_delete_rec(page_cursor, index, mtr); page_cur_delete_rec(page_cursor, index, offsets, mtr); page_cur_move_to_prev(page_cursor); Loading Loading @@ -1885,7 +1885,7 @@ btr_cur_pessimistic_update( btr_search_update_hash_on_delete(cursor); page_cur_delete_rec(page_cursor, index, mtr); page_cur_delete_rec(page_cursor, index, offsets, mtr); page_cur_move_to_prev(page_cursor); Loading Loading @@ -2401,6 +2401,7 @@ btr_cur_optimistic_delete( mem_heap_t* heap = NULL; ulint offsets_[100] = { 100, }; ulint* offsets = offsets_; ibool no_compress_needed; ut_ad(mtr_memo_contains(mtr, buf_block_align(btr_cur_get_page(cursor)), MTR_MEMO_PAGE_X_FIX)); Loading @@ -2414,9 +2415,11 @@ btr_cur_optimistic_delete( offsets = rec_get_offsets(rec, cursor->index, offsets, ULINT_UNDEFINED, &heap); if (!rec_offs_any_extern(offsets) no_compress_needed = !rec_offs_any_extern(offsets) && btr_cur_can_delete_without_compress( cursor, rec_offs_size(offsets), mtr)) { cursor, rec_offs_size(offsets), mtr); if (no_compress_needed) { lock_update_delete(rec); Loading @@ -2425,20 +2428,17 @@ btr_cur_optimistic_delete( max_ins_size = page_get_max_insert_size_after_reorganize(page, 1); page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, mtr); cursor->index, offsets, mtr); ibuf_update_free_bits_low(cursor->index, page, max_ins_size, mtr); if (heap) { mem_heap_free(heap); } return(TRUE); } if (heap) { mem_heap_free(heap); } return(FALSE); return(no_compress_needed); } /***************************************************************** Loading Loading @@ -2478,6 +2478,7 @@ btr_cur_pessimistic_delete( ibool success; ibool ret = FALSE; mem_heap_t* heap; ulint* offsets; page = btr_cur_get_page(cursor); tree = btr_cur_get_tree(cursor); Loading @@ -2503,20 +2504,20 @@ btr_cur_pessimistic_delete( } } heap = mem_heap_create(256); heap = mem_heap_create(1024); rec = btr_cur_get_rec(cursor); offsets = rec_get_offsets(rec, cursor->index, NULL, ULINT_UNDEFINED, &heap); /* Free externally stored fields if the record is neither a node pointer nor in two-byte format. This avoids unnecessary calls to rec_get_offsets(). */ This avoids an unnecessary loop. */ if (cursor->index->table->comp ? !rec_get_node_ptr_flag(rec) : !rec_get_1byte_offs_flag(rec)) { btr_rec_free_externally_stored_fields(cursor->index, rec, rec_get_offsets(rec, cursor->index, NULL, ULINT_UNDEFINED, &heap), in_rollback, mtr); mem_heap_empty(heap); rec, offsets, in_rollback, mtr); } if ((page_get_n_recs(page) < 2) Loading Loading @@ -2568,7 +2569,8 @@ btr_cur_pessimistic_delete( btr_search_update_hash_on_delete(cursor); page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, mtr); page_cur_delete_rec(btr_cur_get_page_cur(cursor), cursor->index, offsets, mtr); ut_ad(btr_check_node_ptr(tree, page, mtr)); Loading
innobase/dict/dict0crea.c +36 −7 Original line number Diff line number Diff line Loading @@ -729,14 +729,17 @@ dict_drop_index_tree( /*********************************************************************** Truncates the index tree associated with a row in SYS_INDEXES table. */ void ulint dict_truncate_index_tree( /*=====================*/ /* out: new root page number, or FIL_NULL on failure */ dict_table_t* table, /* in: the table the index belongs to */ rec_t* rec, /* in: record in the clustered index of SYS_INDEXES table */ mtr_t* mtr) /* in: mtr having the latch on the record page */ on the record page. The mtr may be committed and restarted in this call. */ { ulint root_page_no; ulint space; Loading @@ -761,7 +764,10 @@ dict_truncate_index_tree( if (root_page_no == FIL_NULL) { /* The tree has been freed. */ return; ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Trying to TRUNCATE" " a missing index of table %s!\n", table->name); return(FIL_NULL); } ptr = rec_get_nth_field_old(rec, Loading @@ -775,7 +781,10 @@ dict_truncate_index_tree( /* It is a single table tablespace and the .ibd file is missing: do nothing */ return; ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Trying to TRUNCATE" " a missing .ibd file of table %s!\n", table->name); return(FIL_NULL); } ptr = rec_get_nth_field_old(rec, Loading @@ -801,6 +810,20 @@ dict_truncate_index_tree( space, root_page_no, RW_X_LATCH, mtr)); btr_free_root(space, root_page_no, mtr); /* We will temporarily write FIL_NULL to the PAGE_NO field in SYS_INDEXES, so that the database will not get into an inconsistent state in case it crashes between the mtr_commit() below and the following mtr_commit() call. */ page_rec_write_index_page_no(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, FIL_NULL, mtr); /* We will need to commit the mini-transaction in order to avoid deadlocks in the btr_create() call, because otherwise we would be freeing and allocating pages in the same mini-transaction. */ mtr_commit(mtr); /* mtr_commit() will invalidate rec. */ rec = NULL; mtr_start(mtr); /* Find the index corresponding to this SYS_INDEXES record. */ for (index = UT_LIST_GET_FIRST(table->indexes); Loading @@ -814,11 +837,17 @@ dict_truncate_index_tree( root_page_no = btr_create(type, space, index_id, comp, mtr); if (index) { index->tree->page = root_page_no; } else { ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Index %lu %lu of table %s is missing\n" "InnoDB: from the data dictionary during TRUNCATE!\n", ut_dulint_get_high(index_id), ut_dulint_get_low(index_id), table->name); } page_rec_write_index_page_no(rec, DICT_SYS_INDEXES_PAGE_NO_FIELD, root_page_no, mtr); return(root_page_no); } /************************************************************************* Loading
innobase/include/dict0crea.h +5 −2 Original line number Diff line number Diff line Loading @@ -56,14 +56,17 @@ dict_create_index_step( /*********************************************************************** Truncates the index tree associated with a row in SYS_INDEXES table. */ void ulint dict_truncate_index_tree( /*=====================*/ /* out: new root page number, or FIL_NULL on failure */ dict_table_t* table, /* in: the table the index belongs to */ rec_t* rec, /* in: record in the clustered index of SYS_INDEXES table */ mtr_t* mtr); /* in: mtr having the latch on the record page */ on the record page. The mtr may be committed and restarted in this call. */ /*********************************************************************** Drops the index tree associated with a row in SYS_INDEXES table. */ Loading
innobase/include/page0cur.h +4 −3 Original line number Diff line number Diff line Loading @@ -184,6 +184,7 @@ page_cur_delete_rec( /*================*/ page_cur_t* cursor, /* in: a page cursor */ dict_index_t* index, /* in: record descriptor */ const ulint* offsets,/* in: rec_get_offsets(cursor->rec, index) */ mtr_t* mtr); /* in: mini-transaction handle */ /******************************************************************** Searches the right position for a page cursor. */ Loading
innobase/include/page0page.h +1 −1 Original line number Diff line number Diff line Loading @@ -528,7 +528,7 @@ page_mem_free( /*==========*/ page_t* page, /* in: index page */ rec_t* rec, /* in: pointer to the (origin of) record */ dict_index_t* index); /* in: record descriptor */ const ulint* offsets);/* in: array returned by rec_get_offsets() */ /************************************************************** The index page creation function. */ Loading