mirror of
https://github.com/MariaDB/server.git
synced 2025-01-26 00:34:18 +01:00
UT_LIST_REMOVE(): Invalidate the node pointers #ifdef UNIV_DEBUG.
buf_LRU_invalidate_tablespace(): Invoke UT_LIST_GET_PREV(LRU, block) before UT_LIST_REMOVE(LRU, buf_pool->LRU, block).
This commit is contained in:
parent
65896985e7
commit
c3f7a6ebfc
2 changed files with 28 additions and 17 deletions
|
@ -86,8 +86,10 @@ scan_again:
|
|||
block = UT_LIST_GET_LAST(buf_pool->LRU);
|
||||
|
||||
while (block != NULL) {
|
||||
buf_block_t* prev_block;
|
||||
|
||||
mutex_enter(&block->mutex);
|
||||
prev_block = UT_LIST_GET_PREV(LRU, block);
|
||||
|
||||
ut_a(block->state == BUF_BLOCK_FILE_PAGE);
|
||||
|
||||
|
@ -144,7 +146,7 @@ scan_again:
|
|||
}
|
||||
next_page:
|
||||
mutex_exit(&block->mutex);
|
||||
block = UT_LIST_GET_PREV(LRU, block);
|
||||
block = prev_block;
|
||||
}
|
||||
|
||||
mutex_exit(&(buf_pool->mutex));
|
||||
|
|
|
@ -123,27 +123,36 @@ name, NODE1 and NODE2 are pointers to nodes. */
|
|||
}\
|
||||
}\
|
||||
|
||||
/* Invalidate the pointers in a list node. */
|
||||
#ifdef UNIV_DEBUG
|
||||
# define UT_LIST_REMOVE_CLEAR(NAME, N) \
|
||||
((N)->NAME.prev = (N)->NAME.next = (void*) -1)
|
||||
#else
|
||||
# define UT_LIST_REMOVE_CLEAR(NAME, N) while (0)
|
||||
#endif
|
||||
|
||||
/***********************************************************************
|
||||
Removes a node from a two-way linked list. BASE has to be the base node
|
||||
(not a pointer to it). N has to be the pointer to the node to be removed
|
||||
from the list. NAME is the list name. */
|
||||
|
||||
#define UT_LIST_REMOVE(NAME, BASE, N)\
|
||||
{\
|
||||
ut_ad(N);\
|
||||
ut_a((BASE).count > 0);\
|
||||
((BASE).count)--;\
|
||||
if (((N)->NAME).next != NULL) {\
|
||||
((((N)->NAME).next)->NAME).prev = ((N)->NAME).prev;\
|
||||
} else {\
|
||||
(BASE).end = ((N)->NAME).prev;\
|
||||
}\
|
||||
if (((N)->NAME).prev != NULL) {\
|
||||
((((N)->NAME).prev)->NAME).next = ((N)->NAME).next;\
|
||||
} else {\
|
||||
(BASE).start = ((N)->NAME).next;\
|
||||
}\
|
||||
}\
|
||||
#define UT_LIST_REMOVE(NAME, BASE, N) \
|
||||
do { \
|
||||
ut_ad(N); \
|
||||
ut_a((BASE).count > 0); \
|
||||
((BASE).count)--; \
|
||||
if (((N)->NAME).next != NULL) { \
|
||||
((((N)->NAME).next)->NAME).prev = ((N)->NAME).prev; \
|
||||
} else { \
|
||||
(BASE).end = ((N)->NAME).prev; \
|
||||
} \
|
||||
if (((N)->NAME).prev != NULL) { \
|
||||
((((N)->NAME).prev)->NAME).next = ((N)->NAME).next; \
|
||||
} else { \
|
||||
(BASE).start = ((N)->NAME).next; \
|
||||
} \
|
||||
UT_LIST_REMOVE_CLEAR(NAME, N); \
|
||||
} while (0)
|
||||
|
||||
/************************************************************************
|
||||
Gets the next node in a two-way list. NAME is the name of the list
|
||||
|
|
Loading…
Add table
Reference in a new issue