~stewart/drizzle/docs-improvements-1

« back to all changes in this revision

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

merged with up to date trunk

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.
4
 
Copyright (c) 2008, Google Inc.
 
3
Copyright (C) 1994, 2010, Innobase Oy. All Rights Reserved.
 
4
Copyright (C) 2008, Google Inc.
5
5
 
6
6
Portions of this file contain modifications contributed and copyrighted by
7
7
Google, Inc. Those modifications are gratefully acknowledged and are described
117
117
/** A BLOB field reference full of zero, for use in assertions and tests.
118
118
Initially, BLOB field references are set to zero, in
119
119
dtuple_convert_big_rec(). */
120
 
UNIV_INTERN const byte field_ref_zero[BTR_EXTERN_FIELD_REF_SIZE]= {0};
 
120
const byte field_ref_zero[BTR_EXTERN_FIELD_REF_SIZE]= {0};
121
121
 
122
122
#ifndef UNIV_HOTBACKUP
123
123
/*******************************************************************//**
1071
1071
                                not zero, the parameters index and thr
1072
1072
                                should be specified */
1073
1073
        btr_cur_t*      cursor, /*!< in: cursor on page after which to insert */
1074
 
        const dtuple_t* entry,  /*!< in: entry to insert */
 
1074
        dtuple_t*       entry,  /*!< in/out: entry to insert */
1075
1075
        que_thr_t*      thr,    /*!< in: query thread or NULL */
1076
1076
        mtr_t*          mtr,    /*!< in/out: mini-transaction */
1077
1077
        ibool*          inherit)/*!< out: TRUE if the inserted new record maybe
1744
1744
See if there is enough place in the page modification log to log
1745
1745
an update-in-place.
1746
1746
@return TRUE if enough place */
1747
 
static
 
1747
UNIV_INTERN
1748
1748
ibool
1749
1749
btr_cur_update_alloc_zip(
1750
1750
/*=====================*/
3248
3248
        performance with this code which is just an estimation. If we read
3249
3249
        this many pages before reaching slot2->page_no then we estimate the
3250
3250
        average from the pages scanned so far */
3251
 
        #define N_PAGES_READ_LIMIT      10
 
3251
#       define N_PAGES_READ_LIMIT       10
3252
3252
 
3253
3253
        page_no = slot1->page_no;
3254
3254
        level = slot1->page_level;
3277
3277
                    || btr_page_get_level_low(page) != level) {
3278
3278
 
3279
3279
                        /* The page got reused for something else */
 
3280
                        mtr_commit(&mtr);
3280
3281
                        goto inexact;
3281
3282
                }
3282
3283
 
3520
3521
 
3521
3522
        n_cols = dict_index_get_n_unique(index);
3522
3523
 
3523
 
        n_diff = mem_zalloc((n_cols + 1) * sizeof(ib_int64_t));
 
3524
        n_diff = (ib_int64_t *)mem_zalloc((n_cols + 1) * sizeof(ib_int64_t));
3524
3525
 
3525
3526
        /* It makes no sense to test more pages than are contained
3526
3527
        in the index, thus we lower the number if it is too high */
3632
3633
        also the pages used for external storage of fields (those pages are
3633
3634
        included in index->stat_n_leaf_pages) */
3634
3635
 
3635
 
        dict_index_stat_mutex_enter(index);
3636
 
 
3637
3636
        for (j = 0; j <= n_cols; j++) {
3638
3637
                index->stat_n_diff_key_vals[j]
3639
3638
                        = ((n_diff[j]
3663
3662
                index->stat_n_diff_key_vals[j] += add_on;
3664
3663
        }
3665
3664
 
3666
 
        dict_index_stat_mutex_exit(index);
3667
 
 
3668
3665
        mem_free(n_diff);
3669
3666
        if (UNIV_LIKELY_NULL(heap)) {
3670
3667
                mem_heap_free(heap);
3851
3848
                        }
3852
3849
                }
3853
3850
 
3854
 
                data = dfield_get_data(dfield);
 
3851
                data = (unsigned char *)dfield_get_data(dfield);
3855
3852
                len = dfield_get_len(dfield);
3856
3853
                data[len - BTR_EXTERN_FIELD_REF_SIZE + BTR_EXTERN_LEN]
3857
3854
                        |= BTR_EXTERN_INHERITED_FLAG;
3910
3907
                dfield_t* dfield = dtuple_get_nth_field(entry, i);
3911
3908
 
3912
3909
                if (dfield_is_ext(dfield)) {
3913
 
                        byte*   data = dfield_get_data(dfield);
 
3910
                        byte*   data = (unsigned char *)dfield_get_data(dfield);
3914
3911
                        ulint   len = dfield_get_len(dfield);
3915
3912
 
3916
3913
                        data[len - BTR_EXTERN_FIELD_REF_SIZE + BTR_EXTERN_LEN]
3976
3973
                                will have to be copied. */
3977
3974
                                ut_a(uf->orig_len > BTR_EXTERN_FIELD_REF_SIZE);
3978
3975
 
3979
 
                                data = dfield_get_data(field);
 
3976
                                data = (unsigned char *)dfield_get_data(field);
3980
3977
                                len = dfield_get_len(field);
3981
3978
 
3982
 
                                buf = mem_heap_alloc(heap, uf->orig_len);
 
3979
                                buf = (unsigned char *)mem_heap_alloc(heap, uf->orig_len);
3983
3980
                                /* Copy the locally stored prefix. */
3984
3981
                                memcpy(buf, data,
3985
3982
                                       uf->orig_len
4072
4069
them in rec.  The extern flags in rec will have to be set beforehand.
4073
4070
The fields are stored on pages allocated from leaf node
4074
4071
file segment of the index tree.
4075
 
@return DB_SUCCESS or error */
 
4072
@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
4076
4073
UNIV_INTERN
4077
4074
ulint
4078
4075
btr_store_big_rec_extern_fields(
4087
4084
                                        this function returns */
4088
4085
        big_rec_t*      big_rec_vec,    /*!< in: vector containing fields
4089
4086
                                        to be stored externally */
4090
 
        mtr_t*          local_mtr __attribute__((unused))) /*!< in: mtr
 
4087
        mtr_t*          /*local_mtr __attribute__((unused))*/) /*!< in: mtr
4091
4088
                                        containing the latch to rec and to the
4092
4089
                                        tree */
4093
4090
{
4165
4162
                        int     err = deflateReset(&c_stream);
4166
4163
                        ut_a(err == Z_OK);
4167
4164
 
4168
 
                        c_stream.next_in = (void*) big_rec_vec->fields[i].data;
 
4165
                        c_stream.next_in = (Bytef *) big_rec_vec->fields[i].data;
4169
4166
                        c_stream.avail_in = extern_len;
4170
4167
                }
4171
4168
 
4502
4499
        ulint           i,              /*!< in: field number of field_ref;
4503
4500
                                        ignored if rec == NULL */
4504
4501
        enum trx_rb_ctx rb_ctx,         /*!< in: rollback context */
4505
 
        mtr_t*          local_mtr __attribute__((unused))) /*!< in: mtr
 
4502
        mtr_t*          /*local_mtr __attribute__((unused))*/) /*!< in: mtr
4506
4503
                                        containing the latch to data an an
4507
4504
                                        X-latch to the index tree */
4508
4505
{
5087
5084
 
5088
5085
        extern_len = mach_read_from_4(data + local_len + BTR_EXTERN_LEN + 4);
5089
5086
 
5090
 
        buf = mem_heap_alloc(heap, local_len + extern_len);
 
5087
        buf = (unsigned char *)mem_heap_alloc(heap, local_len + extern_len);
5091
5088
 
5092
5089
        memcpy(buf, data, local_len);
5093
5090
        *len = local_len