Commit c0fd7331 authored by marko's avatar marko

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).
parent cb169c67
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment