Bug #95069 import uncrypted tablespace to encrypted one makes debug version mysqld crash.
Submitted: 20 Apr 2019 7:56 Modified: 22 Apr 2019 8:50
Reporter: Pin Lin Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S6 (Debug Builds)
Version:5.7.23, 5.7.25, 8.0.15 OS:Any
Assigned to: CPU Architecture:Any

[20 Apr 2019 7:56] Pin Lin
Description:
When I imported a unencrypted tablespace to a encrypted tablespace , I wish mysqld make an error, but it crashed.
The follow is the stack infomation when mysqld crashed.

#1  0x0000003e24c34105 in abort () from /lib64/libc.so.6
#2  0x0000000001c0a743 in ut_dbg_assertion_failed (expr=0x23cde08 "table->encryption_key != __null",
    file=0x23caba0 "/home/data_sdb/goldendb_trunk2/DB/storage/innobase/fil/fil0fil.cc", line=6567)
    at /home/data_sdb/goldendb_trunk2/DB/storage/innobase/ut/ut0dbg.cc:67
#3  0x0000000001cf4ea3 in fil_tablespace_iterate (table=0x154b77e0, n_io_buffers=1, callback=...)
    at /home/data_sdb/goldendb_trunk2/DB/storage/innobase/fil/fil0fil.cc:6567
#4  0x0000000001b03297 in row_import_for_mysql (table=0x154b77e0, prebuilt=0x11b030a0)
    at /home/data_sdb/goldendb_trunk2/DB/storage/innobase/row/row0import.cc:3739
#5  0x00000000019edd50 in ha_innobase::discard_or_import_tablespace (this=0x11aa2430, discard=0 '\000')
    at /home/data_sdb/goldendb_trunk2/DB/storage/innobase/handler/ha_innodb.cc:12365  

How to repeat:
create database if not exists test_db;
use test_db;
create table tb1(id int primary key,c1 int);
create table tb2(id int primary key,c1 int);
ALTER TABLE tb1 ENCRYPTION='Y';
insert into tb1 values (1,1);
insert into tb1 values (2,2);

-- session1
flush table t1 for export;

-- session 2
alter table t2 discard tablespace;

-- session3
cp tb1.cfg tb2.cfg 
cp tb1.ibd tb2.ibd

-- session2 crash
alter table t2 imprt tablespace;
[22 Apr 2019 8:50] MySQL Verification Team
Hello Pin Lin,

Thank you for the report.
Observed that 5.7.25 debug build is affected.

regards,
Umesh