29 #include "row0purge.ic"
72 ut_ad(parent && heap);
91 row_purge_reposition_pcur(
97 if (node->found_clust) {
100 found = btr_pcur_restore_position(mode, &node->
pcur, mtr);
107 if (node->found_clust) {
112 return(node->found_clust);
119 static __attribute__((nonnull, warn_unused_result))
121 row_purge_remove_clust_if_poss_low(
132 ulint offsets_[REC_OFFS_NORMAL_SIZE];
133 rec_offs_init(offsets_);
135 #ifdef UNIV_SYNC_DEBUG
139 index = dict_table_get_first_index(node->table);
144 if (!row_purge_reposition_pcur(mode, node, &mtr)) {
149 rec = btr_pcur_get_rec(&node->pcur);
151 offsets = rec_get_offsets(
152 rec, index, offsets_, ULINT_UNDEFINED, &heap);
160 success = btr_cur_optimistic_delete(
161 btr_pcur_get_btr_cur(&node->pcur), 0, &mtr);
166 &err, FALSE, btr_pcur_get_btr_cur(&node->pcur), 0,
172 case DB_OUT_OF_FILE_SPACE:
196 static __attribute__((nonnull, warn_unused_result))
198 row_purge_remove_clust_if_poss(
206 for (ulint n_tries = 0;
209 if (row_purge_remove_clust_if_poss_low(
251 btr_pcur_get_rec(&node->
pcur),
263 static __attribute__((nonnull, warn_unused_result))
265 row_purge_remove_sec_if_poss_tree(
273 ibool success = TRUE;
294 goto func_exit_no_pcur;
306 switch (search_result) {
331 btr_cur = btr_pcur_get_btr_cur(&pcur);
340 ut_ad(REC_INFO_DELETED_FLAG
346 switch (UNIV_EXPECT(err, DB_SUCCESS)) {
349 case DB_OUT_OF_FILE_SPACE:
370 static __attribute__((nonnull, warn_unused_result))
372 row_purge_remove_sec_if_poss_leaf(
401 goto func_exit_no_pcur;
421 index, entry, mode, &pcur, &mtr);
423 switch (search_result) {
428 btr_cur_t* btr_cur = btr_pcur_get_btr_cur(&pcur);
431 ut_ad(REC_INFO_DELETED_FLAG
433 btr_cur_get_rec(btr_cur),
436 if (!btr_cur_optimistic_delete(btr_cur, 0, &mtr)) {
462 UNIV_INLINE __attribute__((nonnull(1,2)))
464 row_purge_remove_sec_if_poss(
482 if (row_purge_remove_sec_if_poss_leaf(node, index, entry)) {
487 success = row_purge_remove_sec_if_poss_tree(node, index, entry);
492 if (!success && n_tries < BTR_CUR_RETRY_DELETE_N_TIMES) {
509 static __attribute__((nonnull, warn_unused_result))
519 while (node->index != NULL) {
521 dict_table_skip_corrupt_index(node->index);
527 if (node->index->type != DICT_FTS) {
529 node->row, NULL, node->index, heap);
530 row_purge_remove_sec_if_poss(node, node->index, entry);
534 node->index = dict_table_get_next_index(node->index);
539 return(row_purge_remove_clust_if_poss(node));
547 row_purge_upd_exist_or_extern_func(
557 #ifdef UNIV_SYNC_DEBUG
561 if (node->rec_type == TRX_UNDO_UPD_DEL_REC
562 || (node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
564 goto skip_secondaries;
569 while (node->index != NULL) {
570 dict_table_skip_corrupt_index(node->index);
576 if (row_upd_changes_ord_field_binary(node->index, node->update,
580 node->row, NULL, node->index, heap);
581 row_purge_remove_sec_if_poss(node, node->index, entry);
585 node->index = dict_table_get_next_index(node->index);
595 = upd_get_nth_field(node->update,
i);
600 ulint internal_offset;
617 dfield_get_data(&ufield->
new_val))
620 ut_a(internal_offset < UNIV_PAGE_SIZE);
623 &is_insert, &rseg_id,
628 ut_a(rseg->
id == rseg_id);
635 index = dict_table_get_first_index(node->table);
650 rseg->
space, 0, page_no, RW_X_LATCH, &mtr);
652 buf_block_dbg_add_level(block, SYNC_TRX_UNDO_PAGE);
654 data_field = buf_block_get_frame(block)
655 + offset + internal_offset;
663 NULL, NULL, NULL, 0,
RB_NONE, &mtr);
670 # define row_purge_upd_exist_or_extern(thr,node,undo_rec) \
671 row_purge_upd_exist_or_extern_func(thr,node,undo_rec)
673 # define row_purge_upd_exist_or_extern(thr,node,undo_rec) \
674 row_purge_upd_exist_or_extern_func(node,undo_rec)
682 row_purge_parse_undo_rec(
686 bool* updated_extern,
703 undo_rec, &type, &node->cmpl_info,
704 updated_extern, &undo_no, &table_id);
706 node->rec_type =
type;
708 if (type == TRX_UNDO_UPD_DEL_REC && !*updated_extern) {
725 if (node->
table == NULL) {
740 clust_index = dict_table_get_first_index(node->
table);
742 if (clust_index == NULL) {
753 if (type == TRX_UNDO_UPD_EXIST_REC
754 && (node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)
755 && !*updated_extern) {
767 roll_ptr, info_bits, trx,
772 if (!(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
774 ptr, clust_index, &node->
row,
775 type == TRX_UNDO_UPD_DEL_REC,
785 static __attribute__((nonnull, warn_unused_result))
787 row_purge_record_func(
800 clust_index = dict_table_get_first_index(node->table);
802 node->index = dict_table_get_next_index(clust_index);
804 switch (node->rec_type) {
805 case TRX_UNDO_DEL_MARK_REC:
806 purged = row_purge_del_mark(node);
813 if (!updated_extern) {
817 case TRX_UNDO_UPD_EXIST_REC:
818 row_purge_upd_exist_or_extern(thr, node, undo_rec);
823 if (node->found_clust) {
825 node->found_clust = FALSE;
828 if (node->table != NULL) {
837 # define row_purge_record(node,undo_rec,thr,updated_extern) \
838 row_purge_record_func(node,undo_rec,thr,updated_extern)
840 # define row_purge_record(node,undo_rec,thr,updated_extern) \
841 row_purge_record_func(node,undo_rec,updated_extern)
848 static __attribute__((nonnull))
859 while (row_purge_parse_undo_rec(
860 node, undo_rec, &updated_extern, thr)) {
862 bool purged = row_purge_record(
863 node, undo_rec, thr, updated_extern);
926 node->found_clust = FALSE;
927 node->rec_type = ULINT_UNDEFINED;
928 node->cmpl_info = ULINT_UNDEFINED;
940 node->roll_ptr = purge_rec->
roll_ptr;
942 row_purge(node, purge_rec->
undo_rec, thr);