~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/include/buf0flu.ic

  • 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) 1995, 2009, Innobase Oy. All Rights Reserved.
 
3
Copyright (C) 1995, 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., 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
 
34
34
void
35
35
buf_flush_insert_into_flush_list(
36
36
/*=============================*/
37
 
        buf_block_t*    block); /*!< in/out: block which is modified */
 
37
        buf_pool_t*     buf_pool,       /*!< buffer pool instance */
 
38
        buf_block_t*    block,          /*!< in/out: block which is modified */
 
39
        ib_uint64_t     lsn);           /*!< in: oldest modification */
38
40
/********************************************************************//**
39
41
Inserts a modified block into the flush list in the right sorted position.
40
42
This function is used by recovery, because there the modifications do not
43
45
void
44
46
buf_flush_insert_sorted_into_flush_list(
45
47
/*====================================*/
46
 
        buf_block_t*    block); /*!< in/out: block which is modified */
 
48
        buf_pool_t*     buf_pool,       /*!< buffer pool instance */
 
49
        buf_block_t*    block,          /*!< in/out: block which is modified */
 
50
        ib_uint64_t     lsn);           /*!< in: oldest modification */
47
51
 
48
52
/********************************************************************//**
49
53
This function should be called at a mini-transaction commit, if a page was
56
60
        buf_block_t*    block,  /*!< in: block which is modified */
57
61
        mtr_t*          mtr)    /*!< in: mtr */
58
62
{
 
63
        buf_pool_t*     buf_pool = buf_pool_from_block(block);
 
64
 
59
65
        ut_ad(block);
60
66
        ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
61
67
        ut_ad(block->page.buf_fix_count > 0);
62
68
#ifdef UNIV_SYNC_DEBUG
63
69
        ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
64
70
#endif /* UNIV_SYNC_DEBUG */
65
 
        ut_ad(buf_pool_mutex_own());
 
71
 
 
72
        ut_ad(!buf_pool_mutex_own(buf_pool));
 
73
        ut_ad(!buf_flush_list_mutex_own(buf_pool));
 
74
        ut_ad(log_flush_order_mutex_own());
66
75
 
67
76
        ut_ad(mtr->start_lsn != 0);
68
77
        ut_ad(mtr->modifications);
 
78
 
 
79
        mutex_enter(&block->mutex);
69
80
        ut_ad(block->page.newest_modification <= mtr->end_lsn);
70
81
 
71
82
        block->page.newest_modification = mtr->end_lsn;
72
83
 
73
84
        if (!block->page.oldest_modification) {
74
 
 
75
 
                block->page.oldest_modification = mtr->start_lsn;
76
 
                ut_ad(block->page.oldest_modification != 0);
77
 
 
78
 
                buf_flush_insert_into_flush_list(block);
 
85
                buf_flush_insert_into_flush_list(
 
86
                        buf_pool, block, mtr->start_lsn);
79
87
        } else {
80
88
                ut_ad(block->page.oldest_modification <= mtr->start_lsn);
81
89
        }
82
90
 
 
91
        mutex_exit(&block->mutex);
 
92
 
83
93
        ++srv_buf_pool_write_requests;
84
94
}
85
95
 
95
105
        ib_uint64_t     end_lsn)        /*!< in: end lsn of the last mtr in the
96
106
                                        set of mtr's */
97
107
{
 
108
        buf_pool_t*     buf_pool = buf_pool_from_block(block);
 
109
 
98
110
        ut_ad(block);
99
111
        ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
100
112
        ut_ad(block->page.buf_fix_count > 0);
102
114
        ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
103
115
#endif /* UNIV_SYNC_DEBUG */
104
116
 
105
 
        buf_pool_mutex_enter();
 
117
        ut_ad(!buf_pool_mutex_own(buf_pool));
 
118
        ut_ad(!buf_flush_list_mutex_own(buf_pool));
 
119
        ut_ad(log_flush_order_mutex_own());
106
120
 
 
121
        ut_ad(start_lsn != 0);
107
122
        ut_ad(block->page.newest_modification <= end_lsn);
108
123
 
 
124
        mutex_enter(&block->mutex);
109
125
        block->page.newest_modification = end_lsn;
110
126
 
111
127
        if (!block->page.oldest_modification) {
112
 
 
113
 
                block->page.oldest_modification = start_lsn;
114
 
 
115
 
                ut_ad(block->page.oldest_modification != 0);
116
 
 
117
 
                buf_flush_insert_sorted_into_flush_list(block);
 
128
                buf_flush_insert_sorted_into_flush_list(
 
129
                        buf_pool, block, start_lsn);
118
130
        } else {
119
131
                ut_ad(block->page.oldest_modification <= start_lsn);
120
132
        }
121
133
 
122
 
        buf_pool_mutex_exit();
 
134
        mutex_exit(&block->mutex);
 
135
 
123
136
}
124
137
#endif /* !UNIV_HOTBACKUP */