[MDEV-16248] Row based replication to spider with float column fails on delete/update Created: 2018-05-22 Updated: 2021-08-11 Resolved: 2019-07-06 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Spider |
| Affects Version/s: | 10.3.7 |
| Fix Version/s: | 10.4.7 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Mattias Jonsson | Assignee: | Kentoku Shiba (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Linux |
||
| Attachments: |
|
||||||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
Replicating using binlog_format = ROW to a spider table can fail for float columns for DELETE and UPDATE statements, due to spider sends delete/update queries to its datanodes that tries to match every column in the table definition, which may fail since you cannot do a comparison like 'float_column = 0.671437' reliably. After finding a repeatable test case (see attached test case files) i have also updated this description. I missed to add the 'UPDATE' to the test case, but just after the DELETE statement, add: Also notice in the .cnf file there is an additional way to even make the master fail. I have not tested federatedX, but assume it suffers from the same issue? The rest of this description is from the original bug report, where we found the inconsistency. This happened due to this bug but we found it first due to the row was never deleted, so the following part is more of a part of our troubleshooting: Every now and then the replication fails with: From the error log on the spider head: From the query log on the spider head: From the query log one of the data nodes: And we can see a row in test_table_2 with that id, but not in test_table_1. show slave status output: Slave_IO_State: Waiting for master to send event |
| Comments |
| Comment by Mattias Jonsson [ 2018-05-24 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
Changing to minor, since currently I suspect something with our test replication setup. | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Mattias Jonsson [ 2018-05-24 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
The duplicate PK is correct, but due to a DELETE was missed in the replication flow. Still investigating. | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Mattias Jonsson [ 2018-05-24 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
I think the DELETE that did not remove the row, failed due to the replicated deleted row had a float column, which did not match the full delete query sent by the spider node, like: And since the float_col probably compares as DOUBLE (or some other floating number comparison issues) it does not get any match and did not actually delete the old row. | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Mattias Jonsson [ 2018-05-25 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
Also the binlog was created with the default binlog_row_image=FULL It could be implemented like: https://godbolt.org/g/3SGZq8 We will try with binlog_row_image=minimal. | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Eric Herman [ 2018-06-28 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
I have created https://github.com/MariaDB/server/pull/805 which adds functions which might be useful in this case as well. See also: https://bugs.mysql.com/bug.php?id=83788 | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Mattias Jonsson [ 2018-07-22 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
I think this shows the real issue:
We need to specify the value after FLOAT -> DOUBLE conversion is done for float columns! | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Mathew (Inactive) [ 2018-07-24 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
I will continue working on this issue after Bar's changes to the FLOAT data type are committed to 10.3. | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Eric Herman [ 2018-07-30 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
Is there an MDEV or a branch or anything to track Bar's changes to FLOAT? (I don't see one, with a quick search) | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Mathew (Inactive) [ 2018-08-01 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
Bar's tasks for his changes to the FLOAT data type are | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jacob Mathew (Inactive) [ 2018-10-17 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
Reassigning to Bar, who has been working on MDEV-16873 and | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-03-21 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
Kentoku, if we implement a new cast type:
would it help to solve this issue? We currently have only CAST( AS DOUBLE). Here's what happens: The original query:
is translated to this binary log entry:
which is, when sent to the backend, is translated to:
Wrapping float constants to CAST should help:
| |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-03-21 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
Here's the proof of the idea, which emulates CAST(AS FLOAT) using a stored function:
| |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kentoku Shiba (Inactive) [ 2019-04-16 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
bar | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-05-16 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
" | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kentoku Shiba (Inactive) [ 2019-05-24 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
willhan | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by willhan [ 2019-06-28 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
kentoku which mysql/mariadb version can support cast(0.671437 as float) ? | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-06-28 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
` | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by willhan [ 2019-07-05 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
It's OK | |||||||||||||||||||||||||||||||||||||||||||||
| Comment by Kentoku Shiba (Inactive) [ 2019-07-06 ] | |||||||||||||||||||||||||||||||||||||||||||||
|
Thank you for checking this. |