summaryrefslogtreecommitdiff
path: root/storage/xtradb
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-05-17 08:54:16 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2017-05-17 08:54:16 +0300
commitfebe88198ebadceef2549c04f3e6afe75b68bac3 (patch)
treeef16517c4fd87ee4dd647e19f9d1bfdfd0c74f33 /storage/xtradb
parent408ef65f840fac2150c385efb0c377ed9a2801d9 (diff)
downloadmariadb-git-febe88198ebadceef2549c04f3e6afe75b68bac3.tar.gz
Make some variables const in fil_iterate()
This is a non-functional change to make it slightly easier to read the code. We seem to have some bugs in this IMPORT TABLESPACE code; see MDEV-12396.
Diffstat (limited to 'storage/xtradb')
-rw-r--r--storage/xtradb/fil/fil0fil.cc26
1 files changed, 10 insertions, 16 deletions
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index e39be46840c..1838b6f8e04 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -6929,15 +6929,15 @@ fil_iterate(
/* TODO: For compressed tables we do a lot of useless
copying for non-index pages. Unfortunately, it is
required by buf_zip_decompress() */
+ const bool row_compressed = callback.get_zip_size() > 0;
for (offset = iter.start; offset < iter.end; offset += n_bytes) {
byte* io_buffer = iter.io_buffer;
- bool row_compressed = false;
block->frame = io_buffer;
- if (callback.get_zip_size() > 0) {
+ if (row_compressed) {
page_zip_des_init(&block->page.zip);
page_zip_set_size(&block->page.zip, iter.page_size);
block->page.zip.data = block->frame + UNIV_PAGE_SIZE;
@@ -6946,9 +6946,6 @@ fil_iterate(
/* Zip IO is done in the compressed page buffer. */
io_buffer = block->page.zip.data;
- row_compressed = true;
- } else {
- io_buffer = iter.io_buffer;
}
/* We have to read the exact number of bytes. Otherwise the
@@ -6961,16 +6958,12 @@ fil_iterate(
ut_ad(n_bytes > 0);
ut_ad(!(n_bytes % iter.page_size));
- byte* readptr = io_buffer;
- byte* writeptr = io_buffer;
- bool encrypted = false;
-
+ const bool encrypted = iter.crypt_data != NULL
+ && iter.crypt_data->should_encrypt();
/* Use additional crypt io buffer if tablespace is encrypted */
- if (iter.crypt_data != NULL && iter.crypt_data->should_encrypt()) {
- encrypted = true;
- readptr = iter.crypt_io_buffer;
- writeptr = iter.crypt_io_buffer;
- }
+ byte* const readptr = encrypted
+ ? iter.crypt_io_buffer : io_buffer;
+ byte* const writeptr = readptr;
if (!os_file_read(iter.file, readptr, offset, (ulint) n_bytes)) {
@@ -6993,8 +6986,9 @@ fil_iterate(
ulint page_type = mach_read_from_2(src+FIL_PAGE_TYPE);
- bool page_compressed = (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED ||
- page_type == FIL_PAGE_PAGE_COMPRESSED);
+ const bool page_compressed
+ = page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
+ || page_type == FIL_PAGE_PAGE_COMPRESSED;
/* If tablespace is encrypted, we need to decrypt
the page. Note that tablespaces are not in