GoogleCloudPlatform / pgadapter

PostgreSQL wire-protocol proxy for Cloud Spanner
https://cloud.google.com/spanner/docs/postgresql-interface#postgresql-client-support
Apache License 2.0
51 stars 19 forks source link

feat: return exit code 0 on successful shutdown #2014

Open olavloite opened 2 weeks ago

olavloite commented 2 weeks ago

The default behavior of Java applications is to return exit code 128 + signal if the application was shut down due to receiving a signal. This means that SIGINT returns 130 and SIGTERM returns 143.

This change modifies this behavior so exit code 0 is returned if the shutdown is successful. The old behavior that returns the JVM default can be restored by starting PGAdapter with the -exit_mode startup argument.

This also prepares the server for adding Smart Shutdown mode, which will allow the server to start refusing new connections, while giving existing connections time to finish their work. See https://www.postgresql.org/docs/current/server-shutdown.html for more information on Smart Shutdown.