1
/******************************************************
2
The database buffer pool flush algorithm
6
Created 11/5/1995 Heikki Tuuri
7
*******************************************************/
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
/************************************************************************
20
Inserts a modified block into the flush list in the right sorted position.
21
This function is used by recovery, because there the modifications do not
22
necessarily come in the order of lsn's. */
25
buf_flush_insert_sorted_into_flush_list(
26
/*====================================*/
27
buf_block_t* block); /* in: block which is modified */
29
/************************************************************************
30
This function should be called at a mini-transaction commit, if a page was
31
modified in it. Puts the block to the list of modified blocks, if it is not
35
buf_flush_note_modification(
36
/*========================*/
37
buf_block_t* block, /* in: block which is modified */
38
mtr_t* mtr) /* in: mtr */
41
ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
42
ut_ad(block->buf_fix_count > 0);
43
#ifdef UNIV_SYNC_DEBUG
44
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
45
#endif /* UNIV_SYNC_DEBUG */
46
ut_ad(mutex_own(&(buf_pool->mutex)));
48
ut_ad(ut_dulint_cmp(mtr->start_lsn, ut_dulint_zero) != 0);
49
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);
61
ut_ad(ut_dulint_cmp(block->oldest_modification,
62
mtr->start_lsn) <= 0);
65
++srv_buf_pool_write_requests;
68
/************************************************************************
69
This function should be called when recovery has modified a buffer page. */
72
buf_flush_recv_note_modification(
73
/*=============================*/
74
buf_block_t* block, /* in: block which is modified */
75
dulint start_lsn, /* in: start lsn of the first mtr in a
77
dulint 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);
83
#ifdef UNIV_SYNC_DEBUG
84
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
85
#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);
101
ut_ad(ut_dulint_cmp(block->oldest_modification,
105
mutex_exit(&(buf_pool->mutex));