~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Monty Taylor
  • Date: 2008-09-15 17:24:04 UTC
  • Revision ID: monty@inaugust.com-20080915172404-ygh6hiyu0q7qpa9x
Removed strndup calls.

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