[MDEV-18244] Server crashes in ha_innobase::update_thd / ... / ha_partition::update_next_auto_inc_val Created: 2019-01-15 Updated: 2021-04-19 Resolved: 2019-11-01 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Partitioning, Storage Engine - InnoDB |
| Affects Version/s: | 10.3.5, 10.4.0 |
| Fix Version/s: | 10.3.19, 10.4.9 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Elena Stepanova | Assignee: | Alexey Botchkov |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | crash, regression | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Description |
|
All of debug, non-debug and ASAN builds crash with SIGSEGV. Not reproducible on 10.2. |
| Comments |
| Comment by Marko Mäkelä [ 2019-01-18 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The problem is that ha_partition::open_read_partitions() is not opening all partitions that the UPDATE statement is accessing. I found this out by setting a breakpoint on ha_innobase::open() and noticing that the this pointer that is passed to ha_innobase::update_thd() did not occur previously. After the ALTER TABLE, only the first partition is being accessed. On the first look, the UPDATE should only access the first partition, but in reality it is accessing all partitions, because the auto-increment counter is being updated on all partitions. Apparently I verified that the crash was introduced by this change that implements MDEV-11084 . There was no crash with the parent commit. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2019-07-04 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Test case from
With MYISAM it results in a wrong values in the auto_incremented column:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alice Sherepa [ 2019-10-02 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
holyfoot, please check also test case from
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexey Botchkov [ 2019-10-21 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
https://github.com/MariaDB/server/commit/7a331ec820be89f8c2d0fd968bd4b003cbbf75fc | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Williams [ 2019-10-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I noticed a related bug, but it may be the same root cause. We have some tables with old datetime columns, not yet updated to new temporal storage type. After doing a partition drop/add, the dates and times in the other partitions become corrupted. The dates look like nonsense afterward, and updating rows in the table will cause additional corruption in other columns. My theory is that the ALTER statement for DROP/ADD causes it to "upgrade" the datetime columns to the new temporal type, or at least mark them as updated, but it doesn't actually go into the other partitions to update the data on disk. When it goes back to read or modify the data, it reads the old datetime value and tries to interpret as if it was the new type. In my tests, upgrading to new temporal type by doing a non-partition targeted alter statement before doing partition maintenance prevented the corruption. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2019-10-28 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Test case from
Given the number of affected users and the fact that it has already undergone at least one round of review, I'm raising it to a blocker. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Chris Calender (Inactive) [ 2019-10-30 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
To be clear, this also affects RANGE partitions too: Test case:
Session Output:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Williams [ 2019-11-01 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I realized my comment above probably does relate to this bug. Reported it separately in MDEV-20940. |