Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
reshke committed Jun 8, 2023
1 parent df22e80 commit 114bd57
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion router/pkg/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (r *InstanceImpl) serv(netconn net.Conn) error {
}

if routerClient.CancelMsg() != nil {
return r.RuleRouter.CancelCleint(routerClient.CancelMsg())
return r.RuleRouter.CancelClient(routerClient.CancelMsg())
}

spqrlog.Logger.Printf(spqrlog.DEBUG2, "client %p: prerouting phase succeeded", routerClient)
Expand Down
12 changes: 5 additions & 7 deletions router/pkg/rulerouter/rulerouter.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ type RuleRouter interface {
AddWorldShard(key qdb.ShardKey) error
AddShardInstance(key qdb.ShardKey, host string)

CancelCleint(csm *pgproto3.CancelRequest) error
AddClient(
cl rclient.RouterClient)
CancelClient(csm *pgproto3.CancelRequest) error
AddClient(cl rclient.RouterClient)

ReleaseClient(
cl rclient.RouterClient)
ReleaseClient(cl rclient.RouterClient)

Config() *config.Router
}
Expand Down Expand Up @@ -278,13 +276,13 @@ func (r *RuleRouterImpl) ReleaseClient(cl rclient.RouterClient) {
delete(r.clmp, cl.GetCancelPid())
}

func (r *RuleRouterImpl) CancelCleint(csm *pgproto3.CancelRequest) error {
func (r *RuleRouterImpl) CancelClient(csm *pgproto3.CancelRequest) error {
r.clmu.Lock()
defer r.clmu.Unlock()

if cl, ok := r.clmp[csm.ProcessID]; ok {
if cl.GetCancelKey() != csm.SecretKey {
return fmt.Errorf("cancel sekret does not match")
return fmt.Errorf("cancel secret does not match")
}
if cl.Server() != nil {
spqrlog.Logger.Printf(spqrlog.DEBUG1, "cancelling client pid %d", csm.ProcessID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ NOTICE: send query to shard(s) : sh2
SELECT pg_is_in_recovery() /* target-session-attrs: read-only */ , id FROM tsa_test WHERE id = 22;
NOTICE: send query to shard(s) : sh2
ERROR: failed to find replica
message type 0x5a arrived from server while idle
ERROR: failed to find replica

0 comments on commit 114bd57

Please sign in to comment.