[Draft] buf_page_get_mutex_enter() is used either redundantly, either dangerously
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Server moved to https://jira.percona.com/projects/PS |
Invalid
|
High
|
Unassigned | ||
5.1 |
Won't Fix
|
High
|
Unassigned | ||
5.5 |
Triaged
|
High
|
Unassigned | ||
5.6 |
Invalid
|
High
|
Unassigned |
Bug Description
This is a draft description for further analysis.
A port of buf_page_
In 5.5 it is defined as
/******
Gets the mutex of a block.
@return pointer to mutex protecting bpage */
UNIV_INLINE
mutex_t*
buf_page_get_mutex(
/*===============*/
const buf_page_t* bpage) /*!< in: pointer to control block */
{
buf_pool_t* buf_pool = buf_pool_
if (/*equivalent to buf_pool_
bpage >= &buf_pool->watch[0]
&& bpage < &buf_pool-
/* TODO: this code is the interim. should be confirmed later. */
return(
}
switch (buf_page_
case BUF_BLOCK_ZIP_FREE:
/* ut_error; */ /* optimistic */
return(NULL);
case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_
return(
default:
return(
}
}
/******
Gets the mutex of a block and enter the mutex with consistency. */
UNIV_INLINE
mutex_t*
buf_page_
/*=====
const buf_page_t* bpage) /*!< in: pointer to control block */
{
mutex_t* block_mutex;
while(1) {
block_mutex = buf_page_
if (!block_mutex)
return block_mutex;
mutex_
if (block_mutex == buf_page_
return block_mutex;
mutex_
}
}
It hard to say what "consistency" in "enter the mutex with consistency" means.
It appears to protect from the buffer page state transition race conditions, namely, from the page moving between BUF_POOL_
The buffer page state transitions are protected by buffer pool mutexes, thus this appears to handle the situation where none are held. But then, depending on where the bpage pointer was taken from, the pointer itself may become invalid if it points not to a buffer pool frame but to a compressed page descriptor that might get freed. Then the protection offered by buf_page_
tags: | added: bp-split xtradb |
Changed in percona-server: | |
assignee: | Laurynas Biveinis (laurynas-biveinis) → nobody |
buf_page_ get_mutex( ) patch to handle BUF_BLOCK_ZIP_FREE and BUF_BLOCK_ POOL_WATCH is suspicious on its own too.