From 44bf036fbb826ee8c480c5d2d0b9e45ecadfb79c Mon Sep 17 00:00:00 2001 From: Matt Lord Date: Sun, 8 Oct 2023 21:14:04 -0400 Subject: [PATCH] Properly handle the vreplication.pos column value Signed-off-by: Matt Lord --- go/vt/vtctl/workflow/server.go | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/go/vt/vtctl/workflow/server.go b/go/vt/vtctl/workflow/server.go index e8d4794ccef..b09b6ede4e1 100644 --- a/go/vt/vtctl/workflow/server.go +++ b/go/vt/vtctl/workflow/server.go @@ -40,6 +40,7 @@ import ( "vitess.io/vitess/go/sqlescape" "vitess.io/vitess/go/sqltypes" "vitess.io/vitess/go/trace" + "vitess.io/vitess/go/vt/binlog/binlogplayer" "vitess.io/vitess/go/vt/concurrency" "vitess.io/vitess/go/vt/discovery" "vitess.io/vitess/go/vt/key" @@ -446,7 +447,22 @@ func (s *Server) GetWorkflows(ctx context.Context, req *vtctldatapb.GetWorkflows return err } - pos := row["pos"].ToString() + // The value in the pos column can be compressed and thus not + // have a valid GTID consisting of valid UTF-8 characters so we + // have to decode it so that it's properly decompressed first + // when needed. + pos, err := row.ToString("pos") + if err != nil { + return err + } + if pos != "" { + mpos, err := binlogplayer.DecodePosition(pos) + if err != nil { + return err + } + pos = mpos.String() + } + stopPos := row["stop_pos"].ToString() state := row["state"].ToString() dbName := row["db_name"].ToString()