Commit 7047bef1 authored by Jan Lindström's avatar Jan Lindström

Use standard InnoDB error mechanism on compression and encryption

error messages.
parent 1f1f9771
call mtr.add_suppression("InnoDB: Warning: Compression failed for space*"); call mtr.add_suppression("Compression failed for space*");
set global innodb_file_format = `barracuda`; set global innodb_file_format = `barracuda`;
set global innodb_file_per_table = on; set global innodb_file_per_table = on;
set global innodb_compression_algorithm = 6; set global innodb_compression_algorithm = 6;
......
call mtr.add_suppression("KeyID 0 not found or with error. Check the key and the log file*"); call mtr.add_suppression("KeyID 0 not found or with error. Check the key and the log*");
call mtr.add_suppression("Disabling redo log encryption"); call mtr.add_suppression("Disabling redo log encryp*");
call mtr.add_suppression("InnoDB: Redo log crypto: Can't initialize to key version*");
SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb; create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
......
-- source include/have_innodb.inc -- source include/have_innodb.inc
-- source include/have_innodb_snappy.inc -- source include/have_innodb_snappy.inc
call mtr.add_suppression("InnoDB: Warning: Compression failed for space*"); call mtr.add_suppression("Compression failed for space*");
--disable_query_log --disable_query_log
let $innodb_compression_algorithm_orig=`select @@innodb_compression_algorithm`; let $innodb_compression_algorithm_orig=`select @@innodb_compression_algorithm`;
......
...@@ -6,8 +6,9 @@ let $innodb_file_format_orig = `SELECT @@innodb_file_format`; ...@@ -6,8 +6,9 @@ let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`; let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
--enable_query_log --enable_query_log
call mtr.add_suppression("KeyID 0 not found or with error. Check the key and the log file*"); call mtr.add_suppression("KeyID 0 not found or with error. Check the key and the log*");
call mtr.add_suppression("Disabling redo log encryption"); call mtr.add_suppression("Disabling redo log encryp*");
call mtr.add_suppression("InnoDB: Redo log crypto: Can't initialize to key version*");
SET GLOBAL innodb_file_format = `Barracuda`; SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;
......
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/
/**************************************************//**
@file fil0crypt.cc
Innodb file space encrypt/decrypt
Created Jonas Oreland Google
Modified Jan Lindström jan.lindstrom@mariadb.com
*******************************************************/
#include "fil0fil.h" #include "fil0fil.h"
#include "srv0srv.h" #include "srv0srv.h"
#include "srv0start.h" #include "srv0start.h"
...@@ -11,6 +37,7 @@ ...@@ -11,6 +37,7 @@
#include "fsp0fsp.h" #include "fsp0fsp.h"
#include "fil0pagecompress.h" #include "fil0pagecompress.h"
#include "fil0pageencryption.h" #include "fil0pageencryption.h"
#include "ha_prototypes.h" // IB_LOG_
#include <my_crypt.h> #include <my_crypt.h>
...@@ -368,11 +395,11 @@ fil_space_read_crypt_data(ulint space, const byte* page, ulint offset) ...@@ -368,11 +395,11 @@ fil_space_read_crypt_data(ulint space, const byte* page, ulint offset)
} }
if (memcmp(page + offset, CRYPT_MAGIC, MAGIC_SZ) != 0) { if (memcmp(page + offset, CRYPT_MAGIC, MAGIC_SZ) != 0) {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_WARN,
"Warning: found potentially bogus bytes on " "Found potentially bogus bytes on "
"page 0 offset %lu for space %lu : " "page 0 offset %lu for space %lu : "
"[ %.2x %.2x %.2x %.2x %.2x %.2x ]. " "[ %.2x %.2x %.2x %.2x %.2x %.2x ]. "
"Assuming space is not encrypted!\n", "Assuming space is not encrypted!.",
offset, space, offset, space,
page[offset + 0], page[offset + 0],
page[offset + 1], page[offset + 1],
...@@ -387,10 +414,10 @@ fil_space_read_crypt_data(ulint space, const byte* page, ulint offset) ...@@ -387,10 +414,10 @@ fil_space_read_crypt_data(ulint space, const byte* page, ulint offset)
if (! (type == CRYPT_SCHEME_UNENCRYPTED || if (! (type == CRYPT_SCHEME_UNENCRYPTED ||
type == CRYPT_SCHEME_1)) { type == CRYPT_SCHEME_1)) {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"Found non sensible crypt scheme: %lu for space %lu " "Found non sensible crypt scheme: %lu for space %lu "
" offset: %lu bytes: " " offset: %lu bytes: "
"[ %.2x %.2x %.2x %.2x %.2x %.2x ]\n", "[ %.2x %.2x %.2x %.2x %.2x %.2x ].",
type, space, offset, type, space, offset,
page[offset + 0 + MAGIC_SZ], page[offset + 0 + MAGIC_SZ],
page[offset + 1 + MAGIC_SZ], page[offset + 1 + MAGIC_SZ],
...@@ -403,10 +430,10 @@ fil_space_read_crypt_data(ulint space, const byte* page, ulint offset) ...@@ -403,10 +430,10 @@ fil_space_read_crypt_data(ulint space, const byte* page, ulint offset)
ulint iv_length = mach_read_from_1(page + offset + MAGIC_SZ + 1); ulint iv_length = mach_read_from_1(page + offset + MAGIC_SZ + 1);
if (! (iv_length == CRYPT_SCHEME_1_IV_LEN)) { if (! (iv_length == CRYPT_SCHEME_1_IV_LEN)) {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"Found non sensible iv length: %lu for space %lu " "Found non sensible iv length: %lu for space %lu "
" offset: %lu type: %lu bytes: " " offset: %lu type: %lu bytes: "
"[ %.2x %.2x %.2x %.2x %.2x %.2x ]\n", "[ %.2x %.2x %.2x %.2x %.2x %.2x ].",
iv_length, space, offset, type, iv_length, space, offset, type,
page[offset + 0 + MAGIC_SZ], page[offset + 0 + MAGIC_SZ],
page[offset + 1 + MAGIC_SZ], page[offset + 1 + MAGIC_SZ],
...@@ -1414,8 +1441,8 @@ fil_crypt_realloc_iops(rotate_thread_t *state) ...@@ -1414,8 +1441,8 @@ fil_crypt_realloc_iops(rotate_thread_t *state)
state->sum_waited_us / state->cnt_waited; state->sum_waited_us / state->cnt_waited;
#if DEBUG_KEYROTATION_THROTTLING #if DEBUG_KEYROTATION_THROTTLING
fprintf(stderr, ib_logf(IB_LOG_LEVEL_INFO,
"thr_no: %u - update estimated_max_iops from %u to %u\n", "thr_no: %u - update estimated_max_iops from %u to %u.",
state->thread_no, state->thread_no,
state->estimated_max_iops, state->estimated_max_iops,
1000000 / avg_wait_time_us); 1000000 / avg_wait_time_us);
...@@ -1428,8 +1455,8 @@ fil_crypt_realloc_iops(rotate_thread_t *state) ...@@ -1428,8 +1455,8 @@ fil_crypt_realloc_iops(rotate_thread_t *state)
state->sum_waited_us = 0; state->sum_waited_us = 0;
} else { } else {
#if DEBUG_KEYROTATION_THROTTLING #if DEBUG_KEYROTATION_THROTTLING
fprintf(stderr, ib_logf(IB_LOG_LEVEL_INFO,
"thr_no: %u only waited %lu%% skip re-estimate\n", "thr_no: %u only waited %lu%% skip re-estimate.",
state->thread_no, state->thread_no,
(100 * state->cnt_waited) / state->batch); (100 * state->cnt_waited) / state->batch);
#endif #endif
...@@ -1477,8 +1504,8 @@ fil_crypt_realloc_iops(rotate_thread_t *state) ...@@ -1477,8 +1504,8 @@ fil_crypt_realloc_iops(rotate_thread_t *state)
n_fil_crypt_iops_allocated += extra; n_fil_crypt_iops_allocated += extra;
state->allocated_iops += extra; state->allocated_iops += extra;
#if DEBUG_KEYROTATION_THROTTLING #if DEBUG_KEYROTATION_THROTTLING
fprintf(stderr, ib_logf(IB_LOG_LEVEL_INFO,
"thr_no: %u increased iops from %u to %u\n", "thr_no: %u increased iops from %u to %u.",
state->thread_no, state->thread_no,
state->allocated_iops - extra, state->allocated_iops - extra,
state->allocated_iops); state->allocated_iops);
...@@ -2325,9 +2352,8 @@ fil_space_crypt_close_tablespace( ...@@ -2325,9 +2352,8 @@ fil_space_crypt_close_tablespace(
uint now = time(0); uint now = time(0);
if (now >= last + 30) { if (now >= last + 30) {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_WARN,
"WARNING: " "Waited %u seconds to drop space: %lu.",
"waited %u seconds to drop space: %lu\n",
now - start, space); now - start, space);
last = now; last = now;
} }
......
This diff is collapsed.
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/
/**************************************************//** /**************************************************//**
@file log0crypt.cc @file log0crypt.cc
Innodb log encrypt/decrypt Innodb log encrypt/decrypt
Created 11/25/2013 Minli Zhu Created 11/25/2013 Minli Zhu Google
Modified Jan Lindström jan.lindstrom@mariadb.com
*******************************************************/ *******************************************************/
#include "m_string.h" #include "m_string.h"
#include "log0crypt.h" #include "log0crypt.h"
...@@ -13,6 +32,7 @@ Created 11/25/2013 Minli Zhu ...@@ -13,6 +32,7 @@ Created 11/25/2013 Minli Zhu
#include "log0recv.h" // for recv_sys #include "log0recv.h" // for recv_sys
#include "mysql/plugin_encryption_key_management.h" // for BAD_ENCRYPTION_KEY_VERSION #include "mysql/plugin_encryption_key_management.h" // for BAD_ENCRYPTION_KEY_VERSION
#include "ha_prototypes.h" // IB_LOG_
/* If true, enable redo log encryption. */ /* If true, enable redo log encryption. */
UNIV_INTERN my_bool srv_encrypt_log = FALSE; UNIV_INTERN my_bool srv_encrypt_log = FALSE;
...@@ -51,18 +71,18 @@ log_init_crypt_msg_and_nonce(void) ...@@ -51,18 +71,18 @@ log_init_crypt_msg_and_nonce(void)
mach_write_to_1(redo_log_crypt_msg, redo_log_purpose_byte); mach_write_to_1(redo_log_crypt_msg, redo_log_purpose_byte);
if (my_random_bytes(redo_log_crypt_msg + 1, PURPOSE_BYTE_LEN) != AES_OK) if (my_random_bytes(redo_log_crypt_msg + 1, PURPOSE_BYTE_LEN) != AES_OK)
{ {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"\nInnoDB redo log crypto: generate " "Redo log crypto: generate "
"%u-byte random number as crypto msg failed.\n", "%u-byte random number as crypto msg failed.",
PURPOSE_BYTE_LEN); PURPOSE_BYTE_LEN);
abort(); abort();
} }
if (my_random_bytes(aes_ctr_nonce, MY_AES_BLOCK_SIZE) != AES_OK) if (my_random_bytes(aes_ctr_nonce, MY_AES_BLOCK_SIZE) != AES_OK)
{ {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"\nInnoDB redo log crypto: generate " "Redo log crypto: generate "
"%u-byte random number as AES_CTR nonce failed.\n", "%u-byte random number as AES_CTR nonce failed.",
MY_AES_BLOCK_SIZE); MY_AES_BLOCK_SIZE);
abort(); abort();
} }
...@@ -80,16 +100,17 @@ log_init_crypt_key( ...@@ -80,16 +100,17 @@ log_init_crypt_key(
{ {
if (crypt_ver == UNENCRYPTED_KEY_VER) if (crypt_ver == UNENCRYPTED_KEY_VER)
{ {
fprintf(stderr, "\nInnoDB redo log crypto: unencrypted key ver.\n\n"); ib_logf(IB_LOG_LEVEL_INFO,
"Redo log crypto: unencrypted key ver.");
memset(key, 0, MY_AES_BLOCK_SIZE); memset(key, 0, MY_AES_BLOCK_SIZE);
return; return;
} }
if (crypt_msg[PURPOSE_BYTE_OFFSET] != redo_log_purpose_byte) if (crypt_msg[PURPOSE_BYTE_OFFSET] != redo_log_purpose_byte)
{ {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"\nInnoDB redo log crypto: msg type mismatched. " "Redo log crypto: msg type mismatched. "
"Expected: %x; Actual: %x\n", "Expected: %x; Actual: %x.",
redo_log_purpose_byte, crypt_msg[PURPOSE_BYTE_OFFSET]); redo_log_purpose_byte, crypt_msg[PURPOSE_BYTE_OFFSET]);
abort(); abort();
} }
...@@ -97,9 +118,9 @@ log_init_crypt_key( ...@@ -97,9 +118,9 @@ log_init_crypt_key(
byte mysqld_key[MY_AES_BLOCK_SIZE] = {0}; byte mysqld_key[MY_AES_BLOCK_SIZE] = {0};
if (get_encryption_key(crypt_ver, mysqld_key, MY_AES_BLOCK_SIZE)) if (get_encryption_key(crypt_ver, mysqld_key, MY_AES_BLOCK_SIZE))
{ {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"\nInnoDB redo log crypto: getting mysqld crypto key " "Redo log crypto: getting mysqld crypto key "
"from key version failed.\n"); "from key version failed.");
abort(); abort();
} }
...@@ -113,9 +134,9 @@ log_init_crypt_key( ...@@ -113,9 +134,9 @@ log_init_crypt_key(
if (rc != AES_OK || dst_len != MY_AES_BLOCK_SIZE) if (rc != AES_OK || dst_len != MY_AES_BLOCK_SIZE)
{ {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"\nInnoDB redo log crypto: getting redo log crypto key " "Redo log crypto: getting redo log crypto key "
"failed.\n"); "failed.");
abort(); abort();
} }
} }
...@@ -247,9 +268,11 @@ log_crypt_set_ver_and_key( ...@@ -247,9 +268,11 @@ log_crypt_set_ver_and_key(
vkey == (unsigned int)CRYPT_KEY_UNKNOWN) { vkey == (unsigned int)CRYPT_KEY_UNKNOWN) {
encrypted = false; encrypted = false;
fprintf(stderr, "\nInnoDB redo log crypto: Can't initialize to key version %du\n", ib_logf(IB_LOG_LEVEL_WARN,
key_ver); "Redo log crypto: Can't initialize to key version %du.", vkey);
fprintf(stderr, "InnoDB: Warning: Disabling redo log encryption\n"); ib_logf(IB_LOG_LEVEL_WARN,
"Disabling redo log encryption.");
srv_encrypt_log = FALSE; srv_encrypt_log = FALSE;
} else { } else {
key_ver = vkey; key_ver = vkey;
......
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/
/**************************************************//**
@file fil0crypt.cc
Innodb file space encrypt/decrypt
Created Jonas Oreland Google
Modified Jan Lindström jan.lindstrom@mariadb.com
*******************************************************/
#include "fil0fil.h" #include "fil0fil.h"
#include "srv0srv.h" #include "srv0srv.h"
#include "srv0start.h" #include "srv0start.h"
...@@ -11,6 +37,7 @@ ...@@ -11,6 +37,7 @@
#include "fsp0fsp.h" #include "fsp0fsp.h"
#include "fil0pagecompress.h" #include "fil0pagecompress.h"
#include "fil0pageencryption.h" #include "fil0pageencryption.h"
#include "ha_prototypes.h" // IB_LOG_
#include <my_crypt.h> #include <my_crypt.h>
...@@ -368,11 +395,11 @@ fil_space_read_crypt_data(ulint space, const byte* page, ulint offset) ...@@ -368,11 +395,11 @@ fil_space_read_crypt_data(ulint space, const byte* page, ulint offset)
} }
if (memcmp(page + offset, CRYPT_MAGIC, MAGIC_SZ) != 0) { if (memcmp(page + offset, CRYPT_MAGIC, MAGIC_SZ) != 0) {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_WARN,
"Warning: found potentially bogus bytes on " "Found potentially bogus bytes on "
"page 0 offset %lu for space %lu : " "page 0 offset %lu for space %lu : "
"[ %.2x %.2x %.2x %.2x %.2x %.2x ]. " "[ %.2x %.2x %.2x %.2x %.2x %.2x ]. "
"Assuming space is not encrypted!\n", "Assuming space is not encrypted!.",
offset, space, offset, space,
page[offset + 0], page[offset + 0],
page[offset + 1], page[offset + 1],
...@@ -387,10 +414,10 @@ fil_space_read_crypt_data(ulint space, const byte* page, ulint offset) ...@@ -387,10 +414,10 @@ fil_space_read_crypt_data(ulint space, const byte* page, ulint offset)
if (! (type == CRYPT_SCHEME_UNENCRYPTED || if (! (type == CRYPT_SCHEME_UNENCRYPTED ||
type == CRYPT_SCHEME_1)) { type == CRYPT_SCHEME_1)) {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"Found non sensible crypt scheme: %lu for space %lu " "Found non sensible crypt scheme: %lu for space %lu "
" offset: %lu bytes: " " offset: %lu bytes: "
"[ %.2x %.2x %.2x %.2x %.2x %.2x ]\n", "[ %.2x %.2x %.2x %.2x %.2x %.2x ].",
type, space, offset, type, space, offset,
page[offset + 0 + MAGIC_SZ], page[offset + 0 + MAGIC_SZ],
page[offset + 1 + MAGIC_SZ], page[offset + 1 + MAGIC_SZ],
...@@ -403,10 +430,10 @@ fil_space_read_crypt_data(ulint space, const byte* page, ulint offset) ...@@ -403,10 +430,10 @@ fil_space_read_crypt_data(ulint space, const byte* page, ulint offset)
ulint iv_length = mach_read_from_1(page + offset + MAGIC_SZ + 1); ulint iv_length = mach_read_from_1(page + offset + MAGIC_SZ + 1);
if (! (iv_length == CRYPT_SCHEME_1_IV_LEN)) { if (! (iv_length == CRYPT_SCHEME_1_IV_LEN)) {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"Found non sensible iv length: %lu for space %lu " "Found non sensible iv length: %lu for space %lu "
" offset: %lu type: %lu bytes: " " offset: %lu type: %lu bytes: "
"[ %.2x %.2x %.2x %.2x %.2x %.2x ]\n", "[ %.2x %.2x %.2x %.2x %.2x %.2x ].",
iv_length, space, offset, type, iv_length, space, offset, type,
page[offset + 0 + MAGIC_SZ], page[offset + 0 + MAGIC_SZ],
page[offset + 1 + MAGIC_SZ], page[offset + 1 + MAGIC_SZ],
...@@ -1414,8 +1441,8 @@ fil_crypt_realloc_iops(rotate_thread_t *state) ...@@ -1414,8 +1441,8 @@ fil_crypt_realloc_iops(rotate_thread_t *state)
state->sum_waited_us / state->cnt_waited; state->sum_waited_us / state->cnt_waited;
#if DEBUG_KEYROTATION_THROTTLING #if DEBUG_KEYROTATION_THROTTLING
fprintf(stderr, ib_logf(IB_LOG_LEVEL_INFO,
"thr_no: %u - update estimated_max_iops from %u to %u\n", "thr_no: %u - update estimated_max_iops from %u to %u.",
state->thread_no, state->thread_no,
state->estimated_max_iops, state->estimated_max_iops,
1000000 / avg_wait_time_us); 1000000 / avg_wait_time_us);
...@@ -1428,8 +1455,8 @@ fil_crypt_realloc_iops(rotate_thread_t *state) ...@@ -1428,8 +1455,8 @@ fil_crypt_realloc_iops(rotate_thread_t *state)
state->sum_waited_us = 0; state->sum_waited_us = 0;
} else { } else {
#if DEBUG_KEYROTATION_THROTTLING #if DEBUG_KEYROTATION_THROTTLING
fprintf(stderr, ib_logf(IB_LOG_LEVEL_INFO,
"thr_no: %u only waited %lu%% skip re-estimate\n", "thr_no: %u only waited %lu%% skip re-estimate.",
state->thread_no, state->thread_no,
(100 * state->cnt_waited) / state->batch); (100 * state->cnt_waited) / state->batch);
#endif #endif
...@@ -1477,8 +1504,8 @@ fil_crypt_realloc_iops(rotate_thread_t *state) ...@@ -1477,8 +1504,8 @@ fil_crypt_realloc_iops(rotate_thread_t *state)
n_fil_crypt_iops_allocated += extra; n_fil_crypt_iops_allocated += extra;
state->allocated_iops += extra; state->allocated_iops += extra;
#if DEBUG_KEYROTATION_THROTTLING #if DEBUG_KEYROTATION_THROTTLING
fprintf(stderr, ib_logf(IB_LOG_LEVEL_INFO,
"thr_no: %u increased iops from %u to %u\n", "thr_no: %u increased iops from %u to %u.",
state->thread_no, state->thread_no,
state->allocated_iops - extra, state->allocated_iops - extra,
state->allocated_iops); state->allocated_iops);
...@@ -2325,9 +2352,8 @@ fil_space_crypt_close_tablespace( ...@@ -2325,9 +2352,8 @@ fil_space_crypt_close_tablespace(
uint now = time(0); uint now = time(0);
if (now >= last + 30) { if (now >= last + 30) {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_WARN,
"WARNING: " "Waited %u seconds to drop space: %lu.",
"waited %u seconds to drop space: %lu\n",
now - start, space); now - start, space);
last = now; last = now;
} }
......
This diff is collapsed.
/*****************************************************************************
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*****************************************************************************/
/**************************************************//** /**************************************************//**
@file log0crypt.cc @file log0crypt.cc
Innodb log encrypt/decrypt Innodb log encrypt/decrypt
Created 11/25/2013 Minli Zhu Created 11/25/2013 Minli Zhu Google
Modified Jan Lindström jan.lindstrom@mariadb.com
*******************************************************/ *******************************************************/
#include "m_string.h" #include "m_string.h"
#include "log0crypt.h" #include "log0crypt.h"
...@@ -14,6 +33,7 @@ Created 11/25/2013 Minli Zhu ...@@ -14,6 +33,7 @@ Created 11/25/2013 Minli Zhu
#include "log0recv.h" // for recv_sys #include "log0recv.h" // for recv_sys
#include "mysql/plugin_encryption_key_management.h" // for BAD_ENCRYPTION_KEY_VERSION #include "mysql/plugin_encryption_key_management.h" // for BAD_ENCRYPTION_KEY_VERSION
#include "ha_prototypes.h" // IB_LOG_
/* If true, enable redo log encryption. */ /* If true, enable redo log encryption. */
UNIV_INTERN my_bool srv_encrypt_log = FALSE; UNIV_INTERN my_bool srv_encrypt_log = FALSE;
...@@ -52,18 +72,18 @@ log_init_crypt_msg_and_nonce(void) ...@@ -52,18 +72,18 @@ log_init_crypt_msg_and_nonce(void)
mach_write_to_1(redo_log_crypt_msg, redo_log_purpose_byte); mach_write_to_1(redo_log_crypt_msg, redo_log_purpose_byte);
if (my_random_bytes(redo_log_crypt_msg + 1, PURPOSE_BYTE_LEN) != AES_OK) if (my_random_bytes(redo_log_crypt_msg + 1, PURPOSE_BYTE_LEN) != AES_OK)
{ {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"\nInnoDB redo log crypto: generate " "Redo log crypto: generate "
"%u-byte random number as crypto msg failed.\n", "%u-byte random number as crypto msg failed.",
PURPOSE_BYTE_LEN); PURPOSE_BYTE_LEN);
abort(); abort();
} }
if (my_random_bytes(aes_ctr_nonce, MY_AES_BLOCK_SIZE) != AES_OK) if (my_random_bytes(aes_ctr_nonce, MY_AES_BLOCK_SIZE) != AES_OK)
{ {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"\nInnoDB redo log crypto: generate " "Redo log crypto: generate "
"%u-byte random number as AES_CTR nonce failed.\n", "%u-byte random number as AES_CTR nonce failed.",
MY_AES_BLOCK_SIZE); MY_AES_BLOCK_SIZE);
abort(); abort();
} }
...@@ -81,16 +101,17 @@ log_init_crypt_key( ...@@ -81,16 +101,17 @@ log_init_crypt_key(
{ {
if (crypt_ver == UNENCRYPTED_KEY_VER) if (crypt_ver == UNENCRYPTED_KEY_VER)
{ {
fprintf(stderr, "\nInnoDB redo log crypto: unencrypted key ver.\n\n"); ib_logf(IB_LOG_LEVEL_INFO,
"Redo log crypto: unencrypted key ver.");
memset(key, 0, MY_AES_BLOCK_SIZE); memset(key, 0, MY_AES_BLOCK_SIZE);
return; return;
} }
if (crypt_msg[PURPOSE_BYTE_OFFSET] != redo_log_purpose_byte) if (crypt_msg[PURPOSE_BYTE_OFFSET] != redo_log_purpose_byte)
{ {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"\nInnoDB redo log crypto: msg type mismatched. " "Redo log crypto: msg type mismatched. "
"Expected: %x; Actual: %x\n", "Expected: %x; Actual: %x.",
redo_log_purpose_byte, crypt_msg[PURPOSE_BYTE_OFFSET]); redo_log_purpose_byte, crypt_msg[PURPOSE_BYTE_OFFSET]);
abort(); abort();
} }
...@@ -98,9 +119,9 @@ log_init_crypt_key( ...@@ -98,9 +119,9 @@ log_init_crypt_key(
byte mysqld_key[MY_AES_BLOCK_SIZE] = {0}; byte mysqld_key[MY_AES_BLOCK_SIZE] = {0};
if (get_encryption_key(crypt_ver, mysqld_key, MY_AES_BLOCK_SIZE)) if (get_encryption_key(crypt_ver, mysqld_key, MY_AES_BLOCK_SIZE))
{ {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"\nInnoDB redo log crypto: getting mysqld crypto key " "Redo log crypto: getting mysqld crypto key "
"from key version failed.\n"); "from key version failed.");
abort(); abort();
} }
...@@ -114,9 +135,9 @@ log_init_crypt_key( ...@@ -114,9 +135,9 @@ log_init_crypt_key(
if (rc != AES_OK || dst_len != MY_AES_BLOCK_SIZE) if (rc != AES_OK || dst_len != MY_AES_BLOCK_SIZE)
{ {
fprintf(stderr, ib_logf(IB_LOG_LEVEL_ERROR,
"\nInnoDB redo log crypto: getting redo log crypto key " "Redo log crypto: getting redo log crypto key "
"failed.\n"); "failed.");
abort(); abort();
} }
} }
...@@ -248,9 +269,11 @@ log_crypt_set_ver_and_key( ...@@ -248,9 +269,11 @@ log_crypt_set_ver_and_key(
vkey == (unsigned int)CRYPT_KEY_UNKNOWN) { vkey == (unsigned int)CRYPT_KEY_UNKNOWN) {
encrypted = false; encrypted = false;
fprintf(stderr, "\nInnoDB redo log crypto: Can't initialize to key version %du\n", ib_logf(IB_LOG_LEVEL_WARN,
key_ver); "Redo log crypto: Can't initialize to key version %du.", vkey);
fprintf(stderr, "InnoDB: Warning: Disabling redo log encryption\n"); ib_logf(IB_LOG_LEVEL_WARN,
"Disabling redo log encryption.");
srv_encrypt_log = FALSE; srv_encrypt_log = FALSE;
} else { } else {
key_ver = vkey; key_ver = vkey;
......
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