Commit fe2e034
committed
MDEV-40388: sequence.simple fails on replay
When the recording is enabled for the query,
explain select * from seq_15_to_1_step_12345;
it recorded the table context having a DDL definition as: -
CREATE TABLE `seq_15_to_1_step_12345` (
-> `seq` bigint(20) unsigned NOT NULL,
-> PRIMARY KEY (`seq`)
-> ) ENGINE=SEQUENCE DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci;
Now, when that context is replayed, the DDL statement is executed.
But, we cannot create such the table and instead it errors out saying
ERROR 1050 (42S01): Table 'seq_15_to_1_step_12345' already exists.
The problem is that,
sequence table was determined using tbl->table->s->sequence. The
intention was to not record sequence table information. However, the
check was only partially correct.
Instead, we could compare using the engine name like
if (!tbl->is_view() && tbl->table)
{
handlerton *hton= tbl->table->file->partition_ht();
const LEX_CSTRING *engine_name= hton_name(hton);
if (strcmp(engine_name->str, "SEQUENCE") == 0 ||
strcmp(engine_name->str, "SQL_SEQUENCE") == 0)
continue;
}
This makes both the following kinds of queries on sequences, to not
record any table contexts on them: -
1. explain select * from seq_15_to_1_step_12345;
2. create sequence s1;
EXPLAIN select * from s1;1 parent feb3817 commit fe2e034
3 files changed
Lines changed: 41 additions & 2 deletions
File tree
- mysql-test/main
- sql
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
591 | 591 | | |
592 | 592 | | |
593 | 593 | | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
432 | 432 | | |
433 | 433 | | |
434 | 434 | | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
746 | 746 | | |
747 | 747 | | |
748 | 748 | | |
749 | | - | |
750 | | - | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
751 | 759 | | |
752 | 760 | | |
753 | 761 | | |
| |||
0 commit comments