diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-01-03 16:58:05 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-01-03 16:58:05 +0200 |
commit | b7392d142a2e7ae15fa07d536fd1e7aaee65554a (patch) | |
tree | 5d71725dd4391a1f3a1f7f5f805bcdf65c48ecbc /extra/mariabackup | |
parent | 842402e4df35c230e7a416ce3ef8df3055f03d60 (diff) | |
parent | 7158edcba3af3766e9329f9927ce4adfd2a40bf8 (diff) | |
download | mariadb-git-b7392d142a2e7ae15fa07d536fd1e7aaee65554a.tar.gz |
Merge 10.1 into 10.2
Diffstat (limited to 'extra/mariabackup')
-rw-r--r-- | extra/mariabackup/fil_cur.cc | 22 | ||||
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 14 | ||||
-rw-r--r-- | extra/mariabackup/xtrabackup.h | 1 |
3 files changed, 28 insertions, 9 deletions
diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index 49e5f181d42..4ce32f828d2 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -262,6 +262,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()); @@ -272,8 +274,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]; @@ -301,8 +304,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++) { @@ -322,8 +325,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; @@ -337,7 +341,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; } @@ -463,6 +470,7 @@ read_retry: "corrupted.\n", cursor->thread_n, cursor->abs_path); ret = XB_FIL_CUR_ERROR; + buf_page_print(page, cursor->page_size); break; } msg("[%02u] mariabackup: " diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index f86395e494f..1b5e28bb257 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -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, @@ -1223,12 +1225,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, diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h index 7de28d1ea31..c16e19d1b18 100644 --- a/extra/mariabackup/xtrabackup.h +++ b/extra/mariabackup/xtrabackup.h @@ -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; |