~ubuntu-branches/ubuntu/precise/mysql-5.5/precise

« back to all changes in this revision

Viewing changes to storage/innobase/row/row0sel.c

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-03-29 17:31:30 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20120329173130-66r4npq2b0by1x8p
Tags: 5.5.22-0ubuntu1
* New upstream release (LP: #965523)
* d/mysql-server-5.5.mysql.upstart: Add respawn limit and code
  to exit ping loop if mysqld needs to be respawned. (LP: #711635)
* New upstream bugfix release.
* Refreshed patches
* d/control: Build-Dep on dh-apparmor (LP: #948481)
* d/p/fix-mysqldump-test.patch: Fixes unreliable test introduced in
  new upstream version. http://bugs.mysql.com/bug.php?id=64401
* d/control: Re-add empty meta-package for mysql-testsuite so users
  will get the 5.5 version on upgrade and when installing
  mysql-testsuite. (LP: #959683)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved.
 
3
Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved.
4
4
Copyright (c) 2008, Google Inc.
5
5
 
6
6
Portions of this file contain modifications contributed and copyrighted by
2301
2301
                                        in the tuple is already according
2302
2302
                                        to index! */
2303
2303
        byte*           buf,            /*!< in: buffer to use in field
2304
 
                                        conversions */
 
2304
                                        conversions; NOTE that dtuple->data
 
2305
                                        may end up pointing inside buf so
 
2306
                                        do not discard that buffer while
 
2307
                                        the tuple is being used. See
 
2308
                                        row_mysql_store_col_in_innobase_format()
 
2309
                                        in the case of DATA_INT */
2305
2310
        ulint           buf_len,        /*!< in: buffer length */
2306
2311
        dict_index_t*   index,          /*!< in: index of the key value */
2307
2312
        const byte*     key_ptr,        /*!< in: MySQL key value */
2433
2438
                /* Storing may use at most data_len bytes of buf */
2434
2439
 
2435
2440
                if (UNIV_LIKELY(!is_null)) {
 
2441
                        ut_a(buf + data_len <= original_buf + buf_len);
2436
2442
                        row_mysql_store_col_in_innobase_format(
2437
2443
                                dfield, buf,
2438
2444
                                FALSE, /* MySQL key value format col */
2915
2921
 
2916
2922
        btr_pcur_open_with_no_init(clust_index, prebuilt->clust_ref,
2917
2923
                                   PAGE_CUR_LE, BTR_SEARCH_LEAF,
2918
 
                                   prebuilt->clust_pcur, 0, mtr);
2919
 
 
2920
 
        clust_rec = btr_pcur_get_rec(prebuilt->clust_pcur);
2921
 
 
2922
 
        prebuilt->clust_pcur->trx_if_known = trx;
 
2924
                                   &prebuilt->clust_pcur, 0, mtr);
 
2925
 
 
2926
        clust_rec = btr_pcur_get_rec(&prebuilt->clust_pcur);
 
2927
 
 
2928
        prebuilt->clust_pcur.trx_if_known = trx;
2923
2929
 
2924
2930
        /* Note: only if the search ends up on a non-infimum record is the
2925
2931
        low_match value the real match to the search tuple */
2926
2932
 
2927
2933
        if (!page_rec_is_user_rec(clust_rec)
2928
 
            || btr_pcur_get_low_match(prebuilt->clust_pcur)
 
2934
            || btr_pcur_get_low_match(&prebuilt->clust_pcur)
2929
2935
            < dict_index_get_n_unique(clust_index)) {
2930
2936
 
2931
2937
                /* In a rare case it is possible that no clust rec is found
2957
2963
                        fputs("\n"
2958
2964
                              "InnoDB: Submit a detailed bug report"
2959
2965
                              " to http://bugs.mysql.com\n", stderr);
 
2966
                        ut_ad(0);
2960
2967
                }
2961
2968
 
2962
2969
                clust_rec = NULL;
2974
2981
                we set a LOCK_REC_NOT_GAP type lock */
2975
2982
 
2976
2983
                err = lock_clust_rec_read_check_and_lock(
2977
 
                        0, btr_pcur_get_block(prebuilt->clust_pcur),
 
2984
                        0, btr_pcur_get_block(&prebuilt->clust_pcur),
2978
2985
                        clust_rec, clust_index, *offsets,
2979
2986
                        prebuilt->select_lock_type, LOCK_REC_NOT_GAP, thr);
2980
2987
                switch (err) {
3052
3059
                /* We may use the cursor in update or in unlock_row():
3053
3060
                store its position */
3054
3061
 
3055
 
                btr_pcur_store_position(prebuilt->clust_pcur, mtr);
 
3062
                btr_pcur_store_position(&prebuilt->clust_pcur, mtr);
3056
3063
        }
3057
3064
 
3058
3065
err_exit:
3300
3307
{
3301
3308
        dict_index_t*   index           = prebuilt->index;
3302
3309
        const dtuple_t* search_tuple    = prebuilt->search_tuple;
3303
 
        btr_pcur_t*     pcur            = prebuilt->pcur;
 
3310
        btr_pcur_t*     pcur            = &prebuilt->pcur;
3304
3311
        trx_t*          trx             = prebuilt->trx;
3305
3312
        const rec_t*    rec;
3306
3313
 
3389
3396
        dict_index_t*   index           = prebuilt->index;
3390
3397
        ibool           comp            = dict_table_is_comp(index->table);
3391
3398
        const dtuple_t* search_tuple    = prebuilt->search_tuple;
3392
 
        btr_pcur_t*     pcur            = prebuilt->pcur;
 
3399
        btr_pcur_t*     pcur            = &prebuilt->pcur;
3393
3400
        trx_t*          trx             = prebuilt->trx;
3394
3401
        dict_index_t*   clust_index;
3395
3402
        que_thr_t*      thr;
3991
3998
wrong_offs:
3992
3999
                if (srv_force_recovery == 0 || moves_up == FALSE) {
3993
4000
                        ut_print_timestamp(stderr);
3994
 
                        buf_page_print(page_align(rec), 0);
 
4001
                        buf_page_print(page_align(rec), 0,
 
4002
                                       BUF_PAGE_PRINT_NO_CRASH);
3995
4003
                        fprintf(stderr,
3996
4004
                                "\nInnoDB: rec address %p,"
3997
4005
                                " buf block fix count %lu\n",
4010
4018
                              "InnoDB: restore from a backup, or"
4011
4019
                              " dump + drop + reimport the table.\n",
4012
4020
                              stderr);
4013
 
 
 
4021
                        ut_ad(0);
4014
4022
                        err = DB_CORRUPTION;
4015
4023
 
4016
4024
                        goto lock_wait_or_error;
4362
4370
                applicable to unique secondary indexes. Current behaviour is
4363
4371
                to widen the scope of a lock on an already delete marked record
4364
4372
                if the same record is deleted twice by the same transaction */
4365
 
                if (index == clust_index && unique_search) {
 
4373
                if (index == clust_index && unique_search
 
4374
                    && !prebuilt->used_in_HANDLER) {
 
4375
 
4366
4376
                        err = DB_RECORD_NOT_FOUND;
4367
4377
 
4368
4378
                        goto normal_return;