MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / forward

Method forward

IceFireDB-SQLite/pkg/mysql/mysql/mariadb_gtid.go:77–103  ·  view source on GitHub ↗
(newer *MariadbGTID)

Source from the content-addressed store, hash-verified

75}
76
77func (gtid *MariadbGTID) forward(newer *MariadbGTID) error {
78 if newer.DomainID != gtid.DomainID {
79 return errors.Errorf("%s is not same with domain of %s", newer, gtid)
80 }
81
82 /*
83 Here's a simplified example of binlog events.
84 Although I think one domain should have only one update at same time, we can't limit the user's usage.
85 we just output a warn log and let it go on
86 | mysqld-bin.000001 | 1453 | Gtid | 112 | 1495 | BEGIN GTID 0-112-6 |
87 | mysqld-bin.000001 | 1624 | Xid | 112 | 1655 | COMMIT xid=74 |
88 | mysqld-bin.000001 | 1655 | Gtid | 112 | 1697 | BEGIN GTID 0-112-7 |
89 | mysqld-bin.000001 | 1826 | Xid | 112 | 1857 | COMMIT xid=75 |
90 | mysqld-bin.000001 | 1857 | Gtid | 111 | 1899 | BEGIN GTID 0-111-5 |
91 | mysqld-bin.000001 | 1981 | Xid | 111 | 2012 | COMMIT xid=77 |
92 | mysqld-bin.000001 | 2012 | Gtid | 112 | 2054 | BEGIN GTID 0-112-8 |
93 | mysqld-bin.000001 | 2184 | Xid | 112 | 2215 | COMMIT xid=116 |
94 | mysqld-bin.000001 | 2215 | Gtid | 111 | 2257 | BEGIN GTID 0-111-6 |
95 */
96 if newer.SequenceNumber <= gtid.SequenceNumber {
97 log.Warnf("out of order binlog appears with gtid %s vs current position gtid %s", newer, gtid)
98 }
99
100 gtid.ServerID = newer.ServerID
101 gtid.SequenceNumber = newer.SequenceNumber
102 return nil
103}
104
105// MariadbGTIDSet is a set of mariadb gtid
106type MariadbGTIDSet struct {

Callers 2

AddSetMethod · 0.45
TestMariaDBForwardMethod · 0.45

Calls

no outgoing calls

Tested by 1

TestMariaDBForwardMethod · 0.36