~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/trx/trx0undo.c

  • Committer: Brian Aker
  • Date: 2010-12-08 18:53:46 UTC
  • mto: This revision was merged to the branch mainline in revision 1983.
  • Revision ID: brian@tangent.org-20101208185346-89uak2ofyivk1yss
Update schema, make sure that it always ruturns a valid string (it just
makes the entire interface simpler to use).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*****************************************************************************
2
2
 
3
 
Copyright (C) 1996, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (c) 1996, 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
415
415
ulint
416
416
trx_undo_seg_create(
417
417
/*================*/
418
 
        trx_rseg_t*     /*rseg*/,/*!< in: rollback segment */
 
418
        trx_rseg_t*     rseg __attribute__((unused)),/*!< in: rollback segment */
419
419
        trx_rsegf_t*    rseg_hdr,/*!< in: rollback segment header, page
420
420
                                x-latched */
421
421
        ulint           type,   /*!< in: type of the segment: TRX_UNDO_INSERT or
817
817
trx_undo_parse_discard_latest(
818
818
/*==========================*/
819
819
        byte*   ptr,    /*!< in: buffer */
820
 
        byte*   /*end_ptr*/, /*!< in: buffer end */
 
820
        byte*   end_ptr __attribute__((unused)), /*!< in: buffer end */
821
821
        page_t* page,   /*!< in: page or NULL */
822
822
        mtr_t*  mtr)    /*!< in: mtr or NULL */
823
823
{
1009
1009
void
1010
1010
trx_undo_free_page_in_rollback(
1011
1011
/*===========================*/
1012
 
        trx_t*          /*trx*/, /*!< in: transaction */
 
1012
        trx_t*          trx __attribute__((unused)), /*!< in: transaction */
1013
1013
        trx_undo_t*     undo,   /*!< in: undo log memory copy */
1014
1014
        ulint           page_no,/*!< in: page number to free: must not be the
1015
1015
                                header page */
1072
1072
        ulint           last_page_no;
1073
1073
        trx_undo_rec_t* rec;
1074
1074
        trx_undo_rec_t* trunc_here;
 
1075
        trx_rseg_t*     rseg;
1075
1076
        mtr_t           mtr;
1076
1077
 
1077
1078
        ut_ad(mutex_own(&(trx->undo_mutex)));
1078
1079
        ut_ad(mutex_own(&(trx->rseg->mutex)));
1079
1080
 
 
1081
        rseg = trx->rseg;
 
1082
 
1080
1083
        for (;;) {
1081
1084
                mtr_start(&mtr);
1082
1085
 
1457
1460
                ut_error;
1458
1461
        }
1459
1462
 
1460
 
        undo = static_cast<trx_undo_t *>(mem_alloc(sizeof(trx_undo_t)));
 
1463
        undo = mem_alloc(sizeof(trx_undo_t));
1461
1464
 
1462
1465
        if (undo == NULL) {
1463
1466
 
1798
1801
page_t*
1799
1802
trx_undo_set_state_at_finish(
1800
1803
/*=========================*/
 
1804
        trx_rseg_t*     rseg,   /*!< in: rollback segment memory object */
 
1805
        trx_t*          trx __attribute__((unused)), /*!< in: transaction */
1801
1806
        trx_undo_t*     undo,   /*!< in: undo log memory copy */
1802
1807
        mtr_t*          mtr)    /*!< in: mtr */
1803
1808
{
1806
1811
        page_t*         undo_page;
1807
1812
        ulint           state;
1808
1813
 
 
1814
        ut_ad(trx);
1809
1815
        ut_ad(undo);
1810
1816
        ut_ad(mtr);
 
1817
        ut_ad(mutex_own(&rseg->mutex));
1811
1818
 
1812
1819
        if (undo->id >= TRX_RSEG_N_SLOTS) {
1813
1820
                fprintf(stderr, "InnoDB: Error: undo->id is %lu\n",
1826
1833
            && mach_read_from_2(page_hdr + TRX_UNDO_PAGE_FREE)
1827
1834
               < TRX_UNDO_PAGE_REUSE_LIMIT) {
1828
1835
 
1829
 
                state = TRX_UNDO_CACHED;
 
1836
                /* This is a heuristic to avoid the problem of all UNDO
 
1837
                slots ending up in one of the UNDO lists. Previously if
 
1838
                the server crashed with all the slots in one of the lists,
 
1839
                transactions that required the slots of a different type
 
1840
                would fail for lack of slots. */
 
1841
 
 
1842
                if (UT_LIST_GET_LEN(rseg->update_undo_list) < 500
 
1843
                    && UT_LIST_GET_LEN(rseg->insert_undo_list) < 500) {
 
1844
 
 
1845
                        state = TRX_UNDO_CACHED;
 
1846
                } else {
 
1847
                        state = TRX_UNDO_TO_FREE;
 
1848
                }
1830
1849
 
1831
1850
        } else if (undo->type == TRX_UNDO_INSERT) {
1832
1851
 
1854
1873
        mtr_t*          mtr)    /*!< in: mtr */
1855
1874
{
1856
1875
        trx_usegf_t*    seg_hdr;
 
1876
        trx_upagef_t*   page_hdr;
1857
1877
        trx_ulogf_t*    undo_header;
1858
1878
        page_t*         undo_page;
1859
1879
        ulint           offset;
1871
1891
                                      undo->hdr_page_no, mtr);
1872
1892
 
1873
1893
        seg_hdr = undo_page + TRX_UNDO_SEG_HDR;
 
1894
        page_hdr = undo_page + TRX_UNDO_PAGE_HDR;
1874
1895
 
1875
1896
        /*------------------------------*/
1876
1897
        undo->state = TRX_UNDO_PREPARED;