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

« back to all changes in this revision

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

  • Committer: Clint Byrum
  • Date: 2012-03-29 22:29:45 UTC
  • mfrom: (1.1.4)
  • Revision ID: clint@ubuntu.com-20120329222945-prqiuinpt1nx402f
New upstream release (LP: #965523)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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.,
 
15
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16
16
 
17
17
*****************************************************************************/
18
18
 
148
148
                        fputs("\n"
149
149
                              "InnoDB: on that page!\n", stderr);
150
150
 
151
 
                        buf_page_print(page, 0);
 
151
                        buf_page_print(page, 0, 0);
152
152
 
153
153
                        ut_error;
154
154
                }
569
569
                        /* Track an assertion failure reported on the mailing
570
570
                        list on June 18th, 2003 */
571
571
 
572
 
                        buf_page_print(new_page, 0);
573
 
                        buf_page_print(page_align(rec), 0);
 
572
                        buf_page_print(new_page, 0,
 
573
                                       BUF_PAGE_PRINT_NO_CRASH);
 
574
                        buf_page_print(page_align(rec), 0,
 
575
                                       BUF_PAGE_PRINT_NO_CRASH);
574
576
                        ut_print_timestamp(stderr);
575
577
 
576
578
                        fprintf(stderr,
1452
1454
        }
1453
1455
}
1454
1456
 
1455
 
#ifndef UNIV_HOTBACKUP
1456
1457
/************************************************************//**
1457
 
Returns the middle record of the record list. If there are an even number
1458
 
of records in the list, returns the first record of the upper half-list.
1459
 
@return middle record */
 
1458
Returns the nth record of the record list.
 
1459
This is the inverse function of page_rec_get_n_recs_before().
 
1460
@return nth record */
1460
1461
UNIV_INTERN
1461
 
rec_t*
1462
 
page_get_middle_rec(
1463
 
/*================*/
1464
 
        page_t* page)   /*!< in: page */
 
1462
const rec_t*
 
1463
page_rec_get_nth_const(
 
1464
/*===================*/
 
1465
        const page_t*   page,   /*!< in: page */
 
1466
        ulint           nth)    /*!< in: nth record */
1465
1467
{
1466
 
        page_dir_slot_t*        slot;
1467
 
        ulint                   middle;
 
1468
        const page_dir_slot_t*  slot;
1468
1469
        ulint                   i;
1469
1470
        ulint                   n_owned;
1470
 
        ulint                   count;
1471
 
        rec_t*                  rec;
1472
 
 
1473
 
        /* This many records we must leave behind */
1474
 
        middle = (page_get_n_recs(page) + PAGE_HEAP_NO_USER_LOW) / 2;
1475
 
 
1476
 
        count = 0;
 
1471
        const rec_t*            rec;
 
1472
 
 
1473
        ut_ad(nth < UNIV_PAGE_SIZE / (REC_N_NEW_EXTRA_BYTES + 1));
1477
1474
 
1478
1475
        for (i = 0;; i++) {
1479
1476
 
1480
1477
                slot = page_dir_get_nth_slot(page, i);
1481
1478
                n_owned = page_dir_slot_get_n_owned(slot);
1482
1479
 
1483
 
                if (count + n_owned > middle) {
 
1480
                if (n_owned > nth) {
1484
1481
                        break;
1485
1482
                } else {
1486
 
                        count += n_owned;
 
1483
                        nth -= n_owned;
1487
1484
                }
1488
1485
        }
1489
1486
 
1490
1487
        ut_ad(i > 0);
1491
1488
        slot = page_dir_get_nth_slot(page, i - 1);
1492
 
        rec = (rec_t*) page_dir_slot_get_rec(slot);
1493
 
        rec = page_rec_get_next(rec);
1494
 
 
1495
 
        /* There are now count records behind rec */
1496
 
 
1497
 
        for (i = 0; i < middle - count; i++) {
1498
 
                rec = page_rec_get_next(rec);
 
1489
        rec = page_dir_slot_get_rec(slot);
 
1490
 
 
1491
        if (page_is_comp(page)) {
 
1492
                do {
 
1493
                        rec = page_rec_get_next_low(rec, TRUE);
 
1494
                        ut_ad(rec);
 
1495
                } while (nth--);
 
1496
        } else {
 
1497
                do {
 
1498
                        rec = page_rec_get_next_low(rec, FALSE);
 
1499
                        ut_ad(rec);
 
1500
                } while (nth--);
1499
1501
        }
1500
1502
 
1501
1503
        return(rec);
1502
1504
}
1503
 
#endif /* !UNIV_HOTBACKUP */
1504
1505
 
1505
1506
/***************************************************************//**
1506
1507
Returns the number of records before the given record in chain.
1562
1563
        n--;
1563
1564
 
1564
1565
        ut_ad(n >= 0);
 
1566
        ut_ad(n < UNIV_PAGE_SIZE / (REC_N_NEW_EXTRA_BYTES + 1));
1565
1567
 
1566
1568
        return((ulint) n);
1567
1569
}
1834
1836
                fprintf(stderr,
1835
1837
                        "InnoDB: Page directory corruption:"
1836
1838
                        " infimum not pointed to\n");
1837
 
                buf_page_print(page, 0);
 
1839
                buf_page_print(page, 0, 0);
1838
1840
        }
1839
1841
 
1840
1842
        if (UNIV_UNLIKELY(!page_rec_is_supremum_low(supremum_offs))) {
1842
1844
                fprintf(stderr,
1843
1845
                        "InnoDB: Page directory corruption:"
1844
1846
                        " supremum not pointed to\n");
1845
 
                buf_page_print(page, 0);
 
1847
                buf_page_print(page, 0, 0);
1846
1848
        }
1847
1849
}
1848
1850
#endif /* !UNIV_HOTBACKUP */
2546
2548
                        (ulong) page_get_space_id(page),
2547
2549
                        (ulong) page_get_page_no(page),
2548
2550
                        index->name);
2549
 
                buf_page_print(page, 0);
 
2551
                buf_page_print(page, 0, 0);
2550
2552
        }
2551
2553
 
2552
2554
        return(ret);