1
1
/*****************************************************************************
3
Copyright (c) 1995, 2010, Innobase Oy. All Rights Reserved.
3
Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
4
4
Copyright (c) 2008, Google Inc.
6
6
Portions of this file contain modifications contributed and copyrighted by
64
64
/********************************************************************//**
65
Tells if a block is still close enough to the MRU end of the LRU list
66
meaning that it is not in danger of getting evicted and also implying
67
that it has been accessed recently.
68
Note that this is for heuristics only and does not reserve buffer pool
70
@return TRUE if block is close to MRU end of LRU */
73
buf_page_peek_if_young(
74
/*===================*/
75
const buf_page_t* bpage) /*!< in: block */
77
/* FIXME: bpage->freed_page_clock is 31 bits */
78
return((buf_pool->freed_page_clock & ((1UL << 31) - 1))
79
< ((ulint) bpage->freed_page_clock
80
+ (buf_pool->curr_size
81
* (BUF_LRU_OLD_RATIO_DIV - buf_LRU_old_ratio)
82
/ (BUF_LRU_OLD_RATIO_DIV * 4))));
85
/********************************************************************//**
65
86
Recommends a move of a block to the start of the LRU list if there is danger
66
87
of dropping from the buffer pool. NOTE: does not reserve the buffer pool
89
110
buf_pool->stat.n_pages_not_made_young++;
92
/* FIXME: bpage->freed_page_clock is 31 bits */
93
return((buf_pool->freed_page_clock & ((1UL << 31) - 1))
94
> ((ulint) bpage->freed_page_clock
95
+ (buf_pool->curr_size
96
* (BUF_LRU_OLD_RATIO_DIV - buf_LRU_old_ratio)
97
/ (BUF_LRU_OLD_RATIO_DIV * 4))));
113
return(!buf_page_peek_if_young(bpage));
717
733
/********************************************************************//**
734
Allocates a buf_page_t descriptor. This function must succeed. In case
735
of failure we assert in this function.
736
@return: the allocated descriptor. */
739
buf_page_alloc_descriptor(void)
740
/*===========================*/
744
bpage = (buf_page_t*) ut_malloc(sizeof *bpage);
745
ut_d(memset(bpage, 0, sizeof *bpage));
746
UNIV_MEM_ALLOC(bpage, sizeof *bpage);
751
/********************************************************************//**
752
Free a buf_page_t descriptor. */
755
buf_page_free_descriptor(
756
/*=====================*/
757
buf_page_t* bpage) /*!< in: bpage descriptor to free. */
762
/********************************************************************//**
718
763
Allocates a buffer block.
719
764
@return own: the allocated block, in state BUF_BLOCK_MEMORY */
724
ulint zip_size) /*!< in: compressed page size in bytes,
725
or 0 if uncompressed tablespace */
767
buf_block_alloc(void)
768
/*=================*/
727
770
buf_block_t* block;
729
block = buf_LRU_get_free_block(zip_size);
772
block = buf_LRU_get_free_block();
731
774
buf_block_set_state(block, BUF_BLOCK_MEMORY);
1073
1116
where we have acquired latch */
1074
1117
ulint level) /*!< in: latching order level */
1076
sync_thread_add_level(&block->lock, level);
1119
sync_thread_add_level(&block->lock, level, FALSE);
1078
1121
#endif /* UNIV_SYNC_DEBUG */
1079
1122
#endif /* !UNIV_HOTBACKUP */