Kristian,
Currently MariaDB (as well as MySQL of all previous versions) has a
very big problem related to replicating same server_id. There is
--replicate-same-server-id flag which as I understand (when set to 0)
controls two things:
1) It doesn't allow slave to connect to a master with the same server_id.
2) Slave ignores all binlog events in the replication stream that have
the same server_id as slave.
And this flag cannot be set to 1 when --log-slave-updates is used. And
that is a big problem.
Consider the following scenario: let's say we have two servers S1
(master) and S2 (slave). Let's say at some moment in time they are
completely in sync and you bring down S2 to take cold backup (you can
even include binlogs in it). Then you bring it back up, S1 is still
master. Now you execute some transactions, then you do a failover,
make S2 master and execute some more transactions. Then you bring down
S1, restore it from the backup taken earlier and connect to replicate
from S2 again. At this point S1 will have to reply some transaction
that have the same server_id as S1 has, but S1 doesn't have those
transactions yet, so it shouldn't skip them, but it will.
What do you think about how this should be fixed? As I understand you
explicitly wanted to support replication cycles, so you still want the
skipping of transactions with the same server_id to exist. But the
situation above is a valid production use case. Maybe in GTID world it
can be solved better? E.g. if transaction has the same server_id, but
the GTID wasn't applied yet then it shouldn't be skipped?
Thank you,
Pavel