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/innobase/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/innobase/buf')
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 7 | ||||
-rw-r--r-- | storage/innobase/buf/buf0dblwr.cc | 123 | ||||
-rw-r--r-- | storage/innobase/buf/buf0flu.cc | 24 | ||||
-rw-r--r-- | storage/innobase/buf/buf0rea.cc | 14 |
4 files changed, 112 insertions, 56 deletions
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index c0859bf82b6..59cbe633dec 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1006,6 +1006,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; @@ -3498,6 +3499,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); #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG @@ -5609,6 +5611,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); @@ -5669,7 +5673,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/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 37b8152f1fa..477bcfe0ee3 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/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,18 @@ 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 +644,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,12 +851,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; } @@ -843,12 +872,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); - fprintf(stderr, "JAN: space %lu page_type %lu\n", buf_block_get_space(block), - mach_read_from_2((byte *)frame+FIL_PAGE_TYPE)); - - 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); } /********************************************************************//** @@ -942,7 +977,7 @@ try_again: fil_io(OS_FILE_WRITE, true, TRX_SYS_SPACE, 0, buf_dblwr->block1, 0, len, - (void*) write_buf, NULL, 0, 0); + (void*) write_buf, NULL, 0, 0, false); if (buf_dblwr->first_free <= TRX_SYS_DOUBLEWRITE_BLOCK_SIZE) { /* No unwritten pages in the second block. */ @@ -958,7 +993,7 @@ try_again: fil_io(OS_FILE_WRITE, true, TRX_SYS_SPACE, 0, buf_dblwr->block2, 0, len, - (void*) write_buf, NULL, 0, 0); + (void*) write_buf, NULL, 0, 0, false); flush: /* increment the doublewrite flushed pages counter */ @@ -1187,17 +1222,31 @@ 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/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 9c11ae2b43e..9bd7a7c007d 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -913,16 +913,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 @@ -943,7 +944,8 @@ buf_flush_write_block_low( frame, bpage, &bpage->write_size, - bpage->newest_modification); + 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/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 19d18dcd870..e91a5da6621 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -184,17 +184,17 @@ buf_read_page_low( if (zip_size) { *err = fil_io(OS_FILE_READ | wake_later - | ignore_nonexistent_pages, - sync, space, zip_size, offset, 0, zip_size, - frame, bpage, &bpage->write_size, 0); + | ignore_nonexistent_pages, + sync, space, zip_size, offset, 0, zip_size, + frame, bpage, &bpage->write_size, 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, 0); + | ignore_nonexistent_pages, + sync, space, 0, offset, 0, UNIV_PAGE_SIZE, + frame, bpage, + &bpage->write_size, 0, false); } if (sync) { |