[MDEV-24273] System versioning replication fails when adding column on master Created: 2020-11-24 Updated: 2023-08-22 Resolved: 2023-08-21 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Replication, Versioned Tables |
| Affects Version/s: | 10.4.12, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.3.35, 10.4.25, 10.5.16, 10.6.8 |
| Type: | Bug | Priority: | Major |
| Reporter: | Catalin Dumitriu | Assignee: | Aleksey Midenkov |
| Resolution: | Fixed | Votes: | 2 |
| Labels: | ProductionIssue, ProductionStory | ||
| Environment: |
Debian 9 |
||
| Issue Links: |
|
||||||||||||||||||||||||
| Description |
|
Hello, I have this setup:
When I add a new column on master for a table, this is also propagated to slave , but when an update is running on master on that table and is replicated to slave, it fails, with error that it cannot change column type from my define type to timestamp(6). I have row based replication with GTID. I have both secure timestamp=YES and system_versioning_alter_history=KEEP on the slave. I have the same setup with mariadb 10.3.14 but replication is not going down. What can be the cause ? |
| Comments |
| Comment by Elena Stepanova [ 2020-11-24 ] | ||||||||||||||||||||||||
|
Thanks for the report. Reproducible as described.
| ||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2020-11-24 ] | ||||||||||||||||||||||||
cata06, | ||||||||||||||||||||||||
| Comment by Catalin Dumitriu [ 2020-11-24 ] | ||||||||||||||||||||||||
|
Glad that you manage to reproduce the problem. I have to check because i just realized that maybe I didn't alter a table on slave which had system versioning. I use only binlog_format=ROW for my replications. Also did you test it with binlog_format=MIXED(default) ? | ||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2020-11-24 ] | ||||||||||||||||||||||||
There is no need. The important part here is not the binlog_format value itself, but the format with which binary log events are written at the time when the DML statement in question (e.g. update which you mentioned in the description) is executed. | ||||||||||||||||||||||||
| Comment by Catalin Dumitriu [ 2020-11-24 ] | ||||||||||||||||||||||||
|
I will wait for a fix than. In the mean time the solution I see is to drop system versioning for the table before doing alter on master and to reactivate it after . | ||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2020-11-24 ] | ||||||||||||||||||||||||
|
I am wondering if you could describe in a little more detail your setup of non-versioned => versioned replication – the purpose of such setup, what your servers' configuration and replication topology is, what kind of objects and SQL you use, etc. | ||||||||||||||||||||||||
| Comment by Catalin Dumitriu [ 2020-11-24 ] | ||||||||||||||||||||||||
|
Sure , I will come back with short descriptions and also with examples | ||||||||||||||||||||||||
| Comment by Catalin Dumitriu [ 2020-11-26 ] | ||||||||||||||||||||||||
|
We wanted to implement a delta mecanism in order to sync tables changes for an interval, like last hour, last day etc. We looked at system versioning and we saw that it keeps track of changes and we can use it. We created an api which runs a query to take what was changed in the last hour for example. We don't use the commands provided in MariaDB documentation for querying historical data as we not interested how table look at a point in time or which rows were visible. Our interest was to see strictly what changed in database. This is used for data project were we sync data to an Azure Data Warehouse instance, for people to use it forward. First we activated system versioning on master server, but because of changes , the history started to increase fast and to slow our daily operations. We cannot create partition due to foreign key constrains to another tables. Even if we cleanup the history periodically the queries were slow. Than we decided to implement a master slave replication with system versioning on slave. The queries were still slow, but we managed to make them fast by adding index for row_start and row_end. Here is and example of query used by us:
I don't exactly know if MariaDB system versioning is intended to be used this way. Maybe it can be extended for something like this is not case, because I'm sure many users will love this. I'm also available to share other information if needed , even to test. We can schedule a call, maybe is easy this way. We are using MariaDB 10.3,10.4 on Debian 9. Replication is master-slave with format ROW. Other questions: Thank you for your involvement | ||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2020-11-27 ] | ||||||||||||||||||||||||
|
Thanks a lot for all the information, I'll get back to you on this if I have further questions. | ||||||||||||||||||||||||
| Comment by Aleksey Midenkov [ 2023-07-19 ] | ||||||||||||||||||||||||
|
cata06 Looks like this was fixed in 10.4.29 with | ||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2023-08-21 ] | ||||||||||||||||||||||||
|
The failure stopped happening after this commit in 10.3.35 / 10.4.25 / 10.5.16 / 10.6.8:
|