10
10
#include "mtr0mtr.h"
12
/************************************************************************
13
Inserts a modified block into the flush list. */
16
buf_flush_insert_into_flush_list(
17
/*=============================*/
18
buf_block_t* block); /* in: block which is modified */
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. */
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 */
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 */
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());
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);
52
block->newest_modification = mtr->end_lsn;
54
if (ut_dulint_is_zero(block->oldest_modification)) {
56
block->oldest_modification = mtr->start_lsn;
57
ut_ad(!ut_dulint_is_zero(block->oldest_modification));
59
buf_flush_insert_into_flush_list(block);
44
ut_ad(block->page.newest_modification <= mtr->end_lsn);
46
block->page.newest_modification = mtr->end_lsn;
48
if (!block->page.oldest_modification) {
50
block->page.oldest_modification = mtr->start_lsn;
51
ut_ad(block->page.oldest_modification != 0);
53
buf_flush_insert_into_flush_list(&block->page);
61
ut_ad(ut_dulint_cmp(block->oldest_modification,
62
mtr->start_lsn) <= 0);
55
ut_ad(block->page.oldest_modification <= mtr->start_lsn);
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
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
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 */
87
mutex_enter(&(buf_pool->mutex));
89
ut_ad(ut_dulint_cmp(block->newest_modification, end_lsn) <= 0);
91
block->newest_modification = end_lsn;
93
if (ut_dulint_is_zero(block->oldest_modification)) {
95
block->oldest_modification = start_lsn;
97
ut_ad(!ut_dulint_is_zero(block->oldest_modification));
99
buf_flush_insert_sorted_into_flush_list(block);
80
buf_pool_mutex_enter();
82
ut_ad(block->page.newest_modification <= end_lsn);
84
block->page.newest_modification = end_lsn;
86
if (!block->page.oldest_modification) {
88
block->page.oldest_modification = start_lsn;
90
ut_ad(block->page.oldest_modification != 0);
92
buf_flush_insert_sorted_into_flush_list(&block->page);
101
ut_ad(ut_dulint_cmp(block->oldest_modification,
94
ut_ad(block->page.oldest_modification <= start_lsn);
105
mutex_exit(&(buf_pool->mutex));
97
buf_pool_mutex_exit();