~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/page/page0page.cc

  • Committer: Monty Taylor
  • Date: 2011-02-13 17:26:39 UTC
  • mfrom: (2157.2.2 give-in-to-pkg-config)
  • mto: This revision was merged to the branch mainline in revision 2166.
  • Revision ID: mordred@inaugust.com-20110213172639-nhy7i72sfhoq13ms
Merged in pkg-config fixes.

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
 
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
11
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
12
 
13
13
You should have received a copy of the GNU General Public License along with
14
 
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
15
 
Place, Suite 330, Boston, MA 02111-1307 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 
15
St, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
233
233
                                      8, mtr);
234
234
#ifndef UNIV_HOTBACKUP
235
235
        } else if (mtr) {
236
 
                mlog_write_dulint(page + (PAGE_HEADER + PAGE_MAX_TRX_ID),
237
 
                                  trx_id, mtr);
 
236
                mlog_write_ull(page + (PAGE_HEADER + PAGE_MAX_TRX_ID),
 
237
                               trx_id, mtr);
238
238
#endif /* !UNIV_HOTBACKUP */
239
239
        } else {
240
240
                mach_write_to_8(page + (PAGE_HEADER + PAGE_MAX_TRX_ID), trx_id);
313
313
page_parse_create(
314
314
/*==============*/
315
315
        byte*           ptr,    /*!< in: buffer */
316
 
        byte*           end_ptr __attribute__((unused)), /*!< in: buffer end */
 
316
        byte*           /*end_ptr __attribute__((unused))*/, /*!< in: buffer end */
317
317
        ulint           comp,   /*!< in: nonzero=compact page format */
318
318
        buf_block_t*    block,  /*!< in: block or NULL */
319
319
        mtr_t*          mtr)    /*!< in: mtr or NULL */
455
455
        page_header_set_field(page, NULL, PAGE_DIRECTION, PAGE_NO_DIRECTION);
456
456
        page_header_set_field(page, NULL, PAGE_N_DIRECTION, 0);
457
457
        page_header_set_field(page, NULL, PAGE_N_RECS, 0);
458
 
        page_set_max_trx_id(block, NULL, ut_dulint_zero, NULL);
 
458
        page_set_max_trx_id(block, NULL, 0, NULL);
459
459
        memset(heap_top, 0, UNIV_PAGE_SIZE - PAGE_EMPTY_DIR_START
460
460
               - page_offset(heap_top));
461
461
 
656
656
                                                index, mtr);
657
657
        }
658
658
 
 
659
        /* Update PAGE_MAX_TRX_ID on the uncompressed page.
 
660
        Modifications will be redo logged and copied to the compressed
 
661
        page in page_zip_compress() or page_zip_reorganize() below. */
 
662
        if (dict_index_is_sec_or_ibuf(index) && page_is_leaf(page)) {
 
663
                page_update_max_trx_id(new_block, NULL,
 
664
                                       page_get_max_trx_id(page), mtr);
 
665
        }
 
666
 
659
667
        if (UNIV_LIKELY_NULL(new_page_zip)) {
660
668
                mtr_set_log_mode(mtr, log_mode);
661
669
 
677
685
 
678
686
                                if (UNIV_UNLIKELY
679
687
                                    (!page_zip_decompress(new_page_zip,
680
 
                                                          new_page))) {
 
688
                                                          new_page, FALSE))) {
681
689
                                        ut_error;
682
690
                                }
683
691
                                ut_ad(page_validate(new_page, index));
694
702
                }
695
703
        }
696
704
 
697
 
        /* Update the lock table, MAX_TRX_ID, and possible hash index */
 
705
        /* Update the lock table and possible hash index */
698
706
 
699
707
        lock_move_rec_list_end(new_block, block, rec);
700
708
 
701
 
        if (dict_index_is_sec_or_ibuf(index) && page_is_leaf(page)) {
702
 
                page_update_max_trx_id(new_block, new_page_zip,
703
 
                                       page_get_max_trx_id(page), mtr);
704
 
        }
705
 
 
706
709
        btr_search_move_or_delete_hash_entries(new_block, block, index);
707
710
 
708
711
        return(ret);
770
773
                mem_heap_free(heap);
771
774
        }
772
775
 
 
776
        /* Update PAGE_MAX_TRX_ID on the uncompressed page.
 
777
        Modifications will be redo logged and copied to the compressed
 
778
        page in page_zip_compress() or page_zip_reorganize() below. */
 
779
        if (dict_index_is_sec_or_ibuf(index)
 
780
            && page_is_leaf(page_align(rec))) {
 
781
                page_update_max_trx_id(new_block, NULL,
 
782
                                       page_get_max_trx_id(page_align(rec)),
 
783
                                       mtr);
 
784
        }
 
785
 
773
786
        if (UNIV_LIKELY_NULL(new_page_zip)) {
774
787
                mtr_set_log_mode(mtr, log_mode);
775
788
 
790
803
 
791
804
                                if (UNIV_UNLIKELY
792
805
                                    (!page_zip_decompress(new_page_zip,
793
 
                                                          new_page))) {
 
806
                                                          new_page, FALSE))) {
794
807
                                        ut_error;
795
808
                                }
796
809
                                ut_ad(page_validate(new_page, index));
807
820
                }
808
821
        }
809
822
 
810
 
        /* Update MAX_TRX_ID, the lock table, and possible hash index */
811
 
 
812
 
        if (dict_index_is_sec_or_ibuf(index)
813
 
            && page_is_leaf(page_align(rec))) {
814
 
                page_update_max_trx_id(new_block, new_page_zip,
815
 
                                       page_get_max_trx_id(page_align(rec)),
816
 
                                       mtr);
817
 
        }
 
823
        /* Update the lock table and possible hash index */
818
824
 
819
825
        lock_move_rec_list_start(new_block, block, rec, ret);
820
826
 
2293
2299
        dict_index_t*   index)  /*!< in: data dictionary index containing
2294
2300
                                the page record type definition */
2295
2301
{
2296
 
        page_dir_slot_t*slot;
2297
 
        mem_heap_t*     heap;
2298
 
        byte*           buf;
2299
 
        ulint           count;
2300
 
        ulint           own_count;
2301
 
        ulint           rec_own_count;
2302
 
        ulint           slot_no;
2303
 
        ulint           data_size;
2304
 
        rec_t*          rec;
 
2302
        page_dir_slot_t*slot= NULL;
 
2303
        mem_heap_t*     heap= NULL;
 
2304
        byte*           buf= NULL;
 
2305
        ulint           count= 0;
 
2306
        ulint           own_count= 0;
 
2307
        ulint           rec_own_count= 0;
 
2308
        ulint           slot_no= 0;
 
2309
        ulint           data_size= 0;
 
2310
        rec_t*          rec= NULL;
2305
2311
        rec_t*          old_rec         = NULL;
2306
 
        ulint           offs;
2307
 
        ulint           n_slots;
 
2312
        ulint           offs= 0;
 
2313
        ulint           n_slots= 0;
2308
2314
        ibool           ret             = FALSE;
2309
 
        ulint           i;
 
2315
        ulint           i= 0;
2310
2316
        ulint*          offsets         = NULL;
2311
2317
        ulint*          old_offsets     = NULL;
 
2318
        void* buf_ptr= NULL;
2312
2319
 
2313
2320
        if (UNIV_UNLIKELY((ibool) !!page_is_comp(page)
2314
2321
                          != dict_table_is_comp(index->table))) {
2330
2337
        /* The following buffer is used to check that the
2331
2338
        records in the page record heap do not overlap */
2332
2339
 
2333
 
        buf = mem_heap_zalloc(heap, UNIV_PAGE_SIZE);
 
2340
        buf_ptr= mem_heap_zalloc(heap, UNIV_PAGE_SIZE);
 
2341
        buf = static_cast<byte *>(buf_ptr);
2334
2342
 
2335
2343
        /* Check first that the record heap and the directory do not
2336
2344
        overlap. */
2406
2414
                }
2407
2415
 
2408
2416
                offs = page_offset(rec_get_start(rec, offsets));
 
2417
                i = rec_offs_size(offsets);
 
2418
                if (UNIV_UNLIKELY(offs + i >= UNIV_PAGE_SIZE)) {
 
2419
                        fputs("InnoDB: record offset out of bounds\n", stderr);
 
2420
                        goto func_exit;
 
2421
                }
2409
2422
 
2410
 
                for (i = rec_offs_size(offsets); i--; ) {
 
2423
                while (i--) {
2411
2424
                        if (UNIV_UNLIKELY(buf[offs + i])) {
2412
2425
                                /* No other record may overlap this */
2413
2426
 
2462
2475
 
2463
2476
                /* set old_offsets to offsets; recycle offsets */
2464
2477
                {
2465
 
                        ulint* offs = old_offsets;
 
2478
                        ulint* tmp_offs = old_offsets;
2466
2479
                        old_offsets = offsets;
2467
 
                        offsets = offs;
 
2480
                        offsets = tmp_offs;
2468
2481
                }
2469
2482
        }
2470
2483
 
2515
2528
 
2516
2529
                count++;
2517
2530
                offs = page_offset(rec_get_start(rec, offsets));
 
2531
                i = rec_offs_size(offsets);
 
2532
                if (UNIV_UNLIKELY(offs + i >= UNIV_PAGE_SIZE)) {
 
2533
                        fputs("InnoDB: record offset out of bounds\n", stderr);
 
2534
                        goto func_exit;
 
2535
                }
2518
2536
 
2519
 
                for (i = rec_offs_size(offsets); i--; ) {
 
2537
                while (i--) {
2520
2538
 
2521
2539
                        if (UNIV_UNLIKELY(buf[offs + i])) {
2522
2540
                                fputs("InnoDB: Record overlaps another"