[MDEV-33128] WITHOUT VALIDATION allows to insert duplicate values into unique key without a way to repair Created: 2023-12-27 Updated: 2024-01-04 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | Partitioning |
| Affects Version/s: | 11.4 |
| Fix Version/s: | 11.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Alexey Botchkov |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
EXCHANGE/CONVERT ... WITHOUT VALIDATION are supposed to bypass the check that each row belongs to the partition in question. However as a side-effect it also allows to bypass unique constraints, and it seems there is no good way to repair it. REPAIR TABLE, REPAIR PARTITION, REBUILD PARTITION don't help. REPAIR TABLE upon the failed attempt points at the duplicate key value suggesting to handle it manually, but since it only shows one violation at a time and there can be thousands or millions such records after unfortunate alter without validation, it is not really a feasible way to recover. Dump/reload which CHECK suggests also doesn't work as it simply tries to re-insert duplicate records into the table. Note: REBUILD PARTITION fails with different errors on a release build and with an assertion failure on debug builds (similar to MDEV-20498), which is why it is commented in the test case below.
MySQL 8.2 doesn't look any better, except for maybe the assertion failure. |
| Comments |
| Comment by Elena Stepanova [ 2023-12-27 ] | |||||||||||||||||||||||||
|
I didn't make it a "blocker" for | |||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-12-27 ] | |||||||||||||||||||||||||
|
sure, there is a way to repair the table. something like
but let's say REPAIR TABLE should be able to repair the table too | |||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2023-12-27 ] | |||||||||||||||||||||||||
Sure, when I said "no way to repair", I meant a meaningful way with a predictable result and preferably with minimal data loss. Otherwise there are other ways – one can truncate the table, or drop the newly added partition, etc. | |||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2024-01-04 ] | |||||||||||||||||||||||||
|
It seems there is a more or less universal (although not immediately obvious) way to fix a variety of problems with such tables, including the one describe in this ticket: ALTER IGNORE TABLE ... FORCE, ALGORITHM=COPY.
|