MDEV-8588: Assertion failure in file ha_innodb.cc line 21140 if at least one encrypted table exists and encryption service is not available

Analysis: Problem was that in fil_read_first_page we do find that
    table has encryption information and that encryption service
    or used key_id is not available. But, then we just printed
    fatal error message that causes above assertion.

    Fix: When we open single table tablespace if it has encryption
    information (crypt_data) store this crypt data to the table
    structure. When we open a table and we find out that tablespace
    is not available, check has table a encryption information
    and from there is encryption service or used key_id is not available.
    If it is, add additional warning for SQL-layer.
This commit is contained in:
Jan Lindström 2015-08-31 19:47:14 +03:00
commit 7e916bb86f
44 changed files with 1552 additions and 414 deletions

View file

@ -2338,7 +2338,7 @@ row_ins_clust_index_entry_low(
{
btr_cur_t cursor;
ulint* offsets = NULL;
dberr_t err;
dberr_t err = DB_SUCCESS;
big_rec_t* big_rec = NULL;
mtr_t mtr;
mem_heap_t* offsets_heap = NULL;
@ -2361,9 +2361,16 @@ row_ins_clust_index_entry_low(
the function will return in both low_match and up_match of the
cursor sensible values */
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE, mode,
err = btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE, mode,
&cursor, 0, __FILE__, __LINE__, &mtr);
if (err != DB_SUCCESS) {
index->table->is_encrypted = true;
index->table->ibd_file_missing = true;
mtr_commit(&mtr);
goto func_exit;
}
#ifdef UNIV_DEBUG
{
page_t* page = btr_cur_get_page(&cursor);
@ -2669,9 +2676,22 @@ row_ins_sec_index_entry_low(
search_mode |= BTR_IGNORE_SEC_UNIQUE;
}
btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
search_mode,
&cursor, 0, __FILE__, __LINE__, &mtr);
err = btr_cur_search_to_nth_level(index, 0, entry, PAGE_CUR_LE,
search_mode,
&cursor, 0, __FILE__, __LINE__, &mtr);
if (err != DB_SUCCESS) {
if (err == DB_ENCRYPTED_DECRYPT_FAILED) {
ib_push_warning(trx->mysql_thd,
DB_ENCRYPTED_DECRYPT_FAILED,
"Table %s is encrypted but encryption service or"
" used key_id is not available. "
" Can't continue reading table.",
index->table->name);
index->table->is_encrypted = true;
}
goto func_exit;
}
if (cursor.flag == BTR_CUR_INSERT_TO_IBUF) {
/* The insert was buffered during the search: we are done */