-
Notifications
You must be signed in to change notification settings - Fork 425
feat: implement cancel request on postgres protocol #6338
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
efdbc20 to
168979b
Compare
Signed-off-by: Ning Sun <[email protected]>
8c2dff2 to
481c27d
Compare
|
I will have to hold this implementation until postgres protocol 3.2 postgres/postgres@a460251 which makes the cancel key a little bit longer so we can carry enough information to identify the connection. |
Signed-off-by: Ning Sun <[email protected]>
d4f4689 to
2f8240e
Compare
|
Let me share more details about the status of this pull request. First you may want to learn more about how cancel works in postgres https://www.postgresql.org/docs/18/protocol-flow.html#PROTOCOL-FLOW-CANCELING-REQUESTS I just implemented postgres protocol 3.2 cancel request in this PR. This feature is expected to land on postgres in 18beta2. The client support may vary due to the variety of ecosystem. In the current implementation, we use extra bytes to carry additional information required to kill a request in a multi-tenant, distributed database. The bytes includes:
The whole idea is to be able to identify the connection in a distributed environment, where multiple frontends running postgres protocol. The cancel request may arrive at any random instance, and we will use RPC between frontends to send the cancel request. There are more tasks:
|
|
I'm considering removing catalog from rpc calls of east-west frontend communication, as well as secret key, because the process id is already a unique number. We may also validation cancel request are sent from same IP as original connection. |
I hereby agree to the terms of the GreptimeDB CLA.
Refer to a related PR or issue link (optional)
What's changed and what's your intention?
This patch implements cancel request on postgres protocol so the server can respond ctrl+c in psql.
PR Checklist
Please convert it to a draft if some of the following conditions are not met.