|
1 | 1 | /*****************************************************************************
|
2 | 2 |
|
3 |
| -Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved. |
| 3 | +Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved. |
4 | 4 |
|
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
|
@@ -90,23 +90,23 @@ row_purge_reposition_pcur(
|
90 | 90 | purge_node_t* node, /*!< in: row purge node */
|
91 | 91 | mtr_t* mtr) /*!< in: mtr */
|
92 | 92 | {
|
93 |
| - ibool found; |
94 |
| - |
95 | 93 | if (node->found_clust) {
|
96 |
| - found = btr_pcur_restore_position(mode, &(node->pcur), mtr); |
| 94 | + ut_ad(row_purge_validate_pcur(node)); |
97 | 95 |
|
98 |
| - return(found); |
99 |
| - } |
| 96 | + node->found_clust = btr_pcur_restore_position( |
| 97 | + mode, &(node->pcur), mtr); |
| 98 | + |
| 99 | + } else { |
100 | 100 |
|
101 |
| - found = row_search_on_row_ref(&(node->pcur), mode, node->table, |
102 |
| - node->ref, mtr); |
103 |
| - node->found_clust = found; |
| 101 | + node->found_clust = row_search_on_row_ref( |
| 102 | + &(node->pcur), mode, node->table, node->ref, mtr); |
104 | 103 |
|
105 |
| - if (found) { |
106 |
| - btr_pcur_store_position(&(node->pcur), mtr); |
| 104 | + if (node->found_clust) { |
| 105 | + btr_pcur_store_position(&(node->pcur), mtr); |
| 106 | + } |
107 | 107 | }
|
108 | 108 |
|
109 |
| - return(found); |
| 109 | + return(node->found_clust); |
110 | 110 | }
|
111 | 111 |
|
112 | 112 | /***********************************************************//**
|
@@ -806,3 +806,51 @@ row_purge_step(
|
806 | 806 |
|
807 | 807 | return(thr);
|
808 | 808 | }
|
| 809 | + |
| 810 | +#ifdef UNIV_DEBUG |
| 811 | +/***********************************************************//** |
| 812 | +Validate the persisent cursor in the purge node. The purge node has two |
| 813 | +references to the clustered index record - one via the ref member, and the |
| 814 | +other via the persistent cursor. These two references must match each |
| 815 | +other if the found_clust flag is set. |
| 816 | +@return true if the persistent cursor is consistent with the ref member.*/ |
| 817 | +ibool |
| 818 | +row_purge_validate_pcur( |
| 819 | + purge_node_t* node) |
| 820 | +{ |
| 821 | + const rec_t* rec ; |
| 822 | + dict_index_t* clust_index; |
| 823 | + ulint* offsets; |
| 824 | + int st; |
| 825 | + |
| 826 | + if (!node->found_clust) { |
| 827 | + return(TRUE); |
| 828 | + } |
| 829 | + |
| 830 | + if (node->index == NULL) { |
| 831 | + return(TRUE); |
| 832 | + } |
| 833 | + |
| 834 | + clust_index = node->pcur.btr_cur.index; |
| 835 | + |
| 836 | + if (node->pcur.old_stored == BTR_PCUR_OLD_STORED) { |
| 837 | + rec = node->pcur.old_rec; |
| 838 | + } else { |
| 839 | + rec = btr_pcur_get_rec(&node->pcur); |
| 840 | + } |
| 841 | + |
| 842 | + offsets = rec_get_offsets(rec, |
| 843 | + clust_index, NULL, ULINT_UNDEFINED, &node->heap); |
| 844 | + |
| 845 | + st = cmp_dtuple_rec(node->ref, rec, offsets); |
| 846 | + |
| 847 | + if (st != 0) { |
| 848 | + fprintf(stderr, "Purge node pcur validation failed\n"); |
| 849 | + dtuple_print(stderr, node->ref); |
| 850 | + rec_print(stderr, rec, clust_index); |
| 851 | + return(FALSE); |
| 852 | + } |
| 853 | + |
| 854 | + return(TRUE); |
| 855 | +} |
| 856 | +#endif /* UNIV_DEBUG */ |
0 commit comments