Skip to content

Commit

Permalink
Merge pull request #8755 from planetscale/fix-8676
Browse files Browse the repository at this point in the history
default to primary tablet if not set in VStream api
  • Loading branch information
systay authored Sep 3, 2021
2 parents 990d49e + 7d62111 commit e6f47d4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion go/vt/vtgate/grpcvtgateservice/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,15 @@ func (vtg *VTGate) ResolveTransaction(ctx context.Context, request *vtgatepb.Res
func (vtg *VTGate) VStream(request *vtgatepb.VStreamRequest, stream vtgateservicepb.Vitess_VStreamServer) (err error) {
defer vtg.server.HandlePanic(&err)
ctx := withCallerIDContext(stream.Context(), request.CallerId)

// For backward compatibility.
// The mysql query equivalent has logic to use topodatapb.TabletType_PRIMARY if tablet_type is not set.
tabletType := request.TabletType
if tabletType == topodatapb.TabletType_UNKNOWN {
tabletType = topodatapb.TabletType_PRIMARY
}
vtgErr := vtg.server.VStream(ctx,
request.TabletType,
tabletType,
request.Vgtid,
request.Filter,
request.Flags,
Expand Down

0 comments on commit e6f47d4

Please sign in to comment.