~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2010-11-17 21:25:31 UTC
  • mto: (1939.1.1 quick)
  • mto: This revision was merged to the branch mainline in revision 1940.
  • Revision ID: brian@tangent.org-20101117212531-va13j4xh43zuma68
First pass though barriers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
603
603
        ulint           line,   /*!< in: line where called */
604
604
        mtr_t*          mtr)    /*!< in: mtr */
605
605
{
606
 
        page_t*         page;
607
606
        dtuple_t*       tuple;
608
607
        rec_t*          user_rec;
609
608
        rec_t*          node_ptr;
620
619
        ut_ad(dict_index_get_page(index) != page_no);
621
620
 
622
621
        level = btr_page_get_level(btr_cur_get_page(cursor), mtr);
623
 
 
624
 
        page = btr_cur_get_page(cursor);
625
622
        user_rec = btr_cur_get_rec(cursor);
626
623
        ut_a(page_rec_is_user_rec(user_rec));
627
624
        tuple = dict_index_build_node_ptr(index, user_rec, 0, heap, level);
952
949
        dict_index_t*   index,  /*!< in: record descriptor */
953
950
        mtr_t*          mtr)    /*!< in: mtr */
954
951
{
955
 
        buf_pool_t*     buf_pool        = buf_pool_from_bpage(&block->page);
956
952
        page_t*         page            = buf_block_get_frame(block);
957
953
        page_zip_des_t* page_zip        = buf_block_get_page_zip(block);
958
954
        buf_block_t*    temp_block;
983
979
        log_mode = mtr_set_log_mode(mtr, MTR_LOG_NONE);
984
980
 
985
981
#ifndef UNIV_HOTBACKUP
986
 
        temp_block = buf_block_alloc(buf_pool, 0);
 
982
        temp_block = buf_block_alloc(0);
987
983
#else /* !UNIV_HOTBACKUP */
988
984
        ut_ad(block == back_block1);
989
985
        temp_block = back_block2;
1941
1937
        if (n_iterations > 0) {
1942
1938
                direction = FSP_UP;
1943
1939
                hint_page_no = page_no + 1;
1944
 
                split_rec = btr_page_get_split_rec(cursor, tuple, n_ext);
 
1940
                split_rec = btr_page_get_split_rec(cursor, tuple, n_ext);
1945
1941
 
1946
1942
                if (UNIV_UNLIKELY(split_rec == NULL)) {
1947
1943
                        insert_left = btr_page_tuple_smaller(
1950
1946
        } else if (btr_page_get_split_rec_to_right(cursor, &split_rec)) {
1951
1947
                direction = FSP_UP;
1952
1948
                hint_page_no = page_no + 1;
 
1949
 
1953
1950
        } else if (btr_page_get_split_rec_to_left(cursor, &split_rec)) {
1954
1951
                direction = FSP_DOWN;
1955
1952
                hint_page_no = page_no - 1;
1956
 
                ut_ad(split_rec);
 
1953
                ut_ad(split_rec);
1957
1954
        } else {
1958
1955
                direction = FSP_UP;
1959
1956
                hint_page_no = page_no + 1;
 
1957
 
1960
1958
                /* If there is only one record in the index page, we
1961
1959
                can't split the node in the middle by default. We need
1962
1960
                to determine whether the new record will be inserted
1963
1961
                to the left or right. */
1964
1962
 
1965
1963
                if (page_get_n_recs(page) > 1) {
1966
 
                  split_rec = page_get_middle_rec(page);
 
1964
                        split_rec = page_get_middle_rec(page);
1967
1965
                } else if (btr_page_tuple_smaller(cursor, tuple,
1968
1966
                                                  offsets, n_uniq, &heap)) {
1969
1967
                        split_rec = page_rec_get_next(
2049
2047
        }
2050
2048
 
2051
2049
        /* 5. Move then the records to the new page */
2052
 
        if (direction == FSP_DOWN) {
 
2050
        if (direction == FSP_DOWN
 
2051
#ifdef UNIV_BTR_AVOID_COPY
 
2052
            && page_rec_is_supremum(move_limit)) {
 
2053
                /* Instead of moving all records, make the new page
 
2054
                the empty page. */
 
2055
 
 
2056
                left_block = block;
 
2057
                right_block = new_block;
 
2058
        } else if (direction == FSP_DOWN
 
2059
#endif /* UNIV_BTR_AVOID_COPY */
 
2060
                   ) {
2053
2061
                /*              fputs("Split left\n", stderr); */
2054
2062
 
2055
2063
                if (0
2092
2100
                right_block = block;
2093
2101
 
2094
2102
                lock_update_split_left(right_block, left_block);
 
2103
#ifdef UNIV_BTR_AVOID_COPY
 
2104
        } else if (!split_rec) {
 
2105
                /* Instead of moving all records, make the new page
 
2106
                the empty page. */
 
2107
 
 
2108
                left_block = new_block;
 
2109
                right_block = block;
 
2110
#endif /* UNIV_BTR_AVOID_COPY */
2095
2111
        } else {
2096
2112
                /*              fputs("Split right\n", stderr); */
2097
2113