Drizzled Public API Documentation

btr0btr.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (C) 1994, 2010, 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., 51 Franklin
15 St, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
26 #pragma once
27 #ifndef btr0btr_h
28 #define btr0btr_h
29 
30 #include "univ.i"
31 
32 #include "dict0dict.h"
33 #include "data0data.h"
34 #include "page0cur.h"
35 #include "mtr0mtr.h"
36 #include "btr0types.h"
37 
38 #ifndef UNIV_HOTBACKUP
39 
41 #define BTR_PAGE_MAX_REC_SIZE (UNIV_PAGE_SIZE / 2 - 200)
42 
52 #define BTR_MAX_LEVELS 100
53 
57  BTR_SEARCH_LEAF = RW_S_LATCH,
59  BTR_MODIFY_LEAF = RW_X_LATCH,
61  BTR_NO_LATCHES = RW_NO_LATCH,
70 };
71 
72 /* BTR_INSERT, BTR_DELETE and BTR_DELETE_MARK are mutually exclusive. */
73 
77 #define BTR_INSERT 512
78 
81 #define BTR_ESTIMATE 1024
82 
86 #define BTR_IGNORE_SEC_UNIQUE 2048
87 
90 #define BTR_DELETE_MARK 4096
91 
94 #define BTR_DELETE 8192
95 
96 /**************************************************************/
99 UNIV_INTERN
100 page_t*
101 btr_root_get(
102 /*=========*/
103  dict_index_t* index,
104  mtr_t* mtr);
105 /**************************************************************/
107 UNIV_INLINE
110 /*===============*/
111  ulint space,
112  ulint zip_size,
114  ulint page_no,
115  ulint mode,
116  const char* file,
117  ulint line,
118  mtr_t* mtr)
119  __attribute__((nonnull));
127 # define btr_block_get(space,zip_size,page_no,mode,mtr) \
128  btr_block_get_func(space,zip_size,page_no,mode,__FILE__,__LINE__,mtr)
129 
136 # define btr_page_get(space,zip_size,page_no,mode,mtr) \
137  buf_block_get_frame(btr_block_get(space,zip_size,page_no,mode,mtr))
138 #endif /* !UNIV_HOTBACKUP */
139 /**************************************************************/
142 UNIV_INLINE
143 index_id_t
145 /*==================*/
146  const page_t* page);
147 #ifndef UNIV_HOTBACKUP
148 /********************************************************/
151 UNIV_INLINE
152 ulint
154 /*===================*/
155  const page_t* page);
156 /********************************************************/
159 UNIV_INLINE
160 ulint
162 /*===============*/
163  const page_t* page,
164  mtr_t* mtr);
165 /********************************************************/
168 UNIV_INLINE
169 ulint
171 /*==============*/
172  const page_t* page,
173  mtr_t* mtr);
174 /********************************************************/
177 UNIV_INLINE
178 ulint
180 /*==============*/
181  const page_t* page,
182  mtr_t* mtr);
183 /*************************************************************/
187 UNIV_INTERN
188 rec_t*
189 btr_get_prev_user_rec(
190 /*==================*/
191  rec_t* rec,
192  mtr_t* mtr);
194 /*************************************************************/
198 UNIV_INTERN
199 rec_t*
200 btr_get_next_user_rec(
201 /*==================*/
202  rec_t* rec,
203  mtr_t* mtr);
205 /**************************************************************/
207 UNIV_INLINE
208 void
210 /*==================*/
211  buf_block_t* block,
212  ulint latch_mode,
214  mtr_t* mtr);
215 /**************************************************************/
222 UNIV_INLINE
223 ulint
225 /*===========================*/
226  const rec_t* rec,
227  const ulint* offsets);
228 /************************************************************/
231 UNIV_INTERN
232 ulint
233 btr_create(
234 /*=======*/
235  ulint type,
236  ulint space,
237  ulint zip_size,
239  index_id_t index_id,
240  dict_index_t* index,
241  mtr_t* mtr);
242 /************************************************************/
245 UNIV_INTERN
246 void
247 btr_free_but_not_root(
248 /*==================*/
249  ulint space,
250  ulint zip_size,
252  ulint root_page_no);
253 /************************************************************/
255 UNIV_INTERN
256 void
257 btr_free_root(
258 /*==========*/
259  ulint space,
260  ulint zip_size,
262  ulint root_page_no,
263  mtr_t* mtr);
265 /*************************************************************/
272 UNIV_INTERN
273 rec_t*
274 btr_root_raise_and_insert(
275 /*======================*/
276  btr_cur_t* cursor,
280  const dtuple_t* tuple,
281  ulint n_ext,
282  mtr_t* mtr);
283 /*************************************************************/
290 UNIV_INTERN
291 ibool
292 btr_page_reorganize(
293 /*================*/
294  buf_block_t* block,
295  dict_index_t* index,
296  mtr_t* mtr);
297 /*************************************************************/
301 UNIV_INTERN
302 ibool
303 btr_page_get_split_rec_to_left(
304 /*===========================*/
305  btr_cur_t* cursor,
306  rec_t** split_rec);
309 /*************************************************************/
313 UNIV_INTERN
314 ibool
315 btr_page_get_split_rec_to_right(
316 /*============================*/
317  btr_cur_t* cursor,
318  rec_t** split_rec);
321 /*************************************************************/
330 UNIV_INTERN
331 rec_t*
332 btr_page_split_and_insert(
333 /*======================*/
334  btr_cur_t* cursor,
337  const dtuple_t* tuple,
338  ulint n_ext,
339  mtr_t* mtr);
340 /*******************************************************/
343 UNIV_INTERN
344 void
345 btr_insert_on_non_leaf_level_func(
346 /*==============================*/
347  dict_index_t* index,
348  ulint level,
349  dtuple_t* tuple,
350  const char* file,
351  ulint line,
352  mtr_t* mtr);
353 # define btr_insert_on_non_leaf_level(i,l,t,m) \
354  btr_insert_on_non_leaf_level_func(i,l,t,__FILE__,__LINE__,m)
355 #endif /* !UNIV_HOTBACKUP */
356 /****************************************************************/
358 UNIV_INTERN
359 void
360 btr_set_min_rec_mark(
361 /*=================*/
362  rec_t* rec,
363  mtr_t* mtr);
364 #ifndef UNIV_HOTBACKUP
365 /*************************************************************/
367 UNIV_INTERN
368 void
369 btr_node_ptr_delete(
370 /*================*/
371  dict_index_t* index,
372  buf_block_t* block,
373  mtr_t* mtr);
374 #ifdef UNIV_DEBUG
375 /************************************************************/
378 UNIV_INTERN
379 ibool
380 btr_check_node_ptr(
381 /*===============*/
382  dict_index_t* index,
383  buf_block_t* block,
384  mtr_t* mtr);
385 #endif /* UNIV_DEBUG */
386 /*************************************************************/
396 UNIV_INTERN
397 ibool
398 btr_compress(
399 /*=========*/
400  btr_cur_t* cursor,
404  mtr_t* mtr);
405 /*************************************************************/
409 UNIV_INTERN
410 void
411 btr_discard_page(
412 /*=============*/
413  btr_cur_t* cursor,
415  mtr_t* mtr);
416 #endif /* !UNIV_HOTBACKUP */
417 /****************************************************************/
421 UNIV_INTERN
422 byte*
423 btr_parse_set_min_rec_mark(
424 /*=======================*/
425  byte* ptr,
426  byte* end_ptr,
427  ulint comp,
428  page_t* page,
429  mtr_t* mtr);
430 /***********************************************************/
433 UNIV_INTERN
434 byte*
435 btr_parse_page_reorganize(
436 /*======================*/
437  byte* ptr,
438  byte* end_ptr,
439  dict_index_t* index,
440  buf_block_t* block,
441  mtr_t* mtr);
442 #ifndef UNIV_HOTBACKUP
443 /**************************************************************/
446 UNIV_INTERN
447 ulint
448 btr_get_size(
449 /*=========*/
450  dict_index_t* index,
451  ulint flag);
452 /**************************************************************/
456 UNIV_INTERN
458 btr_page_alloc(
459 /*===========*/
460  dict_index_t* index,
461  ulint hint_page_no,
462  byte file_direction,
464  ulint level,
466  mtr_t* mtr);
467 /**************************************************************/
470 UNIV_INTERN
471 void
472 btr_page_free(
473 /*==========*/
474  dict_index_t* index,
475  buf_block_t* block,
476  mtr_t* mtr);
477 /**************************************************************/
481 UNIV_INTERN
482 void
483 btr_page_free_low(
484 /*==============*/
485  dict_index_t* index,
486  buf_block_t* block,
487  ulint level,
488  mtr_t* mtr);
489 #ifdef UNIV_BTR_PRINT
490 /*************************************************************/
492 UNIV_INTERN
493 void
494 btr_print_size(
495 /*===========*/
496  dict_index_t* index);
497 /**************************************************************/
499 UNIV_INTERN
500 void
501 btr_print_index(
502 /*============*/
503  dict_index_t* index,
504  ulint width);
506 #endif /* UNIV_BTR_PRINT */
507 /************************************************************/
511 UNIV_INTERN
512 ibool
513 btr_index_rec_validate(
514 /*===================*/
515  const rec_t* rec,
516  const dict_index_t* index,
517  ibool dump_on_error);
520 /**************************************************************/
523 UNIV_INTERN
524 ibool
525 btr_validate_index(
526 /*===============*/
527  dict_index_t* index,
528  trx_t* trx);
530 #define BTR_N_LEAF_PAGES 1
531 #define BTR_TOTAL_SIZE 2
532 #endif /* !UNIV_HOTBACKUP */
533 
534 #ifndef UNIV_NONINL
535 #include "btr0btr.ic"
536 #endif
537 
538 #endif