[MDEV-15352] AUTO_INCREMENT breaks after updating a column value to a negative number Created: 2018-02-19 Updated: 2020-08-25 Resolved: 2018-06-14 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, Storage Engine - XtraDB |
| Affects Version/s: | 10.2.12, 10.3.3 |
| Fix Version/s: | 10.2.16, 10.3.8 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Christoph Biardzki | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | regression | ||
| Environment: |
SLES 12 |
||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
Using MariaDB 10.2.12, there is a change in behaviour compared to, e.g. 10.1.22 when changing a value of an AUTO_INCREMENT-column to a negative value: the AUTO_INCREMENT increases to the maximum possible number and subsequent inserts fail. In 10.1.22, the same sequence succeeds.
ERROR 1467 (HY000): Failed to read auto-increment value from storage engine
|
| Comments |
| Comment by Elena Stepanova [ 2018-02-19 ] | ||||||||||||||||||||||||||||||
|
Thanks for the report. The behavior changed in 10.2.12, somewhere between 15219eb08a28261aa730c301583f1c47a92790b8 (OK) and 9c28fd7a3337a4d6773f3b53e70af9a3b0dbb919 (fails). | ||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-05-30 ] | ||||||||||||||||||||||||||||||
|
In the revision range reported by elenst, the only relevant change to ha_innodb.cc appears to be | ||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-05-30 ] | ||||||||||||||||||||||||||||||
|
bar, you implemented | ||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2018-06-14 ] | ||||||||||||||||||||||||||||||
|
The same problem is repeatable with all integer types:
| ||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2018-06-14 ] | ||||||||||||||||||||||||||||||
|
Note, this script:
returns:
for:
The problem with 10.2+InnoDB was introduced by this commit:
by this chunk:
This code expects val_uint() to return 0 for negative signed values, while in fact val_uint() reinterprets negative signed values to huge positive unsigned values for integer Field_xxx types (truncation only works in Field_real). During a discussion, marko and bar came to a conclusion that val_uint() should be fixed to cut negative values to 0 for all data types, like it is done in Field_real. |