[MDEV-31058] ER_KEY_NOT_FOUND upon concurrent CHANGE column to autoinc and DML Created: 2023-04-15 Updated: 2023-08-16 Resolved: 2023-08-16 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table |
| Affects Version/s: | N/A |
| Fix Version/s: | 11.2.1 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Nikita Malyavin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||
| Description |
|
Notes:
|
| Comments |
| Comment by Nikita Malyavin [ 2023-04-17 ] | |||||||||||||||||
|
ER_KEY_NOT_FOUND seems to become a generic marker for ONLINE ALTER TABLE.
The autoinc value was silently applied under disabled NO_AUTO_VALUE_ON_ZERO mode. | |||||||||||||||||
| Comment by Nikita Malyavin [ 2023-04-18 ] | |||||||||||||||||
|
here's the deterministic test:
| |||||||||||||||||
| Comment by Sergei Golubchik [ 2023-04-30 ] | |||||||||||||||||
|
let's try to disable ONLINE if AUTO_INC if forced on an existing column | |||||||||||||||||
| Comment by Nikita Malyavin [ 2023-04-30 ] | |||||||||||||||||
|
serg I already wrote an algorithm that covers a good subset. I think I'd really like to avoid mentioning that something with AUTO_INC doesn't work in the article | |||||||||||||||||
| Comment by Sergei Golubchik [ 2023-05-01 ] | |||||||||||||||||
|
You cannot disable NO_AUTO_VALUE_ON_ZERO, non-blocking alter must produce the same result as blocking. Technically, you can do online when AUTO_INC is added if the old table had a PK and this PK isn't changed in the ALTER TABLE. But I think it's a very corner use case, normally AUTO_INC is PK. | |||||||||||||||||
| Comment by Nikita Malyavin [ 2023-05-03 ] | |||||||||||||||||
|
serg Please review commits 11cc554...88a2ec | |||||||||||||||||
| Comment by Sergei Golubchik [ 2023-05-03 ] | |||||||||||||||||
|
consider this example
it prints
I don't understand how it could be even possible to do the above online. | |||||||||||||||||
| Comment by Nikita Malyavin [ 2023-05-13 ] | |||||||||||||||||
|
Right, if we stick to taking effect after the changes applied, then this method won't work | |||||||||||||||||
| Comment by Sergei Golubchik [ 2023-05-24 ] | |||||||||||||||||
|
But of course. A user does SELECT — sees the old table structure. Performs UPDATE, commits, runs SELECT again — sees the old table structure, with the updated content. There's no other way to interpret it, the UPDATE was applied to the old table structure, before the ALTER. | |||||||||||||||||
| Comment by Sergei Golubchik [ 2023-06-24 ] | |||||||||||||||||
|
db2d411bc is obsolete, it seems, because d23555b19206 ( I've already commented on d23555b19206, so there's no need to review db2d411bc anymore. | |||||||||||||||||
| Comment by Nikita Malyavin [ 2023-06-25 ] | |||||||||||||||||
|
Well, yes, it can be done so, almost. Thanks. the commit could be useful to understand the intentions at first place, but I can squash it |