diff --git a/go/vt/vtgate/fakerpcvtgateconn/conn.go b/go/vt/vtgate/fakerpcvtgateconn/conn.go index 0b38a1cef9d..6384a705b3f 100644 --- a/go/vt/vtgate/fakerpcvtgateconn/conn.go +++ b/go/vt/vtgate/fakerpcvtgateconn/conn.go @@ -232,8 +232,8 @@ func (conn *FakeVTGateConn) ExecuteEntityIds(ctx context.Context, query string, panic("not implemented") } -// ExecuteBatchShard please see vtgateconn.Impl.ExecuteBatchShard -func (conn *FakeVTGateConn) ExecuteBatchShard(ctx context.Context, queries []proto.BoundShardQuery, tabletType pb.TabletType, asTransaction bool, session interface{}) ([]mproto.QueryResult, interface{}, error) { +// ExecuteBatchShards please see vtgateconn.Impl.ExecuteBatchShards +func (conn *FakeVTGateConn) ExecuteBatchShards(ctx context.Context, queries []proto.BoundShardQuery, tabletType pb.TabletType, asTransaction bool, session interface{}) ([]mproto.QueryResult, interface{}, error) { panic("not implemented") } diff --git a/go/vt/vtgate/gorpcvtgateconn/conn.go b/go/vt/vtgate/gorpcvtgateconn/conn.go index 6fb6692332a..03218277f09 100644 --- a/go/vt/vtgate/gorpcvtgateconn/conn.go +++ b/go/vt/vtgate/gorpcvtgateconn/conn.go @@ -196,7 +196,7 @@ func (conn *vtgateConn) ExecuteEntityIds(ctx context.Context, query string, keys return result.Result, result.Session, nil } -func (conn *vtgateConn) ExecuteBatchShard(ctx context.Context, queries []proto.BoundShardQuery, tabletType pb.TabletType, asTransaction bool, session interface{}) ([]mproto.QueryResult, interface{}, error) { +func (conn *vtgateConn) ExecuteBatchShards(ctx context.Context, queries []proto.BoundShardQuery, tabletType pb.TabletType, asTransaction bool, session interface{}) ([]mproto.QueryResult, interface{}, error) { var s *proto.Session if session != nil { s = session.(*proto.Session) diff --git a/go/vt/vtgate/grpcvtgateconn/conn.go b/go/vt/vtgate/grpcvtgateconn/conn.go index 9d0297443f1..a47937ebede 100644 --- a/go/vt/vtgate/grpcvtgateconn/conn.go +++ b/go/vt/vtgate/grpcvtgateconn/conn.go @@ -165,7 +165,7 @@ func (conn *vtgateConn) ExecuteEntityIds(ctx context.Context, query string, keys return mproto.Proto3ToQueryResult(response.Result), response.Session, nil } -func (conn *vtgateConn) ExecuteBatchShard(ctx context.Context, queries []proto.BoundShardQuery, tabletType pbt.TabletType, asTransaction bool, session interface{}) ([]mproto.QueryResult, interface{}, error) { +func (conn *vtgateConn) ExecuteBatchShards(ctx context.Context, queries []proto.BoundShardQuery, tabletType pbt.TabletType, asTransaction bool, session interface{}) ([]mproto.QueryResult, interface{}, error) { var s *pb.Session if session != nil { s = session.(*pb.Session) diff --git a/go/vt/vtgate/vtgateconn/vtgateconn.go b/go/vt/vtgate/vtgateconn/vtgateconn.go index 195dc276ecb..cfe502da22e 100644 --- a/go/vt/vtgate/vtgateconn/vtgateconn.go +++ b/go/vt/vtgate/vtgateconn/vtgateconn.go @@ -80,9 +80,9 @@ func (conn *VTGateConn) ExecuteEntityIds(ctx context.Context, query string, keys return res, err } -// ExecuteBatchShard executes a set of non-streaming queries for multiple shards. -func (conn *VTGateConn) ExecuteBatchShard(ctx context.Context, queries []proto.BoundShardQuery, tabletType pb.TabletType, asTransaction bool) ([]mproto.QueryResult, error) { - res, _, err := conn.impl.ExecuteBatchShard(ctx, queries, tabletType, asTransaction, nil) +// ExecuteBatchShards executes a set of non-streaming queries for multiple shards. +func (conn *VTGateConn) ExecuteBatchShards(ctx context.Context, queries []proto.BoundShardQuery, tabletType pb.TabletType, asTransaction bool) ([]mproto.QueryResult, error) { + res, _, err := conn.impl.ExecuteBatchShards(ctx, queries, tabletType, asTransaction, nil) return res, err } @@ -264,12 +264,12 @@ func (tx *VTGateTx) ExecuteEntityIds(ctx context.Context, query string, keyspace return res, err } -// ExecuteBatchShard executes a set of non-streaming queries for multiple shards. -func (tx *VTGateTx) ExecuteBatchShard(ctx context.Context, queries []proto.BoundShardQuery, tabletType pb.TabletType, asTransaction bool) ([]mproto.QueryResult, error) { +// ExecuteBatchShards executes a set of non-streaming queries for multiple shards. +func (tx *VTGateTx) ExecuteBatchShards(ctx context.Context, queries []proto.BoundShardQuery, tabletType pb.TabletType, asTransaction bool) ([]mproto.QueryResult, error) { if tx.session == nil { - return nil, fmt.Errorf("executeBatchShard: not in transaction") + return nil, fmt.Errorf("executeBatchShards: not in transaction") } - res, session, err := tx.impl.ExecuteBatchShard(ctx, queries, tabletType, asTransaction, tx.session) + res, session, err := tx.impl.ExecuteBatchShards(ctx, queries, tabletType, asTransaction, tx.session) tx.session = session return res, err } @@ -349,8 +349,8 @@ type Impl interface { // ExecuteEntityIds executes a non-streaming query for multiple entities. ExecuteEntityIds(ctx context.Context, query string, keyspace string, entityColumnName string, entityKeyspaceIDs []proto.EntityId, bindVars map[string]interface{}, tabletType pb.TabletType, notInTransaction bool, session interface{}) (*mproto.QueryResult, interface{}, error) - // ExecuteBatchShard executes a set of non-streaming queries for multiple shards. - ExecuteBatchShard(ctx context.Context, queries []proto.BoundShardQuery, tabletType pb.TabletType, asTransaction bool, session interface{}) ([]mproto.QueryResult, interface{}, error) + // ExecuteBatchShards executes a set of non-streaming queries for multiple shards. + ExecuteBatchShards(ctx context.Context, queries []proto.BoundShardQuery, tabletType pb.TabletType, asTransaction bool, session interface{}) ([]mproto.QueryResult, interface{}, error) // ExecuteBatchKeyspaceIds executes a set of non-streaming queries for multiple keyspace ids. ExecuteBatchKeyspaceIds(ctx context.Context, queries []proto.BoundKeyspaceIdQuery, tabletType pb.TabletType, asTransaction bool, session interface{}) ([]mproto.QueryResult, interface{}, error) diff --git a/go/vt/vtgate/vtgateconntest/client.go b/go/vt/vtgate/vtgateconntest/client.go index 3fc2f40a6f6..9f35214b253 100644 --- a/go/vt/vtgate/vtgateconntest/client.go +++ b/go/vt/vtgate/vtgateconntest/client.go @@ -296,7 +296,7 @@ func (f *fakeVTGateService) ExecuteBatchShards(ctx context.Context, queries []pr Session: session, } if !reflect.DeepEqual(query, execCase.batchQueryShard) { - f.t.Errorf("ExecuteBatchShard: %+v, want %+v", query, execCase.batchQueryShard) + f.t.Errorf("ExecuteBatchShards: %+v, want %+v", query, execCase.batchQueryShard) return nil } reply.Error = execCase.reply.Error @@ -662,7 +662,7 @@ func TestSuite(t *testing.T, impl vtgateconn.Impl, fakeServer vtgateservice.VTGa testExecuteKeyspaceIds(t, conn) testExecuteKeyRanges(t, conn) testExecuteEntityIds(t, conn) - testExecuteBatchShard(t, conn) + testExecuteBatchShards(t, conn) testExecuteBatchKeyspaceIds(t, conn) testStreamExecute(t, conn) testStreamExecuteShards(t, conn) @@ -697,7 +697,7 @@ func TestSuite(t *testing.T, impl vtgateconn.Impl, fakeServer vtgateservice.VTGa testExecuteKeyspaceIdsError(t, conn) testExecuteKeyRangesError(t, conn) testExecuteEntityIdsError(t, conn) - testExecuteBatchShardError(t, conn) + testExecuteBatchShardsError(t, conn) testExecuteBatchKeyspaceIdsError(t, conn) testStreamExecuteError(t, conn, fs) testStreamExecute2Error(t, conn, fs) @@ -729,7 +729,7 @@ func TestSuite(t *testing.T, impl vtgateconn.Impl, fakeServer vtgateservice.VTGa testExecuteKeyspaceIdsPanic(t, conn) testExecuteKeyRangesPanic(t, conn) testExecuteEntityIdsPanic(t, conn) - testExecuteBatchShardPanic(t, conn) + testExecuteBatchShardsPanic(t, conn) testExecuteBatchKeyspaceIdsPanic(t, conn) testStreamExecutePanic(t, conn) testStreamExecuteShardsPanic(t, conn) @@ -954,10 +954,10 @@ func testExecuteEntityIdsPanic(t *testing.T, conn *vtgateconn.VTGateConn) { expectPanic(t, err) } -func testExecuteBatchShard(t *testing.T, conn *vtgateconn.VTGateConn) { +func testExecuteBatchShards(t *testing.T, conn *vtgateconn.VTGateConn) { ctx := newContext() execCase := execMap["request1"] - ql, err := conn.ExecuteBatchShard(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) + ql, err := conn.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) if err != nil { t.Error(err) } @@ -965,31 +965,31 @@ func testExecuteBatchShard(t *testing.T, conn *vtgateconn.VTGateConn) { t.Errorf("Unexpected result from Execute: got %+v want %+v", ql, execCase.reply.Result) } - _, err = conn.ExecuteBatchShard(ctx, []proto.BoundShardQuery{proto.BoundShardQuery{Sql: "none"}}, pb.TabletType_REPLICA, true) + _, err = conn.ExecuteBatchShards(ctx, []proto.BoundShardQuery{proto.BoundShardQuery{Sql: "none"}}, pb.TabletType_REPLICA, true) want := "no match for: none" if err == nil || !strings.Contains(err.Error(), want) { t.Errorf("none request: %v, want %v", err, want) } execCase = execMap["errorRequst"] - _, err = conn.ExecuteBatchShard(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) + _, err = conn.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) want = "app error" if err == nil || err.Error() != want { t.Errorf("errorRequst: %v, want %v", err, want) } } -func testExecuteBatchShardError(t *testing.T, conn *vtgateconn.VTGateConn) { +func testExecuteBatchShardsError(t *testing.T, conn *vtgateconn.VTGateConn) { ctx := newContext() execCase := execMap["request1"] - _, err := conn.ExecuteBatchShard(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) - verifyError(t, err, "ExecuteBatchShard") + _, err := conn.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) + verifyError(t, err, "ExecuteBatchShards") } -func testExecuteBatchShardPanic(t *testing.T, conn *vtgateconn.VTGateConn) { +func testExecuteBatchShardsPanic(t *testing.T, conn *vtgateconn.VTGateConn) { ctx := newContext() execCase := execMap["request1"] - _, err := conn.ExecuteBatchShard(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) + _, err := conn.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) expectPanic(t, err) } @@ -1586,12 +1586,12 @@ func testTxPass(t *testing.T, conn *vtgateconn.VTGateConn) { t.Error(err) } - // ExecuteBatchShard + // ExecuteBatchShards tx, err = conn.Begin(ctx) if err != nil { t.Error(err) } - _, err = tx.ExecuteBatchShard(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) + _, err = tx.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) if err != nil { t.Error(err) } @@ -1643,7 +1643,7 @@ func testTxPassNotInTransaction(t *testing.T, conn *vtgateconn.VTGateConn) { if err != nil { t.Error(err) } - _, err = tx.ExecuteBatchShard(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) + _, err = tx.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) if err != nil { t.Error(err) } @@ -1729,12 +1729,12 @@ func testTx2Pass(t *testing.T, conn *vtgateconn.VTGateConn) { t.Error(err) } - // ExecuteBatchShard + // ExecuteBatchShards tx, err = conn.Begin2(ctx) if err != nil { t.Error(err) } - _, err = tx.ExecuteBatchShard(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) + _, err = tx.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) if err != nil { t.Error(err) } @@ -1787,7 +1787,7 @@ func testTx2PassNotInTransaction(t *testing.T, conn *vtgateconn.VTGateConn) { if err != nil { t.Error(err) } - _, err = tx.ExecuteBatchShard(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) + _, err = tx.ExecuteBatchShards(ctx, execCase.batchQueryShard.Queries, execCase.batchQueryShard.TabletType, execCase.batchQueryShard.AsTransaction) if err != nil { t.Error(err) } @@ -1976,8 +1976,8 @@ func testTxFail(t *testing.T, conn *vtgateconn.VTGateConn) { t.Errorf("ExecuteShards: %v, want %v", err, want) } - _, err = tx.ExecuteBatchShard(ctx, nil, pb.TabletType_REPLICA, false) - want = "executeBatchShard: not in transaction" + _, err = tx.ExecuteBatchShards(ctx, nil, pb.TabletType_REPLICA, false) + want = "executeBatchShards: not in transaction" if err == nil || err.Error() != want { t.Errorf("ExecuteShards: %v, want %v", err, want) } @@ -2053,8 +2053,8 @@ func testTx2Fail(t *testing.T, conn *vtgateconn.VTGateConn) { t.Errorf("ExecuteShards: %v, want %v", err, want) } - _, err = tx.ExecuteBatchShard(ctx, nil, pb.TabletType_REPLICA, false) - want = "executeBatchShard: not in transaction" + _, err = tx.ExecuteBatchShards(ctx, nil, pb.TabletType_REPLICA, false) + want = "executeBatchShards: not in transaction" if err == nil || err.Error() != want { t.Errorf("ExecuteShards: %v, want %v", err, want) }