-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
sql, pgwire: cancel sessions better #30813
Conversation
... and comments around the SessionRegistry. Release note: None
Before this patch, `cancel session <foo>` would cause a connExecutor's context to be canceled. This patch switches it to cancel the pgwire connection's ctx instead (which was a parent of the connExecutor's ctx; now the two are the same), as nature intended. For example, reading from the network connection should stop ASAP after `cancel session`. It also opens to door to guaranteeing that the client using the respective session is unblocked in a timely manner (by the server closing the network connection), although that is not currently implemented (pgwire will still wait for the connExecutor to react to cancelation and finish its task before closing the net.Conn). This patch also eliminates what I presume to have been a crash when someone tries to cancel a "session" created by the InternalExecutor. It will now be a no-op. This patch also moves a cancelation callback out of connExecutor.ctxHolder. I'm trying to get rid of that guy, which is how this patch came to be. I've also added a TODO with some thoughts on a better design for session cancelation, originally expressed in cockroachdb#23861 (comment). FWIW, I've tried to be the change, but gave up for the moment. Release note: None
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1, 2 of 2 files at r2.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+
Reviewable status: complete! 1 of 0 LGTMs obtained
Build failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+
Reviewable status: complete! 1 of 0 LGTMs obtained
30813: sql, pgwire: cancel sessions better r=andreimatei a=andreimatei Before this patch, `cancel session <foo>` would cause a connExecutor's context to be canceled. This patch switches it to cancel the pgwire connection's ctx instead (which was a parent of the connExecutor's ctx; now the two are the same), as nature intended. For example, reading from the network connection should stop ASAP after `cancel session`. It also opens to door to guaranteeing that the client using the respective session is unblocked in a timely manner (by the server closing the network connection), although that is not currently implemented (pgwire will still wait for the connExecutor to react to cancelation and finish its task before closing the net.Conn). This patch also eliminates what I presume to have been a crash when someone tries to cancel a "session" created by the InternalExecutor. It will now be a no-op. This patch also moves a cancelation callback out of connExecutor.ctxHolder. I'm trying to get rid of that guy, which is how this patch came to be. I've also added a TODO with some thoughts on a better design for session cancelation, originally expressed in #23861 (comment). FWIW, I've tried to be the change, but gave up for the moment. Release note: None Co-authored-by: Andrei Matei <[email protected]>
Build succeeded |
I would recommend a backport for this. |
(To go together with #31002) |
You sure you want to backport 31002? It seems like a pretty large change...
But if you do and you need this one for it, feel free to lump it in as far
as I'm concerned.
…On Fri, Oct 5, 2018, 6:51 AM kena ***@***.***> wrote:
(To go together with #31002
<#31002>)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#30813 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAXBcf9TIftYtc2twYckOrTntFCPR8PFks5uhzmXgaJpZM4XBXbp>
.
|
Before this patch,
cancel session <foo>
would cause a connExecutor'scontext to be canceled. This patch switches it to cancel the pgwire
connection's ctx instead (which was a parent of the connExecutor's ctx;
now the two are the same), as nature intended. For example, reading from
the network connection should stop ASAP after
cancel session
. It alsoopens to door to guaranteeing that the client using the respective
session is unblocked in a timely manner (by the server closing the
network connection), although that is not currently implemented (pgwire
will still wait for the connExecutor to react to cancelation and finish
its task before closing the net.Conn).
This patch also eliminates what I presume to have been a crash when
someone tries to cancel a "session" created by the InternalExecutor. It
will now be a no-op.
This patch also moves a cancelation callback out of
connExecutor.ctxHolder. I'm trying to get rid of that guy, which is how
this patch came to be.
I've also added a TODO with some thoughts on a better design for session
cancelation, originally expressed in
#23861 (comment).
FWIW, I've tried to be the change, but gave up for the moment.
Release note: None