Skip to content

Comments

fix: don't stop client connection when parameter status is updated#666

Merged
v0idpwn merged 10 commits intomainfrom
postgres-switching
Jun 26, 2025
Merged

fix: don't stop client connection when parameter status is updated#666
v0idpwn merged 10 commits intomainfrom
postgres-switching

Conversation

@v0idpwn
Copy link
Member

@v0idpwn v0idpwn commented Jun 17, 2025

Instead of stopping the client connection, just continue with the greeting process, with the new parameter status.

Also adds a test script that performs a pseudo postgres update. In the original code, the query must be retried on Supavisor because the first connection attempt fails. After the patch, no retries are needed.

Discovered in #663.

@v0idpwn v0idpwn requested a review from a team as a code owner June 17, 2025 17:28
Copy link
Contributor

@abc3 abc3 left a comment

Choose a reason for hiding this comment

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

With the changes, if the database version updates, only the server_version parameter is forwarded to clients in the status message. However, there are other important fields such as client_encoding, server_encoding, TimeZone, and others.

There is no need to send new_ps because all necessary information is already available in encoded_ps, which is already in iodata format.

Also, there is already a directory for e2e - test/integration

@v0idpwn
Copy link
Member Author

v0idpwn commented Jun 18, 2025

Thank you for the review, @abc3. Yeah, it felt wrong. I'll dive a bit deeper into it once I'm done with other stuff.

changed_parameters ->
Logger.warning("Changed parameters: #{inspect(changed_parameters)}")

# TODO: should we update all? Previously we only updated server version

Check warning

Code scanning / Credo

Found a TODO tag in a comment: # TODO: should we update all? Previously we only updated server version Warning

Found a TODO tag in a comment: # TODO: should we update all? Previously we only updated server version
@v0idpwn
Copy link
Member Author

v0idpwn commented Jun 26, 2025

Hi, @abc3, I'll go ahead and merge this, but if you have any further feedback, let me know. Thank you again!

I plan to extract the test script into a proper integration test, I'm working on this concurrently, but want to ship the code fix.

@v0idpwn v0idpwn enabled auto-merge (squash) June 26, 2025 20:26
@v0idpwn v0idpwn merged commit 5778e7f into main Jun 26, 2025
12 checks passed
@v0idpwn v0idpwn deleted the postgres-switching branch June 26, 2025 20:38
@abc3
Copy link
Contributor

abc3 commented Jun 27, 2025

hey @v0idpwn, looks good to me!

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