Skip to content

Commit

Permalink
Fail immediately for partial journal events
Browse files Browse the repository at this point in the history
Signed-off-by: twthorn <thomaswilliamthornton@gmail.com>
  • Loading branch information
twthorn committed Aug 6, 2024
1 parent 293f586 commit fe75145
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion go/vt/vtgate/vstream_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,10 @@ func (vs *vstream) streamFromTablet(ctx context.Context, sgtid *binlogdatapb.Sha

vs.lastError.Record(err)

if vs.lastError.ShouldRetry() {
if shouldFailNow(err) {
log.Errorf("VStream for %s/%s error: %v", sgtid.Keyspace, sgtid.Shard, err)
return err
} else if vs.lastError.ShouldRetry() {
log.Infof("Retrying tablet, count: %d, alias: %v, hostname: %s", backoffIndex, tablet.GetAlias(), tablet.GetHostname())
retryDelay := vs.backoffStrategy.Backoff(backoffIndex)
backoffIndex++
Expand All @@ -755,6 +758,14 @@ func (vs *vstream) streamFromTablet(ctx context.Context, sgtid *binlogdatapb.Sha
}
}

func shouldFailNow(err error) bool {
errCode := vterrors.Code(err)
if errCode == vtrpcpb.Code_UNKNOWN && strings.Contains(err.Error(), "not all journaling participants are in the stream") {
return true
}
return false
}

// sendAll sends a group of events together while holding the lock.
func (vs *vstream) sendAll(ctx context.Context, sgtid *binlogdatapb.ShardGtid, eventss [][]*binlogdatapb.VEvent) error {
vs.mu.Lock()
Expand Down

0 comments on commit fe75145

Please sign in to comment.