[MDEV-27862] Galera should replicate nextval()-related changes in sequences with INCREMENT <> 0, at least NOCACHE ones with engine=InnoDB Created: 2022-02-16 Updated: 2023-12-22 Resolved: 2022-05-30 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Galera, Sequences |
| Affects Version/s: | 10.5.14 |
| Fix Version/s: | 10.4.26, 10.5.17, 10.6.9, 10.7.5, 10.8.4 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Valerii Kravchuk | Assignee: | Mario Karuza (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Consider the following text case (on a local 2-node Galera cluster):
Normally Galera replicates changes in InnoDB table, that must happen for NOCACHE sequence with engine=InnoDB. In the test above we see that changes to back end InnoDB table seem NOT to be replicated neither for SELEXT (kind of expected) nor for INSERT (which must produce a write set to replicate). As a result we can not use sequences with INCREMENT<>0 in Galera the same way as on standalone node. As I fail to find where is it documented as a limitation I'd say it's a bug actually. |
| Comments |
| Comment by Jan Lindström (Inactive) [ 2022-04-13 ] | |||||||||||||||||||||||||||
|
ralf.gebhardt@mariadb.com Because sequence handlerton is DB_TYPE_SEQUENCE and it has not defined HTON_WSREP_REPLICATION i.e. that it should be replicated by Galera. Adding this is not enough to make it happen and that reason is most likely because somewhere we should do binlogging when WSREP_EMULATE_BINLOG(thd) is set. However, I could not figure out where that binlogging is skipped.
Message empty rbr buffer means that no binlog events where created. If I start servers with --log-bin=1 I can see from binlog that:
This means that when binlog is enabled actual binlog event is written to binlog i.e. there is one Write_rows event for select nextval(s3) but this is still not replicated by Galera. | |||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2022-04-13 ] | |||||||||||||||||||||||||||
|
If I correctly understand this necessary binlog events are in stmt cache but binlog_commit is newer called to flush them. Instead binlog reset is called that notices that there is still events in stmt cache. | |||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2022-04-14 ] | |||||||||||||||||||||||||||
|
This is not enough to get nextval(s3) to replicate in Galera:
Note that I have already fixed the issue that CREATE|ALTER SEQUENCE did not replicate by Galera . | |||||||||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2022-04-14 ] | |||||||||||||||||||||||||||
|
seppo I have now found the reason. We do write binlog events to stmt cache but not in wsrep_client_server cache. However, I do not know how to get those binlog events there. | |||||||||||||||||||||||||||
| Comment by Seppo Jaakola [ 2022-04-14 ] | |||||||||||||||||||||||||||
|
jplindst take a look at wsrep_get_trans_cache(), wsrep patch uses this to get access to binlog cache where to read binlog events from. I suppose the binlog events related to sequence usage go only to statement cache, and not to transactional cache, which wsrep patch is polling. |