Commit 94e22efb authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.2 into 10.3

parents 8cbb0bfa b7392d14
......@@ -261,6 +261,8 @@ xb_fil_cur_open(
mutex_exit(&fil_system.mutex);
}
/*msg("crypt: %s,%u\n", node->name, node->space->crypt_data->type);*/
cursor->space_size = (ulint)(cursor->statinfo.st_size
/ page_size.physical());
......@@ -271,8 +273,9 @@ xb_fil_cur_open(
return(XB_FIL_CUR_SUCCESS);
}
static bool page_is_corrupted(byte *page, ulint page_no, xb_fil_cur_t *cursor,
fil_space_t *space)
static bool page_is_corrupted(const byte *page, ulint page_no,
const xb_fil_cur_t *cursor,
const fil_space_t *space)
{
byte tmp_frame[UNIV_PAGE_SIZE_MAX];
byte tmp_page[UNIV_PAGE_SIZE_MAX];
......@@ -300,8 +303,8 @@ static bool page_is_corrupted(byte *page, ulint page_no, xb_fil_cur_t *cursor,
from the start of each file.)
The first 38 and last 8 bytes are never encrypted. */
const ulint* p = reinterpret_cast<ulint*>(page);
const ulint* const end = reinterpret_cast<ulint*>(
const ulint* p = reinterpret_cast<const ulint*>(page);
const ulint* const end = reinterpret_cast<const ulint*>(
page + page_size);
do {
if (*p++) {
......@@ -321,8 +324,9 @@ static bool page_is_corrupted(byte *page, ulint page_no, xb_fil_cur_t *cursor,
page_no first. */
if (page_no
&& mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)
&& space->crypt_data
&& space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED) {
&& (opt_backup_encrypted
|| (space->crypt_data
&& space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED))) {
if (!fil_space_verify_crypt_checksum(page, cursor->page_size))
return true;
......@@ -336,7 +340,10 @@ static bool page_is_corrupted(byte *page, ulint page_no, xb_fil_cur_t *cursor,
memcpy(tmp_page, page, page_size);
bool decrypted = false;
if (!fil_space_decrypt(space, tmp_frame, tmp_page, &decrypted)) {
if (!space->crypt_data
|| space->crypt_data->type == CRYPT_SCHEME_UNENCRYPTED
|| fil_space_decrypt(space, tmp_frame, tmp_page,
&decrypted)) {
return true;
}
......@@ -462,6 +469,7 @@ xb_fil_cur_read(
"corrupted.\n", cursor->thread_n,
cursor->abs_path);
ret = XB_FIL_CUR_ERROR;
buf_page_print(page, cursor->page_size);
break;
}
msg("[%02u] mariabackup: "
......
......@@ -201,6 +201,7 @@ static char* log_ignored_opt;
extern my_bool opt_use_ssl;
my_bool opt_ssl_verify_server_cert;
my_bool opt_extended_validation;
my_bool opt_backup_encrypted;
/* === metadata of backup === */
#define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints"
......@@ -762,6 +763,7 @@ enum options_xtrabackup
OPT_XTRA_DATABASES_FILE,
OPT_XTRA_PARALLEL,
OPT_XTRA_EXTENDED_VALIDATION,
OPT_XTRA_BACKUP_ENCRYPTED,
OPT_XTRA_STREAM,
OPT_XTRA_COMPRESS,
OPT_XTRA_COMPRESS_THREADS,
......@@ -1220,12 +1222,20 @@ struct my_option xb_server_options[] =
REQUIRED_ARG, 1, 1, INT_MAX, 0, 0, 0},
{"extended_validation", OPT_XTRA_EXTENDED_VALIDATION,
"Enable extended validation for Innodb data pages during backup phase."
"Will slow down backup considerably, in case encryption is used.",
"Enable extended validation for Innodb data pages during backup phase. "
"Will slow down backup considerably, in case encryption is used. "
"May fail if tables are created during the backup.",
(G_PTR*)&opt_extended_validation,
(G_PTR*)&opt_extended_validation,
0, GET_BOOL, NO_ARG, FALSE, 0, 0, 0, 0, 0},
{"backup_encrypted", OPT_XTRA_BACKUP_ENCRYPTED,
"In --backup, assume that nonzero key_version implies that the page"
" is encrypted. Use --backup --skip-backup-encrypted to allow"
" copying unencrypted that were originally created before MySQL 5.1.48.",
(G_PTR*)&opt_backup_encrypted,
(G_PTR*)&opt_backup_encrypted,
0, GET_BOOL, NO_ARG, TRUE, 0, 0, 0, 0, 0},
{"log", OPT_LOG, "Ignored option for MySQL option compatibility",
(G_PTR*) &log_ignored_opt, (G_PTR*) &log_ignored_opt, 0,
......
......@@ -112,6 +112,7 @@ extern my_bool opt_no_backup_locks;
extern my_bool opt_decompress;
extern my_bool opt_remove_original;
extern my_bool opt_extended_validation;
extern my_bool opt_backup_encrypted;
extern my_bool opt_lock_ddl_per_table;
extern char *opt_incremental_history_name;
......
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