mirror of
https://github.com/MariaDB/server.git
synced 2025-12-12 08:01:43 +03:00
branches/zip: Add UNIV_HASH_DEBUG for detecting multiple invocations
of HASH_DELETE(). HASH_ASSERT_VALID(), HASH_INVALIDATE(): New macros, used in HASH_DELETE() and HASH_SEARCH(). buf_page_init_low(): Add HASH_INVALIDATE(bpage, hash); buf_page_init(): Call buf_page_init_low() before HASH_INSERT(), so that bpage->hash will not be invalidated.
This commit is contained in:
@@ -2028,9 +2028,9 @@ buf_page_init_low(
|
|||||||
bpage->io_fix = BUF_IO_NONE;
|
bpage->io_fix = BUF_IO_NONE;
|
||||||
bpage->buf_fix_count = 0;
|
bpage->buf_fix_count = 0;
|
||||||
bpage->freed_page_clock = 0;
|
bpage->freed_page_clock = 0;
|
||||||
// bpage->hash = (buf_page_t*) -1;
|
|
||||||
bpage->newest_modification = 0;
|
bpage->newest_modification = 0;
|
||||||
bpage->oldest_modification = 0;
|
bpage->oldest_modification = 0;
|
||||||
|
HASH_INVALIDATE(bpage, hash);
|
||||||
#ifdef UNIV_DEBUG_FILE_ACCESSES
|
#ifdef UNIV_DEBUG_FILE_ACCESSES
|
||||||
bpage->file_page_was_freed = FALSE;
|
bpage->file_page_was_freed = FALSE;
|
||||||
#endif /* UNIV_DEBUG_FILE_ACCESSES */
|
#endif /* UNIV_DEBUG_FILE_ACCESSES */
|
||||||
@@ -2124,13 +2124,13 @@ buf_page_init(
|
|||||||
ut_error;
|
ut_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buf_page_init_low(&block->page);
|
||||||
|
|
||||||
ut_ad(!block->page.in_zip_hash);
|
ut_ad(!block->page.in_zip_hash);
|
||||||
ut_ad(!block->page.in_page_hash);
|
ut_ad(!block->page.in_page_hash);
|
||||||
ut_d(block->page.in_page_hash = TRUE);
|
ut_d(block->page.in_page_hash = TRUE);
|
||||||
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
|
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
|
||||||
buf_page_address_fold(space, offset), &block->page);
|
buf_page_address_fold(space, offset), &block->page);
|
||||||
|
|
||||||
buf_page_init_low(&block->page);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
|||||||
@@ -98,6 +98,14 @@ do {\
|
|||||||
}\
|
}\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#ifdef UNIV_HASH_DEBUG
|
||||||
|
# define HASH_ASSERT_VALID(DATA) ut_a((void*) (DATA) != (void*) -1)
|
||||||
|
# define HASH_INVALIDATE(DATA, NAME) DATA->NAME = (void*) -1
|
||||||
|
#else
|
||||||
|
# define HASH_ASSERT_VALID(DATA) do {} while (0)
|
||||||
|
# define HASH_INVALIDATE(DATA, NAME) do {} while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
Deletes a struct from a hash table. */
|
Deletes a struct from a hash table. */
|
||||||
|
|
||||||
@@ -111,6 +119,7 @@ do {\
|
|||||||
cell3333 = hash_get_nth_cell(TABLE, hash_calc_hash(FOLD, TABLE));\
|
cell3333 = hash_get_nth_cell(TABLE, hash_calc_hash(FOLD, TABLE));\
|
||||||
\
|
\
|
||||||
if (cell3333->node == DATA) {\
|
if (cell3333->node == DATA) {\
|
||||||
|
HASH_ASSERT_VALID(DATA->NAME);\
|
||||||
cell3333->node = DATA->NAME;\
|
cell3333->node = DATA->NAME;\
|
||||||
} else {\
|
} else {\
|
||||||
struct3333 = cell3333->node;\
|
struct3333 = cell3333->node;\
|
||||||
@@ -123,6 +132,7 @@ do {\
|
|||||||
\
|
\
|
||||||
struct3333->NAME = DATA->NAME;\
|
struct3333->NAME = DATA->NAME;\
|
||||||
}\
|
}\
|
||||||
|
HASH_INVALIDATE(DATA, NAME);\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
@@ -144,11 +154,13 @@ Looks for a struct in a hash table. */
|
|||||||
HASH_ASSERT_OWNED(TABLE, FOLD)\
|
HASH_ASSERT_OWNED(TABLE, FOLD)\
|
||||||
\
|
\
|
||||||
(DATA) = HASH_GET_FIRST(TABLE, hash_calc_hash(FOLD, TABLE));\
|
(DATA) = HASH_GET_FIRST(TABLE, hash_calc_hash(FOLD, TABLE));\
|
||||||
|
HASH_ASSERT_VALID(DATA);\
|
||||||
\
|
\
|
||||||
while ((DATA) != NULL) {\
|
while ((DATA) != NULL) {\
|
||||||
if (TEST) {\
|
if (TEST) {\
|
||||||
break;\
|
break;\
|
||||||
} else {\
|
} else {\
|
||||||
|
HASH_ASSERT_VALID(HASH_GET_NEXT(NAME, DATA));\
|
||||||
(DATA) = HASH_GET_NEXT(NAME, DATA);\
|
(DATA) = HASH_GET_NEXT(NAME, DATA);\
|
||||||
}\
|
}\
|
||||||
}\
|
}\
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ memory is read outside the allocated blocks. */
|
|||||||
#define UNIV_DEBUG_FILE_ACCESSES /* Debug .ibd file access
|
#define UNIV_DEBUG_FILE_ACCESSES /* Debug .ibd file access
|
||||||
(field file_page_was_freed
|
(field file_page_was_freed
|
||||||
in buf_page_t) */
|
in buf_page_t) */
|
||||||
|
#define UNIV_HASH_DEBUG /* debug HASH_ macros */
|
||||||
#define UNIV_LIST_DEBUG /* debug UT_LIST_ macros */
|
#define UNIV_LIST_DEBUG /* debug UT_LIST_ macros */
|
||||||
#define UNIV_MEM_DEBUG /* detect memory leaks etc */
|
#define UNIV_MEM_DEBUG /* detect memory leaks etc */
|
||||||
#define UNIV_IBUF_DEBUG /* debug the insert buffer;
|
#define UNIV_IBUF_DEBUG /* debug the insert buffer;
|
||||||
|
|||||||
Reference in New Issue
Block a user