[MDEV-18910] Hash value unique long column is miscalculated from versioning timestamp Created: 2019-03-13 Updated: 2019-03-21 Resolved: 2019-03-21 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, Versioned Tables |
| Affects Version/s: | 10.4.3 |
| Fix Version/s: | 10.4.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Sachin Setiya (Inactive) |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | corruption, versioned-table | ||
| Issue Links: |
|
||||||||||||||||||||||||||||
| Description |
|
The test case for InnoDB code was modified for implementing system-versioned tables. Hence, the assertion failure in InnoDB (reporting that indexes inside InnoDB are inconsistent with each other) could occur because of the changes for system-versioning, not directly because of Please try to find out if the system versioning code inside InnoDB is always handling errors correctly. As noted in For the test case, please refer to |
| Comments |
| Comment by Marko Mäkelä [ 2019-03-20 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This is still repeatable after merging into 10.4 the fixes of Even though the current test case for this bug depends on a different bug, I believe that any InnoDB corruption bug should have a major if not critical priority. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-03-21 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I analyzed this a little further. Here is the test case:
Internally, the table consists of two indexes:
The current transaction (id=71) has appended the 2 records into the clustered index. The history for all previous records has been removed. What catches my attention is that for the 2 distinct values 'f' and 'o', we see 3 distinct values in the secondary index. Is the hash being calculated on uninitialized data? Also, the secondary index contains only 5 records, while the insert into the clustered index is supposed to have been completed. The transaction is now in an ‘update’ phase. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-03-21 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I believe that the problem is that Item_func_hash::val_int() for computing the virtual column value of DB_ROW_HASH_1 is sometimes invoked on the correct column a, but sometimes on the incorrect column row_end. So, from the InnoDB point of view it is a garbage-in/garbage-out situation caused by the virtual column expression seemingly being nondeterministic. For the correct values 'f' and 'o', we are returning the expected hash values 0x10400000c7c and 0x10400000f28. These values never occur in the secondary index! Instead, something causes hash values to be computed on the system-versioning timestamps:
The value returned is 0xd6605c1b0dff45ee. It occurs twice in the secondary index. Observation: The "infinite future" value for row_end is not at the very end of the domain; it is 0x7fffffff0f423f. Another observation: For debugging purposes, it would be very beneficial to be able to add an invisible generated stored column for DB_ROW_HASH_1. Unfortunately, the following patch had no effect on that, possibly because cf->vcol_info->expr is not being initialized.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2019-03-21 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|