[MDEV-28843] slave_type_conversions does not check for NOT NULL or DEFAULT differences Created: 2022-06-14 Updated: 2023-10-16 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Replication |
| Affects Version/s: | 10.6.8 |
| Fix Version/s: | 10.6 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Hartmut Holzgraefe | Assignee: | Andrei Elkin |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Only tested on 10.6.8 so far, but it's probably on all versions |
||
| Description |
|
Consider the following replication situation:
E.g.:
So now we have a data inconsistency between master and slave even though slave_type_conversions='' should have prevented this. Double check to see that slave type conversion checks are indeed in effect:
|
| Comments |
| Comment by Jan Lindström (Inactive) [ 2022-06-17 ] | ||||||||||||||||||||||||||||||||||
|
julien.fritsch Not really, why and how data inconsistency between master and slave was created? | ||||||||||||||||||||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2022-06-17 ] | ||||||||||||||||||||||||||||||||||
What I would have expected to happen:
| ||||||||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2022-06-17 ] | ||||||||||||||||||||||||||||||||||
|
hholzgra My questions was why and how slave has different table schema? Using normal DDL supported by cluster you should not be able to do so. | ||||||||||||||||||||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2022-06-17 ] | ||||||||||||||||||||||||||||||||||
|
In this specific case it was about a rolling schema upgrade on a Galera cluster, and whether writes to the table would be safe while the RSU was ongoing or not. But also in general users sometimes have different table schema on master and slave, that's what slave_type_conversions=ON/OFF is about in the first place ... | ||||||||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2022-08-17 ] | ||||||||||||||||||||||||||||||||||
|
hholzgra Based on my testing on 10.6 Galera does work exactly as normal master-slave i.e.
| ||||||||||||||||||||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2022-08-17 ] | ||||||||||||||||||||||||||||||||||
|
So master and slave do not have the same "msg" value (NULL vs. abc), conversion between master and slave has happened, which empty slave_type_conversion should have prevented. And yes, it does not matter whether classic replication or Galera is used. I just ran into it on a Galera customer case first. | ||||||||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2022-08-17 ] | ||||||||||||||||||||||||||||||||||
|
hholzgra You can use --binlog-row-image=FULL but however there's a definite overlap between these two options - the image and conversion. I'd say when the image is not FULL the conversion can't full apply. That is CONVERSION only applies to fields that are present in the non-full image. However, in my opinion in your case there is no conversion happening it just about DEFAULT value behavior. | ||||||||||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2022-08-18 ] | ||||||||||||||||||||||||||||||||||
|
Elkin I leave it to you define is this DEFAULT value behavior a bug or works-as-designed. | ||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2023-10-11 ] | ||||||||||||||||||||||||||||||||||
|
hholzgra, I think this case is not a bug actually. RBR behaves correctly to replicate the master's NULL value which is - not converted (sic!), but - computed into abc. This result may be expected by the user who intends (and we of course have a great number of those practically) for the slave's ALTER this effect. We might consider more strict policies to react on this type of table definition mismatch with an error unless the user would specify his intents to produce With this I am closing the ticket, feel free to reopen and explain if I am missing anything. | ||||||||||||||||||||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2023-10-11 ] | ||||||||||||||||||||||||||||||||||
|
So you are basically telling me that "VARCHAR() NULL" and "VARCHAR() NOT NULL" are the same type? IMHO replicating from a NULLable column to a NOT NULL one is a lossy conversion and should only be allowed with slave_type_conversions=ALLOW_LOSSY in effect. | ||||||||||||||||||||||||||||||||||
| Comment by Andrei Elkin [ 2023-10-12 ] | ||||||||||||||||||||||||||||||||||
|
hholzgra, we implemented the conversion copying the upstream. The conversion applies when the basic type (incl the size of a var-size type) is different. They do not replicate NULL-ability as a a part of metadata. Therefore mariadb slave can't separate the same type with and without NULL, and more generally with different defaults. To Overall I believe what you're trying to achieve is fair to qualify as a task, not a bug. |