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.
This commit is contained in:
parent
408ef65f84
commit
febe88198e
@ -6583,15 +6583,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;
|
||||
@ -6600,9 +6600,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
|
||||
@ -6615,16 +6612,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)) {
|
||||
|
||||
@ -6647,8 +6640,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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user