You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The --max-sigterm-delay flag is crucial for microservices that require a graceful shutdown period to ensure ongoing transactions are completed successfully. This flag allows the microservice to remain operational for a specified duration after receiving a termination signal (SIGTERM), granting sufficient time for its database connector to remain active and handle pending transactions.
flag
description
--max-sigterm-delay
Maximum number of seconds to wait for connections to close after receiving a TERM signal.
Register signal handlers for SIGTERM, SIGINT, and SIGQUIT to allow
graceful shutdown, and add support for the SMART shutdown mode
from PostgreSQL. The SMART shutdown mode allows the server to
drain connections and shut down after all connections have closed.
Updates #2040
Updates #1189
Version 0.38.0 that was shipped recently improved shutdown handling:
SIGTERM: This initiates the SMART shutdown mode. In this mode, all new connection requests will be refused, but existing connections are allowed to continue. PGAdapter shuts down when all connections have been closed.
SIGINT: This initiates the FAST shutdown mode. This closes all existing connections and shuts down PGAdapter.
SIGQUIT: (This is relatively theoretical, as JVMs do not allow applications to register a handler for SIGQUIT.) SIGQUIT initiates the IMMEDIATE shutdown mode. For PGAdapter, this is largely the same as the FAST shutdown mode, with the only exception that in IMMEDIATE shutdown mode, PGAdapter does not wait for the internal Spanner session pool to be cleaned up.
The above is designed to align as much as possible with https://www.postgresql.org/docs/current/server-shutdown.html. You can 'upgrade' from SMART to FAST shutdown mode by first sending PGAdapter a SIGTERM, then wait X seconds, and then send it a SIGINT.
The
--max-sigterm-delay
flag is crucial for microservices that require a graceful shutdown period to ensure ongoing transactions are completed successfully. This flag allows the microservice to remain operational for a specified duration after receiving a termination signal (SIGTERM), granting sufficient time for its database connector to remain active and handle pending transactions.Disclaimer: The name of the flag and the description are copied from the https://github.com/GoogleCloudPlatform/cloud-sql-proxy
Implementing this feature will smoothen the transition from Postgres to Spanner.
The text was updated successfully, but these errors were encountered: