-
Notifications
You must be signed in to change notification settings - Fork 172
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
Clean connection state up after protocol named prepared statement #163
Clean connection state up after protocol named prepared statement #163
Conversation
let _ = final_buffer.get_i32() as usize; | ||
|
||
// Almost certainly true | ||
if first_message_code == 'P' { |
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.
Why not run this check in 'P' => {
block? Should be cheaper than cloning the entire buffer (which can be very large) every S
(effectively every query).
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.
Also, aren't all Postgres strings NULL-terminated, so this check would never fire?
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.
Good point on the clone, the reason I run this in the S
and not in the P
is that we have two places where we handle P
buffering so I am trying to avoid duplication. Let me see if we can get away with no clones.
re: NULL-terminated
, we only care about the first byte after P
and the 32bit size. If it is \0
the this is an unnamed prepared statement, anything else would be interpreted as a named prepared statement.
I made a change to access the buffer without cloning. Using |
Pretty cool! |
Avoid reporting ProtocolSyncError when admin session disconnects (postgresml#160) Better logging for failure to get connection from pool (postgresml#161) Send signal even if process is gone (postgresml#162) Clean connection state up after protocol named prepared statement (postgresml#163) Add Discord link (postgresml#164) Add SHOW CLIENTS / SHOW SERVERS + Stats refactor and tests (postgresml#159)
We only send
DISCARD ALL
if we created a named prepared statement or issued aSET xxx
query. This PR catches an edge case when we create named prepared statements usingP
message.