Skip to content

Commit 84c8b66

Browse files
author
Allen Lai
committed
Fixed bug#26595476 INCORRECT ERROR HANDLING IN ROW_IMPORT_FOR_MYSQL
We need to remove all the invalid code in these error handling code. Approved by Sunny Bains <[email protected]> RB: 17022
1 parent 11da991 commit 84c8b66

File tree

4 files changed

+25
-9
lines changed

4 files changed

+25
-9
lines changed

mysql-test/suite/innodb/r/table_encrypt_4.result

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,12 @@ CREATE TABLE test.t1(c1 INT, c2 char(20)) ENGINE = InnoDB;
140140
ALTER TABLE test.t1 DISCARD TABLESPACE;
141141
ALTER TABLE test.t1 IMPORT TABLESPACE;
142142
ERROR HY000: Schema mismatch (Encryption attribute is no matched)
143+
# Import got expected error.
144+
DROP TABLE t1;
145+
CREATE TABLE test.t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB;
146+
ALTER TABLE test.t1 DISCARD TABLESPACE;
147+
SET SESSION DEBUG="+d, fsp_header_rotate_encryption_failure";
148+
ALTER TABLE test.t1 IMPORT TABLESPACE;
149+
ERROR HY000: Got error 168 from storage engine
143150
Warnings:
144151
Note 1051 Unknown table 'test.t1'

mysql-test/suite/innodb/t/table_encrypt_4.test

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,19 @@ eval ALTER TABLE $dest_db.t1 DISCARD TABLESPACE;
168168
--error 1808
169169
eval ALTER TABLE $dest_db.t1 IMPORT TABLESPACE;
170170

171+
--echo # Import got expected error.
172+
DROP TABLE t1;
173+
--remove_file $MYSQLD_DATADIR/$dest_db/t1.cfg
174+
--remove_file $MYSQLD_DATADIR/$dest_db/t1.cfp
175+
--remove_file $MYSQLD_DATADIR/$dest_db/t1.ibd
176+
eval CREATE TABLE $dest_db.t1(c1 INT, c2 char(20)) ENCRYPTION="Y" ENGINE = InnoDB;
177+
eval ALTER TABLE $dest_db.t1 DISCARD TABLESPACE;
178+
--copy_file $MYSQLD_DATADIR/t1.cfp_back $MYSQLD_DATADIR/$dest_db/t1.cfp
179+
--copy_file $MYSQLD_DATADIR/t1.ibd_back $MYSQLD_DATADIR/$dest_db/t1.ibd
180+
--copy_file $MYSQLD_DATADIR/t1.cfg_back $MYSQLD_DATADIR/$dest_db/t1.cfg
181+
SET SESSION DEBUG="+d, fsp_header_rotate_encryption_failure";
182+
--error ER_GET_ERRNO
183+
eval ALTER TABLE $dest_db.t1 IMPORT TABLESPACE;
171184

172185
# Cleanup
173186
--disable_query_log

storage/innobase/fsp/fsp0fsp.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,6 +1005,9 @@ fsp_header_rotate_encryption(
10051005

10061006
const page_size_t page_size(space->flags);
10071007

1008+
DBUG_EXECUTE_IF("fsp_header_rotate_encryption_failure",
1009+
return(false););
1010+
10081011
/* Fill encryption info. */
10091012
if (!fsp_header_fill_encryption_info(space,
10101013
encrypt_info)) {

storage/innobase/row/row0import.cc

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*****************************************************************************
22
3-
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
3+
Copyright (c) 2012, 2017, Oracle and/or its affiliates. All Rights Reserved.
44
55
This program is free software; you can redistribute it and/or modify it under
66
the terms of the GNU General Public License as published by the Free Software
@@ -3952,14 +3952,7 @@ row_import_for_mysql(
39523952
encrypt_info,
39533953
&mtr)) {
39543954
mtr_commit(&mtr);
3955-
ib_senderrf(trx->mysql_thd, IB_LOG_LEVEL_ERROR,
3956-
ER_FILE_NOT_FOUND,
3957-
filepath, err, ut_strerr(err));
3958-
3959-
ut_free(filepath);
3960-
row_mysql_unlock_data_dictionary(trx);
3961-
3962-
return(row_import_cleanup(prebuilt, trx, err));
3955+
return(row_import_cleanup(prebuilt, trx, DB_ERROR));
39633956
}
39643957

39653958
mtr_commit(&mtr);

0 commit comments

Comments
 (0)