diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-01-03 17:26:50 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-01-03 17:26:50 +0200 |
commit | 94e22efb79869e45a38424c0339752d78da80f96 (patch) | |
tree | 4068e74b12f796eed5e959f6b5cc4c5ffe525aec /extra/mariabackup/fil_cur.cc | |
parent | 8cbb0bfaf71a88d0b0c681e7026121c4309620d6 (diff) | |
parent | b7392d142a2e7ae15fa07d536fd1e7aaee65554a (diff) | |
download | mariadb-git-94e22efb79869e45a38424c0339752d78da80f96.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'extra/mariabackup/fil_cur.cc')
-rw-r--r-- | extra/mariabackup/fil_cur.cc | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index d283d0be617..dedae192e2b 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -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 @@ 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: " |