~vadim-tk/percona-server/percona-5.5.15-galera

« back to all changes in this revision

Viewing changes to storage/innobase/include/row0purge.h

  • Committer: root
  • Date: 2011-09-10 16:37:18 UTC
  • Revision ID: root@r815.office.percona.com-20110910163718-ydh4zj8hcdgoyavb
Porting Galera to 5.5.15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 
 
3
Copyright (c) 1997, 2009, Innobase Oy. All Rights Reserved.
 
4
 
 
5
This program is free software; you can redistribute it and/or modify it under
 
6
the terms of the GNU General Public License as published by the Free Software
 
7
Foundation; version 2 of the License.
 
8
 
 
9
This program is distributed in the hope that it will be useful, but WITHOUT
 
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 
12
 
 
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
 
16
 
 
17
*****************************************************************************/
 
18
 
 
19
/**************************************************//**
 
20
@file include/row0purge.h
 
21
Purge obsolete records
 
22
 
 
23
Created 3/14/1997 Heikki Tuuri
 
24
*******************************************************/
 
25
 
 
26
#ifndef row0purge_h
 
27
#define row0purge_h
 
28
 
 
29
#include "univ.i"
 
30
#include "data0data.h"
 
31
#include "btr0types.h"
 
32
#include "btr0pcur.h"
 
33
#include "dict0types.h"
 
34
#include "trx0types.h"
 
35
#include "que0types.h"
 
36
#include "row0types.h"
 
37
 
 
38
/********************************************************************//**
 
39
Creates a purge node to a query graph.
 
40
@return own: purge node */
 
41
UNIV_INTERN
 
42
purge_node_t*
 
43
row_purge_node_create(
 
44
/*==================*/
 
45
        que_thr_t*      parent, /*!< in: parent node, i.e., a thr node */
 
46
        mem_heap_t*     heap);  /*!< in: memory heap where created */
 
47
/***********************************************************//**
 
48
Determines if it is possible to remove a secondary index entry.
 
49
Removal is possible if the secondary index entry does not refer to any
 
50
not delete marked version of a clustered index record where DB_TRX_ID
 
51
is newer than the purge view.
 
52
 
 
53
NOTE: This function should only be called by the purge thread, only
 
54
while holding a latch on the leaf page of the secondary index entry
 
55
(or keeping the buffer pool watch on the page).  It is possible that
 
56
this function first returns TRUE and then FALSE, if a user transaction
 
57
inserts a record that the secondary index entry would refer to.
 
58
However, in that case, the user transaction would also re-insert the
 
59
secondary index entry after purge has removed it and released the leaf
 
60
page latch.
 
61
@return TRUE if the secondary index record can be purged */
 
62
UNIV_INTERN
 
63
ibool
 
64
row_purge_poss_sec(
 
65
/*===============*/
 
66
        purge_node_t*   node,   /*!< in/out: row purge node */
 
67
        dict_index_t*   index,  /*!< in: secondary index */
 
68
        const dtuple_t* entry); /*!< in: secondary index entry */
 
69
/***************************************************************
 
70
Does the purge operation for a single undo log record. This is a high-level
 
71
function used in an SQL execution graph.
 
72
@return query thread to run next or NULL */
 
73
UNIV_INTERN
 
74
que_thr_t*
 
75
row_purge_step(
 
76
/*===========*/
 
77
        que_thr_t*      thr);   /*!< in: query thread */
 
78
 
 
79
/* Purge node structure */
 
80
 
 
81
struct purge_node_struct{
 
82
        que_common_t    common; /*!< node type: QUE_NODE_PURGE */
 
83
        /*----------------------*/
 
84
        /* Local storage for this graph node */
 
85
        roll_ptr_t      roll_ptr;/* roll pointer to undo log record */
 
86
        trx_undo_rec_t* undo_rec;/* undo log record */
 
87
        trx_undo_inf_t* reservation;/* reservation for the undo log record in
 
88
                                the purge array */
 
89
        undo_no_t       undo_no;/* undo number of the record */
 
90
        ulint           rec_type;/* undo log record type: TRX_UNDO_INSERT_REC,
 
91
                                ... */
 
92
        btr_pcur_t      pcur;   /*!< persistent cursor used in searching the
 
93
                                clustered index record */
 
94
        ibool           found_clust;/* TRUE if the clustered index record
 
95
                                determined by ref was found in the clustered
 
96
                                index, and we were able to position pcur on
 
97
                                it */
 
98
        dict_table_t*   table;  /*!< table where purge is done */
 
99
        ulint           cmpl_info;/* compiler analysis info of an update */
 
100
        upd_t*          update; /*!< update vector for a clustered index
 
101
                                record */
 
102
        dtuple_t*       ref;    /*!< NULL, or row reference to the next row to
 
103
                                handle */
 
104
        dtuple_t*       row;    /*!< NULL, or a copy (also fields copied to
 
105
                                heap) of the indexed fields of the row to
 
106
                                handle */
 
107
        dict_index_t*   index;  /*!< NULL, or the next index whose record should
 
108
                                be handled */
 
109
        mem_heap_t*     heap;   /*!< memory heap used as auxiliary storage for
 
110
                                row; this must be emptied after a successful
 
111
                                purge of a row */
 
112
};
 
113
 
 
114
#ifndef UNIV_NONINL
 
115
#include "row0purge.ic"
 
116
#endif
 
117
 
 
118
#endif