Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default to primary tablet if not set in VStream api #8755

Merged
merged 1 commit into from
Sep 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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