File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -325,12 +325,21 @@ func (c *Canal) WaitUntilPos(pos mysql.Position, timeout time.Duration) error {
325325}
326326
327327func (c * Canal ) GetMasterPos () (mysql.Position , error ) {
328- showBinlogStatus := "SHOW BINARY LOG STATUS"
329- if eq , err := c .conn .CompareServerVersion ("8.4.0" ); (err == nil ) && (eq < 0 ) {
330- showBinlogStatus = "SHOW MASTER STATUS"
328+ query := "SHOW BINARY LOG STATUS"
329+ switch c .cfg .Flavor {
330+ case mysql .MariaDBFlavor :
331+ query = "SHOW BINLOG STATUS"
332+
333+ if eq , err := c .conn .CompareServerVersion ("10.5.2" ); (err == nil ) && (eq < 0 ) {
334+ query = "SHOW MASTER STATUS"
335+ }
336+ case mysql .MySQLFlavor :
337+ if eq , err := c .conn .CompareServerVersion ("8.4.0" ); (err == nil ) && (eq < 0 ) {
338+ query = "SHOW MASTER STATUS"
339+ }
331340 }
332341
333- rr , err := c .Execute (showBinlogStatus )
342+ rr , err := c .Execute (query )
334343 if err != nil {
335344 return mysql.Position {}, errors .Trace (err )
336345 }
You can’t perform that action at this time.
0 commit comments