1
1
/*****************************************************************************
3
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
3
Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved.
5
5
This program is free software; you can redistribute it and/or modify it under
6
6
the terms of the GNU General Public License as published by the Free Software
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
13
You should have received a copy of the GNU General Public License along with
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15
Place, Suite 330, Boston, MA 02111-1307 USA
14
this program; if not, write to the Free Software Foundation, Inc.,
15
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
17
17
*****************************************************************************/
387
387
marked record if that record contained an externally stored field. */
390
row_purge_upd_exist_or_extern(
391
/*==========================*/
390
row_purge_upd_exist_or_extern_func(
391
/*===============================*/
393
const que_thr_t*thr, /*!< in: query thread */
394
#endif /* UNIV_DEBUG */
392
395
purge_node_t* node) /*!< in: row purge node */
394
397
mem_heap_t* heap;
413
417
while (node->index != NULL) {
414
418
index = node->index;
416
if (row_upd_changes_ord_field_binary(NULL, node->index,
420
if (row_upd_changes_ord_field_binary(node->index, node->update,
418
422
/* Build the older version of the index entry */
419
423
entry = row_build_index_entry(node->row, NULL,
504
# define row_purge_upd_exist_or_extern(thr,node) \
505
row_purge_upd_exist_or_extern_func(thr,node)
506
#else /* UNIV_DEBUG */
507
# define row_purge_upd_exist_or_extern(thr,node) \
508
row_purge_upd_exist_or_extern_func(node)
509
#endif /* UNIV_DEBUG */
499
511
/***********************************************************//**
500
512
Parses the row reference and other info in a modify undo log record.
501
513
@return TRUE if purge operation required: NOTE that then the CALLER
519
531
roll_ptr_t roll_ptr;
524
535
ut_ad(node && thr);
526
537
trx = thr_get_trx(thr);
528
ptr = trx_undo_rec_get_pars(node->undo_rec, &type, &cmpl_info,
529
updated_extern, &undo_no, &table_id);
539
ptr = trx_undo_rec_get_pars(
540
node->undo_rec, &type, &node->cmpl_info,
541
updated_extern, &undo_no, &table_id);
530
542
node->rec_type = type;
532
544
if (type == TRX_UNDO_UPD_DEL_REC && !(*updated_extern)) {
590
603
/* Read to the partial row the fields that occur in indexes */
592
if (!(cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
605
if (!(node->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) {
593
606
ptr = trx_undo_rec_get_partial_row(
594
607
ptr, clust_index, &node->row,
595
608
type == TRX_UNDO_UPD_DEL_REC,
602
615
/***********************************************************//**
603
616
Fetches an undo log record and does the purge for the recorded operation.
604
617
If none left, or the current purge completed, returns the control to the
605
parent node, which is always a query thread node.
606
@return DB_SUCCESS if operation successfully completed, else error code */
618
parent node, which is always a query thread node. */
619
static __attribute__((nonnull))
611
623
purge_node_t* node, /*!< in: row purge node */
612
624
que_thr_t* thr) /*!< in: query thread */
616
626
ibool updated_extern;
621
trx = thr_get_trx(thr);
623
node->undo_rec = trx_purge_fetch_next_rec(&roll_ptr,
624
&(node->reservation),
631
node->undo_rec = trx_purge_fetch_next_rec(&node->roll_ptr,
626
634
if (!node->undo_rec) {
627
635
/* Purge completed for this query thread */
629
637
thr->run_node = que_node_get_parent(node);
634
node->roll_ptr = roll_ptr;
636
if (node->undo_rec == &trx_purge_dummy_rec) {
637
purge_needed = FALSE;
639
purge_needed = row_purge_parse_undo_rec(node, &updated_extern,
641
/* If purge_needed == TRUE, we must also remember to unfreeze
642
if (node->undo_rec != &trx_purge_dummy_rec
643
&& row_purge_parse_undo_rec(node, &updated_extern, thr)) {
646
644
node->found_clust = FALSE;
648
646
node->index = dict_table_get_next_index(
654
652
} else if (updated_extern
655
653
|| node->rec_type == TRX_UNDO_UPD_EXIST_REC) {
657
row_purge_upd_exist_or_extern(node);
655
row_purge_upd_exist_or_extern(thr, node);
660
658
if (node->found_clust) {
661
659
btr_pcur_close(&(node->pcur));
664
row_mysql_unfreeze_data_dictionary(trx);
662
row_mysql_unfreeze_data_dictionary(thr_get_trx(thr));
667
665
/* Do some cleanup */