Commit 72d01f24 authored by Sergei Golubchik's avatar Sergei Golubchik

remove few #ifdefs in innodb/xtradb

parent 5fc53b7c
......@@ -5708,9 +5708,7 @@ buf_page_encrypt_before_write(
fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
bpage->real_size = UNIV_PAGE_SIZE;
#ifdef UNIV_DEBUG
fil_page_type_validate(src_frame);
#endif
if (crypt_data != NULL && crypt_data->encryption == FIL_SPACE_ENCRYPTION_OFF) {
/* Encryption is disabled */
......@@ -5767,9 +5765,7 @@ buf_page_encrypt_before_write(
bpage->key_version = key_version;
bpage->real_size = page_size;
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
#endif
} else {
/* First we compress the page content */
......@@ -5783,18 +5779,12 @@ buf_page_encrypt_before_write(
fil_space_get_page_compression_level(bpage->space),
block_size,
&out_len,
#ifdef HAVE_LZO
slot->lzo_mem
#else
NULL
#endif
IF_LZO(slot->lzo_mem, NULL)
);
bpage->real_size = out_len;
#ifdef UNIV_DEBUG
fil_page_type_validate(tmp);
#endif
/* And then we encrypt the page content */
fil_space_encrypt(bpage->space,
......@@ -5805,9 +5795,7 @@ buf_page_encrypt_before_write(
dst_frame);
}
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
#endif
// return dst_frame which will be written
return dst_frame;
......@@ -5847,9 +5835,7 @@ buf_page_decrypt_after_read(
/* Find free slot from temporary memory array */
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
#endif
fil_decompress_page(slot->comp_buf,
dst_frame,
......@@ -5860,9 +5846,7 @@ buf_page_decrypt_after_read(
slot->reserved = false;
}
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
#endif
} else {
/* the page we read is encrypted */
/* Find free slot from temporary memory array */
......@@ -5870,10 +5854,8 @@ buf_page_decrypt_after_read(
memcpy(slot->crypt_buf, dst_frame, size);
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
fil_page_type_validate(slot->crypt_buf);
#endif
/* decrypt from crypt_buf to dst_frame */
fil_space_decrypt(bpage->space,
......@@ -5881,10 +5863,8 @@ buf_page_decrypt_after_read(
size,
dst_frame);
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
fil_page_type_validate(slot->crypt_buf);
#endif
/* decompress from dst_frame to comp_buf and then copy to
buffer pool */
......@@ -5895,9 +5875,7 @@ buf_page_decrypt_after_read(
&bpage->write_size);
}
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
#endif
/* Mark this slot as free */
slot->reserved = false;
......
......@@ -105,7 +105,6 @@ fil_node_get_block_size(
return (node->file_block_size);
}
#ifdef UNIV_DEBUG
/****************************************************************//**
Validate page type.
@return true if valid, false if not */
......@@ -114,6 +113,7 @@ bool
fil_page_type_validate(
const byte* page) /*!< in: page */
{
#ifdef UNIV_DEBUG
ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE);
#ifdef UNIV_ENCRYPTION_EXTRA_DEBUG
uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
......@@ -167,8 +167,8 @@ fil_page_type_validate(
return false;
}
#endif /* UNIV_DEBUG */
return true;
}
#endif /* UNIV_DEBUG */
#endif /* fil0fil_ic */
......@@ -5867,9 +5867,7 @@ buf_page_encrypt_before_write(
fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
bpage->real_size = UNIV_PAGE_SIZE;
#ifdef UNIV_DEBUG
fil_page_type_validate(src_frame);
#endif
if (crypt_data != NULL && crypt_data->encryption == FIL_SPACE_ENCRYPTION_OFF) {
/* Encryption is disabled */
......@@ -5926,9 +5924,7 @@ buf_page_encrypt_before_write(
bpage->key_version = key_version;
bpage->real_size = page_size;
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
#endif
} else {
/* First we compress the page content */
......@@ -5942,18 +5938,12 @@ buf_page_encrypt_before_write(
fil_space_get_page_compression_level(bpage->space),
block_size,
&out_len,
#ifdef HAVE_LZO
slot->lzo_mem
#else
NULL
#endif
IF_LZO(slot->lzo_mem, NULL)
);
bpage->real_size = out_len;
#ifdef UNIV_DEBUG
fil_page_type_validate(tmp);
#endif
/* And then we encrypt the page content */
fil_space_encrypt(bpage->space,
......@@ -5964,9 +5954,7 @@ buf_page_encrypt_before_write(
dst_frame);
}
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
#endif
// return dst_frame which will be written
return dst_frame;
......@@ -6003,9 +5991,7 @@ buf_page_decrypt_after_read(
/* Find free slot from temporary memory array */
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
#endif
fil_decompress_page(slot->comp_buf,
dst_frame,
......@@ -6016,18 +6002,14 @@ buf_page_decrypt_after_read(
slot->reserved = false;
}
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
#endif
} else {
/* Find free slot from temporary memory array */
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
memcpy(slot->crypt_buf, dst_frame, size);
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
fil_page_type_validate(slot->crypt_buf);
#endif
/* decrypt from crypt_buf to dst_frame */
fil_space_decrypt(bpage->space,
......@@ -6035,10 +6017,8 @@ buf_page_decrypt_after_read(
size,
dst_frame);
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
fil_page_type_validate(slot->crypt_buf);
#endif
if (page_compressed) {
fil_decompress_page(slot->comp_buf,
......@@ -6046,9 +6026,7 @@ buf_page_decrypt_after_read(
size,
&bpage->write_size);
#ifdef UNIV_DEBUG
fil_page_type_validate(dst_frame);
#endif
}
/* Mark this slot as free */
......
......@@ -105,7 +105,6 @@ fil_node_get_block_size(
return (node->file_block_size);
}
#ifdef UNIV_DEBUG
/****************************************************************//**
Validate page type.
@return true if valid, false if not */
......@@ -114,6 +113,7 @@ bool
fil_page_type_validate(
const byte* page) /*!< in: page */
{
#ifdef UNIV_DEBUG
ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE);
#ifdef UNIV_ENCRYPTION_EXTRA_DEBUG
uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
......@@ -168,8 +168,8 @@ fil_page_type_validate(
return false;
}
#endif /* UNIV_DEBUG */
return true;
}
#endif /* UNIV_DEBUG */
#endif /* fil0fil_ic */
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