[MDEV-19632] Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode Created: 2019-05-29 Updated: 2021-04-19 Resolved: 2020-08-01 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Replication |
| Affects Version/s: | 10.3.16, 10.3.18, 10.3, 10.4 |
| Fix Version/s: | 10.3.24, 10.4.14, 10.5.5 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Alexander Barkov |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | oracle | ||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
Same idea, different types:
|
| Comments |
| Comment by Andrei Elkin [ 2020-06-22 ] | ||||||||||||||||||||||||||||||||||||||
|
sujatha.sivakumar: So sql_mode force the input DATE type in CREATE TABLE become DATETYPE as SHOW can prove:
Notice
But CREATE-SELECT does not -
which must be the reason of the bug. | ||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-06-22 ] | ||||||||||||||||||||||||||||||||||||||
|
Andrei, I can't repeat your results. These two scripts:
both return:
| ||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2020-06-22 ] | ||||||||||||||||||||||||||||||||||||||
|
bar Alexander, thanks a lot for trying to help. I did not mention ROW binlog format (as being mentioned already in the desc) which is cruicial. Here is my re-try:
| ||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-06-22 ] | ||||||||||||||||||||||||||||||||||||||
|
If I create the table with the DATE data type with the default sql_mode, and then run CREATE..LIKE or CREATE..SELECT with sql_mode=ORACLE, both create a column of the DATE data type:
So CREATE..LIKE and CREATE..SELECT work in the same way with a standalone server. | ||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-06-22 ] | ||||||||||||||||||||||||||||||||||||||
|
The problem is that:
is replicated as:
It should be something like:
| ||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2020-06-22 ] | ||||||||||||||||||||||||||||||||||||||
You're correct. Sorry for confusing, in my paste I compared CREATE from different "originals". | ||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-06-23 ] | ||||||||||||||||||||||||||||||||||||||
|
Hi Elkin, Serg proposed an idea. Why we cannot replicate this:
as
instead of the current way (which involves the parser):
Elkin, what do you think? | ||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2020-06-23 ] | ||||||||||||||||||||||||||||||||||||||
|
bar You must mean to place into binlog CREATE-SELECT-LIMIT-0 as the table def, instead of the plain CREATE. Then CREATE-LIKE would be a bit more suitable, right? Either way I think it makes sense. Another question comes should we always binlog such way or at sql_mode = 'oracle' and such? | ||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2020-06-23 ] | ||||||||||||||||||||||||||||||||||||||
|
bar After discussing with sujatha.sivakumar, I also feel we could consider to omit sql_mode='oracle' in Query_log_event if that can help to log it correctly. | ||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-06-23 ] | ||||||||||||||||||||||||||||||||||||||
|
Elkin, I don't think CREATE-LIKE would be suituble all to replicate CREATE-TABLE-SELECT, because SELECT can contain joins or unions. | ||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2020-06-24 ] | ||||||||||||||||||||||||||||||||||||||
|
Elkin, no, definitely not CREATE ... LIKE it produces different results. In particular, it creates indexes that CREATE ... SELECT doesn't. And you cannot do CREATE ... LIKE on, say, SELECT 1 from t1. Another option, indeed, would be to log it as
| ||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2020-06-24 ] | ||||||||||||||||||||||||||||||||||||||
|
I wonder whether it would work, given that MDEV-14760 (Replication does not take into account SET STATEMENT) is still open. | ||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2020-06-24 ] | ||||||||||||||||||||||||||||||||||||||
|
serg set statement sql_mode='' is inferior 'cos sql_mode is a member of Query_log_event::status_var. So regardless of MDEV-14760 we should not have Query_log_event::status_var::sql_mode = 'oracle'. And setting it to '' in status_var would fix the bug being of the same tech trouble. | ||||||||||||||||||||||||||||||||||||||
| Comment by Sujatha Sivakumar (Inactive) [ 2020-06-24 ] | ||||||||||||||||||||||||||||||||||||||
|
Hello elenst MDEV-14760 is (not a bug). All variables on the master are not replicated. Few variables get replicated and few of them are not. For example 'auto_increment_increment', 'sql_mode'. When these variables used with SET STATEMENT they get replicated. There are variables like 'storage_engine' which are not replicated. When these variables are associated with SET STATEMENT they are no-op. Please refer https://jira.mariadb.org/browse/MDEV-14760?focusedCommentId=128669&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-128669 | ||||||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2020-06-24 ] | ||||||||||||||||||||||||||||||||||||||
|
sujatha.sivakumar, thanks for reminding on MDEV-14760 analysis. | ||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2020-06-24 ] | ||||||||||||||||||||||||||||||||||||||
|
I've seen this, and I know that MDEV-14760 is leaning towards being not a bug. I was responding to the previous Sergei's comment about possible use of set statement to solve this issue. If it's ignored by the slave and is going to stay ignored, then it probably won't solve the problem. | ||||||||||||||||||||||||||||||||||||||
| Comment by Michael Widenius [ 2020-06-26 ] | ||||||||||||||||||||||||||||||||||||||
|
The simplest solution is to introduce MARIADB_DATE as a synonym for DATE and to be used in ORACLE mode in case of SHOW CREATE when a original MariaDB date is used. | ||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-06-26 ] | ||||||||||||||||||||||||||||||||||||||
|
After a discussion with Monty and Serg, we decided to fix it in 10.3 to 10.5 in the following way, so this script:
will display:
This will automatically fix this problem. In 10.6 we'll possibly introduce a more generalized solution like MDEV-23023 (but this is not decided yet though). | ||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-06-29 ] | ||||||||||||||||||||||||||||||||||||||
|
The same problem is repeatable with with sql_mode=MAXDB, which translates TIMESTAMP to DATETIME:
Replication fails with this error:
| ||||||||||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2020-07-08 ] | ||||||||||||||||||||||||||||||||||||||
|
Patches: |