~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

Merge Stewart's dead code removal

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, 2009, 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., 51 Franklin
15
 
St, Fifth Floor, Boston, MA 02110-1301 USA
 
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
233
233
                                      8, mtr);
234
234
#ifndef UNIV_HOTBACKUP
235
235
        } else if (mtr) {
236
 
                mlog_write_ull(page + (PAGE_HEADER + PAGE_MAX_TRX_ID),
237
 
                               trx_id, mtr);
 
236
                mlog_write_dulint(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, 0, NULL);
 
458
        page_set_max_trx_id(block, NULL, ut_dulint_zero, 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
 
 
667
659
        if (UNIV_LIKELY_NULL(new_page_zip)) {
668
660
                mtr_set_log_mode(mtr, log_mode);
669
661
 
685
677
 
686
678
                                if (UNIV_UNLIKELY
687
679
                                    (!page_zip_decompress(new_page_zip,
688
 
                                                          new_page, FALSE))) {
 
680
                                                          new_page))) {
689
681
                                        ut_error;
690
682
                                }
691
683
                                ut_ad(page_validate(new_page, index));
702
694
                }
703
695
        }
704
696
 
705
 
        /* Update the lock table and possible hash index */
 
697
        /* Update the lock table, MAX_TRX_ID, and possible hash index */
706
698
 
707
699
        lock_move_rec_list_end(new_block, block, rec);
708
700
 
 
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
 
709
706
        btr_search_move_or_delete_hash_entries(new_block, block, index);
710
707
 
711
708
        return(ret);
773
770
                mem_heap_free(heap);
774
771
        }
775
772
 
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
 
 
786
773
        if (UNIV_LIKELY_NULL(new_page_zip)) {
787
774
                mtr_set_log_mode(mtr, log_mode);
788
775
 
803
790
 
804
791
                                if (UNIV_UNLIKELY
805
792
                                    (!page_zip_decompress(new_page_zip,
806
 
                                                          new_page, FALSE))) {
 
793
                                                          new_page))) {
807
794
                                        ut_error;
808
795
                                }
809
796
                                ut_ad(page_validate(new_page, index));
820
807
                }
821
808
        }
822
809
 
823
 
        /* Update the lock table and possible hash index */
 
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
        }
824
818
 
825
819
        lock_move_rec_list_start(new_block, block, rec, ret);
826
820
 
2299
2293
        dict_index_t*   index)  /*!< in: data dictionary index containing
2300
2294
                                the page record type definition */
2301
2295
{
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;
 
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;
2311
2305
        rec_t*          old_rec         = NULL;
2312
 
        ulint           offs= 0;
2313
 
        ulint           n_slots= 0;
 
2306
        ulint           offs;
 
2307
        ulint           n_slots;
2314
2308
        ibool           ret             = FALSE;
2315
 
        ulint           i= 0;
 
2309
        ulint           i;
2316
2310
        ulint*          offsets         = NULL;
2317
2311
        ulint*          old_offsets     = NULL;
2318
 
        void* buf_ptr= NULL;
2319
2312
 
2320
2313
        if (UNIV_UNLIKELY((ibool) !!page_is_comp(page)
2321
2314
                          != dict_table_is_comp(index->table))) {
2337
2330
        /* The following buffer is used to check that the
2338
2331
        records in the page record heap do not overlap */
2339
2332
 
2340
 
        buf_ptr= mem_heap_zalloc(heap, UNIV_PAGE_SIZE);
2341
 
        buf = static_cast<byte *>(buf_ptr);
 
2333
        buf = mem_heap_zalloc(heap, UNIV_PAGE_SIZE);
2342
2334
 
2343
2335
        /* Check first that the record heap and the directory do not
2344
2336
        overlap. */
2414
2406
                }
2415
2407
 
2416
2408
                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
 
                }
2422
2409
 
2423
 
                while (i--) {
 
2410
                for (i = rec_offs_size(offsets); i--; ) {
2424
2411
                        if (UNIV_UNLIKELY(buf[offs + i])) {
2425
2412
                                /* No other record may overlap this */
2426
2413
 
2475
2462
 
2476
2463
                /* set old_offsets to offsets; recycle offsets */
2477
2464
                {
2478
 
                        ulint* tmp_offs = old_offsets;
 
2465
                        ulint* offs = old_offsets;
2479
2466
                        old_offsets = offsets;
2480
 
                        offsets = tmp_offs;
 
2467
                        offsets = offs;
2481
2468
                }
2482
2469
        }
2483
2470
 
2528
2515
 
2529
2516
                count++;
2530
2517
                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
 
                }
2536
2518
 
2537
 
                while (i--) {
 
2519
                for (i = rec_offs_size(offsets); i--; ) {
2538
2520
 
2539
2521
                        if (UNIV_UNLIKELY(buf[offs + i])) {
2540
2522
                                fputs("InnoDB: Record overlaps another"