~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Stewart Smith
  • Author(s): Marko Mäkelä, Stewart Smith
  • Date: 2010-11-17 05:52:09 UTC
  • mto: (2021.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1971.
  • Revision ID: stewart@flamingspork.com-20101117055209-69m035q6h7e1txrc
Merge Revision revid:marko.makela@oracle.com-20100629113248-fvl48lnzr44z94gg from MySQL InnoDB

Original revid:marko.makela@oracle.com-20100629113248-fvl48lnzr44z94gg

Original Authors: Marko Mkel <marko.makela@oracle.com>
Original commit message:
Bug#52199 utf32: mbminlen=4, mbmaxlen=4, type->mbminlen=0, type->mbmaxlen=4

Merge and adjust a forgotten change to fix this bug.
rb://393 approved by Jimmy Yang
  ------------------------------------------------------------------------
  r3794 | marko | 2009-01-07 14:14:53 +0000 (Wed, 07 Jan 2009) | 18 lines

  branches/6.0: Allow the minimum length of a multi-byte character to be
  up to 4 bytes. (Bug #35391)

  dtype_t, dict_col_t: Replace mbminlen:2, mbmaxlen:3 with mbminmaxlen:5.
  In this way, the 5 bits can hold two values of 0..4, and the storage size
  of the fields will not cross the 64-bit boundary.  Encode the values as
  DATA_MBMAX * mbmaxlen + mbminlen.  Define the auxiliary macros
  DB_MBMINLEN(mbminmaxlen), DB_MBMAXLEN(mbminmaxlen), and
  DB_MINMAXLEN(mbminlen, mbmaxlen).

  Try to trim and pad UTF-16 and UTF-32 with spaces as appropriate.

  Alexander Barkov suggested the use of cs->cset->fill(cs, buff, len, 0x20).
  ha_innobase::store_key_val_for_row() now does that, but the added function
  row_mysql_pad_col() does not, because it doesn't have the MySQL TABLE object.

  rb://49 approved by Heikki Tuuri
  ------------------------------------------------------------------------

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, 2010, 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
603
603
        ulint           line,   /*!< in: line where called */
604
604
        mtr_t*          mtr)    /*!< in: mtr */
605
605
{
 
606
        page_t*         page;
606
607
        dtuple_t*       tuple;
607
608
        rec_t*          user_rec;
608
609
        rec_t*          node_ptr;
620
621
 
621
622
        level = btr_page_get_level(btr_cur_get_page(cursor), mtr);
622
623
 
 
624
        page = btr_cur_get_page(cursor);
623
625
        user_rec = btr_cur_get_rec(cursor);
624
626
        ut_a(page_rec_is_user_rec(user_rec));
625
627
        tuple = dict_index_build_node_ptr(index, user_rec, 0, heap, level);
931
933
        ut_a(btr_root_fseg_validate(header, space));
932
934
#endif /* UNIV_BTR_DEBUG */
933
935
 
934
 
        while (!fseg_free_step(header, mtr)) {};
 
936
        while (!fseg_free_step(header, mtr));
935
937
}
936
938
#endif /* !UNIV_HOTBACKUP */
937
939
 
1120
1122
btr_parse_page_reorganize(
1121
1123
/*======================*/
1122
1124
        byte*           ptr,    /*!< in: buffer */
1123
 
        byte*           /*end_ptr __attribute__((unused))*/,
 
1125
        byte*           end_ptr __attribute__((unused)),
1124
1126
                                /*!< in: buffer end */
1125
1127
        dict_index_t*   index,  /*!< in: record descriptor */
1126
1128
        buf_block_t*    block,  /*!< in: page to be reorganized, or NULL */
1897
1899
        buf_block_t*    left_block;
1898
1900
        buf_block_t*    right_block;
1899
1901
        buf_block_t*    insert_block;
 
1902
        page_t*         insert_page;
1900
1903
        page_cur_t*     page_cursor;
1901
1904
        rec_t*          first_rec;
1902
1905
        byte*           buf = 0; /* remove warning */
2006
2009
insert_empty:
2007
2010
                ut_ad(!split_rec);
2008
2011
                ut_ad(!insert_left);
2009
 
                buf = (unsigned char *)mem_alloc(rec_get_converted_size(cursor->index,
2010
 
                                                                        tuple, n_ext));
 
2012
                buf = mem_alloc(rec_get_converted_size(cursor->index,
 
2013
                                                       tuple, n_ext));
2011
2014
 
2012
2015
                first_rec = rec_convert_dtuple_to_rec(buf, cursor->index,
2013
2016
                                                      tuple, n_ext);
2152
2155
                insert_block = right_block;
2153
2156
        }
2154
2157
 
 
2158
        insert_page = buf_block_get_frame(insert_block);
 
2159
 
2155
2160
        /* 7. Reposition the cursor for insert and try insertion */
2156
2161
        page_cursor = btr_cur_get_page_cur(cursor);
2157
2162
 
2163
2168
 
2164
2169
#ifdef UNIV_ZIP_DEBUG
2165
2170
        {
2166
 
                page_t*         insert_page
2167
 
                        = buf_block_get_frame(insert_block);
2168
 
 
2169
2171
                page_zip_des_t* insert_page_zip
2170
2172
                        = buf_block_get_page_zip(insert_block);
2171
 
 
2172
2173
                ut_a(!insert_page_zip
2173
2174
                     || page_zip_validate(insert_page_zip, insert_page));
2174
2175
        }
2501
2502
 
2502
2503
        /* Go upward to root page, decrementing levels by one. */
2503
2504
        for (i = 0; i < n_blocks; i++, page_level++) {
2504
 
                page_t*         inner_page      = buf_block_get_frame(blocks[i]);
 
2505
                page_t*         page    = buf_block_get_frame(blocks[i]);
2505
2506
                page_zip_des_t* page_zip= buf_block_get_page_zip(blocks[i]);
2506
2507
 
2507
2508
                ut_ad(btr_page_get_level(page, mtr) == page_level + 1);
2508
2509
 
2509
 
                btr_page_set_level(inner_page, page_zip, page_level, mtr);
 
2510
                btr_page_set_level(page, page_zip, page_level, mtr);
2510
2511
#ifdef UNIV_ZIP_DEBUG
2511
 
                ut_a(!page_zip || page_zip_validate(page_zip, inner_page));
 
2512
                ut_a(!page_zip || page_zip_validate(page_zip, page));
2512
2513
#endif /* UNIV_ZIP_DEBUG */
2513
2514
        }
2514
2515
 
2561
2562
        ulint           n_recs;
2562
2563
        ulint           max_ins_size;
2563
2564
        ulint           max_ins_size_reorg;
 
2565
        ulint           level;
2564
2566
 
2565
2567
        block = btr_cur_get_block(cursor);
2566
2568
        page = btr_cur_get_page(cursor);
2570
2572
        ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index),
2571
2573
                                MTR_MEMO_X_LOCK));
2572
2574
        ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX));
 
2575
        level = btr_page_get_level(page, mtr);
2573
2576
        space = dict_index_get_space(index);
2574
2577
        zip_size = dict_table_zip_size(index->table);
2575
2578