From f23f73cdcc02265643eb98f7482664c98115985f Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Sat, 21 Dec 2024 13:17:03 -0500 Subject: [PATCH] Grow byte buffer to exact size Signed-off-by: Matt Lord --- go/vt/vttablet/tabletmanager/vreplication/replicator_plan.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/vt/vttablet/tabletmanager/vreplication/replicator_plan.go b/go/vt/vttablet/tabletmanager/vreplication/replicator_plan.go index ec9de26d7e6..a201ce25847 100644 --- a/go/vt/vttablet/tabletmanager/vreplication/replicator_plan.go +++ b/go/vt/vttablet/tabletmanager/vreplication/replicator_plan.go @@ -505,7 +505,7 @@ func (tp *TablePlan) applyChange(rowChange *binlogdatapb.RowChange, executor fun diff := afterVals[i].RawStr() beforeVal := bindvars["b_"+field.Name].Value buf := bytes.Buffer{} - buf.Grow(len(diff) + len(beforeVal) + len(sqlparser.Utf8mb4Str) + 2) // +2 is for the enclosing quotes + buf.Grow(len(beforeVal) + len(sqlparser.Utf8mb4Str) + 2) // +2 is for the enclosing quotes buf.WriteString(sqlparser.Utf8mb4Str) buf.WriteByte('\'') buf.Write(beforeVal)