Commit f81ecc5a authored by marko's avatar marko

branches/zip: enum buf_page_state: Add BUF_BLOCK_ZIP_FREE, BUF_BLOCK_ZIP_DIRTY.

parent 0b88392a
...@@ -2360,6 +2360,8 @@ buf_validate(void) ...@@ -2360,6 +2360,8 @@ buf_validate(void)
chunk = buf_pool->chunks; chunk = buf_pool->chunks;
/* TODO: check buf_pool->zip_list and buf_pool->flush_list */
for (i = buf_pool->n_chunks; i--; chunk++) { for (i = buf_pool->n_chunks; i--; chunk++) {
ulint j; ulint j;
...@@ -2370,12 +2372,15 @@ buf_validate(void) ...@@ -2370,12 +2372,15 @@ buf_validate(void)
mutex_enter(&block->mutex); mutex_enter(&block->mutex);
switch (buf_block_get_state(block)) { switch (buf_block_get_state(block)) {
case BUF_BLOCK_ZIP_FREE:
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
/* TODO: validate page_zip */ case BUF_BLOCK_ZIP_DIRTY:
/* These should only occur on
zip_clean, zip_free[], or flush_list. */
ut_error; ut_error;
break; break;
case BUF_BLOCK_FILE_PAGE:
case BUF_BLOCK_FILE_PAGE:
ut_a(buf_page_hash_get(buf_block_get_space( ut_a(buf_page_hash_get(buf_block_get_space(
block), block),
buf_block_get_page_no( buf_block_get_page_no(
......
...@@ -58,12 +58,17 @@ extern ibool buf_debug_prints;/* If this is set TRUE, the program ...@@ -58,12 +58,17 @@ extern ibool buf_debug_prints;/* If this is set TRUE, the program
extern ulint srv_buf_pool_write_requests; /* variable to count write request extern ulint srv_buf_pool_write_requests; /* variable to count write request
issued */ issued */
/* States of a control block */ /* States of a control block (@see buf_page_struct).
The enumeration values must be 0..7. */
enum buf_page_state { enum buf_page_state {
BUF_BLOCK_ZIP_PAGE = 1, /* contains a compressed page only; BUF_BLOCK_ZIP_FREE = 0, /* contains a free compressed page */
must be smaller than BUF_BLOCK_ZIP_PAGE, /* contains a clean compressed page */
BUF_BLOCK_NOT_USED; BUF_BLOCK_ZIP_DIRTY, /* contains a compressed page that is
cf. buf_block_state_valid() */ in the buf_pool->flush_list */
/* The constants for compressed-only pages must precede
BUF_BLOCK_NOT_USED; @see buf_block_state_valid() */
BUF_BLOCK_NOT_USED, /* is in the free list */ BUF_BLOCK_NOT_USED, /* is in the free list */
BUF_BLOCK_READY_FOR_USE, /* when buf_get_free_block returns BUF_BLOCK_READY_FOR_USE, /* when buf_get_free_block returns
a block, it is in this state */ a block, it is in this state */
...@@ -608,7 +613,7 @@ Gets the mutex of a block. */ ...@@ -608,7 +613,7 @@ Gets the mutex of a block. */
UNIV_INLINE UNIV_INLINE
mutex_t* mutex_t*
buf_page_get_mutex( buf_page_get_mutex(
/*================*/ /*===============*/
/* out: pointer to mutex protecting bpage */ /* out: pointer to mutex protecting bpage */
buf_page_t* bpage) /* in: pointer to control block */ buf_page_t* bpage) /* in: pointer to control block */
__attribute__((pure)); __attribute__((pure));
......
...@@ -122,7 +122,9 @@ buf_page_get_state( ...@@ -122,7 +122,9 @@ buf_page_get_state(
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
switch (state) { switch (state) {
case BUF_BLOCK_ZIP_FREE:
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
case BUF_BLOCK_NOT_USED: case BUF_BLOCK_NOT_USED:
case BUF_BLOCK_READY_FOR_USE: case BUF_BLOCK_READY_FOR_USE:
case BUF_BLOCK_FILE_PAGE: case BUF_BLOCK_FILE_PAGE:
...@@ -160,7 +162,9 @@ buf_page_set_state( ...@@ -160,7 +162,9 @@ buf_page_set_state(
enum buf_page_state old_state = buf_page_get_state(bpage); enum buf_page_state old_state = buf_page_get_state(bpage);
switch (old_state) { switch (old_state) {
case BUF_BLOCK_ZIP_FREE:
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
ut_error; ut_error;
break; break;
case BUF_BLOCK_NOT_USED: case BUF_BLOCK_NOT_USED:
...@@ -209,7 +213,13 @@ buf_page_in_file( ...@@ -209,7 +213,13 @@ buf_page_in_file(
const buf_page_t* bpage) /* in: pointer to control block */ const buf_page_t* bpage) /* in: pointer to control block */
{ {
switch (buf_page_get_state(bpage)) { switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE:
/* This is a free page in buf_pool->zip_free[].
Such pages should only be accessed by the buddy allocator. */
ut_error;
break;
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
case BUF_BLOCK_FILE_PAGE: case BUF_BLOCK_FILE_PAGE:
return(TRUE); return(TRUE);
case BUF_BLOCK_NOT_USED: case BUF_BLOCK_NOT_USED:
...@@ -241,12 +251,16 @@ Gets the mutex of a block. */ ...@@ -241,12 +251,16 @@ Gets the mutex of a block. */
UNIV_INLINE UNIV_INLINE
mutex_t* mutex_t*
buf_page_get_mutex( buf_page_get_mutex(
/*================*/ /*===============*/
/* out: pointer to mutex protecting bpage */ /* out: pointer to mutex protecting bpage */
buf_page_t* bpage) /* in: pointer to control block */ buf_page_t* bpage) /* in: pointer to control block */
{ {
switch (buf_page_get_state(bpage)) { switch (buf_page_get_state(bpage)) {
case BUF_BLOCK_ZIP_FREE:
ut_error;
break;
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
return(NULL); /* TODO: return common mutex for page_zip */ return(NULL); /* TODO: return common mutex for page_zip */
default: default:
return(&((buf_block_t*) bpage)->mutex); return(&((buf_block_t*) bpage)->mutex);
...@@ -442,8 +456,10 @@ buf_block_get_frame( ...@@ -442,8 +456,10 @@ buf_block_get_frame(
ut_ad(block); ut_ad(block);
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
switch (buf_block_get_state(block)) { switch (buf_block_get_state(block)) {
case BUF_BLOCK_NOT_USED: case BUF_BLOCK_ZIP_FREE:
case BUF_BLOCK_ZIP_PAGE: case BUF_BLOCK_ZIP_PAGE:
case BUF_BLOCK_ZIP_DIRTY:
case BUF_BLOCK_NOT_USED:
ut_error; ut_error;
break; break;
case BUF_BLOCK_FILE_PAGE: case BUF_BLOCK_FILE_PAGE:
......
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