~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/btr0btr.h

  • Committer: Olaf van der Spek
  • Date: 2011-02-12 18:24:24 UTC
  • mto: (2167.1.2 build) (2172.1.4 build)
  • mto: This revision was merged to the branch mainline in revision 2168.
  • Revision ID: olafvdspek@gmail.com-20110212182424-kgnm9osi7qo97at2
casts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1994, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (C) 1994, 2010, Innobase Oy. 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
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
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., 51 Franklin
 
15
St, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
68
68
        BTR_MODIFY_PREV = 36
69
69
};
70
70
 
 
71
/* BTR_INSERT, BTR_DELETE and BTR_DELETE_MARK are mutually exclusive. */
 
72
 
71
73
/** If this is ORed to btr_latch_mode, it means that the search tuple
72
 
will be inserted to the index, at the searched position */
 
74
will be inserted to the index, at the searched position.
 
75
When the record is not in the buffer pool, try to use the insert buffer. */
73
76
#define BTR_INSERT              512
74
77
 
75
78
/** This flag ORed to btr_latch_mode says that we do the search in query
76
79
optimization */
77
80
#define BTR_ESTIMATE            1024
78
81
 
79
 
/** This flag ORed to btr_latch_mode says that we can ignore possible
 
82
/** This flag ORed to BTR_INSERT says that we can ignore possible
80
83
UNIQUE definition on secondary indexes when we decide if we can use
81
84
the insert buffer to speed up inserts */
82
85
#define BTR_IGNORE_SEC_UNIQUE   2048
83
86
 
 
87
/** Try to delete mark the record at the searched position using the
 
88
insert/delete buffer when the record is not in the buffer pool. */
 
89
#define BTR_DELETE_MARK         4096
 
90
 
 
91
/** Try to purge the record at the searched position using the insert/delete
 
92
buffer when the record is not in the buffer pool. */
 
93
#define BTR_DELETE              8192
 
94
 
84
95
/**************************************************************//**
85
96
Gets the root node of a tree and x-latches it.
86
97
@return root page, x-latched */
94
105
Gets a buffer page and declares its latching order level. */
95
106
UNIV_INLINE
96
107
buf_block_t*
97
 
btr_block_get(
98
 
/*==========*/
99
 
        ulint   space,          /*!< in: space id */
100
 
        ulint   zip_size,       /*!< in: compressed page size in bytes
101
 
                                or 0 for uncompressed pages */
102
 
        ulint   page_no,        /*!< in: page number */
103
 
        ulint   mode,           /*!< in: latch mode */
104
 
        mtr_t*  mtr);           /*!< in: mtr */
105
 
/**************************************************************//**
106
 
Gets a buffer page and declares its latching order level. */
107
 
UNIV_INLINE
108
 
page_t*
109
 
btr_page_get(
110
 
/*=========*/
111
 
        ulint   space,          /*!< in: space id */
112
 
        ulint   zip_size,       /*!< in: compressed page size in bytes
113
 
                                or 0 for uncompressed pages */
114
 
        ulint   page_no,        /*!< in: page number */
115
 
        ulint   mode,           /*!< in: latch mode */
116
 
        mtr_t*  mtr);           /*!< in: mtr */
 
108
btr_block_get_func(
 
109
/*===============*/
 
110
        ulint           space,          /*!< in: space id */
 
111
        ulint           zip_size,       /*!< in: compressed page size in bytes
 
112
                                        or 0 for uncompressed pages */
 
113
        ulint           page_no,        /*!< in: page number */
 
114
        ulint           mode,           /*!< in: latch mode */
 
115
        const char*     file,           /*!< in: file name */
 
116
        ulint           line,           /*!< in: line where called */
 
117
        mtr_t*          mtr)            /*!< in/out: mtr */
 
118
        __attribute__((nonnull));
 
119
/** Gets a buffer page and declares its latching order level.
 
120
@param space    tablespace identifier
 
121
@param zip_size compressed page size in bytes or 0 for uncompressed pages
 
122
@param page_no  page number
 
123
@param mode     latch mode
 
124
@param mtr      mini-transaction handle
 
125
@return the block descriptor */
 
126
# define btr_block_get(space,zip_size,page_no,mode,mtr) \
 
127
        btr_block_get_func(space,zip_size,page_no,mode,__FILE__,__LINE__,mtr)
 
128
/** Gets a buffer page and declares its latching order level.
 
129
@param space    tablespace identifier
 
130
@param zip_size compressed page size in bytes or 0 for uncompressed pages
 
131
@param page_no  page number
 
132
@param mode     latch mode
 
133
@param mtr      mini-transaction handle
 
134
@return the uncompressed page frame */
 
135
# define btr_page_get(space,zip_size,page_no,mode,mtr) \
 
136
        buf_block_get_frame(btr_block_get(space,zip_size,page_no,mode,mtr))
117
137
#endif /* !UNIV_HOTBACKUP */
118
138
/**************************************************************//**
119
139
Gets the index id field of a page.
120
140
@return index id */
121
141
UNIV_INLINE
122
 
dulint
 
142
index_id_t
123
143
btr_page_get_index_id(
124
144
/*==================*/
125
145
        const page_t*   page);  /*!< in: index page */
193
213
        mtr_t*          mtr);           /*!< in: mtr */
194
214
/**************************************************************//**
195
215
Gets the child node file address in a node pointer.
 
216
NOTE: the offsets array must contain all offsets for the record since
 
217
we read the last field according to offsets and assume that it contains
 
218
the child page number. In other words offsets must have been retrieved
 
219
with rec_get_offsets(n_fields=ULINT_UNDEFINED).
196
220
@return child node address */
197
221
UNIV_INLINE
198
222
ulint
211
235
        ulint           space,  /*!< in: space where created */
212
236
        ulint           zip_size,/*!< in: compressed page size in bytes
213
237
                                or 0 for uncompressed pages */
214
 
        dulint          index_id,/*!< in: index id */
 
238
        index_id_t      index_id,/*!< in: index id */
215
239
        dict_index_t*   index,  /*!< in: index */
216
240
        mtr_t*          mtr);   /*!< in: mini-transaction handle */
217
241
/************************************************************//**
317
341
that mtr holds an x-latch on the tree. */
318
342
UNIV_INTERN
319
343
void
320
 
btr_insert_on_non_leaf_level(
321
 
/*=========================*/
 
344
btr_insert_on_non_leaf_level_func(
 
345
/*==============================*/
322
346
        dict_index_t*   index,  /*!< in: index */
323
347
        ulint           level,  /*!< in: level, must be > 0 */
324
348
        dtuple_t*       tuple,  /*!< in: the record to be inserted */
 
349
        const char*     file,   /*!< in: file name */
 
350
        ulint           line,   /*!< in: line where called */
325
351
        mtr_t*          mtr);   /*!< in: mtr */
 
352
# define btr_insert_on_non_leaf_level(i,l,t,m)                          \
 
353
        btr_insert_on_non_leaf_level_func(i,l,t,__FILE__,__LINE__,m)
326
354
#endif /* !UNIV_HOTBACKUP */
327
355
/****************************************************************//**
328
356
Sets a record as the predefined minimum record. */