Skip to content

Commit

Permalink
Properly handle the vreplication.pos column value
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
mattlord committed Oct 9, 2023
1 parent 73097e4 commit 44bf036
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion go/vt/vtctl/workflow/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 44bf036

Please sign in to comment.