Skip to content

Commit

Permalink
safer checks for EOF
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com>
  • Loading branch information
shlomi-noach committed Jan 1, 2025
1 parent 61c8f5f commit b204ca6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion go/vt/binlog/binlog_streamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"vitess.io/vitess/go/vt/dbconfigs"
"vitess.io/vitess/go/vt/log"
"vitess.io/vitess/go/vt/sqlparser"
"vitess.io/vitess/go/vt/vterrors"
"vitess.io/vitess/go/vt/vttablet/tabletserver/schema"

binlogdatapb "vitess.io/vitess/go/vt/proto/binlogdata"
Expand Down Expand Up @@ -279,7 +280,7 @@ func (bls *Streamer) parseEvents(ctx context.Context, events <-chan mysql.Binlog
Position: replication.EncodePosition(pos),
}
if err = bls.sendTransaction(eventToken, statements); err != nil {
if errors.Is(err, io.EOF) {
if errors.Is(vterrors.UnwrapAll(err), io.EOF) {
return ErrClientEOF
}
return fmt.Errorf("send reply error: %v", err)
Expand Down

0 comments on commit b204ca6

Please sign in to comment.