Skip to content

Commit 72d01f2

Browse files
committed
remove few #ifdefs in innodb/xtradb
1 parent 5fc53b7 commit 72d01f2

File tree

4 files changed

+6
-50
lines changed

4 files changed

+6
-50
lines changed

storage/innobase/buf/buf0buf.cc

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5708,9 +5708,7 @@ buf_page_encrypt_before_write(
57085708
fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
57095709
bpage->real_size = UNIV_PAGE_SIZE;
57105710

5711-
#ifdef UNIV_DEBUG
57125711
fil_page_type_validate(src_frame);
5713-
#endif
57145712

57155713
if (crypt_data != NULL && crypt_data->encryption == FIL_SPACE_ENCRYPTION_OFF) {
57165714
/* Encryption is disabled */
@@ -5767,9 +5765,7 @@ buf_page_encrypt_before_write(
57675765
bpage->key_version = key_version;
57685766
bpage->real_size = page_size;
57695767

5770-
#ifdef UNIV_DEBUG
57715768
fil_page_type_validate(dst_frame);
5772-
#endif
57735769

57745770
} else {
57755771
/* First we compress the page content */
@@ -5783,18 +5779,12 @@ buf_page_encrypt_before_write(
57835779
fil_space_get_page_compression_level(bpage->space),
57845780
block_size,
57855781
&out_len,
5786-
#ifdef HAVE_LZO
5787-
slot->lzo_mem
5788-
#else
5789-
NULL
5790-
#endif
5782+
IF_LZO(slot->lzo_mem, NULL)
57915783
);
57925784

57935785
bpage->real_size = out_len;
57945786

5795-
#ifdef UNIV_DEBUG
57965787
fil_page_type_validate(tmp);
5797-
#endif
57985788

57995789
/* And then we encrypt the page content */
58005790
fil_space_encrypt(bpage->space,
@@ -5805,9 +5795,7 @@ buf_page_encrypt_before_write(
58055795
dst_frame);
58065796
}
58075797

5808-
#ifdef UNIV_DEBUG
58095798
fil_page_type_validate(dst_frame);
5810-
#endif
58115799

58125800
// return dst_frame which will be written
58135801
return dst_frame;
@@ -5847,9 +5835,7 @@ buf_page_decrypt_after_read(
58475835
/* Find free slot from temporary memory array */
58485836
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
58495837

5850-
#ifdef UNIV_DEBUG
58515838
fil_page_type_validate(dst_frame);
5852-
#endif
58535839

58545840
fil_decompress_page(slot->comp_buf,
58555841
dst_frame,
@@ -5860,31 +5846,25 @@ buf_page_decrypt_after_read(
58605846
slot->reserved = false;
58615847
}
58625848

5863-
#ifdef UNIV_DEBUG
58645849
fil_page_type_validate(dst_frame);
5865-
#endif
58665850
} else {
58675851
/* the page we read is encrypted */
58685852
/* Find free slot from temporary memory array */
58695853
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
58705854

58715855
memcpy(slot->crypt_buf, dst_frame, size);
58725856

5873-
#ifdef UNIV_DEBUG
58745857
fil_page_type_validate(dst_frame);
58755858
fil_page_type_validate(slot->crypt_buf);
5876-
#endif
58775859

58785860
/* decrypt from crypt_buf to dst_frame */
58795861
fil_space_decrypt(bpage->space,
58805862
slot->crypt_buf,
58815863
size,
58825864
dst_frame);
58835865

5884-
#ifdef UNIV_DEBUG
58855866
fil_page_type_validate(dst_frame);
58865867
fil_page_type_validate(slot->crypt_buf);
5887-
#endif
58885868

58895869
/* decompress from dst_frame to comp_buf and then copy to
58905870
buffer pool */
@@ -5895,9 +5875,7 @@ buf_page_decrypt_after_read(
58955875
&bpage->write_size);
58965876
}
58975877

5898-
#ifdef UNIV_DEBUG
58995878
fil_page_type_validate(dst_frame);
5900-
#endif
59015879

59025880
/* Mark this slot as free */
59035881
slot->reserved = false;

storage/innobase/include/fil0fil.ic

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ fil_node_get_block_size(
105105
return (node->file_block_size);
106106
}
107107

108-
#ifdef UNIV_DEBUG
109108
/****************************************************************//**
110109
Validate page type.
111110
@return true if valid, false if not */
@@ -114,6 +113,7 @@ bool
114113
fil_page_type_validate(
115114
const byte* page) /*!< in: page */
116115
{
116+
#ifdef UNIV_DEBUG
117117
ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE);
118118
#ifdef UNIV_ENCRYPTION_EXTRA_DEBUG
119119
uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
@@ -167,8 +167,8 @@ fil_page_type_validate(
167167
return false;
168168
}
169169

170+
#endif /* UNIV_DEBUG */
170171
return true;
171172
}
172-
#endif /* UNIV_DEBUG */
173173

174174
#endif /* fil0fil_ic */

storage/xtradb/buf/buf0buf.cc

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5867,9 +5867,7 @@ buf_page_encrypt_before_write(
58675867
fil_space_crypt_t* crypt_data = fil_space_get_crypt_data(space_id);
58685868
bpage->real_size = UNIV_PAGE_SIZE;
58695869

5870-
#ifdef UNIV_DEBUG
58715870
fil_page_type_validate(src_frame);
5872-
#endif
58735871

58745872
if (crypt_data != NULL && crypt_data->encryption == FIL_SPACE_ENCRYPTION_OFF) {
58755873
/* Encryption is disabled */
@@ -5926,9 +5924,7 @@ buf_page_encrypt_before_write(
59265924
bpage->key_version = key_version;
59275925
bpage->real_size = page_size;
59285926

5929-
#ifdef UNIV_DEBUG
59305927
fil_page_type_validate(dst_frame);
5931-
#endif
59325928

59335929
} else {
59345930
/* First we compress the page content */
@@ -5942,18 +5938,12 @@ buf_page_encrypt_before_write(
59425938
fil_space_get_page_compression_level(bpage->space),
59435939
block_size,
59445940
&out_len,
5945-
#ifdef HAVE_LZO
5946-
slot->lzo_mem
5947-
#else
5948-
NULL
5949-
#endif
5941+
IF_LZO(slot->lzo_mem, NULL)
59505942
);
59515943

59525944
bpage->real_size = out_len;
59535945

5954-
#ifdef UNIV_DEBUG
59555946
fil_page_type_validate(tmp);
5956-
#endif
59575947

59585948
/* And then we encrypt the page content */
59595949
fil_space_encrypt(bpage->space,
@@ -5964,9 +5954,7 @@ buf_page_encrypt_before_write(
59645954
dst_frame);
59655955
}
59665956

5967-
#ifdef UNIV_DEBUG
59685957
fil_page_type_validate(dst_frame);
5969-
#endif
59705958

59715959
// return dst_frame which will be written
59725960
return dst_frame;
@@ -6003,9 +5991,7 @@ buf_page_decrypt_after_read(
60035991
/* Find free slot from temporary memory array */
60045992
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
60055993

6006-
#ifdef UNIV_DEBUG
60075994
fil_page_type_validate(dst_frame);
6008-
#endif
60095995

60105996
fil_decompress_page(slot->comp_buf,
60115997
dst_frame,
@@ -6016,39 +6002,31 @@ buf_page_decrypt_after_read(
60166002
slot->reserved = false;
60176003
}
60186004

6019-
#ifdef UNIV_DEBUG
60206005
fil_page_type_validate(dst_frame);
6021-
#endif
60226006
} else {
60236007
/* Find free slot from temporary memory array */
60246008
buf_tmp_buffer_t* slot = buf_pool_reserve_tmp_slot(buf_pool, page_compressed);
60256009
memcpy(slot->crypt_buf, dst_frame, size);
60266010

6027-
#ifdef UNIV_DEBUG
60286011
fil_page_type_validate(dst_frame);
60296012
fil_page_type_validate(slot->crypt_buf);
6030-
#endif
60316013

60326014
/* decrypt from crypt_buf to dst_frame */
60336015
fil_space_decrypt(bpage->space,
60346016
slot->crypt_buf,
60356017
size,
60366018
dst_frame);
60376019

6038-
#ifdef UNIV_DEBUG
60396020
fil_page_type_validate(dst_frame);
60406021
fil_page_type_validate(slot->crypt_buf);
6041-
#endif
60426022

60436023
if (page_compressed) {
60446024
fil_decompress_page(slot->comp_buf,
60456025
dst_frame,
60466026
size,
60476027
&bpage->write_size);
60486028

6049-
#ifdef UNIV_DEBUG
60506029
fil_page_type_validate(dst_frame);
6051-
#endif
60526030
}
60536031

60546032
/* Mark this slot as free */

storage/xtradb/include/fil0fil.ic

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ fil_node_get_block_size(
105105
return (node->file_block_size);
106106
}
107107

108-
#ifdef UNIV_DEBUG
109108
/****************************************************************//**
110109
Validate page type.
111110
@return true if valid, false if not */
@@ -114,6 +113,7 @@ bool
114113
fil_page_type_validate(
115114
const byte* page) /*!< in: page */
116115
{
116+
#ifdef UNIV_DEBUG
117117
ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE);
118118
#ifdef UNIV_ENCRYPTION_EXTRA_DEBUG
119119
uint key_version = mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
@@ -168,8 +168,8 @@ fil_page_type_validate(
168168
return false;
169169
}
170170

171+
#endif /* UNIV_DEBUG */
171172
return true;
172173
}
173-
#endif /* UNIV_DEBUG */
174174

175175
#endif /* fil0fil_ic */

0 commit comments

Comments
 (0)