summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-01-31 10:06:55 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-01-31 10:06:55 +0200
commit0b36c27e0c06b798b7322ab07d8464b69a7b716c (patch)
tree924a9ad968c5efdcc46566e66068f825e13c7340
parentafe9caa82d9f02eba17efc96baeb62330cfe927b (diff)
downloadmariadb-git-0b36c27e0c06b798b7322ab07d8464b69a7b716c.tar.gz
MDEV-20307: Remove a useless debug check to save stack space
fil_space_encrypt(): Remove the debug check that decrypts the just encrypted page. We are exercising the decryption of encrypted pages enough via --suite=encryption,mariabackup. It is a waste of computing resources to decrypt every page immediately after encrypting it. The redundant check had been added in commit 2bedc3978b90bf5abe1029df393c63ced1849bed (MDEV-9931).
-rw-r--r--storage/innobase/fil/fil0crypt.cc45
-rw-r--r--storage/xtradb/fil/fil0crypt.cc45
2 files changed, 6 insertions, 84 deletions
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 43a3bd8ff29..901b28c8c62 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -706,47 +706,8 @@ fil_space_encrypt(
fil_space_crypt_t* crypt_data = space->crypt_data;
ut_ad(space->n_pending_ios > 0);
ulint zip_size = fsp_flags_get_zip_size(space->flags);
- byte* tmp = fil_encrypt_buf(crypt_data, space->id, offset, lsn, src_frame, zip_size, dst_frame);
-
-#ifdef UNIV_DEBUG
- if (tmp) {
- /* Verify that encrypted buffer is not corrupted */
- dberr_t err = DB_SUCCESS;
- byte* src = src_frame;
- bool page_compressed_encrypted = (mach_read_from_2(tmp+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
- byte uncomp_mem[UNIV_PAGE_SIZE_MAX];
- byte tmp_mem[UNIV_PAGE_SIZE_MAX];
- ulint size = (zip_size) ? zip_size : UNIV_PAGE_SIZE;
-
- if (page_compressed_encrypted) {
- memcpy(uncomp_mem, src, srv_page_size);
- ulint unzipped1 = fil_page_decompress(
- tmp_mem, uncomp_mem);
- ut_ad(unzipped1);
- if (unzipped1 != srv_page_size) {
- src = uncomp_mem;
- }
- }
-
- ut_ad(!buf_page_is_corrupted(true, src, zip_size, space));
- ut_ad(fil_space_decrypt(crypt_data, tmp_mem, size, tmp, &err));
- ut_ad(err == DB_SUCCESS);
-
- /* Need to decompress the page if it was also compressed */
- if (page_compressed_encrypted) {
- byte buf[UNIV_PAGE_SIZE_MAX];
- memcpy(buf, tmp_mem, srv_page_size);
- ulint unzipped2 = fil_page_decompress(tmp_mem, buf);
- ut_ad(unzipped2);
- }
-
- memcpy(tmp_mem + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION,
- src + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 8);
- ut_ad(!memcmp(src, tmp_mem, size));
- }
-#endif /* UNIV_DEBUG */
-
- return tmp;
+ return fil_encrypt_buf(crypt_data, space->id, offset, lsn,
+ src_frame, zip_size, dst_frame);
}
/******************************************************************
diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc
index 43a3bd8ff29..901b28c8c62 100644
--- a/storage/xtradb/fil/fil0crypt.cc
+++ b/storage/xtradb/fil/fil0crypt.cc
@@ -1,6 +1,6 @@
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
-Copyright (c) 2014, 2019, MariaDB Corporation.
+Copyright (c) 2014, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -706,47 +706,8 @@ fil_space_encrypt(
fil_space_crypt_t* crypt_data = space->crypt_data;
ut_ad(space->n_pending_ios > 0);
ulint zip_size = fsp_flags_get_zip_size(space->flags);
- byte* tmp = fil_encrypt_buf(crypt_data, space->id, offset, lsn, src_frame, zip_size, dst_frame);
-
-#ifdef UNIV_DEBUG
- if (tmp) {
- /* Verify that encrypted buffer is not corrupted */
- dberr_t err = DB_SUCCESS;
- byte* src = src_frame;
- bool page_compressed_encrypted = (mach_read_from_2(tmp+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED);
- byte uncomp_mem[UNIV_PAGE_SIZE_MAX];
- byte tmp_mem[UNIV_PAGE_SIZE_MAX];
- ulint size = (zip_size) ? zip_size : UNIV_PAGE_SIZE;
-
- if (page_compressed_encrypted) {
- memcpy(uncomp_mem, src, srv_page_size);
- ulint unzipped1 = fil_page_decompress(
- tmp_mem, uncomp_mem);
- ut_ad(unzipped1);
- if (unzipped1 != srv_page_size) {
- src = uncomp_mem;
- }
- }
-
- ut_ad(!buf_page_is_corrupted(true, src, zip_size, space));
- ut_ad(fil_space_decrypt(crypt_data, tmp_mem, size, tmp, &err));
- ut_ad(err == DB_SUCCESS);
-
- /* Need to decompress the page if it was also compressed */
- if (page_compressed_encrypted) {
- byte buf[UNIV_PAGE_SIZE_MAX];
- memcpy(buf, tmp_mem, srv_page_size);
- ulint unzipped2 = fil_page_decompress(tmp_mem, buf);
- ut_ad(unzipped2);
- }
-
- memcpy(tmp_mem + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION,
- src + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION, 8);
- ut_ad(!memcmp(src, tmp_mem, size));
- }
-#endif /* UNIV_DEBUG */
-
- return tmp;
+ return fil_encrypt_buf(crypt_data, space->id, offset, lsn,
+ src_frame, zip_size, dst_frame);
}
/******************************************************************