2016-03-25 17:51:22 +01:00
|
|
|
connect con1,localhost,root,,;
|
|
|
|
connect con2,localhost,root,,;
|
|
|
|
connection con1;
|
2007-05-27 22:20:01 +02:00
|
|
|
drop table if exists t1,t2;
|
|
|
|
drop view if exists v1;
|
2001-09-28 07:05:54 +02:00
|
|
|
create table t1(n int not null, key(n), key(n), key(n), key(n));
|
2013-09-20 21:30:19 +02:00
|
|
|
Warnings:
|
2016-12-29 13:23:18 +01:00
|
|
|
Note 1831 Duplicate index `n_2`. This is deprecated and will be disallowed in a future release
|
|
|
|
Note 1831 Duplicate index `n_3`. This is deprecated and will be disallowed in a future release
|
|
|
|
Note 1831 Duplicate index `n_4`. This is deprecated and will be disallowed in a future release
|
2006-10-03 15:33:44 +02:00
|
|
|
check table t1 extended;
|
2016-03-25 17:51:22 +01:00
|
|
|
connection con2;
|
2001-09-28 07:05:54 +02:00
|
|
|
insert into t1 values (200000);
|
2016-03-25 17:51:22 +01:00
|
|
|
connection con1;
|
2001-06-12 04:26:24 +02:00
|
|
|
Table Op Msg_type Msg_text
|
|
|
|
test.t1 check status OK
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
|
|
|
disconnect con1;
|
|
|
|
disconnect con2;
|
2001-09-28 07:05:54 +02:00
|
|
|
drop table t1;
|
2005-05-07 14:17:54 +02:00
|
|
|
Create table t1(f1 int);
|
|
|
|
Create table t2(f1 int);
|
|
|
|
Create view v1 as Select * from t1;
|
|
|
|
Check Table v1,t2;
|
|
|
|
Table Op Msg_type Msg_text
|
|
|
|
test.v1 check status OK
|
|
|
|
test.t2 check status OK
|
|
|
|
drop view v1;
|
|
|
|
drop table t1, t2;
|
2007-07-19 10:51:31 +02:00
|
|
|
CREATE TEMPORARY TABLE t1(a INT);
|
|
|
|
CHECK TABLE t1;
|
|
|
|
Table Op Msg_type Msg_text
|
|
|
|
test.t1 check status OK
|
|
|
|
REPAIR TABLE t1;
|
|
|
|
Table Op Msg_type Msg_text
|
|
|
|
test.t1 repair status OK
|
|
|
|
DROP TABLE t1;
|
Bug #56494 Segfault in upgrade_shared_lock_to_exclusive() for
REPAIR of merge table
Bug #56422 CHECK TABLE run when the table is locked reports
corruption along with timeout
The crash happened if a table maintenance statement (ANALYZE TABLE,
REPAIR TABLE, etc.) was executed on a MERGE table and opening and
locking a child table failed. This could for example happen if a child
table did not exist or if a lock timeout happened while waiting for
a conflicting metadata lock to disappear.
Since opening and locking the MERGE table and its children failed,
the tables would be closed and the metadata locks released.
However, TABLE_LIST::table for the MERGE table would still be set,
with its value invalid since the tables had been closed.
This caused the table maintenance statement to try to continue
and upgrade the metadata lock on the MERGE table. But since the lock
already had been released, this caused a segfault.
This patch fixes the problem by setting TABLE_LIST::table to NULL
if open_and_lock_tables() fails. This prevents maintenance
statements from continuing and trying to upgrade the metadata lock.
The patch includes a 5.5 version of the fix for
Bug #46339 crash on REPAIR TABLE merge table USE_FRM.
This bug caused REPAIR TABLE ... USE_FRM to give an assert
when used on merge tables.
The patch also enables the CHECK TABLE statement for log tables.
Before, CHECK TABLE for log tables gave ER_CANT_LOCK_LOG_TABLE,
yet still counted the statement as successfully executed.
With the changes to table maintenance statement error handling
in this patch, CHECK TABLE would no longer be considered as
successful in this case. This would have caused upgrade scripts
to mistakenly think that the general and slow logs are corrupted
and have to be repaired. Enabling CHECK TABLES for log tables
prevents this from happening.
Finally, the patch changes the error message from "Corrupt" to
"Operation failed" for a number of issues not related to table
corruption. For example "Lock wait timeout exceeded" and
"Deadlock found trying to get lock".
Test cases added to merge.test and check.test.
2010-09-22 10:15:41 +02:00
|
|
|
#
|
|
|
|
# Bug#56422 CHECK TABLE run when the table is locked reports corruption
|
|
|
|
# along with timeout
|
|
|
|
#
|
|
|
|
DROP TABLE IF EXISTS t1;
|
|
|
|
CREATE TABLE t1(a INT);
|
|
|
|
LOCK TABLE t1 WRITE;
|
2016-03-25 17:51:22 +01:00
|
|
|
connect con1, localhost, root;
|
Bug #56494 Segfault in upgrade_shared_lock_to_exclusive() for
REPAIR of merge table
Bug #56422 CHECK TABLE run when the table is locked reports
corruption along with timeout
The crash happened if a table maintenance statement (ANALYZE TABLE,
REPAIR TABLE, etc.) was executed on a MERGE table and opening and
locking a child table failed. This could for example happen if a child
table did not exist or if a lock timeout happened while waiting for
a conflicting metadata lock to disappear.
Since opening and locking the MERGE table and its children failed,
the tables would be closed and the metadata locks released.
However, TABLE_LIST::table for the MERGE table would still be set,
with its value invalid since the tables had been closed.
This caused the table maintenance statement to try to continue
and upgrade the metadata lock on the MERGE table. But since the lock
already had been released, this caused a segfault.
This patch fixes the problem by setting TABLE_LIST::table to NULL
if open_and_lock_tables() fails. This prevents maintenance
statements from continuing and trying to upgrade the metadata lock.
The patch includes a 5.5 version of the fix for
Bug #46339 crash on REPAIR TABLE merge table USE_FRM.
This bug caused REPAIR TABLE ... USE_FRM to give an assert
when used on merge tables.
The patch also enables the CHECK TABLE statement for log tables.
Before, CHECK TABLE for log tables gave ER_CANT_LOCK_LOG_TABLE,
yet still counted the statement as successfully executed.
With the changes to table maintenance statement error handling
in this patch, CHECK TABLE would no longer be considered as
successful in this case. This would have caused upgrade scripts
to mistakenly think that the general and slow logs are corrupted
and have to be repaired. Enabling CHECK TABLES for log tables
prevents this from happening.
Finally, the patch changes the error message from "Corrupt" to
"Operation failed" for a number of issues not related to table
corruption. For example "Lock wait timeout exceeded" and
"Deadlock found trying to get lock".
Test cases added to merge.test and check.test.
2010-09-22 10:15:41 +02:00
|
|
|
SET lock_wait_timeout= 1;
|
|
|
|
CHECK TABLE t1;
|
|
|
|
Table Op Msg_type Msg_text
|
|
|
|
test.t1 check Error Lock wait timeout exceeded; try restarting transaction
|
|
|
|
test.t1 check status Operation failed
|
2016-03-25 17:51:22 +01:00
|
|
|
connection default;
|
Bug #56494 Segfault in upgrade_shared_lock_to_exclusive() for
REPAIR of merge table
Bug #56422 CHECK TABLE run when the table is locked reports
corruption along with timeout
The crash happened if a table maintenance statement (ANALYZE TABLE,
REPAIR TABLE, etc.) was executed on a MERGE table and opening and
locking a child table failed. This could for example happen if a child
table did not exist or if a lock timeout happened while waiting for
a conflicting metadata lock to disappear.
Since opening and locking the MERGE table and its children failed,
the tables would be closed and the metadata locks released.
However, TABLE_LIST::table for the MERGE table would still be set,
with its value invalid since the tables had been closed.
This caused the table maintenance statement to try to continue
and upgrade the metadata lock on the MERGE table. But since the lock
already had been released, this caused a segfault.
This patch fixes the problem by setting TABLE_LIST::table to NULL
if open_and_lock_tables() fails. This prevents maintenance
statements from continuing and trying to upgrade the metadata lock.
The patch includes a 5.5 version of the fix for
Bug #46339 crash on REPAIR TABLE merge table USE_FRM.
This bug caused REPAIR TABLE ... USE_FRM to give an assert
when used on merge tables.
The patch also enables the CHECK TABLE statement for log tables.
Before, CHECK TABLE for log tables gave ER_CANT_LOCK_LOG_TABLE,
yet still counted the statement as successfully executed.
With the changes to table maintenance statement error handling
in this patch, CHECK TABLE would no longer be considered as
successful in this case. This would have caused upgrade scripts
to mistakenly think that the general and slow logs are corrupted
and have to be repaired. Enabling CHECK TABLES for log tables
prevents this from happening.
Finally, the patch changes the error message from "Corrupt" to
"Operation failed" for a number of issues not related to table
corruption. For example "Lock wait timeout exceeded" and
"Deadlock found trying to get lock".
Test cases added to merge.test and check.test.
2010-09-22 10:15:41 +02:00
|
|
|
UNLOCK TABLES;
|
|
|
|
DROP TABLE t1;
|
2016-03-25 17:51:22 +01:00
|
|
|
disconnect con1;
|
2018-05-22 23:19:15 +02:00
|
|
|
#
|
|
|
|
# MDEV-15338
|
|
|
|
# Assertion `!table || (!table->read_set ||
|
|
|
|
# bitmap_is_set(table->read_set, field_index))'
|
|
|
|
# failed on dropping column with CHECK
|
|
|
|
#
|
|
|
|
CREATE TABLE t1 (a INT, b INT, CHECK (a>0)) ENGINE=MyISAM;
|
|
|
|
INSERT INTO t1 VALUES (1,2),(3,4);
|
|
|
|
ALTER TABLE t1 DROP COLUMN a;
|
|
|
|
CREATE OR REPLACE TABLE t1 (a INT, b INT, CHECK (a>0)) ENGINE=MyISAM;
|
|
|
|
ALTER TABLE t1 DROP COLUMN b;
|
|
|
|
CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM;
|
|
|
|
ALTER TABLE t1 DROP COLUMN b;
|
|
|
|
ERROR 42S22: Unknown column 'b' in 'CHECK'
|
|
|
|
ALTER TABLE t1 DROP COLUMN a, DROP COLUMN b;
|
|
|
|
CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM;
|
|
|
|
ALTER TABLE t1 DROP CONSTRAINT `CONSTRAINT_1`;
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE `t1` (
|
|
|
|
`a` int(11) DEFAULT NULL,
|
|
|
|
`b` int(11) DEFAULT NULL,
|
|
|
|
`c` int(11) DEFAULT NULL
|
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
|
|
CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM;
|
|
|
|
ALTER TABLE t1 DROP COLUMN b, DROP CONSTRAINT `CONSTRAINT_1`;
|
|
|
|
SHOW CREATE TABLE t1;
|
|
|
|
Table Create Table
|
|
|
|
t1 CREATE TABLE `t1` (
|
|
|
|
`a` int(11) DEFAULT NULL,
|
|
|
|
`c` int(11) DEFAULT NULL
|
|
|
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
|
|
|
DROP TABLE t1;
|
2018-12-14 14:28:30 +01:00
|
|
|
create temporary table t1 (
|
|
|
|
id int not null auto_increment primary key,
|
|
|
|
f int not null default 0
|
|
|
|
);
|
|
|
|
insert into t1 () values ();
|
|
|
|
alter ignore table t1 add constraint check (f > 0);
|
|
|
|
Warnings:
|
|
|
|
Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
|
|
|
|
alter table t1;
|
|
|
|
drop table t1;
|