mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-36487 Fix ha_innobase::check() for sequences
InnoDB does the following check for sequence table during check table command: - There should be only one index should exist on sequence table - There should be only one row should exist on sequence table - The leaf page must be the root page for the sequence table - Delete marked record should not exist - DB_TRX_ID and DB_ROLL_PTR of the record should be 0 and 1U << 55
This commit is contained in:
@ -120,12 +120,16 @@ drop sequence s;
|
||||
#
|
||||
CREATE SEQUENCE s engine=innodb;
|
||||
ALTER TABLE s sequence=0;
|
||||
connect prevent_purge,localhost,root;
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
connection default;
|
||||
delete from s;
|
||||
FLUSH TABLES;
|
||||
CHECK TABLE s;
|
||||
Table Op Msg_type Msg_text
|
||||
test.s check Error Fewer than one row in the table
|
||||
test.s check Warning InnoDB: Encountered delete marked record in sequence table test/s.
|
||||
test.s check error Corrupt
|
||||
disconnect prevent_purge;
|
||||
DROP SEQUENCE s;
|
||||
CREATE SEQUENCE s engine=innodb;
|
||||
CHECK TABLE s;
|
||||
@ -138,6 +142,6 @@ insert into s values (2,1,9223372036854775806,1,1,1000,0,0);
|
||||
FLUSH TABLES;
|
||||
CHECK TABLE s;
|
||||
Table Op Msg_type Msg_text
|
||||
test.s check Warning More than one row in the table
|
||||
test.s check status OK
|
||||
test.s check Warning InnoDB: Should have only one record in sequence table test/s. But it has 2 records.
|
||||
test.s check error Corrupt
|
||||
DROP SEQUENCE s;
|
||||
|
@ -147,11 +147,16 @@ let $datadir=`select @@datadir`;
|
||||
CREATE SEQUENCE s engine=innodb;
|
||||
copy_file $datadir/test/s.frm $datadir/test/s1.frm;
|
||||
ALTER TABLE s sequence=0;
|
||||
--connect (prevent_purge,localhost,root)
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
|
||||
--connection default
|
||||
delete from s;
|
||||
FLUSH TABLES;
|
||||
remove_file $datadir/test/s.frm;
|
||||
move_file $datadir/test/s1.frm $datadir/test/s.frm;
|
||||
CHECK TABLE s;
|
||||
--disconnect prevent_purge
|
||||
DROP SEQUENCE s;
|
||||
|
||||
# Just one row, check ok
|
||||
|
Reference in New Issue
Block a user