diff --git a/lib/gat/database/query_router/query_router.go b/lib/gat/database/query_router/query_router.go index 722ca3185562917104d4a47499a93045ddf36633..760eeb3c0bd76dbb6813258511b6e4265ccc16ec 100644 --- a/lib/gat/database/query_router/query_router.go +++ b/lib/gat/database/query_router/query_router.go @@ -98,7 +98,8 @@ func (r *QueryRouter) InferRole(query string) (config.ServerRole, error) { lex.KeywordTruncate, lex.KeywordVacuum, lex.KeywordAnalyze, - lex.KeywordAlter: + lex.KeywordAlter, + lex.KeywordGrant: return config.SERVERROLE_PRIMARY, nil case lex.KeywordBegin: depth += 1 diff --git a/lib/gat/pool/transaction/worker.go b/lib/gat/pool/transaction/worker.go index 30d0843623387b24423a1e6041f029ed387bea8d..94a3083aa85d221665de8c142c25ac2ede43d6c8 100644 --- a/lib/gat/pool/transaction/worker.go +++ b/lib/gat/pool/transaction/worker.go @@ -103,7 +103,7 @@ func (w *worker) GetServerInfo(client gat.Client) []*protocol.ParameterStatus { func (w *worker) HandleDescribe(ctx context.Context, c gat.Client, d *protocol.Describe) error { defer w.ret() - if w.w.user.StatementTimeout == 0 { + if w.w.user.StatementTimeout != 0 { ctx, _ = context.WithTimeout(ctx, time.Duration(w.w.user.StatementTimeout)*time.Millisecond) } @@ -127,7 +127,7 @@ func (w *worker) HandleDescribe(ctx context.Context, c gat.Client, d *protocol.D func (w *worker) HandleExecute(ctx context.Context, c gat.Client, e *protocol.Execute) error { defer w.ret() - if w.w.user.StatementTimeout == 0 { + if w.w.user.StatementTimeout != 0 { ctx, _ = context.WithTimeout(ctx, time.Duration(w.w.user.StatementTimeout)*time.Millisecond) }