mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
branches/zip: Move all fields that are not needed in compression or
decompression from page_zip_des_t to buf_page_t, because the fields needed in compression are modified without holding the block mutex. All writes to bit-fields sharing a machine word must be protected by the same mutex or rw-lock.
This commit is contained in:
parent
61a48f1e14
commit
cf7b6e9153
5 changed files with 22 additions and 17 deletions
|
@ -616,7 +616,7 @@ buf_block_init(
|
|||
block->n_pointers = 0;
|
||||
#endif /* UNIV_DEBUG */
|
||||
page_zip_des_init(&block->page.zip);
|
||||
block->page.zip.state = BUF_BLOCK_NOT_USED;
|
||||
block->page.state = BUF_BLOCK_NOT_USED;
|
||||
|
||||
mutex_create(&block->mutex, SYNC_BUF_BLOCK);
|
||||
|
||||
|
|
|
@ -2663,8 +2663,7 @@ error_exit2:
|
|||
page_zip_des_t page_zip;
|
||||
page_zip_set_size(&page_zip, zip_size);
|
||||
page_zip.data = page + UNIV_PAGE_SIZE;
|
||||
page_zip.state = page_zip.n_blobs
|
||||
= page_zip.m_start = page_zip.m_end = 0;
|
||||
page_zip.n_blobs = page_zip.m_start = page_zip.m_end = 0;
|
||||
buf_flush_init_for_writing(page, &page_zip, 0);
|
||||
ret = os_file_write(path, file, page_zip.data, 0, 0, zip_size);
|
||||
}
|
||||
|
|
|
@ -737,11 +737,22 @@ buf_get_free_list_len(void);
|
|||
for compressed and uncompressed frames */
|
||||
|
||||
struct buf_page_struct{
|
||||
/* None of the following bit-fields must be modified without
|
||||
holding block->mutex, since they can be stored in the same
|
||||
machine word. Some of them are additionally protected by
|
||||
buf_pool->mutex. */
|
||||
|
||||
ulint space:32; /* tablespace id */
|
||||
ulint offset:32; /* page number */
|
||||
page_zip_des_t zip; /* compressed page; zip.state
|
||||
and zip.flush_type are relevant
|
||||
for all pages */
|
||||
|
||||
ulint state:3; /* state of the control block
|
||||
(@see enum buf_page_state); also
|
||||
protected by buf_pool->mutex */
|
||||
ulint flush_type:2; /* if this block is currently being
|
||||
flushed to disk, this tells the
|
||||
flush_type (@see enum buf_flush) */
|
||||
|
||||
page_zip_des_t zip; /* compressed page */
|
||||
buf_page_t* hash; /* node used in chaining to the page
|
||||
hash table */
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ buf_page_get_state(
|
|||
/* out: state */
|
||||
const buf_page_t* bpage) /* in: pointer to the control block */
|
||||
{
|
||||
enum buf_page_state state = bpage->zip.state;
|
||||
enum buf_page_state state = bpage->state;
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
switch (state) {
|
||||
|
@ -157,7 +157,7 @@ buf_block_set_state(
|
|||
break;
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
block->page.zip.state = state;
|
||||
block->page.state = state;
|
||||
ut_ad(buf_block_get_state(block) == state);
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ buf_page_get_flush_type(
|
|||
/* out: flush type */
|
||||
const buf_page_t* bpage) /* in: buffer page */
|
||||
{
|
||||
enum buf_flush flush_type = bpage->zip.flush_type;
|
||||
enum buf_flush flush_type = bpage->flush_type;
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
switch (flush_type) {
|
||||
|
@ -217,7 +217,7 @@ buf_page_set_flush_type(
|
|||
buf_page_t* bpage, /* in: buffer page */
|
||||
enum buf_flush flush_type) /* in: flush type */
|
||||
{
|
||||
bpage->zip.flush_type = flush_type;
|
||||
bpage->flush_type = flush_type;
|
||||
ut_ad(buf_page_get_flush_type(bpage) == flush_type);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,13 +31,8 @@ page0*.h includes rem0rec.h and may include rem0rec.ic. */
|
|||
struct page_zip_des_struct
|
||||
{
|
||||
page_zip_t* data; /* compressed page data */
|
||||
ulint state:3; /* state of the control block
|
||||
(cf. enum buf_page_state) */
|
||||
ulint flush_type:2; /* if this block is currently being
|
||||
flushed to disk, this tells the
|
||||
flush_type (cf. enum buf_flush);
|
||||
protected by block->mutex */
|
||||
ulint :9; /* reserved */
|
||||
|
||||
ulint :17; /* reserved */
|
||||
ulint n_blobs:12; /* number of externally stored
|
||||
columns on the page; the maximum
|
||||
is 744 on a 16 KiB page */
|
||||
|
|
Loading…
Add table
Reference in a new issue