Skip to content
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

Improve logging for connection cleanup #428

Merged

Conversation

zainkabani
Copy link
Contributor

Adds logging to identify why we are doing server connection cleanup and which application is responsible for it

Example log:

[2023-05-05T22:54:53.201620Z WARN  pgcat::server] Server returned with session state altered, discarding state (SET: true, PREPARE: false) for application psql

@@ -103,6 +103,48 @@ impl StreamInner {
}
}

#[derive(Copy, Clone)]
struct CleanupState {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non blocking: would be cool to track all the session variables the user has set and print them :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The command tag (server response) is how we determine if there was a set statement or not. It does not include the actual variable that was set unfortunately so we'd have to parse the SET query and then do a few other things there to get it to log. Not trivial to add that in this PR, but I'd love to have that visibility

@zainkabani zainkabani marked this pull request as draft May 10, 2023 19:16
@zainkabani zainkabani marked this pull request as ready for review May 10, 2023 19:16
@levkk levkk merged commit 0907f1b into postgresml:main May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants