~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*****************************************************************************
2
 
 
3
 
Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved.
4
 
 
5
 
This program is free software; you can redistribute it and/or modify it under
6
 
the terms of the GNU General Public License as published by the Free Software
7
 
Foundation; version 2 of the License.
8
 
 
9
 
This program is distributed in the hope that it will be useful, but WITHOUT
10
 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
 
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12
 
 
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
16
 
 
17
 
*****************************************************************************/
18
 
 
19
 
/**************************************************//**
20
 
@file include/buf0flu.ic
21
 
The database buffer pool flush algorithm
22
 
 
23
 
Created 11/5/1995 Heikki Tuuri
24
 
*******************************************************/
25
 
 
26
 
#ifndef UNIV_HOTBACKUP
27
 
#include "buf0buf.h"
28
 
#include "mtr0mtr.h"
29
 
#include "srv0srv.h"
30
 
 
31
 
/********************************************************************//**
32
 
Inserts a modified block into the flush list. */
33
 
UNIV_INTERN
34
 
void
35
 
buf_flush_insert_into_flush_list(
36
 
/*=============================*/
37
 
        buf_block_t*    block); /*!< in/out: block which is modified */
38
 
/********************************************************************//**
39
 
Inserts a modified block into the flush list in the right sorted position.
40
 
This function is used by recovery, because there the modifications do not
41
 
necessarily come in the order of lsn's. */
42
 
UNIV_INTERN
43
 
void
44
 
buf_flush_insert_sorted_into_flush_list(
45
 
/*====================================*/
46
 
        buf_block_t*    block); /*!< in/out: block which is modified */
47
 
 
48
 
/********************************************************************//**
49
 
This function should be called at a mini-transaction commit, if a page was
50
 
modified in it. Puts the block to the list of modified blocks, if it is not
51
 
already in it. */
52
 
UNIV_INLINE
53
 
void
54
 
buf_flush_note_modification(
55
 
/*========================*/
56
 
        buf_block_t*    block,  /*!< in: block which is modified */
57
 
        mtr_t*          mtr)    /*!< in: mtr */
58
 
{
59
 
        ut_ad(block);
60
 
        ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
61
 
        ut_ad(block->page.buf_fix_count > 0);
62
 
#ifdef UNIV_SYNC_DEBUG
63
 
        ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
64
 
#endif /* UNIV_SYNC_DEBUG */
65
 
        ut_ad(buf_pool_mutex_own());
66
 
 
67
 
        ut_ad(mtr->start_lsn != 0);
68
 
        ut_ad(mtr->modifications);
69
 
        ut_ad(block->page.newest_modification <= mtr->end_lsn);
70
 
 
71
 
        block->page.newest_modification = mtr->end_lsn;
72
 
 
73
 
        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);
79
 
        } else {
80
 
                ut_ad(block->page.oldest_modification <= mtr->start_lsn);
81
 
        }
82
 
 
83
 
        ++srv_buf_pool_write_requests;
84
 
}
85
 
 
86
 
/********************************************************************//**
87
 
This function should be called when recovery has modified a buffer page. */
88
 
UNIV_INLINE
89
 
void
90
 
buf_flush_recv_note_modification(
91
 
/*=============================*/
92
 
        buf_block_t*    block,          /*!< in: block which is modified */
93
 
        ib_uint64_t     start_lsn,      /*!< in: start lsn of the first mtr in a
94
 
                                        set of mtr's */
95
 
        ib_uint64_t     end_lsn)        /*!< in: end lsn of the last mtr in the
96
 
                                        set of mtr's */
97
 
{
98
 
        ut_ad(block);
99
 
        ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
100
 
        ut_ad(block->page.buf_fix_count > 0);
101
 
#ifdef UNIV_SYNC_DEBUG
102
 
        ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
103
 
#endif /* UNIV_SYNC_DEBUG */
104
 
 
105
 
        buf_pool_mutex_enter();
106
 
 
107
 
        ut_ad(block->page.newest_modification <= end_lsn);
108
 
 
109
 
        block->page.newest_modification = end_lsn;
110
 
 
111
 
        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);
118
 
        } else {
119
 
                ut_ad(block->page.oldest_modification <= start_lsn);
120
 
        }
121
 
 
122
 
        buf_pool_mutex_exit();
123
 
}
124
 
#endif /* !UNIV_HOTBACKUP */