Merge branch 'master' into status

This commit is contained in:
Liang Guo 2016-05-05 14:22:07 -07:00
Родитель b5196b6a96 fe3591f613
Коммит 0d4b8fe87b
52 изменённых файлов: 1653 добавлений и 1277 удалений

Просмотреть файл

@ -104,6 +104,14 @@ proto: install_protoc-gen-go
find go/vt/proto -name "*.pb.go" | xargs sed --in-place -r -e 's,import ([a-z0-9_]+) ".",import \1 "github.com/youtube/vitess/go/vt/proto/\1",g'
find proto -maxdepth 1 -name '*.proto' -print | sed 's/^proto\///' | sed 's/\.proto//' | xargs -I{} $$VTROOT/dist/grpc/usr/local/bin/protoc -Iproto proto/{}.proto --python_out=py/vtproto --grpc_out=py/vtproto --plugin=protoc-gen-grpc=$$VTROOT/dist/grpc/usr/local/bin/grpc_python_plugin
# build a new image, create the PHP proto files, and copy them back.
php_proto: docker_php_proto
docker run -ti --name=vitess_php-proto vitess/php-proto bash -c 'tools/proto-gen-php.sh'
docker cp vitess_php-proto:/vt/src/github.com/youtube/vitess/php/src/descriptor.php php/src/
docker cp vitess_php-proto:/vt/src/github.com/youtube/vitess/php/src/php.php php/src/
docker cp vitess_php-proto:/vt/src/github.com/youtube/vitess/php/src/Vitess/Proto/. php/src/Vitess/Proto/
docker rm vitess_php-proto
# This rule builds the bootstrap images for all flavors.
docker_bootstrap:
docker/bootstrap/build.sh common
@ -142,6 +150,9 @@ docker_etcd:
docker_publish_site:
docker build -f docker/publish-site/Dockerfile -t vitess/publish-site .
docker_php_proto:
docker build -f docker/php-proto/Dockerfile -t vitess/php-proto .
# This rule loads the working copy of the code into a bootstrap image,
# and then runs the tests inside Docker.
# Example: $ make docker_test flavor=mariadb

Просмотреть файл

@ -0,0 +1,25 @@
FROM vitess/bootstrap:mariadb
USER root
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
rubygems \
ruby-dev
RUN gem install rake ronn
# copy proto files
COPY proto /vt/src/github.com/youtube/vitess/proto
RUN chown -R vitess:vitess /vt/src/github.com/youtube/vitess/proto
# install necessary packages for proto compiler
WORKDIR /vt
RUN git clone https://github.com/stanley-cheung/Protobuf-PHP
WORKDIR /vt/Protobuf-PHP
RUN rake pear:package version=1.0
RUN pear install Protobuf-1.0.tgz
# Bootstrap Vitess
WORKDIR /vt/src/github.com/youtube/vitess
USER vitess
ENV MYSQL_FLAVOR MariaDB

Просмотреть файл

@ -238,7 +238,7 @@ func (itc *internalTabletConn) Execute(ctx context.Context, query string, bindVa
Keyspace: itc.tablet.keyspace,
Shard: itc.tablet.shard,
TabletType: itc.tablet.tabletType,
}, query, bindVars, 0, transactionID)
}, query, bindVars, transactionID)
if err != nil {
return nil, tabletconn.TabletErrorFromGRPC(tabletserver.ToGRPCError(err))
}
@ -265,7 +265,7 @@ func (itc *internalTabletConn) ExecuteBatch(ctx context.Context, queries []query
Keyspace: itc.tablet.keyspace,
Shard: itc.tablet.shard,
TabletType: itc.tablet.tabletType,
}, q, 0, asTransaction, transactionID)
}, q, asTransaction, transactionID)
if err != nil {
return nil, tabletconn.TabletErrorFromGRPC(tabletserver.ToGRPCError(err))
}
@ -307,7 +307,7 @@ func (itc *internalTabletConn) StreamExecute(ctx context.Context, query string,
Keyspace: itc.tablet.keyspace,
Shard: itc.tablet.shard,
TabletType: itc.tablet.tabletType,
}, query, bindVars, 0, func(reply *sqltypes.Result) error {
}, query, bindVars, func(reply *sqltypes.Result) error {
// We need to deep-copy the reply before returning,
// because the underlying buffers are reused.
result <- reply.Copy()
@ -328,7 +328,7 @@ func (itc *internalTabletConn) Begin(ctx context.Context) (int64, error) {
Keyspace: itc.tablet.keyspace,
Shard: itc.tablet.shard,
TabletType: itc.tablet.tabletType,
}, 0)
})
if err != nil {
return 0, tabletconn.TabletErrorFromGRPC(tabletserver.ToGRPCError(err))
}
@ -341,7 +341,7 @@ func (itc *internalTabletConn) Commit(ctx context.Context, transactionID int64)
Keyspace: itc.tablet.keyspace,
Shard: itc.tablet.shard,
TabletType: itc.tablet.tabletType,
}, 0, transactionID)
}, transactionID)
return tabletconn.TabletErrorFromGRPC(tabletserver.ToGRPCError(err))
}
@ -351,7 +351,7 @@ func (itc *internalTabletConn) Rollback(ctx context.Context, transactionID int64
Keyspace: itc.tablet.keyspace,
Shard: itc.tablet.shard,
TabletType: itc.tablet.tabletType,
}, 0, transactionID)
}, transactionID)
return tabletconn.TabletErrorFromGRPC(tabletserver.ToGRPCError(err))
}
@ -395,7 +395,7 @@ func (itc *internalTabletConn) SplitQuery(ctx context.Context, query querytypes.
Keyspace: itc.tablet.keyspace,
Shard: itc.tablet.shard,
TabletType: itc.tablet.tabletType,
}, query.Sql, query.BindVariables, splitColumn, splitCount, 0)
}, query.Sql, query.BindVariables, splitColumn, splitCount)
if err != nil {
return nil, tabletconn.TabletErrorFromGRPC(tabletserver.ToGRPCError(err))
}
@ -424,8 +424,7 @@ func (itc *internalTabletConn) SplitQueryV2(
splitColumns,
splitCount,
numRowsPerQueryPart,
algorithm,
0 /* SessionID */)
algorithm)
if err != nil {
return nil, tabletconn.TabletErrorFromGRPC(tabletserver.ToGRPCError(err))
}

Просмотреть файл

@ -92,7 +92,7 @@ func trimmedRequestToError(received string) error {
case "integrity error":
return vterrors.FromError(
vtrpcpb.ErrorCode_INTEGRITY_ERROR,
errors.New("vtgate test client forced error: integrity error (errno 1062)"),
errors.New("vtgate test client forced error: integrity error (errno 1062) (sqlstate 23000)"),
)
// request backlog and general throttling type errors
case "transient error":

Просмотреть файл

@ -216,7 +216,7 @@ func (conn *Connection) IsClosed() bool {
// ExecuteFetch executes the query on the connection
func (conn *Connection) ExecuteFetch(query string, maxrows int, wantfields bool) (qr *sqltypes.Result, err error) {
if conn.IsClosed() {
return nil, sqldb.NewSQLError(2006, "Connection is closed")
return nil, sqldb.NewSQLError(2006, "", "Connection is closed")
}
if C.vt_execute(&conn.c, (*C.char)(hack.StringPointer(query)), C.ulong(len(query)), 0) != 0 {
@ -273,7 +273,7 @@ func (conn *Connection) ExecuteFetchMap(query string) (map[string]string, error)
// on the Connection until it returns nil or error
func (conn *Connection) ExecuteStreamFetch(query string) (err error) {
if conn.IsClosed() {
return sqldb.NewSQLError(2006, "Connection is closed")
return sqldb.NewSQLError(2006, "", "Connection is closed")
}
if C.vt_execute(&conn.c, (*C.char)(hack.StringPointer(query)), C.ulong(len(query)), 1) != 0 {
return conn.lastError(query)
@ -379,12 +379,14 @@ func (conn *Connection) lastError(query string) error {
if err := C.vt_error(&conn.c); *err != 0 {
return &sqldb.SQLError{
Num: int(C.vt_errno(&conn.c)),
State: C.GoString(C.vt_sqlstate(&conn.c)),
Message: C.GoString(err),
Query: query,
}
}
return &sqldb.SQLError{
Num: 0,
State: sqldb.SQLStateGeneral,
Message: "Dummy",
Query: string(query),
}

Просмотреть файл

@ -142,6 +142,11 @@ const char *vt_error(VT_CONN *conn) {
return mysql_error(conn->mysql);
}
const char *vt_sqlstate(VT_CONN *conn) {
mysql_thread_init();
return mysql_sqlstate(conn->mysql);
}
my_bool vt_simple_command(
VT_CONN *conn,
enum enum_server_command command,

Просмотреть файл

@ -50,6 +50,7 @@ extern void vt_close_result(VT_CONN *conn);
extern unsigned long vt_thread_id(VT_CONN *conn);
extern unsigned int vt_errno(VT_CONN *conn);
extern const char *vt_error(VT_CONN *conn);
extern const char *vt_sqlstate(VT_CONN *conn);
// vt_simple_command: Calls MySQL simple_command macro to send raw commands.
my_bool vt_simple_command(

Просмотреть файл

@ -4,29 +4,59 @@
package sqldb
import "fmt"
import (
"bytes"
"fmt"
)
const (
// SQLStateGeneral is the SQLSTATE value for "general error".
SQLStateGeneral = "HY000"
)
// SQLError is the error structure returned from calling a db library function
type SQLError struct {
Num int
State string
Message string
Query string
}
// NewSQLError returns a new SQLError
func NewSQLError(number int, format string, args ...interface{}) *SQLError {
return &SQLError{Num: number, Message: fmt.Sprintf(format, args...)}
// NewSQLError creates a new SQLError.
// If sqlState is left empty, it will default to "HY000" (general error).
func NewSQLError(number int, sqlState string, format string, args ...interface{}) *SQLError {
if sqlState == "" {
sqlState = SQLStateGeneral
}
return &SQLError{
Num: number,
State: sqlState,
Message: fmt.Sprintf(format, args...),
}
}
// Error implements the error interface
func (se *SQLError) Error() string {
if se.Query == "" {
return fmt.Sprintf("%v (errno %v)", se.Message, se.Num)
buf := &bytes.Buffer{}
buf.WriteString(se.Message)
// Add MySQL errno and SQLSTATE in a format that we can later parse.
// There's no avoiding string parsing because all errors
// are converted to strings anyway at RPC boundaries.
fmt.Fprintf(buf, " (errno %v) (sqlstate %v)", se.Num, se.State)
if se.Query != "" {
fmt.Fprintf(buf, " during query: %s", se.Query)
}
return fmt.Sprintf("%v (errno %v) during query: %s", se.Message, se.Num, se.Query)
return buf.String()
}
// Number returns the internal mysql error code
// Number returns the internal MySQL error code.
func (se *SQLError) Number() int {
return se.Num
}
// SQLState returns the SQLSTATE value.
func (se *SQLError) SQLState() string {
return se.State
}

Просмотреть файл

@ -17,8 +17,6 @@ It has these top-level messages:
Field
Row
QueryResult
GetSessionIdRequest
GetSessionIdResponse
ExecuteRequest
ExecuteResponse
ExecuteBatchRequest
@ -279,7 +277,7 @@ func (x SplitQueryRequest_Algorithm) String() string {
return proto.EnumName(SplitQueryRequest_Algorithm_name, int32(x))
}
func (SplitQueryRequest_Algorithm) EnumDescriptor() ([]byte, []int) {
return fileDescriptor0, []int{26, 0}
return fileDescriptor0, []int{24, 0}
}
// Target describes what the client expects the tablet is.
@ -427,43 +425,6 @@ func (m *QueryResult) GetRows() []*Row {
return nil
}
// GetSessionIdRequest is the payload to GetSessionId
type GetSessionIdRequest struct {
EffectiveCallerId *vtrpc.CallerID `protobuf:"bytes,1,opt,name=effective_caller_id,json=effectiveCallerId" json:"effective_caller_id,omitempty"`
ImmediateCallerId *VTGateCallerID `protobuf:"bytes,2,opt,name=immediate_caller_id,json=immediateCallerId" json:"immediate_caller_id,omitempty"`
Keyspace string `protobuf:"bytes,3,opt,name=keyspace" json:"keyspace,omitempty"`
Shard string `protobuf:"bytes,4,opt,name=shard" json:"shard,omitempty"`
}
func (m *GetSessionIdRequest) Reset() { *m = GetSessionIdRequest{} }
func (m *GetSessionIdRequest) String() string { return proto.CompactTextString(m) }
func (*GetSessionIdRequest) ProtoMessage() {}
func (*GetSessionIdRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
func (m *GetSessionIdRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
return m.EffectiveCallerId
}
return nil
}
func (m *GetSessionIdRequest) GetImmediateCallerId() *VTGateCallerID {
if m != nil {
return m.ImmediateCallerId
}
return nil
}
// GetSessionIdResponse is the returned value from GetSessionId
type GetSessionIdResponse struct {
SessionId int64 `protobuf:"varint,1,opt,name=session_id,json=sessionId" json:"session_id,omitempty"`
}
func (m *GetSessionIdResponse) Reset() { *m = GetSessionIdResponse{} }
func (m *GetSessionIdResponse) String() string { return proto.CompactTextString(m) }
func (*GetSessionIdResponse) ProtoMessage() {}
func (*GetSessionIdResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
// ExecuteRequest is the payload to Execute
type ExecuteRequest struct {
EffectiveCallerId *vtrpc.CallerID `protobuf:"bytes,1,opt,name=effective_caller_id,json=effectiveCallerId" json:"effective_caller_id,omitempty"`
@ -471,13 +432,12 @@ type ExecuteRequest struct {
Target *Target `protobuf:"bytes,3,opt,name=target" json:"target,omitempty"`
Query *BoundQuery `protobuf:"bytes,4,opt,name=query" json:"query,omitempty"`
TransactionId int64 `protobuf:"varint,5,opt,name=transaction_id,json=transactionId" json:"transaction_id,omitempty"`
SessionId int64 `protobuf:"varint,6,opt,name=session_id,json=sessionId" json:"session_id,omitempty"`
}
func (m *ExecuteRequest) Reset() { *m = ExecuteRequest{} }
func (m *ExecuteRequest) String() string { return proto.CompactTextString(m) }
func (*ExecuteRequest) ProtoMessage() {}
func (*ExecuteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
func (*ExecuteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
func (m *ExecuteRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -515,7 +475,7 @@ type ExecuteResponse struct {
func (m *ExecuteResponse) Reset() { *m = ExecuteResponse{} }
func (m *ExecuteResponse) String() string { return proto.CompactTextString(m) }
func (*ExecuteResponse) ProtoMessage() {}
func (*ExecuteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
func (*ExecuteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (m *ExecuteResponse) GetResult() *QueryResult {
if m != nil {
@ -532,13 +492,12 @@ type ExecuteBatchRequest struct {
Queries []*BoundQuery `protobuf:"bytes,4,rep,name=queries" json:"queries,omitempty"`
AsTransaction bool `protobuf:"varint,5,opt,name=as_transaction,json=asTransaction" json:"as_transaction,omitempty"`
TransactionId int64 `protobuf:"varint,6,opt,name=transaction_id,json=transactionId" json:"transaction_id,omitempty"`
SessionId int64 `protobuf:"varint,7,opt,name=session_id,json=sessionId" json:"session_id,omitempty"`
}
func (m *ExecuteBatchRequest) Reset() { *m = ExecuteBatchRequest{} }
func (m *ExecuteBatchRequest) String() string { return proto.CompactTextString(m) }
func (*ExecuteBatchRequest) ProtoMessage() {}
func (*ExecuteBatchRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
func (*ExecuteBatchRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
func (m *ExecuteBatchRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -576,7 +535,7 @@ type ExecuteBatchResponse struct {
func (m *ExecuteBatchResponse) Reset() { *m = ExecuteBatchResponse{} }
func (m *ExecuteBatchResponse) String() string { return proto.CompactTextString(m) }
func (*ExecuteBatchResponse) ProtoMessage() {}
func (*ExecuteBatchResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
func (*ExecuteBatchResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
func (m *ExecuteBatchResponse) GetResults() []*QueryResult {
if m != nil {
@ -591,13 +550,12 @@ type StreamExecuteRequest struct {
ImmediateCallerId *VTGateCallerID `protobuf:"bytes,2,opt,name=immediate_caller_id,json=immediateCallerId" json:"immediate_caller_id,omitempty"`
Target *Target `protobuf:"bytes,3,opt,name=target" json:"target,omitempty"`
Query *BoundQuery `protobuf:"bytes,4,opt,name=query" json:"query,omitempty"`
SessionId int64 `protobuf:"varint,5,opt,name=session_id,json=sessionId" json:"session_id,omitempty"`
}
func (m *StreamExecuteRequest) Reset() { *m = StreamExecuteRequest{} }
func (m *StreamExecuteRequest) String() string { return proto.CompactTextString(m) }
func (*StreamExecuteRequest) ProtoMessage() {}
func (*StreamExecuteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
func (*StreamExecuteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} }
func (m *StreamExecuteRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -635,7 +593,7 @@ type StreamExecuteResponse struct {
func (m *StreamExecuteResponse) Reset() { *m = StreamExecuteResponse{} }
func (m *StreamExecuteResponse) String() string { return proto.CompactTextString(m) }
func (*StreamExecuteResponse) ProtoMessage() {}
func (*StreamExecuteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
func (*StreamExecuteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} }
func (m *StreamExecuteResponse) GetResult() *QueryResult {
if m != nil {
@ -649,13 +607,12 @@ type BeginRequest struct {
EffectiveCallerId *vtrpc.CallerID `protobuf:"bytes,1,opt,name=effective_caller_id,json=effectiveCallerId" json:"effective_caller_id,omitempty"`
ImmediateCallerId *VTGateCallerID `protobuf:"bytes,2,opt,name=immediate_caller_id,json=immediateCallerId" json:"immediate_caller_id,omitempty"`
Target *Target `protobuf:"bytes,3,opt,name=target" json:"target,omitempty"`
SessionId int64 `protobuf:"varint,4,opt,name=session_id,json=sessionId" json:"session_id,omitempty"`
}
func (m *BeginRequest) Reset() { *m = BeginRequest{} }
func (m *BeginRequest) String() string { return proto.CompactTextString(m) }
func (*BeginRequest) ProtoMessage() {}
func (*BeginRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
func (*BeginRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
func (m *BeginRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -686,7 +643,7 @@ type BeginResponse struct {
func (m *BeginResponse) Reset() { *m = BeginResponse{} }
func (m *BeginResponse) String() string { return proto.CompactTextString(m) }
func (*BeginResponse) ProtoMessage() {}
func (*BeginResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }
func (*BeginResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} }
// CommitRequest is the payload to Commit
type CommitRequest struct {
@ -694,13 +651,12 @@ type CommitRequest struct {
ImmediateCallerId *VTGateCallerID `protobuf:"bytes,2,opt,name=immediate_caller_id,json=immediateCallerId" json:"immediate_caller_id,omitempty"`
Target *Target `protobuf:"bytes,3,opt,name=target" json:"target,omitempty"`
TransactionId int64 `protobuf:"varint,4,opt,name=transaction_id,json=transactionId" json:"transaction_id,omitempty"`
SessionId int64 `protobuf:"varint,5,opt,name=session_id,json=sessionId" json:"session_id,omitempty"`
}
func (m *CommitRequest) Reset() { *m = CommitRequest{} }
func (m *CommitRequest) String() string { return proto.CompactTextString(m) }
func (*CommitRequest) ProtoMessage() {}
func (*CommitRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
func (*CommitRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} }
func (m *CommitRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -730,7 +686,7 @@ type CommitResponse struct {
func (m *CommitResponse) Reset() { *m = CommitResponse{} }
func (m *CommitResponse) String() string { return proto.CompactTextString(m) }
func (*CommitResponse) ProtoMessage() {}
func (*CommitResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} }
func (*CommitResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} }
// RollbackRequest is the payload to Rollback
type RollbackRequest struct {
@ -738,13 +694,12 @@ type RollbackRequest struct {
ImmediateCallerId *VTGateCallerID `protobuf:"bytes,2,opt,name=immediate_caller_id,json=immediateCallerId" json:"immediate_caller_id,omitempty"`
Target *Target `protobuf:"bytes,3,opt,name=target" json:"target,omitempty"`
TransactionId int64 `protobuf:"varint,4,opt,name=transaction_id,json=transactionId" json:"transaction_id,omitempty"`
SessionId int64 `protobuf:"varint,5,opt,name=session_id,json=sessionId" json:"session_id,omitempty"`
}
func (m *RollbackRequest) Reset() { *m = RollbackRequest{} }
func (m *RollbackRequest) String() string { return proto.CompactTextString(m) }
func (*RollbackRequest) ProtoMessage() {}
func (*RollbackRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
func (*RollbackRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
func (m *RollbackRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -774,7 +729,7 @@ type RollbackResponse struct {
func (m *RollbackResponse) Reset() { *m = RollbackResponse{} }
func (m *RollbackResponse) String() string { return proto.CompactTextString(m) }
func (*RollbackResponse) ProtoMessage() {}
func (*RollbackResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
func (*RollbackResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} }
// BeginExecuteRequest is the payload to BeginExecute
type BeginExecuteRequest struct {
@ -787,7 +742,7 @@ type BeginExecuteRequest struct {
func (m *BeginExecuteRequest) Reset() { *m = BeginExecuteRequest{} }
func (m *BeginExecuteRequest) String() string { return proto.CompactTextString(m) }
func (*BeginExecuteRequest) ProtoMessage() {}
func (*BeginExecuteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
func (*BeginExecuteRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} }
func (m *BeginExecuteRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -831,7 +786,7 @@ type BeginExecuteResponse struct {
func (m *BeginExecuteResponse) Reset() { *m = BeginExecuteResponse{} }
func (m *BeginExecuteResponse) String() string { return proto.CompactTextString(m) }
func (*BeginExecuteResponse) ProtoMessage() {}
func (*BeginExecuteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
func (*BeginExecuteResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} }
func (m *BeginExecuteResponse) GetError() *vtrpc.RPCError {
if m != nil {
@ -859,7 +814,7 @@ type BeginExecuteBatchRequest struct {
func (m *BeginExecuteBatchRequest) Reset() { *m = BeginExecuteBatchRequest{} }
func (m *BeginExecuteBatchRequest) String() string { return proto.CompactTextString(m) }
func (*BeginExecuteBatchRequest) ProtoMessage() {}
func (*BeginExecuteBatchRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }
func (*BeginExecuteBatchRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} }
func (m *BeginExecuteBatchRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -903,7 +858,7 @@ type BeginExecuteBatchResponse struct {
func (m *BeginExecuteBatchResponse) Reset() { *m = BeginExecuteBatchResponse{} }
func (m *BeginExecuteBatchResponse) String() string { return proto.CompactTextString(m) }
func (*BeginExecuteBatchResponse) ProtoMessage() {}
func (*BeginExecuteBatchResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
func (*BeginExecuteBatchResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} }
func (m *BeginExecuteBatchResponse) GetError() *vtrpc.RPCError {
if m != nil {
@ -930,7 +885,6 @@ type SplitQueryRequest struct {
// Exactly one of the following must be nonzero.
SplitCount int64 `protobuf:"varint,6,opt,name=split_count,json=splitCount" json:"split_count,omitempty"`
NumRowsPerQueryPart int64 `protobuf:"varint,8,opt,name=num_rows_per_query_part,json=numRowsPerQueryPart" json:"num_rows_per_query_part,omitempty"`
SessionId int64 `protobuf:"varint,7,opt,name=session_id,json=sessionId" json:"session_id,omitempty"`
Algorithm SplitQueryRequest_Algorithm `protobuf:"varint,9,opt,name=algorithm,enum=query.SplitQueryRequest_Algorithm" json:"algorithm,omitempty"`
// Whether to use the new split-query code
// that supports multiple split-columns and
@ -946,7 +900,7 @@ type SplitQueryRequest struct {
func (m *SplitQueryRequest) Reset() { *m = SplitQueryRequest{} }
func (m *SplitQueryRequest) String() string { return proto.CompactTextString(m) }
func (*SplitQueryRequest) ProtoMessage() {}
func (*SplitQueryRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }
func (*SplitQueryRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} }
func (m *SplitQueryRequest) GetEffectiveCallerId() *vtrpc.CallerID {
if m != nil {
@ -987,7 +941,7 @@ type QuerySplit struct {
func (m *QuerySplit) Reset() { *m = QuerySplit{} }
func (m *QuerySplit) String() string { return proto.CompactTextString(m) }
func (*QuerySplit) ProtoMessage() {}
func (*QuerySplit) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }
func (*QuerySplit) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} }
func (m *QuerySplit) GetQuery() *BoundQuery {
if m != nil {
@ -1005,7 +959,7 @@ type SplitQueryResponse struct {
func (m *SplitQueryResponse) Reset() { *m = SplitQueryResponse{} }
func (m *SplitQueryResponse) String() string { return proto.CompactTextString(m) }
func (*SplitQueryResponse) ProtoMessage() {}
func (*SplitQueryResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
func (*SplitQueryResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} }
func (m *SplitQueryResponse) GetQueries() []*QuerySplit {
if m != nil {
@ -1021,7 +975,7 @@ type StreamHealthRequest struct {
func (m *StreamHealthRequest) Reset() { *m = StreamHealthRequest{} }
func (m *StreamHealthRequest) String() string { return proto.CompactTextString(m) }
func (*StreamHealthRequest) ProtoMessage() {}
func (*StreamHealthRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
func (*StreamHealthRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} }
// RealtimeStats contains information about the tablet status
type RealtimeStats struct {
@ -1057,7 +1011,7 @@ type RealtimeStats struct {
func (m *RealtimeStats) Reset() { *m = RealtimeStats{} }
func (m *RealtimeStats) String() string { return proto.CompactTextString(m) }
func (*RealtimeStats) ProtoMessage() {}
func (*RealtimeStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} }
func (*RealtimeStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} }
// StreamHealthResponse is streamed by StreamHealth on a regular basis
type StreamHealthResponse struct {
@ -1081,7 +1035,7 @@ type StreamHealthResponse struct {
func (m *StreamHealthResponse) Reset() { *m = StreamHealthResponse{} }
func (m *StreamHealthResponse) String() string { return proto.CompactTextString(m) }
func (*StreamHealthResponse) ProtoMessage() {}
func (*StreamHealthResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} }
func (*StreamHealthResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} }
func (m *StreamHealthResponse) GetTarget() *Target {
if m != nil {
@ -1106,8 +1060,6 @@ func init() {
proto.RegisterType((*Field)(nil), "query.Field")
proto.RegisterType((*Row)(nil), "query.Row")
proto.RegisterType((*QueryResult)(nil), "query.QueryResult")
proto.RegisterType((*GetSessionIdRequest)(nil), "query.GetSessionIdRequest")
proto.RegisterType((*GetSessionIdResponse)(nil), "query.GetSessionIdResponse")
proto.RegisterType((*ExecuteRequest)(nil), "query.ExecuteRequest")
proto.RegisterType((*ExecuteResponse)(nil), "query.ExecuteResponse")
proto.RegisterType((*ExecuteBatchRequest)(nil), "query.ExecuteBatchRequest")
@ -1136,113 +1088,108 @@ func init() {
}
var fileDescriptor0 = []byte{
// 1717 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xec, 0x58, 0x5b, 0x73, 0xeb, 0x48,
0x11, 0x46, 0xf2, 0x25, 0x76, 0x3b, 0x76, 0x94, 0xb1, 0x03, 0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, 0x9c, 0xce, 0x07, 0xa4, 0x76, 0xe9, 0x50, 0x76, 0xad, 0x86,
0xdf, 0x7f, 0x07, 0x59, 0xf1, 0xf3, 0xd2, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x87, 0x97, 0xc9,
0x7a, 0x39, 0x16, 0x00, 0x00,
// 1644 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xec, 0x58, 0xdd, 0x73, 0xdb, 0xc6,
0x11, 0x2f, 0xf8, 0x25, 0x72, 0x29, 0x52, 0xd0, 0x51, 0x6a, 0x59, 0xb5, 0xd3, 0xba, 0xb0, 0xeb,
0xba, 0xaa, 0x87, 0xa3, 0xd2, 0xae, 0xeb, 0xe9, 0xa7, 0x49, 0x0a, 0xb2, 0x39, 0x95, 0x28, 0xfa,
0x08, 0x6a, 0xea, 0xbe, 0x60, 0x20, 0xf2, 0x44, 0x61, 0x04, 0x12, 0x14, 0x70, 0x94, 0xad, 0x37,
0xd5, 0xfd, 0xfe, 0xb4, 0x33, 0x89, 0xe3, 0x7c, 0x4c, 0x9e, 0xf2, 0x77, 0x64, 0x32, 0x93, 0xff,
0x25, 0x93, 0xc9, 0x43, 0x92, 0x7f, 0x21, 0x77, 0x87, 0x03, 0x08, 0x59, 0x4c, 0x9c, 0xf8, 0xcd,
0x76, 0x9e, 0x78, 0xbb, 0xbf, 0xbd, 0xdb, 0xdd, 0xdf, 0xee, 0x02, 0x38, 0x42, 0xfe, 0x70, 0x42,
0xbc, 0xe3, 0xca, 0xd8, 0x73, 0xa9, 0x8b, 0xd2, 0x42, 0x58, 0x29, 0x52, 0x77, 0xec, 0xf6, 0x2d,
0x6a, 0x05, 0xea, 0x95, 0xfc, 0x11, 0xf5, 0xc6, 0xbd, 0x40, 0xd0, 0x0e, 0x21, 0x63, 0x58, 0xde,
0x80, 0x50, 0xb4, 0x02, 0xd9, 0x03, 0x72, 0xec, 0x8f, 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xdd, 0x8c, 0xf8, 0xb9, 0xf2, 0x79, 0x00,
0x00, 0x00, 0xff, 0xff, 0xfc, 0xa2, 0x82, 0x47, 0x57, 0x14, 0x00, 0x00,
}

Просмотреть файл

@ -42,10 +42,6 @@ const _ = grpc.SupportPackageIsVersion2
// Client API for Query service
type QueryClient interface {
// GetSessionId gets a session id from the server. This call is being
// deprecated in favor of using the Target field of the subsequent
// queries, but is still here for backward compatibility.
GetSessionId(ctx context.Context, in *query.GetSessionIdRequest, opts ...grpc.CallOption) (*query.GetSessionIdResponse, error)
// Execute executes the specified SQL query (might be in a
// transaction context, if Query.transaction_id is set).
Execute(ctx context.Context, in *query.ExecuteRequest, opts ...grpc.CallOption) (*query.ExecuteResponse, error)
@ -83,15 +79,6 @@ func NewQueryClient(cc *grpc.ClientConn) QueryClient {
return &queryClient{cc}
}
func (c *queryClient) GetSessionId(ctx context.Context, in *query.GetSessionIdRequest, opts ...grpc.CallOption) (*query.GetSessionIdResponse, error) {
out := new(query.GetSessionIdResponse)
err := grpc.Invoke(ctx, "/queryservice.Query/GetSessionId", in, out, c.cc, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *queryClient) Execute(ctx context.Context, in *query.ExecuteRequest, opts ...grpc.CallOption) (*query.ExecuteResponse, error) {
out := new(query.ExecuteResponse)
err := grpc.Invoke(ctx, "/queryservice.Query/Execute", in, out, c.cc, opts...)
@ -231,10 +218,6 @@ func (x *queryStreamHealthClient) Recv() (*query.StreamHealthResponse, error) {
// Server API for Query service
type QueryServer interface {
// GetSessionId gets a session id from the server. This call is being
// deprecated in favor of using the Target field of the subsequent
// queries, but is still here for backward compatibility.
GetSessionId(context.Context, *query.GetSessionIdRequest) (*query.GetSessionIdResponse, error)
// Execute executes the specified SQL query (might be in a
// transaction context, if Query.transaction_id is set).
Execute(context.Context, *query.ExecuteRequest) (*query.ExecuteResponse, error)
@ -268,24 +251,6 @@ func RegisterQueryServer(s *grpc.Server, srv QueryServer) {
s.RegisterService(&_Query_serviceDesc, srv)
}
func _Query_GetSessionId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(query.GetSessionIdRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(QueryServer).GetSessionId(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/queryservice.Query/GetSessionId",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(QueryServer).GetSessionId(ctx, req.(*query.GetSessionIdRequest))
}
return interceptor(ctx, in, info, handler)
}
func _Query_Execute_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(query.ExecuteRequest)
if err := dec(in); err != nil {
@ -476,10 +441,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{
ServiceName: "queryservice.Query",
HandlerType: (*QueryServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetSessionId",
Handler: _Query_GetSessionId_Handler,
},
{
MethodName: "Execute",
Handler: _Query_Execute_Handler,
@ -528,25 +489,24 @@ var _Query_serviceDesc = grpc.ServiceDesc{
}
var fileDescriptor0 = []byte{
// 313 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x93, 0xcf, 0x4a, 0xc3, 0x40,
0x10, 0xc6, 0xf5, 0xd0, 0x28, 0x63, 0x3c, 0x38, 0x5a, 0xff, 0xa4, 0x82, 0xe2, 0x03, 0x14, 0x51,
0x41, 0x10, 0xbc, 0xb4, 0x88, 0x16, 0x41, 0xb0, 0xb9, 0x78, 0x4d, 0xe3, 0xa0, 0xc1, 0x24, 0x1b,
0xb3, 0x5b, 0xd1, 0x97, 0xf0, 0x99, 0xad, 0xd9, 0xcc, 0x76, 0xb3, 0xae, 0xc7, 0xf9, 0x7d, 0x33,
0x1f, 0xdf, 0x64, 0x36, 0x80, 0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
0xdf, 0x60, 0x9c, 0xc7, 0x00, 0x71, 0x95, 0x67, 0x4a, 0x3f, 0xc1, 0x7d, 0x3e, 0x81, 0x41, 0xec,
0x75, 0xe0, 0x51, 0x8c, 0xc9, 0x3d, 0x84, 0xfa, 0x68, 0x77, 0x94, 0xe4, 0x6a, 0xf9, 0x64, 0x6c,
0xe8, 0x6e, 0xda, 0xd5, 0x96, 0x47, 0x9e, 0x05, 0xcd, 0x7f, 0x71, 0xfe, 0x13, 0x00, 0x00, 0xff,
0xff, 0x80, 0xaa, 0x0c, 0xf7, 0x48, 0x03, 0x00, 0x00,
// 293 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x74, 0x92, 0xcf, 0x4a, 0xc3, 0x40,
0x10, 0xc6, 0xf5, 0x90, 0x2a, 0x63, 0x3c, 0x38, 0x5a, 0xff, 0xa4, 0x82, 0xe2, 0x03, 0x14, 0x51,
0x41, 0x10, 0xbc, 0xb4, 0x08, 0x8a, 0x20, 0xd8, 0x5e, 0xbc, 0xa6, 0x61, 0xd0, 0x60, 0xd2, 0x8d,
0xc9, 0x54, 0xf4, 0xf9, 0x7c, 0x31, 0x75, 0x37, 0xb3, 0xdd, 0x8d, 0xeb, 0x71, 0x7e, 0xdf, 0x37,
0x1f, 0xb3, 0x3b, 0x03, 0xf8, 0xb6, 0xa0, 0xfa, 0xb3, 0xa1, 0xfa, 0x3d, 0xcf, 0x68, 0x58, 0xd5,
0x8a, 0x15, 0xc6, 0x2e, 0x4b, 0x36, 0x74, 0x65, 0xa4, 0xb3, 0xaf, 0x08, 0xa2, 0xc7, 0xdf, 0x1a,
0xaf, 0x60, 0xed, 0xe6, 0x83, 0xb2, 0x05, 0x13, 0xf6, 0x87, 0xc6, 0xd2, 0xd6, 0x13, 0xfa, 0x29,
0x1b, 0x4e, 0x76, 0xbb, 0xb8, 0xa9, 0xd4, 0xbc, 0xa1, 0x93, 0x15, 0xbc, 0x83, 0xb8, 0x85, 0xa3,
0x94, 0xb3, 0x17, 0x4c, 0x7c, 0xa7, 0x86, 0x92, 0x32, 0x08, 0x6a, 0x36, 0xea, 0x01, 0x36, 0xa7,
0x5c, 0x53, 0x5a, 0xca, 0x30, 0xe2, 0xf7, 0xa8, 0x84, 0x1d, 0x86, 0x45, 0x49, 0x3b, 0x5d, 0xc5,
0x0b, 0x88, 0x46, 0xf4, 0x9c, 0xcf, 0x71, 0xbb, 0xb5, 0xea, 0x4a, 0xfa, 0x77, 0x7c, 0x68, 0xa7,
0xb8, 0x84, 0xde, 0x58, 0x95, 0x65, 0xce, 0x28, 0x0e, 0x53, 0x4a, 0x5f, 0xbf, 0x43, 0x6d, 0xe3,
0x35, 0xac, 0x4f, 0x54, 0x51, 0xcc, 0xd2, 0xec, 0x15, 0xe5, 0xbf, 0x04, 0x48, 0xf3, 0xde, 0x1f,
0xee, 0x7e, 0xa4, 0x1e, 0x45, 0x1e, 0x9f, 0xb8, 0xf3, 0x75, 0xde, 0x3e, 0x08, 0x6a, 0x36, 0xea,
0x09, 0xb6, 0x5c, 0xc5, 0x2c, 0xe6, 0x28, 0xd0, 0xe3, 0x6d, 0xe7, 0xf8, 0x7f, 0x83, 0x4d, 0x1e,
0x03, 0x4c, 0xab, 0x22, 0x67, 0x73, 0x37, 0xfb, 0xb2, 0x02, 0x8b, 0x24, 0xeb, 0x20, 0xa0, 0xd8,
0x90, 0x7b, 0x88, 0xcd, 0xd2, 0x6e, 0x29, 0x2d, 0x78, 0x79, 0x32, 0x2e, 0xec, 0xbe, 0xd4, 0xd7,
0x96, 0x4b, 0x9e, 0xf5, 0xf4, 0x31, 0x9f, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0xc1, 0xe2, 0xe9,
0x0d, 0xfd, 0x02, 0x00, 0x00,
}

Просмотреть файл

@ -45,7 +45,7 @@ func (client *QueryClient) Begin() error {
if client.transactionID != 0 {
return errors.New("already in transaction")
}
transactionID, err := client.server.Begin(client.ctx, &client.target, 0)
transactionID, err := client.server.Begin(client.ctx, &client.target)
if err != nil {
return err
}
@ -56,13 +56,13 @@ func (client *QueryClient) Begin() error {
// Commit commits the current transaction.
func (client *QueryClient) Commit() error {
defer func() { client.transactionID = 0 }()
return client.server.Commit(client.ctx, &client.target, 0, client.transactionID)
return client.server.Commit(client.ctx, &client.target, client.transactionID)
}
// Rollback rolls back the current transaction.
func (client *QueryClient) Rollback() error {
defer func() { client.transactionID = 0 }()
return client.server.Rollback(client.ctx, &client.target, 0, client.transactionID)
return client.server.Rollback(client.ctx, &client.target, client.transactionID)
}
// Execute executes a query.
@ -72,7 +72,6 @@ func (client *QueryClient) Execute(query string, bindvars map[string]interface{}
&client.target,
query,
bindvars,
0,
client.transactionID,
)
}
@ -85,7 +84,6 @@ func (client *QueryClient) StreamExecute(query string, bindvars map[string]inter
&client.target,
query,
bindvars,
0,
func(res *sqltypes.Result) error {
if result.Fields == nil {
result.Fields = res.Fields
@ -108,7 +106,6 @@ func (client *QueryClient) Stream(query string, bindvars map[string]interface{},
&client.target,
query,
bindvars,
0,
sendFunc,
)
}
@ -119,7 +116,6 @@ func (client *QueryClient) ExecuteBatch(queries []querytypes.BoundQuery, asTrans
client.ctx,
&client.target,
queries,
0,
asTransaction,
client.transactionID,
)

Просмотреть файл

@ -26,20 +26,6 @@ type query struct {
server queryservice.QueryService
}
// GetSessionId is part of the queryservice.QueryServer interface
func (q *query) GetSessionId(ctx context.Context, request *querypb.GetSessionIdRequest) (response *querypb.GetSessionIdResponse, err error) {
defer q.server.HandlePanic(&err)
sessionID, err := q.server.GetSessionId(request.Keyspace, request.Shard)
if err != nil {
return nil, tabletserver.ToGRPCError(err)
}
return &querypb.GetSessionIdResponse{
SessionId: sessionID,
}, nil
}
// Execute is part of the queryservice.QueryServer interface
func (q *query) Execute(ctx context.Context, request *querypb.ExecuteRequest) (response *querypb.ExecuteResponse, err error) {
defer q.server.HandlePanic(&err)
@ -51,7 +37,7 @@ func (q *query) Execute(ctx context.Context, request *querypb.ExecuteRequest) (r
if err != nil {
return nil, tabletserver.ToGRPCError(err)
}
result, err := q.server.Execute(ctx, request.Target, request.Query.Sql, bv, request.SessionId, request.TransactionId)
result, err := q.server.Execute(ctx, request.Target, request.Query.Sql, bv, request.TransactionId)
if err != nil {
return nil, tabletserver.ToGRPCError(err)
}
@ -71,7 +57,7 @@ func (q *query) ExecuteBatch(ctx context.Context, request *querypb.ExecuteBatchR
if err != nil {
return nil, tabletserver.ToGRPCError(err)
}
results, err := q.server.ExecuteBatch(ctx, request.Target, bql, request.SessionId, request.AsTransaction, request.TransactionId)
results, err := q.server.ExecuteBatch(ctx, request.Target, bql, request.AsTransaction, request.TransactionId)
if err != nil {
return nil, tabletserver.ToGRPCError(err)
}
@ -91,7 +77,7 @@ func (q *query) StreamExecute(request *querypb.StreamExecuteRequest, stream quer
if err != nil {
return tabletserver.ToGRPCError(err)
}
if err := q.server.StreamExecute(ctx, request.Target, request.Query.Sql, bv, request.SessionId, func(reply *sqltypes.Result) error {
if err := q.server.StreamExecute(ctx, request.Target, request.Query.Sql, bv, func(reply *sqltypes.Result) error {
return stream.Send(&querypb.StreamExecuteResponse{
Result: sqltypes.ResultToProto3(reply),
})
@ -108,7 +94,7 @@ func (q *query) Begin(ctx context.Context, request *querypb.BeginRequest) (respo
request.EffectiveCallerId,
request.ImmediateCallerId,
)
transactionID, err := q.server.Begin(ctx, request.Target, request.SessionId)
transactionID, err := q.server.Begin(ctx, request.Target)
if err != nil {
return nil, tabletserver.ToGRPCError(err)
}
@ -125,7 +111,7 @@ func (q *query) Commit(ctx context.Context, request *querypb.CommitRequest) (res
request.EffectiveCallerId,
request.ImmediateCallerId,
)
if err := q.server.Commit(ctx, request.Target, request.SessionId, request.TransactionId); err != nil {
if err := q.server.Commit(ctx, request.Target, request.TransactionId); err != nil {
return nil, tabletserver.ToGRPCError(err)
}
return &querypb.CommitResponse{}, nil
@ -138,7 +124,7 @@ func (q *query) Rollback(ctx context.Context, request *querypb.RollbackRequest)
request.EffectiveCallerId,
request.ImmediateCallerId,
)
if err := q.server.Rollback(ctx, request.Target, request.SessionId, request.TransactionId); err != nil {
if err := q.server.Rollback(ctx, request.Target, request.TransactionId); err != nil {
return nil, tabletserver.ToGRPCError(err)
}
@ -158,13 +144,13 @@ func (q *query) BeginExecute(ctx context.Context, request *querypb.BeginExecuteR
}
// Begin part
transactionID, err := q.server.Begin(ctx, request.Target, 0)
transactionID, err := q.server.Begin(ctx, request.Target)
if err != nil {
return nil, tabletserver.ToGRPCError(err)
}
// Execute part
result, err := q.server.Execute(ctx, request.Target, request.Query.Sql, bv, 0, transactionID)
result, err := q.server.Execute(ctx, request.Target, request.Query.Sql, bv, transactionID)
if err != nil {
return &querypb.BeginExecuteResponse{
Error: tabletserver.ToRPCError(err),
@ -190,13 +176,13 @@ func (q *query) BeginExecuteBatch(ctx context.Context, request *querypb.BeginExe
}
// Begin part
transactionID, err := q.server.Begin(ctx, request.Target, 0)
transactionID, err := q.server.Begin(ctx, request.Target)
if err != nil {
return nil, tabletserver.ToGRPCError(err)
}
// ExecuteBatch part
results, err := q.server.ExecuteBatch(ctx, request.Target, bql, 0, request.AsTransaction, transactionID)
results, err := q.server.ExecuteBatch(ctx, request.Target, bql, request.AsTransaction, transactionID)
if err != nil {
return &querypb.BeginExecuteBatchResponse{
Error: tabletserver.ToRPCError(err),
@ -232,8 +218,7 @@ func (q *query) SplitQuery(ctx context.Context, request *querypb.SplitQueryReque
request.SplitColumn,
request.SplitCount,
request.NumRowsPerQueryPart,
request.Algorithm,
request.SessionId)
request.Algorithm)
if err != nil {
return nil, tabletserver.ToGRPCError(err)
}

Просмотреть файл

@ -248,18 +248,18 @@ func TestQueryExecutorPlanUpsertPk(t *testing.T) {
db.AddRejectedQuery(
"insert into test_table values (1) /* _stream test_table (pk ) (1 ); */",
sqldb.NewSQLError(mysql.ErrDupEntry, "err"),
sqldb.NewSQLError(mysql.ErrDupEntry, "23000", "err"),
)
db.AddQuery("update test_table set val = 1 where pk in (1) /* _stream test_table (pk ) (1 ); */", &sqltypes.Result{})
_, err = qre.Execute()
wantErr = "error: err (errno 1062)"
wantErr = "error: err (errno 1062) (sqlstate 23000)"
if err == nil || err.Error() != wantErr {
t.Fatalf("qre.Execute() = %v, want %v", err, wantErr)
}
db.AddRejectedQuery(
"insert into test_table values (1) /* _stream test_table (pk ) (1 ); */",
sqldb.NewSQLError(mysql.ErrDupEntry, "ERROR 1062 (23000): Duplicate entry '2' for key 'PRIMARY'"),
sqldb.NewSQLError(mysql.ErrDupEntry, "23000", "ERROR 1062 (23000): Duplicate entry '2' for key 'PRIMARY'"),
)
db.AddQuery(
"update test_table set val = 1 where pk in (1) /* _stream test_table (pk ) (1 ); */",
@ -1049,7 +1049,7 @@ func newTestTabletServer(ctx context.Context, flags executorFlags, db *fakesqldb
}
func newTransaction(tsv *TabletServer) int64 {
transactionID, err := tsv.Begin(context.Background(), &tsv.target, tsv.sessionID)
transactionID, err := tsv.Begin(context.Background(), &tsv.target)
if err != nil {
panic(fmt.Errorf("failed to start a transaction: %v", err))
}
@ -1070,7 +1070,7 @@ func newTestQueryExecutor(ctx context.Context, tsv *TabletServer, sql string, tx
}
func testCommitHelper(t *testing.T, tsv *TabletServer, queryExecutor *QueryExecutor) {
if err := tsv.Commit(queryExecutor.ctx, &tsv.target, tsv.sessionID, queryExecutor.transactionID); err != nil {
if err := tsv.Commit(queryExecutor.ctx, &tsv.target, queryExecutor.transactionID); err != nil {
t.Fatalf("failed to commit transaction: %d, err: %v", queryExecutor.transactionID, err)
}
}

Просмотреть файл

@ -17,47 +17,41 @@ import (
// It is used as base for other, more specialised QueryService fakes e.g.
// StreamHealthQueryService.
type ErrorQueryService struct {
GetSessionIdError error
}
// GetSessionId is part of QueryService interface
func (e *ErrorQueryService) GetSessionId(keyspace, shard string) (int64, error) {
return 0, e.GetSessionIdError
}
// Begin is part of QueryService interface
func (e *ErrorQueryService) Begin(ctx context.Context, target *querypb.Target, sessionID int64) (int64, error) {
func (e *ErrorQueryService) Begin(ctx context.Context, target *querypb.Target) (int64, error) {
return 0, fmt.Errorf("ErrorQueryService does not implement any method")
}
// Commit is part of QueryService interface
func (e *ErrorQueryService) Commit(ctx context.Context, target *querypb.Target, sessionID, transactionID int64) error {
func (e *ErrorQueryService) Commit(ctx context.Context, target *querypb.Target, transactionID int64) error {
return fmt.Errorf("ErrorQueryService does not implement any method")
}
// Rollback is part of QueryService interface
func (e *ErrorQueryService) Rollback(ctx context.Context, target *querypb.Target, sessionID, transactionID int64) error {
func (e *ErrorQueryService) Rollback(ctx context.Context, target *querypb.Target, transactionID int64) error {
return fmt.Errorf("ErrorQueryService does not implement any method")
}
// Execute is part of QueryService interface
func (e *ErrorQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sessionID, transactionID int64) (*sqltypes.Result, error) {
func (e *ErrorQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64) (*sqltypes.Result, error) {
return nil, fmt.Errorf("ErrorQueryService does not implement any method")
}
// StreamExecute is part of QueryService interface
func (e *ErrorQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sessionID int64, sendReply func(*sqltypes.Result) error) error {
func (e *ErrorQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(*sqltypes.Result) error) error {
return fmt.Errorf("ErrorQueryService does not implement any method")
}
// ExecuteBatch is part of QueryService interface
func (e *ErrorQueryService) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, sessionID int64, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
func (e *ErrorQueryService) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
return nil, fmt.Errorf("ErrorQueryService does not implement any method")
}
// SplitQuery is part of QueryService interface
// TODO(erez): Remove once the migration to SplitQuery V2 is done.
func (e *ErrorQueryService) SplitQuery(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64, sessionID int64) ([]querytypes.QuerySplit, error) {
func (e *ErrorQueryService) SplitQuery(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64) ([]querytypes.QuerySplit, error) {
return nil, fmt.Errorf("ErrorQueryService does not implement any method")
}
@ -71,7 +65,7 @@ func (e *ErrorQueryService) SplitQueryV2(
splitCount int64,
numRowsPerQueryPart int64,
algorithm querypb.SplitQueryRequest_Algorithm,
sessionID int64) ([]querytypes.QuerySplit, error) {
) ([]querytypes.QuerySplit, error) {
return nil, fmt.Errorf("ErrorQueryService does not implement any method")
}

Просмотреть файл

@ -16,32 +16,27 @@ import (
// QueryService is the interface implemented by the tablet's query service.
type QueryService interface {
// GetSessionId establishes a session to guarantee the current
// query service state doesn't change.
// This is begin deprecated, replaced by the Target structure.
GetSessionId(keyspace, shard string) (int64, error)
// Transaction management
// Begin returns the transaction id to use for further operations
Begin(ctx context.Context, target *querypb.Target, sessionID int64) (int64, error)
Begin(ctx context.Context, target *querypb.Target) (int64, error)
// Commit commits the current transaction
Commit(ctx context.Context, target *querypb.Target, sessionID, transactionID int64) error
Commit(ctx context.Context, target *querypb.Target, transactionID int64) error
// Rollback aborts the current transaction
Rollback(ctx context.Context, target *querypb.Target, sessionID, transactionID int64) error
Rollback(ctx context.Context, target *querypb.Target, transactionID int64) error
// Query execution
Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sessionID, transactionID int64) (*sqltypes.Result, error)
StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sessionID int64, sendReply func(*sqltypes.Result) error) error
ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, sessionID int64, asTransaction bool, transactionID int64) ([]sqltypes.Result, error)
Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64) (*sqltypes.Result, error)
StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(*sqltypes.Result) error) error
ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error)
// SplitQuery is a map reduce helper function
// TODO(erez): Remove this and rename the following func to SplitQuery
// once we migrate to SplitQuery V2.
SplitQuery(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64, sessionID int64) ([]querytypes.QuerySplit, error)
SplitQuery(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64) ([]querytypes.QuerySplit, error)
// SplitQueryV2 is a MapReduce helper function.
// This is version of SplitQuery supports multiple algorithms and multiple split columns.
@ -55,7 +50,7 @@ type QueryService interface {
splitCount int64,
numRowsPerQueryPart int64,
algorithm querypb.SplitQueryRequest_Algorithm,
sessionID int64) ([]querytypes.QuerySplit, error)
) ([]querytypes.QuerySplit, error)
// StreamHealthRegister registers a listener for StreamHealth
StreamHealthRegister(chan<- *querypb.StreamHealthResponse) (int, error)
@ -82,7 +77,7 @@ func CallCorrectSplitQuery(
splitCount int64,
numRowsPerQueryPart int64,
algorithm querypb.SplitQueryRequest_Algorithm,
sessionID int64) ([]querytypes.QuerySplit, error) {
) ([]querytypes.QuerySplit, error) {
if useSplitQueryV2 {
return queryService.SplitQueryV2(
@ -93,8 +88,7 @@ func CallCorrectSplitQuery(
splitColumns,
splitCount,
numRowsPerQueryPart,
algorithm,
sessionID)
algorithm)
}
return queryService.SplitQuery(
ctx,
@ -102,8 +96,7 @@ func CallCorrectSplitQuery(
sql,
bindVariables,
splitColumnsToSplitColumn(splitColumns),
splitCount,
sessionID)
splitCount)
}
// SplitColumnsToSplitColumn returns the first SplitColumn in the given slice or an empty

Просмотреть файл

@ -16,7 +16,6 @@ var (
bindVariables = map[string]interface{}{}
splitCount int64 = 123
numRowsPerQueryPart int64 = 456
sessionID int64 = 789
algorithm = querypb.SplitQueryRequest_EQUAL_SPLITS
)
@ -31,8 +30,7 @@ func TestCallCorrectSplitQueryCallV1NoSplitColumn(t *testing.T) {
sql,
bindVariables,
"",
splitCount,
sessionID)
splitCount)
CallCorrectSplitQuery(
mockQueryService,
false, /* useSplitQueryV2 */
@ -43,8 +41,7 @@ func TestCallCorrectSplitQueryCallV1NoSplitColumn(t *testing.T) {
[]string{}, /* SplitColumns */
splitCount,
numRowsPerQueryPart,
algorithm,
sessionID)
algorithm)
}
func TestCallCorrectSplitQueryCallV1WithSplitColumn(t *testing.T) {
@ -58,8 +55,7 @@ func TestCallCorrectSplitQueryCallV1WithSplitColumn(t *testing.T) {
sql,
bindVariables,
"First Split Column",
splitCount,
sessionID)
splitCount)
CallCorrectSplitQuery(
mockQueryService,
false, /* useSplitQueryV2 */
@ -70,8 +66,7 @@ func TestCallCorrectSplitQueryCallV1WithSplitColumn(t *testing.T) {
[]string{"First Split Column"}, /* SplitColumns */
splitCount,
numRowsPerQueryPart,
algorithm,
sessionID)
algorithm)
}
func TestCallCorrectSplitQueryCallV2(t *testing.T) {
@ -87,8 +82,7 @@ func TestCallCorrectSplitQueryCallV2(t *testing.T) {
splitColumns,
splitCount,
numRowsPerQueryPart,
algorithm,
sessionID)
algorithm)
CallCorrectSplitQuery(
mockQueryService,
true, /* useSplitQueryV2 */
@ -99,6 +93,5 @@ func TestCallCorrectSplitQueryCallV2(t *testing.T) {
splitColumns,
splitCount,
numRowsPerQueryPart,
algorithm,
sessionID)
algorithm)
}

Просмотреть файл

@ -32,100 +32,89 @@ func (_m *MockQueryService) EXPECT() *_MockQueryServiceRecorder {
return _m.recorder
}
func (_m *MockQueryService) GetSessionId(keyspace string, shard string) (int64, error) {
ret := _m.ctrl.Call(_m, "GetSessionId", keyspace, shard)
func (_m *MockQueryService) Begin(ctx context.Context, target *query.Target) (int64, error) {
ret := _m.ctrl.Call(_m, "Begin", ctx, target)
ret0, _ := ret[0].(int64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockQueryServiceRecorder) GetSessionId(arg0, arg1 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "GetSessionId", arg0, arg1)
func (_mr *_MockQueryServiceRecorder) Begin(arg0, arg1 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Begin", arg0, arg1)
}
func (_m *MockQueryService) Begin(ctx context.Context, target *query.Target, sessionID int64) (int64, error) {
ret := _m.ctrl.Call(_m, "Begin", ctx, target, sessionID)
ret0, _ := ret[0].(int64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockQueryServiceRecorder) Begin(arg0, arg1, arg2 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Begin", arg0, arg1, arg2)
}
func (_m *MockQueryService) Commit(ctx context.Context, target *query.Target, sessionID int64, transactionID int64) error {
ret := _m.ctrl.Call(_m, "Commit", ctx, target, sessionID, transactionID)
func (_m *MockQueryService) Commit(ctx context.Context, target *query.Target, transactionID int64) error {
ret := _m.ctrl.Call(_m, "Commit", ctx, target, transactionID)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockQueryServiceRecorder) Commit(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Commit", arg0, arg1, arg2, arg3)
func (_mr *_MockQueryServiceRecorder) Commit(arg0, arg1, arg2 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Commit", arg0, arg1, arg2)
}
func (_m *MockQueryService) Rollback(ctx context.Context, target *query.Target, sessionID int64, transactionID int64) error {
ret := _m.ctrl.Call(_m, "Rollback", ctx, target, sessionID, transactionID)
func (_m *MockQueryService) Rollback(ctx context.Context, target *query.Target, transactionID int64) error {
ret := _m.ctrl.Call(_m, "Rollback", ctx, target, transactionID)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockQueryServiceRecorder) Rollback(arg0, arg1, arg2, arg3 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Rollback", arg0, arg1, arg2, arg3)
func (_mr *_MockQueryServiceRecorder) Rollback(arg0, arg1, arg2 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Rollback", arg0, arg1, arg2)
}
func (_m *MockQueryService) Execute(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}, sessionID int64, transactionID int64) (*sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "Execute", ctx, target, sql, bindVariables, sessionID, transactionID)
func (_m *MockQueryService) Execute(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}, transactionID int64) (*sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "Execute", ctx, target, sql, bindVariables, transactionID)
ret0, _ := ret[0].(*sqltypes.Result)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockQueryServiceRecorder) Execute(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Execute", arg0, arg1, arg2, arg3, arg4, arg5)
func (_mr *_MockQueryServiceRecorder) Execute(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "Execute", arg0, arg1, arg2, arg3, arg4)
}
func (_m *MockQueryService) StreamExecute(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}, sessionID int64, sendReply func(*sqltypes.Result) error) error {
ret := _m.ctrl.Call(_m, "StreamExecute", ctx, target, sql, bindVariables, sessionID, sendReply)
func (_m *MockQueryService) StreamExecute(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}, sendReply func(*sqltypes.Result) error) error {
ret := _m.ctrl.Call(_m, "StreamExecute", ctx, target, sql, bindVariables, sendReply)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockQueryServiceRecorder) StreamExecute(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "StreamExecute", arg0, arg1, arg2, arg3, arg4, arg5)
func (_mr *_MockQueryServiceRecorder) StreamExecute(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "StreamExecute", arg0, arg1, arg2, arg3, arg4)
}
func (_m *MockQueryService) ExecuteBatch(ctx context.Context, target *query.Target, queries []querytypes.BoundQuery, sessionID int64, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteBatch", ctx, target, queries, sessionID, asTransaction, transactionID)
func (_m *MockQueryService) ExecuteBatch(ctx context.Context, target *query.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
ret := _m.ctrl.Call(_m, "ExecuteBatch", ctx, target, queries, asTransaction, transactionID)
ret0, _ := ret[0].([]sqltypes.Result)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockQueryServiceRecorder) ExecuteBatch(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteBatch", arg0, arg1, arg2, arg3, arg4, arg5)
func (_mr *_MockQueryServiceRecorder) ExecuteBatch(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "ExecuteBatch", arg0, arg1, arg2, arg3, arg4)
}
func (_m *MockQueryService) SplitQuery(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64, sessionID int64) ([]querytypes.QuerySplit, error) {
ret := _m.ctrl.Call(_m, "SplitQuery", ctx, target, sql, bindVariables, splitColumn, splitCount, sessionID)
func (_m *MockQueryService) SplitQuery(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64) ([]querytypes.QuerySplit, error) {
ret := _m.ctrl.Call(_m, "SplitQuery", ctx, target, sql, bindVariables, splitColumn, splitCount)
ret0, _ := ret[0].([]querytypes.QuerySplit)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockQueryServiceRecorder) SplitQuery(arg0, arg1, arg2, arg3, arg4, arg5, arg6 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "SplitQuery", arg0, arg1, arg2, arg3, arg4, arg5, arg6)
func (_mr *_MockQueryServiceRecorder) SplitQuery(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "SplitQuery", arg0, arg1, arg2, arg3, arg4, arg5)
}
func (_m *MockQueryService) SplitQueryV2(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}, splitColumns []string, splitCount int64, numRowsPerQueryPart int64, algorithm query.SplitQueryRequest_Algorithm, sessionID int64) ([]querytypes.QuerySplit, error) {
ret := _m.ctrl.Call(_m, "SplitQueryV2", ctx, target, sql, bindVariables, splitColumns, splitCount, numRowsPerQueryPart, algorithm, sessionID)
func (_m *MockQueryService) SplitQueryV2(ctx context.Context, target *query.Target, sql string, bindVariables map[string]interface{}, splitColumns []string, splitCount int64, numRowsPerQueryPart int64, algorithm query.SplitQueryRequest_Algorithm) ([]querytypes.QuerySplit, error) {
ret := _m.ctrl.Call(_m, "SplitQueryV2", ctx, target, sql, bindVariables, splitColumns, splitCount, numRowsPerQueryPart, algorithm)
ret0, _ := ret[0].([]querytypes.QuerySplit)
ret1, _ := ret[1].(error)
return ret0, ret1
}
func (_mr *_MockQueryServiceRecorder) SplitQueryV2(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "SplitQueryV2", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8)
func (_mr *_MockQueryServiceRecorder) SplitQueryV2(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "SplitQueryV2", arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)
}
func (_m *MockQueryService) StreamHealthRegister(_param0 chan<- *query.StreamHealthResponse) (int, error) {

Просмотреть файл

@ -15,6 +15,7 @@ import (
log "github.com/golang/glog"
"github.com/youtube/vitess/go/mysql"
"github.com/youtube/vitess/go/sqldb"
"github.com/youtube/vitess/go/tb"
"github.com/youtube/vitess/go/vt/logutil"
vtrpcpb "github.com/youtube/vitess/go/vt/proto/vtrpc"
@ -38,15 +39,11 @@ var logTxPoolFull = logutil.NewThrottledLogger("TxPoolFull", 1*time.Minute)
type TabletError struct {
Message string
SQLError int
SQLState string
// ErrorCode will be used to transmit the error across RPC boundaries
ErrorCode vtrpcpb.ErrorCode
}
// This is how go-mysql exports its error number
type hasNumber interface {
Number() int
}
// NewTabletError returns a TabletError of the given type
func NewTabletError(errCode vtrpcpb.ErrorCode, format string, args ...interface{}) *TabletError {
return &TabletError{
@ -59,8 +56,10 @@ func NewTabletError(errCode vtrpcpb.ErrorCode, format string, args ...interface{
func NewTabletErrorSQL(errCode vtrpcpb.ErrorCode, err error) *TabletError {
var errnum int
errstr := err.Error()
if sqlErr, ok := err.(hasNumber); ok {
sqlState := sqldb.SQLStateGeneral
if sqlErr, ok := err.(*sqldb.SQLError); ok {
errnum = sqlErr.Number()
sqlState = sqlErr.SQLState()
switch errnum {
case mysql.ErrOptionPreventsStatement:
// Override error type if MySQL is in read-only mode. It's probably because
@ -76,6 +75,7 @@ func NewTabletErrorSQL(errCode vtrpcpb.ErrorCode, err error) *TabletError {
return &TabletError{
Message: printable(errstr),
SQLError: errnum,
SQLState: sqlState,
ErrorCode: errCode,
}
}
@ -146,7 +146,7 @@ func IsConnErr(err error) bool {
switch err := err.(type) {
case *TabletError:
sqlError = err.SQLError
case hasNumber:
case *sqldb.SQLError:
sqlError = err.Number()
default:
match := errExtract.FindStringSubmatch(err.Error())

Просмотреть файл

@ -24,7 +24,7 @@ func TestTabletErrorCode(t *testing.T) {
}
func TestTabletErrorRetriableErrorTypeOverwrite(t *testing.T) {
sqlErr := sqldb.NewSQLError(mysql.ErrOptionPreventsStatement, "read-only")
sqlErr := sqldb.NewSQLError(mysql.ErrOptionPreventsStatement, "HY000", "read-only")
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_INTERNAL_ERROR, sqlErr)
if tabletErr.ErrorCode != vtrpcpb.ErrorCode_QUERY_NOT_SERVED {
t.Fatalf("got: %v wanted: QUERY_NOT_SERVED", tabletErr.ErrorCode)
@ -37,7 +37,7 @@ func TestTabletErrorMsgTooLong(t *testing.T) {
buf[i] = 'a'
}
msg := string(buf)
sqlErr := sqldb.NewSQLError(mysql.ErrDupEntry, msg)
sqlErr := sqldb.NewSQLError(mysql.ErrDupEntry, "23000", msg)
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_INTERNAL_ERROR, sqlErr)
if tabletErr.ErrorCode != vtrpcpb.ErrorCode_INTEGRITY_ERROR {
t.Fatalf("got %v wanted INTEGRITY_ERROR", tabletErr.ErrorCode)
@ -48,27 +48,27 @@ func TestTabletErrorMsgTooLong(t *testing.T) {
}
func TestTabletErrorConnError(t *testing.T) {
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_INTERNAL_ERROR, sqldb.NewSQLError(1999, "test"))
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_INTERNAL_ERROR, sqldb.NewSQLError(1999, "HY000", "test"))
if IsConnErr(tabletErr) {
t.Fatalf("table error: %v is not a connection error", tabletErr)
}
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_INTERNAL_ERROR, sqldb.NewSQLError(2000, "test"))
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_INTERNAL_ERROR, sqldb.NewSQLError(2000, "HY000", "test"))
if !IsConnErr(tabletErr) {
t.Fatalf("table error: %v is a connection error", tabletErr)
}
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_INTERNAL_ERROR, sqldb.NewSQLError(mysql.ErrServerLost, "test"))
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_INTERNAL_ERROR, sqldb.NewSQLError(mysql.ErrServerLost, "HY000", "test"))
if IsConnErr(tabletErr) {
t.Fatalf("table error: %v is not a connection error", tabletErr)
}
want := "fatal: the query was killed either because it timed out or was canceled: test (errno 2013)"
want := "fatal: the query was killed either because it timed out or was canceled: test (errno 2013) (sqlstate HY000)"
if tabletErr.Error() != want {
t.Fatalf("tablet error: %v, want %s", tabletErr, want)
}
sqlErr := sqldb.NewSQLError(1998, "test")
sqlErr := sqldb.NewSQLError(1998, "HY000", "test")
if IsConnErr(sqlErr) {
t.Fatalf("sql error: %v is not a connection error", sqlErr)
}
sqlErr = sqldb.NewSQLError(2001, "test")
sqlErr = sqldb.NewSQLError(2001, "HY000", "test")
if !IsConnErr(sqlErr) {
t.Fatalf("sql error: %v is a connection error", sqlErr)
}
@ -85,26 +85,26 @@ func TestTabletErrorConnError(t *testing.T) {
}
func TestTabletErrorPrefix(t *testing.T) {
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_QUERY_NOT_SERVED, sqldb.NewSQLError(2000, "test"))
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_QUERY_NOT_SERVED, sqldb.NewSQLError(2000, "HY000", "test"))
if tabletErr.Prefix() != "retry: " {
t.Fatalf("tablet error with error code: QUERY_NOT_SERVED should has prefix: 'retry: '")
}
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_INTERNAL_ERROR, sqldb.NewSQLError(2000, "test"))
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_INTERNAL_ERROR, sqldb.NewSQLError(2000, "HY000", "test"))
if tabletErr.Prefix() != "fatal: " {
t.Fatalf("tablet error with error code: INTERNAL_ERROR should has prefix: 'fatal: '")
}
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_RESOURCE_EXHAUSTED, sqldb.NewSQLError(2000, "test"))
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_RESOURCE_EXHAUSTED, sqldb.NewSQLError(2000, "HY000", "test"))
if tabletErr.Prefix() != "tx_pool_full: " {
t.Fatalf("tablet error with error code: RESOURCE_EXHAUSTED should has prefix: 'tx_pool_full: '")
}
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_NOT_IN_TX, sqldb.NewSQLError(2000, "test"))
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_NOT_IN_TX, sqldb.NewSQLError(2000, "HY000", "test"))
if tabletErr.Prefix() != "not_in_tx: " {
t.Fatalf("tablet error with error code: NOT_IN_TX should has prefix: 'not_in_tx: '")
}
}
func TestTabletErrorRecordStats(t *testing.T) {
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_QUERY_NOT_SERVED, sqldb.NewSQLError(2000, "test"))
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_QUERY_NOT_SERVED, sqldb.NewSQLError(2000, "HY000", "test"))
queryServiceStats := NewQueryServiceStats("", false)
retryCounterBefore := queryServiceStats.InfoErrors.Counts()["Retry"]
tabletErr.RecordStats(queryServiceStats)
@ -113,7 +113,7 @@ func TestTabletErrorRecordStats(t *testing.T) {
t.Fatalf("tablet error with error code QUERY_NOT_SERVED should increase Retry error count by 1")
}
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_INTERNAL_ERROR, sqldb.NewSQLError(2000, "test"))
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_INTERNAL_ERROR, sqldb.NewSQLError(2000, "HY000", "test"))
fatalCounterBefore := queryServiceStats.InfoErrors.Counts()["Fatal"]
tabletErr.RecordStats(queryServiceStats)
fatalCounterAfter := queryServiceStats.InfoErrors.Counts()["Fatal"]
@ -121,7 +121,7 @@ func TestTabletErrorRecordStats(t *testing.T) {
t.Fatalf("tablet error with error code INTERNAL_ERROR should increase Fatal error count by 1")
}
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_RESOURCE_EXHAUSTED, sqldb.NewSQLError(2000, "test"))
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_RESOURCE_EXHAUSTED, sqldb.NewSQLError(2000, "HY000", "test"))
txPoolFullCounterBefore := queryServiceStats.ErrorStats.Counts()["TxPoolFull"]
tabletErr.RecordStats(queryServiceStats)
txPoolFullCounterAfter := queryServiceStats.ErrorStats.Counts()["TxPoolFull"]
@ -129,7 +129,7 @@ func TestTabletErrorRecordStats(t *testing.T) {
t.Fatalf("tablet error with error code RESOURCE_EXHAUSTED should increase TxPoolFull error count by 1")
}
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_NOT_IN_TX, sqldb.NewSQLError(2000, "test"))
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_NOT_IN_TX, sqldb.NewSQLError(2000, "HY000", "test"))
notInTxCounterBefore := queryServiceStats.ErrorStats.Counts()["NotInTx"]
tabletErr.RecordStats(queryServiceStats)
notInTxCounterAfter := queryServiceStats.ErrorStats.Counts()["NotInTx"]
@ -137,7 +137,7 @@ func TestTabletErrorRecordStats(t *testing.T) {
t.Fatalf("tablet error with error code NOT_IN_TX should increase NotInTx error count by 1")
}
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_UNKNOWN_ERROR, sqldb.NewSQLError(mysql.ErrDupEntry, "test"))
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_UNKNOWN_ERROR, sqldb.NewSQLError(mysql.ErrDupEntry, "23000", "test"))
dupKeyCounterBefore := queryServiceStats.InfoErrors.Counts()["DupKey"]
tabletErr.RecordStats(queryServiceStats)
dupKeyCounterAfter := queryServiceStats.InfoErrors.Counts()["DupKey"]
@ -145,7 +145,7 @@ func TestTabletErrorRecordStats(t *testing.T) {
t.Fatalf("sql error with SQL error mysql.ErrDupEntry should increase DupKey error count by 1")
}
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_UNKNOWN_ERROR, sqldb.NewSQLError(mysql.ErrLockWaitTimeout, "test"))
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_UNKNOWN_ERROR, sqldb.NewSQLError(mysql.ErrLockWaitTimeout, "HY000", "test"))
lockWaitTimeoutCounterBefore := queryServiceStats.ErrorStats.Counts()["Deadlock"]
tabletErr.RecordStats(queryServiceStats)
lockWaitTimeoutCounterAfter := queryServiceStats.ErrorStats.Counts()["Deadlock"]
@ -153,7 +153,7 @@ func TestTabletErrorRecordStats(t *testing.T) {
t.Fatalf("sql error with SQL error mysql.ErrLockWaitTimeout should increase Deadlock error count by 1")
}
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_UNKNOWN_ERROR, sqldb.NewSQLError(mysql.ErrLockDeadlock, "test"))
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_UNKNOWN_ERROR, sqldb.NewSQLError(mysql.ErrLockDeadlock, "40001", "test"))
deadlockCounterBefore := queryServiceStats.ErrorStats.Counts()["Deadlock"]
tabletErr.RecordStats(queryServiceStats)
deadlockCounterAfter := queryServiceStats.ErrorStats.Counts()["Deadlock"]
@ -161,7 +161,7 @@ func TestTabletErrorRecordStats(t *testing.T) {
t.Fatalf("sql error with SQL error mysql.ErrLockDeadlock should increase Deadlock error count by 1")
}
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_UNKNOWN_ERROR, sqldb.NewSQLError(mysql.ErrOptionPreventsStatement, "test"))
tabletErr = NewTabletErrorSQL(vtrpcpb.ErrorCode_UNKNOWN_ERROR, sqldb.NewSQLError(mysql.ErrOptionPreventsStatement, "HY000", "test"))
failCounterBefore := queryServiceStats.ErrorStats.Counts()["Fail"]
tabletErr.RecordStats(queryServiceStats)
failCounterAfter := queryServiceStats.ErrorStats.Counts()["Fail"]
@ -186,7 +186,7 @@ func TestTabletErrorHandleUncaughtError(t *testing.T) {
func TestTabletErrorHandleRetryError(t *testing.T) {
var err error
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_QUERY_NOT_SERVED, sqldb.NewSQLError(1000, "test"))
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_QUERY_NOT_SERVED, sqldb.NewSQLError(1000, "HY000", "test"))
logStats := newLogStats("TestTabletErrorHandleError", context.Background())
queryServiceStats := NewQueryServiceStats("", false)
defer func() {
@ -201,7 +201,7 @@ func TestTabletErrorHandleRetryError(t *testing.T) {
func TestTabletErrorHandleTxPoolFullError(t *testing.T) {
var err error
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_RESOURCE_EXHAUSTED, sqldb.NewSQLError(1000, "test"))
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_RESOURCE_EXHAUSTED, sqldb.NewSQLError(1000, "HY000", "test"))
logStats := newLogStats("TestTabletErrorHandleError", context.Background())
queryServiceStats := NewQueryServiceStats("", false)
defer func() {
@ -228,7 +228,7 @@ func TestTabletErrorLogUncaughtErr(t *testing.T) {
}
func TestTabletErrorTxPoolFull(t *testing.T) {
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_RESOURCE_EXHAUSTED, sqldb.NewSQLError(1000, "test"))
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_RESOURCE_EXHAUSTED, sqldb.NewSQLError(1000, "HY000", "test"))
queryServiceStats := NewQueryServiceStats("", false)
defer func() {
err := recover()
@ -241,7 +241,7 @@ func TestTabletErrorTxPoolFull(t *testing.T) {
}
func TestTabletErrorFatal(t *testing.T) {
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_INTERNAL_ERROR, sqldb.NewSQLError(1000, "test"))
tabletErr := NewTabletErrorSQL(vtrpcpb.ErrorCode_INTERNAL_ERROR, sqldb.NewSQLError(1000, "HY000", "test"))
queryServiceStats := NewQueryServiceStats("", false)
defer func() {
err := recover()

Просмотреть файл

@ -158,14 +158,8 @@ func (f *FakeQueryService) checkTargetCallerID(ctx context.Context, name string,
}
}
// GetSessionId is part of the queryservice.QueryService interface
func (f *FakeQueryService) GetSessionId(keyspace, shard string) (int64, error) {
f.t.Fatal("GetSessionId should not be called any more")
return 0, nil
}
// Begin is part of the queryservice.QueryService interface
func (f *FakeQueryService) Begin(ctx context.Context, target *querypb.Target, sessionID int64) (int64, error) {
func (f *FakeQueryService) Begin(ctx context.Context, target *querypb.Target) (int64, error) {
if f.hasBeginError {
return 0, f.tabletError
}
@ -207,7 +201,7 @@ func testBeginPanics(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryServi
}
// Commit is part of the queryservice.QueryService interface
func (f *FakeQueryService) Commit(ctx context.Context, target *querypb.Target, sessionID, transactionID int64) error {
func (f *FakeQueryService) Commit(ctx context.Context, target *querypb.Target, transactionID int64) error {
if f.hasError {
return f.tabletError
}
@ -247,7 +241,7 @@ func testCommitPanics(t *testing.T, conn tabletconn.TabletConn, f *FakeQueryServ
}
// Rollback is part of the queryservice.QueryService interface
func (f *FakeQueryService) Rollback(ctx context.Context, target *querypb.Target, sessionID, transactionID int64) error {
func (f *FakeQueryService) Rollback(ctx context.Context, target *querypb.Target, transactionID int64) error {
if f.hasError {
return f.tabletError
}
@ -286,7 +280,7 @@ func testRollbackPanics(t *testing.T, conn tabletconn.TabletConn, f *FakeQuerySe
}
// Execute is part of the queryservice.QueryService interface
func (f *FakeQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sessionID, transactionID int64) (*sqltypes.Result, error) {
func (f *FakeQueryService) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64) (*sqltypes.Result, error) {
if f.hasError {
return nil, f.tabletError
}
@ -417,7 +411,7 @@ func testBeginExecutePanics(t *testing.T, conn tabletconn.TabletConn, f *FakeQue
}
// StreamExecute is part of the queryservice.QueryService interface
func (f *FakeQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sessionID int64, sendReply func(*sqltypes.Result) error) error {
func (f *FakeQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(*sqltypes.Result) error) error {
if f.panics && f.streamExecutePanicsEarly {
panic(fmt.Errorf("test-triggered panic early"))
}
@ -586,7 +580,7 @@ func testStreamExecutePanics(t *testing.T, conn tabletconn.TabletConn, f *FakeQu
}
// ExecuteBatch is part of the queryservice.QueryService interface
func (f *FakeQueryService) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, sessionID int64, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
func (f *FakeQueryService) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) ([]sqltypes.Result, error) {
if f.hasError {
return nil, f.tabletError
}
@ -740,7 +734,7 @@ func testBeginExecuteBatchPanics(t *testing.T, conn tabletconn.TabletConn, f *Fa
}
// SplitQuery is part of the queryservice.QueryService interface
func (f *FakeQueryService) SplitQuery(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64, sessionID int64) ([]querytypes.QuerySplit, error) {
func (f *FakeQueryService) SplitQuery(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64) ([]querytypes.QuerySplit, error) {
if f.hasError {
return nil, f.tabletError
}
@ -774,7 +768,7 @@ func (f *FakeQueryService) SplitQueryV2(
splitCount int64,
numRowsPerQueryPart int64,
algorithm querypb.SplitQueryRequest_Algorithm,
sessionID int64) ([]querytypes.QuerySplit, error) {
) ([]querytypes.QuerySplit, error) {
if f.hasError {
return nil, f.tabletError

Просмотреть файл

@ -104,7 +104,6 @@ type TabletServer struct {
// the context of a startRequest-endRequest.
qe *QueryEngine
invalidator *RowcacheInvalidator
sessionID int64
// checkMySQLThrottler is used to throttle the number of
// requests sent to CheckMySQL.
@ -145,7 +144,6 @@ func NewTabletServer(config Config) *TabletServer {
BeginTimeout: sync2.NewAtomicDuration(time.Duration(config.TxPoolTimeout * 1e9)),
checkMySQLThrottler: sync2.NewSemaphore(1, 0),
streamHealthMap: make(map[int]chan<- *querypb.StreamHealthResponse),
sessionID: Rand(),
history: history.New(10),
}
tsv.qe = NewQueryEngine(tsv, config)
@ -383,8 +381,6 @@ func (tsv *TabletServer) serveNewType() (err error) {
} else {
tsv.invalidator.Close()
}
tsv.sessionID = Rand()
log.Infof("Session id: %d", tsv.sessionID)
tsv.transition(StateServing)
return nil
}
@ -429,7 +425,6 @@ func (tsv *TabletServer) StopService() {
tsv.invalidator.Close()
tsv.qe.Close()
tsv.sessionID = Rand()
}
func (tsv *TabletServer) waitForShutdown() {
@ -467,7 +462,6 @@ func (tsv *TabletServer) IsHealthy() error {
nil,
"select 1 from dual",
nil,
tsv.sessionID,
0,
)
return err
@ -542,29 +536,13 @@ func (tsv *TabletServer) QueryServiceStats() *QueryServiceStats {
return tsv.qe.queryServiceStats
}
// GetSessionId returns a sessionInfo response if the state is StateServing.
func (tsv *TabletServer) GetSessionId(keyspace, shard string) (int64, error) {
tsv.mu.Lock()
defer tsv.mu.Unlock()
if tsv.state != StateServing {
return 0, NewTabletError(vtrpcpb.ErrorCode_QUERY_NOT_SERVED, "operation not allowed in state %s", stateName[tsv.state])
}
if keyspace != tsv.dbconfigs.App.Keyspace {
return 0, NewTabletError(vtrpcpb.ErrorCode_INTERNAL_ERROR, "Keyspace mismatch, expecting %v, received %v", tsv.dbconfigs.App.Keyspace, keyspace)
}
if strings.ToLower(shard) != strings.ToLower(tsv.dbconfigs.App.Shard) {
return 0, NewTabletError(vtrpcpb.ErrorCode_INTERNAL_ERROR, "Shard mismatch, expecting %v, received %v", tsv.dbconfigs.App.Shard, shard)
}
return tsv.sessionID, nil
}
// Begin starts a new transaction. This is allowed only if the state is StateServing.
func (tsv *TabletServer) Begin(ctx context.Context, target *querypb.Target, sessionID int64) (transactionID int64, err error) {
func (tsv *TabletServer) Begin(ctx context.Context, target *querypb.Target) (transactionID int64, err error) {
logStats := newLogStats("Begin", ctx)
logStats.OriginalSQL = "begin"
defer handleError(&err, logStats, tsv.qe.queryServiceStats)
if err = tsv.startRequest(target, sessionID, true, false); err != nil {
if err = tsv.startRequest(target, true, false); err != nil {
return 0, err
}
ctx, cancel := withTimeout(ctx, tsv.BeginTimeout.Get())
@ -580,13 +558,13 @@ func (tsv *TabletServer) Begin(ctx context.Context, target *querypb.Target, sess
}
// Commit commits the specified transaction.
func (tsv *TabletServer) Commit(ctx context.Context, target *querypb.Target, sessionID, transactionID int64) (err error) {
func (tsv *TabletServer) Commit(ctx context.Context, target *querypb.Target, transactionID int64) (err error) {
logStats := newLogStats("Commit", ctx)
logStats.OriginalSQL = "commit"
logStats.TransactionID = transactionID
defer handleError(&err, logStats, tsv.qe.queryServiceStats)
if err = tsv.startRequest(target, sessionID, false, true); err != nil {
if err = tsv.startRequest(target, false, true); err != nil {
return err
}
ctx, cancel := withTimeout(ctx, tsv.QueryTimeout.Get())
@ -601,13 +579,13 @@ func (tsv *TabletServer) Commit(ctx context.Context, target *querypb.Target, ses
}
// Rollback rollsback the specified transaction.
func (tsv *TabletServer) Rollback(ctx context.Context, target *querypb.Target, sessionID, transactionID int64) (err error) {
func (tsv *TabletServer) Rollback(ctx context.Context, target *querypb.Target, transactionID int64) (err error) {
logStats := newLogStats("Rollback", ctx)
logStats.OriginalSQL = "rollback"
logStats.TransactionID = transactionID
defer handleError(&err, logStats, tsv.qe.queryServiceStats)
if err = tsv.startRequest(target, sessionID, false, true); err != nil {
if err = tsv.startRequest(target, false, true); err != nil {
return err
}
ctx, cancel := withTimeout(ctx, tsv.QueryTimeout.Get())
@ -650,8 +628,9 @@ func (tsv *TabletServer) handleExecErrorNoPanic(sql string, bindVariables map[st
if tsv.config.TerseErrors && terr.SQLError != 0 && len(bindVariables) != 0 {
myError = &TabletError{
SQLError: terr.SQLError,
SQLState: terr.SQLState,
ErrorCode: terr.ErrorCode,
Message: fmt.Sprintf("(errno %d) during query: %s", terr.SQLError, sql),
Message: fmt.Sprintf("(errno %d) (sqlstate %s) during query: %s", terr.SQLError, terr.SQLState, sql),
}
} else {
myError = terr
@ -691,12 +670,12 @@ func (tsv *TabletServer) handleExecErrorNoPanic(sql string, bindVariables map[st
}
// Execute executes the query and returns the result as response.
func (tsv *TabletServer) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sessionID, transactionID int64) (result *sqltypes.Result, err error) {
func (tsv *TabletServer) Execute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, transactionID int64) (result *sqltypes.Result, err error) {
logStats := newLogStats("Execute", ctx)
defer tsv.handleExecError(sql, bindVariables, &err, logStats)
allowShutdown := (transactionID != 0)
if err = tsv.startRequest(target, sessionID, false, allowShutdown); err != nil {
if err = tsv.startRequest(target, false, allowShutdown); err != nil {
return nil, err
}
ctx, cancel := withTimeout(ctx, tsv.QueryTimeout.Get())
@ -728,11 +707,11 @@ func (tsv *TabletServer) Execute(ctx context.Context, target *querypb.Target, sq
// StreamExecute executes the query and streams the result.
// The first QueryResult will have Fields set (and Rows nil).
// The subsequent QueryResult will have Rows set (and Fields nil).
func (tsv *TabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sessionID int64, sendReply func(*sqltypes.Result) error) (err error) {
func (tsv *TabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(*sqltypes.Result) error) (err error) {
logStats := newLogStats("StreamExecute", ctx)
defer tsv.handleExecError(sql, bindVariables, &err, logStats)
if err = tsv.startRequest(target, sessionID, false, false); err != nil {
if err = tsv.startRequest(target, false, false); err != nil {
return err
}
defer tsv.endRequest(false)
@ -760,7 +739,7 @@ func (tsv *TabletServer) StreamExecute(ctx context.Context, target *querypb.Targ
// ExecuteBatch can be called for an existing transaction, or it can be called with
// the AsTransaction flag which will execute all statements inside an independent
// transaction. If AsTransaction is true, TransactionId must be 0.
func (tsv *TabletServer) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, sessionID int64, asTransaction bool, transactionID int64) (results []sqltypes.Result, err error) {
func (tsv *TabletServer) ExecuteBatch(ctx context.Context, target *querypb.Target, queries []querytypes.BoundQuery, asTransaction bool, transactionID int64) (results []sqltypes.Result, err error) {
if len(queries) == 0 {
return nil, NewTabletError(vtrpcpb.ErrorCode_BAD_INPUT, "Empty query list")
}
@ -769,14 +748,14 @@ func (tsv *TabletServer) ExecuteBatch(ctx context.Context, target *querypb.Targe
}
allowShutdown := (transactionID != 0)
if err = tsv.startRequest(target, sessionID, false, allowShutdown); err != nil {
if err = tsv.startRequest(target, false, allowShutdown); err != nil {
return nil, err
}
defer tsv.endRequest(false)
defer handleError(&err, nil, tsv.qe.queryServiceStats)
if asTransaction {
transactionID, err = tsv.Begin(ctx, target, sessionID)
transactionID, err = tsv.Begin(ctx, target)
if err != nil {
return nil, err
}
@ -784,20 +763,20 @@ func (tsv *TabletServer) ExecuteBatch(ctx context.Context, target *querypb.Targe
// that there was an error, roll it back.
defer func() {
if transactionID != 0 {
tsv.Rollback(ctx, target, sessionID, transactionID)
tsv.Rollback(ctx, target, transactionID)
}
}()
}
results = make([]sqltypes.Result, 0, len(queries))
for _, bound := range queries {
localReply, err := tsv.Execute(ctx, target, bound.Sql, bound.BindVariables, sessionID, transactionID)
localReply, err := tsv.Execute(ctx, target, bound.Sql, bound.BindVariables, transactionID)
if err != nil {
return nil, err
}
results = append(results, *localReply)
}
if asTransaction {
if err = tsv.Commit(ctx, target, sessionID, transactionID); err != nil {
if err = tsv.Commit(ctx, target, transactionID); err != nil {
transactionID = 0
return nil, err
}
@ -810,12 +789,12 @@ func (tsv *TabletServer) ExecuteBatch(ctx context.Context, target *querypb.Targe
// subset of rows from the original query.
// TODO(erez): Remove this method and rename SplitQueryV2 to SplitQuery once we migrate to
// SplitQuery V2.
func (tsv *TabletServer) SplitQuery(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64, sessionID int64) (splits []querytypes.QuerySplit, err error) {
func (tsv *TabletServer) SplitQuery(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, splitColumn string, splitCount int64) (splits []querytypes.QuerySplit, err error) {
logStats := newLogStats("SplitQuery", ctx)
logStats.OriginalSQL = sql
logStats.BindVariables = bindVariables
defer handleError(&err, logStats, tsv.qe.queryServiceStats)
if err = tsv.startRequest(target, sessionID, false, false); err != nil {
if err = tsv.startRequest(target, false, false); err != nil {
return nil, err
}
ctx, cancel := withTimeout(ctx, tsv.QueryTimeout.Get())
@ -870,13 +849,12 @@ func (tsv *TabletServer) SplitQueryV2(
splitCount int64,
numRowsPerQueryPart int64,
algorithm querypb.SplitQueryRequest_Algorithm,
sessionID int64,
) (splits []querytypes.QuerySplit, err error) {
logStats := newLogStats("SplitQuery", ctx)
logStats.OriginalSQL = sql
logStats.BindVariables = bindVariables
defer handleError(&err, logStats, tsv.qe.queryServiceStats)
if err = tsv.startRequest(target, sessionID, false, false); err != nil {
if err = tsv.startRequest(target, false, false); err != nil {
return nil, err
}
// We don't set a timeout for SplitQueryV2.
@ -892,7 +870,7 @@ func (tsv *TabletServer) SplitQueryV2(
splitCount,
numRowsPerQueryPart,
algorithm,
sessionID); err != nil {
); err != nil {
return nil, err
}
schema := getSchemaForSplitQuery(tsv.qe.schemaInfo)
@ -929,7 +907,6 @@ func validateSplitQueryParameters(
splitCount int64,
numRowsPerQueryPart int64,
algorithm querypb.SplitQueryRequest_Algorithm,
sessionID int64,
) error {
// Check that the caller requested a RDONLY tablet.
// Since we're called by VTGate this should not normally be violated.
@ -1146,12 +1123,12 @@ func (tsv *TabletServer) BroadcastHealth(terTimestamp int64, stats *querypb.Real
tsv.lastStreamHealthResponse = shr
}
// startRequest validates the current state and sessionID and registers
// startRequest validates the current state and target and registers
// the request (a waitgroup) as started. Every startRequest requires one
// and only one corresponding endRequest. When the service shuts down,
// StopService will wait on this waitgroup to ensure that there are
// no requests in flight.
func (tsv *TabletServer) startRequest(target *querypb.Target, sessionID int64, isBegin, allowShutdown bool) (err error) {
func (tsv *TabletServer) startRequest(target *querypb.Target, isBegin, allowShutdown bool) (err error) {
tsv.mu.Lock()
defer tsv.mu.Unlock()
if tsv.state == StateServing {
@ -1181,9 +1158,6 @@ verifySession:
}
goto ok
}
if sessionID != tsv.sessionID {
return NewTabletError(vtrpcpb.ErrorCode_QUERY_NOT_SERVED, "Invalid session Id %v", sessionID)
}
ok:
tsv.requests.Add(1)

Просмотреть файл

@ -488,14 +488,14 @@ func TestTabletServerReconnect(t *testing.T) {
if err != nil {
t.Fatalf("TabletServer.StartService should success but get error: %v", err)
}
_, err = tsv.Execute(context.Background(), nil, query, nil, tsv.sessionID, 0)
_, err = tsv.Execute(context.Background(), nil, query, nil, 0)
if err != nil {
t.Error(err)
}
// make mysql conn fail
db.EnableConnFail()
_, err = tsv.Execute(context.Background(), nil, query, nil, tsv.sessionID, 0)
_, err = tsv.Execute(context.Background(), nil, query, nil, 0)
if err == nil {
t.Error("Execute: want error, got nil")
}
@ -510,94 +510,12 @@ func TestTabletServerReconnect(t *testing.T) {
if err != nil {
t.Error(err)
}
_, err = tsv.Execute(context.Background(), nil, query, nil, tsv.sessionID, 0)
_, err = tsv.Execute(context.Background(), nil, query, nil, 0)
if err != nil {
t.Error(err)
}
}
func TestTabletServerGetSessionId(t *testing.T) {
db := setUpTabletServerTest()
testUtils := newTestUtils()
config := testUtils.newQueryServiceConfig()
tsv := NewTabletServer(config)
if _, err := tsv.GetSessionId("", ""); err == nil {
t.Fatalf("call GetSessionId while not serving should get an error")
}
keyspace := "test_keyspace"
shard := "0"
dbconfigs := testUtils.newDBConfigs(db)
target := querypb.Target{TabletType: topodatapb.TabletType_MASTER}
err := tsv.StartService(target, dbconfigs, []SchemaOverride{}, testUtils.newMysqld(&dbconfigs))
if err != nil {
t.Fatalf("StartService failed: %v", err)
}
defer tsv.StopService()
sessionID, err := tsv.GetSessionId(keyspace, shard)
if err != nil {
t.Fatalf("got GetSessionId error: %v", err)
}
if sessionID != tsv.sessionID {
t.Fatalf("call GetSessionId returns an unexpected session id, "+
"expect seesion id: %d but got %d", tsv.sessionID,
sessionID)
}
_, err = tsv.GetSessionId(keyspace, "")
if err == nil {
t.Fatalf("call GetSessionId should fail because of missing shard in request")
}
_, err = tsv.GetSessionId("", shard)
if err == nil {
t.Fatalf("call GetSessionId should fail because of missing keyspace in request")
}
}
func TestTabletServerCommandFailUnMatchedSessionId(t *testing.T) {
db := setUpTabletServerTest()
testUtils := newTestUtils()
config := testUtils.newQueryServiceConfig()
tsv := NewTabletServer(config)
dbconfigs := testUtils.newDBConfigs(db)
target := querypb.Target{TabletType: topodatapb.TabletType_MASTER}
err := tsv.StartService(target, dbconfigs, []SchemaOverride{}, testUtils.newMysqld(&dbconfigs))
if err != nil {
t.Fatalf("StartService failed: %v", err)
}
defer tsv.StopService()
ctx := context.Background()
if _, err = tsv.Begin(ctx, nil, 0); err == nil {
t.Fatalf("call TabletServer.Begin should fail because of an invalid session id: 0")
}
if err = tsv.Commit(ctx, nil, 0, 0); err == nil {
t.Fatalf("call TabletServer.Commit should fail because of an invalid session id: 0")
}
if err = tsv.Rollback(ctx, nil, 0, 0); err == nil {
t.Fatalf("call TabletServer.Rollback should fail because of an invalid session id: 0")
}
if _, err := tsv.Execute(ctx, nil, "select * from test_table limit 1000", nil, 0, 0); err == nil {
t.Fatalf("call TabletServer.Execute should fail because of an invalid session id: 0")
}
streamSendReply := func(*sqltypes.Result) error { return nil }
if err = tsv.StreamExecute(ctx, nil, "select * from test_table limit 1000", nil, 0, streamSendReply); err == nil {
t.Fatalf("call TabletServer.StreamExecute should fail because of an invalid session id: 0")
}
if _, err = tsv.ExecuteBatch(ctx, nil, []querytypes.BoundQuery{
{
Sql: "noquery",
BindVariables: nil,
},
}, 0, false, 0); err == nil {
t.Fatalf("call TabletServer.ExecuteBatch should fail because of an invalid session id: 0")
}
if _, err = tsv.SplitQuery(ctx, nil, "select * from test_table where count > :count", nil, "", 10, 0); err == nil {
t.Fatalf("call TabletServer.SplitQuery should fail because of an invalid session id: 0")
}
}
func TestTabletServerTarget(t *testing.T) {
db := setUpTabletServerTest()
testUtils := newTestUtils()
@ -614,21 +532,21 @@ func TestTabletServerTarget(t *testing.T) {
ctx := context.Background()
db.AddQuery("select * from test_table limit 1000", &sqltypes.Result{})
_, err = tsv.Execute(ctx, &target1, "select * from test_table limit 1000", nil, 0, 0)
_, err = tsv.Execute(ctx, &target1, "select * from test_table limit 1000", nil, 0)
if err != nil {
t.Fatal(err)
}
_, err = tsv.Execute(ctx, &target2, "select * from test_table limit 1000", nil, 0, 0)
_, err = tsv.Execute(ctx, &target2, "select * from test_table limit 1000", nil, 0)
want := "Invalid tablet type"
if err == nil || !strings.Contains(err.Error(), want) {
t.Errorf("err: %v, must contain %s", err, want)
}
tsv.SetServingType(topodatapb.TabletType_MASTER, true, []topodatapb.TabletType{topodatapb.TabletType_REPLICA})
_, err = tsv.Execute(ctx, &target1, "select * from test_table limit 1000", nil, 0, 0)
_, err = tsv.Execute(ctx, &target1, "select * from test_table limit 1000", nil, 0)
if err != nil {
t.Fatal(err)
}
_, err = tsv.Execute(ctx, &target2, "select * from test_table limit 1000", nil, 0, 0)
_, err = tsv.Execute(ctx, &target2, "select * from test_table limit 1000", nil, 0)
if err != nil {
t.Fatal(err)
}
@ -656,14 +574,14 @@ func TestTabletServerCommitTransaciton(t *testing.T) {
}
defer tsv.StopService()
ctx := context.Background()
transactionID, err := tsv.Begin(ctx, nil, tsv.sessionID)
transactionID, err := tsv.Begin(ctx, nil)
if err != nil {
t.Fatalf("call TabletServer.Begin failed")
}
if _, err := tsv.Execute(ctx, nil, executeSQL, nil, tsv.sessionID, transactionID); err != nil {
if _, err := tsv.Execute(ctx, nil, executeSQL, nil, transactionID); err != nil {
t.Fatalf("failed to execute query: %s", executeSQL)
}
if err := tsv.Commit(ctx, nil, tsv.sessionID, transactionID); err != nil {
if err := tsv.Commit(ctx, nil, transactionID); err != nil {
t.Fatalf("call TabletServer.Commit failed")
}
}
@ -690,14 +608,14 @@ func TestTabletServerRollback(t *testing.T) {
}
defer tsv.StopService()
ctx := context.Background()
transactionID, err := tsv.Begin(ctx, nil, tsv.sessionID)
transactionID, err := tsv.Begin(ctx, nil)
if err != nil {
t.Fatalf("call TabletServer.Begin failed")
}
if _, err := tsv.Execute(ctx, nil, executeSQL, nil, tsv.sessionID, transactionID); err != nil {
if _, err := tsv.Execute(ctx, nil, executeSQL, nil, transactionID); err != nil {
t.Fatalf("failed to execute query: %s", executeSQL)
}
if err := tsv.Rollback(ctx, nil, tsv.sessionID, transactionID); err != nil {
if err := tsv.Rollback(ctx, nil, transactionID); err != nil {
t.Fatalf("call TabletServer.Rollback failed")
}
}
@ -726,7 +644,7 @@ func TestTabletServerStreamExecute(t *testing.T) {
defer tsv.StopService()
ctx := context.Background()
sendReply := func(*sqltypes.Result) error { return nil }
if err := tsv.StreamExecute(ctx, nil, executeSQL, nil, tsv.sessionID, sendReply); err != nil {
if err := tsv.StreamExecute(ctx, nil, executeSQL, nil, sendReply); err != nil {
t.Fatalf("TabletServer.StreamExecute should success: %s, but get error: %v",
executeSQL, err)
}
@ -756,7 +674,7 @@ func TestTabletServerExecuteBatch(t *testing.T) {
Sql: sql,
BindVariables: nil,
},
}, tsv.sessionID, true, 0); err != nil {
}, true, 0); err != nil {
t.Fatalf("TabletServer.ExecuteBatch should success: %v, but get error: %v",
sql, err)
}
@ -775,7 +693,7 @@ func TestTabletServerExecuteBatchFailEmptyQueryList(t *testing.T) {
}
defer tsv.StopService()
ctx := context.Background()
_, err = tsv.ExecuteBatch(ctx, nil, []querytypes.BoundQuery{}, tsv.sessionID, false, 0)
_, err = tsv.ExecuteBatch(ctx, nil, []querytypes.BoundQuery{}, false, 0)
verifyTabletError(t, err, vtrpcpb.ErrorCode_BAD_INPUT)
}
@ -797,7 +715,7 @@ func TestTabletServerExecuteBatchFailAsTransaction(t *testing.T) {
Sql: "begin",
BindVariables: nil,
},
}, tsv.sessionID, true, 1)
}, true, 1)
verifyTabletError(t, err, vtrpcpb.ErrorCode_BAD_INPUT)
}
@ -821,7 +739,7 @@ func TestTabletServerExecuteBatchBeginFail(t *testing.T) {
Sql: "begin",
BindVariables: nil,
},
}, tsv.sessionID, false, 0); err == nil {
}, false, 0); err == nil {
t.Fatalf("TabletServer.ExecuteBatch should fail")
}
}
@ -850,7 +768,7 @@ func TestTabletServerExecuteBatchCommitFail(t *testing.T) {
Sql: "commit",
BindVariables: nil,
},
}, tsv.sessionID, false, 0); err == nil {
}, false, 0); err == nil {
t.Fatalf("TabletServer.ExecuteBatch should fail")
}
}
@ -888,7 +806,7 @@ func TestTabletServerExecuteBatchSqlExecFailInTransaction(t *testing.T) {
Sql: sql,
BindVariables: nil,
},
}, tsv.sessionID, true, 0); err == nil {
}, true, 0); err == nil {
t.Fatalf("TabletServer.ExecuteBatch should fail")
}
@ -926,7 +844,7 @@ func TestTabletServerExecuteBatchSqlSucceedInTransaction(t *testing.T) {
Sql: sql,
BindVariables: nil,
},
}, tsv.sessionID, false, 0); err != nil {
}, false, 0); err != nil {
t.Fatalf("TabletServer.ExecuteBatch should succeed")
}
}
@ -949,7 +867,7 @@ func TestTabletServerExecuteBatchCallCommitWithoutABegin(t *testing.T) {
Sql: "commit",
BindVariables: nil,
},
}, tsv.sessionID, false, 0); err == nil {
}, false, 0); err == nil {
t.Fatalf("TabletServer.ExecuteBatch should fail")
}
}
@ -994,7 +912,7 @@ func TestExecuteBatchNestedTransaction(t *testing.T) {
Sql: "commit",
BindVariables: nil,
},
}, tsv.sessionID, false, 0); err == nil {
}, false, 0); err == nil {
t.Fatalf("TabletServer.Execute should fail because of nested transaction")
}
tsv.qe.txPool.SetTimeout(10)
@ -1037,7 +955,7 @@ func TestTabletServerSplitQuery(t *testing.T) {
defer tsv.StopService()
ctx := context.Background()
sql := "select * from test_table where count > :count"
if _, err := tsv.SplitQuery(ctx, nil, sql, nil, "", 10, tsv.sessionID); err != nil {
if _, err := tsv.SplitQuery(ctx, nil, sql, nil, "", 10); err != nil {
t.Fatalf("TabletServer.SplitQuery should success: %v, but get error: %v", sql, err)
}
}
@ -1077,8 +995,7 @@ func TestTabletServerSplitQueryV2(t *testing.T) {
[]string{}, /* splitColumns */
10, /* splitCount */
0, /* numRowsPerQueryPart */
querypb.SplitQueryRequest_EQUAL_SPLITS,
tsv.sessionID)
querypb.SplitQueryRequest_EQUAL_SPLITS)
if err != nil {
t.Fatalf("TabletServer.SplitQuery should succeed: %v, but get error: %v", sql, err)
}
@ -1124,7 +1041,7 @@ func TestTabletServerSplitQueryInvalidQuery(t *testing.T) {
defer tsv.StopService()
ctx := context.Background()
// add limit clause to make SplitQuery fail
if _, err := tsv.SplitQuery(ctx, nil, "select * from test_table where count > :count limit 1000", nil, "", 10, tsv.sessionID); err == nil {
if _, err := tsv.SplitQuery(ctx, nil, "select * from test_table where count > :count limit 1000", nil, "", 10); err == nil {
t.Fatalf("TabletServer.SplitQuery should fail")
}
}
@ -1154,8 +1071,7 @@ func TestTabletServerSplitQueryV2InvalidQuery(t *testing.T) {
[]string{}, /* splitColumns */
10, /* splitCount */
0, /* numRowsPerQueryPart */
querypb.SplitQueryRequest_EQUAL_SPLITS,
tsv.sessionID)
querypb.SplitQueryRequest_EQUAL_SPLITS)
if err == nil {
t.Fatalf("TabletServer.SplitQuery should fail")
}
@ -1202,7 +1118,7 @@ func TestTabletServerSplitQueryInvalidMinMax(t *testing.T) {
}
defer tsv.StopService()
ctx := context.Background()
if _, err := tsv.SplitQuery(ctx, nil, "select * from test_table where count > :count", nil, "", 10, tsv.sessionID); err == nil {
if _, err := tsv.SplitQuery(ctx, nil, "select * from test_table where count > :count", nil, "", 10); err == nil {
t.Fatalf("TabletServer.SplitQuery should fail")
}
}
@ -1232,8 +1148,7 @@ func TestTabletServerSplitQueryV2InvalidParams(t *testing.T) {
[]string{}, /* splitColumns */
10, /* splitCount */
11, /* numRowsPerQueryPart */
querypb.SplitQueryRequest_EQUAL_SPLITS,
tsv.sessionID)
querypb.SplitQueryRequest_EQUAL_SPLITS)
if err == nil {
t.Fatalf("TabletServer.SplitQuery should fail")
}
@ -1267,7 +1182,7 @@ func TestHandleExecTabletError(t *testing.T) {
panic(NewTabletError(vtrpcpb.ErrorCode_INTERNAL_ERROR, "tablet error"))
}
func TestTerseErrors1(t *testing.T) {
func TestTerseErrorsNonSQLError(t *testing.T) {
ctx := context.Background()
logStats := newLogStats("TestHandleExecError", ctx)
var err error
@ -1285,12 +1200,12 @@ func TestTerseErrors1(t *testing.T) {
panic(NewTabletError(vtrpcpb.ErrorCode_INTERNAL_ERROR, "tablet error"))
}
func TestTerseErrors2(t *testing.T) {
func TestTerseErrorsBindVars(t *testing.T) {
ctx := context.Background()
logStats := newLogStats("TestHandleExecError", ctx)
var err error
defer func() {
want := "error: (errno 10) during query: select * from test_table"
want := "error: (errno 10) (sqlstate HY000) during query: select * from test_table"
if err == nil || err.Error() != want {
t.Errorf("Error: %v, want '%s'", err, want)
}
@ -1304,10 +1219,11 @@ func TestTerseErrors2(t *testing.T) {
ErrorCode: vtrpcpb.ErrorCode_DEADLINE_EXCEEDED,
Message: "msg",
SQLError: 10,
SQLState: "HY000",
})
}
func TestTerseErrors3(t *testing.T) {
func TestTerseErrorsNoBindVars(t *testing.T) {
ctx := context.Background()
logStats := newLogStats("TestHandleExecError", ctx)
var err error

Просмотреть файл

@ -237,7 +237,7 @@ type testQueryService struct {
*fakes.StreamHealthQueryService
}
func (sq *testQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sessionID int64, sendReply func(reply *sqltypes.Result) error) error {
func (sq *testQueryService) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(reply *sqltypes.Result) error) error {
// Custom parsing of the query we expect.
min := splitCloneTestMin
max := splitCloneTestMax

Просмотреть файл

@ -36,7 +36,7 @@ type destinationTabletServer struct {
excludedTable string
}
func (sq *destinationTabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sessionID int64, sendReply func(reply *sqltypes.Result) error) error {
func (sq *destinationTabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(reply *sqltypes.Result) error) error {
if strings.Contains(sql, sq.excludedTable) {
sq.t.Errorf("Split Diff operation on destination should skip the excluded table: %v query: %v", sq.excludedTable, sql)
}
@ -98,7 +98,7 @@ type sourceTabletServer struct {
v3 bool
}
func (sq *sourceTabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sessionID int64, sendReply func(reply *sqltypes.Result) error) error {
func (sq *sourceTabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(reply *sqltypes.Result) error) error {
if strings.Contains(sql, sq.excludedTable) {
sq.t.Errorf("Split Diff operation on source should skip the excluded table: %v query: %v", sq.excludedTable, sql)
}

Просмотреть файл

@ -40,7 +40,7 @@ type verticalTabletServer struct {
*fakes.StreamHealthQueryService
}
func (sq *verticalTabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sessionID int64, sendReply func(reply *sqltypes.Result) error) error {
func (sq *verticalTabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(reply *sqltypes.Result) error) error {
// Custom parsing of the query we expect
min := verticalSplitCloneTestMin
max := verticalSplitCloneTestMax

Просмотреть файл

@ -35,7 +35,7 @@ type verticalDiffTabletServer struct {
*fakes.StreamHealthQueryService
}
func (sq *verticalDiffTabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sessionID int64, sendReply func(reply *sqltypes.Result) error) error {
func (sq *verticalDiffTabletServer) StreamExecute(ctx context.Context, target *querypb.Target, sql string, bindVariables map[string]interface{}, sendReply func(reply *sqltypes.Result) error) error {
if !strings.Contains(sql, "moving1") {
sq.t.Errorf("Vertical Split Diff operation should only operate on the 'moving1' table. query: %v", sql)
}

Просмотреть файл

@ -29,6 +29,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
/**
* Proto contains methods for working with Vitess protobuf messages.
*/
@ -45,25 +47,83 @@ public class Proto {
*/
public static void checkError(RPCError error) throws SQLException {
if (error != null) {
int errno = getErrno(error.getMessage());
String sqlState = getSQLState(error.getMessage());
switch (error.getCode()) {
case SUCCESS:
break;
case BAD_INPUT:
throw new SQLSyntaxErrorException(error.toString());
throw new SQLSyntaxErrorException(error.toString(), sqlState, errno);
case DEADLINE_EXCEEDED:
throw new SQLTimeoutException(error.toString());
throw new SQLTimeoutException(error.toString(), sqlState, errno);
case INTEGRITY_ERROR:
throw new SQLIntegrityConstraintViolationException(error.toString());
throw new SQLIntegrityConstraintViolationException(error.toString(), sqlState, errno);
case TRANSIENT_ERROR:
throw new SQLTransientException(error.toString());
throw new SQLTransientException(error.toString(), sqlState, errno);
case UNAUTHENTICATED:
throw new SQLInvalidAuthorizationSpecException(error.toString());
throw new SQLInvalidAuthorizationSpecException(error.toString(), sqlState, errno);
default:
throw new SQLNonTransientException("Vitess RPC error: " + error.toString());
throw new SQLNonTransientException(
"Vitess RPC error: " + error.toString(), sqlState, errno);
}
}
}
/**
* Extracts the MySQL errno from a Vitess error message, if any.
*
* <p>
* If no errno information is found, it returns {@code 0}.
*/
public static int getErrno(@Nullable String errorMessage) {
if (errorMessage == null) {
return 0;
}
int tagPos = errorMessage.indexOf("(errno ");
if (tagPos == -1) {
return 0;
}
int start = tagPos + "(errno ".length();
if (start >= errorMessage.length()) {
return 0;
}
int end = errorMessage.indexOf(')', start);
if (end == -1) {
return 0;
}
try {
return Integer.parseInt(errorMessage.substring(start, end));
} catch (NumberFormatException e) {
return 0;
}
}
/**
* Extracts the SQLSTATE from a Vitess error message, if any.
*
* <p>
* If no SQLSTATE information is found, it returns {@code ""}.
*/
public static String getSQLState(@Nullable String errorMessage) {
if (errorMessage == null) {
return "";
}
int tagPos = errorMessage.indexOf("(sqlstate ");
if (tagPos == -1) {
return "";
}
int start = tagPos + "(sqlstate ".length();
if (start >= errorMessage.length()) {
return "";
}
int end = errorMessage.indexOf(')', start);
if (end == -1) {
return "";
}
return errorMessage.substring(start, end);
}
public static BindVariable buildBindVariable(Object value) {
BindVariable.Builder builder = BindVariable.newBuilder();

Просмотреть файл

@ -14,20 +14,22 @@ import java.util.concurrent.TimeoutException;
/**
* A ListenableFuture with an optional getter method that throws checked SQLException.
*
* <p>When used as a {@link ListenableFuture}, the {@link SQLException} thrown by
* Vitess will be wrapped in {@link ExecutionException}. You can retrieve it by calling
* <p>
* When used as a {@link ListenableFuture}, the {@link SQLException} thrown by Vitess will be
* wrapped in {@link ExecutionException}. You can retrieve it by calling
* {@link ExecutionException#getCause()}.
*
* <p>For users who want to get results synchronously, we provide {@link #checkedGet()}
* as a convenience method. Unlike {@link #get()}, it throws only {@code SQLException},
* so e.g. {@code vtgateConn.execute(...).checkedGet()} behaves the same as our
* old synchronous API.
* <p>
* For users who want to get results synchronously, we provide {@link #checkedGet()} as a
* convenience method. Unlike {@link #get()}, it throws only {@code SQLException}, so e.g.
* {@code vtgateConn.execute(...).checkedGet()} behaves the same as our old synchronous API.
*
* <p>The additional methods are similar to the {@code CheckedFuture} interface (marked as beta),
* but this class does not declare that it implements {@code CheckedFuture} because that interface
* is not recommended for new projects. See the
* <a href="https://google.github.io/guava/releases/19.0/api/docs/com/google/common/util/concurrent/CheckedFuture.html">CheckedFuture docs</a>
* for more information.
* <p>
* The additional methods are similar to the {@code CheckedFuture} interface (marked as beta), but
* this class does not declare that it implements {@code CheckedFuture} because that interface is
* not recommended for new projects. See the <a href=
* "https://google.github.io/guava/releases/19.0/api/docs/com/google/common/util/concurrent/CheckedFuture.html">
* CheckedFuture docs</a> for more information.
*/
public class SQLFuture<V> extends SimpleForwardingListenableFuture<V> {
/**
@ -40,8 +42,9 @@ public class SQLFuture<V> extends SimpleForwardingListenableFuture<V> {
/**
* Returns the result while ensuring the appropriate SQLException is thrown for Vitess errors.
*
* <p>This can be used to effectively turn the Vitess client into a synchronous API.
* For example: {@code Cursor cursor = vtgateConn.execute(...).checkedGet();}
* <p>
* This can be used to effectively turn the Vitess client into a synchronous API. For example:
* {@code Cursor cursor = vtgateConn.execute(...).checkedGet();}
*/
public V checkedGet() throws SQLException {
try {
@ -59,8 +62,9 @@ public class SQLFuture<V> extends SimpleForwardingListenableFuture<V> {
/**
* Returns the result while ensuring the appropriate SQLException is thrown for Vitess errors.
*
* <p>This can be used to effectively turn the Vitess client into a synchronous API.
* For example: {@code Cursor cursor = vtgateConn.execute(...).checkedGet();}
* <p>
* This can be used to effectively turn the Vitess client into a synchronous API. For example:
* {@code Cursor cursor = vtgateConn.execute(...).checkedGet();}
*/
public V checkedGet(long timeout, TimeUnit unit) throws TimeoutException, SQLException {
try {
@ -76,15 +80,14 @@ public class SQLFuture<V> extends SimpleForwardingListenableFuture<V> {
}
/**
* Translates from an {@link InterruptedException},
* {@link CancellationException} or {@link ExecutionException} thrown by
* {@code get} to an exception of type {@code SQLException} to be thrown by
* {@code checkedGet}.
* Translates from an {@link InterruptedException}, {@link CancellationException} or
* {@link ExecutionException} thrown by {@code get} to an exception of type {@code SQLException}
* to be thrown by {@code checkedGet}.
*
* <p>If {@code e} is an {@code InterruptedException}, the calling
* {@code checkedGet} method has already restored the interrupt after catching
* the exception. If an implementation of {@link #mapException(Exception)}
* wishes to swallow the interrupt, it can do so by calling
* <p>
* If {@code e} is an {@code InterruptedException}, the calling {@code checkedGet} method has
* already restored the interrupt after catching the exception. If an implementation of
* {@link #mapException(Exception)} wishes to swallow the interrupt, it can do so by calling
* {@link Thread#interrupted()}.
*/
protected SQLException mapException(Exception e) {
@ -94,17 +97,19 @@ public class SQLFuture<V> extends SimpleForwardingListenableFuture<V> {
// subclass of the original exception.
Throwable cause = e.getCause();
if (cause instanceof SQLException) {
SQLException se = (SQLException) cause;
try {
Constructor<? extends Throwable> constructor =
cause.getClass().getConstructor(Throwable.class);
return (SQLException) constructor.newInstance(e);
} catch (
NoSuchMethodException
| InstantiationException
| IllegalAccessException
| IllegalArgumentException
| InvocationTargetException
e1) {
cause
.getClass()
.getConstructor(String.class, String.class, int.class, Throwable.class);
return (SQLException)
constructor.newInstance(se.getMessage(), se.getSQLState(), se.getErrorCode(), e);
} catch (NoSuchMethodException
| InstantiationException
| IllegalAccessException
| IllegalArgumentException
| InvocationTargetException e1) {
throw new RuntimeException(
"SQLException subclass can't be instantiated: " + cause.getClass().getName(), e1);
}

Просмотреть файл

@ -0,0 +1,44 @@
package com.youtube.vitess.client;
import com.google.common.collect.ImmutableMap;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.Map;
@RunWith(JUnit4.class)
public class ProtoTest {
@Test
public void testGetErrno() {
final Map<String, Integer> testValues =
new ImmutableMap.Builder<String, Integer>()
.put("no errno", 0)
.put("bad format (errno ", 0)
.put("bad format (errno ...", 0)
.put("good format, bad number (errno 123A)", 0)
.put("good format, good number (errno 1234) ...", 1234)
.build();
for (Map.Entry<String, Integer> entry : testValues.entrySet()) {
Assert.assertEquals((int) entry.getValue(), Proto.getErrno(entry.getKey()));
}
}
@Test
public void testGetSQLState() {
final Map<String, String> testValues =
new ImmutableMap.Builder<String, String>()
.put("no sqlstate", "")
.put("bad format (sqlstate ", "")
.put("bad format (sqlstate ...", "")
.put("good format (sqlstate abcd) ...", "abcd")
.build();
for (Map.Entry<String, String> entry : testValues.entrySet()) {
Assert.assertEquals(entry.getValue(), Proto.getSQLState(entry.getKey()));
}
}
}

Просмотреть файл

@ -22,6 +22,7 @@ import org.junit.Test;
import java.nio.charset.StandardCharsets;
import java.sql.SQLDataException;
import java.sql.SQLException;
import java.sql.SQLIntegrityConstraintViolationException;
import java.sql.SQLInvalidAuthorizationSpecException;
import java.sql.SQLNonTransientException;
@ -34,8 +35,8 @@ import java.util.List;
import java.util.Map;
/**
* RpcClientTest tests a given implementation of RpcClient
* against a mock vtgate server (go/cmd/vtgateclienttest).
* RpcClientTest tests a given implementation of RpcClient against a mock vtgate server
* (go/cmd/vtgateclienttest).
*
* Each implementation should extend this class and add a @BeforeClass method that starts the
* vtgateclienttest server with the necessary parameters, and then sets 'client'.
@ -499,6 +500,14 @@ public abstract class RpcClientTest {
Assert.fail("no exception thrown for " + query);
} catch (Exception e) {
Assert.assertEquals(cls, e.getClass());
if (error == "integrity error") {
// The mock test server sends back errno:1062 sqlstate:23000 for this case.
// Make sure these values get properly extracted by the client.
SQLException sqlException = (SQLException) e;
Assert.assertEquals(1062, sqlException.getErrorCode());
Assert.assertEquals("23000", sqlException.getSQLState());
}
}
// Don't close the transaction on partial error.
@ -509,6 +518,14 @@ public abstract class RpcClientTest {
Assert.fail("no exception thrown for " + query);
} catch (Exception e) {
Assert.assertEquals(cls, e.getClass());
if (error == "integrity error") {
// The mock test server sends back errno:1062 sqlstate:23000 for this case.
// Make sure these values get properly extracted by the client.
SQLException sqlException = (SQLException) e;
Assert.assertEquals(1062, sqlException.getErrorCode());
Assert.assertEquals("23000", sqlException.getSQLState());
}
}
// The transaction should still be usable now.
tx.rollback(ctx);

Просмотреть файл

@ -5,6 +5,7 @@ import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.youtube.vitess.client.Context;
import com.youtube.vitess.client.Proto;
import com.youtube.vitess.client.RpcClient;
import com.youtube.vitess.client.StreamIterator;
import com.youtube.vitess.proto.Query.QueryResult;
@ -248,17 +249,21 @@ public class GrpcClient implements RpcClient {
static SQLException convertGrpcError(Throwable e) {
if (e instanceof StatusRuntimeException) {
StatusRuntimeException sre = (StatusRuntimeException) e;
int errno = Proto.getErrno(sre.getMessage());
String sqlState = Proto.getSQLState(sre.getMessage());
switch (sre.getStatus().getCode()) {
case INVALID_ARGUMENT:
return new SQLSyntaxErrorException(sre.toString(), sre);
return new SQLSyntaxErrorException(sre.toString(), sqlState, errno, sre);
case DEADLINE_EXCEEDED:
return new SQLTimeoutException(sre.toString(), sre);
return new SQLTimeoutException(sre.toString(), sqlState, errno, sre);
case ALREADY_EXISTS:
return new SQLIntegrityConstraintViolationException(sre.toString(), sre);
return new SQLIntegrityConstraintViolationException(sre.toString(), sqlState, errno, sre);
case UNAUTHENTICATED:
return new SQLInvalidAuthorizationSpecException(sre.toString(), sre);
return new SQLInvalidAuthorizationSpecException(sre.toString(), sqlState, errno, sre);
case UNAVAILABLE:
return new SQLTransientException(sre.toString(), sre);
return new SQLTransientException(sre.toString(), sqlState, errno, sre);
default: // Covers e.g. UNKNOWN.
String advice = "";
if (e.getCause() instanceof java.nio.channels.ClosedChannelException) {
@ -266,7 +271,7 @@ public class GrpcClient implements RpcClient {
"Failed to connect to vtgate. Make sure that vtgate is running and you are using the correct address. Details: ";
}
return new SQLNonTransientException(
"gRPC StatusRuntimeException: " + advice + e.toString(), e);
"gRPC StatusRuntimeException: " + advice + e.toString(), sqlState, errno, e);
}
}
return new SQLNonTransientException("gRPC error: " + e.toString(), e);

Просмотреть файл

@ -80,32 +80,6 @@
<target>7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>
<exclude>log4j:log4j:jar:</exclude>
<exclude>org.slf4j:slf4j-log4j12:jar:</exclude>
<exclude>org.slf4j:slf4j-api:jar:</exclude>
<exclude>com.fasterxml.jackson.core:jackson-core:jar:</exclude>
<exclude>com.sun.jersey:jersey-client:jar:</exclude>
<exclude>com.sun.jersey:jersey-core:jar:</exclude>
<exclude>javax.servlet:servlet-api:jar:</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Просмотреть файл

@ -10,6 +10,7 @@ import com.youtube.vitess.client.VTGateTx;
import com.youtube.vitess.client.cursor.Cursor;
import com.youtube.vitess.proto.Query;
import com.youtube.vitess.proto.Topodata;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -21,8 +22,17 @@ import org.powermock.modules.junit4.PowerMockRunner;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.*;
import java.util.*;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Time;
import java.sql.Timestamp;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
/**
* Created by harshit.gangal on 09/02/16.
@ -440,7 +450,9 @@ import java.util.*;
String stringValue = "vitess";
byte[] bytesValue = stringValue.getBytes();
Date dateValue = new Date(0);
Time timeValue = new Time(0);
// Use a time value that won't go negative after adjusting for time zone.
// The java.sql.Time class does not properly format negative times.
Time timeValue = new Time(12*60*60*1000);
Timestamp timestampValue = new Timestamp(0);
preparedStatement.setNull(1, Types.INTEGER);

Просмотреть файл

@ -0,0 +1,289 @@
<?php
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
// Source: query.proto
namespace Vitess\Proto\Query {
class BeginExecuteBatchRequest extends \DrSlump\Protobuf\Message {
/** @var \Vitess\Proto\Vtrpc\CallerID */
public $effective_caller_id = null;
/** @var \Vitess\Proto\Query\VTGateCallerID */
public $immediate_caller_id = null;
/** @var \Vitess\Proto\Query\Target */
public $target = null;
/** @var \Vitess\Proto\Query\BoundQuery[] */
public $queries = array();
/** @var boolean */
public $as_transaction = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'query.BeginExecuteBatchRequest');
// OPTIONAL MESSAGE effective_caller_id = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "effective_caller_id";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\Vitess\Proto\Vtrpc\CallerID';
$descriptor->addField($f);
// OPTIONAL MESSAGE immediate_caller_id = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "immediate_caller_id";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\Vitess\Proto\Query\VTGateCallerID';
$descriptor->addField($f);
// OPTIONAL MESSAGE target = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "target";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\Vitess\Proto\Query\Target';
$descriptor->addField($f);
// REPEATED MESSAGE queries = 4
$f = new \DrSlump\Protobuf\Field();
$f->number = 4;
$f->name = "queries";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$f->reference = '\Vitess\Proto\Query\BoundQuery';
$descriptor->addField($f);
// OPTIONAL BOOL as_transaction = 5
$f = new \DrSlump\Protobuf\Field();
$f->number = 5;
$f->name = "as_transaction";
$f->type = \DrSlump\Protobuf::TYPE_BOOL;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if <effective_caller_id> has a value
*
* @return boolean
*/
public function hasEffectiveCallerId(){
return $this->_has(1);
}
/**
* Clear <effective_caller_id> value
*
* @return \Vitess\Proto\Query\BeginExecuteBatchRequest
*/
public function clearEffectiveCallerId(){
return $this->_clear(1);
}
/**
* Get <effective_caller_id> value
*
* @return \Vitess\Proto\Vtrpc\CallerID
*/
public function getEffectiveCallerId(){
return $this->_get(1);
}
/**
* Set <effective_caller_id> value
*
* @param \Vitess\Proto\Vtrpc\CallerID $value
* @return \Vitess\Proto\Query\BeginExecuteBatchRequest
*/
public function setEffectiveCallerId(\Vitess\Proto\Vtrpc\CallerID $value){
return $this->_set(1, $value);
}
/**
* Check if <immediate_caller_id> has a value
*
* @return boolean
*/
public function hasImmediateCallerId(){
return $this->_has(2);
}
/**
* Clear <immediate_caller_id> value
*
* @return \Vitess\Proto\Query\BeginExecuteBatchRequest
*/
public function clearImmediateCallerId(){
return $this->_clear(2);
}
/**
* Get <immediate_caller_id> value
*
* @return \Vitess\Proto\Query\VTGateCallerID
*/
public function getImmediateCallerId(){
return $this->_get(2);
}
/**
* Set <immediate_caller_id> value
*
* @param \Vitess\Proto\Query\VTGateCallerID $value
* @return \Vitess\Proto\Query\BeginExecuteBatchRequest
*/
public function setImmediateCallerId(\Vitess\Proto\Query\VTGateCallerID $value){
return $this->_set(2, $value);
}
/**
* Check if <target> has a value
*
* @return boolean
*/
public function hasTarget(){
return $this->_has(3);
}
/**
* Clear <target> value
*
* @return \Vitess\Proto\Query\BeginExecuteBatchRequest
*/
public function clearTarget(){
return $this->_clear(3);
}
/**
* Get <target> value
*
* @return \Vitess\Proto\Query\Target
*/
public function getTarget(){
return $this->_get(3);
}
/**
* Set <target> value
*
* @param \Vitess\Proto\Query\Target $value
* @return \Vitess\Proto\Query\BeginExecuteBatchRequest
*/
public function setTarget(\Vitess\Proto\Query\Target $value){
return $this->_set(3, $value);
}
/**
* Check if <queries> has a value
*
* @return boolean
*/
public function hasQueries(){
return $this->_has(4);
}
/**
* Clear <queries> value
*
* @return \Vitess\Proto\Query\BeginExecuteBatchRequest
*/
public function clearQueries(){
return $this->_clear(4);
}
/**
* Get <queries> value
*
* @param int $idx
* @return \Vitess\Proto\Query\BoundQuery
*/
public function getQueries($idx = NULL){
return $this->_get(4, $idx);
}
/**
* Set <queries> value
*
* @param \Vitess\Proto\Query\BoundQuery $value
* @return \Vitess\Proto\Query\BeginExecuteBatchRequest
*/
public function setQueries(\Vitess\Proto\Query\BoundQuery $value, $idx = NULL){
return $this->_set(4, $value, $idx);
}
/**
* Get all elements of <queries>
*
* @return \Vitess\Proto\Query\BoundQuery[]
*/
public function getQueriesList(){
return $this->_get(4);
}
/**
* Add a new element to <queries>
*
* @param \Vitess\Proto\Query\BoundQuery $value
* @return \Vitess\Proto\Query\BeginExecuteBatchRequest
*/
public function addQueries(\Vitess\Proto\Query\BoundQuery $value){
return $this->_add(4, $value);
}
/**
* Check if <as_transaction> has a value
*
* @return boolean
*/
public function hasAsTransaction(){
return $this->_has(5);
}
/**
* Clear <as_transaction> value
*
* @return \Vitess\Proto\Query\BeginExecuteBatchRequest
*/
public function clearAsTransaction(){
return $this->_clear(5);
}
/**
* Get <as_transaction> value
*
* @return boolean
*/
public function getAsTransaction(){
return $this->_get(5);
}
/**
* Set <as_transaction> value
*
* @param boolean $value
* @return \Vitess\Proto\Query\BeginExecuteBatchRequest
*/
public function setAsTransaction( $value){
return $this->_set(5, $value);
}
}
}

Просмотреть файл

@ -0,0 +1,191 @@
<?php
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
// Source: query.proto
namespace Vitess\Proto\Query {
class BeginExecuteBatchResponse extends \DrSlump\Protobuf\Message {
/** @var \Vitess\Proto\Vtrpc\RPCError */
public $error = null;
/** @var \Vitess\Proto\Query\QueryResult[] */
public $results = array();
/** @var int */
public $transaction_id = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'query.BeginExecuteBatchResponse');
// OPTIONAL MESSAGE error = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "error";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\Vitess\Proto\Vtrpc\RPCError';
$descriptor->addField($f);
// REPEATED MESSAGE results = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "results";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_REPEATED;
$f->reference = '\Vitess\Proto\Query\QueryResult';
$descriptor->addField($f);
// OPTIONAL INT64 transaction_id = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "transaction_id";
$f->type = \DrSlump\Protobuf::TYPE_INT64;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if <error> has a value
*
* @return boolean
*/
public function hasError(){
return $this->_has(1);
}
/**
* Clear <error> value
*
* @return \Vitess\Proto\Query\BeginExecuteBatchResponse
*/
public function clearError(){
return $this->_clear(1);
}
/**
* Get <error> value
*
* @return \Vitess\Proto\Vtrpc\RPCError
*/
public function getError(){
return $this->_get(1);
}
/**
* Set <error> value
*
* @param \Vitess\Proto\Vtrpc\RPCError $value
* @return \Vitess\Proto\Query\BeginExecuteBatchResponse
*/
public function setError(\Vitess\Proto\Vtrpc\RPCError $value){
return $this->_set(1, $value);
}
/**
* Check if <results> has a value
*
* @return boolean
*/
public function hasResults(){
return $this->_has(2);
}
/**
* Clear <results> value
*
* @return \Vitess\Proto\Query\BeginExecuteBatchResponse
*/
public function clearResults(){
return $this->_clear(2);
}
/**
* Get <results> value
*
* @param int $idx
* @return \Vitess\Proto\Query\QueryResult
*/
public function getResults($idx = NULL){
return $this->_get(2, $idx);
}
/**
* Set <results> value
*
* @param \Vitess\Proto\Query\QueryResult $value
* @return \Vitess\Proto\Query\BeginExecuteBatchResponse
*/
public function setResults(\Vitess\Proto\Query\QueryResult $value, $idx = NULL){
return $this->_set(2, $value, $idx);
}
/**
* Get all elements of <results>
*
* @return \Vitess\Proto\Query\QueryResult[]
*/
public function getResultsList(){
return $this->_get(2);
}
/**
* Add a new element to <results>
*
* @param \Vitess\Proto\Query\QueryResult $value
* @return \Vitess\Proto\Query\BeginExecuteBatchResponse
*/
public function addResults(\Vitess\Proto\Query\QueryResult $value){
return $this->_add(2, $value);
}
/**
* Check if <transaction_id> has a value
*
* @return boolean
*/
public function hasTransactionId(){
return $this->_has(3);
}
/**
* Clear <transaction_id> value
*
* @return \Vitess\Proto\Query\BeginExecuteBatchResponse
*/
public function clearTransactionId(){
return $this->_clear(3);
}
/**
* Get <transaction_id> value
*
* @return int
*/
public function getTransactionId(){
return $this->_get(3);
}
/**
* Set <transaction_id> value
*
* @param int $value
* @return \Vitess\Proto\Query\BeginExecuteBatchResponse
*/
public function setTransactionId( $value){
return $this->_set(3, $value);
}
}
}

Просмотреть файл

@ -0,0 +1,221 @@
<?php
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
// Source: query.proto
namespace Vitess\Proto\Query {
class BeginExecuteRequest extends \DrSlump\Protobuf\Message {
/** @var \Vitess\Proto\Vtrpc\CallerID */
public $effective_caller_id = null;
/** @var \Vitess\Proto\Query\VTGateCallerID */
public $immediate_caller_id = null;
/** @var \Vitess\Proto\Query\Target */
public $target = null;
/** @var \Vitess\Proto\Query\BoundQuery */
public $query = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'query.BeginExecuteRequest');
// OPTIONAL MESSAGE effective_caller_id = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "effective_caller_id";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\Vitess\Proto\Vtrpc\CallerID';
$descriptor->addField($f);
// OPTIONAL MESSAGE immediate_caller_id = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "immediate_caller_id";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\Vitess\Proto\Query\VTGateCallerID';
$descriptor->addField($f);
// OPTIONAL MESSAGE target = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "target";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\Vitess\Proto\Query\Target';
$descriptor->addField($f);
// OPTIONAL MESSAGE query = 4
$f = new \DrSlump\Protobuf\Field();
$f->number = 4;
$f->name = "query";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\Vitess\Proto\Query\BoundQuery';
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if <effective_caller_id> has a value
*
* @return boolean
*/
public function hasEffectiveCallerId(){
return $this->_has(1);
}
/**
* Clear <effective_caller_id> value
*
* @return \Vitess\Proto\Query\BeginExecuteRequest
*/
public function clearEffectiveCallerId(){
return $this->_clear(1);
}
/**
* Get <effective_caller_id> value
*
* @return \Vitess\Proto\Vtrpc\CallerID
*/
public function getEffectiveCallerId(){
return $this->_get(1);
}
/**
* Set <effective_caller_id> value
*
* @param \Vitess\Proto\Vtrpc\CallerID $value
* @return \Vitess\Proto\Query\BeginExecuteRequest
*/
public function setEffectiveCallerId(\Vitess\Proto\Vtrpc\CallerID $value){
return $this->_set(1, $value);
}
/**
* Check if <immediate_caller_id> has a value
*
* @return boolean
*/
public function hasImmediateCallerId(){
return $this->_has(2);
}
/**
* Clear <immediate_caller_id> value
*
* @return \Vitess\Proto\Query\BeginExecuteRequest
*/
public function clearImmediateCallerId(){
return $this->_clear(2);
}
/**
* Get <immediate_caller_id> value
*
* @return \Vitess\Proto\Query\VTGateCallerID
*/
public function getImmediateCallerId(){
return $this->_get(2);
}
/**
* Set <immediate_caller_id> value
*
* @param \Vitess\Proto\Query\VTGateCallerID $value
* @return \Vitess\Proto\Query\BeginExecuteRequest
*/
public function setImmediateCallerId(\Vitess\Proto\Query\VTGateCallerID $value){
return $this->_set(2, $value);
}
/**
* Check if <target> has a value
*
* @return boolean
*/
public function hasTarget(){
return $this->_has(3);
}
/**
* Clear <target> value
*
* @return \Vitess\Proto\Query\BeginExecuteRequest
*/
public function clearTarget(){
return $this->_clear(3);
}
/**
* Get <target> value
*
* @return \Vitess\Proto\Query\Target
*/
public function getTarget(){
return $this->_get(3);
}
/**
* Set <target> value
*
* @param \Vitess\Proto\Query\Target $value
* @return \Vitess\Proto\Query\BeginExecuteRequest
*/
public function setTarget(\Vitess\Proto\Query\Target $value){
return $this->_set(3, $value);
}
/**
* Check if <query> has a value
*
* @return boolean
*/
public function hasQuery(){
return $this->_has(4);
}
/**
* Clear <query> value
*
* @return \Vitess\Proto\Query\BeginExecuteRequest
*/
public function clearQuery(){
return $this->_clear(4);
}
/**
* Get <query> value
*
* @return \Vitess\Proto\Query\BoundQuery
*/
public function getQuery(){
return $this->_get(4);
}
/**
* Set <query> value
*
* @param \Vitess\Proto\Query\BoundQuery $value
* @return \Vitess\Proto\Query\BeginExecuteRequest
*/
public function setQuery(\Vitess\Proto\Query\BoundQuery $value){
return $this->_set(4, $value);
}
}
}

Просмотреть файл

@ -0,0 +1,171 @@
<?php
// DO NOT EDIT! Generated by Protobuf-PHP protoc plugin 1.0
// Source: query.proto
namespace Vitess\Proto\Query {
class BeginExecuteResponse extends \DrSlump\Protobuf\Message {
/** @var \Vitess\Proto\Vtrpc\RPCError */
public $error = null;
/** @var \Vitess\Proto\Query\QueryResult */
public $result = null;
/** @var int */
public $transaction_id = null;
/** @var \Closure[] */
protected static $__extensions = array();
public static function descriptor()
{
$descriptor = new \DrSlump\Protobuf\Descriptor(__CLASS__, 'query.BeginExecuteResponse');
// OPTIONAL MESSAGE error = 1
$f = new \DrSlump\Protobuf\Field();
$f->number = 1;
$f->name = "error";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\Vitess\Proto\Vtrpc\RPCError';
$descriptor->addField($f);
// OPTIONAL MESSAGE result = 2
$f = new \DrSlump\Protobuf\Field();
$f->number = 2;
$f->name = "result";
$f->type = \DrSlump\Protobuf::TYPE_MESSAGE;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$f->reference = '\Vitess\Proto\Query\QueryResult';
$descriptor->addField($f);
// OPTIONAL INT64 transaction_id = 3
$f = new \DrSlump\Protobuf\Field();
$f->number = 3;
$f->name = "transaction_id";
$f->type = \DrSlump\Protobuf::TYPE_INT64;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
return $descriptor;
}
/**
* Check if <error> has a value
*
* @return boolean
*/
public function hasError(){
return $this->_has(1);
}
/**
* Clear <error> value
*
* @return \Vitess\Proto\Query\BeginExecuteResponse
*/
public function clearError(){
return $this->_clear(1);
}
/**
* Get <error> value
*
* @return \Vitess\Proto\Vtrpc\RPCError
*/
public function getError(){
return $this->_get(1);
}
/**
* Set <error> value
*
* @param \Vitess\Proto\Vtrpc\RPCError $value
* @return \Vitess\Proto\Query\BeginExecuteResponse
*/
public function setError(\Vitess\Proto\Vtrpc\RPCError $value){
return $this->_set(1, $value);
}
/**
* Check if <result> has a value
*
* @return boolean
*/
public function hasResult(){
return $this->_has(2);
}
/**
* Clear <result> value
*
* @return \Vitess\Proto\Query\BeginExecuteResponse
*/
public function clearResult(){
return $this->_clear(2);
}
/**
* Get <result> value
*
* @return \Vitess\Proto\Query\QueryResult
*/
public function getResult(){
return $this->_get(2);
}
/**
* Set <result> value
*
* @param \Vitess\Proto\Query\QueryResult $value
* @return \Vitess\Proto\Query\BeginExecuteResponse
*/
public function setResult(\Vitess\Proto\Query\QueryResult $value){
return $this->_set(2, $value);
}
/**
* Check if <transaction_id> has a value
*
* @return boolean
*/
public function hasTransactionId(){
return $this->_has(3);
}
/**
* Clear <transaction_id> value
*
* @return \Vitess\Proto\Query\BeginExecuteResponse
*/
public function clearTransactionId(){
return $this->_clear(3);
}
/**
* Get <transaction_id> value
*
* @return int
*/
public function getTransactionId(){
return $this->_get(3);
}
/**
* Set <transaction_id> value
*
* @param int $value
* @return \Vitess\Proto\Query\BeginExecuteResponse
*/
public function setTransactionId( $value){
return $this->_set(3, $value);
}
}
}

Просмотреть файл

@ -15,9 +15,6 @@ namespace Vitess\Proto\Query {
/** @var \Vitess\Proto\Query\Target */
public $target = null;
/** @var int */
public $session_id = null;
/** @var \Closure[] */
protected static $__extensions = array();
@ -53,14 +50,6 @@ namespace Vitess\Proto\Query {
$f->reference = '\Vitess\Proto\Query\Target';
$descriptor->addField($f);
// OPTIONAL INT64 session_id = 4
$f = new \DrSlump\Protobuf\Field();
$f->number = 4;
$f->name = "session_id";
$f->type = \DrSlump\Protobuf::TYPE_INT64;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
@ -178,43 +167,6 @@ namespace Vitess\Proto\Query {
public function setTarget(\Vitess\Proto\Query\Target $value){
return $this->_set(3, $value);
}
/**
* Check if <session_id> has a value
*
* @return boolean
*/
public function hasSessionId(){
return $this->_has(4);
}
/**
* Clear <session_id> value
*
* @return \Vitess\Proto\Query\BeginRequest
*/
public function clearSessionId(){
return $this->_clear(4);
}
/**
* Get <session_id> value
*
* @return int
*/
public function getSessionId(){
return $this->_get(4);
}
/**
* Set <session_id> value
*
* @param int $value
* @return \Vitess\Proto\Query\BeginRequest
*/
public function setSessionId( $value){
return $this->_set(4, $value);
}
}
}

Просмотреть файл

@ -18,9 +18,6 @@ namespace Vitess\Proto\Query {
/** @var int */
public $transaction_id = null;
/** @var int */
public $session_id = null;
/** @var \Closure[] */
protected static $__extensions = array();
@ -64,14 +61,6 @@ namespace Vitess\Proto\Query {
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL INT64 session_id = 5
$f = new \DrSlump\Protobuf\Field();
$f->number = 5;
$f->name = "session_id";
$f->type = \DrSlump\Protobuf::TYPE_INT64;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
@ -226,43 +215,6 @@ namespace Vitess\Proto\Query {
public function setTransactionId( $value){
return $this->_set(4, $value);
}
/**
* Check if <session_id> has a value
*
* @return boolean
*/
public function hasSessionId(){
return $this->_has(5);
}
/**
* Clear <session_id> value
*
* @return \Vitess\Proto\Query\CommitRequest
*/
public function clearSessionId(){
return $this->_clear(5);
}
/**
* Get <session_id> value
*
* @return int
*/
public function getSessionId(){
return $this->_get(5);
}
/**
* Set <session_id> value
*
* @param int $value
* @return \Vitess\Proto\Query\CommitRequest
*/
public function setSessionId( $value){
return $this->_set(5, $value);
}
}
}

Просмотреть файл

@ -24,9 +24,6 @@ namespace Vitess\Proto\Query {
/** @var int */
public $transaction_id = null;
/** @var int */
public $session_id = null;
/** @var \Closure[] */
protected static $__extensions = array();
@ -87,14 +84,6 @@ namespace Vitess\Proto\Query {
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL INT64 session_id = 7
$f = new \DrSlump\Protobuf\Field();
$f->number = 7;
$f->name = "session_id";
$f->type = \DrSlump\Protobuf::TYPE_INT64;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
@ -343,43 +332,6 @@ namespace Vitess\Proto\Query {
public function setTransactionId( $value){
return $this->_set(6, $value);
}
/**
* Check if <session_id> has a value
*
* @return boolean
*/
public function hasSessionId(){
return $this->_has(7);
}
/**
* Clear <session_id> value
*
* @return \Vitess\Proto\Query\ExecuteBatchRequest
*/
public function clearSessionId(){
return $this->_clear(7);
}
/**
* Get <session_id> value
*
* @return int
*/
public function getSessionId(){
return $this->_get(7);
}
/**
* Set <session_id> value
*
* @param int $value
* @return \Vitess\Proto\Query\ExecuteBatchRequest
*/
public function setSessionId( $value){
return $this->_set(7, $value);
}
}
}

Просмотреть файл

@ -21,9 +21,6 @@ namespace Vitess\Proto\Query {
/** @var int */
public $transaction_id = null;
/** @var int */
public $session_id = null;
/** @var \Closure[] */
protected static $__extensions = array();
@ -76,14 +73,6 @@ namespace Vitess\Proto\Query {
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL INT64 session_id = 6
$f = new \DrSlump\Protobuf\Field();
$f->number = 6;
$f->name = "session_id";
$f->type = \DrSlump\Protobuf::TYPE_INT64;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
@ -275,43 +264,6 @@ namespace Vitess\Proto\Query {
public function setTransactionId( $value){
return $this->_set(5, $value);
}
/**
* Check if <session_id> has a value
*
* @return boolean
*/
public function hasSessionId(){
return $this->_has(6);
}
/**
* Clear <session_id> value
*
* @return \Vitess\Proto\Query\ExecuteRequest
*/
public function clearSessionId(){
return $this->_clear(6);
}
/**
* Get <session_id> value
*
* @return int
*/
public function getSessionId(){
return $this->_get(6);
}
/**
* Set <session_id> value
*
* @param int $value
* @return \Vitess\Proto\Query\ExecuteRequest
*/
public function setSessionId( $value){
return $this->_set(6, $value);
}
}
}

Просмотреть файл

@ -18,9 +18,6 @@ namespace Vitess\Proto\Query {
/** @var int */
public $transaction_id = null;
/** @var int */
public $session_id = null;
/** @var \Closure[] */
protected static $__extensions = array();
@ -64,14 +61,6 @@ namespace Vitess\Proto\Query {
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL INT64 session_id = 5
$f = new \DrSlump\Protobuf\Field();
$f->number = 5;
$f->name = "session_id";
$f->type = \DrSlump\Protobuf::TYPE_INT64;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
@ -226,43 +215,6 @@ namespace Vitess\Proto\Query {
public function setTransactionId( $value){
return $this->_set(4, $value);
}
/**
* Check if <session_id> has a value
*
* @return boolean
*/
public function hasSessionId(){
return $this->_has(5);
}
/**
* Clear <session_id> value
*
* @return \Vitess\Proto\Query\RollbackRequest
*/
public function clearSessionId(){
return $this->_clear(5);
}
/**
* Get <session_id> value
*
* @return int
*/
public function getSessionId(){
return $this->_get(5);
}
/**
* Set <session_id> value
*
* @param int $value
* @return \Vitess\Proto\Query\RollbackRequest
*/
public function setSessionId( $value){
return $this->_set(5, $value);
}
}
}

Просмотреть файл

@ -27,9 +27,6 @@ namespace Vitess\Proto\Query {
/** @var int */
public $num_rows_per_query_part = null;
/** @var int */
public $session_id = null;
/** @var int - \Vitess\Proto\Query\SplitQueryRequest\Algorithm */
public $algorithm = null;
@ -104,14 +101,6 @@ namespace Vitess\Proto\Query {
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL INT64 session_id = 7
$f = new \DrSlump\Protobuf\Field();
$f->number = 7;
$f->name = "session_id";
$f->type = \DrSlump\Protobuf::TYPE_INT64;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL ENUM algorithm = 9
$f = new \DrSlump\Protobuf\Field();
$f->number = 9;
@ -415,43 +404,6 @@ namespace Vitess\Proto\Query {
return $this->_set(8, $value);
}
/**
* Check if <session_id> has a value
*
* @return boolean
*/
public function hasSessionId(){
return $this->_has(7);
}
/**
* Clear <session_id> value
*
* @return \Vitess\Proto\Query\SplitQueryRequest
*/
public function clearSessionId(){
return $this->_clear(7);
}
/**
* Get <session_id> value
*
* @return int
*/
public function getSessionId(){
return $this->_get(7);
}
/**
* Set <session_id> value
*
* @param int $value
* @return \Vitess\Proto\Query\SplitQueryRequest
*/
public function setSessionId( $value){
return $this->_set(7, $value);
}
/**
* Check if <algorithm> has a value
*

Просмотреть файл

@ -18,9 +18,6 @@ namespace Vitess\Proto\Query {
/** @var \Vitess\Proto\Query\BoundQuery */
public $query = null;
/** @var int */
public $session_id = null;
/** @var \Closure[] */
protected static $__extensions = array();
@ -65,14 +62,6 @@ namespace Vitess\Proto\Query {
$f->reference = '\Vitess\Proto\Query\BoundQuery';
$descriptor->addField($f);
// OPTIONAL INT64 session_id = 5
$f = new \DrSlump\Protobuf\Field();
$f->number = 5;
$f->name = "session_id";
$f->type = \DrSlump\Protobuf::TYPE_INT64;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
@ -227,43 +216,6 @@ namespace Vitess\Proto\Query {
public function setQuery(\Vitess\Proto\Query\BoundQuery $value){
return $this->_set(4, $value);
}
/**
* Check if <session_id> has a value
*
* @return boolean
*/
public function hasSessionId(){
return $this->_has(5);
}
/**
* Clear <session_id> value
*
* @return \Vitess\Proto\Query\StreamExecuteRequest
*/
public function clearSessionId(){
return $this->_clear(5);
}
/**
* Get <session_id> value
*
* @return int
*/
public function getSessionId(){
return $this->_get(5);
}
/**
* Set <session_id> value
*
* @param int $value
* @return \Vitess\Proto\Query\StreamExecuteRequest
*/
public function setSessionId( $value){
return $this->_set(5, $value);
}
}
}

Просмотреть файл

@ -9,12 +9,6 @@ namespace Vitess\Proto\Queryservice {
public function __construct($hostname, $opts) {
parent::__construct($hostname, $opts);
}
/**
* @param Vitess\Proto\Query\GetSessionIdRequest $input
*/
public function GetSessionId(\Vitess\Proto\Query\GetSessionIdRequest $argument, $metadata = array(), $options = array()) {
return $this->_simpleRequest('/queryservice.Query/GetSessionId', $argument, '\Vitess\Proto\Query\GetSessionIdResponse::deserialize', $metadata, $options);
}
/**
* @param Vitess\Proto\Query\ExecuteRequest $input
*/
@ -51,6 +45,18 @@ namespace Vitess\Proto\Queryservice {
public function Rollback(\Vitess\Proto\Query\RollbackRequest $argument, $metadata = array(), $options = array()) {
return $this->_simpleRequest('/queryservice.Query/Rollback', $argument, '\Vitess\Proto\Query\RollbackResponse::deserialize', $metadata, $options);
}
/**
* @param Vitess\Proto\Query\BeginExecuteRequest $input
*/
public function BeginExecute(\Vitess\Proto\Query\BeginExecuteRequest $argument, $metadata = array(), $options = array()) {
return $this->_simpleRequest('/queryservice.Query/BeginExecute', $argument, '\Vitess\Proto\Query\BeginExecuteResponse::deserialize', $metadata, $options);
}
/**
* @param Vitess\Proto\Query\BeginExecuteBatchRequest $input
*/
public function BeginExecuteBatch(\Vitess\Proto\Query\BeginExecuteBatchRequest $argument, $metadata = array(), $options = array()) {
return $this->_simpleRequest('/queryservice.Query/BeginExecuteBatch', $argument, '\Vitess\Proto\Query\BeginExecuteBatchResponse::deserialize', $metadata, $options);
}
/**
* @param Vitess\Proto\Query\SplitQueryRequest $input
*/

Просмотреть файл

@ -21,6 +21,9 @@ namespace Vitess\Proto\Vtgate {
/** @var boolean */
public $not_in_transaction = null;
/** @var string */
public $keyspace = null;
/** @var \Closure[] */
protected static $__extensions = array();
@ -73,6 +76,14 @@ namespace Vitess\Proto\Vtgate {
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
// OPTIONAL STRING keyspace = 6
$f = new \DrSlump\Protobuf\Field();
$f->number = 6;
$f->name = "keyspace";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
@ -264,6 +275,43 @@ namespace Vitess\Proto\Vtgate {
public function setNotInTransaction( $value){
return $this->_set(5, $value);
}
/**
* Check if <keyspace> has a value
*
* @return boolean
*/
public function hasKeyspace(){
return $this->_has(6);
}
/**
* Clear <keyspace> value
*
* @return \Vitess\Proto\Vtgate\ExecuteRequest
*/
public function clearKeyspace(){
return $this->_clear(6);
}
/**
* Get <keyspace> value
*
* @return string
*/
public function getKeyspace(){
return $this->_get(6);
}
/**
* Set <keyspace> value
*
* @param string $value
* @return \Vitess\Proto\Vtgate\ExecuteRequest
*/
public function setKeyspace( $value){
return $this->_set(6, $value);
}
}
}

Просмотреть файл

@ -15,6 +15,9 @@ namespace Vitess\Proto\Vtgate {
/** @var int - \Vitess\Proto\Topodata\TabletType */
public $tablet_type = null;
/** @var string */
public $keyspace = null;
/** @var \Closure[] */
protected static $__extensions = array();
@ -50,6 +53,14 @@ namespace Vitess\Proto\Vtgate {
$f->reference = '\Vitess\Proto\Topodata\TabletType';
$descriptor->addField($f);
// OPTIONAL STRING keyspace = 4
$f = new \DrSlump\Protobuf\Field();
$f->number = 4;
$f->name = "keyspace";
$f->type = \DrSlump\Protobuf::TYPE_STRING;
$f->rule = \DrSlump\Protobuf::RULE_OPTIONAL;
$descriptor->addField($f);
foreach (self::$__extensions as $cb) {
$descriptor->addField($cb(), true);
}
@ -167,6 +178,43 @@ namespace Vitess\Proto\Vtgate {
public function setTabletType( $value){
return $this->_set(3, $value);
}
/**
* Check if <keyspace> has a value
*
* @return boolean
*/
public function hasKeyspace(){
return $this->_has(4);
}
/**
* Clear <keyspace> value
*
* @return \Vitess\Proto\Vtgate\StreamExecuteRequest
*/
public function clearKeyspace(){
return $this->_clear(4);
}
/**
* Get <keyspace> value
*
* @return string
*/
public function getKeyspace(){
return $this->_get(4);
}
/**
* Set <keyspace> value
*
* @param string $value
* @return \Vitess\Proto\Vtgate\StreamExecuteRequest
*/
public function setKeyspace( $value){
return $this->_set(4, $value);
}
}
}

Просмотреть файл

@ -193,19 +193,6 @@ message QueryResult {
repeated Row rows = 4;
}
// GetSessionIdRequest is the payload to GetSessionId
message GetSessionIdRequest {
vtrpc.CallerID effective_caller_id = 1;
VTGateCallerID immediate_caller_id = 2;
string keyspace = 3;
string shard = 4;
}
// GetSessionIdResponse is the returned value from GetSessionId
message GetSessionIdResponse {
int64 session_id = 1;
}
// ExecuteRequest is the payload to Execute
message ExecuteRequest {
vtrpc.CallerID effective_caller_id = 1;
@ -213,7 +200,6 @@ message ExecuteRequest {
Target target = 3;
BoundQuery query = 4;
int64 transaction_id = 5;
int64 session_id = 6;
}
// ExecuteResponse is the returned value from Execute
@ -229,7 +215,6 @@ message ExecuteBatchRequest {
repeated BoundQuery queries = 4;
bool as_transaction = 5;
int64 transaction_id = 6;
int64 session_id = 7;
}
// ExecuteBatchResponse is the returned value from ExecuteBatch
@ -243,7 +228,6 @@ message StreamExecuteRequest {
VTGateCallerID immediate_caller_id = 2;
Target target = 3;
BoundQuery query = 4;
int64 session_id = 5;
}
// StreamExecuteResponse is the returned value from StreamExecute
@ -256,7 +240,6 @@ message BeginRequest {
vtrpc.CallerID effective_caller_id = 1;
VTGateCallerID immediate_caller_id = 2;
Target target = 3;
int64 session_id = 4;
}
// BeginResponse is the returned value from Begin
@ -270,7 +253,6 @@ message CommitRequest {
VTGateCallerID immediate_caller_id = 2;
Target target = 3;
int64 transaction_id = 4;
int64 session_id = 5;
}
// CommitResponse is the returned value from Commit
@ -282,7 +264,6 @@ message RollbackRequest {
VTGateCallerID immediate_caller_id = 2;
Target target = 3;
int64 transaction_id = 4;
int64 session_id = 5;
}
// RollbackResponse is the returned value from Rollback
@ -345,8 +326,6 @@ message SplitQueryRequest {
int64 split_count = 6;
int64 num_rows_per_query_part = 8;
int64 session_id = 7;
enum Algorithm {
EQUAL_SPLITS = 0;
FULL_SCAN = 1;

Просмотреть файл

@ -8,11 +8,6 @@ import "query.proto";
// Query defines the tablet query service, implemented by vttablet.
service Query {
// GetSessionId gets a session id from the server. This call is being
// deprecated in favor of using the Target field of the subsequent
// queries, but is still here for backward compatibility.
rpc GetSessionId(query.GetSessionIdRequest) returns (query.GetSessionIdResponse) {};
// Execute executes the specified SQL query (might be in a
// transaction context, if Query.transaction_id is set).
rpc Execute(query.ExecuteRequest) returns (query.ExecuteResponse) {};

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -20,7 +20,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
name='queryservice.proto',
package='queryservice',
syntax='proto3',
serialized_pb=_b('\n\x12queryservice.proto\x12\x0cqueryservice\x1a\x0bquery.proto2\x8e\x06\n\x05Query\x12I\n\x0cGetSessionId\x12\x1a.query.GetSessionIdRequest\x1a\x1b.query.GetSessionIdResponse\"\x00\x12:\n\x07\x45xecute\x12\x15.query.ExecuteRequest\x1a\x16.query.ExecuteResponse\"\x00\x12I\n\x0c\x45xecuteBatch\x12\x1a.query.ExecuteBatchRequest\x1a\x1b.query.ExecuteBatchResponse\"\x00\x12N\n\rStreamExecute\x12\x1b.query.StreamExecuteRequest\x1a\x1c.query.StreamExecuteResponse\"\x00\x30\x01\x12\x34\n\x05\x42\x65gin\x12\x13.query.BeginRequest\x1a\x14.query.BeginResponse\"\x00\x12\x37\n\x06\x43ommit\x12\x14.query.CommitRequest\x1a\x15.query.CommitResponse\"\x00\x12=\n\x08Rollback\x12\x16.query.RollbackRequest\x1a\x17.query.RollbackResponse\"\x00\x12I\n\x0c\x42\x65ginExecute\x12\x1a.query.BeginExecuteRequest\x1a\x1b.query.BeginExecuteResponse\"\x00\x12X\n\x11\x42\x65ginExecuteBatch\x12\x1f.query.BeginExecuteBatchRequest\x1a .query.BeginExecuteBatchResponse\"\x00\x12\x43\n\nSplitQuery\x12\x18.query.SplitQueryRequest\x1a\x19.query.SplitQueryResponse\"\x00\x12K\n\x0cStreamHealth\x12\x1a.query.StreamHealthRequest\x1a\x1b.query.StreamHealthResponse\"\x00\x30\x01\x62\x06proto3')
serialized_pb=_b('\n\x12queryservice.proto\x12\x0cqueryservice\x1a\x0bquery.proto2\xc3\x05\n\x05Query\x12:\n\x07\x45xecute\x12\x15.query.ExecuteRequest\x1a\x16.query.ExecuteResponse\"\x00\x12I\n\x0c\x45xecuteBatch\x12\x1a.query.ExecuteBatchRequest\x1a\x1b.query.ExecuteBatchResponse\"\x00\x12N\n\rStreamExecute\x12\x1b.query.StreamExecuteRequest\x1a\x1c.query.StreamExecuteResponse\"\x00\x30\x01\x12\x34\n\x05\x42\x65gin\x12\x13.query.BeginRequest\x1a\x14.query.BeginResponse\"\x00\x12\x37\n\x06\x43ommit\x12\x14.query.CommitRequest\x1a\x15.query.CommitResponse\"\x00\x12=\n\x08Rollback\x12\x16.query.RollbackRequest\x1a\x17.query.RollbackResponse\"\x00\x12I\n\x0c\x42\x65ginExecute\x12\x1a.query.BeginExecuteRequest\x1a\x1b.query.BeginExecuteResponse\"\x00\x12X\n\x11\x42\x65ginExecuteBatch\x12\x1f.query.BeginExecuteBatchRequest\x1a .query.BeginExecuteBatchResponse\"\x00\x12\x43\n\nSplitQuery\x12\x18.query.SplitQueryRequest\x1a\x19.query.SplitQueryResponse\"\x00\x12K\n\x0cStreamHealth\x12\x1a.query.StreamHealthRequest\x1a\x1b.query.StreamHealthResponse\"\x00\x30\x01\x62\x06proto3')
,
dependencies=[query__pb2.DESCRIPTOR,])
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
@ -38,9 +38,6 @@ class BetaQueryServicer(object):
"""<fill me in later!>"""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def GetSessionId(self, request, context):
raise NotImplementedError()
@abc.abstractmethod
def Execute(self, request, context):
raise NotImplementedError()
@abc.abstractmethod
@ -75,10 +72,6 @@ class BetaQueryStub(object):
"""The interface to which stubs will conform."""
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def GetSessionId(self, request, timeout):
raise NotImplementedError()
GetSessionId.future = None
@abc.abstractmethod
def Execute(self, request, timeout):
raise NotImplementedError()
Execute.future = None
@ -138,8 +131,6 @@ def beta_create_Query_server(servicer, pool=None, pool_size=None, default_timeou
import query_pb2
import query_pb2
import query_pb2
import query_pb2
import query_pb2
request_deserializers = {
('queryservice.Query', 'Begin'): query_pb2.BeginRequest.FromString,
('queryservice.Query', 'BeginExecute'): query_pb2.BeginExecuteRequest.FromString,
@ -147,7 +138,6 @@ def beta_create_Query_server(servicer, pool=None, pool_size=None, default_timeou
('queryservice.Query', 'Commit'): query_pb2.CommitRequest.FromString,
('queryservice.Query', 'Execute'): query_pb2.ExecuteRequest.FromString,
('queryservice.Query', 'ExecuteBatch'): query_pb2.ExecuteBatchRequest.FromString,
('queryservice.Query', 'GetSessionId'): query_pb2.GetSessionIdRequest.FromString,
('queryservice.Query', 'Rollback'): query_pb2.RollbackRequest.FromString,
('queryservice.Query', 'SplitQuery'): query_pb2.SplitQueryRequest.FromString,
('queryservice.Query', 'StreamExecute'): query_pb2.StreamExecuteRequest.FromString,
@ -160,7 +150,6 @@ def beta_create_Query_server(servicer, pool=None, pool_size=None, default_timeou
('queryservice.Query', 'Commit'): query_pb2.CommitResponse.SerializeToString,
('queryservice.Query', 'Execute'): query_pb2.ExecuteResponse.SerializeToString,
('queryservice.Query', 'ExecuteBatch'): query_pb2.ExecuteBatchResponse.SerializeToString,
('queryservice.Query', 'GetSessionId'): query_pb2.GetSessionIdResponse.SerializeToString,
('queryservice.Query', 'Rollback'): query_pb2.RollbackResponse.SerializeToString,
('queryservice.Query', 'SplitQuery'): query_pb2.SplitQueryResponse.SerializeToString,
('queryservice.Query', 'StreamExecute'): query_pb2.StreamExecuteResponse.SerializeToString,
@ -173,7 +162,6 @@ def beta_create_Query_server(servicer, pool=None, pool_size=None, default_timeou
('queryservice.Query', 'Commit'): face_utilities.unary_unary_inline(servicer.Commit),
('queryservice.Query', 'Execute'): face_utilities.unary_unary_inline(servicer.Execute),
('queryservice.Query', 'ExecuteBatch'): face_utilities.unary_unary_inline(servicer.ExecuteBatch),
('queryservice.Query', 'GetSessionId'): face_utilities.unary_unary_inline(servicer.GetSessionId),
('queryservice.Query', 'Rollback'): face_utilities.unary_unary_inline(servicer.Rollback),
('queryservice.Query', 'SplitQuery'): face_utilities.unary_unary_inline(servicer.SplitQuery),
('queryservice.Query', 'StreamExecute'): face_utilities.unary_stream_inline(servicer.StreamExecute),
@ -203,8 +191,6 @@ def beta_create_Query_stub(channel, host=None, metadata_transformer=None, pool=N
import query_pb2
import query_pb2
import query_pb2
import query_pb2
import query_pb2
request_serializers = {
('queryservice.Query', 'Begin'): query_pb2.BeginRequest.SerializeToString,
('queryservice.Query', 'BeginExecute'): query_pb2.BeginExecuteRequest.SerializeToString,
@ -212,7 +198,6 @@ def beta_create_Query_stub(channel, host=None, metadata_transformer=None, pool=N
('queryservice.Query', 'Commit'): query_pb2.CommitRequest.SerializeToString,
('queryservice.Query', 'Execute'): query_pb2.ExecuteRequest.SerializeToString,
('queryservice.Query', 'ExecuteBatch'): query_pb2.ExecuteBatchRequest.SerializeToString,
('queryservice.Query', 'GetSessionId'): query_pb2.GetSessionIdRequest.SerializeToString,
('queryservice.Query', 'Rollback'): query_pb2.RollbackRequest.SerializeToString,
('queryservice.Query', 'SplitQuery'): query_pb2.SplitQueryRequest.SerializeToString,
('queryservice.Query', 'StreamExecute'): query_pb2.StreamExecuteRequest.SerializeToString,
@ -225,7 +210,6 @@ def beta_create_Query_stub(channel, host=None, metadata_transformer=None, pool=N
('queryservice.Query', 'Commit'): query_pb2.CommitResponse.FromString,
('queryservice.Query', 'Execute'): query_pb2.ExecuteResponse.FromString,
('queryservice.Query', 'ExecuteBatch'): query_pb2.ExecuteBatchResponse.FromString,
('queryservice.Query', 'GetSessionId'): query_pb2.GetSessionIdResponse.FromString,
('queryservice.Query', 'Rollback'): query_pb2.RollbackResponse.FromString,
('queryservice.Query', 'SplitQuery'): query_pb2.SplitQueryResponse.FromString,
('queryservice.Query', 'StreamExecute'): query_pb2.StreamExecuteResponse.FromString,
@ -238,7 +222,6 @@ def beta_create_Query_stub(channel, host=None, metadata_transformer=None, pool=N
'Commit': cardinality.Cardinality.UNARY_UNARY,
'Execute': cardinality.Cardinality.UNARY_UNARY,
'ExecuteBatch': cardinality.Cardinality.UNARY_UNARY,
'GetSessionId': cardinality.Cardinality.UNARY_UNARY,
'Rollback': cardinality.Cardinality.UNARY_UNARY,
'SplitQuery': cardinality.Cardinality.UNARY_UNARY,
'StreamExecute': cardinality.Cardinality.UNARY_STREAM,

Просмотреть файл

@ -5,15 +5,15 @@ set -e
# As of 07/2015, this mirror is the fastest for the Travis CI workers.
DEB_PACKAGES="
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/mysql-common_10.0.24+maria-1~precise_all.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/mariadb-common_10.0.24+maria-1~precise_all.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/libmysqlclient18_10.0.24+maria-1~precise_amd64.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/libmariadbclient18_10.0.24+maria-1~precise_amd64.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/libmariadbclient-dev_10.0.24+maria-1~precise_amd64.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/mariadb-client-core-10.0_10.0.24+maria-1~precise_amd64.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/mariadb-client-10.0_10.0.24+maria-1~precise_amd64.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/mariadb-server-core-10.0_10.0.24+maria-1~precise_amd64.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/mariadb-server-10.0_10.0.24+maria-1~precise_amd64.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/mysql-common_10.0.25+maria-1~precise_all.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/mariadb-common_10.0.25+maria-1~precise_all.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/libmysqlclient18_10.0.25+maria-1~precise_amd64.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/libmariadbclient18_10.0.25+maria-1~precise_amd64.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/libmariadbclient-dev_10.0.25+maria-1~precise_amd64.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/mariadb-client-core-10.0_10.0.25+maria-1~precise_amd64.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/mariadb-client-10.0_10.0.25+maria-1~precise_amd64.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/mariadb-server-core-10.0_10.0.25+maria-1~precise_amd64.deb
http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu/pool/main/m/mariadb-10.0/mariadb-server-10.0_10.0.25+maria-1~precise_amd64.deb
"
mkdir -p $MYSQL_ROOT