MCPcopy
hub / github.com/github/gh-ost / ConnectBinlogStreamer

Method ConnectBinlogStreamer

go/binlog/gomysql_reader.go:58–80  ·  view source on GitHub ↗

ConnectBinlogStreamer

(coordinates mysql.BinlogCoordinates)

Source from the content-addressed store, hash-verified

56
57// ConnectBinlogStreamer
58func (gmr *GoMySQLReader) ConnectBinlogStreamer(coordinates mysql.BinlogCoordinates) (err error) {
59 if coordinates.IsEmpty() {
60 return gmr.migrationContext.Log.Errorf("empty coordinates at ConnectBinlogStreamer()")
61 }
62
63 gmr.currentCoordinatesMutex.Lock()
64 defer gmr.currentCoordinatesMutex.Unlock()
65 gmr.currentCoordinates = coordinates
66 gmr.migrationContext.Log.Infof("Connecting binlog streamer at %+v", coordinates)
67
68 // Start sync with specified GTID set or binlog file and position
69 if gmr.migrationContext.UseGTIDs {
70 coords := coordinates.(*mysql.GTIDBinlogCoordinates)
71 gmr.binlogStreamer, err = gmr.binlogSyncer.StartSyncGTID(coords.GTIDSet)
72 } else {
73 coords := gmr.currentCoordinates.(*mysql.FileBinlogCoordinates)
74 gmr.binlogStreamer, err = gmr.binlogSyncer.StartSync(gomysql.Position{
75 Name: coords.LogFile,
76 Pos: uint32(coords.LogPos)},
77 )
78 }
79 return err
80}
81
82func (gmr *GoMySQLReader) GetCurrentBinlogCoordinates() mysql.BinlogCoordinates {
83 gmr.currentCoordinatesMutex.Lock()

Callers 1

initBinlogReaderMethod · 0.95

Calls 3

IsEmptyMethod · 0.65
ErrorfMethod · 0.65
InfofMethod · 0.65

Tested by

no test coverage detected