diff options
author | Jan Lindström <jan.lindstrom@skysql.com> | 2015-01-09 12:30:59 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-02-10 10:21:18 +0100 |
commit | e2e809860e8a1ad6a4d82859558cfd89409ac6d4 (patch) | |
tree | 2b300109a168ec882f89aee88aa09bd588c0176d /storage/xtradb/buf | |
parent | e109a662c77ec8f6db42c940d6c82c00d2f9f5d9 (diff) | |
download | mariadb-git-e2e809860e8a1ad6a4d82859558cfd89409ac6d4.tar.gz |
Pass down the information should we encrypt the page at os0file.cc
when page compression and google encryption is used.
Diffstat (limited to 'storage/xtradb/buf')
-rw-r--r-- | storage/xtradb/buf/buf0buf.cc | 7 | ||||
-rw-r--r-- | storage/xtradb/buf/buf0dblwr.cc | 149 | ||||
-rw-r--r-- | storage/xtradb/buf/buf0flu.cc | 42 | ||||
-rw-r--r-- | storage/xtradb/buf/buf0rea.cc | 4 |
4 files changed, 139 insertions, 63 deletions
diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc index 37b1c65dfe1..71008455f9b 100644 --- a/storage/xtradb/buf/buf0buf.cc +++ b/storage/xtradb/buf/buf0buf.cc @@ -1084,6 +1084,7 @@ buf_block_init( block->page.comp_buf = NULL; block->page.comp_buf_free = NULL; block->page.key_version = 0; + block->page.encrypt_later = false; block->modify_clock = 0; @@ -3587,6 +3588,7 @@ buf_page_init_low( bpage->comp_buf = NULL; bpage->comp_buf_free = NULL; bpage->key_version = 0; + bpage->encrypt_later = false; HASH_INVALIDATE(bpage, hash); bpage->is_corrupt = FALSE; @@ -5793,6 +5795,8 @@ buf_page_encrypt_before_write( buf_page_t* bpage, /*!< in/out: buffer page to be flushed */ const byte* src_frame) /*!< in: src frame */ { + bpage->encrypt_later = false; + if (srv_encrypt_tables == FALSE) { /* Encryption is disabled */ return const_cast<byte*>(src_frame); @@ -5853,7 +5857,8 @@ buf_page_encrypt_before_write( ut_ad(key_version == 0 || key_version >= bpage->key_version); bpage->key_version = key_version; } else { - // We do compression and encryption later on os0file.cc + /** Compression and encryption is done later at os0file.cc */ + bpage->encrypt_later = true; dst_frame = (byte *)src_frame; } diff --git a/storage/xtradb/buf/buf0dblwr.cc b/storage/xtradb/buf/buf0dblwr.cc index 75e86ac4326..871f723549b 100644 --- a/storage/xtradb/buf/buf0dblwr.cc +++ b/storage/xtradb/buf/buf0dblwr.cc @@ -521,10 +521,18 @@ buf_dblwr_process() ulint zip_size = fil_space_get_zip_size(space_id); /* Read in the actual page from the file */ - fil_io(OS_FILE_READ, true, space_id, zip_size, - page_no, 0, - zip_size ? zip_size : UNIV_PAGE_SIZE, - read_buf, NULL, 0, 0); + fil_io(OS_FILE_READ, + true, + space_id, + zip_size, + page_no, + 0, + zip_size ? zip_size : UNIV_PAGE_SIZE, + read_buf, + NULL, + 0, + 0, + false); if (fil_space_verify_crypt_checksum(read_buf, zip_size)) { /* page is encrypted and checksum is OK */ @@ -576,10 +584,18 @@ buf_dblwr_process() doublewrite buffer to the intended position */ - fil_io(OS_FILE_WRITE, true, space_id, - zip_size, page_no, 0, - zip_size ? zip_size : UNIV_PAGE_SIZE, - page, NULL, 0, 0); + fil_io(OS_FILE_WRITE, + true, + space_id, + zip_size, + page_no, + 0, + zip_size ? zip_size : UNIV_PAGE_SIZE, + page, + NULL, + 0, + 0, + false); ib_logf(IB_LOG_LEVEL_INFO, "Recovered the page from" @@ -595,11 +611,17 @@ buf_dblwr_process() zeroes, while a valid copy is available in dblwr buffer. */ - fil_io(OS_FILE_WRITE, true, space_id, - zip_size, page_no, 0, - zip_size ? zip_size - : UNIV_PAGE_SIZE, - page, NULL, 0, 0); + fil_io(OS_FILE_WRITE, + true, + space_id, + zip_size, + page_no, 0, + zip_size ? zip_size : UNIV_PAGE_SIZE, + page, + NULL, + 0, + 0, + false); } } } @@ -621,9 +643,9 @@ buf_dblwr_process() memset(buf, 0, bytes); fil_io(OS_FILE_WRITE, true, TRX_SYS_SPACE, 0, - buf_dblwr->block1, 0, bytes, buf, NULL, NULL, 0); + buf_dblwr->block1, 0, bytes, buf, NULL, NULL, 0, false); fil_io(OS_FILE_WRITE, true, TRX_SYS_SPACE, 0, - buf_dblwr->block2, 0, bytes, buf, NULL, NULL, 0); + buf_dblwr->block2, 0, bytes, buf, NULL, NULL, 0, false); ut_free(unaligned_buf); } @@ -828,13 +850,18 @@ buf_dblwr_write_block_to_datafile( void * frame = buf_page_get_frame(bpage); if (bpage->zip.data) { - fil_io(flags, sync, buf_page_get_space(bpage), - buf_page_get_zip_size(bpage), - buf_page_get_page_no(bpage), 0, - buf_page_get_zip_size(bpage), - frame, - (void*) bpage, 0, - bpage->newest_modification); + fil_io(flags, + sync, + buf_page_get_space(bpage), + buf_page_get_zip_size(bpage), + buf_page_get_page_no(bpage), + 0, + buf_page_get_zip_size(bpage), + frame, + (void*) bpage, + 0, + bpage->newest_modification, + bpage->encrypt_later); return; } @@ -844,10 +871,18 @@ buf_dblwr_write_block_to_datafile( ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); buf_dblwr_check_page_lsn(block->frame); - fil_io(flags, sync, buf_block_get_space(block), 0, - buf_block_get_page_no(block), 0, UNIV_PAGE_SIZE, - frame, (void*) block, - (ulint *)&bpage->write_size, bpage->newest_modification); + fil_io(flags, + sync, + buf_block_get_space(block), + 0, + buf_block_get_page_no(block), + 0, + UNIV_PAGE_SIZE, + frame, + (void*) block, + (ulint *)&bpage->write_size, + bpage->newest_modification, + bpage->encrypt_later); } /********************************************************************//** @@ -939,9 +974,19 @@ try_again: len = ut_min(TRX_SYS_DOUBLEWRITE_BLOCK_SIZE, buf_dblwr->first_free) * UNIV_PAGE_SIZE; - fil_io(OS_FILE_WRITE, true, TRX_SYS_SPACE, 0, - buf_dblwr->block1, 0, len, - (void*) write_buf, NULL, 0, 0); + fil_io(OS_FILE_WRITE, + true, + TRX_SYS_SPACE, + 0, + buf_dblwr->block1, + 0, + len, + (void*) + write_buf, + NULL, + 0, + 0, + false); if (buf_dblwr->first_free <= TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) { /* No unwritten pages in the second block. */ @@ -955,9 +1000,18 @@ try_again: write_buf = buf_dblwr->write_buf + TRX_SYS_DOUBLEWRITE_BLOCK_SIZE * UNIV_PAGE_SIZE; - fil_io(OS_FILE_WRITE, true, TRX_SYS_SPACE, 0, - buf_dblwr->block2, 0, len, - (void*) write_buf, NULL, 0, 0); + fil_io(OS_FILE_WRITE, + true, + TRX_SYS_SPACE, + 0, + buf_dblwr->block2, + 0, + len, + (void*) write_buf, + NULL, + 0, + 0, + false); flush: /* increment the doublewrite flushed pages counter */ @@ -1187,17 +1241,32 @@ retry: memset(buf_dblwr->write_buf + UNIV_PAGE_SIZE * i + zip_size, 0, UNIV_PAGE_SIZE - zip_size); - fil_io(OS_FILE_WRITE, true, TRX_SYS_SPACE, 0, - offset, 0, UNIV_PAGE_SIZE, - (void*) (buf_dblwr->write_buf - + UNIV_PAGE_SIZE * i), NULL, 0,bpage->newest_modification); + fil_io(OS_FILE_WRITE, + true, + TRX_SYS_SPACE, + 0, + offset, + 0, + UNIV_PAGE_SIZE, + (void*) (buf_dblwr->write_buf + UNIV_PAGE_SIZE * i), + NULL, + 0, + bpage->newest_modification, + bpage->encrypt_later); } else { /* It is a regular page. Write it directly to the doublewrite buffer */ - fil_io(OS_FILE_WRITE, true, TRX_SYS_SPACE, 0, - offset, 0, UNIV_PAGE_SIZE, - frame, - NULL, 0, bpage->newest_modification); + fil_io(OS_FILE_WRITE, + true, + TRX_SYS_SPACE, + 0, + offset, + 0, UNIV_PAGE_SIZE, + frame, + NULL, + 0, + bpage->newest_modification, + bpage->encrypt_later); } /* Now flush the doublewrite buffer data to disk */ diff --git a/storage/xtradb/buf/buf0flu.cc b/storage/xtradb/buf/buf0flu.cc index c7356015788..3411dc27d2c 100644 --- a/storage/xtradb/buf/buf0flu.cc +++ b/storage/xtradb/buf/buf0flu.cc @@ -955,16 +955,17 @@ buf_flush_write_block_low( if (!srv_use_doublewrite_buf || !buf_dblwr) { fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER, - sync, - buf_page_get_space(bpage), - zip_size, - buf_page_get_page_no(bpage), - 0, - zip_size ? zip_size : UNIV_PAGE_SIZE, - frame, - bpage, - &bpage->write_size, - bpage->newest_modification); + sync, + buf_page_get_space(bpage), + zip_size, + buf_page_get_page_no(bpage), + 0, + zip_size ? zip_size : UNIV_PAGE_SIZE, + frame, + bpage, + &bpage->write_size, + bpage->newest_modification, + bpage->encrypt_later); } else { /* InnoDB uses doublewrite buffer and doublewrite buffer is initialized. User can define do we use atomic writes @@ -975,16 +976,17 @@ buf_flush_write_block_low( if (awrites == ATOMIC_WRITES_ON) { fil_io(OS_FILE_WRITE | OS_AIO_SIMULATED_WAKE_LATER, - FALSE, - buf_page_get_space(bpage), - zip_size, - buf_page_get_page_no(bpage), - 0, - zip_size ? zip_size : UNIV_PAGE_SIZE, - frame, - bpage, - &bpage->write_size, - bpage->newest_modification); + FALSE, + buf_page_get_space(bpage), + zip_size, + buf_page_get_page_no(bpage), + 0, + zip_size ? zip_size : UNIV_PAGE_SIZE, + frame, + bpage, + &bpage->write_size, + bpage->newest_modification, + bpage->encrypt_later); } else if (flush_type == BUF_FLUSH_SINGLE_PAGE) { buf_dblwr_write_single_page(bpage, sync); } else { diff --git a/storage/xtradb/buf/buf0rea.cc b/storage/xtradb/buf/buf0rea.cc index 271fcdc12aa..afa14f0df04 100644 --- a/storage/xtradb/buf/buf0rea.cc +++ b/storage/xtradb/buf/buf0rea.cc @@ -232,14 +232,14 @@ not_to_recover: *err = _fil_io(OS_FILE_READ | wake_later | ignore_nonexistent_pages, sync, space, zip_size, offset, 0, zip_size, - frame, bpage, 0, trx, 0); + frame, bpage, 0, trx, 0, false); } else { ut_a(buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE); *err = _fil_io(OS_FILE_READ | wake_later | ignore_nonexistent_pages, sync, space, 0, offset, 0, UNIV_PAGE_SIZE, - frame, bpage, &bpage->write_size, trx, 0); + frame, bpage, &bpage->write_size, trx, 0, false); } if (sync) { |