Commit 1d55cfce authored by Jan Lindström's avatar Jan Lindström

Do not use os_file_read() directly for reading first page of the

tablespace. Instead use fil_read() with syncronous setting.
Fix test failures and mask tablespace number as it could
change in concurrent mtr runs.
parent 2bedc397
......@@ -36,7 +36,7 @@ SELECT * FROM t1;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 192 Table test/t1 in tablespace 6 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Warning 192 Table test/t1 in tablespace is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Warning 192 Table test/t1 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
DROP TABLE t1;
......@@ -52,7 +52,7 @@ SELECT * FROM t2;
ERROR HY000: Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SHOW WARNINGS;
Level Code Message
Warning 192 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Warning 192 Table test/t2 in tablespace is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Warning 192 Table test/t2 is encrypted but encryption service or used key_id is not available. Can't continue reading table.
Error 1296 Got error 192 'Table encrypted but decryption failed. This could be because correct encryption management plugin is not loaded, used encryption key is not available or encryption method does not match.' from InnoDB
SELECT * FROM t2 where id = 1;
......
......@@ -11,13 +11,13 @@ create database innodb_encrypted_1;
use innodb_encrypted_1;
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 1
Innodb_pages0_read 3
set autocommit=0;
set autocommit=1;
commit work;
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 1
Innodb_pages0_read 3
# should be 100
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE NAME LIKE 'innodb_encrypted%';
COUNT(*)
......@@ -127,7 +127,7 @@ Variable_name Value
Innodb_pages0_read 203
show status like 'innodb_pages0_read%';
Variable_name Value
Innodb_pages0_read 203
Innodb_pages0_read 303
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0 AND NAME LIKE 'innodb_encrypted%';
COUNT(*)
100
......
......@@ -54,6 +54,7 @@ SELECT * FROM t1;
--error ER_GET_ERRMSG
SELECT * FROM t1;
--replace_regex /tablespace [0-9]*/tablespace /
SHOW WARNINGS;
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keysbad3.txt
......@@ -79,7 +80,7 @@ INSERT INTO t2 VALUES ('foobar',1,2);
--error ER_GET_ERRMSG
SELECT * FROM t2;
--replace_regex /.*tablespace [0-9]*//
--replace_regex /tablespace [0-9]*/tablespace /
SHOW WARNINGS;
--error ER_GET_ERRMSG
SELECT * FROM t2 where id = 1;
......
......@@ -40,6 +40,7 @@ buffer_pages_written disabled
buffer_index_pages_written disabled
buffer_non_index_pages_written disabled
buffer_pages_read disabled
buffer_pages0_read disabled
buffer_index_sec_rec_cluster_reads disabled
buffer_index_sec_rec_cluster_reads_avoided disabled
buffer_data_reads disabled
......
......@@ -75,6 +75,7 @@ buffer_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NUL
buffer_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of index pages written (innodb_index_pages_written)
buffer_non_index_pages_written buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of non index pages written (innodb_non_index_pages_written)
buffer_pages_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of pages read (innodb_pages_read)
buffer_pages0_read buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of page 0 read (innodb_pages0_read)
buffer_index_sec_rec_cluster_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of secondary record reads triggered cluster read
buffer_index_sec_rec_cluster_reads_avoided buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Number of secondary record reads avoided triggering cluster read
buffer_data_reads buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled status_counter Amount of data read in bytes (innodb_data_reads)
......
......@@ -40,6 +40,7 @@ buffer_pages_written disabled
buffer_index_pages_written disabled
buffer_non_index_pages_written disabled
buffer_pages_read disabled
buffer_pages0_read disabled
buffer_index_sec_rec_cluster_reads disabled
buffer_index_sec_rec_cluster_reads_avoided disabled
buffer_data_reads disabled
......
......@@ -40,6 +40,7 @@ buffer_pages_written disabled
buffer_index_pages_written disabled
buffer_non_index_pages_written disabled
buffer_pages_read disabled
buffer_pages0_read disabled
buffer_index_sec_rec_cluster_reads disabled
buffer_index_sec_rec_cluster_reads_avoided disabled
buffer_data_reads disabled
......
......@@ -669,6 +669,7 @@ fil_node_open_file(
page = static_cast<byte*>(ut_align(buf2, UNIV_PAGE_SIZE));
success = os_file_read(node->handle, page, 0, UNIV_PAGE_SIZE);
srv_stats.page0_read.add(1);
space_id = fsp_header_get_space_id(page);
flags = fsp_header_get_flags(page);
......@@ -7244,30 +7245,27 @@ fil_space_get_crypt_data(
space = fil_space_get_by_id(id);
mutex_exit(&fil_system->mutex);
if (space != NULL) {
/* If we have not yet read the page0
of this tablespace we will do it now. */
if (!space->crypt_data && !space->page_0_crypt_read) {
ulint flags;
ulint space_id;
lsn_t min_flushed_lsn;
lsn_t max_flushed_lsn;
ulint space_id = space->id;
fil_node_t* node;
ut_a(space->crypt_data == NULL);
node = UT_LIST_GET_FIRST(space->chain);
fil_node_prepare_for_io(node, fil_system, space);
const char* msg = fil_read_first_page(node->handle,
false,
&flags,
&space_id,
&min_flushed_lsn,
&max_flushed_lsn,
&space->crypt_data);
fil_node_complete_io(node, fil_system, OS_FILE_READ);
byte *buf = static_cast<byte*>(ut_malloc(2 * UNIV_PAGE_SIZE));
byte *page = static_cast<byte*>(ut_align(buf, UNIV_PAGE_SIZE));
fil_read(true, space_id, 0, 0, 0, UNIV_PAGE_SIZE, page,
NULL, NULL);
ulint flags = fsp_header_get_flags(page);
ulint offset = fsp_header_get_crypt_offset(
fsp_flags_get_zip_size(flags), NULL);
space->crypt_data = fil_space_read_crypt_data(space_id, page, offset);
ut_free(buf);
ib_logf(IB_LOG_LEVEL_INFO,
"Read page 0 from tablespace for space %lu name %s key_id %u encryption %d handle %d\n",
......@@ -7287,8 +7285,6 @@ fil_space_get_crypt_data(
ut_ad(space->page_0_crypt_read);
}
mutex_exit(&fil_system->mutex);
return(crypt_data);
}
......
......@@ -672,6 +672,7 @@ fil_node_open_file(
page = static_cast<byte*>(ut_align(buf2, UNIV_PAGE_SIZE));
success = os_file_read(node->handle, page, 0, UNIV_PAGE_SIZE);
srv_stats.page0_read.add(1);
space_id = fsp_header_get_space_id(page);
flags = fsp_header_get_flags(page);
......@@ -7342,30 +7343,27 @@ fil_space_get_crypt_data(
space = fil_space_get_by_id(id);
mutex_exit(&fil_system->mutex);
if (space != NULL) {
/* If we have not yet read the page0
of this tablespace we will do it now. */
if (!space->crypt_data && !space->page_0_crypt_read) {
ulint flags;
ulint space_id;
lsn_t min_flushed_lsn;
lsn_t max_flushed_lsn;
ulint space_id = space->id;
fil_node_t* node;
ut_a(space->crypt_data == NULL);
node = UT_LIST_GET_FIRST(space->chain);
fil_node_prepare_for_io(node, fil_system, space);
const char* msg = fil_read_first_page(node->handle,
false,
&flags,
&space_id,
&min_flushed_lsn,
&max_flushed_lsn,
&space->crypt_data);
fil_node_complete_io(node, fil_system, OS_FILE_READ);
byte *buf = static_cast<byte*>(ut_malloc(2 * UNIV_PAGE_SIZE));
byte *page = static_cast<byte*>(ut_align(buf, UNIV_PAGE_SIZE));
fil_read(true, space_id, 0, 0, 0, UNIV_PAGE_SIZE, page,
NULL, NULL);
ulint flags = fsp_header_get_flags(page);
ulint offset = fsp_header_get_crypt_offset(
fsp_flags_get_zip_size(flags), NULL);
space->crypt_data = fil_space_read_crypt_data(space_id, page, offset);
ut_free(buf);
ib_logf(IB_LOG_LEVEL_INFO,
"Read page 0 from tablespace for space %lu name %s key_id %u encryption %d handle %d\n",
......@@ -7385,8 +7383,6 @@ fil_space_get_crypt_data(
ut_ad(space->page_0_crypt_read);
}
mutex_exit(&fil_system->mutex);
return(crypt_data);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment