@@ -1236,7 +1236,7 @@ func (c *Conn) handleNextCommand(ctx context.Context, handler Handler) error {
12361236 return err
12371237 }
12381238 case ComStmtSendLongData :
1239- stmtID , paramID , chunkData , ok := c .parseComStmtSendLongData (data )
1239+ stmtID , paramID , chunk , ok := c .parseComStmtSendLongData (data )
12401240 c .recycleReadPacket ()
12411241 if ! ok {
12421242 err := fmt .Errorf ("error parsing statement send long data from client %v, returning error: %v" , c .ConnectionID , data )
@@ -1259,9 +1259,6 @@ func (c *Conn) handleNextCommand(ctx context.Context, handler Handler) error {
12591259 return err
12601260 }
12611261
1262- chunk := make ([]byte , len (chunkData ))
1263- copy (chunk , chunkData )
1264-
12651262 key := fmt .Sprintf ("v%d" , paramID + 1 )
12661263 if val , ok := prepare .BindVars [key ]; ok {
12671264 val .Value = append (val .Value , chunk ... )
@@ -1427,13 +1424,14 @@ func (c *Conn) handleComRegisterReplica(handler Handler, data []byte) (kontinue
14271424 return true
14281425 }
14291426
1430- c .recycleReadPacket ()
1431-
14321427 replicaHost , replicaPort , replicaUser , replicaPassword , err := c .parseComRegisterReplica (data )
14331428 if err != nil {
14341429 log .Errorf ("conn %v: parseComRegisterReplica failed: %v" , c .ID (), err )
14351430 return false
14361431 }
1432+
1433+ c .recycleReadPacket ()
1434+
14371435 if err := binlogReplicaHandler .ComRegisterReplica (c , replicaHost , replicaPort , replicaUser , replicaPassword ); err != nil {
14381436 c .writeErrorPacketFromError (err )
14391437 return false
@@ -1452,7 +1450,6 @@ func (c *Conn) handleComBinlogDumpGTID(handler Handler, data []byte) (kontinue b
14521450 return true
14531451 }
14541452
1455- c .recycleReadPacket ()
14561453 kontinue = true
14571454
14581455 c .startWriterBuffering ()
@@ -1468,6 +1465,7 @@ func (c *Conn) handleComBinlogDumpGTID(handler Handler, data []byte) (kontinue b
14681465 log .Errorf ("conn %v: parseComBinlogDumpGTID failed: %v" , c .ID (), err )
14691466 return false
14701467 }
1468+ c .recycleReadPacket ()
14711469 if err := binlogReplicaHandler .ComBinlogDumpGTID (c , logFile , logPos , position .GTIDSet ); err != nil {
14721470 log .Error (err .Error ())
14731471 c .writeErrorPacketFromError (err )
0 commit comments