Enhance lifecheck log. master
authorTatsuo Ishii <ishii@postgresql.org>
Sat, 14 Jun 2025 11:54:13 +0000 (20:54 +0900)
committerTatsuo Ishii <ishii@postgresql.org>
Sat, 14 Jun 2025 11:54:13 +0000 (20:54 +0900)
Previously when wd_lifecheck_method = 'query', life checking prints
SQL without application name if "%a" is specified in
log_line_prefix. This commit add application_name "lifecheck_ping" to
make the log looks better.  Since this changes user visible behavior,
I do not apply this to stable branches.

Discussion: [pgpool-hackers: 4603] life check log is not nice
https://www.pgpool.net/pipermail/pgpool-hackers/2025-June/004604.html

src/watchdog/wd_lifecheck.c

index c399128b4c5f2bd15cdf6b4ea2840ce36b4ef321..ce99a4000459bc0626790d906a1e589dec9bf16f 100644 (file)
@@ -6,7 +6,7 @@
  * pgpool: a language independent connection pool server for PostgreSQL
  * written by Tatsuo Ishii
  *
- * Copyright (c) 2003-2022     PgPool Global Development Group
+ * Copyright (c) 2003-2025     PgPool Global Development Group
  *
  * Permission to use, copy, modify, and distribute this software and
  * its documentation for any purpose and without fee is hereby
@@ -943,13 +943,15 @@ create_conn(char *hostname, int port, char *password)
        }
 
        snprintf(conninfo, sizeof(conninfo),
-                        "host='%s' port='%d' dbname='%s' user='%s' password='%s' connect_timeout='%d'",
+                        "host='%s' port='%d' dbname='%s' user='%s' password='%s' connect_timeout='%d' application_name='%s'",
                         hostname,
                         port,
                         pool_config->wd_lifecheck_dbname,
                         pool_config->wd_lifecheck_user,
                         password ? password : "",
-                        pool_config->wd_interval / 2 + 1);
+                        pool_config->wd_interval / 2 + 1,
+                        "lifecheck_ping");
+
        conn = PQconnectdb(conninfo);
 
        if (PQstatus(conn) != CONNECTION_OK)