From a52cd4aedac70676eb100afc8779eb694ccd8dce Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 26 Oct 2021 14:37:16 +0200 Subject: InnoDB: send "corrupted" error to the user, not only to the log --- .../encryption/r/corrupted_during_recovery.result | 2 +- .../encryption/r/innodb-bad-key-change.result | 28 +++++++++++----------- .../encryption/r/innodb-bad-key-change2.result | 18 +++++++------- .../encryption/r/innodb-bad-key-change4.result | 8 +++---- .../suite/encryption/r/innodb-missing-key.result | 8 +++---- .../encryption/t/corrupted_during_recovery.test | 4 ++-- .../suite/encryption/t/innodb-bad-key-change.test | 20 ++++++++-------- .../suite/encryption/t/innodb-bad-key-change2.test | 10 ++++---- .../suite/encryption/t/innodb-bad-key-change4.test | 4 ++-- .../suite/encryption/t/innodb-missing-key.test | 8 +++---- mysql-test/suite/innodb/r/alter_kill.result | 2 +- .../innodb/r/corrupted_during_recovery.result | 2 +- mysql-test/suite/innodb/t/alter_kill.test | 4 ++-- .../suite/innodb/t/corrupted_during_recovery.test | 4 ++-- .../suite/plugins/r/compression,innodb-lz4.rdiff | 11 +++++---- .../suite/plugins/r/compression,innodb-lzma.rdiff | 11 +++++---- .../suite/plugins/r/compression,innodb-lzo.rdiff | 11 +++++---- .../plugins/r/compression,innodb-snappy.rdiff | 11 +++++---- .../suite/plugins/r/compression,mroonga-lz4.rdiff | 4 ++-- mysql-test/suite/plugins/r/compression.result | 4 ++-- mysql-test/suite/plugins/t/compression.test | 4 ++-- storage/innobase/dict/dict0dict.cc | 15 ++++++------ 22 files changed, 99 insertions(+), 94 deletions(-) diff --git a/mysql-test/suite/encryption/r/corrupted_during_recovery.result b/mysql-test/suite/encryption/r/corrupted_during_recovery.result index 356dce64f8d..2b29bf260e1 100644 --- a/mysql-test/suite/encryption/r/corrupted_during_recovery.result +++ b/mysql-test/suite/encryption/r/corrupted_during_recovery.result @@ -9,7 +9,7 @@ INSERT INTO t2 VALUES(2); SELECT * FROM t1; ERROR 42000: Unknown storage engine 'InnoDB' SELECT * FROM t1; -ERROR 42S02: Table 'test.t1' doesn't exist in engine +ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate. SELECT * FROM t2; a 2 diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change.result b/mysql-test/suite/encryption/r/innodb-bad-key-change.result index 255dde207ed..3c83a23b4be 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change.result @@ -1,10 +1,10 @@ call mtr.add_suppression("Plugin 'file_key_management' init function returned error"); call mtr.add_suppression("Plugin 'file_key_management' registration.*failed"); -call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)"); +call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` has an unreadable root page"); +call mtr.add_suppression("Table .*t[12].* is corrupted"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1"); -call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` is corrupted"); call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found"); call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space="); # Start server with keys2.txt @@ -46,29 +46,29 @@ INSERT INTO t2 VALUES ('foobar',1,2); SELECT * FROM t2; ERROR 42S02: Table 'test.t2' doesn't exist in engine SELECT * FROM t2 where id = 1; -ERROR 42S02: Table 'test.t2' doesn't exist in engine +ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate. SELECT * FROM t2 where b = 1; -ERROR 42S02: Table 'test.t2' doesn't exist in engine +ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate. INSERT INTO t2 VALUES ('tmp',3,3); -ERROR 42S02: Table 'test.t2' doesn't exist in engine +ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate. DELETE FROM t2 where b = 3; -ERROR 42S02: Table 'test.t2' doesn't exist in engine +ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate. DELETE FROM t2 where id = 3; -ERROR 42S02: Table 'test.t2' doesn't exist in engine +ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate. UPDATE t2 set b = b +1; -ERROR 42S02: Table 'test.t2' doesn't exist in engine +ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate. OPTIMIZE TABLE t2; Table Op Msg_type Msg_text -test.t2 optimize Error Table 'test.t2' doesn't exist in engine -test.t2 optimize status Operation failed +test.t2 optimize Error Table test/t2 is corrupted. Please drop the table and recreate. +test.t2 optimize error Corrupt ALTER TABLE t2 ADD COLUMN d INT; -ERROR 42S02: Table 'test.t2' doesn't exist in engine +ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate. ANALYZE TABLE t2; Table Op Msg_type Msg_text -test.t2 analyze Error Table 'test.t2' doesn't exist in engine -test.t2 analyze status Operation failed +test.t2 analyze Error Table test/t2 is corrupted. Please drop the table and recreate. +test.t2 analyze error Corrupt TRUNCATE TABLE t2; -ERROR 42S02: Table 'test.t2' doesn't exist in engine +ERROR HY000: Table test/t2 is corrupted. Please drop the table and recreate. DROP TABLE t2; # Start server with keys2.txt diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change2.result b/mysql-test/suite/encryption/r/innodb-bad-key-change2.result index af1028f1331..ca73643ba83 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change2.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change2.result @@ -1,9 +1,9 @@ -call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted|does not exist.*is trying to rename)"); +call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|does not exist.*is trying to rename)"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t1(new)?\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); call mtr.add_suppression("InnoDB: Tablespace for table \`test\`.\`t1\` is set as discarded\\."); -call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted"); +call mtr.add_suppression("Table .*t1.* is corrupted"); call mtr.add_suppression("InnoDB: Cannot delete tablespace .* because it is not found in the tablespace memory cache"); call mtr.add_suppression("InnoDB: ALTER TABLE `test`\\.`t1` DISCARD TABLESPACE failed to find tablespace"); call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space="); @@ -19,20 +19,20 @@ SHOW WARNINGS; Level Code Message Error 1932 Table 'test.t1' doesn't exist in engine ALTER TABLE t1 ENGINE=InnoDB; -ERROR 42S02: Table 'test.t1' doesn't exist in engine +ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate. SHOW WARNINGS; Level Code Message -Error 1932 Table 'test.t1' doesn't exist in engine +Error 1877 Table test/t1 is corrupted. Please drop the table and recreate. OPTIMIZE TABLE t1; Table Op Msg_type Msg_text -test.t1 optimize Error Table 'test.t1' doesn't exist in engine -test.t1 optimize status Operation failed +test.t1 optimize Error Table test/t1 is corrupted. Please drop the table and recreate. +test.t1 optimize error Corrupt SHOW WARNINGS; Level Code Message CHECK TABLE t1; Table Op Msg_type Msg_text -test.t1 check Error Table 'test.t1' doesn't exist in engine -test.t1 check status Operation failed +test.t1 check Error Table test/t1 is corrupted. Please drop the table and recreate. +test.t1 check error Corrupt SHOW WARNINGS; Level Code Message # restart: --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt @@ -65,5 +65,5 @@ t1 CREATE TABLE `t1` ( RENAME TABLE t1 TO t1new; ERROR HY000: Error on rename of './test/t1' to './test/t1new' (errno: 155 "The table does not exist in the storage engine") ALTER TABLE t1 RENAME TO t1new; -ERROR 42S02: Table 'test.t1' doesn't exist in engine +ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate. DROP TABLE t1; diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change4.result b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result index ad218457068..90b24799808 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change4.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change4.result @@ -1,8 +1,8 @@ -call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)"); +call mtr.add_suppression("InnoDB: Table `test`\\.`t1` has an unreadable root page"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t1\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); -call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted"); +call mtr.add_suppression("Table .*t1.* is corrupted"); call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space="); # restart: --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt SET GLOBAL innodb_file_per_table = ON; @@ -18,8 +18,8 @@ SHOW WARNINGS; Level Code Message CHECK TABLE t1; Table Op Msg_type Msg_text -test.t1 check Error Table 'test.t1' doesn't exist in engine -test.t1 check status Operation failed +test.t1 check Error Table test/t1 is corrupted. Please drop the table and recreate. +test.t1 check error Corrupt SHOW WARNINGS; Level Code Message # restart: --plugin-load-add=file_key_management --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt diff --git a/mysql-test/suite/encryption/r/innodb-missing-key.result b/mysql-test/suite/encryption/r/innodb-missing-key.result index ecb4ad2c40e..c8aadfd5172 100644 --- a/mysql-test/suite/encryption/r/innodb-missing-key.result +++ b/mysql-test/suite/encryption/r/innodb-missing-key.result @@ -1,8 +1,8 @@ -call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)"); +call mtr.add_suppression("InnoDB: Table `test`\\.`t1` has an unreadable root page"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1"); -call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted"); +call mtr.add_suppression("Table .*t1.* is corrupted"); # Start server with keys2.txt # restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19; @@ -40,9 +40,9 @@ COUNT(1) SELECT COUNT(1) FROM t2,t1 where t2.a = t1.a; ERROR 42S02: Table 'test.t1' doesn't exist in engine SELECT COUNT(1) FROM t1 where b = 'ab'; -ERROR 42S02: Table 'test.t1' doesn't exist in engine +ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate. SELECT COUNT(1) FROM t1; -ERROR 42S02: Table 'test.t1' doesn't exist in engine +ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate. # Start server with keys2.txt # restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt diff --git a/mysql-test/suite/encryption/t/corrupted_during_recovery.test b/mysql-test/suite/encryption/t/corrupted_during_recovery.test index 78acb366d57..f838ea04c28 100644 --- a/mysql-test/suite/encryption/t/corrupted_during_recovery.test +++ b/mysql-test/suite/encryption/t/corrupted_during_recovery.test @@ -54,12 +54,12 @@ EOF SELECT * FROM t1; --disable_query_log call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[1].ibd looks corrupted; key_version="); -call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted. Please drop the table and recreate."); +call mtr.add_suppression("Table .*t1.* is corrupted. Please drop the table and recreate."); --enable_query_log let $restart_parameters=--innodb_force_recovery=1 --skip-innodb-buffer-pool-load-at-startup; --source include/restart_mysqld.inc ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT SELECT * FROM t1; SELECT * FROM t2; CHECK TABLE t2; diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change.test b/mysql-test/suite/encryption/t/innodb-bad-key-change.test index a9a32a3d6fc..942038dedc4 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change.test @@ -10,11 +10,11 @@ call mtr.add_suppression("Plugin 'file_key_management' init function returned error"); call mtr.add_suppression("Plugin 'file_key_management' registration.*failed"); -call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)"); +call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` has an unreadable root page"); +call mtr.add_suppression("Table .*t[12].* is corrupted"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1"); -call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` is corrupted"); call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found"); # for innodb_checksum_algorithm=full_crc32 only call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space="); @@ -75,32 +75,32 @@ INSERT INTO t2 VALUES ('foobar',1,2); --error ER_NO_SUCH_TABLE_IN_ENGINE SELECT * FROM t2; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT SELECT * FROM t2 where id = 1; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT SELECT * FROM t2 where b = 1; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT INSERT INTO t2 VALUES ('tmp',3,3); ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT DELETE FROM t2 where b = 3; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT DELETE FROM t2 where id = 3; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT UPDATE t2 set b = b +1; OPTIMIZE TABLE t2; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT ALTER TABLE t2 ADD COLUMN d INT; ANALYZE TABLE t2; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT TRUNCATE TABLE t2; DROP TABLE t2; diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change2.test b/mysql-test/suite/encryption/t/innodb-bad-key-change2.test index 19399b1e891..ad0f06ab5ff 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change2.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change2.test @@ -8,13 +8,13 @@ # MDEV-8768: Server crash at file btr0btr.ic line 122 when checking encrypted table using incorrect keys # MDEV-8727: Server/InnoDB hangs on shutdown after trying to read an encrypted table with a wrong key # -call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted|does not exist.*is trying to rename)"); +call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|does not exist.*is trying to rename)"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t1(new)?\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); # Suppression for builds where file_key_management plugin is linked statically call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); call mtr.add_suppression("InnoDB: Tablespace for table \`test\`.\`t1\` is set as discarded\\."); -call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted"); +call mtr.add_suppression("Table .*t1.* is corrupted"); call mtr.add_suppression("InnoDB: Cannot delete tablespace .* because it is not found in the tablespace memory cache"); call mtr.add_suppression("InnoDB: ALTER TABLE `test`\\.`t1` DISCARD TABLESPACE failed to find tablespace"); # for innodb_checksum_algorithm=full_crc32 only @@ -36,7 +36,7 @@ INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); SELECT * FROM t1; --replace_regex /key_id [1-9][0-9]*/\1 / SHOW WARNINGS; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT ALTER TABLE t1 ENGINE=InnoDB; --replace_regex /key_id [1-9][0-9]*/\1 / SHOW WARNINGS; @@ -97,7 +97,7 @@ SHOW CREATE TABLE t1; --error ER_ERROR_ON_RENAME RENAME TABLE t1 TO t1new; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT ALTER TABLE t1 RENAME TO t1new; -# Drop should pass even with incorrect keys +# Drop should succeed even with incorrect keys DROP TABLE t1; diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test index 58517f14978..bc060776ecd 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change4.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change4.test @@ -7,12 +7,12 @@ # MDEV-8768: Server crash at file btr0btr.ic line 122 when checking encrypted table using incorrect keys # -call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)"); +call mtr.add_suppression("InnoDB: Table `test`\\.`t1` has an unreadable root page"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t1\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); # Suppression for builds where file_key_management plugin is linked statically call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); -call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted"); +call mtr.add_suppression("Table .*t1.* is corrupted"); # for innodb_checksum_algorithm=full_crc32 only call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space="); diff --git a/mysql-test/suite/encryption/t/innodb-missing-key.test b/mysql-test/suite/encryption/t/innodb-missing-key.test index 0b81d37ac50..7935ea00efa 100644 --- a/mysql-test/suite/encryption/t/innodb-missing-key.test +++ b/mysql-test/suite/encryption/t/innodb-missing-key.test @@ -7,11 +7,11 @@ # MDEV-11004: Unable to start (Segfault or os error 2) when encryption key missing # -call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)"); +call mtr.add_suppression("InnoDB: Table `test`\\.`t1` has an unreadable root page"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1"); -call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted"); +call mtr.add_suppression("Table .*t1.* is corrupted"); --echo # Start server with keys2.txt -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt @@ -48,9 +48,9 @@ SELECT COUNT(1) FROM t3; SELECT COUNT(1) FROM t2; --error ER_NO_SUCH_TABLE_IN_ENGINE SELECT COUNT(1) FROM t2,t1 where t2.a = t1.a; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT SELECT COUNT(1) FROM t1 where b = 'ab'; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT SELECT COUNT(1) FROM t1; --echo diff --git a/mysql-test/suite/innodb/r/alter_kill.result b/mysql-test/suite/innodb/r/alter_kill.result index 8195d8e8ed1..5c2e154f6a2 100644 --- a/mysql-test/suite/innodb/r/alter_kill.result +++ b/mysql-test/suite/innodb/r/alter_kill.result @@ -17,7 +17,7 @@ disconnect con1; SELECT COUNT(*) FROM bug16720368; ERROR 42S02: Table 'test.bug16720368' doesn't exist in engine INSERT INTO bug16720368 VALUES(1); -ERROR 42S02: Table 'test.bug16720368' doesn't exist in engine +ERROR HY000: Table test/bug16720368 is corrupted. Please drop the table and recreate. INSERT INTO bug16720368_1 VALUES(1); # Shut down the server to uncorrupt the data. # restart diff --git a/mysql-test/suite/innodb/r/corrupted_during_recovery.result b/mysql-test/suite/innodb/r/corrupted_during_recovery.result index 951233ced3c..d67dc8a63d8 100644 --- a/mysql-test/suite/innodb/r/corrupted_during_recovery.result +++ b/mysql-test/suite/innodb/r/corrupted_during_recovery.result @@ -9,7 +9,7 @@ INSERT INTO t2 VALUES(1); SELECT * FROM t1; ERROR 42000: Unknown storage engine 'InnoDB' SELECT * FROM t1; -ERROR 42S02: Table 'test.t1' doesn't exist in engine +ERROR HY000: Table test/t1 is corrupted. Please drop the table and recreate. SELECT * FROM t2; a 1 diff --git a/mysql-test/suite/innodb/t/alter_kill.test b/mysql-test/suite/innodb/t/alter_kill.test index 2313d63db69..a90fa9e6e3e 100644 --- a/mysql-test/suite/innodb/t/alter_kill.test +++ b/mysql-test/suite/innodb/t/alter_kill.test @@ -19,7 +19,7 @@ call mtr.add_suppression("InnoDB: Set innodb_force_recovery=1 to ignore this and call mtr.add_suppression("InnoDB: Plugin initialization aborted*"); call mtr.add_suppression("Plugin 'InnoDB' init function returned error."); call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed."); -call mtr.add_suppression("InnoDB: Table `test`\\.`bug16720368` is corrupted"); +call mtr.add_suppression("Table .*bug16720368.* is corrupted"); -- enable_query_log -- echo # @@ -79,7 +79,7 @@ EOF --error ER_NO_SUCH_TABLE_IN_ENGINE SELECT COUNT(*) FROM bug16720368; ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT INSERT INTO bug16720368 VALUES(1); INSERT INTO bug16720368_1 VALUES(1); diff --git a/mysql-test/suite/innodb/t/corrupted_during_recovery.test b/mysql-test/suite/innodb/t/corrupted_during_recovery.test index 31fd1f18b8a..4893a638dda 100644 --- a/mysql-test/suite/innodb/t/corrupted_during_recovery.test +++ b/mysql-test/suite/innodb/t/corrupted_during_recovery.test @@ -7,7 +7,7 @@ call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE faile call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed read of file '.*test.t1\\.ibd' page"); call mtr.add_suppression("InnoDB: Failed to read page 3 from file '.*test.t1\\.ibd': Page read from tablespace is corrupted."); call mtr.add_suppression("InnoDB: Background Page read failed to read or decrypt \\[page id: space=\\d+, page number=3\\]"); -call mtr.add_suppression("InnoDB: Table `test`.`t1` is corrupted. Please drop the table and recreate."); +call mtr.add_suppression("Table .*t1.* is corrupted. Please drop the table and recreate."); --enable_query_log let INNODB_PAGE_SIZE=`select @@innodb_page_size`; @@ -57,7 +57,7 @@ SELECT * FROM t1; let $restart_parameters=--innodb_force_recovery=1; --source include/restart_mysqld.inc ---error ER_NO_SUCH_TABLE_IN_ENGINE +--error ER_TABLE_CORRUPT SELECT * FROM t1; SELECT * FROM t2; CHECK TABLE t2; diff --git a/mysql-test/suite/plugins/r/compression,innodb-lz4.rdiff b/mysql-test/suite/plugins/r/compression,innodb-lz4.rdiff index 490a5113560..06fdb0bd4f0 100644 --- a/mysql-test/suite/plugins/r/compression,innodb-lz4.rdiff +++ b/mysql-test/suite/plugins/r/compression,innodb-lz4.rdiff @@ -1,6 +1,6 @@ --- suite/plugins/r/compression.result +++ suite/plugins/r/compression.reject -@@ -1,9 +1,9 @@ +@@ -1,8 +1,8 @@ # -# Testing bzip2 compression provider with innodb +# Testing lz4 compression provider with innodb @@ -10,14 +10,15 @@ +set global innodb_compression_algorithm = lz4; call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt"); call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed"); - call mtr.add_suppression("InnoDB: Table `test`.`t1` is compressed with (\\w+) \\(\\d\\), which is not currently loaded. Please load the '\\1' provider plugin to open the table."); - create table t1 (a int, b text ) engine = innodb page_compressed = 1; -@@ -14,7 +14,7 @@ + call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table"); +@@ -15,8 +15,8 @@ 0 abcabcabc 300 1 defdefdef 3000 2 ghighighi 30000 -# restart: --disable-provider-bzip2 +# restart: --disable-provider-lz4 select a, left(b, 9), length(b) from t1; - ERROR 42S02: Table 'test.t1' doesn't exist in engine +-ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table ++ERROR HY000: Table test/t1 is compressed with lz4, which is not currently loaded. Please load the lz4 provider plugin to open the table drop table t1; + # restart diff --git a/mysql-test/suite/plugins/r/compression,innodb-lzma.rdiff b/mysql-test/suite/plugins/r/compression,innodb-lzma.rdiff index 9a6a9cff5a9..ee348934a54 100644 --- a/mysql-test/suite/plugins/r/compression,innodb-lzma.rdiff +++ b/mysql-test/suite/plugins/r/compression,innodb-lzma.rdiff @@ -1,6 +1,6 @@ --- suite/plugins/r/compression.result +++ suite/plugins/r/compression.reject -@@ -1,9 +1,9 @@ +@@ -1,8 +1,8 @@ # -# Testing bzip2 compression provider with innodb +# Testing lzma compression provider with innodb @@ -10,14 +10,15 @@ +set global innodb_compression_algorithm = lzma; call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt"); call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed"); - call mtr.add_suppression("InnoDB: Table `test`.`t1` is compressed with (\\w+) \\(\\d\\), which is not currently loaded. Please load the '\\1' provider plugin to open the table."); - create table t1 (a int, b text ) engine = innodb page_compressed = 1; -@@ -14,7 +14,7 @@ + call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table"); +@@ -15,8 +15,8 @@ 0 abcabcabc 300 1 defdefdef 3000 2 ghighighi 30000 -# restart: --disable-provider-bzip2 +# restart: --disable-provider-lzma select a, left(b, 9), length(b) from t1; - ERROR 42S02: Table 'test.t1' doesn't exist in engine +-ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table ++ERROR HY000: Table test/t1 is compressed with lzma, which is not currently loaded. Please load the lzma provider plugin to open the table drop table t1; + # restart diff --git a/mysql-test/suite/plugins/r/compression,innodb-lzo.rdiff b/mysql-test/suite/plugins/r/compression,innodb-lzo.rdiff index e1ee08d1a3b..d7cdc41092a 100644 --- a/mysql-test/suite/plugins/r/compression,innodb-lzo.rdiff +++ b/mysql-test/suite/plugins/r/compression,innodb-lzo.rdiff @@ -1,6 +1,6 @@ --- suite/plugins/r/compression.result +++ suite/plugins/r/compression.reject -@@ -1,9 +1,9 @@ +@@ -1,8 +1,8 @@ # -# Testing bzip2 compression provider with innodb +# Testing lzo compression provider with innodb @@ -10,14 +10,15 @@ +set global innodb_compression_algorithm = lzo; call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt"); call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed"); - call mtr.add_suppression("InnoDB: Table `test`.`t1` is compressed with (\\w+) \\(\\d\\), which is not currently loaded. Please load the '\\1' provider plugin to open the table."); - create table t1 (a int, b text ) engine = innodb page_compressed = 1; -@@ -14,7 +14,7 @@ + call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table"); +@@ -15,8 +15,8 @@ 0 abcabcabc 300 1 defdefdef 3000 2 ghighighi 30000 -# restart: --disable-provider-bzip2 +# restart: --disable-provider-lzo select a, left(b, 9), length(b) from t1; - ERROR 42S02: Table 'test.t1' doesn't exist in engine +-ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table ++ERROR HY000: Table test/t1 is compressed with lzo, which is not currently loaded. Please load the lzo provider plugin to open the table drop table t1; + # restart diff --git a/mysql-test/suite/plugins/r/compression,innodb-snappy.rdiff b/mysql-test/suite/plugins/r/compression,innodb-snappy.rdiff index 8965b2118a2..e9c7485d118 100644 --- a/mysql-test/suite/plugins/r/compression,innodb-snappy.rdiff +++ b/mysql-test/suite/plugins/r/compression,innodb-snappy.rdiff @@ -1,6 +1,6 @@ --- suite/plugins/r/compression.result +++ suite/plugins/r/compression.reject -@@ -1,9 +1,9 @@ +@@ -1,8 +1,8 @@ # -# Testing bzip2 compression provider with innodb +# Testing snappy compression provider with innodb @@ -10,14 +10,15 @@ +set global innodb_compression_algorithm = snappy; call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt"); call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed"); - call mtr.add_suppression("InnoDB: Table `test`.`t1` is compressed with (\\w+) \\(\\d\\), which is not currently loaded. Please load the '\\1' provider plugin to open the table."); - create table t1 (a int, b text ) engine = innodb page_compressed = 1; -@@ -14,7 +14,7 @@ + call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table"); +@@ -15,8 +15,8 @@ 0 abcabcabc 300 1 defdefdef 3000 2 ghighighi 30000 -# restart: --disable-provider-bzip2 +# restart: --disable-provider-snappy select a, left(b, 9), length(b) from t1; - ERROR 42S02: Table 'test.t1' doesn't exist in engine +-ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table ++ERROR HY000: Table test/t1 is compressed with snappy, which is not currently loaded. Please load the snappy provider plugin to open the table drop table t1; + # restart diff --git a/mysql-test/suite/plugins/r/compression,mroonga-lz4.rdiff b/mysql-test/suite/plugins/r/compression,mroonga-lz4.rdiff index 8f578cd0871..9b155ff3a1d 100644 --- a/mysql-test/suite/plugins/r/compression,mroonga-lz4.rdiff +++ b/mysql-test/suite/plugins/r/compression,mroonga-lz4.rdiff @@ -9,7 +9,7 @@ -set global innodb_compression_algorithm = bzip2; -call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt"); -call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed"); --call mtr.add_suppression("InnoDB: Table `test`.`t1` is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table"); +-call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table"); -create table t1 (a int, b text ) engine = innodb page_compressed = 1; +create table t1 (a int, b text COMMENT 'FLAGS "COLUMN_SCALAR|COMPRESS_LZ4"') engine = mroonga charset = utf8; insert t1 (a, b) values (0, repeat("abc", 100)); @@ -22,7 +22,7 @@ -# restart: --disable-provider-bzip2 +# restart: --disable-provider-lz4 select a, left(b, 9), length(b) from t1; --ERROR 42S02: Table 'test.t1' doesn't exist in engine +-ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table +a left(b, 9) length(b) +0 0 +1 0 diff --git a/mysql-test/suite/plugins/r/compression.result b/mysql-test/suite/plugins/r/compression.result index 63c2a11a0d4..dd267f282c5 100644 --- a/mysql-test/suite/plugins/r/compression.result +++ b/mysql-test/suite/plugins/r/compression.result @@ -5,7 +5,7 @@ call mtr.add_suppression("MariaDB tried to use the .+ compression, but its provi set global innodb_compression_algorithm = bzip2; call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt"); call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed"); -call mtr.add_suppression("InnoDB: Table `test`.`t1` is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table"); +call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table"); create table t1 (a int, b text ) engine = innodb page_compressed = 1; insert t1 (a, b) values (0, repeat("abc", 100)); insert t1 (a, b) values (1, repeat("def", 1000)); @@ -17,6 +17,6 @@ a left(b, 9) length(b) 2 ghighighi 30000 # restart: --disable-provider-bzip2 select a, left(b, 9), length(b) from t1; -ERROR 42S02: Table 'test.t1' doesn't exist in engine +ERROR HY000: Table test/t1 is compressed with bzip2, which is not currently loaded. Please load the bzip2 provider plugin to open the table drop table t1; # restart diff --git a/mysql-test/suite/plugins/t/compression.test b/mysql-test/suite/plugins/t/compression.test index e55daa86d34..c97c5725e1d 100644 --- a/mysql-test/suite/plugins/t/compression.test +++ b/mysql-test/suite/plugins/t/compression.test @@ -21,7 +21,7 @@ if ($engine == "innodb") { let $table_params = page_compressed = 1; call mtr.add_suppression("Background Page read failed to read, uncompress, or decrypt"); call mtr.add_suppression("Table is compressed or encrypted but uncompress or decrypt failed"); - call mtr.add_suppression("InnoDB: Table `test`.`t1` is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table"); + call mtr.add_suppression("Table .*t1.* is compressed with (\\w+), which is not currently loaded. Please load the \\1 provider plugin to open the table"); } if ($engine == "mroonga") { let $column_params = `select upper('COMMENT \'flags "COLUMN_SCALAR|COMPRESS_$alg"\'')`; @@ -39,7 +39,7 @@ let $restart_parameters = --disable-provider-$alg; source include/restart_mysqld.inc; if ($engine == "innodb") { - error ER_NO_SUCH_TABLE_IN_ENGINE; + error ER_PROVIDER_NOT_LOADED; select a, left(b, 9), length(b) from t1; } if ($engine == "mroonga"){ diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index b87fdc55aa1..a990a518d5b 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -1041,14 +1041,15 @@ dict_table_open_on_name( { ulint algo = table->space->get_compression_algo(); if (algo <= PAGE_ALGORITHM_LAST && !fil_comp_algo_loaded(algo)) { - ib::error() << "Table " << table->name << " is compressed with " - << page_compression_algorithms[algo] - << ", which is not currently loaded. Please load the " - << page_compression_algorithms[algo] - << " provider plugin to open the table"; + my_printf_error(ER_PROVIDER_NOT_LOADED, + "Table %s is compressed with %s, which is not currently loaded. " + "Please load the %s provider plugin to open the table", + MYF(ME_ERROR_LOG), table->name, + page_compression_algorithms[algo], page_compression_algorithms[algo]); } else { - ib::error() << "Table " << table->name - << " is corrupted. Please drop the table and recreate."; + my_printf_error(ER_TABLE_CORRUPT, + "Table %s is corrupted. Please drop the table and recreate.", + MYF(ME_ERROR_LOG), table->name); } dict_sys.unfreeze(); DBUG_RETURN(nullptr); -- cgit v1.2.1