From 2ab4a76d5832f769197edaeed01cb5c54b0e32bc Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Fri, 15 Jan 2021 15:50:17 +0100 Subject: [PATCH 1/9] Addition of @@use_reserved_connection to vtgate Signed-off-by: Florent Poinsard --- go/vt/proto/vtgate/vtgate.pb.go | 191 ++++++++++++----------- go/vt/sqlparser/ast_rewriting.go | 1 + go/vt/sqlparser/ast_rewriting_test.go | 7 +- go/vt/sysvars/sysvars.go | 24 +-- go/vt/vtgate/engine/fake_vcursor_test.go | 4 + go/vt/vtgate/engine/primitive.go | 2 + go/vt/vtgate/engine/set.go | 2 + go/vt/vtgate/executor.go | 2 + go/vt/vtgate/safe_session.go | 7 + go/vt/vtgate/vcursor_impl.go | 6 + proto/vtgate.proto | 3 + 11 files changed, 147 insertions(+), 102 deletions(-) diff --git a/go/vt/proto/vtgate/vtgate.pb.go b/go/vt/proto/vtgate/vtgate.pb.go index e5deffdfd18..ed1ccac1727 100644 --- a/go/vt/proto/vtgate/vtgate.pb.go +++ b/go/vt/proto/vtgate/vtgate.pb.go @@ -156,10 +156,12 @@ type Session struct { // DDL strategy DDLStrategy string `protobuf:"bytes,21,opt,name=DDLStrategy,proto3" json:"DDLStrategy,omitempty"` // Session UUID - SessionUUID string `protobuf:"bytes,22,opt,name=SessionUUID,proto3" json:"SessionUUID,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + SessionUUID string `protobuf:"bytes,22,opt,name=SessionUUID,proto3" json:"SessionUUID,omitempty"` + // use_reserved_connection defines if we can use reserved connections. + UseReservedConnection bool `protobuf:"varint,23,opt,name=use_reserved_connection,json=useReservedConnection,proto3" json:"use_reserved_connection,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Session) Reset() { *m = Session{} } @@ -334,6 +336,13 @@ func (m *Session) GetSessionUUID() string { return "" } +func (m *Session) GetUseReservedConnection() bool { + if m != nil { + return m.UseReservedConnection + } + return false +} + type Session_ShardSession struct { Target *query.Target `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` TransactionId int64 `protobuf:"varint,2,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"` @@ -1101,90 +1110,92 @@ func init() { func init() { proto.RegisterFile("vtgate.proto", fileDescriptor_aab96496ceaf1ebb) } var fileDescriptor_aab96496ceaf1ebb = []byte{ - // 1357 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x6d, 0x6f, 0x1b, 0xc5, - 0x13, 0xef, 0xf9, 0xd9, 0xe3, 0xa7, 0xcb, 0xe6, 0xe1, 0x7f, 0xcd, 0xbf, 0x80, 0xe5, 0xb6, 0xaa, - 0x5b, 0x50, 0x02, 0x41, 0x40, 0x85, 0x40, 0x90, 0xd8, 0x6e, 0x71, 0x95, 0xd4, 0x61, 0xed, 0x24, - 0x12, 0x02, 0x9d, 0x2e, 0xbe, 0x8d, 0xb3, 0x8a, 0x73, 0xeb, 0xee, 0xae, 0x1d, 0xfc, 0x29, 0x78, - 0x0f, 0x1f, 0x80, 0x37, 0xbc, 0xe7, 0x3b, 0xf0, 0x8e, 0x6f, 0x84, 0x76, 0xf7, 0xce, 0x3e, 0xbb, - 0x81, 0xa6, 0xad, 0xfa, 0xc6, 0xba, 0x9d, 0xdf, 0xec, 0xec, 0xcc, 0xfc, 0x66, 0x76, 0xd6, 0x50, - 0x9c, 0xc8, 0x81, 0x27, 0xc9, 0xd6, 0x88, 0x33, 0xc9, 0x50, 0xc6, 0xac, 0x36, 0xed, 0x53, 0x1a, - 0x0c, 0xd9, 0xc0, 0xf7, 0xa4, 0x67, 0x90, 0xcd, 0xc2, 0x8b, 0x31, 0xe1, 0xd3, 0x70, 0x51, 0x96, - 0x6c, 0xc4, 0xe2, 0x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0xc3, 0x33, 0x25, 0xf4, 0x0d, 0x14, - 0x47, 0x9c, 0xcc, 0xb3, 0x95, 0xbf, 0x41, 0xb6, 0x0a, 0x23, 0x4e, 0x66, 0xb9, 0xda, 0x85, 0xd2, - 0x88, 0x09, 0x39, 0xb7, 0x00, 0x37, 0xb0, 0x50, 0x54, 0x5b, 0x66, 0x26, 0xee, 0x41, 0x79, 0xe8, - 0x09, 0xe9, 0xd2, 0x40, 0x10, 0x2e, 0x5d, 0xea, 0x3b, 0x85, 0xaa, 0x55, 0x4f, 0xe1, 0xa2, 0x92, - 0xb6, 0xb5, 0xb0, 0xed, 0xa3, 0xf7, 0x00, 0xce, 0xd8, 0x38, 0xf0, 0x5d, 0xce, 0xae, 0x84, 0x53, - 0xd4, 0x1a, 0x79, 0x2d, 0xc1, 0xec, 0x4a, 0x20, 0x17, 0x36, 0xc6, 0x82, 0x70, 0xd7, 0x27, 0x67, - 0x34, 0x20, 0xbe, 0x3b, 0xf1, 0x38, 0xf5, 0x4e, 0x87, 0x44, 0x38, 0x25, 0xed, 0xd0, 0xc3, 0x65, - 0x87, 0x8e, 0x04, 0xe1, 0x4d, 0xa3, 0x7c, 0x1c, 0xe9, 0xb6, 0x02, 0xc9, 0xa7, 0x78, 0x6d, 0x7c, - 0x0d, 0x84, 0x3a, 0x60, 0x8b, 0xa9, 0x90, 0xe4, 0x32, 0x66, 0xba, 0xac, 0x4d, 0xdf, 0x7b, 0x29, - 0x56, 0xad, 0xb7, 0x64, 0xb5, 0x22, 0x16, 0xa5, 0xe8, 0xff, 0x90, 0xe7, 0xec, 0xca, 0xed, 0xb3, - 0x71, 0x20, 0x9d, 0x4a, 0xd5, 0xaa, 0x27, 0x71, 0x8e, 0xb3, 0xab, 0x86, 0x5a, 0xab, 0x12, 0x14, - 0xde, 0x84, 0x8c, 0x18, 0x0d, 0xa4, 0x70, 0xec, 0x6a, 0xb2, 0x9e, 0xc7, 0x31, 0x09, 0xaa, 0x83, - 0x4d, 0x03, 0x97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0x35, 0xda, 0x4f, 0xda, 0xad, 0xa6, 0x7d, - 0x0b, 0x01, 0x64, 0xba, 0xed, 0xe7, 0x4f, 0xf7, 0x5b, 0xb6, 0x85, 0xf2, 0x90, 0x3e, 0x38, 0xda, - 0xef, 0xb5, 0xed, 0x84, 0xfa, 0xec, 0x9d, 0x74, 0x0e, 0x1b, 0x76, 0xf2, 0xd1, 0x57, 0x50, 0x68, - 0xe8, 0x7f, 0x2a, 0x1d, 0xee, 0x13, 0xae, 0x36, 0x3c, 0xef, 0xe0, 0x83, 0xdd, 0x7d, 0xfb, 0x16, - 0xca, 0x42, 0xf2, 0x10, 0xab, 0x9d, 0x39, 0x48, 0x1d, 0x76, 0xba, 0x3d, 0x3b, 0x81, 0xca, 0x00, - 0xbb, 0x47, 0xbd, 0x4e, 0xa3, 0x73, 0x70, 0xd0, 0xee, 0xd9, 0xc9, 0xbd, 0xcf, 0xa1, 0x42, 0xd9, - 0xd6, 0x84, 0x4a, 0x22, 0x84, 0xf9, 0x23, 0xf6, 0xc3, 0xdd, 0x70, 0x45, 0xd9, 0xb6, 0xf9, 0xda, - 0x1e, 0xb0, 0xed, 0x89, 0xdc, 0xd6, 0xe8, 0xb6, 0x29, 0xcd, 0xd3, 0x8c, 0x5e, 0x7d, 0xfa, 0x4f, - 0x00, 0x00, 0x00, 0xff, 0xff, 0x90, 0xad, 0x39, 0x45, 0x08, 0x0e, 0x00, 0x00, + // 1380 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xdd, 0x6e, 0x1b, 0xb7, + 0x12, 0xce, 0xea, 0x5f, 0xa3, 0xbf, 0x35, 0xfd, 0x93, 0x8d, 0x4f, 0xce, 0x39, 0x82, 0x92, 0x20, + 0x4a, 0xce, 0x81, 0xdd, 0xba, 0x68, 0x1a, 0x14, 0x2d, 0x5a, 0x5b, 0x52, 0x52, 0x05, 0x76, 0xe4, + 0x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0x97, 0xb4, 0x53, 0xb5, + 0x5f, 0x2d, 0x28, 0x2f, 0x26, 0x00, 0xfa, 0x18, 0xd6, 0x97, 0x53, 0xc6, 0x1d, 0x48, 0xea, 0x87, + 0x66, 0xd1, 0x62, 0x7e, 0x3c, 0x97, 0xd4, 0x47, 0x9f, 0x81, 0xf3, 0xda, 0x16, 0x49, 0x2f, 0x09, + 0x1b, 0x4b, 0x7d, 0xb0, 0x85, 0xd7, 0x17, 0x77, 0xf5, 0x0c, 0xa8, 0xd2, 0x39, 0x2c, 0x05, 0x35, + 0x4d, 0xfa, 0x17, 0xfa, 0x20, 0x43, 0x44, 0x0e, 0xaf, 0x84, 0x50, 0x4f, 0x21, 0xea, 0x1c, 0x51, + 0xfb, 0x25, 0x01, 0xe5, 0xb0, 0x65, 0x63, 0xf2, 0x6a, 0x4c, 0x84, 0x44, 0xff, 0x87, 0x7c, 0xdf, + 0x1b, 0x0e, 0x09, 0x77, 0x43, 0x17, 0x0b, 0x3b, 0x95, 0x2d, 0x33, 0xb8, 0x1a, 0x5a, 0xde, 0x6e, + 0xe2, 0x9c, 0xd1, 0x68, 0xfb, 0xe8, 0x11, 0x64, 0xa3, 0xda, 0x4b, 0xcc, 0x74, 0xe3, 0xb5, 0x87, + 0x23, 0x1c, 0x3d, 0x84, 0xb4, 0x66, 0x21, 0x4c, 0x8b, 0x95, 0x88, 0x13, 0xd5, 0xe5, 0x74, 0x03, + 0xc7, 0x06, 0x47, 0x9f, 0x42, 0x98, 0x1b, 0xae, 0x9c, 0x8e, 0x88, 0x4e, 0x86, 0xf2, 0xce, 0xda, + 0x72, 0x16, 0xf5, 0xa6, 0x23, 0x82, 0x41, 0xce, 0xbe, 0x55, 0x92, 0x5e, 0x90, 0xa9, 0x18, 0x79, + 0x7d, 0xe2, 0xea, 0x91, 0xa7, 0x47, 0x53, 0x1e, 0x97, 0x22, 0xa9, 0xce, 0xfc, 0xf8, 0xe8, 0xca, + 0xde, 0x64, 0x74, 0xbd, 0x48,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 0x7b, 0x76, 0x72, 0xef, 0x09, 0x54, 0x28, 0xdb, 0x9a, 0x50, 0x49, 0x84, 0x30, 0x7f, 0xe0, 0xbe, + 0xbb, 0x17, 0xae, 0x28, 0xdb, 0x36, 0x5f, 0xdb, 0x03, 0xb6, 0x3d, 0x91, 0xdb, 0x1a, 0xdd, 0x36, + 0xa9, 0x79, 0x9a, 0xd1, 0xab, 0x4f, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x7c, 0x84, 0xad, 0x3f, + 0x40, 0x0e, 0x00, 0x00, } diff --git a/go/vt/sqlparser/ast_rewriting.go b/go/vt/sqlparser/ast_rewriting.go index bc0e8653ae3..0d8bbee1276 100644 --- a/go/vt/sqlparser/ast_rewriting.go +++ b/go/vt/sqlparser/ast_rewriting.go @@ -235,6 +235,7 @@ func (er *expressionRewriter) sysVarRewrite(cursor *Cursor, node *ColName) { sysvars.Workload.Name, sysvars.DDLStrategy.Name, sysvars.SessionUUID.Name, + sysvars.AllowUseReservedConn.Name, sysvars.ReadAfterWriteGTID.Name, sysvars.ReadAfterWriteTimeOut.Name, sysvars.VitessVersion.Name, diff --git a/go/vt/sqlparser/ast_rewriting_test.go b/go/vt/sqlparser/ast_rewriting_test.go index 64f185c42da..60e093f19c1 100644 --- a/go/vt/sqlparser/ast_rewriting_test.go +++ b/go/vt/sqlparser/ast_rewriting_test.go @@ -29,7 +29,7 @@ import ( type myTestCase struct { in, expected string liid, db, foundRows, rowCount, rawGTID, rawTimeout, sessTrackGTID bool - ddlStrategy, sessionUUID bool + ddlStrategy, sessionUUID, allowUseReservedConn bool udv int autocommit, clientFoundRows, skipQueryPlanCache bool sqlSelectLimit, transactionMode, workload, vitessVersion bool @@ -44,6 +44,10 @@ func TestRewrites(in *testing.T) { in: "SELECT @@vitess_version", expected: "SELECT :__vtvitess_version as `@@vitess_version`", vitessVersion: true, + }, { + in: "SELECT @@use_reserved_connection", + expected: "SELECT :__vtuse_reserved_connection as `@@use_reserved_connection`", + allowUseReservedConn: true, }, { in: "SELECT last_insert_id()", expected: "SELECT :__lastInsertId as `last_insert_id()`", @@ -199,6 +203,7 @@ func TestRewrites(in *testing.T) { assert.Equal(tc.workload, result.NeedsSysVar(sysvars.Workload.Name), "should need :__vtworkload") assert.Equal(tc.ddlStrategy, result.NeedsSysVar(sysvars.DDLStrategy.Name), "should need ddlStrategy") assert.Equal(tc.sessionUUID, result.NeedsSysVar(sysvars.SessionUUID.Name), "should need sessionUUID") + assert.Equal(tc.allowUseReservedConn, result.NeedsSysVar(sysvars.AllowUseReservedConn.Name), "should need allowUseReservedConnection") assert.Equal(tc.rawGTID, result.NeedsSysVar(sysvars.ReadAfterWriteGTID.Name), "should need rawGTID") assert.Equal(tc.rawTimeout, result.NeedsSysVar(sysvars.ReadAfterWriteTimeOut.Name), "should need rawTimeout") assert.Equal(tc.sessTrackGTID, result.NeedsSysVar(sysvars.SessionTrackGTIDs.Name), "should need sessTrackGTID") diff --git a/go/vt/sysvars/sysvars.go b/go/vt/sysvars/sysvars.go index 2c6515ca28e..323854a1659 100644 --- a/go/vt/sysvars/sysvars.go +++ b/go/vt/sysvars/sysvars.go @@ -43,17 +43,18 @@ var ( off = "0" utf8 = "'utf8'" - Autocommit = SystemVariable{Name: "autocommit", IsBoolean: true, Default: on} - ClientFoundRows = SystemVariable{Name: "client_found_rows", IsBoolean: true, Default: off} - SkipQueryPlanCache = SystemVariable{Name: "skip_query_plan_cache", IsBoolean: true, Default: off} - TxReadOnly = SystemVariable{Name: "tx_read_only", IsBoolean: true, Default: off} - TransactionReadOnly = SystemVariable{Name: "transaction_read_only", IsBoolean: true, Default: off} - SQLSelectLimit = SystemVariable{Name: "sql_select_limit", Default: off} - TransactionMode = SystemVariable{Name: "transaction_mode", IdentifierAsString: true} - Workload = SystemVariable{Name: "workload", IdentifierAsString: true} - Charset = SystemVariable{Name: "charset", Default: utf8, IdentifierAsString: true} - Names = SystemVariable{Name: "names", Default: utf8, IdentifierAsString: true} - SessionUUID = SystemVariable{Name: "session_uuid", IdentifierAsString: true} + Autocommit = SystemVariable{Name: "autocommit", IsBoolean: true, Default: on} + ClientFoundRows = SystemVariable{Name: "client_found_rows", IsBoolean: true, Default: off} + SkipQueryPlanCache = SystemVariable{Name: "skip_query_plan_cache", IsBoolean: true, Default: off} + TxReadOnly = SystemVariable{Name: "tx_read_only", IsBoolean: true, Default: off} + TransactionReadOnly = SystemVariable{Name: "transaction_read_only", IsBoolean: true, Default: off} + SQLSelectLimit = SystemVariable{Name: "sql_select_limit", Default: off} + TransactionMode = SystemVariable{Name: "transaction_mode", IdentifierAsString: true} + Workload = SystemVariable{Name: "workload", IdentifierAsString: true} + Charset = SystemVariable{Name: "charset", Default: utf8, IdentifierAsString: true} + Names = SystemVariable{Name: "names", Default: utf8, IdentifierAsString: true} + SessionUUID = SystemVariable{Name: "session_uuid", IdentifierAsString: true} + AllowUseReservedConn = SystemVariable{Name: "use_reserved_connection", IsBoolean: true, Default: off} // Online DDL DDLStrategy = SystemVariable{Name: "ddl_strategy", IdentifierAsString: true} VitessVersion = SystemVariable{Name: "vitess_version", IdentifierAsString: true} @@ -76,6 +77,7 @@ var ( Charset, Names, SessionUUID, + AllowUseReservedConn, ReadAfterWriteGTID, ReadAfterWriteTimeOut, SessionTrackGTIDs, diff --git a/go/vt/vtgate/engine/fake_vcursor_test.go b/go/vt/vtgate/engine/fake_vcursor_test.go index 59a4eb82374..76112509b0a 100644 --- a/go/vt/vtgate/engine/fake_vcursor_test.go +++ b/go/vt/vtgate/engine/fake_vcursor_test.go @@ -73,6 +73,10 @@ func (t noopVCursor) SetReadAfterWriteGTID(s string) { panic("implement me") } +func (t noopVCursor) SetAllowUseReservedConn(allow bool) error { + panic("implement me") +} + func (t noopVCursor) SetReadAfterWriteTimeout(f float64) { panic("implement me") } diff --git a/go/vt/vtgate/engine/primitive.go b/go/vt/vtgate/engine/primitive.go index b8562ba7175..36a86f51228 100644 --- a/go/vt/vtgate/engine/primitive.go +++ b/go/vt/vtgate/engine/primitive.go @@ -134,6 +134,8 @@ type ( GetSessionUUID() string + SetAllowUseReservedConn(bool) error + // SetReadAfterWriteGTID sets the GTID that the user expects a replica to have caught up with before answering a query SetReadAfterWriteGTID(string) SetReadAfterWriteTimeout(float64) diff --git a/go/vt/vtgate/engine/set.go b/go/vt/vtgate/engine/set.go index 43401cb8a25..5e70cff6d6c 100644 --- a/go/vt/vtgate/engine/set.go +++ b/go/vt/vtgate/engine/set.go @@ -408,6 +408,8 @@ func (svss *SysVarSetAware) Execute(vcursor VCursor, env evalengine.ExpressionEn return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "invalid DDL strategy: %s", str) } vcursor.Session().SetDDLStrategy(str) + case sysvars.AllowUseReservedConn.Name: + err = svss.setBoolSysVar(env, vcursor.Session().SetAllowUseReservedConn) case sysvars.Charset.Name, sysvars.Names.Name: str, err := svss.evalAsString(env) if err != nil { diff --git a/go/vt/vtgate/executor.go b/go/vt/vtgate/executor.go index 7dcd4aa73e2..145b737c710 100644 --- a/go/vt/vtgate/executor.go +++ b/go/vt/vtgate/executor.go @@ -297,6 +297,8 @@ func (e *Executor) addNeededBindVars(bindVarNeeds *sqlparser.BindVarNeeds, bindV bindVars[key] = sqltypes.StringBindVariable(session.DDLStrategy) case sysvars.SessionUUID.Name: bindVars[key] = sqltypes.StringBindVariable(session.SessionUUID) + case sysvars.AllowUseReservedConn.Name: + bindVars[key] = sqltypes.BoolBindVariable(session.UseReservedConnection) case sysvars.ReadAfterWriteGTID.Name: var v string ifReadAfterWriteExist(session, func(raw *vtgatepb.ReadAfterWrite) { diff --git a/go/vt/vtgate/safe_session.go b/go/vt/vtgate/safe_session.go index ead6619b4af..3a3516c83ae 100644 --- a/go/vt/vtgate/safe_session.go +++ b/go/vt/vtgate/safe_session.go @@ -478,6 +478,13 @@ func (session *SafeSession) GetSessionUUID() string { return session.SessionUUID } +// SetAllowUseReservedConn returns the AllowUseReservedConn value. +func (session *SafeSession) SetAllowUseReservedConn(allow bool) { + session.mu.Lock() + defer session.mu.Unlock() + session.UseReservedConnection = allow +} + // SetReadAfterWriteGTID set the ReadAfterWriteGtid setting. func (session *SafeSession) SetReadAfterWriteGTID(vtgtid string) { session.mu.Lock() diff --git a/go/vt/vtgate/vcursor_impl.go b/go/vt/vtgate/vcursor_impl.go index 6760994bfdc..ff1e4dcf680 100644 --- a/go/vt/vtgate/vcursor_impl.go +++ b/go/vt/vtgate/vcursor_impl.go @@ -661,6 +661,12 @@ func (vc *vcursorImpl) GetSessionUUID() string { return vc.safeSession.GetSessionUUID() } +// SetAllowUseReservedConn implements the SessionActions interface +func (vc *vcursorImpl) SetAllowUseReservedConn(allow bool) error { + vc.safeSession.SetAllowUseReservedConn(allow) + return nil +} + // SetReadAfterWriteGTID implements the SessionActions interface func (vc *vcursorImpl) SetReadAfterWriteGTID(vtgtid string) { vc.safeSession.SetReadAfterWriteGTID(vtgtid) diff --git a/proto/vtgate.proto b/proto/vtgate.proto index 43723c5bcd5..a36b87f959f 100644 --- a/proto/vtgate.proto +++ b/proto/vtgate.proto @@ -143,6 +143,9 @@ message Session { // Session UUID string SessionUUID = 22; + + // use_reserved_connection defines if we can use reserved connections. + bool use_reserved_connection = 23; } // ReadAfterWrite contains information regarding gtid set and timeout From 59702c1e6944d87df0b3d6f9e134058095fc4a3b Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Sun, 17 Jan 2021 18:08:28 +0100 Subject: [PATCH 2/9] New tests and condition on vcursor SysVarSetEnabled Signed-off-by: Florent Poinsard --- go.sum | 2 ++ go/vt/sysvars/sysvars.go | 2 +- go/vt/vtgate/engine/fake_vcursor_test.go | 4 ++++ go/vt/vtgate/engine/primitive.go | 1 + go/vt/vtgate/executor_set_test.go | 19 +++++++++++++++++++ go/vt/vtgate/plugin_mysql_server.go | 7 ++++--- go/vt/vtgate/safe_session.go | 9 ++++++++- go/vt/vtgate/vcursor_impl.go | 7 ++++++- 8 files changed, 45 insertions(+), 6 deletions(-) diff --git a/go.sum b/go.sum index 50b907dda98..0266bddda50 100644 --- a/go.sum +++ b/go.sum @@ -261,6 +261,7 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -582,6 +583,7 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= +github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= diff --git a/go/vt/sysvars/sysvars.go b/go/vt/sysvars/sysvars.go index 323854a1659..f01a46996d3 100644 --- a/go/vt/sysvars/sysvars.go +++ b/go/vt/sysvars/sysvars.go @@ -54,7 +54,7 @@ var ( Charset = SystemVariable{Name: "charset", Default: utf8, IdentifierAsString: true} Names = SystemVariable{Name: "names", Default: utf8, IdentifierAsString: true} SessionUUID = SystemVariable{Name: "session_uuid", IdentifierAsString: true} - AllowUseReservedConn = SystemVariable{Name: "use_reserved_connection", IsBoolean: true, Default: off} + AllowUseReservedConn = SystemVariable{Name: "use_reserved_connection", IsBoolean: true, Default: on} // Online DDL DDLStrategy = SystemVariable{Name: "ddl_strategy", IdentifierAsString: true} VitessVersion = SystemVariable{Name: "vitess_version", IdentifierAsString: true} diff --git a/go/vt/vtgate/engine/fake_vcursor_test.go b/go/vt/vtgate/engine/fake_vcursor_test.go index 76112509b0a..8a49c851698 100644 --- a/go/vt/vtgate/engine/fake_vcursor_test.go +++ b/go/vt/vtgate/engine/fake_vcursor_test.go @@ -77,6 +77,10 @@ func (t noopVCursor) SetAllowUseReservedConn(allow bool) error { panic("implement me") } +func (t noopVCursor) GetAllowUseReservedConn() bool { + panic("implement me") +} + func (t noopVCursor) SetReadAfterWriteTimeout(f float64) { panic("implement me") } diff --git a/go/vt/vtgate/engine/primitive.go b/go/vt/vtgate/engine/primitive.go index 36a86f51228..fb0b8aad485 100644 --- a/go/vt/vtgate/engine/primitive.go +++ b/go/vt/vtgate/engine/primitive.go @@ -135,6 +135,7 @@ type ( GetSessionUUID() string SetAllowUseReservedConn(bool) error + GetAllowUseReservedConn() bool // SetReadAfterWriteGTID sets the GTID that the user expects a replica to have caught up with before answering a query SetReadAfterWriteGTID(string) diff --git a/go/vt/vtgate/executor_set_test.go b/go/vt/vtgate/executor_set_test.go index 19e8d980600..70687654ff1 100644 --- a/go/vt/vtgate/executor_set_test.go +++ b/go/vt/vtgate/executor_set_test.go @@ -228,6 +228,24 @@ func TestExecutorSet(t *testing.T) { }, { in: "set session transaction read write", out: &vtgatepb.Session{Autocommit: true}, + }, { + in: "set @@use_reserved_connection = on", + out: &vtgatepb.Session{Autocommit: true, UseReservedConnection: true}, + }, { + in: "set @@use_reserved_connection = off", + out: &vtgatepb.Session{Autocommit: true, UseReservedConnection: false}, + }, { + in: "set @@use_reserved_connection = 1", + out: &vtgatepb.Session{Autocommit: true, UseReservedConnection: true}, + }, { + in: "set @@use_reserved_connection = 0", + out: &vtgatepb.Session{Autocommit: true, UseReservedConnection: false}, + }, { + in: "set @@use_reserved_connection = true", + out: &vtgatepb.Session{Autocommit: true, UseReservedConnection: true}, + }, { + in: "set @@use_reserved_connection = false", + out: &vtgatepb.Session{Autocommit: true, UseReservedConnection: false}, }} for i, tcase := range testcases { t.Run(fmt.Sprintf("%d-%s", i, tcase.in), func(t *testing.T) { @@ -317,6 +335,7 @@ func TestExecutorSetOp(t *testing.T) { t.Run(tcase.in, func(t *testing.T) { session := NewAutocommitSession(masterSession) session.TargetString = KsTestUnsharded + session.UseReservedConnection = true _, err := executor.Execute( context.Background(), "TestExecute", diff --git a/go/vt/vtgate/plugin_mysql_server.go b/go/vt/vtgate/plugin_mysql_server.go index 5ee65dd5c45..d31d458c5bc 100644 --- a/go/vt/vtgate/plugin_mysql_server.go +++ b/go/vt/vtgate/plugin_mysql_server.go @@ -342,9 +342,10 @@ func (vh *vtgateHandler) session(c *mysql.Conn) *vtgatepb.Session { IncludedFields: querypb.ExecuteOptions_ALL, Workload: querypb.ExecuteOptions_Workload(mysqlDefaultWorkload), }, - Autocommit: true, - DDLStrategy: *defaultDDLStrategy, - SessionUUID: u.String(), + Autocommit: true, + DDLStrategy: *defaultDDLStrategy, + SessionUUID: u.String(), + UseReservedConnection: true, } if c.Capabilities&mysql.CapabilityClientFoundRows != 0 { session.Options.ClientFoundRows = true diff --git a/go/vt/vtgate/safe_session.go b/go/vt/vtgate/safe_session.go index 3a3516c83ae..e8dfdd4b099 100644 --- a/go/vt/vtgate/safe_session.go +++ b/go/vt/vtgate/safe_session.go @@ -478,13 +478,20 @@ func (session *SafeSession) GetSessionUUID() string { return session.SessionUUID } -// SetAllowUseReservedConn returns the AllowUseReservedConn value. +// SetAllowUseReservedConn set the AllowUseReservedConn setting. func (session *SafeSession) SetAllowUseReservedConn(allow bool) { session.mu.Lock() defer session.mu.Unlock() session.UseReservedConnection = allow } +// GetAllowUseReservedConn returns the AllowUseReservedConn value. +func (session *SafeSession) GetAllowUseReservedConn() bool { + session.mu.Lock() + defer session.mu.Unlock() + return session.UseReservedConnection +} + // SetReadAfterWriteGTID set the ReadAfterWriteGtid setting. func (session *SafeSession) SetReadAfterWriteGTID(vtgtid string) { session.mu.Lock() diff --git a/go/vt/vtgate/vcursor_impl.go b/go/vt/vtgate/vcursor_impl.go index ff1e4dcf680..a945f2c7691 100644 --- a/go/vt/vtgate/vcursor_impl.go +++ b/go/vt/vtgate/vcursor_impl.go @@ -329,7 +329,7 @@ func (vc *vcursorImpl) FirstSortedKeyspace() (*vindexes.Keyspace, error) { // SysVarSetEnabled implements the ContextVSchema interface func (vc *vcursorImpl) SysVarSetEnabled() bool { - return *sysVarSetEnabled + return vc.GetAllowUseReservedConn() && *sysVarSetEnabled } // KeyspaceExists provides whether the keyspace exists or not. @@ -667,6 +667,11 @@ func (vc *vcursorImpl) SetAllowUseReservedConn(allow bool) error { return nil } +// GetAllowUseReservedConn implements the SessionActions interface +func (vc *vcursorImpl) GetAllowUseReservedConn() bool { + return vc.safeSession.GetAllowUseReservedConn() +} + // SetReadAfterWriteGTID implements the SessionActions interface func (vc *vcursorImpl) SetReadAfterWriteGTID(vtgtid string) { vc.safeSession.SetReadAfterWriteGTID(vtgtid) From 0a5bf2b85e2a0de586efd7a06efceb7f73cf01c3 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 18 Jan 2021 14:05:31 +0100 Subject: [PATCH 3/9] Restored unwanted changes on go.sum Signed-off-by: Florent Poinsard --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index 0266bddda50..50b907dda98 100644 --- a/go.sum +++ b/go.sum @@ -261,7 +261,6 @@ github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -583,7 +582,6 @@ github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y8 github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1 h1:KOMtN28tlbam3/7ZKEYKHhKoJZYYj3gMH4uc62x7X7U= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.15.0 h1:4fgOnadei3EZvgRwxJ7RMpG1k1pOZth5Pc13tyspaKM= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a h1:9a8MnZMP0X2nLJdBg+pBmGgkJlSaKC2KaQmTCk1XDtE= github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= From afe8931a840ed770da61c43fdb9bd826911dee07 Mon Sep 17 00:00:00 2001 From: Andres Taylor Date: Mon, 18 Jan 2021 16:53:56 +0100 Subject: [PATCH 4/9] updated test Signed-off-by: Andres Taylor --- go/vt/vtgate/executor_set_test.go | 84 ++++++++++++++++++------------- 1 file changed, 49 insertions(+), 35 deletions(-) diff --git a/go/vt/vtgate/executor_set_test.go b/go/vt/vtgate/executor_set_test.go index 70687654ff1..2929fbe919f 100644 --- a/go/vt/vtgate/executor_set_test.go +++ b/go/vt/vtgate/executor_set_test.go @@ -265,77 +265,91 @@ func TestExecutorSetOp(t *testing.T) { executor, _, _, sbclookup := createLegacyExecutorEnv() *sysVarSetEnabled = true - sbclookup.SetResults([]*sqltypes.Result{ - sqltypes.MakeTestResult(sqltypes.MakeTestFields("sql_mode", "varchar"), "STRICT_ALL_TABLES,NO_AUTO_UPDATES"), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("sql_safe_updates", "int64"), "1"), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("tx_isolation", "varchar"), "read-committed"), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("sql_quote_show_create", "int64"), "0"), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("foreign_key_checks", "int64")), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("unique_checks", "int64"), "0"), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("net_write_timeout", "int64"), "600"), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("net_read_timeout", "int64"), "300"), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("character_set_client", "varchar"), "utf8"), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("character_set_results", "varchar")), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("character_set_results", "varchar")), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("character_set_results", "varchar")), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("character_set_results", "varchar")), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("character_set_results", "varchar")), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("character_set_results", "varchar")), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("client_found_rows", "int64")), - sqltypes.MakeTestResult(sqltypes.MakeTestFields("client_found_rows", "int64")), - }) + returnResult := func(columnName, typ, value string) *sqltypes.Result { + return sqltypes.MakeTestResult(sqltypes.MakeTestFields(columnName, typ), value) + } + returnNoResult := func(columnName, typ string) *sqltypes.Result { + return sqltypes.MakeTestResult(sqltypes.MakeTestFields(columnName, typ)) + } testcases := []struct { - in string - warning []*querypb.QueryWarning - sysVars map[string]string + in string + warning []*querypb.QueryWarning + sysVars map[string]string + disallowResConn bool + result *sqltypes.Result }{{ in: "set big_tables = 1", //ignore }, { in: "set sql_mode = 'STRICT_ALL_TABLES,NO_AUTO_UPDATES'", sysVars: map[string]string{"sql_mode": "'STRICT_ALL_TABLES,NO_AUTO_UPDATES'"}, + result: returnResult("sql_mode", "varchar", "STRICT_ALL_TABLES,NO_AUTO_UPDATES"), + }, { + // even though the tablet is saying that the value has changed, + // useReservedConn is false, so we won't allow this change + in: "set sql_mode = 'STRICT_ALL_TABLES,NO_AUTO_UPDATES'", + result: returnResult("sql_mode", "varchar", "STRICT_ALL_TABLES,NO_AUTO_UPDATES"), + sysVars: nil, + disallowResConn: true, }, { in: "set sql_safe_updates = 1", sysVars: map[string]string{"sql_safe_updates": "1"}, + result: returnResult("sql_safe_updates", "int64", "1"), }, { in: "set tx_isolation = 'read-committed'", sysVars: map[string]string{"tx_isolation": "'read-committed'"}, + result: returnResult("tx_isolation", "varchar", "read-committed"), }, { in: "set sql_quote_show_create = 0", sysVars: map[string]string{"sql_quote_show_create": "0"}, + result: returnResult("sql_quote_show_create", "int64", "0"), }, { - in: "set foreign_key_checks = 1", + in: "set foreign_key_checks = 1", + result: returnNoResult("foreign_key_checks", "int64"), }, { in: "set unique_checks = 0", sysVars: map[string]string{"unique_checks": "0"}, + result: returnResult("unique_checks", "int64", "0"), }, { - in: "set net_write_timeout = 600", + in: "set net_write_timeout = 600", + result: returnResult("net_write_timeout", "int64", "600"), }, { - in: "set net_read_timeout = 600", + in: "set net_read_timeout = 600", + result: returnResult("net_read_timeout", "int64", "300"), }, { - in: "set character_set_client = utf8", + in: "set character_set_client = utf8", + result: returnResult("character_set_client", "varchar", "utf8"), }, { - in: "set character_set_results=null", + in: "set character_set_results=null", + result: returnNoResult("character_set_results", "varchar"), }, { - in: "set character_set_results='binary'", + in: "set character_set_results='binary'", + result: returnNoResult("character_set_results", "varchar"), }, { - in: "set character_set_results='utf8'", + in: "set character_set_results='utf8'", + result: returnNoResult("character_set_results", "varchar"), }, { - in: "set character_set_results=utf8mb4", + in: "set character_set_results=utf8mb4", + result: returnNoResult("character_set_results", "varchar"), }, { - in: "set character_set_results='latin1'", + in: "set character_set_results='latin1'", + result: returnNoResult("character_set_results", "varchar"), }, { - in: "set character_set_results='abcd'", + in: "set character_set_results='abcd'", + result: returnNoResult("character_set_results", "varchar"), }, { - in: "set @@global.client_found_rows = 1", + in: "set @@global.client_found_rows = 1", + result: returnNoResult("client_found_rows", "int64"), }, { - in: "set global client_found_rows = 1", + in: "set global client_found_rows = 1", + result: returnNoResult("client_found_rows", "int64"), }} for _, tcase := range testcases { t.Run(tcase.in, func(t *testing.T) { session := NewAutocommitSession(masterSession) session.TargetString = KsTestUnsharded - session.UseReservedConnection = true + session.UseReservedConnection = !tcase.disallowResConn + sbclookup.SetResults([]*sqltypes.Result{tcase.result}) _, err := executor.Execute( context.Background(), "TestExecute", From 67237437666570560060a4d7766c90a1d0d8cd1c Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 18 Jan 2021 18:13:03 +0100 Subject: [PATCH 5/9] modified variable name to @@enable_system_settings Signed-off-by: Florent Poinsard --- go/vt/proto/vtgate/vtgate.pb.go | 188 +++++++++++------------ go/vt/sqlparser/ast_rewriting.go | 2 +- go/vt/sqlparser/ast_rewriting_test.go | 10 +- go/vt/sysvars/sysvars.go | 26 ++-- go/vt/vtgate/engine/fake_vcursor_test.go | 4 +- go/vt/vtgate/engine/primitive.go | 4 +- go/vt/vtgate/engine/set.go | 4 +- go/vt/vtgate/executor.go | 4 +- go/vt/vtgate/executor_set_test.go | 26 ++-- go/vt/vtgate/plugin_mysql_server.go | 8 +- go/vt/vtgate/safe_session.go | 12 +- go/vt/vtgate/vcursor_impl.go | 14 +- proto/vtgate.proto | 4 +- 13 files changed, 153 insertions(+), 153 deletions(-) diff --git a/go/vt/proto/vtgate/vtgate.pb.go b/go/vt/proto/vtgate/vtgate.pb.go index ed1ccac1727..ef6d6a75fd6 100644 --- a/go/vt/proto/vtgate/vtgate.pb.go +++ b/go/vt/proto/vtgate/vtgate.pb.go @@ -157,11 +157,11 @@ type Session struct { DDLStrategy string `protobuf:"bytes,21,opt,name=DDLStrategy,proto3" json:"DDLStrategy,omitempty"` // Session UUID SessionUUID string `protobuf:"bytes,22,opt,name=SessionUUID,proto3" json:"SessionUUID,omitempty"` - // use_reserved_connection defines if we can use reserved connections. - UseReservedConnection bool `protobuf:"varint,23,opt,name=use_reserved_connection,json=useReservedConnection,proto3" json:"use_reserved_connection,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // enable_system_settings defines if we can use reserved connections. + EnableSystemSettings bool `protobuf:"varint,23,opt,name=enable_system_settings,json=enableSystemSettings,proto3" json:"enable_system_settings,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Session) Reset() { *m = Session{} } @@ -336,9 +336,9 @@ func (m *Session) GetSessionUUID() string { return "" } -func (m *Session) GetUseReservedConnection() bool { +func (m *Session) GetEnableSystemSettings() bool { if m != nil { - return m.UseReservedConnection + return m.EnableSystemSettings } return false } @@ -1110,92 +1110,92 @@ func init() { func init() { proto.RegisterFile("vtgate.proto", fileDescriptor_aab96496ceaf1ebb) } var fileDescriptor_aab96496ceaf1ebb = []byte{ - // 1380 bytes of a gzipped FileDescriptorProto + // 1382 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0xdd, 0x6e, 0x1b, 0xb7, - 0x12, 0xce, 0xea, 0x5f, 0xa3, 0xbf, 0x35, 0xfd, 0x93, 0x8d, 0x4f, 0xce, 0x39, 0x82, 0x92, 0x20, - 0x4a, 0xce, 0x81, 0xdd, 0xba, 0x68, 0x1a, 0x14, 0x2d, 0x5a, 0x5b, 0x52, 0x52, 0x05, 0x76, 0xe4, - 0x52, 0xb2, 0x0d, 0x14, 0x2d, 0x16, 0x6b, 0x2d, 0x2d, 0x13, 0x96, 0x97, 0x0a, 0x49, 0xc9, 0xd5, - 0x53, 0xf4, 0xbe, 0x2f, 0xd0, 0x9b, 0xde, 0xf7, 0x1d, 0x7a, 0x57, 0xf4, 0x85, 0x0a, 0x92, 0xbb, - 0xd2, 0x4a, 0x71, 0x1b, 0x27, 0x41, 0x6e, 0x84, 0xe5, 0x7c, 0xc3, 0xe1, 0x70, 0xbe, 0xf9, 0xa1, - 0xa0, 0x38, 0x91, 0x03, 0x4f, 0x92, 0xad, 0x11, 0x67, 0x92, 0xa1, 0x8c, 0x59, 0x6d, 0xda, 0xa7, - 0x34, 0x18, 0xb2, 0x81, 0xef, 0x49, 0xcf, 0x20, 0x9b, 0x85, 0x57, 0x63, 0xc2, 0xa7, 0xe1, 0xa2, - 0x2c, 0xd9, 0x88, 0xc5, 0xc1, 0x89, 0xe4, 0xa3, 0xbe, 0x59, 0xd4, 0xfe, 0x2c, 0x40, 0xb6, 0x4b, - 0x84, 0xa0, 0x2c, 0x40, 0x0f, 0xa0, 0x4c, 0x03, 0x57, 0x72, 0x2f, 0x10, 0x5e, 0x5f, 0x52, 0x16, - 0x38, 0x56, 0xd5, 0xaa, 0xe7, 0x70, 0x89, 0x06, 0xbd, 0xb9, 0x10, 0x35, 0xa0, 0x2c, 0xce, 0x3d, - 0xee, 0xbb, 0xc2, 0xec, 0x13, 0x4e, 0xa2, 0x9a, 0xac, 0x17, 0x76, 0xee, 0x6e, 0x85, 0xde, 0x85, - 0xf6, 0xb6, 0xba, 0x4a, 0x2b, 0x5c, 0xe0, 0x92, 0x88, 0xad, 0x04, 0xfa, 0x0f, 0x80, 0x37, 0x96, - 0xac, 0xcf, 0x2e, 0x2f, 0xa9, 0x74, 0x52, 0xfa, 0x9c, 0x98, 0x04, 0xdd, 0x83, 0x92, 0xf4, 0xf8, - 0x80, 0x48, 0x57, 0x48, 0x4e, 0x83, 0x81, 0x93, 0xae, 0x5a, 0xf5, 0x3c, 0x2e, 0x1a, 0x61, 0x57, - 0xcb, 0xd0, 0x36, 0x64, 0xd9, 0x48, 0x6a, 0x17, 0x32, 0x55, 0xab, 0x5e, 0xd8, 0x59, 0xdf, 0x32, - 0x17, 0x6f, 0xfd, 0x48, 0xfa, 0x63, 0x49, 0x3a, 0x06, 0xc4, 0x91, 0x16, 0xda, 0x03, 0x3b, 0x76, - 0x3d, 0xf7, 0x92, 0xf9, 0xc4, 0xc9, 0x56, 0xad, 0x7a, 0x79, 0xe7, 0x76, 0xe4, 0x7c, 0xec, 0xa6, - 0x07, 0xcc, 0x27, 0xb8, 0x22, 0x17, 0x05, 0x68, 0x1b, 0x72, 0x57, 0x1e, 0x0f, 0x68, 0x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x01, 0xe5, 0xb0, 0x65, 0x63, 0xf2, 0x6a, 0x4c, 0x84, 0x44, 0xff, 0x87, 0x7c, 0xdf, - 0x1b, 0x0e, 0x09, 0x77, 0x43, 0x17, 0x0b, 0x3b, 0x95, 0x2d, 0x33, 0xb8, 0x1a, 0x5a, 0xde, 0x6e, - 0xe2, 0x9c, 0xd1, 0x68, 0xfb, 0xe8, 0x11, 0x64, 0xa3, 0xda, 0x4b, 0xcc, 0x74, 0xe3, 0xb5, 0x87, - 0x23, 0x1c, 0x3d, 0x84, 0xb4, 0x66, 0x21, 0x4c, 0x8b, 0x95, 0x88, 0x13, 0xd5, 0xe5, 0x74, 0x03, - 0xc7, 0x06, 0x47, 0x9f, 0x42, 0x98, 0x1b, 0xae, 0x9c, 0x8e, 0x88, 0x4e, 0x86, 0xf2, 0xce, 0xda, - 0x72, 0x16, 0xf5, 0xa6, 0x23, 0x82, 0x41, 0xce, 0xbe, 0x55, 0x92, 0x5e, 0x90, 0xa9, 0x18, 0x79, - 0x7d, 0xe2, 0xea, 0x91, 0xa7, 0x47, 0x53, 0x1e, 0x97, 0x22, 0xa9, 0xce, 0xfc, 0xf8, 0xe8, 0xca, - 0xde, 0x64, 0x74, 0xbd, 0x48, 0xe5, 0xd2, 0x76, 0xa6, 0xf6, 0x93, 0x05, 0x95, 0x59, 0xa4, 0xc4, - 0x88, 0x05, 0x42, 0x9d, 0x98, 0x26, 0x9c, 0x33, 0xbe, 0x14, 0x26, 0x7c, 0xd8, 0x68, 0x29, 0x31, - 0x36, 0xe8, 0xdb, 0xc4, 0xe8, 0x31, 0x64, 0x38, 0x11, 0xe3, 0xa1, 0x0c, 0x83, 0x84, 0xe2, 0x03, - 0x0e, 0x6b, 0x04, 0x87, 0x1a, 0xb5, 0x3f, 0x12, 0xb0, 0x1a, 0x7a, 0xb4, 0xe7, 0xc9, 0xfe, 0xf9, - 0x07, 0x27, 0xf0, 0x7f, 0x90, 0x55, 0xde, 0x50, 0xa2, 0x12, 0x2a,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ae, 0x1e, 0x78, 0x7a, 0x30, 0xe5, 0x71, 0x29, 0x92, 0xea, 0xcc, 0x8f, 0x0f, + 0xae, 0xec, 0x4d, 0x06, 0xd7, 0xf3, 0x54, 0x2e, 0x6d, 0x67, 0xea, 0xbf, 0x58, 0x50, 0x99, 0x45, + 0x4a, 0x8c, 0x58, 0x20, 0xd4, 0x89, 0x69, 0xc2, 0x39, 0xe3, 0x4b, 0x61, 0xc2, 0x87, 0xcd, 0x96, + 0x12, 0x63, 0x83, 0xbe, 0x4d, 0x8c, 0x1e, 0x43, 0x86, 0x13, 0x31, 0x1e, 0xca, 0x30, 0x48, 0x28, + 0x3e, 0xde, 0xb0, 0x46, 0x70, 0xa8, 0x51, 0x7f, 0x95, 0x80, 0xd5, 0xd0, 0xa3, 0x5d, 0x4f, 0xf6, + 0xcf, 0x3f, 0x38, 0x81, 0xff, 0x83, 0xac, 0xf2, 0x86, 0x12, 0x95, 0x50, 0xc9, 0xeb, 0x29, 0x8c, + 0x34, 0xde, 0x83, 0x44, 0x4f, 0x2c, 0xbc, 0x83, 0xd2, 0xe6, 0x1d, 0xe4, 0x89, 0xf8, 0x3b, 0xe8, + 0x03, 0x71, 0x5d, 0xff, 0xd5, 0x82, 0xea, 0x62, 0x4c, 0x3f, 0x18, 0xd5, 0x1f, 0x41, 0xd6, 0x10, + 0x19, 0x45, 0x73, 0x3d, 0xf4, 0xcd, 0xd0, 0x7c, 0x42, 0xe5, 0xb9, 0x31, 0x1d, 0xa9, 0xa9, 0x62, + 0xad, 0x76, 0x25, 0x27, 0xde, 0xe5, 0x7b, 0x95, 0xec, 0xac, 0x0e, 0x13, 0x6f, 0x57, 0x87, 0xc9, + 0x77, 0xae, 0xc3, 0xd4, 0x1b, 0xb8, 0x49, 0xdf, 0xe8, 0x01, 0x19, 0x8b, 0x6d, 0xe6, 0x9f, 0x63, + 0x5b, 0x6f, 0xc2, 0xda, 0x52, 0xa0, 0x42, 0x1a, 0xe7, 0xf5, 0x65, 0xbd,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+ 0x90, 0x3a, 0xec, 0x74, 0x7b, 0x76, 0x02, 0x95, 0x01, 0x76, 0x8e, 0x7a, 0x9d, 0x66, 0xe7, 0xe0, + 0xa0, 0xdd, 0xb3, 0x93, 0xbb, 0x9f, 0x43, 0x85, 0xb2, 0xcd, 0x09, 0x95, 0x44, 0x08, 0xf3, 0xf7, + 0xed, 0x87, 0x7b, 0xe1, 0x8a, 0xb2, 0x2d, 0xf3, 0xb5, 0x35, 0x60, 0x5b, 0x13, 0xb9, 0xa5, 0xd1, + 0x2d, 0x93, 0x9a, 0xa7, 0x19, 0xbd, 0xfa, 0xe4, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x86, 0x85, + 0xad, 0x4f, 0x3e, 0x0e, 0x00, 0x00, } diff --git a/go/vt/sqlparser/ast_rewriting.go b/go/vt/sqlparser/ast_rewriting.go index 0d8bbee1276..151fc4291f7 100644 --- a/go/vt/sqlparser/ast_rewriting.go +++ b/go/vt/sqlparser/ast_rewriting.go @@ -235,7 +235,7 @@ func (er *expressionRewriter) sysVarRewrite(cursor *Cursor, node *ColName) { sysvars.Workload.Name, sysvars.DDLStrategy.Name, sysvars.SessionUUID.Name, - sysvars.AllowUseReservedConn.Name, + sysvars.SessionEnableSystemSettings.Name, sysvars.ReadAfterWriteGTID.Name, sysvars.ReadAfterWriteTimeOut.Name, sysvars.VitessVersion.Name, diff --git a/go/vt/sqlparser/ast_rewriting_test.go b/go/vt/sqlparser/ast_rewriting_test.go index 60e093f19c1..15b25d068ac 100644 --- a/go/vt/sqlparser/ast_rewriting_test.go +++ b/go/vt/sqlparser/ast_rewriting_test.go @@ -29,7 +29,7 @@ import ( type myTestCase struct { in, expected string liid, db, foundRows, rowCount, rawGTID, rawTimeout, sessTrackGTID bool - ddlStrategy, sessionUUID, allowUseReservedConn bool + ddlStrategy, sessionUUID, sessionEnableSystemSettings bool udv int autocommit, clientFoundRows, skipQueryPlanCache bool sqlSelectLimit, transactionMode, workload, vitessVersion bool @@ -45,9 +45,9 @@ func TestRewrites(in *testing.T) { expected: "SELECT :__vtvitess_version as `@@vitess_version`", vitessVersion: true, }, { - in: "SELECT @@use_reserved_connection", - expected: "SELECT :__vtuse_reserved_connection as `@@use_reserved_connection`", - allowUseReservedConn: true, + in: "SELECT @@enable_system_settings", + expected: "SELECT :__vtenable_system_settings as `@@enable_system_settings`", + sessionEnableSystemSettings: true, }, { in: "SELECT last_insert_id()", expected: "SELECT :__lastInsertId as `last_insert_id()`", @@ -203,7 +203,7 @@ func TestRewrites(in *testing.T) { assert.Equal(tc.workload, result.NeedsSysVar(sysvars.Workload.Name), "should need :__vtworkload") assert.Equal(tc.ddlStrategy, result.NeedsSysVar(sysvars.DDLStrategy.Name), "should need ddlStrategy") assert.Equal(tc.sessionUUID, result.NeedsSysVar(sysvars.SessionUUID.Name), "should need sessionUUID") - assert.Equal(tc.allowUseReservedConn, result.NeedsSysVar(sysvars.AllowUseReservedConn.Name), "should need allowUseReservedConnection") + assert.Equal(tc.sessionEnableSystemSettings, result.NeedsSysVar(sysvars.SessionEnableSystemSettings.Name), "should need sessionEnableSystemSettings") assert.Equal(tc.rawGTID, result.NeedsSysVar(sysvars.ReadAfterWriteGTID.Name), "should need rawGTID") assert.Equal(tc.rawTimeout, result.NeedsSysVar(sysvars.ReadAfterWriteTimeOut.Name), "should need rawTimeout") assert.Equal(tc.sessTrackGTID, result.NeedsSysVar(sysvars.SessionTrackGTIDs.Name), "should need sessTrackGTID") diff --git a/go/vt/sysvars/sysvars.go b/go/vt/sysvars/sysvars.go index f01a46996d3..ecbffa94775 100644 --- a/go/vt/sysvars/sysvars.go +++ b/go/vt/sysvars/sysvars.go @@ -43,18 +43,18 @@ var ( off = "0" utf8 = "'utf8'" - Autocommit = SystemVariable{Name: "autocommit", IsBoolean: true, Default: on} - ClientFoundRows = SystemVariable{Name: "client_found_rows", IsBoolean: true, Default: off} - SkipQueryPlanCache = SystemVariable{Name: "skip_query_plan_cache", IsBoolean: true, Default: off} - TxReadOnly = SystemVariable{Name: "tx_read_only", IsBoolean: true, Default: off} - TransactionReadOnly = SystemVariable{Name: "transaction_read_only", IsBoolean: true, Default: off} - SQLSelectLimit = SystemVariable{Name: "sql_select_limit", Default: off} - TransactionMode = SystemVariable{Name: "transaction_mode", IdentifierAsString: true} - Workload = SystemVariable{Name: "workload", IdentifierAsString: true} - Charset = SystemVariable{Name: "charset", Default: utf8, IdentifierAsString: true} - Names = SystemVariable{Name: "names", Default: utf8, IdentifierAsString: true} - SessionUUID = SystemVariable{Name: "session_uuid", IdentifierAsString: true} - AllowUseReservedConn = SystemVariable{Name: "use_reserved_connection", IsBoolean: true, Default: on} + Autocommit = SystemVariable{Name: "autocommit", IsBoolean: true, Default: on} + ClientFoundRows = SystemVariable{Name: "client_found_rows", IsBoolean: true, Default: off} + SkipQueryPlanCache = SystemVariable{Name: "skip_query_plan_cache", IsBoolean: true, Default: off} + TxReadOnly = SystemVariable{Name: "tx_read_only", IsBoolean: true, Default: off} + TransactionReadOnly = SystemVariable{Name: "transaction_read_only", IsBoolean: true, Default: off} + SQLSelectLimit = SystemVariable{Name: "sql_select_limit", Default: off} + TransactionMode = SystemVariable{Name: "transaction_mode", IdentifierAsString: true} + Workload = SystemVariable{Name: "workload", IdentifierAsString: true} + Charset = SystemVariable{Name: "charset", Default: utf8, IdentifierAsString: true} + Names = SystemVariable{Name: "names", Default: utf8, IdentifierAsString: true} + SessionUUID = SystemVariable{Name: "session_uuid", IdentifierAsString: true} + SessionEnableSystemSettings = SystemVariable{Name: "enable_system_settings", IsBoolean: true, Default: on} // Online DDL DDLStrategy = SystemVariable{Name: "ddl_strategy", IdentifierAsString: true} VitessVersion = SystemVariable{Name: "vitess_version", IdentifierAsString: true} @@ -77,7 +77,7 @@ var ( Charset, Names, SessionUUID, - AllowUseReservedConn, + SessionEnableSystemSettings, ReadAfterWriteGTID, ReadAfterWriteTimeOut, SessionTrackGTIDs, diff --git a/go/vt/vtgate/engine/fake_vcursor_test.go b/go/vt/vtgate/engine/fake_vcursor_test.go index 8a49c851698..df27d1984e8 100644 --- a/go/vt/vtgate/engine/fake_vcursor_test.go +++ b/go/vt/vtgate/engine/fake_vcursor_test.go @@ -73,11 +73,11 @@ func (t noopVCursor) SetReadAfterWriteGTID(s string) { panic("implement me") } -func (t noopVCursor) SetAllowUseReservedConn(allow bool) error { +func (t noopVCursor) SetSessionEnableSystemSettings(allow bool) error { panic("implement me") } -func (t noopVCursor) GetAllowUseReservedConn() bool { +func (t noopVCursor) GetSessionEnableSystemSettings() bool { panic("implement me") } diff --git a/go/vt/vtgate/engine/primitive.go b/go/vt/vtgate/engine/primitive.go index fb0b8aad485..6d347f3deb6 100644 --- a/go/vt/vtgate/engine/primitive.go +++ b/go/vt/vtgate/engine/primitive.go @@ -134,8 +134,8 @@ type ( GetSessionUUID() string - SetAllowUseReservedConn(bool) error - GetAllowUseReservedConn() bool + SetSessionEnableSystemSettings(bool) error + GetSessionEnableSystemSettings() bool // SetReadAfterWriteGTID sets the GTID that the user expects a replica to have caught up with before answering a query SetReadAfterWriteGTID(string) diff --git a/go/vt/vtgate/engine/set.go b/go/vt/vtgate/engine/set.go index 5e70cff6d6c..24d0b9b8b4a 100644 --- a/go/vt/vtgate/engine/set.go +++ b/go/vt/vtgate/engine/set.go @@ -408,8 +408,8 @@ func (svss *SysVarSetAware) Execute(vcursor VCursor, env evalengine.ExpressionEn return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "invalid DDL strategy: %s", str) } vcursor.Session().SetDDLStrategy(str) - case sysvars.AllowUseReservedConn.Name: - err = svss.setBoolSysVar(env, vcursor.Session().SetAllowUseReservedConn) + case sysvars.SessionEnableSystemSettings.Name: + err = svss.setBoolSysVar(env, vcursor.Session().SetSessionEnableSystemSettings) case sysvars.Charset.Name, sysvars.Names.Name: str, err := svss.evalAsString(env) if err != nil { diff --git a/go/vt/vtgate/executor.go b/go/vt/vtgate/executor.go index 145b737c710..f16e7122d90 100644 --- a/go/vt/vtgate/executor.go +++ b/go/vt/vtgate/executor.go @@ -297,8 +297,8 @@ func (e *Executor) addNeededBindVars(bindVarNeeds *sqlparser.BindVarNeeds, bindV bindVars[key] = sqltypes.StringBindVariable(session.DDLStrategy) case sysvars.SessionUUID.Name: bindVars[key] = sqltypes.StringBindVariable(session.SessionUUID) - case sysvars.AllowUseReservedConn.Name: - bindVars[key] = sqltypes.BoolBindVariable(session.UseReservedConnection) + case sysvars.SessionEnableSystemSettings.Name: + bindVars[key] = sqltypes.BoolBindVariable(session.EnableSystemSettings) case sysvars.ReadAfterWriteGTID.Name: var v string ifReadAfterWriteExist(session, func(raw *vtgatepb.ReadAfterWrite) { diff --git a/go/vt/vtgate/executor_set_test.go b/go/vt/vtgate/executor_set_test.go index 2929fbe919f..3d6db4a755d 100644 --- a/go/vt/vtgate/executor_set_test.go +++ b/go/vt/vtgate/executor_set_test.go @@ -229,23 +229,23 @@ func TestExecutorSet(t *testing.T) { in: "set session transaction read write", out: &vtgatepb.Session{Autocommit: true}, }, { - in: "set @@use_reserved_connection = on", - out: &vtgatepb.Session{Autocommit: true, UseReservedConnection: true}, + in: "set @@enable_system_settings = on", + out: &vtgatepb.Session{Autocommit: true, EnableSystemSettings: true}, }, { - in: "set @@use_reserved_connection = off", - out: &vtgatepb.Session{Autocommit: true, UseReservedConnection: false}, + in: "set @@enable_system_settings = off", + out: &vtgatepb.Session{Autocommit: true, EnableSystemSettings: false}, }, { - in: "set @@use_reserved_connection = 1", - out: &vtgatepb.Session{Autocommit: true, UseReservedConnection: true}, + in: "set @@enable_system_settings = 1", + out: &vtgatepb.Session{Autocommit: true, EnableSystemSettings: true}, }, { - in: "set @@use_reserved_connection = 0", - out: &vtgatepb.Session{Autocommit: true, UseReservedConnection: false}, + in: "set @@enable_system_settings = 0", + out: &vtgatepb.Session{Autocommit: true, EnableSystemSettings: false}, }, { - in: "set @@use_reserved_connection = true", - out: &vtgatepb.Session{Autocommit: true, UseReservedConnection: true}, + in: "set @@enable_system_settings = true", + out: &vtgatepb.Session{Autocommit: true, EnableSystemSettings: true}, }, { - in: "set @@use_reserved_connection = false", - out: &vtgatepb.Session{Autocommit: true, UseReservedConnection: false}, + in: "set @@enable_system_settings = false", + out: &vtgatepb.Session{Autocommit: true, EnableSystemSettings: false}, }} for i, tcase := range testcases { t.Run(fmt.Sprintf("%d-%s", i, tcase.in), func(t *testing.T) { @@ -348,7 +348,7 @@ func TestExecutorSetOp(t *testing.T) { t.Run(tcase.in, func(t *testing.T) { session := NewAutocommitSession(masterSession) session.TargetString = KsTestUnsharded - session.UseReservedConnection = !tcase.disallowResConn + session.EnableSystemSettings = !tcase.disallowResConn sbclookup.SetResults([]*sqltypes.Result{tcase.result}) _, err := executor.Execute( context.Background(), diff --git a/go/vt/vtgate/plugin_mysql_server.go b/go/vt/vtgate/plugin_mysql_server.go index d31d458c5bc..82655a4871b 100644 --- a/go/vt/vtgate/plugin_mysql_server.go +++ b/go/vt/vtgate/plugin_mysql_server.go @@ -342,10 +342,10 @@ func (vh *vtgateHandler) session(c *mysql.Conn) *vtgatepb.Session { IncludedFields: querypb.ExecuteOptions_ALL, Workload: querypb.ExecuteOptions_Workload(mysqlDefaultWorkload), }, - Autocommit: true, - DDLStrategy: *defaultDDLStrategy, - SessionUUID: u.String(), - UseReservedConnection: true, + Autocommit: true, + DDLStrategy: *defaultDDLStrategy, + SessionUUID: u.String(), + EnableSystemSettings: true, } if c.Capabilities&mysql.CapabilityClientFoundRows != 0 { session.Options.ClientFoundRows = true diff --git a/go/vt/vtgate/safe_session.go b/go/vt/vtgate/safe_session.go index e8dfdd4b099..9691fd18662 100644 --- a/go/vt/vtgate/safe_session.go +++ b/go/vt/vtgate/safe_session.go @@ -478,18 +478,18 @@ func (session *SafeSession) GetSessionUUID() string { return session.SessionUUID } -// SetAllowUseReservedConn set the AllowUseReservedConn setting. -func (session *SafeSession) SetAllowUseReservedConn(allow bool) { +// SetSessionEnableSystemSettings set the SessionEnableSystemSettings setting. +func (session *SafeSession) SetSessionEnableSystemSettings(allow bool) { session.mu.Lock() defer session.mu.Unlock() - session.UseReservedConnection = allow + session.EnableSystemSettings = allow } -// GetAllowUseReservedConn returns the AllowUseReservedConn value. -func (session *SafeSession) GetAllowUseReservedConn() bool { +// GetSessionEnableSystemSettings returns the SessionEnableSystemSettings value. +func (session *SafeSession) GetSessionEnableSystemSettings() bool { session.mu.Lock() defer session.mu.Unlock() - return session.UseReservedConnection + return session.EnableSystemSettings } // SetReadAfterWriteGTID set the ReadAfterWriteGtid setting. diff --git a/go/vt/vtgate/vcursor_impl.go b/go/vt/vtgate/vcursor_impl.go index a945f2c7691..c110345b1b0 100644 --- a/go/vt/vtgate/vcursor_impl.go +++ b/go/vt/vtgate/vcursor_impl.go @@ -329,7 +329,7 @@ func (vc *vcursorImpl) FirstSortedKeyspace() (*vindexes.Keyspace, error) { // SysVarSetEnabled implements the ContextVSchema interface func (vc *vcursorImpl) SysVarSetEnabled() bool { - return vc.GetAllowUseReservedConn() && *sysVarSetEnabled + return vc.GetSessionEnableSystemSettings() && *sysVarSetEnabled } // KeyspaceExists provides whether the keyspace exists or not. @@ -661,15 +661,15 @@ func (vc *vcursorImpl) GetSessionUUID() string { return vc.safeSession.GetSessionUUID() } -// SetAllowUseReservedConn implements the SessionActions interface -func (vc *vcursorImpl) SetAllowUseReservedConn(allow bool) error { - vc.safeSession.SetAllowUseReservedConn(allow) +// SetSessionEnableSystemSettings implements the SessionActions interface +func (vc *vcursorImpl) SetSessionEnableSystemSettings(allow bool) error { + vc.safeSession.SetSessionEnableSystemSettings(allow) return nil } -// GetAllowUseReservedConn implements the SessionActions interface -func (vc *vcursorImpl) GetAllowUseReservedConn() bool { - return vc.safeSession.GetAllowUseReservedConn() +// GetSessionEnableSystemSettings implements the SessionActions interface +func (vc *vcursorImpl) GetSessionEnableSystemSettings() bool { + return vc.safeSession.GetSessionEnableSystemSettings() } // SetReadAfterWriteGTID implements the SessionActions interface diff --git a/proto/vtgate.proto b/proto/vtgate.proto index a36b87f959f..61ec3d7211a 100644 --- a/proto/vtgate.proto +++ b/proto/vtgate.proto @@ -144,8 +144,8 @@ message Session { // Session UUID string SessionUUID = 22; - // use_reserved_connection defines if we can use reserved connections. - bool use_reserved_connection = 23; + // enable_system_settings defines if we can use reserved connections. + bool enable_system_settings = 23; } // ReadAfterWrite contains information regarding gtid set and timeout From f962627dbd19595f152ee86bb8c551e5eefd2d7c Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Mon, 18 Jan 2021 18:14:48 +0100 Subject: [PATCH 6/9] modified session enable_sys_setting default value Signed-off-by: Florent Poinsard --- go/vt/vtgate/plugin_mysql_server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/vt/vtgate/plugin_mysql_server.go b/go/vt/vtgate/plugin_mysql_server.go index 82655a4871b..dce5e5f37e4 100644 --- a/go/vt/vtgate/plugin_mysql_server.go +++ b/go/vt/vtgate/plugin_mysql_server.go @@ -345,7 +345,7 @@ func (vh *vtgateHandler) session(c *mysql.Conn) *vtgatepb.Session { Autocommit: true, DDLStrategy: *defaultDDLStrategy, SessionUUID: u.String(), - EnableSystemSettings: true, + EnableSystemSettings: *sysVarSetEnabled, } if c.Capabilities&mysql.CapabilityClientFoundRows != 0 { session.Options.ClientFoundRows = true From bb76bbfe796741480addf31cec7d24b948e3cb4f Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Tue, 19 Jan 2021 17:23:17 +0100 Subject: [PATCH 7/9] changed SysVarSetEnabled condition Signed-off-by: Florent Poinsard --- go/vt/vtgate/vcursor_impl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go/vt/vtgate/vcursor_impl.go b/go/vt/vtgate/vcursor_impl.go index c110345b1b0..1d9ac6ca76c 100644 --- a/go/vt/vtgate/vcursor_impl.go +++ b/go/vt/vtgate/vcursor_impl.go @@ -329,7 +329,7 @@ func (vc *vcursorImpl) FirstSortedKeyspace() (*vindexes.Keyspace, error) { // SysVarSetEnabled implements the ContextVSchema interface func (vc *vcursorImpl) SysVarSetEnabled() bool { - return vc.GetSessionEnableSystemSettings() && *sysVarSetEnabled + return vc.GetSessionEnableSystemSettings() } // KeyspaceExists provides whether the keyspace exists or not. From ebf4d931d3b2234234785d580ed33cb8d2cd034d Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Tue, 19 Jan 2021 21:25:51 +0100 Subject: [PATCH 8/9] addition of endtoend tests for enable system settings variable Signed-off-by: Florent Poinsard --- .../vtgate/reservedconn/sysvar_test.go | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/go/test/endtoend/vtgate/reservedconn/sysvar_test.go b/go/test/endtoend/vtgate/reservedconn/sysvar_test.go index 19af2cdc4d2..74a32bd083c 100644 --- a/go/test/endtoend/vtgate/reservedconn/sysvar_test.go +++ b/go/test/endtoend/vtgate/reservedconn/sysvar_test.go @@ -319,3 +319,38 @@ func TestSetSystemVarInTxWithConnError(t *testing.T) { // subsequent queries on 80- will pass assertMatches(t, conn, "select id, @@sql_safe_updates from test where id = 4", "[[INT64(4) INT64(1)]]") } + +func TestEnableSystemSettings(t *testing.T) { + vtParams := mysql.ConnParams{ + Host: "localhost", + Port: clusterInstance.VtgateMySQLPort, + } + conn, err := mysql.Connect(context.Background(), &vtParams) + require.NoError(t, err) + defer conn.Close() + + // Insert a single row to correctly select @@enable_system_settings. + // See: https://github.com/vitessio/vitess/issues/7301 + checkedExec(t, conn, "delete from test") + checkedExec(t, conn, "insert into test (id, val1, val2, val3) values (1, null, 0, 0)") + + // test set @@enable_system_settings to false and true + checkedExec(t, conn, "set enable_system_settings = false") + assertMatches(t, conn, `select @@enable_system_settings from test`, `[[INT64(0)]]`) + checkedExec(t, conn, "set enable_system_settings = true") + assertMatches(t, conn, `select @@enable_system_settings from test`, `[[INT64(1)]]`) + + // prepare the @@sql_mode variable + checkedExec(t, conn, "set sql_mode = 'NO_ZERO_DATE'") + assertMatches(t, conn, "select @@sql_mode", `[[VARCHAR("NO_ZERO_DATE")]]`) + + // check disabling @@enable_system_settings + checkedExec(t, conn, "set enable_system_settings = false") + checkedExec(t, conn, "set sql_mode = ''") // attempting to set @@sql_mode to an empty string + assertMatches(t, conn, "select @@sql_mode", `[[VARCHAR("NO_ZERO_DATE")]]`) // @@sql_mode did not change + + // check enabling @@enable_system_settings + checkedExec(t, conn, "set enable_system_settings = true") + checkedExec(t, conn, "set sql_mode = ''") // changing @@sql_mode to empty string + assertMatches(t, conn, "select @@sql_mode", `[[VARCHAR("")]]`) // @@sql_mode did change +} From 4bfaf2d956c5ad675301a1b6d823c802000575d8 Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Tue, 19 Jan 2021 21:32:57 +0100 Subject: [PATCH 9/9] addition of @@enable_system_settings in TestSelectSystemVariables Signed-off-by: Florent Poinsard --- go/vt/vtgate/executor_select_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/go/vt/vtgate/executor_select_test.go b/go/vt/vtgate/executor_select_test.go index d5783b070ce..48945d68c6f 100644 --- a/go/vt/vtgate/executor_select_test.go +++ b/go/vt/vtgate/executor_select_test.go @@ -327,7 +327,7 @@ func TestSelectSystemVariables(t *testing.T) { logChan := QueryLogger.Subscribe("Test") defer QueryLogger.Unsubscribe(logChan) - sql := "select @@autocommit, @@client_found_rows, @@skip_query_plan_cache, " + + sql := "select @@autocommit, @@client_found_rows, @@skip_query_plan_cache, @@enable_system_settings, " + "@@sql_select_limit, @@transaction_mode, @@workload, @@read_after_write_gtid, " + "@@read_after_write_timeout, @@session_track_gtids, @@ddl_strategy" @@ -337,6 +337,7 @@ func TestSelectSystemVariables(t *testing.T) { {Name: "@@autocommit", Type: sqltypes.Int32}, {Name: "@@client_found_rows", Type: sqltypes.Int32}, {Name: "@@skip_query_plan_cache", Type: sqltypes.Int32}, + {Name: "@@enable_system_settings", Type: sqltypes.Int32}, {Name: "@@sql_select_limit", Type: sqltypes.Int64}, {Name: "@@transaction_mode", Type: sqltypes.VarBinary}, {Name: "@@workload", Type: sqltypes.VarBinary}, @@ -351,6 +352,7 @@ func TestSelectSystemVariables(t *testing.T) { sqltypes.NULL, sqltypes.NULL, sqltypes.NULL, + sqltypes.NULL, sqltypes.NewInt64(0), sqltypes.NewVarBinary("UNSPECIFIED"), sqltypes.NewVarBinary(""),