~drizzle-developers/ubuntu/karmic/drizzle/ppa

« back to all changes in this revision

Viewing changes to plugin/innobase/btr/btr0cur.c

  • Committer: Monty Taylor
  • Date: 2010-11-24 18:44:57 UTC
  • mfrom: (1308.1.31 trunk)
  • Revision ID: mordred@inaugust.com-20101124184457-qd6jvoe2wgnvl3yq
Tags: 2010.11.04-0ubuntu1~karmic1
* New upstream release.
* Turn off -Werror for packaging builds. (Closes: #602662)

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
Copyright (c) 2008, Google Inc.
5
5
 
6
6
Portions of this file contain modifications contributed and copyrighted by
342
342
        ulint           has_search_latch,/*!< in: info on the latch mode the
343
343
                                caller currently has on btr_search_latch:
344
344
                                RW_S_LATCH, or 0 */
 
345
        const char*     file,   /*!< in: file name */
 
346
        ulint           line,   /*!< in: line where called */
345
347
        mtr_t*          mtr)    /*!< in: mtr */
346
348
{
347
349
        page_cur_t*     page_cursor;
520
522
retry_page_get:
521
523
                block = buf_page_get_gen(space, zip_size, page_no,
522
524
                                         rw_latch, guess, buf_mode,
523
 
                                         __FILE__, __LINE__, mtr);
 
525
                                         file, line, mtr);
524
526
                if (block == NULL) {
525
527
                        /* This must be a search to perform an insert;
526
528
                        try insert to the insert buffer */
677
679
Opens a cursor at either end of an index. */
678
680
UNIV_INTERN
679
681
void
680
 
btr_cur_open_at_index_side(
681
 
/*=======================*/
 
682
btr_cur_open_at_index_side_func(
 
683
/*============================*/
682
684
        ibool           from_left,      /*!< in: TRUE if open to the low end,
683
685
                                        FALSE if to the high end */
684
686
        dict_index_t*   index,          /*!< in: index */
685
687
        ulint           latch_mode,     /*!< in: latch mode */
686
688
        btr_cur_t*      cursor,         /*!< in: cursor */
 
689
        const char*     file,           /*!< in: file name */
 
690
        ulint           line,           /*!< in: line where called */
687
691
        mtr_t*          mtr)            /*!< in: mtr */
688
692
{
689
693
        page_cur_t*     page_cursor;
728
732
                page_t*         page;
729
733
                block = buf_page_get_gen(space, zip_size, page_no,
730
734
                                         RW_NO_LATCH, NULL, BUF_GET,
731
 
                                         __FILE__, __LINE__, mtr);
 
735
                                         file, line, mtr);
732
736
                page = buf_block_get_frame(block);
733
737
                ut_ad(0 == ut_dulint_cmp(index->id,
734
738
                                         btr_page_get_index_id(page)));
808
812
Positions a cursor at a randomly chosen position within a B-tree. */
809
813
UNIV_INTERN
810
814
void
811
 
btr_cur_open_at_rnd_pos(
812
 
/*====================*/
 
815
btr_cur_open_at_rnd_pos_func(
 
816
/*=========================*/
813
817
        dict_index_t*   index,          /*!< in: index */
814
818
        ulint           latch_mode,     /*!< in: BTR_SEARCH_LEAF, ... */
815
819
        btr_cur_t*      cursor,         /*!< in/out: B-tree cursor */
 
820
        const char*     file,           /*!< in: file name */
 
821
        ulint           line,           /*!< in: line where called */
816
822
        mtr_t*          mtr)            /*!< in: mtr */
817
823
{
818
824
        page_cur_t*     page_cursor;
847
853
 
848
854
                block = buf_page_get_gen(space, zip_size, page_no,
849
855
                                         RW_NO_LATCH, NULL, BUF_GET,
850
 
                                         __FILE__, __LINE__, mtr);
 
856
                                         file, line, mtr);
851
857
                page = buf_block_get_frame(block);
852
858
                ut_ad(0 == ut_dulint_cmp(index->id,
853
859
                                         btr_page_get_index_id(page)));
1058
1064
        ibool           inherit;
1059
1065
        ulint           zip_size;
1060
1066
        ulint           rec_size;
1061
 
        mem_heap_t*     heap            = NULL;
1062
1067
        ulint           err;
1063
1068
 
1064
1069
        *big_rec = NULL;
1138
1143
                                        index, entry, big_rec_vec);
1139
1144
                        }
1140
1145
 
1141
 
                        if (heap) {
1142
 
                                mem_heap_free(heap);
1143
 
                        }
1144
 
 
1145
1146
                        return(DB_TOO_BIG_RECORD);
1146
1147
                }
1147
1148
        }
1164
1165
                        dtuple_convert_back_big_rec(index, entry, big_rec_vec);
1165
1166
                }
1166
1167
 
1167
 
                if (UNIV_LIKELY_NULL(heap)) {
1168
 
                        mem_heap_free(heap);
1169
 
                }
1170
 
 
1171
1168
                return(err);
1172
1169
        }
1173
1170
 
1174
1171
        if (UNIV_UNLIKELY(max_size < BTR_CUR_PAGE_REORGANIZE_LIMIT
1175
 
             || max_size < rec_size)
 
1172
                          || max_size < rec_size)
1176
1173
            && UNIV_LIKELY(page_get_n_recs(page) > 1)
1177
1174
            && page_get_max_insert_size(page, 1) < rec_size) {
1178
1175
 
1238
1235
                }
1239
1236
        }
1240
1237
 
1241
 
        if (UNIV_LIKELY_NULL(heap)) {
1242
 
                mem_heap_free(heap);
1243
 
        }
1244
 
 
1245
1238
#ifdef BTR_CUR_HASH_ADAPT
1246
1239
        if (!reorg && leaf && (cursor->flag == BTR_CUR_HASH)) {
1247
1240
                btr_search_update_hash_node_on_insert(cursor);
3100
3093
 
3101
3094
                btr_cur_search_to_nth_level(index, 0, tuple1, mode1,
3102
3095
                                            BTR_SEARCH_LEAF | BTR_ESTIMATE,
3103
 
                                            &cursor, 0, &mtr);
 
3096
                                            &cursor, 0,
 
3097
                                            __FILE__, __LINE__, &mtr);
3104
3098
        } else {
3105
3099
                btr_cur_open_at_index_side(TRUE, index,
3106
3100
                                           BTR_SEARCH_LEAF | BTR_ESTIMATE,
3117
3111
 
3118
3112
                btr_cur_search_to_nth_level(index, 0, tuple2, mode2,
3119
3113
                                            BTR_SEARCH_LEAF | BTR_ESTIMATE,
3120
 
                                            &cursor, 0, &mtr);
 
3114
                                            &cursor, 0,
 
3115
                                            __FILE__, __LINE__, &mtr);
3121
3116
        } else {
3122
3117
                btr_cur_open_at_index_side(FALSE, index,
3123
3118
                                           BTR_SEARCH_LEAF | BTR_ESTIMATE,
3361
3356
        also the pages used for external storage of fields (those pages are
3362
3357
        included in index->stat_n_leaf_pages) */
3363
3358
 
 
3359
        dict_index_stat_mutex_enter(index);
 
3360
 
3364
3361
        for (j = 0; j <= n_cols; j++) {
3365
3362
                index->stat_n_diff_key_vals[j]
3366
3363
                        = ((n_diff[j]
3390
3387
                index->stat_n_diff_key_vals[j] += add_on;
3391
3388
        }
3392
3389
 
 
3390
        dict_index_stat_mutex_exit(index);
 
3391
 
3393
3392
        mem_free(n_diff);
3394
3393
        if (UNIV_LIKELY_NULL(heap)) {
3395
3394
                mem_heap_free(heap);
3872
3871
                        field_ref += local_len;
3873
3872
                }
3874
3873
                extern_len = big_rec_vec->fields[i].len;
 
3874
                UNIV_MEM_ASSERT_RW(big_rec_vec->fields[i].data,
 
3875
                                   extern_len);
3875
3876
 
3876
3877
                ut_a(extern_len > 0);
3877
3878
 
4252
4253
                /* In the rollback of uncommitted transactions, we may
4253
4254
                encounter a clustered index record whose BLOBs have
4254
4255
                not been written.  There is nothing to free then. */
4255
 
                ut_a(rb_ctx == RB_RECOVERY);
 
4256
                ut_a(rb_ctx == RB_RECOVERY || rb_ctx == RB_RECOVERY_PURGE_REC);
4256
4257
                return;
4257
4258
        }
4258
4259
 
4298
4299
                    || (mach_read_from_1(field_ref + BTR_EXTERN_LEN)
4299
4300
                        & BTR_EXTERN_OWNER_FLAG)
4300
4301
                    /* Rollback and inherited field */
4301
 
                    || (rb_ctx != RB_NONE
 
4302
                    || ((rb_ctx == RB_NORMAL || rb_ctx == RB_RECOVERY)
4302
4303
                        && (mach_read_from_1(field_ref + BTR_EXTERN_LEN)
4303
4304
                            & BTR_EXTERN_INHERITED_FLAG))) {
4304
4305
 
4508
4509
                mtr_commit(&mtr);
4509
4510
 
4510
4511
                if (page_no == FIL_NULL || copy_len != part_len) {
 
4512
                        UNIV_MEM_ASSERT_RW(buf, copied_len);
4511
4513
                        return(copied_len);
4512
4514
                }
4513
4515
 
4691
4693
                                      space_id, page_no, offset);
4692
4694
                inflateEnd(&d_stream);
4693
4695
                mem_heap_free(heap);
 
4696
                UNIV_MEM_ASSERT_RW(buf, d_stream.total_out);
4694
4697
                return(d_stream.total_out);
4695
4698
        } else {
4696
4699
                return(btr_copy_blob_prefix(buf, len, space_id,