diff options
Diffstat (limited to 'storage/maria')
-rw-r--r-- | storage/maria/ma_blockrec.c | 10 | ||||
-rw-r--r-- | storage/maria/ma_check.c | 6 | ||||
-rw-r--r-- | storage/maria/ma_crypt.c | 18 | ||||
-rw-r--r-- | storage/maria/ma_key_recover.c | 3 | ||||
-rw-r--r-- | storage/maria/maria_def.h | 1 |
5 files changed, 28 insertions, 10 deletions
diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c index ad4ffa349d0..e628c5ba5f3 100644 --- a/storage/maria/ma_blockrec.c +++ b/storage/maria/ma_blockrec.c @@ -6395,16 +6395,19 @@ uint _ma_apply_redo_insert_row_head_or_tail(MARIA_HA *info, LSN lsn, pin_method= PAGECACHE_PIN_LEFT_PINNED; share->pagecache->readwrite_flags&= ~MY_WME; + share->silence_encryption_errors= 1; buff= pagecache_read(share->pagecache, &info->dfile, page, 0, 0, PAGECACHE_PLAIN_PAGE, PAGECACHE_LOCK_WRITE, &page_link.link); share->pagecache->readwrite_flags= share->pagecache->org_readwrite_flags; + share->silence_encryption_errors= 0; if (!buff) { /* Skip errors when reading outside of file and uninitialized pages */ if (!new_page || (my_errno != HA_ERR_FILE_TOO_SHORT && - my_errno != HA_ERR_WRONG_CRC)) + my_errno != HA_ERR_WRONG_CRC && + my_errno != HA_ERR_DECRYPTION_FAILED)) { DBUG_PRINT("error", ("Error %d when reading page", (int) my_errno)); goto err; @@ -6896,6 +6899,7 @@ uint _ma_apply_redo_insert_row_blobs(MARIA_HA *info, else { share->pagecache->readwrite_flags&= ~MY_WME; + share->silence_encryption_errors= 1; buff= pagecache_read(share->pagecache, &info->dfile, page, 0, 0, @@ -6903,10 +6907,12 @@ uint _ma_apply_redo_insert_row_blobs(MARIA_HA *info, PAGECACHE_LOCK_WRITE, &page_link.link); share->pagecache->readwrite_flags= share->pagecache-> org_readwrite_flags; + share->silence_encryption_errors= 0; if (!buff) { if (my_errno != HA_ERR_FILE_TOO_SHORT && - my_errno != HA_ERR_WRONG_CRC) + my_errno != HA_ERR_WRONG_CRC && + my_errno != HA_ERR_DECRYPTION_FAILED) { /* If not read outside of file */ pagecache_unlock_by_link(share->pagecache, page_link.link, diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index a244a9326ab..f8377df8350 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -5015,7 +5015,8 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) DBUG_RETURN(-1); } /* Retry only if wrong record, not if disk error */ - if (flag != HA_ERR_WRONG_IN_RECORD && flag != HA_ERR_WRONG_CRC) + if (flag != HA_ERR_WRONG_IN_RECORD && flag != HA_ERR_WRONG_CRC && + flag != HA_ERR_DECRYPTION_FAILED) { retry_if_quick(sort_param, flag); DBUG_RETURN(flag); @@ -6825,7 +6826,8 @@ read_next_page: PAGECACHE_READ_UNKNOWN_PAGE, PAGECACHE_LOCK_LEFT_UNLOCKED, 0))) { - if (my_errno == HA_ERR_WRONG_CRC) + if (my_errno == HA_ERR_WRONG_CRC || + my_errno == HA_ERR_DECRYPTION_FAILED) { /* Don't give errors for zero filled blocks. These can diff --git a/storage/maria/ma_crypt.c b/storage/maria/ma_crypt.c index 31f16a21841..9282405bae9 100644 --- a/storage/maria/ma_crypt.c +++ b/storage/maria/ma_crypt.c @@ -345,7 +345,14 @@ static my_bool ma_crypt_index_post_read_hook(int res, const uint block_size= share->block_size; const uint page_used= _ma_get_page_used(share, args->page); - if (res == 0 && page_used <= block_size - CRC_SIZE) + if (res || + page_used < share->keypage_header || + page_used >= block_size - CRC_SIZE) + { + res= 1; + my_errno= HA_ERR_DECRYPTION_FAILED; + } + else { const uchar *src= args->page; uchar* dst= args->crypt_buf; @@ -506,10 +513,11 @@ static int ma_decrypt(MARIA_SHARE *share, MARIA_CRYPT_DATA *crypt_data, if (! (rc == MY_AES_OK && dstlen == size)) { my_errno= HA_ERR_DECRYPTION_FAILED; - my_printf_error(HA_ERR_DECRYPTION_FAILED, - "failed to decrypt '%s' rc: %d dstlen: %u size: %u\n", - MYF(ME_FATAL|ME_ERROR_LOG), - share->open_file_name.str, rc, dstlen, size); + if (!share->silence_encryption_errors) + my_printf_error(HA_ERR_DECRYPTION_FAILED, + "failed to decrypt '%s' rc: %d dstlen: %u size: %u\n", + MYF(ME_FATAL|ME_ERROR_LOG), + share->open_file_name.str, rc, dstlen, size); return 1; } return 0; diff --git a/storage/maria/ma_key_recover.c b/storage/maria/ma_key_recover.c index afa69fce444..2f28ec8d175 100644 --- a/storage/maria/ma_key_recover.c +++ b/storage/maria/ma_key_recover.c @@ -767,7 +767,8 @@ uint _ma_apply_redo_index_new_page(MARIA_HA *info, LSN lsn, &page_link.link))) { if (my_errno != HA_ERR_FILE_TOO_SHORT && - my_errno != HA_ERR_WRONG_CRC) + my_errno != HA_ERR_WRONG_CRC && + my_errno != HA_ERR_DECRYPTION_FAILED) { result= 1; goto err; diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index 0002048d924..fe050dbf03a 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -803,6 +803,7 @@ typedef struct st_maria_share my_bool key_del_used; /* != 0 if key_del is locked */ my_bool deleting; /* we are going to delete this table */ my_bool redo_error_given; /* Used during recovery */ + my_bool silence_encryption_errors; /* Used during recovery */ THR_LOCK lock; void (*lock_restore_status)(void *); /** |