Skip to content

Conversation

DarkStar1982
Copy link

@DarkStar1982 DarkStar1982 commented Sep 24, 2025

Allows hot patching the new executable file into the same process using "execv" command

How to use:

  1. run pgdog
  2. run ps | grep "pgdog" (or pgrep "pgdog") to find its process id (PID)
  3. run kill -USR1 [PID] will send SIGUSR1 to listener in pgdog to trigger "execv" command
  4. watch the new executable starting up while keeping the current process id
  5. run ps | grep "pgdog" or pgrep "pgdog" to confirm that process id didn't change

Repeat as many times as needed. You can use "cargo build" to create a new executable instance and hot-load it at any time into the same process.

@CLAassistant
Copy link

CLAassistant commented Sep 24, 2025

CLA assistant check
All committers have signed the CLA.

@levkk
Copy link
Collaborator

levkk commented Sep 24, 2025

Hey, thanks for your contribution. The trick with this one is we have to restore pgdog to the same state it was before the restart:

  1. Client and server connections must be maintained and be in the same state
  2. Prepared statements cache must be maintained
  3. Query cache, used for query routing, ideally should be maintained to avoid latency spikes

This requires serializing the state of the app and passing it down to the new process to "re-hydrate" the process.

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