-
Notifications
You must be signed in to change notification settings - Fork 990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL 8.3 will introduce new GTID format #845
Comments
An example event from
The event is serialized with the new The The UUID of the GTID is encoded as A >>> print(f'{0xaaaaaaaa888866664444222222222222 >> 1:0x}');
55555555444433332222111111111111 The checksum here is According to
|
The Examples: MySQL 9.1
Note the
Note the MySQL 8.0
Note the
Note the |
A first attempt in decoding this. Some info on this is available here: https://github.com/mysql/mysql-server/blob/61a3a1d8ef15512396b4c2af46e922a19bf2b174/sql/rpl_gtid_set.cc#L1364 package main
import (
"encoding/binary"
"fmt"
)
func main() {
cases := []struct {
b []byte
}{
{
[]byte{1, 2, 0, 0, 0, 0, 0, 1}, // tagged, sidnr=2
},
{
[]byte{1, 1, 0, 0, 0, 0, 0, 1}, // tagged, sidnr=1
},
{
[]byte{1, 0, 0, 0, 0, 0, 0, 1}, // tagged, sidnr=0
},
{
[]byte{0, 0, 0, 0, 0, 0, 0, 0}, // untagged, sidnr=0
},
{
[]byte{1, 0, 0, 0, 0, 0, 0, 0}, // untagged, sidnr=1
},
}
for _, c := range cases {
fmt.Printf("\nraw bytes= %08b\n", c.b)
if c.b[7] == 1 {
fmt.Println("tagged gtid format")
sid_mask := []byte{0, 255, 255, 255, 255, 255, 255, 0}
// Apply the mask
for i, _ := range c.b {
c.b[i] &= sid_mask[i]
}
c.b = append(c.b, 0)
// sidnr, encoded
fmt.Printf("sidnr = %08b\n", c.b[1:])
// sidnr
n := binary.LittleEndian.Uint64(c.b[1:])
fmt.Printf("sidnr = %d\n", n)
} else {
fmt.Println("classic gtid format")
n := binary.LittleEndian.Uint64(c.b)
fmt.Printf("sidnr = %d\n", n)
}
}
} |
Issue: closes go-mysql-org#845 The `PreviousGTIDsEvent` / `PREVIOUS_GTIDS_LOG_EVENT` has changed to work with tagged GTIDs. First the `uuidCount` has changed, it encodes the GTID format. Here format 1 is tagged and format 0 is untagged. Then each entry may have a tag. If there is a tag then the uuid itself isn't printed but the tag is appended to the last entry. Examples: - `896e7882-18fe-11ef-ab88-22222d34d411:1-3` regular format, compatible with both formats - `896e7882-18fe-11ef-ab88-22222d34d411:1-4:aaaa:1` tagged format. Combination of `896e7882-18fe-11ef-ab88-22222d34d411:1-4` and `896e7882-18fe-11ef-ab88-22222d34d411:aaaa:1` - `896e7882-18fe-11ef-ab88-22222d34d411:1-4:aaaa:1:abc:1-3:bbbbb:1:bbbbbb:1:x:1,896e7882-18fe-11ef-ab88-22222d34d412:1-2` Combination of: ``` 896e7882-18fe-11ef-ab88-22222d34d411:1-4 :aaaa:1 🔤1-3 :bbbbb:1 :bbbbbb:1 ❌1, 896e7882-18fe-11ef-ab88-22222d34d412:1-2 ``` Please also see: `mysqlbinlog --read-from-remote-server --hexdump $binlogfile` to see how MySQL encodes/decodes this. See also: - https://dev.mysql.com/doc/refman/8.4/en/replication-gtids-concepts.html
Issue: closes go-mysql-org#845 The `PreviousGTIDsEvent` / `PREVIOUS_GTIDS_LOG_EVENT` has changed to work with tagged GTIDs. First the `uuidCount` has changed, it encodes the GTID format. Here format 1 is tagged and format 0 is untagged. Then each entry may have a tag. If there is a tag then the uuid itself isn't printed but the tag is appended to the last entry. Examples: `896e7882-18fe-11ef-ab88-22222d34d411:1-3` regular format, compatible with both formats `896e7882-18fe-11ef-ab88-22222d34d411:1-4:aaaa:1` tagged format. Combination of - `896e7882-18fe-11ef-ab88-22222d34d411:1-4` - `896e7882-18fe-11ef-ab88-22222d34d411:aaaa:1` `896e7882-18fe-11ef-ab88-22222d34d411:1-4:aaaa:1:abc:1-3:bbbbb:1:bbbbbb:1:x:1,896e7882-18fe-11ef-ab88-22222d34d412:1-2` Combination of: ``` 896e7882-18fe-11ef-ab88-22222d34d411:1-4 :aaaa:1 🔤1-3 :bbbbb:1 :bbbbbb:1 ❌1, 896e7882-18fe-11ef-ab88-22222d34d412:1-2 ``` Please also see: `mysqlbinlog --read-from-remote-server --hexdump $binlogfile` to see how MySQL encodes/decodes this. See also: - https://dev.mysql.com/doc/refman/8.4/en/replication-gtids-concepts.html
Issue: ref go-mysql-org#845 The `PreviousGTIDsEvent` / `PREVIOUS_GTIDS_LOG_EVENT` has changed to work with tagged GTIDs. First the `uuidCount` has changed, it encodes the GTID format. Here format 1 is tagged and format 0 is untagged. Then each entry may have a tag. If there is a tag then the uuid itself isn't printed but the tag is appended to the last entry. Examples: `896e7882-18fe-11ef-ab88-22222d34d411:1-3` regular format, compatible with both formats `896e7882-18fe-11ef-ab88-22222d34d411:1-4:aaaa:1` tagged format. Combination of - `896e7882-18fe-11ef-ab88-22222d34d411:1-4` - `896e7882-18fe-11ef-ab88-22222d34d411:aaaa:1` `896e7882-18fe-11ef-ab88-22222d34d411:1-4:aaaa:1:abc:1-3:bbbbb:1:bbbbbb:1:x:1,896e7882-18fe-11ef-ab88-22222d34d412:1-2` Combination of: ``` 896e7882-18fe-11ef-ab88-22222d34d411:1-4 :aaaa:1 🔤1-3 :bbbbb:1 :bbbbbb:1 ❌1, 896e7882-18fe-11ef-ab88-22222d34d412:1-2 ``` Please also see: `mysqlbinlog --read-from-remote-server --hexdump $binlogfile` to see how MySQL encodes/decodes this. See also: - https://dev.mysql.com/doc/refman/8.4/en/replication-gtids-concepts.html
https://dev.mysql.com/doc/relnotes/mysql/8.3/en/news-8-3-0.html
thanks for @dveeden to remind us
PreviousGTIDsEvent
replication: Support GTID tag in PreviousGTIDsEvent #952GTID_TAGGED_LOG_EVENT
mysql.ParseGTIDSet(mysql.MySQLFlavor, ...)
/mysql.ParseMysqlGTIDSet()
The text was updated successfully, but these errors were encountered: