~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: lbieber
  • Date: 2010-10-06 16:34:16 UTC
  • mfrom: (1816.1.3 build)
  • Revision ID: lbieber@orisndriz08-20101006163416-ea0sl59qgpglk21y
Merge Monty - Change the requirement from either libinnodb to libhaildb. Also, tied it to version 2.2
Merge Andrew - fix bug 650935: remove --compress from all clients
Merge Andrew - fix bug 653471: Add -A to drizzle client
Merge Travis - 621861 = To change C structs to C++ classes in Drizzle

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 1994, 2010, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1994, 2009, 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
138
138
                                should always be made using PAGE_CUR_LE to
139
139
                                search the position! */
140
140
        ulint           latch_mode, /*!< in: BTR_SEARCH_LEAF, ..., ORed with
141
 
                                at most one of BTR_INSERT, BTR_DELETE_MARK,
142
 
                                BTR_DELETE, or BTR_ESTIMATE;
 
141
                                BTR_INSERT and BTR_ESTIMATE;
143
142
                                cursor->left_block is used to store a pointer
144
143
                                to the left neighbor page, in the cases
145
144
                                BTR_SEARCH_PREV and BTR_MODIFY_PREV;
153
152
        ulint           has_search_latch,/*!< in: latch mode the caller
154
153
                                currently has on btr_search_latch:
155
154
                                RW_S_LATCH, or 0 */
156
 
        const char*     file,   /*!< in: file name */
157
 
        ulint           line,   /*!< in: line where called */
158
155
        mtr_t*          mtr);   /*!< in: mtr */
159
156
/*****************************************************************//**
160
157
Opens a cursor at either end of an index. */
161
158
UNIV_INTERN
162
159
void
163
 
btr_cur_open_at_index_side_func(
164
 
/*============================*/
 
160
btr_cur_open_at_index_side(
 
161
/*=======================*/
165
162
        ibool           from_left,      /*!< in: TRUE if open to the low end,
166
163
                                        FALSE if to the high end */
167
164
        dict_index_t*   index,          /*!< in: index */
168
165
        ulint           latch_mode,     /*!< in: latch mode */
169
166
        btr_cur_t*      cursor,         /*!< in: cursor */
170
 
        const char*     file,           /*!< in: file name */
171
 
        ulint           line,           /*!< in: line where called */
172
167
        mtr_t*          mtr);           /*!< in: mtr */
173
 
#define btr_cur_open_at_index_side(f,i,l,c,m)                           \
174
 
        btr_cur_open_at_index_side_func(f,i,l,c,__FILE__,__LINE__,m)
175
168
/**********************************************************************//**
176
169
Positions a cursor at a randomly chosen position within a B-tree. */
177
170
UNIV_INTERN
178
171
void
179
 
btr_cur_open_at_rnd_pos_func(
180
 
/*=========================*/
 
172
btr_cur_open_at_rnd_pos(
 
173
/*====================*/
181
174
        dict_index_t*   index,          /*!< in: index */
182
175
        ulint           latch_mode,     /*!< in: BTR_SEARCH_LEAF, ... */
183
176
        btr_cur_t*      cursor,         /*!< in/out: B-tree cursor */
184
 
        const char*     file,           /*!< in: file name */
185
 
        ulint           line,           /*!< in: line where called */
186
177
        mtr_t*          mtr);           /*!< in: mtr */
187
 
#define btr_cur_open_at_rnd_pos(i,l,c,m)                                \
188
 
        btr_cur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m)
189
178
/*************************************************************//**
190
179
Tries to perform an insert to a page in an index tree, next to cursor.
191
180
It is assumed that mtr holds an x-latch on the page. The operation does
243
232
        que_thr_t*      thr,    /*!< in: query thread or NULL */
244
233
        mtr_t*          mtr);   /*!< in: mtr */
245
234
/*************************************************************//**
246
 
See if there is enough place in the page modification log to log
247
 
an update-in-place.
248
 
@return TRUE if enough place */
249
 
UNIV_INTERN
250
 
ibool
251
 
btr_cur_update_alloc_zip(
252
 
/*=====================*/
253
 
        page_zip_des_t* page_zip,/*!< in/out: compressed page */
254
 
        buf_block_t*    block,  /*!< in/out: buffer page */
255
 
        dict_index_t*   index,  /*!< in: the index corresponding to the block */
256
 
        ulint           length, /*!< in: size needed */
257
 
        ibool           create, /*!< in: TRUE=delete-and-insert,
258
 
                                FALSE=update-in-place */
259
 
        mtr_t*          mtr)    /*!< in: mini-transaction */
260
 
        UNIV_WARN_UNUSED_RESULT_NONNULL;
261
 
/*************************************************************//**
262
235
Updates a record when the update causes no size changes in its fields.
263
236
@return DB_SUCCESS or error number */
264
237
UNIV_INTERN
349
322
        ibool           val,    /*!< in: value to set */
350
323
        que_thr_t*      thr,    /*!< in: query thread */
351
324
        mtr_t*          mtr);   /*!< in: mtr */
 
325
/***********************************************************//**
 
326
Clear a secondary index record's delete mark.  This function is only
 
327
used by the insert buffer insert merge mechanism. */
 
328
UNIV_INTERN
 
329
void
 
330
btr_cur_del_unmark_for_ibuf(
 
331
/*========================*/
 
332
        rec_t*          rec,            /*!< in/out: record to delete unmark */
 
333
        page_zip_des_t* page_zip,       /*!< in/out: compressed page
 
334
                                        corresponding to rec, or NULL
 
335
                                        when the tablespace is
 
336
                                        uncompressed */
 
337
        mtr_t*          mtr);           /*!< in: mtr */
352
338
/*************************************************************//**
353
339
Tries to compress a page of the tree if it seems useful. It is assumed
354
340
that mtr holds an x-latch on the tree and on the cursor page. To avoid
472
458
Marks not updated extern fields as not-owned by this record. The ownership
473
459
is transferred to the updated record which is inserted elsewhere in the
474
460
index tree. In purge only the owner of externally stored field is allowed
475
 
to free the field.
476
 
@return TRUE if BLOB ownership was transferred */
 
461
to free the field. */
477
462
UNIV_INTERN
478
 
ibool
 
463
void
479
464
btr_cur_mark_extern_inherited_fields(
480
465
/*=================================*/
481
466
        page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed
508
493
them in rec.  The extern flags in rec will have to be set beforehand.
509
494
The fields are stored on pages allocated from leaf node
510
495
file segment of the index tree.
511
 
@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
 
496
@return DB_SUCCESS or error */
512
497
UNIV_INTERN
513
498
ulint
514
499
btr_store_big_rec_extern_fields(
575
560
        ulint           local_len);/*!< in: length of data, in bytes */
576
561
/*******************************************************************//**
577
562
Copies an externally stored field of a record to mem heap.
578
 
@return the field copied to heap, or NULL if the field is incomplete */
 
563
@return the field copied to heap */
579
564
UNIV_INTERN
580
565
byte*
581
566
btr_rec_copy_externally_stored_field(
601
586
        const upd_t*    update, /*!< in: update vector */
602
587
        mem_heap_t*     heap)   /*!< in: memory heap */
603
588
        __attribute__((nonnull));
604
 
/***********************************************************//**
605
 
Sets a secondary index record's delete mark to the given value. This
606
 
function is only used by the insert buffer merge mechanism. */
607
 
UNIV_INTERN
608
 
void
609
 
btr_cur_set_deleted_flag_for_ibuf(
610
 
/*==============================*/
611
 
        rec_t*          rec,            /*!< in/out: record */
612
 
        page_zip_des_t* page_zip,       /*!< in/out: compressed page
613
 
                                        corresponding to rec, or NULL
614
 
                                        when the tablespace is
615
 
                                        uncompressed */
616
 
        ibool           val,            /*!< in: value to set */
617
 
        mtr_t*          mtr);           /*!< in: mtr */
 
589
 
618
590
/*######################################################################*/
619
591
 
620
592
/** In the pessimistic delete, if the page data size drops below this
632
604
                                order); value ULINT_UNDEFINED
633
605
                                denotes array end */
634
606
        ulint   n_recs;         /*!< number of records on the page */
635
 
        ulint   page_no;        /*!< no of the page containing the record */
636
 
        ulint   page_level;     /*!< level of the page, if later we fetch
637
 
                                the page under page_no and it is no different
638
 
                                level then we know that the tree has been
639
 
                                reorganized */
640
607
};
641
608
 
642
609
#define BTR_PATH_ARRAY_N_SLOTS  250     /*!< size of path array (in slots) */
651
618
                                hash_node, and might be necessary to
652
619
                                update */
653
620
        BTR_CUR_BINARY,         /*!< success using the binary search */
654
 
        BTR_CUR_INSERT_TO_IBUF, /*!< performed the intended insert to
655
 
                                the insert buffer */
656
 
        BTR_CUR_DEL_MARK_IBUF,  /*!< performed the intended delete
657
 
                                mark in the insert/delete buffer */
658
 
        BTR_CUR_DELETE_IBUF,    /*!< performed the intended delete in
659
 
                                the insert/delete buffer */
660
 
        BTR_CUR_DELETE_REF      /*!< row_purge_poss_sec() failed */
 
621
        BTR_CUR_INSERT_TO_IBUF  /*!< performed the intended insert to
 
622
                                the insert buffer */
661
623
};
662
624
 
663
625
/** The tree cursor: the definition appears here only for the compiler
665
627
struct btr_cur_struct {
666
628
        dict_index_t*   index;          /*!< index where positioned */
667
629
        page_cur_t      page_cur;       /*!< page cursor */
668
 
        purge_node_t*   purge_node;     /*!< purge node, for BTR_DELETE */
669
630
        buf_block_t*    left_block;     /*!< this field is used to store
670
631
                                        a pointer to the left neighbor
671
632
                                        page, in the cases
722
683
                                        NULL */
723
684
        ulint           fold;           /*!< fold value used in the search if
724
685
                                        flag is BTR_CUR_HASH */
725
 
        /*----- Delete buffering -------*/
726
 
        ulint           ibuf_cnt;       /* in searches done on insert buffer
727
 
                                        trees, this contains the "counter"
728
 
                                        value (the first two bytes of the
729
 
                                        fourth field) extracted from the
730
 
                                        page above the leaf page, from the
731
 
                                        father node pointer that pointed to
732
 
                                        the leaf page. in other words, it
733
 
                                        contains the minimum counter value
734
 
                                        for records to be inserted on the
735
 
                                        chosen leaf page. If for some reason
736
 
                                        this can't be read, or if the search
737
 
                                        ended on the leftmost leaf page in
738
 
                                        the tree (in which case the father
739
 
                                        node pointer had the 'minimum
740
 
                                        record' flag set), this is
741
 
                                        ULINT_UNDEFINED. */
742
686
        /*------------------------------*/
743
687
        /* @} */
744
688
        btr_path_t*     path_arr;       /*!< in estimating the number of