-
Notifications
You must be signed in to change notification settings - Fork 997
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #759 from Fizic/master
Adding replication protocol support to mysql server implementation
- Loading branch information
Showing
6 changed files
with
133 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package server | ||
|
||
import ( | ||
"encoding/binary" | ||
|
||
"github.com/go-mysql-org/go-mysql/mysql" | ||
) | ||
|
||
func parseBinlogDump(data []byte) (mysql.Position, error) { | ||
if len(data) < 10 { | ||
return mysql.Position{}, mysql.ErrMalformPacket | ||
} | ||
var p mysql.Position | ||
p.Pos = binary.LittleEndian.Uint32(data[0:4]) | ||
p.Name = string(data[10:]) | ||
|
||
return p, nil | ||
} | ||
|
||
func parseBinlogDumpGTID(data []byte) (*mysql.MysqlGTIDSet, error) { | ||
if len(data) < 15 { | ||
return nil, mysql.ErrMalformPacket | ||
} | ||
lenPosName := binary.LittleEndian.Uint32(data[11:15]) | ||
if len(data) < 22+int(lenPosName) { | ||
return nil, mysql.ErrMalformPacket | ||
} | ||
|
||
return mysql.DecodeMysqlGTIDSet(data[22+lenPosName:]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters