drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
btr0btr.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (C) 1994, 2010, Innobase Oy. All Rights Reserved.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License as published by the Free Software
7Foundation; version 2 of the License.
8
9This program is distributed in the hope that it will be useful, but WITHOUT
10ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License along with
14this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
15St, Fifth Floor, Boston, MA 02110-1301 USA
16
17*****************************************************************************/
18
19/**************************************************/
25
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
41#define BTR_PAGE_MAX_REC_SIZE (UNIV_PAGE_SIZE / 2 - 200)
42
52#define BTR_MAX_LEVELS 100
53
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#ifdef UNIV_BLOB_DEBUG
97# include "ut0rbt.h"
99struct btr_blob_dbg_struct
100{
101 unsigned blob_page_no:32;
102 unsigned ref_page_no:32;
103 unsigned ref_heap_no:16;
104 unsigned ref_field_no:10;
105 unsigned owner:1;
106 unsigned always_owner:1;
110 unsigned del:1;
112};
113
114/**************************************************************/
116UNIV_INTERN
117void
118btr_blob_dbg_add_blob(
119/*==================*/
120 const rec_t* rec,
121 ulint field_no,
122 ulint page_no,
123 dict_index_t* index,
124 const char* ctx)
125 __attribute__((nonnull));
126/**************************************************************/
130UNIV_INTERN
131void
132btr_blob_dbg_print(
133/*===============*/
134 const dict_index_t* index)
135 __attribute__((nonnull));
136/**************************************************************/
140UNIV_INTERN
141ibool
142btr_blob_dbg_is_empty(
143/*==================*/
144 dict_index_t* index,
145 ulint page_no)
146 __attribute__((nonnull, warn_unused_result));
147
148/**************************************************************/
150UNIV_INTERN
151void
152btr_blob_dbg_set_deleted_flag(
153/*==========================*/
154 const rec_t* rec,
155 dict_index_t* index,
156 const ulint* offsets,
157 ibool del)
158 __attribute__((nonnull));
159/**************************************************************/
161UNIV_INTERN
162void
163btr_blob_dbg_owner(
164/*===============*/
165 const rec_t* rec,
166 dict_index_t* index,
167 const ulint* offsets,
168 ulint i,
169 ibool own)
170 __attribute__((nonnull));
172# define btr_blob_dbg_assert_empty(index, page_no) \
173 ut_a(btr_blob_dbg_is_empty(index, page_no))
174#else /* UNIV_BLOB_DEBUG */
175# define btr_blob_dbg_add_blob(rec, field_no, page, index, ctx) ((void) 0)
176# define btr_blob_dbg_set_deleted_flag(rec, index, offsets, del)((void) 0)
177# define btr_blob_dbg_owner(rec, index, offsets, i, val) ((void) 0)
178# define btr_blob_dbg_assert_empty(index, page_no) ((void) 0)
179#endif /* UNIV_BLOB_DEBUG */
180
181/**************************************************************/
184UNIV_INTERN
185page_t*
187/*=========*/
188 dict_index_t* index,
189 mtr_t* mtr);
190/**************************************************************/
192UNIV_INLINE
195/*===============*/
196 ulint space,
197 ulint zip_size,
199 ulint page_no,
200 ulint mode,
201 const char* file,
202 ulint line,
203 mtr_t* mtr)
204 __attribute__((nonnull));
212# define btr_block_get(space,zip_size,page_no,mode,mtr) \
213 btr_block_get_func(space,zip_size,page_no,mode,__FILE__,__LINE__,mtr)
214
221# define btr_page_get(space,zip_size,page_no,mode,mtr) \
222 buf_block_get_frame(btr_block_get(space,zip_size,page_no,mode,mtr))
223#endif /* !UNIV_HOTBACKUP */
224/**************************************************************/
227UNIV_INLINE
228index_id_t
230/*==================*/
231 const page_t* page);
232#ifndef UNIV_HOTBACKUP
233/********************************************************/
236UNIV_INLINE
237ulint
239/*===================*/
240 const page_t* page);
241/********************************************************/
244UNIV_INLINE
245ulint
247/*===============*/
248 const page_t* page,
249 mtr_t* mtr);
250/********************************************************/
253UNIV_INLINE
254ulint
256/*==============*/
257 const page_t* page,
258 mtr_t* mtr);
259/********************************************************/
262UNIV_INLINE
263ulint
265/*==============*/
266 const page_t* page,
267 mtr_t* mtr);
268/*************************************************************/
272UNIV_INTERN
273rec_t*
275/*==================*/
276 rec_t* rec,
277 mtr_t* mtr);
279/*************************************************************/
283UNIV_INTERN
284rec_t*
286/*==================*/
287 rec_t* rec,
288 mtr_t* mtr);
290/**************************************************************/
292UNIV_INLINE
293void
295/*==================*/
296 buf_block_t* block,
297 ulint latch_mode,
299 mtr_t* mtr);
300/**************************************************************/
307UNIV_INLINE
308ulint
310/*===========================*/
311 const rec_t* rec,
312 const ulint* offsets);
313/************************************************************/
316UNIV_INTERN
317ulint
319/*=======*/
320 ulint type,
321 ulint space,
322 ulint zip_size,
324 index_id_t index_id,
325 dict_index_t* index,
326 mtr_t* mtr);
327/************************************************************/
330UNIV_INTERN
331void
333/*==================*/
334 ulint space,
335 ulint zip_size,
337 ulint root_page_no);
338/************************************************************/
340UNIV_INTERN
341void
343/*==========*/
344 ulint space,
345 ulint zip_size,
347 ulint root_page_no,
348 mtr_t* mtr);
350/*************************************************************/
357UNIV_INTERN
358rec_t*
360/*======================*/
361 btr_cur_t* cursor,
365 const dtuple_t* tuple,
366 ulint n_ext,
367 mtr_t* mtr);
368/*************************************************************/
375UNIV_INTERN
376ibool
378/*================*/
379 buf_block_t* block,
380 dict_index_t* index,
381 mtr_t* mtr);
382/*************************************************************/
386UNIV_INTERN
387ibool
389/*===========================*/
390 btr_cur_t* cursor,
391 rec_t** split_rec);
394/*************************************************************/
398UNIV_INTERN
399ibool
401/*============================*/
402 btr_cur_t* cursor,
403 rec_t** split_rec);
406/*************************************************************/
415UNIV_INTERN
416rec_t*
418/*======================*/
419 btr_cur_t* cursor,
422 const dtuple_t* tuple,
423 ulint n_ext,
424 mtr_t* mtr);
425/*******************************************************/
428UNIV_INTERN
429void
431/*==============================*/
432 dict_index_t* index,
433 ulint level,
434 dtuple_t* tuple,
435 const char* file,
436 ulint line,
437 mtr_t* mtr);
438# define btr_insert_on_non_leaf_level(i,l,t,m) \
439 btr_insert_on_non_leaf_level_func(i,l,t,__FILE__,__LINE__,m)
440#endif /* !UNIV_HOTBACKUP */
441/****************************************************************/
443UNIV_INTERN
444void
446/*=================*/
447 rec_t* rec,
448 mtr_t* mtr);
449#ifndef UNIV_HOTBACKUP
450/*************************************************************/
452UNIV_INTERN
453void
455/*================*/
456 dict_index_t* index,
457 buf_block_t* block,
458 mtr_t* mtr);
459#ifdef UNIV_DEBUG
460/************************************************************/
463UNIV_INTERN
464ibool
465btr_check_node_ptr(
466/*===============*/
467 dict_index_t* index,
468 buf_block_t* block,
469 mtr_t* mtr);
470#endif /* UNIV_DEBUG */
471/*************************************************************/
481UNIV_INTERN
482ibool
484/*=========*/
485 btr_cur_t* cursor,
489 mtr_t* mtr);
490/*************************************************************/
494UNIV_INTERN
495void
497/*=============*/
498 btr_cur_t* cursor,
500 mtr_t* mtr);
501#endif /* !UNIV_HOTBACKUP */
502/****************************************************************/
506UNIV_INTERN
507byte*
509/*=======================*/
510 byte* ptr,
511 byte* end_ptr,
512 ulint comp,
513 page_t* page,
514 mtr_t* mtr);
515/***********************************************************/
518UNIV_INTERN
519byte*
521/*======================*/
522 byte* ptr,
523 byte* end_ptr,
524 dict_index_t* index,
525 buf_block_t* block,
526 mtr_t* mtr);
527#ifndef UNIV_HOTBACKUP
528/**************************************************************/
531UNIV_INTERN
532ulint
534/*=========*/
535 dict_index_t* index,
536 ulint flag);
537/**************************************************************/
541UNIV_INTERN
544/*===========*/
545 dict_index_t* index,
546 ulint hint_page_no,
547 byte file_direction,
549 ulint level,
551 mtr_t* mtr);
552/**************************************************************/
555UNIV_INTERN
556void
558/*==========*/
559 dict_index_t* index,
560 buf_block_t* block,
561 mtr_t* mtr);
562/**************************************************************/
566UNIV_INTERN
567void
569/*==============*/
570 dict_index_t* index,
571 buf_block_t* block,
572 ulint level,
573 mtr_t* mtr);
574#ifdef UNIV_BTR_PRINT
575/*************************************************************/
577UNIV_INTERN
578void
579btr_print_size(
580/*===========*/
581 dict_index_t* index);
582/**************************************************************/
584UNIV_INTERN
585void
586btr_print_index(
587/*============*/
588 dict_index_t* index,
589 ulint width);
591#endif /* UNIV_BTR_PRINT */
592/************************************************************/
596UNIV_INTERN
597ibool
599/*===================*/
600 const rec_t* rec,
601 const dict_index_t* index,
602 ibool dump_on_error);
605/**************************************************************/
608UNIV_INTERN
609ibool
611/*===============*/
612 dict_index_t* index,
613 trx_t* trx);
614
615#define BTR_N_LEAF_PAGES 1
616#define BTR_TOTAL_SIZE 2
617#endif /* !UNIV_HOTBACKUP */
618
619#ifndef UNIV_NONINL
620#include "btr0btr.ic"
621#endif
622
623#endif
UNIV_INTERN ibool btr_page_reorganize(buf_block_t *block, dict_index_t *index, mtr_t *mtr)
Definition btr0btr.cc:1671
UNIV_INTERN ibool btr_index_rec_validate(const rec_t *rec, const dict_index_t *index, ibool dump_on_error)
Definition btr0btr.cc:3772
UNIV_INTERN void btr_set_min_rec_mark(rec_t *rec, mtr_t *mtr)
Definition btr0btr.cc:2920
UNIV_INTERN void btr_page_free(dict_index_t *index, buf_block_t *block, mtr_t *mtr)
Definition btr0btr.cc:1074
UNIV_INTERN ulint btr_get_size(dict_index_t *index, ulint flag)
Definition btr0btr.cc:963
UNIV_INTERN void btr_free_root(ulint space, ulint zip_size, ulint root_page_no, mtr_t *mtr)
Definition btr0btr.cc:1476
UNIV_INTERN byte * btr_parse_set_min_rec_mark(byte *ptr, byte *end_ptr, ulint comp, page_t *page, mtr_t *mtr)
Definition btr0btr.cc:2890
UNIV_INTERN page_t * btr_root_get(dict_index_t *index, mtr_t *mtr)
Definition btr0btr.cc:715
UNIV_INTERN ulint btr_create(ulint type, ulint space, ulint zip_size, index_id_t index_id, dict_index_t *index, mtr_t *mtr)
Definition btr0btr.cc:1287
UNIV_INTERN void btr_free_but_not_root(ulint space, ulint zip_size, ulint root_page_no)
Definition btr0btr.cc:1420
UNIV_INTERN ibool btr_page_get_split_rec_to_right(btr_cur_t *cursor, rec_t **split_rec)
Definition btr0btr.cc:1966
UNIV_INTERN ibool btr_compress(btr_cur_t *cursor, mtr_t *mtr)
Definition btr0btr.cc:3106
UNIV_INLINE ulint btr_page_get_level_low(const page_t *page)
UNIV_INLINE ulint btr_page_get_level(const page_t *page, mtr_t *mtr)
UNIV_INTERN rec_t * btr_page_split_and_insert(btr_cur_t *cursor, const dtuple_t *tuple, ulint n_ext, mtr_t *mtr)
Definition btr0btr.cc:2445
UNIV_INTERN void btr_page_free_low(dict_index_t *index, buf_block_t *block, ulint level, mtr_t *mtr)
Definition btr0btr.cc:1032
UNIV_INLINE index_id_t btr_page_get_index_id(const page_t *page)
UNIV_INTERN ibool btr_validate_index(dict_index_t *index, trx_t *trx)
Definition btr0btr.cc:4300
UNIV_INLINE void btr_leaf_page_release(buf_block_t *block, ulint latch_mode, mtr_t *mtr)
UNIV_INLINE ulint btr_node_ptr_get_child_page_no(const rec_t *rec, const ulint *offsets)
btr_latch_mode
Definition btr0btr.h:55
@ BTR_CONT_MODIFY_TREE
Definition btr0btr.h:65
@ BTR_MODIFY_TREE
Definition btr0btr.h:63
@ BTR_MODIFY_LEAF
Definition btr0btr.h:59
@ BTR_SEARCH_PREV
Definition btr0btr.h:67
@ BTR_NO_LATCHES
Definition btr0btr.h:61
@ BTR_SEARCH_LEAF
Definition btr0btr.h:57
@ BTR_MODIFY_PREV
Definition btr0btr.h:69
UNIV_INTERN rec_t * btr_get_next_user_rec(rec_t *rec, mtr_t *mtr)
Definition btr0btr.cc:787
UNIV_INTERN rec_t * btr_root_raise_and_insert(btr_cur_t *cursor, const dtuple_t *tuple, ulint n_ext, mtr_t *mtr)
Definition btr0btr.cc:1752
UNIV_INLINE buf_block_t * btr_block_get_func(ulint space, ulint zip_size, ulint page_no, ulint mode, const char *file, ulint line, mtr_t *mtr) __attribute__((nonnull))
UNIV_INTERN void btr_discard_page(btr_cur_t *cursor, mtr_t *mtr)
Definition btr0btr.cc:3464
UNIV_INTERN rec_t * btr_get_prev_user_rec(rec_t *rec, mtr_t *mtr)
Definition btr0btr.cc:729
UNIV_INTERN byte * btr_parse_page_reorganize(byte *ptr, byte *end_ptr, dict_index_t *index, buf_block_t *block, mtr_t *mtr)
Definition btr0btr.cc:1686
UNIV_INLINE ulint btr_page_get_next(const page_t *page, mtr_t *mtr)
UNIV_INTERN void btr_insert_on_non_leaf_level_func(dict_index_t *index, ulint level, dtuple_t *tuple, const char *file, ulint line, mtr_t *mtr)
Definition btr0btr.cc:2240
UNIV_INTERN ibool btr_page_get_split_rec_to_left(btr_cur_t *cursor, rec_t **split_rec)
Definition btr0btr.cc:1921
UNIV_INTERN void btr_node_ptr_delete(dict_index_t *index, buf_block_t *block, mtr_t *mtr)
Definition btr0btr.cc:2947
UNIV_INTERN buf_block_t * btr_page_alloc(dict_index_t *index, ulint hint_page_no, byte file_direction, ulint level, mtr_t *mtr)
Definition btr0btr.cc:911
UNIV_INLINE ulint btr_page_get_prev(const page_t *page, mtr_t *mtr)
struct btr_cur_struct btr_cur_t
Definition btr0types.h:38
struct buf_block_struct buf_block_t
Definition buf0types.h:33
#define page_t
Definition page0types.h:35