From d82d53907561c7462c0bf5609b4a525fcde3b5bd Mon Sep 17 00:00:00 2001 From: Harshit Gangal Date: Wed, 1 Sep 2021 15:20:47 +0530 Subject: [PATCH] default to primary tablet if not set Signed-off-by: Harshit Gangal Signed-off-by: Florent Poinsard Signed-off-by: Florent Poinsard --- go/vt/vtgate/grpcvtgateservice/server.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/go/vt/vtgate/grpcvtgateservice/server.go b/go/vt/vtgate/grpcvtgateservice/server.go index ae108c06ee3..641ab540a16 100644 --- a/go/vt/vtgate/grpcvtgateservice/server.go +++ b/go/vt/vtgate/grpcvtgateservice/server.go @@ -194,8 +194,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_MASTER if tablet_type is not set. + tabletType := request.TabletType + if tabletType == topodatapb.TabletType_UNKNOWN { + tabletType = topodatapb.TabletType_MASTER + } vtgErr := vtg.server.VStream(ctx, - request.TabletType, + tabletType, request.Vgtid, request.Filter, func(events []*binlogdatapb.VEvent) error {