@ -790,12 +790,25 @@ buf_LRU_old_adjust_len(void)
# if 3 * (BUF_LRU_OLD_MIN_LEN / 8) <= BUF_LRU_OLD_TOLERANCE + 5
# if 3 * (BUF_LRU_OLD_MIN_LEN / 8) <= BUF_LRU_OLD_TOLERANCE + 5
# error "3 * (BUF_LRU_OLD_MIN_LEN / 8) <= BUF_LRU_OLD_TOLERANCE + 5"
# error "3 * (BUF_LRU_OLD_MIN_LEN / 8) <= BUF_LRU_OLD_TOLERANCE + 5"
# endif
# endif
# ifdef UNIV_LRU_DEBUG
/* buf_pool->LRU_old must be the first item in the LRU list
whose " old " flag is set . */
ut_a ( buf_pool - > LRU_old - > old ) ;
ut_a ( ! UT_LIST_GET_PREV ( LRU , buf_pool - > LRU_old )
| | ! UT_LIST_GET_PREV ( LRU , buf_pool - > LRU_old ) - > old ) ;
ut_a ( ! UT_LIST_GET_NEXT ( LRU , buf_pool - > LRU_old )
| | UT_LIST_GET_NEXT ( LRU , buf_pool - > LRU_old ) - > old ) ;
# endif /* UNIV_LRU_DEBUG */
for ( ; ; ) {
for ( ; ; ) {
old_len = buf_pool - > LRU_old_len ;
old_len = buf_pool - > LRU_old_len ;
new_len = 3 * ( UT_LIST_GET_LEN ( buf_pool - > LRU ) / 8 ) ;
new_len = 3 * ( UT_LIST_GET_LEN ( buf_pool - > LRU ) / 8 ) ;
ut_ad ( buf_pool - > LRU_old - > in_LRU_list ) ;
ut_ad ( buf_pool - > LRU_old - > in_LRU_list ) ;
ut_a ( buf_pool - > LRU_old ) ;
# ifdef UNIV_LRU_DEBUG
ut_a ( buf_pool - > LRU_old - > old ) ;
# endif /* UNIV_LRU_DEBUG */
/* Update the LRU_old pointer if necessary */
/* Update the LRU_old pointer if necessary */
@ -803,6 +816,9 @@ buf_LRU_old_adjust_len(void)
buf_pool - > LRU_old = UT_LIST_GET_PREV (
buf_pool - > LRU_old = UT_LIST_GET_PREV (
LRU , buf_pool - > LRU_old ) ;
LRU , buf_pool - > LRU_old ) ;
# ifdef UNIV_LRU_DEBUG
ut_a ( ! buf_pool - > LRU_old - > old ) ;
# endif /* UNIV_LRU_DEBUG */
buf_page_set_old ( buf_pool - > LRU_old , TRUE ) ;
buf_page_set_old ( buf_pool - > LRU_old , TRUE ) ;
buf_pool - > LRU_old_len + + ;
buf_pool - > LRU_old_len + + ;
@ -813,8 +829,6 @@ buf_LRU_old_adjust_len(void)
LRU , buf_pool - > LRU_old ) ;
LRU , buf_pool - > LRU_old ) ;
buf_pool - > LRU_old_len - - ;
buf_pool - > LRU_old_len - - ;
} else {
} else {
ut_a ( buf_pool - > LRU_old ) ; /* Check that we did not
fall out of the LRU list */
return ;
return ;
}
}
}
}
@ -901,6 +915,9 @@ buf_LRU_remove_block(
buf_pool - > LRU_old = UT_LIST_GET_PREV ( LRU , bpage ) ;
buf_pool - > LRU_old = UT_LIST_GET_PREV ( LRU , bpage ) ;
ut_a ( buf_pool - > LRU_old ) ;
ut_a ( buf_pool - > LRU_old ) ;
# ifdef UNIV_LRU_DEBUG
ut_a ( ! buf_pool - > LRU_old - > old ) ;
# endif /* UNIV_LRU_DEBUG */
buf_page_set_old ( buf_pool - > LRU_old , TRUE ) ;
buf_page_set_old ( buf_pool - > LRU_old , TRUE ) ;
buf_pool - > LRU_old_len + + ;
buf_pool - > LRU_old_len + + ;
@ -1042,6 +1059,15 @@ buf_LRU_add_block_low(
bpage - > LRU_position = buf_pool_clock_tic ( ) ;
bpage - > LRU_position = buf_pool_clock_tic ( ) ;
bpage - > freed_page_clock = buf_pool - > freed_page_clock ;
bpage - > freed_page_clock = buf_pool - > freed_page_clock ;
} else {
} else {
# ifdef UNIV_LRU_DEBUG
/* buf_pool->LRU_old must be the first item in the LRU list
whose " old " flag is set . */
ut_a ( buf_pool - > LRU_old - > old ) ;
ut_a ( ! UT_LIST_GET_PREV ( LRU , buf_pool - > LRU_old )
| | ! UT_LIST_GET_PREV ( LRU , buf_pool - > LRU_old ) - > old ) ;
ut_a ( ! UT_LIST_GET_NEXT ( LRU , buf_pool - > LRU_old )
| | UT_LIST_GET_NEXT ( LRU , buf_pool - > LRU_old ) - > old ) ;
# endif /* UNIV_LRU_DEBUG */
UT_LIST_INSERT_AFTER ( LRU , buf_pool - > LRU , buf_pool - > LRU_old ,
UT_LIST_INSERT_AFTER ( LRU , buf_pool - > LRU , buf_pool - > LRU_old ,
bpage ) ;
bpage ) ;
buf_pool - > LRU_old_len + + ;
buf_pool - > LRU_old_len + + ;
@ -1252,6 +1278,15 @@ alloc:
buf_pool - > LRU_old = b ;
buf_pool - > LRU_old = b ;
}
}
# ifdef UNIV_LRU_DEBUG
ut_a ( prev_b - > old
| | ! UT_LIST_GET_NEXT ( LRU , b )
| | UT_LIST_GET_NEXT ( LRU , b ) - > old ) ;
} else {
ut_a ( ! prev_b - > old
| | ! UT_LIST_GET_NEXT ( LRU , b )
| | ! UT_LIST_GET_NEXT ( LRU , b ) - > old ) ;
# endif /* UNIV_LRU_DEBUG */
}
}
lru_len = UT_LIST_GET_LEN ( buf_pool - > LRU ) ;
lru_len = UT_LIST_GET_LEN ( buf_pool - > LRU ) ;