diff options
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 10 | ||||
-rw-r--r-- | storage/innobase/include/page0size.h | 2 | ||||
-rw-r--r-- | storage/innobase/page/page0zip.cc | 10 |
3 files changed, 6 insertions, 16 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index cec39ab8e47..ad0f40ce67e 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -958,14 +958,8 @@ static uint32_t buf_page_check_crc32(const byte* page, uint32_t checksum) @return whether the buffer is all zeroes */ bool buf_is_zeroes(span<const byte> buf) { - static const byte zeroes[4 * 1024] = {0}; - for (size_t i = 0; i < buf.size(); i += std::min(sizeof(zeroes), - buf.size() - i)) { - if (memcmp(zeroes, buf.data() + i, std::min(sizeof(zeroes), - buf.size() - i)) != 0) - return false; - } - return true; + ut_ad(buf.size() <= sizeof field_ref_zero); + return memcmp(buf.data(), field_ref_zero, buf.size()) == 0; } /** Check if a page is corrupt. diff --git a/storage/innobase/include/page0size.h b/storage/innobase/include/page0size.h index eb11db7781d..74fcfb106ea 100644 --- a/storage/innobase/include/page0size.h +++ b/storage/innobase/include/page0size.h @@ -34,7 +34,7 @@ Created Nov 14, 2013 Vasil Dimov /** A BLOB field reference full of zero, for use in assertions and tests.Initially, BLOB field references are set to zero, in dtuple_convert_big_rec(). */ -extern const byte field_ref_zero[FIELD_REF_SIZE]; +extern const byte field_ref_zero[UNIV_PAGE_SIZE_MAX]; #define PAGE_SIZE_T_SIZE_BITS 17 diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index a64be931584..9db2bd1c341 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -34,12 +34,8 @@ using st_::span; /** A BLOB field reference full of zero, for use in assertions and tests. Initially, BLOB field references are set to zero, in dtuple_convert_big_rec(). */ -const byte field_ref_zero[FIELD_REF_SIZE] = { - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, -}; +MY_ALIGNED(UNIV_PAGE_SIZE_MAX) +const byte field_ref_zero[UNIV_PAGE_SIZE_MAX] = { 0, }; #ifndef UNIV_INNOCHECKSUM #include "page0page.h" @@ -113,7 +109,7 @@ Compare at most sizeof(field_ref_zero) bytes. /** Assert that a BLOB pointer is filled with zero bytes. @param b in: BLOB pointer */ #define ASSERT_ZERO_BLOB(b) \ - ut_ad(!memcmp(b, field_ref_zero, sizeof field_ref_zero)) + ut_ad(!memcmp(b, field_ref_zero, FIELD_REF_SIZE)) /* Enable some extra debugging output. This code can be enabled independently of any UNIV_ debugging conditions. */ |