Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions go/vt/vtgate/fakerpcvtgateconn/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/gorpcvtgateconn/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion go/vt/vtgate/grpcvtgateconn/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 9 additions & 9 deletions go/vt/vtgate/vtgateconn/vtgateconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down
46 changes: 23 additions & 23 deletions go/vt/vtgate/vtgateconntest/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -954,42 +954,42 @@ 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)
}
if !reflect.DeepEqual(&ql[0], execCase.reply.Result) {
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)
}

Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
Expand Down