1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +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:
Thirunarayanan Balathandayuthapani
2025-06-06 18:42:30 +05:30
parent 37274ae01f
commit 6a2afb42ba
6 changed files with 395 additions and 3 deletions

View File

@ -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;