From 8485c2e9774e86ee267212bfa1ab9462131fa219 Mon Sep 17 00:00:00 2001 From: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> Date: Mon, 18 Mar 2024 06:43:32 +0200 Subject: [PATCH] use maxRows, wantFields Signed-off-by: Shlomi Noach <2607934+shlomi-noach@users.noreply.github.com> --- go/vt/vttablet/tabletmanager/rpc_query.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/go/vt/vttablet/tabletmanager/rpc_query.go b/go/vt/vttablet/tabletmanager/rpc_query.go index 0e3bee07f5c..b801511a781 100644 --- a/go/vt/vttablet/tabletmanager/rpc_query.go +++ b/go/vt/vttablet/tabletmanager/rpc_query.go @@ -222,13 +222,15 @@ func (tm *TabletManager) ExecuteMultiFetchAsDba(ctx context.Context, req *tablet // (in v20): result, err := ExecuteFetch(uq, int(req.MaxRows), true /*wantFields*/) results := make([]*querypb.QueryResult, 0, len(queries)) result, more, err := conn.ExecuteFetchMulti(uq, int(req.MaxRows), true /*wantFields*/) - results = append(results, sqltypes.ResultToProto3(result)) - for more { - result, more, _, err = conn.ReadQueryResult(0, false) + if err == nil { results = append(results, sqltypes.ResultToProto3(result)) + } + for more { + result, more, _, err = conn.ReadQueryResult(int(req.MaxRows), true /*wantFields*/) if err != nil { return nil, err } + results = append(results, sqltypes.ResultToProto3(result)) } // Re-enable FK checks if necessary.