~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2008-10-28 08:36:02 UTC
  • mfrom: (520.4.13 merge-innodb-plugin)
  • Revision ID: brian@tangent.org-20081028083602-0p3zzlhlxr5q2sqo
Merging Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
#include "buf0buf.h"
10
10
#include "mtr0mtr.h"
11
 
 
12
 
/************************************************************************
13
 
Inserts a modified block into the flush list. */
14
 
 
15
 
void
16
 
buf_flush_insert_into_flush_list(
17
 
/*=============================*/
18
 
        buf_block_t*    block); /* in: block which is modified */
 
11
#include "srv0srv.h"
 
12
 
19
13
/************************************************************************
20
14
Inserts a modified block into the flush list in the right sorted position.
21
15
This function is used by recovery, because there the modifications do not
22
16
necessarily come in the order of lsn's. */
23
 
 
 
17
UNIV_INTERN
24
18
void
25
19
buf_flush_insert_sorted_into_flush_list(
26
20
/*====================================*/
27
 
        buf_block_t*    block); /* in: block which is modified */
 
21
        buf_page_t*     bpage); /* in: block which is modified */
28
22
 
29
23
/************************************************************************
30
24
This function should be called at a mini-transaction commit, if a page was
38
32
        mtr_t*          mtr)    /* in: mtr */
39
33
{
40
34
        ut_ad(block);
41
 
        ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
42
 
        ut_ad(block->buf_fix_count > 0);
 
35
        ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
 
36
        ut_ad(block->page.buf_fix_count > 0);
43
37
#ifdef UNIV_SYNC_DEBUG
44
38
        ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
45
39
#endif /* UNIV_SYNC_DEBUG */
46
 
        ut_ad(mutex_own(&(buf_pool->mutex)));
 
40
        ut_ad(buf_pool_mutex_own());
47
41
 
48
 
        ut_ad(ut_dulint_cmp(mtr->start_lsn, ut_dulint_zero) != 0);
 
42
        ut_ad(mtr->start_lsn != 0);
49
43
        ut_ad(mtr->modifications);
50
 
        ut_ad(ut_dulint_cmp(block->newest_modification, mtr->end_lsn) <= 0);
51
 
 
52
 
        block->newest_modification = mtr->end_lsn;
53
 
 
54
 
        if (ut_dulint_is_zero(block->oldest_modification)) {
55
 
 
56
 
                block->oldest_modification = mtr->start_lsn;
57
 
                ut_ad(!ut_dulint_is_zero(block->oldest_modification));
58
 
 
59
 
                buf_flush_insert_into_flush_list(block);
 
44
        ut_ad(block->page.newest_modification <= mtr->end_lsn);
 
45
 
 
46
        block->page.newest_modification = mtr->end_lsn;
 
47
 
 
48
        if (!block->page.oldest_modification) {
 
49
 
 
50
                block->page.oldest_modification = mtr->start_lsn;
 
51
                ut_ad(block->page.oldest_modification != 0);
 
52
 
 
53
                buf_flush_insert_into_flush_list(&block->page);
60
54
        } else {
61
 
                ut_ad(ut_dulint_cmp(block->oldest_modification,
62
 
                                    mtr->start_lsn) <= 0);
 
55
                ut_ad(block->page.oldest_modification <= mtr->start_lsn);
63
56
        }
64
57
 
65
58
        ++srv_buf_pool_write_requests;
72
65
buf_flush_recv_note_modification(
73
66
/*=============================*/
74
67
        buf_block_t*    block,          /* in: block which is modified */
75
 
        dulint          start_lsn,      /* in: start lsn of the first mtr in a
 
68
        ib_uint64_t     start_lsn,      /* in: start lsn of the first mtr in a
76
69
                                        set of mtr's */
77
 
        dulint          end_lsn)        /* in: end lsn of the last mtr in the
 
70
        ib_uint64_t     end_lsn)        /* in: end lsn of the last mtr in the
78
71
                                        set of mtr's */
79
72
{
80
73
        ut_ad(block);
81
 
        ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
82
 
        ut_ad(block->buf_fix_count > 0);
 
74
        ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
 
75
        ut_ad(block->page.buf_fix_count > 0);
83
76
#ifdef UNIV_SYNC_DEBUG
84
77
        ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
85
78
#endif /* UNIV_SYNC_DEBUG */
86
79
 
87
 
        mutex_enter(&(buf_pool->mutex));
88
 
 
89
 
        ut_ad(ut_dulint_cmp(block->newest_modification, end_lsn) <= 0);
90
 
 
91
 
        block->newest_modification = end_lsn;
92
 
 
93
 
        if (ut_dulint_is_zero(block->oldest_modification)) {
94
 
 
95
 
                block->oldest_modification = start_lsn;
96
 
 
97
 
                ut_ad(!ut_dulint_is_zero(block->oldest_modification));
98
 
 
99
 
                buf_flush_insert_sorted_into_flush_list(block);
 
80
        buf_pool_mutex_enter();
 
81
 
 
82
        ut_ad(block->page.newest_modification <= end_lsn);
 
83
 
 
84
        block->page.newest_modification = end_lsn;
 
85
 
 
86
        if (!block->page.oldest_modification) {
 
87
 
 
88
                block->page.oldest_modification = start_lsn;
 
89
 
 
90
                ut_ad(block->page.oldest_modification != 0);
 
91
 
 
92
                buf_flush_insert_sorted_into_flush_list(&block->page);
100
93
        } else {
101
 
                ut_ad(ut_dulint_cmp(block->oldest_modification,
102
 
                                    start_lsn) <= 0);
 
94
                ut_ad(block->page.oldest_modification <= start_lsn);
103
95
        }
104
96
 
105
 
        mutex_exit(&(buf_pool->mutex));
 
97
        buf_pool_mutex_exit();
106
98
}